diff --git a/sdk/resourcemanager/migrate/armmigrate/CHANGELOG.md b/sdk/resourcemanager/migrate/armmigrate/CHANGELOG.md index b243725c65cf..023b0b626323 100644 --- a/sdk/resourcemanager/migrate/armmigrate/CHANGELOG.md +++ b/sdk/resourcemanager/migrate/armmigrate/CHANGELOG.md @@ -1,5 +1,260 @@ # Release History +## 2.0.0-beta.1 (2025-04-11) +### Breaking Changes + +- Type of `Operation.Origin` has been changed from `*string` to `*Origin` +- `MachineBootTypeBIOS` from enum `MachineBootType` has been removed +- `ProvisioningStateCreating`, `ProvisioningStateMoving` from enum `ProvisioningState` has been removed +- Enum `AssessmentStage` has been removed +- Enum `AzureDiskSize` has been removed +- Enum `AzureDiskSuitabilityDetail` has been removed +- Enum `AzureDiskSuitabilityExplanation` has been removed +- Enum `AzureNetworkAdapterSuitabilityDetail` has been removed +- Enum `AzureNetworkAdapterSuitabilityExplanation` has been removed +- Enum `AzureOfferCode` has been removed +- Enum `AzureVMSize` has been removed +- Enum `AzureVMSuitabilityDetail` has been removed +- Enum `AzureVMSuitabilityExplanation` has been removed +- Enum `CloudSuitability` has been removed +- Enum `Currency` has been removed +- Enum `GroupStatus` has been removed +- Enum `GroupUpdateOperation` has been removed +- Enum `PrivateEndpointConnectionPropertiesProvisioningState` has been removed +- Enum `PrivateLinkServiceConnectionStateStatus` has been removed +- Enum `ProjectStatus` has been removed +- Enum `ReservedInstance` has been removed +- Function `NewAssessedMachinesClient` has been removed +- Function `*AssessedMachinesClient.Get` has been removed +- Function `*AssessedMachinesClient.NewListByAssessmentPager` has been removed +- Function `NewAssessmentsClient` has been removed +- Function `*AssessmentsClient.Create` has been removed +- Function `*AssessmentsClient.Delete` has been removed +- Function `*AssessmentsClient.Get` has been removed +- Function `*AssessmentsClient.GetReportDownloadURL` has been removed +- Function `*AssessmentsClient.NewListByGroupPager` has been removed +- Function `*AssessmentsClient.NewListByProjectPager` has been removed +- Function `*ClientFactory.NewAssessedMachinesClient` has been removed +- Function `*ClientFactory.NewAssessmentsClient` has been removed +- Function `*ClientFactory.NewGroupsClient` has been removed +- Function `*ClientFactory.NewHyperVCollectorsClient` has been removed +- Function `*ClientFactory.NewImportCollectorsClient` has been removed +- Function `*ClientFactory.NewMachinesClient` has been removed +- Function `*ClientFactory.NewPrivateEndpointConnectionClient` has been removed +- Function `*ClientFactory.NewPrivateLinkResourceClient` has been removed +- Function `*ClientFactory.NewProjectsClient` has been removed +- Function `*ClientFactory.NewServerCollectorsClient` has been removed +- Function `*ClientFactory.NewVMwareCollectorsClient` has been removed +- Function `NewGroupsClient` has been removed +- Function `*GroupsClient.Create` has been removed +- Function `*GroupsClient.Delete` has been removed +- Function `*GroupsClient.Get` has been removed +- Function `*GroupsClient.NewListByProjectPager` has been removed +- Function `*GroupsClient.UpdateMachines` has been removed +- Function `NewHyperVCollectorsClient` has been removed +- Function `*HyperVCollectorsClient.Create` has been removed +- Function `*HyperVCollectorsClient.Delete` has been removed +- Function `*HyperVCollectorsClient.Get` has been removed +- Function `*HyperVCollectorsClient.NewListByProjectPager` has been removed +- Function `NewImportCollectorsClient` has been removed +- Function `*ImportCollectorsClient.Create` has been removed +- Function `*ImportCollectorsClient.Delete` has been removed +- Function `*ImportCollectorsClient.Get` has been removed +- Function `*ImportCollectorsClient.NewListByProjectPager` has been removed +- Function `NewMachinesClient` has been removed +- Function `*MachinesClient.Get` has been removed +- Function `*MachinesClient.NewListByProjectPager` has been removed +- Function `NewPrivateEndpointConnectionClient` has been removed +- Function `*PrivateEndpointConnectionClient.Delete` has been removed +- Function `*PrivateEndpointConnectionClient.Get` has been removed +- Function `*PrivateEndpointConnectionClient.ListByProject` has been removed +- Function `*PrivateEndpointConnectionClient.Update` has been removed +- Function `NewPrivateLinkResourceClient` has been removed +- Function `*PrivateLinkResourceClient.Get` has been removed +- Function `*PrivateLinkResourceClient.ListByProject` has been removed +- Function `NewProjectsClient` has been removed +- Function `*ProjectsClient.AssessmentOptions` has been removed +- Function `*ProjectsClient.NewAssessmentOptionsListPager` has been removed +- Function `*ProjectsClient.Create` has been removed +- Function `*ProjectsClient.Delete` has been removed +- Function `*ProjectsClient.Get` has been removed +- Function `*ProjectsClient.NewListBySubscriptionPager` has been removed +- Function `*ProjectsClient.NewListPager` has been removed +- Function `*ProjectsClient.Update` has been removed +- Function `NewServerCollectorsClient` has been removed +- Function `*ServerCollectorsClient.Create` has been removed +- Function `*ServerCollectorsClient.Delete` has been removed +- Function `*ServerCollectorsClient.Get` has been removed +- Function `*ServerCollectorsClient.NewListByProjectPager` has been removed +- Function `NewVMwareCollectorsClient` has been removed +- Function `*VMwareCollectorsClient.Create` has been removed +- Function `*VMwareCollectorsClient.Delete` has been removed +- Function `*VMwareCollectorsClient.Get` has been removed +- Function `*VMwareCollectorsClient.NewListByProjectPager` has been removed +- Struct `AssessedDisk` has been removed +- Struct `AssessedMachine` has been removed +- Struct `AssessedMachineProperties` has been removed +- Struct `AssessedMachineResultList` has been removed +- Struct `AssessedNetworkAdapter` has been removed +- Struct `Assessment` has been removed +- Struct `AssessmentOptions` has been removed +- Struct `AssessmentOptionsProperties` has been removed +- Struct `AssessmentOptionsResultList` has been removed +- Struct `AssessmentProperties` has been removed +- Struct `AssessmentResultList` has been removed +- Struct `CollectorAgentProperties` has been removed +- Struct `CollectorBodyAgentSpnProperties` has been removed +- Struct `CollectorProperties` has been removed +- Struct `Disk` has been removed +- Struct `Group` has been removed +- Struct `GroupBodyProperties` has been removed +- Struct `GroupProperties` has been removed +- Struct `GroupResultList` has been removed +- Struct `HyperVCollector` has been removed +- Struct `HyperVCollectorList` has been removed +- Struct `ImportCollector` has been removed +- Struct `ImportCollectorList` has been removed +- Struct `ImportCollectorProperties` has been removed +- Struct `Machine` has been removed +- Struct `MachineProperties` has been removed +- Struct `MachineResultList` has been removed +- Struct `NetworkAdapter` has been removed +- Struct `OperationResultList` has been removed +- Struct `PrivateEndpointConnection` has been removed +- Struct `PrivateEndpointConnectionCollection` has been removed +- Struct `PrivateEndpointConnectionProperties` has been removed +- Struct `PrivateLinkResource` has been removed +- Struct `PrivateLinkResourceCollection` has been removed +- Struct `PrivateLinkResourceProperties` has been removed +- Struct `PrivateLinkServiceConnectionState` has been removed +- Struct `Project` has been removed +- Struct `ProjectProperties` has been removed +- Struct `ProjectResultList` has been removed +- Struct `ResourceID` has been removed +- Struct `ServerCollector` has been removed +- Struct `ServerCollectorList` has been removed +- Struct `UpdateGroupBody` has been removed +- Struct `VMFamily` has been removed +- Struct `VMwareCollector` has been removed +- Struct `VMwareCollectorList` has been removed +- Field `OperationResultList` of struct `OperationsClientListResponse` has been removed + +### Features Added + +- New value `AssessmentStatusDeleted`, `AssessmentStatusFailed` added to enum type `AssessmentStatus` +- New value `AzureDiskTypePremiumV2`, `AzureDiskTypeUltra` added to enum type `AzureDiskType` +- New value `AzureLocationAustraliaCentral`, `AzureLocationAustraliaCentral2`, `AzureLocationChinaEast2`, `AzureLocationChinaNorth2`, `AzureLocationFranceCentral`, `AzureLocationFranceSouth`, `AzureLocationGermanyNorth`, `AzureLocationGermanyWestCentral`, `AzureLocationIsraelCentral`, `AzureLocationItalyNorth`, `AzureLocationJioIndiaWest`, `AzureLocationMexicoCentral`, `AzureLocationNewZealandNorth`, `AzureLocationNorwayEast`, `AzureLocationNorwayWest`, `AzureLocationPolandCentral`, `AzureLocationQatarCentral`, `AzureLocationSouthAfricaNorth`, `AzureLocationSouthAfricaWest`, `AzureLocationSpainCentral`, `AzureLocationSwedenCentral`, `AzureLocationSwitzerlandNorth`, `AzureLocationSwitzerlandWest`, `AzureLocationUAECentral`, `AzureLocationUAENorth`, `AzureLocationUsNatEast`, `AzureLocationUsNatWest`, `AzureLocationUsSecCentral`, `AzureLocationUsSecEast`, `AzureLocationUsSecWest` added to enum type `AzureLocation` +- New value `AzureVMFamilyDadsv5Series`, `AzureVMFamilyDasv4Series`, `AzureVMFamilyDasv5Series`, `AzureVMFamilyDav4Series`, `AzureVMFamilyDdsv4Series`, `AzureVMFamilyDdsv5Series`, `AzureVMFamilyDdv4Series`, `AzureVMFamilyDdv5Series`, `AzureVMFamilyDsv4Series`, `AzureVMFamilyDsv5Series`, `AzureVMFamilyDv4Series`, `AzureVMFamilyDv5Series`, `AzureVMFamilyEadsv5Series`, `AzureVMFamilyEasv4Series`, `AzureVMFamilyEasv5Series`, `AzureVMFamilyEav4Series`, `AzureVMFamilyEbdsv5Series`, `AzureVMFamilyEbsv5Series`, `AzureVMFamilyEdsv4Series`, `AzureVMFamilyEdsv5Series`, `AzureVMFamilyEdv4Series`, `AzureVMFamilyEdv5Series`, `AzureVMFamilyEsv4Series`, `AzureVMFamilyEsv5Series`, `AzureVMFamilyEv4Series`, `AzureVMFamilyEv5Series`, `AzureVMFamilyLsv2Series`, `AzureVMFamilyMdsv2Series`, `AzureVMFamilyMsv2Series`, `AzureVMFamilyMv2Series` added to enum type `AzureVMFamily` +- New value `MachineBootTypeBios`, `MachineBootTypeNotSpecified` added to enum type `MachineBootType` +- New value `PercentilePercentileUnknown` added to enum type `Percentile` +- New value `ProvisioningStateCanceled`, `ProvisioningStateProvisioning`, `ProvisioningStateUpdating` added to enum type `ProvisioningState` +- New enum type `ActionType` with values `ActionTypeInternal` +- New enum type `AssessedMachineType` with values `AssessedMachineTypeAssessedMachine`, `AssessedMachineTypeAvsAssessedMachine`, `AssessedMachineTypeSQLAssessedMachine`, `AssessedMachineTypeUnknown` +- New enum type `AssessmentSource` with values `AssessmentSourceIIS`, `AssessmentSourceMachine`, `AssessmentSourceMySQLServer`, `AssessmentSourceOracleDatabase`, `AssessmentSourceOracleServer`, `AssessmentSourceSAPInstance`, `AssessmentSourceSQLDatabase`, `AssessmentSourceSQLInstance`, `AssessmentSourceSpringbootApplication`, `AssessmentSourceTomCat`, `AssessmentSourceUnknown`, `AssessmentSourceWebApps` +- New enum type `AzureCurrency` with values `AzureCurrencyARS`, `AzureCurrencyAUD`, `AzureCurrencyBRL`, `AzureCurrencyCAD`, `AzureCurrencyCHF`, `AzureCurrencyCNY`, `AzureCurrencyDKK`, `AzureCurrencyEUR`, `AzureCurrencyGBP`, `AzureCurrencyHKD`, `AzureCurrencyIDR`, `AzureCurrencyINR`, `AzureCurrencyJPY`, `AzureCurrencyKRW`, `AzureCurrencyMXN`, `AzureCurrencyMYR`, `AzureCurrencyNOK`, `AzureCurrencyNZD`, `AzureCurrencyRUB`, `AzureCurrencySAR`, `AzureCurrencySEK`, `AzureCurrencyTRY`, `AzureCurrencyTWD`, `AzureCurrencyUSD`, `AzureCurrencyUnknown`, `AzureCurrencyZAR` +- New enum type `AzureManagementOfferingType` with values `AzureManagementOfferingTypeAUM`, `AzureManagementOfferingTypeAzMon`, `AzureManagementOfferingTypeAzureBackup`, `AzureManagementOfferingTypeNo`, `AzureManagementOfferingTypeSCOMMI` +- New enum type `AzureOffer` with values `AzureOfferEA`, `AzureOfferMsazr0003P`, `AzureOfferMsazr0023P`, `AzureOfferMsazrusgov0003P`, `AzureOfferMsmcazr0044P`, `AzureOfferMsmcazr0059P`, `AzureOfferMsmcazr0060P`, `AzureOfferMsmcazr0063P`, `AzureOfferSavingsPlan1Year`, `AzureOfferSavingsPlan3Year`, `AzureOfferUnknown` +- New enum type `AzureSecurityOfferingType` with values `AzureSecurityOfferingTypeMDC`, `AzureSecurityOfferingTypeNO` +- New enum type `AzureTarget` with values `AzureTargetAKS`, `AzureTargetAvs`, `AzureTargetAzureAppService`, `AzureTargetAzureAppServiceContainer`, `AzureTargetAzureSQLVM`, `AzureTargetAzureSpringApps`, `AzureTargetAzureVM`, `AzureTargetFlexServerPG`, `AzureTargetMySQLAzureFlexServer`, `AzureTargetOracleIaasVM`, `AzureTargetSAPAzureInstance`, `AzureTargetSQLDatabase`, `AzureTargetSQLMI`, `AzureTargetUnknown` +- New enum type `AzureVMSecuritySuitabilityDetail` with values `AzureVMSecuritySuitabilityDetailAllDiskSizeExceeds2TB`, `AzureVMSecuritySuitabilityDetailAllDiskSizeExceeds4TB`, `AzureVMSecuritySuitabilityDetailAnyDiskSizeExceeds4TB`, `AzureVMSecuritySuitabilityDetailAnyDiskSizeExceeds4TBConditional`, `AzureVMSecuritySuitabilityDetailBootTypeNotSupported`, `AzureVMSecuritySuitabilityDetailDiskSize2TBConditionalReadyBiosBoot`, `AzureVMSecuritySuitabilityDetailDiskSizeLarge`, `AzureVMSecuritySuitabilityDetailGuestOperatingSystemNotSupported`, `AzureVMSecuritySuitabilityDetailNotApplicable`, `AzureVMSecuritySuitabilityDetailOSNameCannotBeRead`, `AzureVMSecuritySuitabilityDetailOSNotSupported`, `AzureVMSecuritySuitabilityDetailStandardCanMigrate`, `AzureVMSecuritySuitabilityDetailStandardCannotMigrateOSNotSupported`, `AzureVMSecuritySuitabilityDetailStandardNotReady2TBBiosBoot`, `AzureVMSecuritySuitabilityDetailStandardNotReadyOSNotSupported`, `AzureVMSecuritySuitabilityDetailStandardReady`, `AzureVMSecuritySuitabilityDetailTVMCanMigrateConditional`, `AzureVMSecuritySuitabilityDetailTVMCannotMigrateOSNotSupported`, `AzureVMSecuritySuitabilityDetailTVMNotReadyOSNotSupported`, `AzureVMSecuritySuitabilityDetailTVMNotSupportedForBiosBoot`, `AzureVMSecuritySuitabilityDetailTVMReady`, `AzureVMSecuritySuitabilityDetailUnknown` +- New enum type `AzureVMSecurityType` with values `AzureVMSecurityTypeCVM`, `AzureVMSecurityTypeStandard`, `AzureVMSecurityTypeTVM`, `AzureVMSecurityTypeUnknown` +- New enum type `CloudSuitabilityCommon` with values `CloudSuitabilityCommonConditionallySuitable`, `CloudSuitabilityCommonNotSuitable`, `CloudSuitabilityCommonReadinessUnknown`, `CloudSuitabilityCommonSuitable`, `CloudSuitabilityCommonSuitableWithWarnings`, `CloudSuitabilityCommonUnknown` +- New enum type `CostType` with values `CostTypeDataProtectionService`, `CostTypeMonitoringService`, `CostTypeMonthlyAvsExternalStorageCost`, `CostTypeMonthlyAvsNetworkCost`, `CostTypeMonthlyAvsNodeCost`, `CostTypeMonthlyAzureHybridCost`, `CostTypeMonthlyBandwidthCost`, `CostTypeMonthlyComputeCost`, `CostTypeMonthlyLicensingCost`, `CostTypeMonthlyLinuxAzureHybridCost`, `CostTypeMonthlyManagementCost`, `CostTypeMonthlyPremiumStorageCost`, `CostTypeMonthlyPremiumV2StorageCost`, `CostTypeMonthlySecurityCost`, `CostTypeMonthlyStandardHddStorageCost`, `CostTypeMonthlyStandardSsdStorageCost`, `CostTypeMonthlyStorageCost`, `CostTypeMonthlyUltraDiskCost`, `CostTypeMonthlyUltraStorageCost`, `CostTypePatchingService`, `CostTypeTotalMonthlyCost` +- New enum type `CreatedByType` with values `CreatedByTypeApplication`, `CreatedByTypeKey`, `CreatedByTypeManagedIdentity`, `CreatedByTypeUser` +- New enum type `EnvironmentType` with values `EnvironmentTypeDevTest`, `EnvironmentTypeProduction`, `EnvironmentTypeUnknown` +- New enum type `GuestOperatingSystemArchitecture` with values `GuestOperatingSystemArchitectureUnknown`, `GuestOperatingSystemArchitectureX64`, `GuestOperatingSystemArchitectureX86` +- New enum type `LicensingProgram` with values `LicensingProgramEA`, `LicensingProgramMCA`, `LicensingProgramRetail`, `LicensingProgramUnknown` +- New enum type `LinkageKind` with values `LinkageKindDatabase`, `LinkageKindInstance`, `LinkageKindMachine`, `LinkageKindServer`, `LinkageKindUnknown`, `LinkageKindWebApplication`, `LinkageKindWebServer` +- New enum type `LinkageType` with values `LinkageTypeParent`, `LinkageTypeSource` +- New enum type `MigrationIssuesCategory` with values `MigrationIssuesCategoryInternal`, `MigrationIssuesCategoryIssue`, `MigrationIssuesCategoryWarning` +- New enum type `MigrationPlatform` with values `MigrationPlatformIaaS`, `MigrationPlatformPaaS`, `MigrationPlatformSaaS`, `MigrationPlatformUnknown` +- New enum type `MigrationType` with values `MigrationTypeRearchitect`, `MigrationTypeRehost`, `MigrationTypeReplatform`, `MigrationTypeRetain`, `MigrationTypeUnknown` +- New enum type `Origin` with values `OriginSystem`, `OriginUser`, `OriginUserSystem` +- New enum type `PremiumDiskSupport` with values `PremiumDiskSupportPremiumDiskNotSupported`, `PremiumDiskSupportPremiumDiskSupported` +- New enum type `SKUKind` with values `SKUKindDetails`, `SKUKindEndpoint` +- New enum type `SKUType` with values `SKUTypeAppServicePlan`, `SKUTypeAzureSpringApps`, `SKUTypeCompute`, `SKUTypeNetwork`, `SKUTypeStorage`, `SKUTypeUnknown` +- New enum type `SavingsOptions` with values `SavingsOptionsCustomAzureOfferCode`, `SavingsOptionsNone`, `SavingsOptionsRI1Year`, `SavingsOptionsRI3Year`, `SavingsOptionsSavingsPlan1Year`, `SavingsOptionsSavingsPlan3Year` +- New enum type `SavingsType` with values `SavingsTypeMonthlyAhubSQLCostSavings`, `SavingsTypeMonthlyAzureHybridCostSavings`, `SavingsTypeMonthlyLinuxAzureHybridCostSavings`, `SavingsTypeMonthlyVcfByolCostDifference` +- New enum type `ScopeType` with values `ScopeTypeAzureResourceGraphQuery`, `ScopeTypeServerGroupID` +- New enum type `StrategyType` with values `StrategyTypeCostOptimized`, `StrategyTypeEffortOptimized`, `StrategyTypePaaSPreferred` +- New enum type `SummaryType` with values `SummaryTypeStrategy`, `SummaryTypeTarget`, `SummaryTypeUnknown` +- New enum type `UltraDiskSupport` with values `UltraDiskSupportUltraDiskNotSupported`, `UltraDiskSupportUltraDiskSupported` +- New enum type `VMFamilyCategoryItem` with values `VMFamilyCategoryItemComputeOptimized`, `VMFamilyCategoryItemConfidential`, `VMFamilyCategoryItemGeneralPurpose`, `VMFamilyCategoryItemGpuOptimized`, `VMFamilyCategoryItemHighPerformanceCompute`, `VMFamilyCategoryItemMemoryOptimized`, `VMFamilyCategoryItemStorageOptimized`, `VMFamilyCategoryItemSupportsPremiumStorage`, `VMFamilyCategoryItemSupportsUltraDiskStorage`, `VMFamilyCategoryItemUnknown` +- New enum type `WorkloadType` with values `WorkloadTypeDatabase`, `WorkloadTypeHost`, `WorkloadTypeInstance`, `WorkloadTypeMachine`, `WorkloadTypeManagementServer`, `WorkloadTypeServer`, `WorkloadTypeUnknown`, `WorkloadTypeWebApplication`, `WorkloadTypeWebServer` +- New function `NewAssessedMachinesV2OperationsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AssessedMachinesV2OperationsClient, error)` +- New function `*AssessedMachinesV2OperationsClient.Get(context.Context, string, string, string, string, *AssessedMachinesV2OperationsClientGetOptions) (AssessedMachinesV2OperationsClientGetResponse, error)` +- New function `*AssessedMachinesV2OperationsClient.NewListByParentPager(string, string, string, *AssessedMachinesV2OperationsClientListByParentOptions) *runtime.Pager[AssessedMachinesV2OperationsClientListByParentResponse]` +- New function `*ClientFactory.NewAssessedMachinesV2OperationsClient() *AssessedMachinesV2OperationsClient` +- New function `*ClientFactory.NewMachineAssessmentV2SummaryOperationsClient() *MachineAssessmentV2SummaryOperationsClient` +- New function `*ClientFactory.NewMachineAssessmentsV2OperationsClient() *MachineAssessmentsV2OperationsClient` +- New function `*ClientFactory.NewMachineGraphAssessmentOptionsOperationsClient() *MachineGraphAssessmentOptionsOperationsClient` +- New function `NewMachineAssessmentV2SummaryOperationsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*MachineAssessmentV2SummaryOperationsClient, error)` +- New function `*MachineAssessmentV2SummaryOperationsClient.Get(context.Context, string, string, string, string, *MachineAssessmentV2SummaryOperationsClientGetOptions) (MachineAssessmentV2SummaryOperationsClientGetResponse, error)` +- New function `*MachineAssessmentV2SummaryOperationsClient.NewListByParentPager(string, string, string, *MachineAssessmentV2SummaryOperationsClientListByParentOptions) *runtime.Pager[MachineAssessmentV2SummaryOperationsClientListByParentResponse]` +- New function `NewMachineAssessmentsV2OperationsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*MachineAssessmentsV2OperationsClient, error)` +- New function `*MachineAssessmentsV2OperationsClient.BeginCreate(context.Context, string, string, string, MachineAssessmentV2, *MachineAssessmentsV2OperationsClientBeginCreateOptions) (*runtime.Poller[MachineAssessmentsV2OperationsClientCreateResponse], error)` +- New function `*MachineAssessmentsV2OperationsClient.Delete(context.Context, string, string, string, *MachineAssessmentsV2OperationsClientDeleteOptions) (MachineAssessmentsV2OperationsClientDeleteResponse, error)` +- New function `*MachineAssessmentsV2OperationsClient.BeginDownloadURL(context.Context, string, string, string, DownloadURLRequest, *MachineAssessmentsV2OperationsClientBeginDownloadURLOptions) (*runtime.Poller[MachineAssessmentsV2OperationsClientDownloadURLResponse], error)` +- New function `*MachineAssessmentsV2OperationsClient.Get(context.Context, string, string, string, *MachineAssessmentsV2OperationsClientGetOptions) (MachineAssessmentsV2OperationsClientGetResponse, error)` +- New function `*MachineAssessmentsV2OperationsClient.NewListByParentPager(string, string, *MachineAssessmentsV2OperationsClientListByParentOptions) *runtime.Pager[MachineAssessmentsV2OperationsClientListByParentResponse]` +- New function `NewMachineGraphAssessmentOptionsOperationsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*MachineGraphAssessmentOptionsOperationsClient, error)` +- New function `*MachineGraphAssessmentOptionsOperationsClient.Get(context.Context, string, string, *MachineGraphAssessmentOptionsOperationsClientGetOptions) (MachineGraphAssessmentOptionsOperationsClientGetResponse, error)` +- New function `*MachineGraphAssessmentOptionsOperationsClient.NewListByParentPager(string, string, *MachineGraphAssessmentOptionsOperationsClientListByParentOptions) *runtime.Pager[MachineGraphAssessmentOptionsOperationsClientListByParentResponse]` +- New struct `AssessedDiskDataV3` +- New struct `AssessedMachineExtendedDetails` +- New struct `AssessedMachineNetworkAdaptersV3` +- New struct `AssessedMachineV2` +- New struct `AssessedMachineV2ListResult` +- New struct `AssessedMachineV2Properties` +- New struct `AssessmentDetails` +- New struct `BillingSettings` +- New struct `Configuration` +- New struct `CostDetailsCommon` +- New struct `DownloadURLRequest` +- New struct `Error` +- New struct `Linkages` +- New struct `MachineAssessmentOptionsOutboundEdgeGroup` +- New struct `MachineAssessmentRecommendation` +- New struct `MachineAssessmentSettings` +- New struct `MachineAssessmentV2` +- New struct `MachineAssessmentV2ListResult` +- New struct `MachineAssessmentV2Properties` +- New struct `MachineAssessmentV2Summary` +- New struct `MachineAssessmentV2SummaryListResult` +- New struct `MachineGraphAssessmentOptions` +- New struct `MachineGraphAssessmentOptionsListResult` +- New struct `MachineGraphAssessmentOptionsProperties` +- New struct `ManagementDetails` +- New struct `MigrationDetails` +- New struct `MigrationIssues` +- New struct `MigrationSuitability` +- New struct `MoreInformation` +- New struct `NameValuePair` +- New struct `NameValuePairCloudSuitabilityCommon` +- New struct `NameValuePairCostType` +- New struct `NameValuePairSavingsType` +- New struct `OperationListResult` +- New struct `PerformanceData` +- New struct `ProcessorInfo` +- New struct `ProductSupportStatus` +- New struct `RecommendedFor` +- New struct `SKUDetails` +- New struct `SKUsMigrationSuitability` +- New struct `SavingsDetailsCommon` +- New struct `SavingsSettings` +- New struct `Scope` +- New struct `SecuritySuitability` +- New struct `SourceDetails` +- New struct `SourceRecommendationMigrationSuitability` +- New struct `SummaryProperties` +- New struct `SystemData` +- New struct `TargetDetails` +- New struct `TargetSourcePair` +- New struct `VMSecuritySuitability` +- New field `ActionType`, `IsDataAction` in struct `Operation` +- New anonymous field `OperationListResult` in struct `OperationsClientListResponse` + + ## 1.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/migrate/armmigrate/README.md b/sdk/resourcemanager/migrate/armmigrate/README.md index c229cc350b41..5f35d42746f4 100644 --- a/sdk/resourcemanager/migrate/armmigrate/README.md +++ b/sdk/resourcemanager/migrate/armmigrate/README.md @@ -18,7 +18,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Migrate module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2 ``` ## Authorization @@ -55,7 +55,7 @@ clientFactory, err := armmigrate.NewClientFactory(, cred, &opti A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. ```go -client := clientFactory.NewGroupsClient() +client := clientFactory.NewAssessedMachinesV2OperationsClient() ``` ## Fakes diff --git a/sdk/resourcemanager/migrate/armmigrate/assessedmachines_client.go b/sdk/resourcemanager/migrate/armmigrate/assessedmachines_client.go deleted file mode 100644 index 69d8f0705980..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/assessedmachines_client.go +++ /dev/null @@ -1,208 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// AssessedMachinesClient contains the methods for the AssessedMachines group. -// Don't use this type directly, use NewAssessedMachinesClient() instead. -type AssessedMachinesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAssessedMachinesClient creates a new instance of AssessedMachinesClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewAssessedMachinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AssessedMachinesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AssessedMachinesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Get an assessed machine with its size & cost estimate that was evaluated in the specified assessment. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - assessmentName - Unique name of an assessment within a project. -// - assessedMachineName - Unique name of an assessed machine evaluated as part of an assessment. -// - options - AssessedMachinesClientGetOptions contains the optional parameters for the AssessedMachinesClient.Get method. -func (client *AssessedMachinesClient) Get(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, assessedMachineName string, options *AssessedMachinesClientGetOptions) (AssessedMachinesClientGetResponse, error) { - var err error - const operationName = "AssessedMachinesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, groupName, assessmentName, assessedMachineName, options) - if err != nil { - return AssessedMachinesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AssessedMachinesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AssessedMachinesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AssessedMachinesClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, assessedMachineName string, options *AssessedMachinesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}/assessedMachines/{assessedMachineName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - if assessmentName == "" { - return nil, errors.New("parameter assessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) - if assessedMachineName == "" { - return nil, errors.New("parameter assessedMachineName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessedMachineName}", url.PathEscape(assessedMachineName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *AssessedMachinesClient) getHandleResponse(resp *http.Response) (AssessedMachinesClientGetResponse, error) { - result := AssessedMachinesClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.AssessedMachine); err != nil { - return AssessedMachinesClientGetResponse{}, err - } - return result, nil -} - -// NewListByAssessmentPager - Get list of machines that assessed as part of the specified assessment. Returns a json array -// of objects of type 'assessedMachine' as specified in the Models section. -// Whenever an assessment is created or updated, it goes under computation. During this phase, the 'status' field of Assessment -// object reports 'Computing'. During the period when the assessment is under -// computation, the list of assessed machines is empty and no assessed machines are returned by this call. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - assessmentName - Unique name of an assessment within a project. -// - options - AssessedMachinesClientListByAssessmentOptions contains the optional parameters for the AssessedMachinesClient.NewListByAssessmentPager -// method. -func (client *AssessedMachinesClient) NewListByAssessmentPager(resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessedMachinesClientListByAssessmentOptions) *runtime.Pager[AssessedMachinesClientListByAssessmentResponse] { - return runtime.NewPager(runtime.PagingHandler[AssessedMachinesClientListByAssessmentResponse]{ - More: func(page AssessedMachinesClientListByAssessmentResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AssessedMachinesClientListByAssessmentResponse) (AssessedMachinesClientListByAssessmentResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AssessedMachinesClient.NewListByAssessmentPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByAssessmentCreateRequest(ctx, resourceGroupName, projectName, groupName, assessmentName, options) - }, nil) - if err != nil { - return AssessedMachinesClientListByAssessmentResponse{}, err - } - return client.listByAssessmentHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByAssessmentCreateRequest creates the ListByAssessment request. -func (client *AssessedMachinesClient) listByAssessmentCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessedMachinesClientListByAssessmentOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}/assessedMachines" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - if assessmentName == "" { - return nil, errors.New("parameter assessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByAssessmentHandleResponse handles the ListByAssessment response. -func (client *AssessedMachinesClient) listByAssessmentHandleResponse(resp *http.Response) (AssessedMachinesClientListByAssessmentResponse, error) { - result := AssessedMachinesClientListByAssessmentResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.AssessedMachineResultList); err != nil { - return AssessedMachinesClientListByAssessmentResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/assessedmachines_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/assessedmachines_client_example_test.go deleted file mode 100644 index e0ba10b46036..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/assessedmachines_client_example_test.go +++ /dev/null @@ -1,267 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/AssessedMachines_ListByAssessment.json -func ExampleAssessedMachinesClient_NewListByAssessmentPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAssessedMachinesClient().NewListByAssessmentPager("abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Test1", "assessment_5_9_2019_16_22_14", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AssessedMachineResultList = armmigrate.AssessedMachineResultList{ - // Value: []*armmigrate.AssessedMachine{ - // { - // Name: to.Ptr("f57fe432-3bd2-486a-a83a-6f4d99f1a952"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups/assessments/assessedMachines"), - // ETag: to.Ptr("\"b300e5dd-0000-0d00-0000-5cd4065f0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1/assessments/assessment_5_9_2019_16_22_14/assessedMachines/f57fe432-3bd2-486a-a83a-6f4d99f1a952"), - // Properties: &armmigrate.AssessedMachineProperties{ - // Description: to.Ptr("Microsoft Azure Migration Image on Windows Server 2016"), - // BootType: to.Ptr(armmigrate.MachineBootTypeBIOS), - // ConfidenceRatingInPercentage: to.Ptr[float64](0), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:15.778Z"); return t}()), - // DatacenterMachineArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.offazure/vmwaresites/portalvcenterbc2fsite/machines/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_52e1f68c-bea5-19ff-d0ad-6a94b79a286f"), - // DatacenterManagementServerArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.OffAzure/VMwareSites/PortalvCenterbc2fsite/vcenters/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3"), - // DatacenterManagementServerName: to.Ptr("IDCLAB-A360.fareast.corp.microsoft.com"), - // Disks: map[string]*armmigrate.AssessedDisk{ - // "6000C299-02f5-d137-9bab-8a8ee7b192a0": &armmigrate.AssessedDisk{ - // Name: to.Ptr("6000C299-02f5-d137-9bab-8a8ee7b192a0"), - // DisplayName: to.Ptr("scsi0:0"), - // GigabytesForRecommendedDiskSize: to.Ptr[int32](128), - // GigabytesProvisioned: to.Ptr[float64](80), - // MegabytesPerSecondOfRead: to.Ptr[float64](0), - // MegabytesPerSecondOfWrite: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](5.888), - // NumberOfReadOperationsPerSecond: to.Ptr[float64](0), - // NumberOfWriteOperationsPerSecond: to.Ptr[float64](0), - // RecommendedDiskSize: to.Ptr(armmigrate.AzureDiskSizeStandardS10), - // RecommendedDiskType: to.Ptr(armmigrate.AzureDiskTypeStandard), - // Suitability: to.Ptr(armmigrate.CloudSuitabilitySuitable), - // SuitabilityDetail: to.Ptr(armmigrate.AzureDiskSuitabilityDetail("NumberOfReadOperationsPerSecondMissing, NumberOfWriteOperationsPerSecondMissing, MegabytesPerSecondOfReadMissing, MegabytesPerSecondOfWriteMissing")), - // SuitabilityExplanation: to.Ptr(armmigrate.AzureDiskSuitabilityExplanationNotApplicable), - // }, - // }, - // DisplayName: to.Ptr("SHubhamVMNew"), - // MegabytesOfMemory: to.Ptr[float64](16384), - // MegabytesOfMemoryForRecommendedSize: to.Ptr[float64](16384), - // MonthlyBandwidthCost: to.Ptr[float64](0), - // MonthlyComputeCostForRecommendedSize: to.Ptr[float64](101.138616), - // MonthlyPremiumStorageCost: to.Ptr[float64](0), - // MonthlyStandardSSDStorageCost: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](5.888), - // NetworkAdapters: map[string]*armmigrate.AssessedNetworkAdapter{ - // "4000": &armmigrate.AssessedNetworkAdapter{ - // DisplayName: to.Ptr("VM Network"), - // IPAddresses: []*string{ - // }, - // MacAddress: to.Ptr("00:0c:29:ad:13:d3"), - // MegabytesPerSecondReceived: to.Ptr[float64](0), - // MegabytesPerSecondTransmitted: to.Ptr[float64](0), - // MonthlyBandwidthCosts: to.Ptr[float64](0), - // NetGigabytesTransmittedPerMonth: to.Ptr[float64](0), - // Suitability: to.Ptr(armmigrate.CloudSuitabilitySuitable), - // SuitabilityDetail: to.Ptr(armmigrate.AzureNetworkAdapterSuitabilityDetailMegabytesOfDataTransmittedMissing), - // SuitabilityExplanation: to.Ptr(armmigrate.AzureNetworkAdapterSuitabilityExplanationNotApplicable), - // }, - // }, - // NumberOfCores: to.Ptr[int32](8), - // NumberOfCoresForRecommendedSize: to.Ptr[int32](8), - // OperatingSystemName: to.Ptr("Microsoft Windows Server 2016 (64-bit)"), - // OperatingSystemType: to.Ptr("windowsGuest"), - // PercentageCoresUtilization: to.Ptr[float64](0), - // PercentageMemoryUtilization: to.Ptr[float64](0), - // RecommendedSize: to.Ptr(armmigrate.AzureVMSizeStandardF8SV2), - // Suitability: to.Ptr(armmigrate.CloudSuitabilitySuitable), - // SuitabilityDetail: to.Ptr(armmigrate.AzureVMSuitabilityDetail("PercentageOfCoresUtilizedMissing, PercentageOfMemoryUtilizedMissing")), - // SuitabilityExplanation: to.Ptr(armmigrate.AzureVMSuitabilityExplanationNotApplicable), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:15.778Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("3b4a34a6-c729-46d2-bfd1-bcb52cc4935e"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups/assessments/assessedMachines"), - // ETag: to.Ptr("\"b300e6dd-0000-0d00-0000-5cd4065f0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1/assessments/assessment_5_9_2019_16_22_14/assessedMachines/3b4a34a6-c729-46d2-bfd1-bcb52cc4935e"), - // Properties: &armmigrate.AssessedMachineProperties{ - // Description: to.Ptr("Microsoft Azure Migration Image on Windows Server 2016"), - // BootType: to.Ptr(armmigrate.MachineBootTypeBIOS), - // ConfidenceRatingInPercentage: to.Ptr[float64](0), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:15.778Z"); return t}()), - // DatacenterMachineArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.offazure/vmwaresites/portalvcenterbc2fsite/machines/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_50296915-8b4b-5c82-79a1-adf3966acb6b"), - // DatacenterManagementServerArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.OffAzure/VMwareSites/PortalvCenterbc2fsite/vcenters/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3"), - // DatacenterManagementServerName: to.Ptr("IDCLAB-A360.fareast.corp.microsoft.com"), - // Disks: map[string]*armmigrate.AssessedDisk{ - // "6000C298-8305-5635-e618-3a8675c42495": &armmigrate.AssessedDisk{ - // Name: to.Ptr("6000C298-8305-5635-e618-3a8675c42495"), - // DisplayName: to.Ptr("scsi0:0"), - // GigabytesForRecommendedDiskSize: to.Ptr[int32](128), - // GigabytesProvisioned: to.Ptr[float64](80), - // MegabytesPerSecondOfRead: to.Ptr[float64](0), - // MegabytesPerSecondOfWrite: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](5.888), - // NumberOfReadOperationsPerSecond: to.Ptr[float64](0), - // NumberOfWriteOperationsPerSecond: to.Ptr[float64](0), - // RecommendedDiskSize: to.Ptr(armmigrate.AzureDiskSizeStandardS10), - // RecommendedDiskType: to.Ptr(armmigrate.AzureDiskTypeStandard), - // Suitability: to.Ptr(armmigrate.CloudSuitabilitySuitable), - // SuitabilityDetail: to.Ptr(armmigrate.AzureDiskSuitabilityDetail("NumberOfReadOperationsPerSecondMissing, NumberOfWriteOperationsPerSecondMissing, MegabytesPerSecondOfReadMissing, MegabytesPerSecondOfWriteMissing")), - // SuitabilityExplanation: to.Ptr(armmigrate.AzureDiskSuitabilityExplanationNotApplicable), - // }, - // }, - // DisplayName: to.Ptr("testfpl1"), - // MegabytesOfMemory: to.Ptr[float64](16384), - // MegabytesOfMemoryForRecommendedSize: to.Ptr[float64](16384), - // MonthlyBandwidthCost: to.Ptr[float64](0), - // MonthlyComputeCostForRecommendedSize: to.Ptr[float64](101.138616), - // MonthlyPremiumStorageCost: to.Ptr[float64](0), - // MonthlyStandardSSDStorageCost: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](5.888), - // NetworkAdapters: map[string]*armmigrate.AssessedNetworkAdapter{ - // "4000": &armmigrate.AssessedNetworkAdapter{ - // DisplayName: to.Ptr("VM Network"), - // IPAddresses: []*string{ - // }, - // MacAddress: to.Ptr("00:50:56:a9:35:ca"), - // MegabytesPerSecondReceived: to.Ptr[float64](0), - // MegabytesPerSecondTransmitted: to.Ptr[float64](0), - // MonthlyBandwidthCosts: to.Ptr[float64](0), - // NetGigabytesTransmittedPerMonth: to.Ptr[float64](0), - // Suitability: to.Ptr(armmigrate.CloudSuitabilitySuitable), - // SuitabilityDetail: to.Ptr(armmigrate.AzureNetworkAdapterSuitabilityDetailMegabytesOfDataTransmittedMissing), - // SuitabilityExplanation: to.Ptr(armmigrate.AzureNetworkAdapterSuitabilityExplanationNotApplicable), - // }, - // }, - // NumberOfCores: to.Ptr[int32](8), - // NumberOfCoresForRecommendedSize: to.Ptr[int32](8), - // OperatingSystemName: to.Ptr("Microsoft Windows Server 2016 (64-bit)"), - // OperatingSystemType: to.Ptr("windowsguest"), - // PercentageCoresUtilization: to.Ptr[float64](0), - // PercentageMemoryUtilization: to.Ptr[float64](0), - // RecommendedSize: to.Ptr(armmigrate.AzureVMSizeStandardF8SV2), - // Suitability: to.Ptr(armmigrate.CloudSuitabilitySuitable), - // SuitabilityDetail: to.Ptr(armmigrate.AzureVMSuitabilityDetail("PercentageOfCoresUtilizedMissing, PercentageOfMemoryUtilizedMissing")), - // SuitabilityExplanation: to.Ptr(armmigrate.AzureVMSuitabilityExplanationNotApplicable), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:15.778Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/AssessedMachines_Get.json -func ExampleAssessedMachinesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssessedMachinesClient().Get(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Test1", "assessment_5_9_2019_16_22_14", "f57fe432-3bd2-486a-a83a-6f4d99f1a952", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AssessedMachine = armmigrate.AssessedMachine{ - // Name: to.Ptr("f57fe432-3bd2-486a-a83a-6f4d99f1a952"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups/assessments/assessedMachines"), - // ETag: to.Ptr("\"b300e5dd-0000-0d00-0000-5cd4065f0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1/assessments/assessment_5_9_2019_16_22_14/assessedMachines/f57fe432-3bd2-486a-a83a-6f4d99f1a952"), - // Properties: &armmigrate.AssessedMachineProperties{ - // Description: to.Ptr("Microsoft Azure Migration Image on Windows Server 2016"), - // BootType: to.Ptr(armmigrate.MachineBootTypeBIOS), - // ConfidenceRatingInPercentage: to.Ptr[float64](0), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:15.778Z"); return t}()), - // DatacenterMachineArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.offazure/vmwaresites/portalvcenterbc2fsite/machines/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_52e1f68c-bea5-19ff-d0ad-6a94b79a286f"), - // DatacenterManagementServerArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.OffAzure/VMwareSites/PortalvCenterbc2fsite/vcenters/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3"), - // DatacenterManagementServerName: to.Ptr("IDCLAB-A360.fareast.corp.microsoft.com"), - // Disks: map[string]*armmigrate.AssessedDisk{ - // "6000C299-02f5-d137-9bab-8a8ee7b192a0": &armmigrate.AssessedDisk{ - // Name: to.Ptr("6000C299-02f5-d137-9bab-8a8ee7b192a0"), - // DisplayName: to.Ptr("scsi0:0"), - // GigabytesForRecommendedDiskSize: to.Ptr[int32](128), - // GigabytesProvisioned: to.Ptr[float64](80), - // MegabytesPerSecondOfRead: to.Ptr[float64](0), - // MegabytesPerSecondOfWrite: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](5.888), - // NumberOfReadOperationsPerSecond: to.Ptr[float64](0), - // NumberOfWriteOperationsPerSecond: to.Ptr[float64](0), - // RecommendedDiskSize: to.Ptr(armmigrate.AzureDiskSizeStandardS10), - // RecommendedDiskType: to.Ptr(armmigrate.AzureDiskTypeStandard), - // Suitability: to.Ptr(armmigrate.CloudSuitabilitySuitable), - // SuitabilityDetail: to.Ptr(armmigrate.AzureDiskSuitabilityDetail("NumberOfReadOperationsPerSecondMissing, NumberOfWriteOperationsPerSecondMissing, MegabytesPerSecondOfReadMissing, MegabytesPerSecondOfWriteMissing")), - // SuitabilityExplanation: to.Ptr(armmigrate.AzureDiskSuitabilityExplanationNotApplicable), - // }, - // }, - // DisplayName: to.Ptr("SHubhamVMNew"), - // MegabytesOfMemory: to.Ptr[float64](16384), - // MegabytesOfMemoryForRecommendedSize: to.Ptr[float64](16384), - // MonthlyBandwidthCost: to.Ptr[float64](0), - // MonthlyComputeCostForRecommendedSize: to.Ptr[float64](101.138616), - // MonthlyPremiumStorageCost: to.Ptr[float64](0), - // MonthlyStandardSSDStorageCost: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](5.888), - // NetworkAdapters: map[string]*armmigrate.AssessedNetworkAdapter{ - // "4000": &armmigrate.AssessedNetworkAdapter{ - // DisplayName: to.Ptr("VM Network"), - // IPAddresses: []*string{ - // }, - // MacAddress: to.Ptr("00:0c:29:ad:13:d3"), - // MegabytesPerSecondReceived: to.Ptr[float64](0), - // MegabytesPerSecondTransmitted: to.Ptr[float64](0), - // MonthlyBandwidthCosts: to.Ptr[float64](0), - // NetGigabytesTransmittedPerMonth: to.Ptr[float64](0), - // Suitability: to.Ptr(armmigrate.CloudSuitabilitySuitable), - // SuitabilityDetail: to.Ptr(armmigrate.AzureNetworkAdapterSuitabilityDetailMegabytesOfDataTransmittedMissing), - // SuitabilityExplanation: to.Ptr(armmigrate.AzureNetworkAdapterSuitabilityExplanationNotApplicable), - // }, - // }, - // NumberOfCores: to.Ptr[int32](8), - // NumberOfCoresForRecommendedSize: to.Ptr[int32](8), - // OperatingSystemName: to.Ptr("Microsoft Windows Server 2016 (64-bit)"), - // OperatingSystemType: to.Ptr("windowsGuest"), - // PercentageCoresUtilization: to.Ptr[float64](0), - // PercentageMemoryUtilization: to.Ptr[float64](0), - // RecommendedSize: to.Ptr(armmigrate.AzureVMSizeStandardF8SV2), - // Suitability: to.Ptr(armmigrate.CloudSuitabilitySuitable), - // SuitabilityDetail: to.Ptr(armmigrate.AzureVMSuitabilityDetail("PercentageOfCoresUtilizedMissing, PercentageOfMemoryUtilizedMissing")), - // SuitabilityExplanation: to.Ptr(armmigrate.AzureVMSuitabilityExplanationNotApplicable), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:15.778Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/assessedmachinesv2operations_client.go b/sdk/resourcemanager/migrate/armmigrate/assessedmachinesv2operations_client.go new file mode 100644 index 000000000000..6393956ef868 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/assessedmachinesv2operations_client.go @@ -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) Go Code Generator. DO NOT EDIT. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// AssessedMachinesV2OperationsClient contains the methods for the AssessedMachinesV2Operations group. +// Don't use this type directly, use NewAssessedMachinesV2OperationsClient() instead. +type AssessedMachinesV2OperationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAssessedMachinesV2OperationsClient creates a new instance of AssessedMachinesV2OperationsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAssessedMachinesV2OperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AssessedMachinesV2OperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AssessedMachinesV2OperationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a AssessedMachineV2 +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-03-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - Assessment Project Name +// - assessmentName - Machine Assessment V2 ARM name +// - assessedMachineName - Machine assessment V2 Assessed Machine ARM name +// - options - AssessedMachinesV2OperationsClientGetOptions contains the optional parameters for the AssessedMachinesV2OperationsClient.Get +// method. +func (client *AssessedMachinesV2OperationsClient) Get(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, assessedMachineName string, options *AssessedMachinesV2OperationsClientGetOptions) (AssessedMachinesV2OperationsClientGetResponse, error) { + var err error + const operationName = "AssessedMachinesV2OperationsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, assessmentName, assessedMachineName, options) + if err != nil { + return AssessedMachinesV2OperationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AssessedMachinesV2OperationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AssessedMachinesV2OperationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AssessedMachinesV2OperationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, assessedMachineName string, _ *AssessedMachinesV2OperationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessments/{assessmentName}/assessedMachines/{assessedMachineName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if assessmentName == "" { + return nil, errors.New("parameter assessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) + if assessedMachineName == "" { + return nil, errors.New("parameter assessedMachineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessedMachineName}", url.PathEscape(assessedMachineName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-03-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AssessedMachinesV2OperationsClient) getHandleResponse(resp *http.Response) (AssessedMachinesV2OperationsClientGetResponse, error) { + result := AssessedMachinesV2OperationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AssessedMachineV2); err != nil { + return AssessedMachinesV2OperationsClientGetResponse{}, err + } + return result, nil +} + +// NewListByParentPager - List AssessedMachineV2 resources by MachineAssessmentV2 +// +// Generated from API version 2024-03-03-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - Assessment Project Name +// - assessmentName - Machine Assessment V2 ARM name +// - options - AssessedMachinesV2OperationsClientListByParentOptions contains the optional parameters for the AssessedMachinesV2OperationsClient.NewListByParentPager +// method. +func (client *AssessedMachinesV2OperationsClient) NewListByParentPager(resourceGroupName string, projectName string, assessmentName string, options *AssessedMachinesV2OperationsClientListByParentOptions) *runtime.Pager[AssessedMachinesV2OperationsClientListByParentResponse] { + return runtime.NewPager(runtime.PagingHandler[AssessedMachinesV2OperationsClientListByParentResponse]{ + More: func(page AssessedMachinesV2OperationsClientListByParentResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AssessedMachinesV2OperationsClientListByParentResponse) (AssessedMachinesV2OperationsClientListByParentResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AssessedMachinesV2OperationsClient.NewListByParentPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByParentCreateRequest(ctx, resourceGroupName, projectName, assessmentName, options) + }, nil) + if err != nil { + return AssessedMachinesV2OperationsClientListByParentResponse{}, err + } + return client.listByParentHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByParentCreateRequest creates the ListByParent request. +func (client *AssessedMachinesV2OperationsClient) listByParentCreateRequest(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, options *AssessedMachinesV2OperationsClientListByParentOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessments/{assessmentName}/assessedMachines" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if assessmentName == "" { + return nil, errors.New("parameter assessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2024-03-03-preview") + if options != nil && options.ContinuationToken != nil { + reqQP.Set("continuationToken", *options.ContinuationToken) + } + if options != nil && options.PageSize != nil { + reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) + } + if options != nil && options.TotalRecordCount != nil { + reqQP.Set("totalRecordCount", strconv.FormatInt(int64(*options.TotalRecordCount), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByParentHandleResponse handles the ListByParent response. +func (client *AssessedMachinesV2OperationsClient) listByParentHandleResponse(resp *http.Response) (AssessedMachinesV2OperationsClientListByParentResponse, error) { + result := AssessedMachinesV2OperationsClientListByParentResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AssessedMachineV2ListResult); err != nil { + return AssessedMachinesV2OperationsClientListByParentResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/assessedmachinesv2operations_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/assessedmachinesv2operations_client_example_test.go new file mode 100644 index 000000000000..3a8272ec19ca --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/assessedmachinesv2operations_client_example_test.go @@ -0,0 +1,497 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armmigrate_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "log" +) + +// Generated from example definition: 2024-03-03-preview/AssessedMachinesV2Operations_Get_MaximumSet_Gen.json +func ExampleAssessedMachinesV2OperationsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmigrate.NewClientFactory("AEDD0824-BBE9-4E7C-8909-F46C68EA6BB9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAssessedMachinesV2OperationsClient().Get(ctx, "rgmachineAssessments", "contosoProject", "assessmentName", "machine1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armmigrate.AssessedMachinesV2OperationsClientGetResponse{ + // AssessedMachineV2: &armmigrate.AssessedMachineV2{ + // Properties: &armmigrate.AssessedMachineV2Properties{ + // WorkloadType: to.Ptr(armmigrate.WorkloadTypeUnknown), + // Linkages: []*armmigrate.Linkages{ + // { + // WorkloadName: to.Ptr("ffpmzzx"), + // LinkageType: to.Ptr(armmigrate.LinkageTypeParent), + // Kind: to.Ptr(armmigrate.LinkageKindUnknown), + // ArmID: to.Ptr("nedxrqwdpcjvzclmruofufiyfp"), + // }, + // }, + // Recommendations: []*armmigrate.MachineAssessmentRecommendation{ + // { + // Configuration: &armmigrate.Configuration{ + // AzureTarget: to.Ptr(armmigrate.AzureTargetUnknown), + // SizingCriterion: to.Ptr(armmigrate.AssessmentSizingCriterionPerformanceBased), + // }, + // RecommendedFor: &armmigrate.RecommendedFor{ + // Strategies: []*armmigrate.StrategyType{ + // to.Ptr(armmigrate.StrategyTypePaaSPreferred), + // }, + // }, + // ConfidenceScore: to.Ptr[float32](13), + // MigrationSuitability: &armmigrate.MigrationSuitability{ + // Readiness: to.Ptr(armmigrate.CloudSuitabilityCommonUnknown), + // }, + // SecuritySuitability: &armmigrate.SecuritySuitability{ + // Readiness: to.Ptr(armmigrate.CloudSuitabilityCommonUnknown), + // }, + // TotalCost: []*armmigrate.CostDetailsCommon{ + // { + // CostDetail: []*armmigrate.NameValuePairCostType{ + // { + // Name: to.Ptr(armmigrate.CostTypeMonthlyStorageCost), + // Value: to.Ptr[float32](16), + // }, + // }, + // SavingOptions: to.Ptr(armmigrate.SavingsOptionsNone), + // }, + // }, + // TotalSavings: []*armmigrate.SavingsDetailsCommon{ + // { + // SavingsDetail: []*armmigrate.NameValuePairSavingsType{ + // { + // Name: to.Ptr(armmigrate.SavingsTypeMonthlyAzureHybridCostSavings), + // Value: to.Ptr[float32](5), + // }, + // }, + // SavingOptions: to.Ptr(armmigrate.SavingsOptionsNone), + // }, + // }, + // MigrationIssues: []*armmigrate.MigrationIssues{ + // { + // IssueCode: to.Ptr("broifuie"), + // IssueCategory: to.Ptr(armmigrate.MigrationIssuesCategoryIssue), + // IssueDescription: to.Ptr("krwqxftdw"), + // PossibleCause: to.Ptr("bxkjmkliilsa"), + // RecommendedActions: []*string{ + // to.Ptr("poomtsyvmfncnbv"), + // }, + // MoreInformation: []*armmigrate.MoreInformation{ + // { + // Title: to.Ptr("hqimzvxlatvzytoqfilyu"), + // URL: to.Ptr("bxsoybdfpd"), + // }, + // }, + // }, + // }, + // SKUs: []*armmigrate.SKUsMigrationSuitability{ + // { + // Kind: to.Ptr(armmigrate.SKUKindEndpoint), + // ResourceURI: to.Ptr("syg"), + // DisplayName: to.Ptr("jcxoygywmnqppfernysmzjwdnbnqkm"), + // ID: to.Ptr("bgwisesdkecmvyiadobszno"), + // Type: to.Ptr(armmigrate.SKUTypeUnknown), + // Sources: []*armmigrate.SourceRecommendationMigrationSuitability{ + // { + // Name: to.Ptr("cmenmvpoltkiewdrjzu"), + // MigrationSuitability: &armmigrate.MigrationSuitability{ + // Readiness: to.Ptr(armmigrate.CloudSuitabilityCommonUnknown), + // }, + // }, + // }, + // Details: &armmigrate.SKUDetails{ + // SKUType: to.Ptr(armmigrate.SKUTypeUnknown), + // SKUName: to.Ptr("fgplpqgdbosxyumpzoc"), + // Capabilities: []*armmigrate.NameValuePair{ + // { + // Name: to.Ptr("szlqwwhiebj"), + // Value: to.Ptr("pkrocddmpnkryngyrzomhjzeai"), + // }, + // }, + // TotalCost: []*armmigrate.CostDetailsCommon{ + // { + // CostDetail: []*armmigrate.NameValuePairCostType{ + // { + // Name: to.Ptr(armmigrate.CostTypeMonthlyStorageCost), + // Value: to.Ptr[float32](16), + // }, + // }, + // SavingOptions: to.Ptr(armmigrate.SavingsOptionsNone), + // }, + // }, + // TotalSavings: []*armmigrate.SavingsDetailsCommon{ + // { + // SavingsDetail: []*armmigrate.NameValuePairSavingsType{ + // { + // Name: to.Ptr(armmigrate.SavingsTypeMonthlyAzureHybridCostSavings), + // Value: to.Ptr[float32](5), + // }, + // }, + // SavingOptions: to.Ptr(armmigrate.SavingsOptionsNone), + // }, + // }, + // }, + // }, + // }, + // MigrationPlatform: to.Ptr(armmigrate.MigrationPlatformUnknown), + // }, + // }, + // ExtendedDetails: &armmigrate.AssessedMachineExtendedDetails{ + // DisplayName: to.Ptr("lflnrvlib"), + // ProductSupportStatus: &armmigrate.ProductSupportStatus{ + // CurrentVersion: to.Ptr("cgxjdbuabosuxrpjgfrjtzqkgndlsx"), + // ServicePackStatus: to.Ptr("rnznmjoibdxhqonnyiwf"), + // EsuStatus: to.Ptr("flrcxpamltntuyrc"), + // SupportStatus: to.Ptr("tujcyrwmckqqwmtapmbzhs"), + // Eta: to.Ptr[int32](17), + // CurrentEsuYear: to.Ptr("jtzzisk"), + // MainstreamEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:26.183Z"); return t}()), + // ExtendedSupportEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:26.183Z"); return t}()), + // ExtendedSecurityUpdateYear1EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:26.183Z"); return t}()), + // ExtendedSecurityUpdateYear2EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:26.183Z"); return t}()), + // ExtendedSecurityUpdateYear3EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:26.183Z"); return t}()), + // }, + // Disks: []*armmigrate.AssessedDiskDataV3{ + // { + // Name: to.Ptr("wxpcpldoajzgkftxghuqmjhqnzz"), + // DisplayName: to.Ptr("ulzxrtcaivlvb"), + // GigabytesProvisioned: to.Ptr[float32](12), + // MegabytesPerSecondOfRead: to.Ptr[float32](13), + // MegabytesPerSecondOfWrite: to.Ptr[float32](29), + // NumberOfReadOperationsPerSecond: to.Ptr[float32](2), + // NumberOfWriteOperationsPerSecond: to.Ptr[float32](22), + // }, + // }, + // HostProcessor: &armmigrate.ProcessorInfo{ + // Name: to.Ptr("szonbnup"), + // NumberOfSockets: to.Ptr[int32](8), + // NumberOfCoresPerSocket: to.Ptr[int32](20), + // }, + // NetworkAdapters: []*armmigrate.AssessedMachineNetworkAdaptersV3{ + // { + // Name: to.Ptr("uzelretpmbgehrecamebizdxshmgb"), + // NetGigabytesTransmittedPerMonth: to.Ptr[float32](10), + // MacAddress: to.Ptr("tguabzgtp"), + // IPAddresses: []*string{ + // to.Ptr("tdet"), + // }, + // MegabytesPerSecondRecieved: to.Ptr[float32](23), + // MegabytesPerSecondTransmitted: to.Ptr[float32](19), + // DisplayName: to.Ptr("syncmqcuhja"), + // }, + // }, + // BootType: to.Ptr(armmigrate.MachineBootTypeUnknown), + // OperatingSystemType: to.Ptr("hbassxigsetxwryywvdrvw"), + // OperatingSystemName: to.Ptr("twkefugwwwnedbnqde"), + // OperatingSystemVersion: to.Ptr("bqonvxtarsrjxx"), + // OperatingSystemArchitecture: to.Ptr(armmigrate.GuestOperatingSystemArchitectureUnknown), + // MegabytesOfMemory: to.Ptr[float32](19), + // NumberOfCores: to.Ptr[int32](3), + // PercentageCoresUtilization: to.Ptr[float32](9), + // PercentageMemoryUtilization: to.Ptr[float32](1), + // Errors: []*armmigrate.Error{ + // { + // ID: to.Ptr[int32](19), + // Code: to.Ptr("gwivqwge"), + // RunAsAccountID: to.Ptr("ympfiooryijkqbzzpyshimecwvgmj"), + // ApplianceName: to.Ptr("fdzovbudmavlezh"), + // Message: to.Ptr("dwqahjjqlripog"), + // SummaryMessage: to.Ptr("eiesjxrezalapqmxkxbxwrq"), + // AgentScenario: to.Ptr("cqhxfgqgejxlkjaydnwyqybhv"), + // PossibleCauses: to.Ptr("sppnxiswpon"), + // RecommendedAction: to.Ptr("sftmftcprumeayb"), + // Severity: to.Ptr("xlwmctkywvvefmgvqpi"), + // MessageParameters: []*armmigrate.NameValuePair{ + // { + // Name: to.Ptr("myslpcygyeruupywlrfnknjizkq"), + // Value: to.Ptr("wpmieiabnzdbxkumafwhylqjrfmvr"), + // }, + // }, + // UpdatedTimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:26.183Z"); return t}()), + // ImpactedAssessmentType: to.Ptr("wtb"), + // }, + // }, + // AssessedMachineType: to.Ptr(armmigrate.AssessedMachineTypeUnknown), + // Description: to.Ptr("rfjoclwlv"), + // }, + // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:26.183Z"); return t}()), + // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:26.183Z"); return t}()), + // }, + // ID: to.Ptr("/subscriptions/AEDD0824-BBE9-4E7C-8909-F46C68EA6BB9/resourceGroups/rgmachineAssessments/providers/Microsoft.Migrate/assessmentProjects/contosoProject/assessments/assessmentName/assessedMachines/machine1"), + // Name: to.Ptr("machine1"), + // Type: to.Ptr("Microsoft.Migrate/assessmentProjects/assessments/assessedMachines"), + // SystemData: &armmigrate.SystemData{ + // CreatedBy: to.Ptr("drvgxn"), + // CreatedByType: to.Ptr(armmigrate.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:25.000Z"); return t}()), + // LastModifiedBy: to.Ptr("qfyznkjasypfwyfmmkc"), + // LastModifiedByType: to.Ptr(armmigrate.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:25.000Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-03-03-preview/AssessedMachinesV2Operations_ListByParent_MaximumSet_Gen.json +func ExampleAssessedMachinesV2OperationsClient_NewListByParentPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmigrate.NewClientFactory("AEDD0824-BBE9-4E7C-8909-F46C68EA6BB9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAssessedMachinesV2OperationsClient().NewListByParentPager("rgmachineAssessments", "contosoProject", "assessmentName", &AssessedMachinesV2OperationsClientListByParentOptions{ + Filter: to.Ptr("eabpcsewhenpdfcsjck"), + pageSize: to.Ptr[int32](13), + continuationToken: to.Ptr("lsuhpxtnundds"), + totalRecordCount: to.Ptr[int32](28)}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armmigrate.AssessedMachinesV2OperationsClientListByParentResponse{ + // AssessedMachineV2ListResult: armmigrate.AssessedMachineV2ListResult{ + // Value: []*armmigrate.AssessedMachineV2{ + // { + // Properties: &armmigrate.AssessedMachineV2Properties{ + // WorkloadType: to.Ptr(armmigrate.WorkloadTypeUnknown), + // Linkages: []*armmigrate.Linkages{ + // { + // WorkloadName: to.Ptr("ffpmzzx"), + // LinkageType: to.Ptr(armmigrate.LinkageTypeParent), + // Kind: to.Ptr(armmigrate.LinkageKindUnknown), + // ArmID: to.Ptr("nedxrqwdpcjvzclmruofufiyfp"), + // }, + // }, + // Recommendations: []*armmigrate.MachineAssessmentRecommendation{ + // { + // Configuration: &armmigrate.Configuration{ + // AzureTarget: to.Ptr(armmigrate.AzureTargetUnknown), + // SizingCriterion: to.Ptr(armmigrate.AssessmentSizingCriterionPerformanceBased), + // }, + // RecommendedFor: &armmigrate.RecommendedFor{ + // Strategies: []*armmigrate.StrategyType{ + // to.Ptr(armmigrate.StrategyTypePaaSPreferred), + // }, + // }, + // ConfidenceScore: to.Ptr[float32](13), + // MigrationSuitability: &armmigrate.MigrationSuitability{ + // Readiness: to.Ptr(armmigrate.CloudSuitabilityCommonUnknown), + // }, + // SecuritySuitability: &armmigrate.SecuritySuitability{ + // Readiness: to.Ptr(armmigrate.CloudSuitabilityCommonUnknown), + // }, + // TotalCost: []*armmigrate.CostDetailsCommon{ + // { + // CostDetail: []*armmigrate.NameValuePairCostType{ + // { + // Name: to.Ptr(armmigrate.CostTypeMonthlyStorageCost), + // Value: to.Ptr[float32](16), + // }, + // }, + // SavingOptions: to.Ptr(armmigrate.SavingsOptionsNone), + // }, + // }, + // TotalSavings: []*armmigrate.SavingsDetailsCommon{ + // { + // SavingsDetail: []*armmigrate.NameValuePairSavingsType{ + // { + // Name: to.Ptr(armmigrate.SavingsTypeMonthlyAzureHybridCostSavings), + // Value: to.Ptr[float32](5), + // }, + // }, + // SavingOptions: to.Ptr(armmigrate.SavingsOptionsNone), + // }, + // }, + // MigrationIssues: []*armmigrate.MigrationIssues{ + // { + // IssueCode: to.Ptr("broifuie"), + // IssueCategory: to.Ptr(armmigrate.MigrationIssuesCategoryIssue), + // IssueDescription: to.Ptr("krwqxftdw"), + // PossibleCause: to.Ptr("bxkjmkliilsa"), + // RecommendedActions: []*string{ + // to.Ptr("poomtsyvmfncnbv"), + // }, + // MoreInformation: []*armmigrate.MoreInformation{ + // { + // Title: to.Ptr("hqimzvxlatvzytoqfilyu"), + // URL: to.Ptr("bxsoybdfpd"), + // }, + // }, + // }, + // }, + // SKUs: []*armmigrate.SKUsMigrationSuitability{ + // { + // Kind: to.Ptr(armmigrate.SKUKindEndpoint), + // ResourceURI: to.Ptr("syg"), + // DisplayName: to.Ptr("jcxoygywmnqppfernysmzjwdnbnqkm"), + // ID: to.Ptr("bgwisesdkecmvyiadobszno"), + // Type: to.Ptr(armmigrate.SKUTypeUnknown), + // Sources: []*armmigrate.SourceRecommendationMigrationSuitability{ + // { + // Name: to.Ptr("cmenmvpoltkiewdrjzu"), + // MigrationSuitability: &armmigrate.MigrationSuitability{ + // Readiness: to.Ptr(armmigrate.CloudSuitabilityCommonUnknown), + // }, + // }, + // }, + // Details: &armmigrate.SKUDetails{ + // SKUType: to.Ptr(armmigrate.SKUTypeUnknown), + // SKUName: to.Ptr("fgplpqgdbosxyumpzoc"), + // Capabilities: []*armmigrate.NameValuePair{ + // { + // Name: to.Ptr("szlqwwhiebj"), + // Value: to.Ptr("pkrocddmpnkryngyrzomhjzeai"), + // }, + // }, + // TotalCost: []*armmigrate.CostDetailsCommon{ + // { + // CostDetail: []*armmigrate.NameValuePairCostType{ + // { + // Name: to.Ptr(armmigrate.CostTypeMonthlyStorageCost), + // Value: to.Ptr[float32](16), + // }, + // }, + // SavingOptions: to.Ptr(armmigrate.SavingsOptionsNone), + // }, + // }, + // TotalSavings: []*armmigrate.SavingsDetailsCommon{ + // { + // SavingsDetail: []*armmigrate.NameValuePairSavingsType{ + // { + // Name: to.Ptr(armmigrate.SavingsTypeMonthlyAzureHybridCostSavings), + // Value: to.Ptr[float32](5), + // }, + // }, + // SavingOptions: to.Ptr(armmigrate.SavingsOptionsNone), + // }, + // }, + // }, + // }, + // }, + // MigrationPlatform: to.Ptr(armmigrate.MigrationPlatformUnknown), + // }, + // }, + // ExtendedDetails: &armmigrate.AssessedMachineExtendedDetails{ + // DisplayName: to.Ptr("lflnrvlib"), + // ProductSupportStatus: &armmigrate.ProductSupportStatus{ + // CurrentVersion: to.Ptr("cgxjdbuabosuxrpjgfrjtzqkgndlsx"), + // ServicePackStatus: to.Ptr("rnznmjoibdxhqonnyiwf"), + // EsuStatus: to.Ptr("flrcxpamltntuyrc"), + // SupportStatus: to.Ptr("tujcyrwmckqqwmtapmbzhs"), + // Eta: to.Ptr[int32](17), + // CurrentEsuYear: to.Ptr("jtzzisk"), + // MainstreamEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:26.183Z"); return t}()), + // ExtendedSupportEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:26.183Z"); return t}()), + // ExtendedSecurityUpdateYear1EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:26.183Z"); return t}()), + // ExtendedSecurityUpdateYear2EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:26.183Z"); return t}()), + // ExtendedSecurityUpdateYear3EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:26.183Z"); return t}()), + // }, + // Disks: []*armmigrate.AssessedDiskDataV3{ + // { + // Name: to.Ptr("wxpcpldoajzgkftxghuqmjhqnzz"), + // DisplayName: to.Ptr("ulzxrtcaivlvb"), + // GigabytesProvisioned: to.Ptr[float32](12), + // MegabytesPerSecondOfRead: to.Ptr[float32](13), + // MegabytesPerSecondOfWrite: to.Ptr[float32](29), + // NumberOfReadOperationsPerSecond: to.Ptr[float32](2), + // NumberOfWriteOperationsPerSecond: to.Ptr[float32](22), + // }, + // }, + // HostProcessor: &armmigrate.ProcessorInfo{ + // Name: to.Ptr("szonbnup"), + // NumberOfSockets: to.Ptr[int32](8), + // NumberOfCoresPerSocket: to.Ptr[int32](20), + // }, + // NetworkAdapters: []*armmigrate.AssessedMachineNetworkAdaptersV3{ + // { + // Name: to.Ptr("uzelretpmbgehrecamebizdxshmgb"), + // NetGigabytesTransmittedPerMonth: to.Ptr[float32](10), + // MacAddress: to.Ptr("tguabzgtp"), + // IPAddresses: []*string{ + // to.Ptr("tdet"), + // }, + // MegabytesPerSecondRecieved: to.Ptr[float32](23), + // MegabytesPerSecondTransmitted: to.Ptr[float32](19), + // DisplayName: to.Ptr("syncmqcuhja"), + // }, + // }, + // BootType: to.Ptr(armmigrate.MachineBootTypeUnknown), + // OperatingSystemType: to.Ptr("hbassxigsetxwryywvdrvw"), + // OperatingSystemName: to.Ptr("twkefugwwwnedbnqde"), + // OperatingSystemVersion: to.Ptr("bqonvxtarsrjxx"), + // OperatingSystemArchitecture: to.Ptr(armmigrate.GuestOperatingSystemArchitectureUnknown), + // MegabytesOfMemory: to.Ptr[float32](19), + // NumberOfCores: to.Ptr[int32](3), + // PercentageCoresUtilization: to.Ptr[float32](9), + // PercentageMemoryUtilization: to.Ptr[float32](1), + // Errors: []*armmigrate.Error{ + // { + // ID: to.Ptr[int32](19), + // Code: to.Ptr("gwivqwge"), + // RunAsAccountID: to.Ptr("ympfiooryijkqbzzpyshimecwvgmj"), + // ApplianceName: to.Ptr("fdzovbudmavlezh"), + // Message: to.Ptr("dwqahjjqlripog"), + // SummaryMessage: to.Ptr("eiesjxrezalapqmxkxbxwrq"), + // AgentScenario: to.Ptr("cqhxfgqgejxlkjaydnwyqybhv"), + // PossibleCauses: to.Ptr("sppnxiswpon"), + // RecommendedAction: to.Ptr("sftmftcprumeayb"), + // Severity: to.Ptr("xlwmctkywvvefmgvqpi"), + // MessageParameters: []*armmigrate.NameValuePair{ + // { + // Name: to.Ptr("myslpcygyeruupywlrfnknjizkq"), + // Value: to.Ptr("wpmieiabnzdbxkumafwhylqjrfmvr"), + // }, + // }, + // UpdatedTimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:26.183Z"); return t}()), + // ImpactedAssessmentType: to.Ptr("wtb"), + // }, + // }, + // AssessedMachineType: to.Ptr(armmigrate.AssessedMachineTypeUnknown), + // Description: to.Ptr("rfjoclwlv"), + // }, + // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:26.183Z"); return t}()), + // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:26.183Z"); return t}()), + // }, + // ID: to.Ptr("/subscriptions/AEDD0824-BBE9-4E7C-8909-F46C68EA6BB9/resourceGroups/rgmachineAssessments/providers/Microsoft.Migrate/assessmentProjects/contosoProject/assessments/assessmentName/assessedMachines/machine1"), + // Name: to.Ptr("machine1"), + // Type: to.Ptr("Microsoft.Migrate/assessmentProjects/assessments/assessedMachines"), + // SystemData: &armmigrate.SystemData{ + // CreatedBy: to.Ptr("drvgxn"), + // CreatedByType: to.Ptr(armmigrate.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:25.000Z"); return t}()), + // LastModifiedBy: to.Ptr("qfyznkjasypfwyfmmkc"), + // LastModifiedByType: to.Ptr(armmigrate.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:25.000Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/migrate/armmigrate/assessments_client.go b/sdk/resourcemanager/migrate/armmigrate/assessments_client.go deleted file mode 100644 index d7e114231b84..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/assessments_client.go +++ /dev/null @@ -1,513 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// AssessmentsClient contains the methods for the Assessments group. -// Don't use this type directly, use NewAssessmentsClient() instead. -type AssessmentsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAssessmentsClient creates a new instance of AssessmentsClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewAssessmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AssessmentsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AssessmentsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Create a new assessment with the given name and the specified settings. Since name of an assessment in a project -// is a unique identifier, if an assessment with the name provided already exists, then -// the existing assessment is updated. -// Any PUT operation, resulting in either create or update on an assessment, will cause the assessment to go in a "InProgress" -// state. This will be indicated by the field 'computationState' on the -// Assessment object. During this time no other PUT operation will be allowed on that assessment object, nor will a Delete -// operation. Once the computation for the assessment is complete, the field -// 'computationState' will be updated to 'Ready', and then other PUT or DELETE operations can happen on the assessment. -// When assessment is under computation, any PUT will lead to a 400 - Bad Request error. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - assessmentName - Unique name of an assessment within a project. -// - options - AssessmentsClientCreateOptions contains the optional parameters for the AssessmentsClient.Create method. -func (client *AssessmentsClient) Create(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientCreateOptions) (AssessmentsClientCreateResponse, error) { - var err error - const operationName = "AssessmentsClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, groupName, assessmentName, options) - if err != nil { - return AssessmentsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AssessmentsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return AssessmentsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *AssessmentsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - if assessmentName == "" { - return nil, errors.New("parameter assessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Assessment != nil { - if err := runtime.MarshalAsJSON(req, *options.Assessment); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *AssessmentsClient) createHandleResponse(resp *http.Response) (AssessmentsClientCreateResponse, error) { - result := AssessmentsClientCreateResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.Assessment); err != nil { - return AssessmentsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Delete an assessment from the project. The machines remain in the assessment. Deleting a non-existent assessment -// results in a no-operation. -// When an assessment is under computation, as indicated by the 'computationState' field, it cannot be deleted. Any such attempt -// will return a 400 - Bad Request. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - assessmentName - Unique name of an assessment within a project. -// - options - AssessmentsClientDeleteOptions contains the optional parameters for the AssessmentsClient.Delete method. -func (client *AssessmentsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientDeleteOptions) (AssessmentsClientDeleteResponse, error) { - var err error - const operationName = "AssessmentsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, groupName, assessmentName, options) - if err != nil { - return AssessmentsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AssessmentsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return AssessmentsClientDeleteResponse{}, err - } - resp, err := client.deleteHandleResponse(httpResp) - return resp, err -} - -// deleteCreateRequest creates the Delete request. -func (client *AssessmentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - if assessmentName == "" { - return nil, errors.New("parameter assessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteHandleResponse handles the Delete response. -func (client *AssessmentsClient) deleteHandleResponse(resp *http.Response) (AssessmentsClientDeleteResponse, error) { - result := AssessmentsClientDeleteResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - return result, nil -} - -// Get - Get an existing assessment with the specified name. Returns a json object of type 'assessment' as specified in Models -// section. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - assessmentName - Unique name of an assessment within a project. -// - options - AssessmentsClientGetOptions contains the optional parameters for the AssessmentsClient.Get method. -func (client *AssessmentsClient) Get(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientGetOptions) (AssessmentsClientGetResponse, error) { - var err error - const operationName = "AssessmentsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, groupName, assessmentName, options) - if err != nil { - return AssessmentsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AssessmentsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AssessmentsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AssessmentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - if assessmentName == "" { - return nil, errors.New("parameter assessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *AssessmentsClient) getHandleResponse(resp *http.Response) (AssessmentsClientGetResponse, error) { - result := AssessmentsClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.Assessment); err != nil { - return AssessmentsClientGetResponse{}, err - } - return result, nil -} - -// GetReportDownloadURL - Get the URL for downloading the assessment in a report format. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - assessmentName - Unique name of an assessment within a project. -// - options - AssessmentsClientGetReportDownloadURLOptions contains the optional parameters for the AssessmentsClient.GetReportDownloadURL -// method. -func (client *AssessmentsClient) GetReportDownloadURL(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientGetReportDownloadURLOptions) (AssessmentsClientGetReportDownloadURLResponse, error) { - var err error - const operationName = "AssessmentsClient.GetReportDownloadURL" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getReportDownloadURLCreateRequest(ctx, resourceGroupName, projectName, groupName, assessmentName, options) - if err != nil { - return AssessmentsClientGetReportDownloadURLResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AssessmentsClientGetReportDownloadURLResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AssessmentsClientGetReportDownloadURLResponse{}, err - } - resp, err := client.getReportDownloadURLHandleResponse(httpResp) - return resp, err -} - -// getReportDownloadURLCreateRequest creates the GetReportDownloadURL request. -func (client *AssessmentsClient) getReportDownloadURLCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientGetReportDownloadURLOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}/downloadUrl" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - if assessmentName == "" { - return nil, errors.New("parameter assessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getReportDownloadURLHandleResponse handles the GetReportDownloadURL response. -func (client *AssessmentsClient) getReportDownloadURLHandleResponse(resp *http.Response) (AssessmentsClientGetReportDownloadURLResponse, error) { - result := AssessmentsClientGetReportDownloadURLResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.DownloadURL); err != nil { - return AssessmentsClientGetReportDownloadURLResponse{}, err - } - return result, nil -} - -// NewListByGroupPager - Get all assessments created for the specified group. -// Returns a json array of objects of type 'assessment' as specified in Models section. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - options - AssessmentsClientListByGroupOptions contains the optional parameters for the AssessmentsClient.NewListByGroupPager -// method. -func (client *AssessmentsClient) NewListByGroupPager(resourceGroupName string, projectName string, groupName string, options *AssessmentsClientListByGroupOptions) *runtime.Pager[AssessmentsClientListByGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[AssessmentsClientListByGroupResponse]{ - More: func(page AssessmentsClientListByGroupResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *AssessmentsClientListByGroupResponse) (AssessmentsClientListByGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AssessmentsClient.NewListByGroupPager") - req, err := client.listByGroupCreateRequest(ctx, resourceGroupName, projectName, groupName, options) - if err != nil { - return AssessmentsClientListByGroupResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AssessmentsClientListByGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AssessmentsClientListByGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listByGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByGroupCreateRequest creates the ListByGroup request. -func (client *AssessmentsClient) listByGroupCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *AssessmentsClientListByGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByGroupHandleResponse handles the ListByGroup response. -func (client *AssessmentsClient) listByGroupHandleResponse(resp *http.Response) (AssessmentsClientListByGroupResponse, error) { - result := AssessmentsClientListByGroupResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.AssessmentResultList); err != nil { - return AssessmentsClientListByGroupResponse{}, err - } - return result, nil -} - -// NewListByProjectPager - Get all assessments created in the project. -// Returns a json array of objects of type 'assessment' as specified in Models section. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - AssessmentsClientListByProjectOptions contains the optional parameters for the AssessmentsClient.NewListByProjectPager -// method. -func (client *AssessmentsClient) NewListByProjectPager(resourceGroupName string, projectName string, options *AssessmentsClientListByProjectOptions) *runtime.Pager[AssessmentsClientListByProjectResponse] { - return runtime.NewPager(runtime.PagingHandler[AssessmentsClientListByProjectResponse]{ - More: func(page AssessmentsClientListByProjectResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *AssessmentsClientListByProjectResponse) (AssessmentsClientListByProjectResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AssessmentsClient.NewListByProjectPager") - req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return AssessmentsClientListByProjectResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AssessmentsClientListByProjectResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AssessmentsClientListByProjectResponse{}, runtime.NewResponseError(resp) - } - return client.listByProjectHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByProjectCreateRequest creates the ListByProject request. -func (client *AssessmentsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *AssessmentsClientListByProjectOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessments" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByProjectHandleResponse handles the ListByProject response. -func (client *AssessmentsClient) listByProjectHandleResponse(resp *http.Response) (AssessmentsClientListByProjectResponse, error) { - result := AssessmentsClientListByProjectResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.AssessmentResultList); err != nil { - return AssessmentsClientListByProjectResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/assessments_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/assessments_client_example_test.go deleted file mode 100644 index 76b50d0146e2..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/assessments_client_example_test.go +++ /dev/null @@ -1,511 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Assessments_ListByGroup.json -func ExampleAssessmentsClient_NewListByGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAssessmentsClient().NewListByGroupPager("abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Test1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AssessmentResultList = armmigrate.AssessmentResultList{ - // Value: []*armmigrate.Assessment{ - // { - // Name: to.Ptr("assessment_5_9_2019_16_22_14"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups/assessments"), - // ETag: to.Ptr("\"21009c31-0000-0d00-0000-5cd585ad0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1/assessments/assessment_5_9_2019_16_22_14"), - // Properties: &armmigrate.AssessmentProperties{ - // AzureDiskType: to.Ptr(armmigrate.AzureDiskTypeStandardOrPremium), - // AzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitYes), - // AzureLocation: to.Ptr(armmigrate.AzureLocationNorthEurope), - // AzureOfferCode: to.Ptr(armmigrate.AzureOfferCodeMSAZR0003P), - // AzurePricingTier: to.Ptr(armmigrate.AzurePricingTierStandard), - // AzureStorageRedundancy: to.Ptr(armmigrate.AzureStorageRedundancyLocallyRedundant), - // AzureVMFamilies: []*armmigrate.AzureVMFamily{ - // to.Ptr(armmigrate.AzureVMFamilyDv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFSeries), - // to.Ptr(armmigrate.AzureVMFamilyDv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSSeries), - // to.Ptr(armmigrate.AzureVMFamilyDSv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFsSeries), - // to.Ptr(armmigrate.AzureVMFamilyDsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSeries), - // to.Ptr(armmigrate.AzureVMFamilyMSeries), - // to.Ptr(armmigrate.AzureVMFamilyFsv2Series), - // to.Ptr(armmigrate.AzureVMFamilyHSeries)}, - // ConfidenceRatingInPercentage: to.Ptr[float64](0), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:14.489Z"); return t}()), - // Currency: to.Ptr(armmigrate.CurrencyUSD), - // DiscountPercentage: to.Ptr[float64](0), - // MonthlyBandwidthCost: to.Ptr[float64](0), - // MonthlyComputeCost: to.Ptr[float64](2588.830584), - // MonthlyPremiumStorageCost: to.Ptr[float64](0), - // MonthlyStandardSSDStorageCost: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](238.016), - // NumberOfMachines: to.Ptr[int32](26), - // Percentile: to.Ptr(armmigrate.PercentilePercentile95), - // PerfDataEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:14.489Z"); return t}()), - // PerfDataStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-08T10:52:14.489Z"); return t}()), - // PricesTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-26T11:07:37.139Z"); return t}()), - // ReservedInstance: to.Ptr(armmigrate.ReservedInstanceRI3Year), - // ScalingFactor: to.Ptr[float64](1), - // SizingCriterion: to.Ptr(armmigrate.AssessmentSizingCriterionPerformanceBased), - // Stage: to.Ptr(armmigrate.AssessmentStageInProgress), - // Status: to.Ptr(armmigrate.AssessmentStatusOutDated), - // TimeRange: to.Ptr(armmigrate.TimeRangeDay), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:14.489Z"); return t}()), - // VMUptime: &armmigrate.VMUptime{ - // DaysPerMonth: to.Ptr[int32](31), - // HoursPerDay: to.Ptr[int32](24), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Assessments_ListByProject.json -func ExampleAssessmentsClient_NewListByProjectPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAssessmentsClient().NewListByProjectPager("abgoyal-westEurope", "abgoyalWEselfhostb72bproject", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AssessmentResultList = armmigrate.AssessmentResultList{ - // Value: []*armmigrate.Assessment{ - // { - // Name: to.Ptr("assessment_5_9_2019_16_22_14"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups/assessments"), - // ETag: to.Ptr("\"21009c31-0000-0d00-0000-5cd585ad0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1/assessments/assessment_5_9_2019_16_22_14"), - // Properties: &armmigrate.AssessmentProperties{ - // AzureDiskType: to.Ptr(armmigrate.AzureDiskTypeStandardOrPremium), - // AzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitYes), - // AzureLocation: to.Ptr(armmigrate.AzureLocationNorthEurope), - // AzureOfferCode: to.Ptr(armmigrate.AzureOfferCodeMSAZR0003P), - // AzurePricingTier: to.Ptr(armmigrate.AzurePricingTierStandard), - // AzureStorageRedundancy: to.Ptr(armmigrate.AzureStorageRedundancyLocallyRedundant), - // AzureVMFamilies: []*armmigrate.AzureVMFamily{ - // to.Ptr(armmigrate.AzureVMFamilyDv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFSeries), - // to.Ptr(armmigrate.AzureVMFamilyDv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSSeries), - // to.Ptr(armmigrate.AzureVMFamilyDSv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFsSeries), - // to.Ptr(armmigrate.AzureVMFamilyDsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSeries), - // to.Ptr(armmigrate.AzureVMFamilyMSeries), - // to.Ptr(armmigrate.AzureVMFamilyFsv2Series), - // to.Ptr(armmigrate.AzureVMFamilyHSeries)}, - // ConfidenceRatingInPercentage: to.Ptr[float64](0), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:14.489Z"); return t}()), - // Currency: to.Ptr(armmigrate.CurrencyUSD), - // DiscountPercentage: to.Ptr[float64](0), - // MonthlyBandwidthCost: to.Ptr[float64](0), - // MonthlyComputeCost: to.Ptr[float64](2588.830584), - // MonthlyPremiumStorageCost: to.Ptr[float64](0), - // MonthlyStandardSSDStorageCost: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](238.016), - // NumberOfMachines: to.Ptr[int32](26), - // Percentile: to.Ptr(armmigrate.PercentilePercentile95), - // PerfDataEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:14.489Z"); return t}()), - // PerfDataStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-08T10:52:14.489Z"); return t}()), - // PricesTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-26T11:07:37.139Z"); return t}()), - // ReservedInstance: to.Ptr(armmigrate.ReservedInstanceRI3Year), - // ScalingFactor: to.Ptr[float64](1), - // SizingCriterion: to.Ptr(armmigrate.AssessmentSizingCriterionPerformanceBased), - // Stage: to.Ptr(armmigrate.AssessmentStageInProgress), - // Status: to.Ptr(armmigrate.AssessmentStatusOutDated), - // TimeRange: to.Ptr(armmigrate.TimeRangeDay), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:14.489Z"); return t}()), - // VMUptime: &armmigrate.VMUptime{ - // DaysPerMonth: to.Ptr[int32](31), - // HoursPerDay: to.Ptr[int32](24), - // }, - // }, - // }, - // { - // Name: to.Ptr("assessment_5_9_2019_17_0_56"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups/assessments"), - // ETag: to.Ptr("\"1e000c2c-0000-0d00-0000-5cdaa4190000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Group2/assessments/assessment_5_9_2019_17_0_56"), - // Properties: &armmigrate.AssessmentProperties{ - // AzureDiskType: to.Ptr(armmigrate.AzureDiskTypeStandardOrPremium), - // AzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitYes), - // AzureLocation: to.Ptr(armmigrate.AzureLocationNorthEurope), - // AzureOfferCode: to.Ptr(armmigrate.AzureOfferCodeMSAZR0003P), - // AzurePricingTier: to.Ptr(armmigrate.AzurePricingTierStandard), - // AzureStorageRedundancy: to.Ptr(armmigrate.AzureStorageRedundancyLocallyRedundant), - // AzureVMFamilies: []*armmigrate.AzureVMFamily{ - // to.Ptr(armmigrate.AzureVMFamilyDv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFSeries), - // to.Ptr(armmigrate.AzureVMFamilyDv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSSeries), - // to.Ptr(armmigrate.AzureVMFamilyDSv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFsSeries), - // to.Ptr(armmigrate.AzureVMFamilyDsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSeries), - // to.Ptr(armmigrate.AzureVMFamilyMSeries), - // to.Ptr(armmigrate.AzureVMFamilyFsv2Series), - // to.Ptr(armmigrate.AzureVMFamilyHSeries)}, - // ConfidenceRatingInPercentage: to.Ptr[float64](0), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T11:30:57.003Z"); return t}()), - // Currency: to.Ptr(armmigrate.CurrencyUSD), - // DiscountPercentage: to.Ptr[float64](0), - // MonthlyBandwidthCost: to.Ptr[float64](0), - // MonthlyComputeCost: to.Ptr[float64](607.443264), - // MonthlyPremiumStorageCost: to.Ptr[float64](0), - // MonthlyStandardSSDStorageCost: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](111.36), - // NumberOfMachines: to.Ptr[int32](5), - // Percentile: to.Ptr(armmigrate.PercentilePercentile95), - // PerfDataEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T11:30:57.003Z"); return t}()), - // PerfDataStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-08T11:30:57.003Z"); return t}()), - // PricesTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-26T11:07:37.139Z"); return t}()), - // ReservedInstance: to.Ptr(armmigrate.ReservedInstanceRI3Year), - // ScalingFactor: to.Ptr[float64](1), - // SizingCriterion: to.Ptr(armmigrate.AssessmentSizingCriterionPerformanceBased), - // Stage: to.Ptr(armmigrate.AssessmentStageInProgress), - // Status: to.Ptr(armmigrate.AssessmentStatusCompleted), - // TimeRange: to.Ptr(armmigrate.TimeRangeDay), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T11:30:57.003Z"); return t}()), - // VMUptime: &armmigrate.VMUptime{ - // DaysPerMonth: to.Ptr[int32](31), - // HoursPerDay: to.Ptr[int32](24), - // }, - // }, - // }, - // { - // Name: to.Ptr("assessment_5_14_2019_16_48_47"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups/assessments"), - // ETag: to.Ptr("\"1e000c2c-0000-0d00-0000-5cdaa4190000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Group2/assessments/assessment_5_14_2019_16_48_47"), - // Properties: &armmigrate.AssessmentProperties{ - // AzureDiskType: to.Ptr(armmigrate.AzureDiskTypeStandardOrPremium), - // AzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitYes), - // AzureLocation: to.Ptr(armmigrate.AzureLocationNorthEurope), - // AzureOfferCode: to.Ptr(armmigrate.AzureOfferCodeMSAZR0003P), - // AzurePricingTier: to.Ptr(armmigrate.AzurePricingTierStandard), - // AzureStorageRedundancy: to.Ptr(armmigrate.AzureStorageRedundancyLocallyRedundant), - // AzureVMFamilies: []*armmigrate.AzureVMFamily{ - // to.Ptr(armmigrate.AzureVMFamilyDv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFSeries), - // to.Ptr(armmigrate.AzureVMFamilyDv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSSeries), - // to.Ptr(armmigrate.AzureVMFamilyDSv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFsSeries), - // to.Ptr(armmigrate.AzureVMFamilyDsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSeries), - // to.Ptr(armmigrate.AzureVMFamilyMSeries), - // to.Ptr(armmigrate.AzureVMFamilyFsv2Series), - // to.Ptr(armmigrate.AzureVMFamilyHSeries)}, - // ConfidenceRatingInPercentage: to.Ptr[float64](0), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:47.789Z"); return t}()), - // Currency: to.Ptr(armmigrate.CurrencyUSD), - // DiscountPercentage: to.Ptr[float64](0), - // MonthlyBandwidthCost: to.Ptr[float64](0), - // MonthlyComputeCost: to.Ptr[float64](607.443264), - // MonthlyPremiumStorageCost: to.Ptr[float64](0), - // MonthlyStandardSSDStorageCost: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](111.36), - // NumberOfMachines: to.Ptr[int32](5), - // Percentile: to.Ptr(armmigrate.PercentilePercentile95), - // PerfDataEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:47.789Z"); return t}()), - // PerfDataStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-13T11:18:47.789Z"); return t}()), - // PricesTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-26T11:07:37.139Z"); return t}()), - // ReservedInstance: to.Ptr(armmigrate.ReservedInstanceRI3Year), - // ScalingFactor: to.Ptr[float64](1), - // SizingCriterion: to.Ptr(armmigrate.AssessmentSizingCriterionPerformanceBased), - // Stage: to.Ptr(armmigrate.AssessmentStageInProgress), - // Status: to.Ptr(armmigrate.AssessmentStatusCompleted), - // TimeRange: to.Ptr(armmigrate.TimeRangeDay), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:47.789Z"); return t}()), - // VMUptime: &armmigrate.VMUptime{ - // DaysPerMonth: to.Ptr[int32](31), - // HoursPerDay: to.Ptr[int32](24), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Assessments_Get.json -func ExampleAssessmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssessmentsClient().Get(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Test1", "assessment_5_9_2019_16_22_14", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Assessment = armmigrate.Assessment{ - // Name: to.Ptr("assessment_5_9_2019_16_22_14"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups/assessments"), - // ETag: to.Ptr("\"21009c31-0000-0d00-0000-5cd585ad0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1/assessments/assessment_5_9_2019_16_22_14"), - // Properties: &armmigrate.AssessmentProperties{ - // AzureDiskType: to.Ptr(armmigrate.AzureDiskTypeStandardOrPremium), - // AzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitYes), - // AzureLocation: to.Ptr(armmigrate.AzureLocationNorthEurope), - // AzureOfferCode: to.Ptr(armmigrate.AzureOfferCodeMSAZR0003P), - // AzurePricingTier: to.Ptr(armmigrate.AzurePricingTierStandard), - // AzureStorageRedundancy: to.Ptr(armmigrate.AzureStorageRedundancyLocallyRedundant), - // AzureVMFamilies: []*armmigrate.AzureVMFamily{ - // to.Ptr(armmigrate.AzureVMFamilyDv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFSeries), - // to.Ptr(armmigrate.AzureVMFamilyDv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSSeries), - // to.Ptr(armmigrate.AzureVMFamilyDSv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFsSeries), - // to.Ptr(armmigrate.AzureVMFamilyDsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSeries), - // to.Ptr(armmigrate.AzureVMFamilyMSeries), - // to.Ptr(armmigrate.AzureVMFamilyFsv2Series), - // to.Ptr(armmigrate.AzureVMFamilyHSeries)}, - // ConfidenceRatingInPercentage: to.Ptr[float64](0), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:14.489Z"); return t}()), - // Currency: to.Ptr(armmigrate.CurrencyUSD), - // DiscountPercentage: to.Ptr[float64](0), - // MonthlyBandwidthCost: to.Ptr[float64](0), - // MonthlyComputeCost: to.Ptr[float64](2588.830584), - // MonthlyPremiumStorageCost: to.Ptr[float64](0), - // MonthlyStandardSSDStorageCost: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](238.016), - // NumberOfMachines: to.Ptr[int32](26), - // Percentile: to.Ptr(armmigrate.PercentilePercentile95), - // PerfDataEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:14.489Z"); return t}()), - // PerfDataStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-08T10:52:14.489Z"); return t}()), - // PricesTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-26T11:07:37.139Z"); return t}()), - // ReservedInstance: to.Ptr(armmigrate.ReservedInstanceRI3Year), - // ScalingFactor: to.Ptr[float64](1), - // SizingCriterion: to.Ptr(armmigrate.AssessmentSizingCriterionPerformanceBased), - // Stage: to.Ptr(armmigrate.AssessmentStageInProgress), - // Status: to.Ptr(armmigrate.AssessmentStatusOutDated), - // TimeRange: to.Ptr(armmigrate.TimeRangeDay), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:14.489Z"); return t}()), - // VMUptime: &armmigrate.VMUptime{ - // DaysPerMonth: to.Ptr[int32](31), - // HoursPerDay: to.Ptr[int32](24), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Assessments_Create.json -func ExampleAssessmentsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssessmentsClient().Create(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Group2", "assessment_5_14_2019_16_48_47", &armmigrate.AssessmentsClientCreateOptions{Assessment: &armmigrate.Assessment{ - ETag: to.Ptr("\"1e000c2c-0000-0d00-0000-5cdaa4190000\""), - Properties: &armmigrate.AssessmentProperties{ - AzureDiskType: to.Ptr(armmigrate.AzureDiskTypeStandardOrPremium), - AzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitYes), - AzureLocation: to.Ptr(armmigrate.AzureLocationNorthEurope), - AzureOfferCode: to.Ptr(armmigrate.AzureOfferCodeMSAZR0003P), - AzurePricingTier: to.Ptr(armmigrate.AzurePricingTierStandard), - AzureStorageRedundancy: to.Ptr(armmigrate.AzureStorageRedundancyLocallyRedundant), - AzureVMFamilies: []*armmigrate.AzureVMFamily{ - to.Ptr(armmigrate.AzureVMFamilyDv2Series), - to.Ptr(armmigrate.AzureVMFamilyFSeries), - to.Ptr(armmigrate.AzureVMFamilyDv3Series), - to.Ptr(armmigrate.AzureVMFamilyDSSeries), - to.Ptr(armmigrate.AzureVMFamilyDSv2Series), - to.Ptr(armmigrate.AzureVMFamilyFsSeries), - to.Ptr(armmigrate.AzureVMFamilyDsv3Series), - to.Ptr(armmigrate.AzureVMFamilyEv3Series), - to.Ptr(armmigrate.AzureVMFamilyEsv3Series), - to.Ptr(armmigrate.AzureVMFamilyDSeries), - to.Ptr(armmigrate.AzureVMFamilyMSeries), - to.Ptr(armmigrate.AzureVMFamilyFsv2Series), - to.Ptr(armmigrate.AzureVMFamilyHSeries)}, - Currency: to.Ptr(armmigrate.CurrencyUSD), - DiscountPercentage: to.Ptr[float64](100), - Percentile: to.Ptr(armmigrate.PercentilePercentile95), - ReservedInstance: to.Ptr(armmigrate.ReservedInstanceRI3Year), - ScalingFactor: to.Ptr[float64](1), - SizingCriterion: to.Ptr(armmigrate.AssessmentSizingCriterionPerformanceBased), - Stage: to.Ptr(armmigrate.AssessmentStageInProgress), - TimeRange: to.Ptr(armmigrate.TimeRangeDay), - VMUptime: &armmigrate.VMUptime{ - DaysPerMonth: to.Ptr[int32](31), - HoursPerDay: to.Ptr[int32](24), - }, - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Assessment = armmigrate.Assessment{ - // Name: to.Ptr("assessment_5_14_2019_16_48_47"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups/assessments"), - // ETag: to.Ptr("\"1e000c2c-0000-0d00-0000-5cdaa4190000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Group2/assessments/assessment_5_14_2019_16_48_47"), - // Properties: &armmigrate.AssessmentProperties{ - // AzureDiskType: to.Ptr(armmigrate.AzureDiskTypeStandardOrPremium), - // AzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitYes), - // AzureLocation: to.Ptr(armmigrate.AzureLocationNorthEurope), - // AzureOfferCode: to.Ptr(armmigrate.AzureOfferCodeMSAZR0003P), - // AzurePricingTier: to.Ptr(armmigrate.AzurePricingTierStandard), - // AzureStorageRedundancy: to.Ptr(armmigrate.AzureStorageRedundancyLocallyRedundant), - // AzureVMFamilies: []*armmigrate.AzureVMFamily{ - // to.Ptr(armmigrate.AzureVMFamilyDv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFSeries), - // to.Ptr(armmigrate.AzureVMFamilyDv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSSeries), - // to.Ptr(armmigrate.AzureVMFamilyDSv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFsSeries), - // to.Ptr(armmigrate.AzureVMFamilyDsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSeries), - // to.Ptr(armmigrate.AzureVMFamilyMSeries), - // to.Ptr(armmigrate.AzureVMFamilyFsv2Series), - // to.Ptr(armmigrate.AzureVMFamilyHSeries)}, - // ConfidenceRatingInPercentage: to.Ptr[float64](0), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:47.789Z"); return t}()), - // Currency: to.Ptr(armmigrate.CurrencyUSD), - // DiscountPercentage: to.Ptr[float64](0), - // MonthlyBandwidthCost: to.Ptr[float64](0), - // MonthlyComputeCost: to.Ptr[float64](607.443264), - // MonthlyPremiumStorageCost: to.Ptr[float64](0), - // MonthlyStandardSSDStorageCost: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](111.36), - // NumberOfMachines: to.Ptr[int32](5), - // Percentile: to.Ptr(armmigrate.PercentilePercentile95), - // PerfDataEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:47.789Z"); return t}()), - // PerfDataStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-13T11:18:47.789Z"); return t}()), - // PricesTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-26T11:07:37.139Z"); return t}()), - // ReservedInstance: to.Ptr(armmigrate.ReservedInstanceRI3Year), - // ScalingFactor: to.Ptr[float64](1), - // SizingCriterion: to.Ptr(armmigrate.AssessmentSizingCriterionPerformanceBased), - // Stage: to.Ptr(armmigrate.AssessmentStageInProgress), - // Status: to.Ptr(armmigrate.AssessmentStatusCompleted), - // TimeRange: to.Ptr(armmigrate.TimeRangeDay), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:47.789Z"); return t}()), - // VMUptime: &armmigrate.VMUptime{ - // DaysPerMonth: to.Ptr[int32](31), - // HoursPerDay: to.Ptr[int32](24), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Assessments_Delete.json -func ExampleAssessmentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAssessmentsClient().Delete(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Test1", "assessment_5_9_2019_16_22_14", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Assessments_GetReportDownloadUrl.json -func ExampleAssessmentsClient_GetReportDownloadURL() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssessmentsClient().GetReportDownloadURL(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Test1", "assessment_5_9_2019_16_22_14", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DownloadURL = armmigrate.DownloadURL{ - // AssessmentReportURL: to.Ptr("link-to-download-assessment-report"), - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-05T13:17:23.543Z"); return t}()), - // } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/autorest.md b/sdk/resourcemanager/migrate/armmigrate/autorest.md deleted file mode 100644 index 7bc45e58d2a4..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/autorest.md +++ /dev/null @@ -1,13 +0,0 @@ -### AutoRest Configuration - -> see https://aka.ms/autorest - -``` yaml -azure-arm: true -require: -- https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/readme.go.md -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.2.0 - -``` \ No newline at end of file diff --git a/sdk/resourcemanager/migrate/armmigrate/build.go b/sdk/resourcemanager/migrate/armmigrate/build.go deleted file mode 100644 index ba3d27807162..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/build.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -// This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/migrate/armmigrate - -package armmigrate diff --git a/sdk/resourcemanager/migrate/armmigrate/client_factory.go b/sdk/resourcemanager/migrate/armmigrate/client_factory.go index b999a6f2a261..8dcb6fd803aa 100644 --- a/sdk/resourcemanager/migrate/armmigrate/client_factory.go +++ b/sdk/resourcemanager/migrate/armmigrate/client_factory.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmigrate @@ -17,94 +13,60 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - Azure Subscription Id in which project was created. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - subscriptionID: subscriptionID, credential: credential, - options: options.Clone(), + subscriptionID: subscriptionID, + internal: internal, }, nil } -// NewAssessedMachinesClient creates a new instance of AssessedMachinesClient. -func (c *ClientFactory) NewAssessedMachinesClient() *AssessedMachinesClient { - subClient, _ := NewAssessedMachinesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewAssessmentsClient creates a new instance of AssessmentsClient. -func (c *ClientFactory) NewAssessmentsClient() *AssessmentsClient { - subClient, _ := NewAssessmentsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewGroupsClient creates a new instance of GroupsClient. -func (c *ClientFactory) NewGroupsClient() *GroupsClient { - subClient, _ := NewGroupsClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewAssessedMachinesV2OperationsClient creates a new instance of AssessedMachinesV2OperationsClient. +func (c *ClientFactory) NewAssessedMachinesV2OperationsClient() *AssessedMachinesV2OperationsClient { + return &AssessedMachinesV2OperationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewHyperVCollectorsClient creates a new instance of HyperVCollectorsClient. -func (c *ClientFactory) NewHyperVCollectorsClient() *HyperVCollectorsClient { - subClient, _ := NewHyperVCollectorsClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewMachineAssessmentV2SummaryOperationsClient creates a new instance of MachineAssessmentV2SummaryOperationsClient. +func (c *ClientFactory) NewMachineAssessmentV2SummaryOperationsClient() *MachineAssessmentV2SummaryOperationsClient { + return &MachineAssessmentV2SummaryOperationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewImportCollectorsClient creates a new instance of ImportCollectorsClient. -func (c *ClientFactory) NewImportCollectorsClient() *ImportCollectorsClient { - subClient, _ := NewImportCollectorsClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewMachineAssessmentsV2OperationsClient creates a new instance of MachineAssessmentsV2OperationsClient. +func (c *ClientFactory) NewMachineAssessmentsV2OperationsClient() *MachineAssessmentsV2OperationsClient { + return &MachineAssessmentsV2OperationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewMachinesClient creates a new instance of MachinesClient. -func (c *ClientFactory) NewMachinesClient() *MachinesClient { - subClient, _ := NewMachinesClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewMachineGraphAssessmentOptionsOperationsClient creates a new instance of MachineGraphAssessmentOptionsOperationsClient. +func (c *ClientFactory) NewMachineGraphAssessmentOptionsOperationsClient() *MachineGraphAssessmentOptionsOperationsClient { + return &MachineGraphAssessmentOptionsOperationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient -} - -// NewPrivateEndpointConnectionClient creates a new instance of PrivateEndpointConnectionClient. -func (c *ClientFactory) NewPrivateEndpointConnectionClient() *PrivateEndpointConnectionClient { - subClient, _ := NewPrivateEndpointConnectionClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewPrivateLinkResourceClient creates a new instance of PrivateLinkResourceClient. -func (c *ClientFactory) NewPrivateLinkResourceClient() *PrivateLinkResourceClient { - subClient, _ := NewPrivateLinkResourceClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewProjectsClient creates a new instance of ProjectsClient. -func (c *ClientFactory) NewProjectsClient() *ProjectsClient { - subClient, _ := NewProjectsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewServerCollectorsClient creates a new instance of ServerCollectorsClient. -func (c *ClientFactory) NewServerCollectorsClient() *ServerCollectorsClient { - subClient, _ := NewServerCollectorsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewVMwareCollectorsClient creates a new instance of VMwareCollectorsClient. -func (c *ClientFactory) NewVMwareCollectorsClient() *VMwareCollectorsClient { - subClient, _ := NewVMwareCollectorsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &OperationsClient{ + internal: c.internal, + } } diff --git a/sdk/resourcemanager/migrate/armmigrate/constants.go b/sdk/resourcemanager/migrate/armmigrate/constants.go index 987064342fa7..4f05204c53c0 100644 --- a/sdk/resourcemanager/migrate/armmigrate/constants.go +++ b/sdk/resourcemanager/migrate/armmigrate/constants.go @@ -1,23 +1,60 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmigrate const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - moduleVersion = "v1.2.0" + moduleVersion = "v2.0.0-beta.1" +) + +// ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + // ActionTypeInternal - Actions are for internal-only APIs. + ActionTypeInternal ActionType = "Internal" ) -// AssessmentSizingCriterion - Assessment sizing criterion. +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// AssessedMachineType - Assessed machine type +type AssessedMachineType string + +const ( + // AssessedMachineTypeAssessedMachine - AssessedMachine - Assessed machine type + AssessedMachineTypeAssessedMachine AssessedMachineType = "AssessedMachine" + // AssessedMachineTypeAvsAssessedMachine - AvsAssessedMachine - Assessed machine type + AssessedMachineTypeAvsAssessedMachine AssessedMachineType = "AvsAssessedMachine" + // AssessedMachineTypeSQLAssessedMachine - SqlAssessedMachine - Assessed machine type + AssessedMachineTypeSQLAssessedMachine AssessedMachineType = "SqlAssessedMachine" + // AssessedMachineTypeUnknown - Unknown - Assessed machine type + AssessedMachineTypeUnknown AssessedMachineType = "Unknown" +) + +// PossibleAssessedMachineTypeValues returns the possible values for the AssessedMachineType const type. +func PossibleAssessedMachineTypeValues() []AssessedMachineType { + return []AssessedMachineType{ + AssessedMachineTypeAssessedMachine, + AssessedMachineTypeAvsAssessedMachine, + AssessedMachineTypeSQLAssessedMachine, + AssessedMachineTypeUnknown, + } +} + +// AssessmentSizingCriterion - Assessment Sizing Criteria. type AssessmentSizingCriterion string const ( - AssessmentSizingCriterionAsOnPremises AssessmentSizingCriterion = "AsOnPremises" + // AssessmentSizingCriterionAsOnPremises - As On Premises or Static Data based Sizing. + AssessmentSizingCriterionAsOnPremises AssessmentSizingCriterion = "AsOnPremises" + // AssessmentSizingCriterionPerformanceBased - Performance Data based Sizing. AssessmentSizingCriterionPerformanceBased AssessmentSizingCriterion = "PerformanceBased" ) @@ -29,35 +66,76 @@ func PossibleAssessmentSizingCriterionValues() []AssessmentSizingCriterion { } } -// AssessmentStage - User configurable setting that describes the status of the assessment. -type AssessmentStage string +// AssessmentSource - Assessment Source +type AssessmentSource string const ( - AssessmentStageApproved AssessmentStage = "Approved" - AssessmentStageInProgress AssessmentStage = "InProgress" - AssessmentStageUnderReview AssessmentStage = "UnderReview" + // AssessmentSourceIIS - IIS - Assessment Source + AssessmentSourceIIS AssessmentSource = "IIS" + // AssessmentSourceMachine - Machine - Assessment Source + AssessmentSourceMachine AssessmentSource = "Machine" + // AssessmentSourceMySQLServer - MySQLServer - Assessment Source + AssessmentSourceMySQLServer AssessmentSource = "MySQLServer" + // AssessmentSourceOracleDatabase - OracleDatabase - Assessment Source + AssessmentSourceOracleDatabase AssessmentSource = "OracleDatabase" + // AssessmentSourceOracleServer - OracleServer - Assessment Source + AssessmentSourceOracleServer AssessmentSource = "OracleServer" + // AssessmentSourceSAPInstance - SAPInstance - Assessment Source + AssessmentSourceSAPInstance AssessmentSource = "SAPInstance" + // AssessmentSourceSQLDatabase - SqlDatabase - Assessment Source + AssessmentSourceSQLDatabase AssessmentSource = "SqlDatabase" + // AssessmentSourceSQLInstance - SqlInstance - Assessment Source + AssessmentSourceSQLInstance AssessmentSource = "SqlInstance" + // AssessmentSourceSpringbootApplication - SpringbootApplication - Assessment Source + AssessmentSourceSpringbootApplication AssessmentSource = "SpringbootApplication" + // AssessmentSourceTomCat - TomCat - Assessment Source + AssessmentSourceTomCat AssessmentSource = "TomCat" + // AssessmentSourceUnknown - Unknown - Assessment Source + AssessmentSourceUnknown AssessmentSource = "Unknown" + // AssessmentSourceWebApps - WebApps - Assessment Source + AssessmentSourceWebApps AssessmentSource = "WebApps" ) -// PossibleAssessmentStageValues returns the possible values for the AssessmentStage const type. -func PossibleAssessmentStageValues() []AssessmentStage { - return []AssessmentStage{ - AssessmentStageApproved, - AssessmentStageInProgress, - AssessmentStageUnderReview, +// PossibleAssessmentSourceValues returns the possible values for the AssessmentSource const type. +func PossibleAssessmentSourceValues() []AssessmentSource { + return []AssessmentSource{ + AssessmentSourceIIS, + AssessmentSourceMachine, + AssessmentSourceMySQLServer, + AssessmentSourceOracleDatabase, + AssessmentSourceOracleServer, + AssessmentSourceSAPInstance, + AssessmentSourceSQLDatabase, + AssessmentSourceSQLInstance, + AssessmentSourceSpringbootApplication, + AssessmentSourceTomCat, + AssessmentSourceUnknown, + AssessmentSourceWebApps, } } -// AssessmentStatus - Whether the assessment has been created and is valid. +// AssessmentStatus - Assessment Status. type AssessmentStatus string const ( + // AssessmentStatusCompleted - Assessment is Completed or Ready. AssessmentStatusCompleted AssessmentStatus = "Completed" - AssessmentStatusCreated AssessmentStatus = "Created" - AssessmentStatusInvalid AssessmentStatus = "Invalid" - AssessmentStatusOutDated AssessmentStatus = "OutDated" + // AssessmentStatusCreated - Assessment is Created. + AssessmentStatusCreated AssessmentStatus = "Created" + // AssessmentStatusDeleted - Assessment is Deleted. + AssessmentStatusDeleted AssessmentStatus = "Deleted" + // AssessmentStatusFailed - Assessment has Failed. + AssessmentStatusFailed AssessmentStatus = "Failed" + // AssessmentStatusInvalid - Assessment is Failed i.e. it is now invalid. + AssessmentStatusInvalid AssessmentStatus = "Invalid" + // AssessmentStatusOutDated - Assessment is Out Dated. + AssessmentStatusOutDated AssessmentStatus = "OutDated" + // AssessmentStatusOutOfSync - Assessment is Out of Sync. AssessmentStatusOutOfSync AssessmentStatus = "OutOfSync" - AssessmentStatusRunning AssessmentStatus = "Running" - AssessmentStatusUpdated AssessmentStatus = "Updated" + // AssessmentStatusRunning - Assessment is currently running. + AssessmentStatusRunning AssessmentStatus = "Running" + // AssessmentStatusUpdated - Assessment is Updated. + AssessmentStatusUpdated AssessmentStatus = "Updated" ) // PossibleAssessmentStatusValues returns the possible values for the AssessmentStatus const type. @@ -65,6 +143,8 @@ func PossibleAssessmentStatusValues() []AssessmentStatus { return []AssessmentStatus{ AssessmentStatusCompleted, AssessmentStatusCreated, + AssessmentStatusDeleted, + AssessmentStatusFailed, AssessmentStatusInvalid, AssessmentStatusOutDated, AssessmentStatusOutOfSync, @@ -73,184 +153,139 @@ func PossibleAssessmentStatusValues() []AssessmentStatus { } } -// AzureDiskSize - Recommended Azure size for the disk, given utilization data and preferences set on Assessment. -type AzureDiskSize string - -const ( - AzureDiskSizePremiumP10 AzureDiskSize = "Premium_P10" - AzureDiskSizePremiumP15 AzureDiskSize = "Premium_P15" - AzureDiskSizePremiumP20 AzureDiskSize = "Premium_P20" - AzureDiskSizePremiumP30 AzureDiskSize = "Premium_P30" - AzureDiskSizePremiumP4 AzureDiskSize = "Premium_P4" - AzureDiskSizePremiumP40 AzureDiskSize = "Premium_P40" - AzureDiskSizePremiumP50 AzureDiskSize = "Premium_P50" - AzureDiskSizePremiumP6 AzureDiskSize = "Premium_P6" - AzureDiskSizePremiumP60 AzureDiskSize = "Premium_P60" - AzureDiskSizePremiumP70 AzureDiskSize = "Premium_P70" - AzureDiskSizePremiumP80 AzureDiskSize = "Premium_P80" - AzureDiskSizeStandardS10 AzureDiskSize = "Standard_S10" - AzureDiskSizeStandardS15 AzureDiskSize = "Standard_S15" - AzureDiskSizeStandardS20 AzureDiskSize = "Standard_S20" - AzureDiskSizeStandardS30 AzureDiskSize = "Standard_S30" - AzureDiskSizeStandardS4 AzureDiskSize = "Standard_S4" - AzureDiskSizeStandardS40 AzureDiskSize = "Standard_S40" - AzureDiskSizeStandardS50 AzureDiskSize = "Standard_S50" - AzureDiskSizeStandardS6 AzureDiskSize = "Standard_S6" - AzureDiskSizeStandardS60 AzureDiskSize = "Standard_S60" - AzureDiskSizeStandardS70 AzureDiskSize = "Standard_S70" - AzureDiskSizeStandardS80 AzureDiskSize = "Standard_S80" - AzureDiskSizeStandardSSDE10 AzureDiskSize = "StandardSSD_E10" - AzureDiskSizeStandardSSDE15 AzureDiskSize = "StandardSSD_E15" - AzureDiskSizeStandardSSDE20 AzureDiskSize = "StandardSSD_E20" - AzureDiskSizeStandardSSDE30 AzureDiskSize = "StandardSSD_E30" - AzureDiskSizeStandardSSDE4 AzureDiskSize = "StandardSSD_E4" - AzureDiskSizeStandardSSDE40 AzureDiskSize = "StandardSSD_E40" - AzureDiskSizeStandardSSDE50 AzureDiskSize = "StandardSSD_E50" - AzureDiskSizeStandardSSDE6 AzureDiskSize = "StandardSSD_E6" - AzureDiskSizeStandardSSDE60 AzureDiskSize = "StandardSSD_E60" - AzureDiskSizeStandardSSDE70 AzureDiskSize = "StandardSSD_E70" - AzureDiskSizeStandardSSDE80 AzureDiskSize = "StandardSSD_E80" - AzureDiskSizeUnknown AzureDiskSize = "Unknown" -) - -// PossibleAzureDiskSizeValues returns the possible values for the AzureDiskSize const type. -func PossibleAzureDiskSizeValues() []AzureDiskSize { - return []AzureDiskSize{ - AzureDiskSizePremiumP10, - AzureDiskSizePremiumP15, - AzureDiskSizePremiumP20, - AzureDiskSizePremiumP30, - AzureDiskSizePremiumP4, - AzureDiskSizePremiumP40, - AzureDiskSizePremiumP50, - AzureDiskSizePremiumP6, - AzureDiskSizePremiumP60, - AzureDiskSizePremiumP70, - AzureDiskSizePremiumP80, - AzureDiskSizeStandardS10, - AzureDiskSizeStandardS15, - AzureDiskSizeStandardS20, - AzureDiskSizeStandardS30, - AzureDiskSizeStandardS4, - AzureDiskSizeStandardS40, - AzureDiskSizeStandardS50, - AzureDiskSizeStandardS6, - AzureDiskSizeStandardS60, - AzureDiskSizeStandardS70, - AzureDiskSizeStandardS80, - AzureDiskSizeStandardSSDE10, - AzureDiskSizeStandardSSDE15, - AzureDiskSizeStandardSSDE20, - AzureDiskSizeStandardSSDE30, - AzureDiskSizeStandardSSDE4, - AzureDiskSizeStandardSSDE40, - AzureDiskSizeStandardSSDE50, - AzureDiskSizeStandardSSDE6, - AzureDiskSizeStandardSSDE60, - AzureDiskSizeStandardSSDE70, - AzureDiskSizeStandardSSDE80, - AzureDiskSizeUnknown, - } -} - -// AzureDiskSuitabilityDetail - If disk is suitable to be migrate but some conditions/checks were not considered while calculating -// suitability, this explains the details. -type AzureDiskSuitabilityDetail string +// AzureCurrency - Currency for Azure. +type AzureCurrency string const ( - AzureDiskSuitabilityDetailDiskGigabytesConsumedMissing AzureDiskSuitabilityDetail = "DiskGigabytesConsumedMissing" - AzureDiskSuitabilityDetailDiskGigabytesConsumedOutOfRange AzureDiskSuitabilityDetail = "DiskGigabytesConsumedOutOfRange" - AzureDiskSuitabilityDetailDiskGigabytesProvisionedMissing AzureDiskSuitabilityDetail = "DiskGigabytesProvisionedMissing" - AzureDiskSuitabilityDetailDiskGigabytesProvisionedOutOfRange AzureDiskSuitabilityDetail = "DiskGigabytesProvisionedOutOfRange" - AzureDiskSuitabilityDetailMegabytesPerSecondOfReadMissing AzureDiskSuitabilityDetail = "MegabytesPerSecondOfReadMissing" - AzureDiskSuitabilityDetailMegabytesPerSecondOfReadOutOfRange AzureDiskSuitabilityDetail = "MegabytesPerSecondOfReadOutOfRange" - AzureDiskSuitabilityDetailMegabytesPerSecondOfWriteMissing AzureDiskSuitabilityDetail = "MegabytesPerSecondOfWriteMissing" - AzureDiskSuitabilityDetailMegabytesPerSecondOfWriteOutOfRange AzureDiskSuitabilityDetail = "MegabytesPerSecondOfWriteOutOfRange" - AzureDiskSuitabilityDetailNone AzureDiskSuitabilityDetail = "None" - AzureDiskSuitabilityDetailNumberOfReadOperationsPerSecondMissing AzureDiskSuitabilityDetail = "NumberOfReadOperationsPerSecondMissing" - AzureDiskSuitabilityDetailNumberOfReadOperationsPerSecondOutOfRange AzureDiskSuitabilityDetail = "NumberOfReadOperationsPerSecondOutOfRange" - AzureDiskSuitabilityDetailNumberOfWriteOperationsPerSecondMissing AzureDiskSuitabilityDetail = "NumberOfWriteOperationsPerSecondMissing" - AzureDiskSuitabilityDetailNumberOfWriteOperationsPerSecondOutOfRange AzureDiskSuitabilityDetail = "NumberOfWriteOperationsPerSecondOutOfRange" + // AzureCurrencyARS - ARS Currency for Azure + AzureCurrencyARS AzureCurrency = "ARS" + // AzureCurrencyAUD - AUD Currency for Azure + AzureCurrencyAUD AzureCurrency = "AUD" + // AzureCurrencyBRL - BRL Currency for Azure + AzureCurrencyBRL AzureCurrency = "BRL" + // AzureCurrencyCAD - CAD Currency for Azure + AzureCurrencyCAD AzureCurrency = "CAD" + // AzureCurrencyCHF - CHF Currency for Azure + AzureCurrencyCHF AzureCurrency = "CHF" + // AzureCurrencyCNY - CNY Currency for Azure + AzureCurrencyCNY AzureCurrency = "CNY" + // AzureCurrencyDKK - DKK Currency for Azure + AzureCurrencyDKK AzureCurrency = "DKK" + // AzureCurrencyEUR - EUR Currency for Azure + AzureCurrencyEUR AzureCurrency = "EUR" + // AzureCurrencyGBP - GBP Currency for Azure + AzureCurrencyGBP AzureCurrency = "GBP" + // AzureCurrencyHKD - HKD Currency for Azure + AzureCurrencyHKD AzureCurrency = "HKD" + // AzureCurrencyIDR - IDR Currency for Azure + AzureCurrencyIDR AzureCurrency = "IDR" + // AzureCurrencyINR - INR Currency for Azure + AzureCurrencyINR AzureCurrency = "INR" + // AzureCurrencyJPY - JPY Currency for Azure + AzureCurrencyJPY AzureCurrency = "JPY" + // AzureCurrencyKRW - KRW Currency for Azure + AzureCurrencyKRW AzureCurrency = "KRW" + // AzureCurrencyMXN - MXN Currency for Azure + AzureCurrencyMXN AzureCurrency = "MXN" + // AzureCurrencyMYR - MYR Currency for Azure + AzureCurrencyMYR AzureCurrency = "MYR" + // AzureCurrencyNOK - NOK Currency for Azure + AzureCurrencyNOK AzureCurrency = "NOK" + // AzureCurrencyNZD - NZD Currency for Azure + AzureCurrencyNZD AzureCurrency = "NZD" + // AzureCurrencyRUB - RUB Currency for Azure + AzureCurrencyRUB AzureCurrency = "RUB" + // AzureCurrencySAR - SAR Currency for Azure + AzureCurrencySAR AzureCurrency = "SAR" + // AzureCurrencySEK - SEK Currency for Azure + AzureCurrencySEK AzureCurrency = "SEK" + // AzureCurrencyTRY - TRY Currency for Azure + AzureCurrencyTRY AzureCurrency = "TRY" + // AzureCurrencyTWD - TWD Currency for Azure + AzureCurrencyTWD AzureCurrency = "TWD" + // AzureCurrencyUSD - USD Currency for Azure + AzureCurrencyUSD AzureCurrency = "USD" + // AzureCurrencyUnknown - Unknown Currency for Azure + AzureCurrencyUnknown AzureCurrency = "Unknown" + // AzureCurrencyZAR - ZAR Currency for Azure + AzureCurrencyZAR AzureCurrency = "ZAR" ) -// PossibleAzureDiskSuitabilityDetailValues returns the possible values for the AzureDiskSuitabilityDetail const type. -func PossibleAzureDiskSuitabilityDetailValues() []AzureDiskSuitabilityDetail { - return []AzureDiskSuitabilityDetail{ - AzureDiskSuitabilityDetailDiskGigabytesConsumedMissing, - AzureDiskSuitabilityDetailDiskGigabytesConsumedOutOfRange, - AzureDiskSuitabilityDetailDiskGigabytesProvisionedMissing, - AzureDiskSuitabilityDetailDiskGigabytesProvisionedOutOfRange, - AzureDiskSuitabilityDetailMegabytesPerSecondOfReadMissing, - AzureDiskSuitabilityDetailMegabytesPerSecondOfReadOutOfRange, - AzureDiskSuitabilityDetailMegabytesPerSecondOfWriteMissing, - AzureDiskSuitabilityDetailMegabytesPerSecondOfWriteOutOfRange, - AzureDiskSuitabilityDetailNone, - AzureDiskSuitabilityDetailNumberOfReadOperationsPerSecondMissing, - AzureDiskSuitabilityDetailNumberOfReadOperationsPerSecondOutOfRange, - AzureDiskSuitabilityDetailNumberOfWriteOperationsPerSecondMissing, - AzureDiskSuitabilityDetailNumberOfWriteOperationsPerSecondOutOfRange, +// PossibleAzureCurrencyValues returns the possible values for the AzureCurrency const type. +func PossibleAzureCurrencyValues() []AzureCurrency { + return []AzureCurrency{ + AzureCurrencyARS, + AzureCurrencyAUD, + AzureCurrencyBRL, + AzureCurrencyCAD, + AzureCurrencyCHF, + AzureCurrencyCNY, + AzureCurrencyDKK, + AzureCurrencyEUR, + AzureCurrencyGBP, + AzureCurrencyHKD, + AzureCurrencyIDR, + AzureCurrencyINR, + AzureCurrencyJPY, + AzureCurrencyKRW, + AzureCurrencyMXN, + AzureCurrencyMYR, + AzureCurrencyNOK, + AzureCurrencyNZD, + AzureCurrencyRUB, + AzureCurrencySAR, + AzureCurrencySEK, + AzureCurrencyTRY, + AzureCurrencyTWD, + AzureCurrencyUSD, + AzureCurrencyUnknown, + AzureCurrencyZAR, } } -// AzureDiskSuitabilityExplanation - If disk is not suitable to be migrated, this explains the reasons and mitigation steps. -type AzureDiskSuitabilityExplanation string - -const ( - AzureDiskSuitabilityExplanationDiskSizeGreaterThanSupported AzureDiskSuitabilityExplanation = "DiskSizeGreaterThanSupported" - AzureDiskSuitabilityExplanationInternalErrorOccurredForDiskEvaluation AzureDiskSuitabilityExplanation = "InternalErrorOccurredForDiskEvaluation" - AzureDiskSuitabilityExplanationNoDiskSizeFoundForSelectedRedundancy AzureDiskSuitabilityExplanation = "NoDiskSizeFoundForSelectedRedundancy" - AzureDiskSuitabilityExplanationNoDiskSizeFoundInSelectedLocation AzureDiskSuitabilityExplanation = "NoDiskSizeFoundInSelectedLocation" - AzureDiskSuitabilityExplanationNoEaPriceFoundForDiskSize AzureDiskSuitabilityExplanation = "NoEaPriceFoundForDiskSize" - AzureDiskSuitabilityExplanationNoSuitableDiskSizeForIops AzureDiskSuitabilityExplanation = "NoSuitableDiskSizeForIops" - AzureDiskSuitabilityExplanationNoSuitableDiskSizeForThroughput AzureDiskSuitabilityExplanation = "NoSuitableDiskSizeForThroughput" - AzureDiskSuitabilityExplanationNotApplicable AzureDiskSuitabilityExplanation = "NotApplicable" - AzureDiskSuitabilityExplanationUnknown AzureDiskSuitabilityExplanation = "Unknown" -) - -// PossibleAzureDiskSuitabilityExplanationValues returns the possible values for the AzureDiskSuitabilityExplanation const type. -func PossibleAzureDiskSuitabilityExplanationValues() []AzureDiskSuitabilityExplanation { - return []AzureDiskSuitabilityExplanation{ - AzureDiskSuitabilityExplanationDiskSizeGreaterThanSupported, - AzureDiskSuitabilityExplanationInternalErrorOccurredForDiskEvaluation, - AzureDiskSuitabilityExplanationNoDiskSizeFoundForSelectedRedundancy, - AzureDiskSuitabilityExplanationNoDiskSizeFoundInSelectedLocation, - AzureDiskSuitabilityExplanationNoEaPriceFoundForDiskSize, - AzureDiskSuitabilityExplanationNoSuitableDiskSizeForIops, - AzureDiskSuitabilityExplanationNoSuitableDiskSizeForThroughput, - AzureDiskSuitabilityExplanationNotApplicable, - AzureDiskSuitabilityExplanationUnknown, - } -} - -// AzureDiskType - Storage type selected for this disk. +// AzureDiskType - Azure Disk Type type AzureDiskType string const ( - AzureDiskTypePremium AzureDiskType = "Premium" - AzureDiskTypeStandard AzureDiskType = "Standard" + // AzureDiskTypePremium - Premium Azure Disk Type + AzureDiskTypePremium AzureDiskType = "Premium" + // AzureDiskTypePremiumV2 - PremiumV2 Azure Disk Type + AzureDiskTypePremiumV2 AzureDiskType = "PremiumV2" + // AzureDiskTypeStandard - Standard Azure Disk Type + AzureDiskTypeStandard AzureDiskType = "Standard" + // AzureDiskTypeStandardOrPremium - StandardOrPremium Azure Disk Type AzureDiskTypeStandardOrPremium AzureDiskType = "StandardOrPremium" - AzureDiskTypeStandardSSD AzureDiskType = "StandardSSD" - AzureDiskTypeUnknown AzureDiskType = "Unknown" + // AzureDiskTypeStandardSSD - StandardSSD Azure Disk Type + AzureDiskTypeStandardSSD AzureDiskType = "StandardSSD" + // AzureDiskTypeUltra - Ultra Azure Disk Type + AzureDiskTypeUltra AzureDiskType = "Ultra" + // AzureDiskTypeUnknown - Unknown Azure Disk Type + AzureDiskTypeUnknown AzureDiskType = "Unknown" ) // PossibleAzureDiskTypeValues returns the possible values for the AzureDiskType const type. func PossibleAzureDiskTypeValues() []AzureDiskType { return []AzureDiskType{ AzureDiskTypePremium, + AzureDiskTypePremiumV2, AzureDiskTypeStandard, AzureDiskTypeStandardOrPremium, AzureDiskTypeStandardSSD, + AzureDiskTypeUltra, AzureDiskTypeUnknown, } } -// AzureHybridUseBenefit - AHUB discount on windows virtual machines. +// AzureHybridUseBenefit - Azure Hybrid Use Benefit type AzureHybridUseBenefit string const ( - AzureHybridUseBenefitNo AzureHybridUseBenefit = "No" + // AzureHybridUseBenefitNo - No Azure Hybrid Use Benefit + AzureHybridUseBenefitNo AzureHybridUseBenefit = "No" + // AzureHybridUseBenefitUnknown - Unknown Azure Hybrid Use Benefit AzureHybridUseBenefitUnknown AzureHybridUseBenefit = "Unknown" - AzureHybridUseBenefitYes AzureHybridUseBenefit = "Yes" + // AzureHybridUseBenefitYes - Yes Azure Hybrid Use Benefit + AzureHybridUseBenefitYes AzureHybridUseBenefit = "Yes" ) // PossibleAzureHybridUseBenefitValues returns the possible values for the AzureHybridUseBenefit const type. @@ -262,53 +297,151 @@ func PossibleAzureHybridUseBenefitValues() []AzureHybridUseBenefit { } } -// AzureLocation - Target Azure location for which the machines should be assessed. These enums are the same as used by Compute -// API. +// AzureLocation - Location for Azure. type AzureLocation string const ( - AzureLocationAustraliaEast AzureLocation = "AustraliaEast" + // AzureLocationAustraliaCentral - AustraliaCentral Location for Azure + AzureLocationAustraliaCentral AzureLocation = "AustraliaCentral" + // AzureLocationAustraliaCentral2 - AustraliaCentral2 Location for Azure + AzureLocationAustraliaCentral2 AzureLocation = "AustraliaCentral2" + // AzureLocationAustraliaEast - AustraliaEast Location for Azure + AzureLocationAustraliaEast AzureLocation = "AustraliaEast" + // AzureLocationAustraliaSoutheast - AustraliaSoutheast Location for Azure AzureLocationAustraliaSoutheast AzureLocation = "AustraliaSoutheast" - AzureLocationBrazilSouth AzureLocation = "BrazilSouth" - AzureLocationCanadaCentral AzureLocation = "CanadaCentral" - AzureLocationCanadaEast AzureLocation = "CanadaEast" - AzureLocationCentralIndia AzureLocation = "CentralIndia" - AzureLocationCentralUs AzureLocation = "CentralUs" - AzureLocationChinaEast AzureLocation = "ChinaEast" - AzureLocationChinaNorth AzureLocation = "ChinaNorth" - AzureLocationEastAsia AzureLocation = "EastAsia" - AzureLocationEastUs AzureLocation = "EastUs" - AzureLocationEastUs2 AzureLocation = "EastUs2" - AzureLocationGermanyCentral AzureLocation = "GermanyCentral" - AzureLocationGermanyNortheast AzureLocation = "GermanyNortheast" - AzureLocationJapanEast AzureLocation = "JapanEast" - AzureLocationJapanWest AzureLocation = "JapanWest" - AzureLocationKoreaCentral AzureLocation = "KoreaCentral" - AzureLocationKoreaSouth AzureLocation = "KoreaSouth" - AzureLocationNorthCentralUs AzureLocation = "NorthCentralUs" - AzureLocationNorthEurope AzureLocation = "NorthEurope" - AzureLocationSouthCentralUs AzureLocation = "SouthCentralUs" - AzureLocationSouthIndia AzureLocation = "SouthIndia" - AzureLocationSoutheastAsia AzureLocation = "SoutheastAsia" - AzureLocationUSDoDCentral AzureLocation = "USDoDCentral" - AzureLocationUSDoDEast AzureLocation = "USDoDEast" - AzureLocationUSGovArizona AzureLocation = "USGovArizona" - AzureLocationUSGovIowa AzureLocation = "USGovIowa" - AzureLocationUSGovTexas AzureLocation = "USGovTexas" - AzureLocationUSGovVirginia AzureLocation = "USGovVirginia" - AzureLocationUkSouth AzureLocation = "UkSouth" - AzureLocationUkWest AzureLocation = "UkWest" - AzureLocationUnknown AzureLocation = "Unknown" - AzureLocationWestCentralUs AzureLocation = "WestCentralUs" - AzureLocationWestEurope AzureLocation = "WestEurope" - AzureLocationWestIndia AzureLocation = "WestIndia" - AzureLocationWestUs AzureLocation = "WestUs" - AzureLocationWestUs2 AzureLocation = "WestUs2" + // AzureLocationBrazilSouth - BrazilSouth Location for Azure + AzureLocationBrazilSouth AzureLocation = "BrazilSouth" + // AzureLocationCanadaCentral - CanadaCentral Location for Azure + AzureLocationCanadaCentral AzureLocation = "CanadaCentral" + // AzureLocationCanadaEast - CanadaEast Location for Azure + AzureLocationCanadaEast AzureLocation = "CanadaEast" + // AzureLocationCentralIndia - CentralIndia Location for Azure + AzureLocationCentralIndia AzureLocation = "CentralIndia" + // AzureLocationCentralUs - CentralUs Location for Azure + AzureLocationCentralUs AzureLocation = "CentralUs" + // AzureLocationChinaEast - ChinaEast Location for Azure + AzureLocationChinaEast AzureLocation = "ChinaEast" + // AzureLocationChinaEast2 - ChinaEast2 Location for Azure + AzureLocationChinaEast2 AzureLocation = "ChinaEast2" + // AzureLocationChinaNorth - ChinaNorth Location for Azure + AzureLocationChinaNorth AzureLocation = "ChinaNorth" + // AzureLocationChinaNorth2 - ChinaNorth2 Location for Azure + AzureLocationChinaNorth2 AzureLocation = "ChinaNorth2" + // AzureLocationEastAsia - EastAsia Location for Azure + AzureLocationEastAsia AzureLocation = "EastAsia" + // AzureLocationEastUs - EastUs Location for Azure + AzureLocationEastUs AzureLocation = "EastUs" + // AzureLocationEastUs2 - EastUs2 Location for Azure + AzureLocationEastUs2 AzureLocation = "EastUs2" + // AzureLocationFranceCentral - FranceCentral Location for Azure + AzureLocationFranceCentral AzureLocation = "FranceCentral" + // AzureLocationFranceSouth - FranceSouth Location for Azure + AzureLocationFranceSouth AzureLocation = "FranceSouth" + // AzureLocationGermanyCentral - GermanyCentral Location for Azure + AzureLocationGermanyCentral AzureLocation = "GermanyCentral" + // AzureLocationGermanyNorth - GermanyNorth Location for Azure + AzureLocationGermanyNorth AzureLocation = "GermanyNorth" + // AzureLocationGermanyNortheast - GermanyNortheast Location for Azure + AzureLocationGermanyNortheast AzureLocation = "GermanyNortheast" + // AzureLocationGermanyWestCentral - GermanyWestCentral Location for Azure + AzureLocationGermanyWestCentral AzureLocation = "GermanyWestCentral" + // AzureLocationIsraelCentral - IsraelCentral Location for Azure + AzureLocationIsraelCentral AzureLocation = "IsraelCentral" + // AzureLocationItalyNorth - ItalyNorth Location for Azure + AzureLocationItalyNorth AzureLocation = "ItalyNorth" + // AzureLocationJapanEast - JapanEast Location for Azure + AzureLocationJapanEast AzureLocation = "JapanEast" + // AzureLocationJapanWest - JapanWest Location for Azure + AzureLocationJapanWest AzureLocation = "JapanWest" + // AzureLocationJioIndiaWest - JioIndiaWest Location for Azure + AzureLocationJioIndiaWest AzureLocation = "JioIndiaWest" + // AzureLocationKoreaCentral - KoreaCentral Location for Azure + AzureLocationKoreaCentral AzureLocation = "KoreaCentral" + // AzureLocationKoreaSouth - KoreaSouth Location for Azure + AzureLocationKoreaSouth AzureLocation = "KoreaSouth" + // AzureLocationMexicoCentral - MexicoCentral Location for Azure + AzureLocationMexicoCentral AzureLocation = "MexicoCentral" + // AzureLocationNewZealandNorth - NewZealandNorth Location for Azure + AzureLocationNewZealandNorth AzureLocation = "NewZealandNorth" + // AzureLocationNorthCentralUs - NorthCentralUs Location for Azure + AzureLocationNorthCentralUs AzureLocation = "NorthCentralUs" + // AzureLocationNorthEurope - NorthEurope Location for Azure + AzureLocationNorthEurope AzureLocation = "NorthEurope" + // AzureLocationNorwayEast - NorwayEast Location for Azure + AzureLocationNorwayEast AzureLocation = "NorwayEast" + // AzureLocationNorwayWest - NorwayWest Location for Azure + AzureLocationNorwayWest AzureLocation = "NorwayWest" + // AzureLocationPolandCentral - PolandCentral Location for Azure + AzureLocationPolandCentral AzureLocation = "PolandCentral" + // AzureLocationQatarCentral - QatarCentral Location for Azure + AzureLocationQatarCentral AzureLocation = "QatarCentral" + // AzureLocationSouthAfricaNorth - SouthAfricaNorth Location for Azure + AzureLocationSouthAfricaNorth AzureLocation = "SouthAfricaNorth" + // AzureLocationSouthAfricaWest - SouthAfricaWest Location for Azure + AzureLocationSouthAfricaWest AzureLocation = "SouthAfricaWest" + // AzureLocationSouthCentralUs - SouthCentralUs Location for Azure + AzureLocationSouthCentralUs AzureLocation = "SouthCentralUs" + // AzureLocationSouthIndia - SouthIndia Location for Azure + AzureLocationSouthIndia AzureLocation = "SouthIndia" + // AzureLocationSoutheastAsia - SoutheastAsia Location for Azure + AzureLocationSoutheastAsia AzureLocation = "SoutheastAsia" + // AzureLocationSpainCentral - SpainCentral Location for Azure + AzureLocationSpainCentral AzureLocation = "SpainCentral" + // AzureLocationSwedenCentral - SwedenCentral Location for Azure + AzureLocationSwedenCentral AzureLocation = "SwedenCentral" + // AzureLocationSwitzerlandNorth - SwitzerlandNorth Location for Azure + AzureLocationSwitzerlandNorth AzureLocation = "SwitzerlandNorth" + // AzureLocationSwitzerlandWest - SwitzerlandWest Location for Azure + AzureLocationSwitzerlandWest AzureLocation = "SwitzerlandWest" + // AzureLocationUAECentral - UAECentral Location for Azure + AzureLocationUAECentral AzureLocation = "UAECentral" + // AzureLocationUAENorth - UAENorth Location for Azure + AzureLocationUAENorth AzureLocation = "UAENorth" + // AzureLocationUSDoDCentral - USDoDCentral Location for Azure + AzureLocationUSDoDCentral AzureLocation = "USDoDCentral" + // AzureLocationUSDoDEast - USDoDEast Location for Azure + AzureLocationUSDoDEast AzureLocation = "USDoDEast" + // AzureLocationUSGovArizona - USGovArizona Location for Azure + AzureLocationUSGovArizona AzureLocation = "USGovArizona" + // AzureLocationUSGovIowa - USGovIowa Location for Azure + AzureLocationUSGovIowa AzureLocation = "USGovIowa" + // AzureLocationUSGovTexas - USGovTexas Location for Azure + AzureLocationUSGovTexas AzureLocation = "USGovTexas" + // AzureLocationUSGovVirginia - USGovVirginia Location for Azure + AzureLocationUSGovVirginia AzureLocation = "USGovVirginia" + // AzureLocationUkSouth - UkSouth Location for Azure + AzureLocationUkSouth AzureLocation = "UkSouth" + // AzureLocationUkWest - UkWest Location for Azure + AzureLocationUkWest AzureLocation = "UkWest" + // AzureLocationUnknown - Unknown Location for Azure + AzureLocationUnknown AzureLocation = "Unknown" + // AzureLocationUsNatEast - UsNatEast Location for Azure + AzureLocationUsNatEast AzureLocation = "UsNatEast" + // AzureLocationUsNatWest - UsNatWest Location for Azure + AzureLocationUsNatWest AzureLocation = "UsNatWest" + // AzureLocationUsSecCentral - UsSecCentral Location for Azure + AzureLocationUsSecCentral AzureLocation = "UsSecCentral" + // AzureLocationUsSecEast - UsSecEast Location for Azure + AzureLocationUsSecEast AzureLocation = "UsSecEast" + // AzureLocationUsSecWest - UsSecWest Location for Azure + AzureLocationUsSecWest AzureLocation = "UsSecWest" + // AzureLocationWestCentralUs - WestCentralUs Location for Azure + AzureLocationWestCentralUs AzureLocation = "WestCentralUs" + // AzureLocationWestEurope - WestEurope Location for Azure + AzureLocationWestEurope AzureLocation = "WestEurope" + // AzureLocationWestIndia - WestIndia Location for Azure + AzureLocationWestIndia AzureLocation = "WestIndia" + // AzureLocationWestUs - WestUs Location for Azure + AzureLocationWestUs AzureLocation = "WestUs" + // AzureLocationWestUs2 - WestUs2 Location for Azure + AzureLocationWestUs2 AzureLocation = "WestUs2" ) // PossibleAzureLocationValues returns the possible values for the AzureLocation const type. func PossibleAzureLocationValues() []AzureLocation { return []AzureLocation{ + AzureLocationAustraliaCentral, + AzureLocationAustraliaCentral2, AzureLocationAustraliaEast, AzureLocationAustraliaSoutheast, AzureLocationBrazilSouth, @@ -317,21 +450,44 @@ func PossibleAzureLocationValues() []AzureLocation { AzureLocationCentralIndia, AzureLocationCentralUs, AzureLocationChinaEast, + AzureLocationChinaEast2, AzureLocationChinaNorth, + AzureLocationChinaNorth2, AzureLocationEastAsia, AzureLocationEastUs, AzureLocationEastUs2, + AzureLocationFranceCentral, + AzureLocationFranceSouth, AzureLocationGermanyCentral, + AzureLocationGermanyNorth, AzureLocationGermanyNortheast, + AzureLocationGermanyWestCentral, + AzureLocationIsraelCentral, + AzureLocationItalyNorth, AzureLocationJapanEast, AzureLocationJapanWest, + AzureLocationJioIndiaWest, AzureLocationKoreaCentral, AzureLocationKoreaSouth, + AzureLocationMexicoCentral, + AzureLocationNewZealandNorth, AzureLocationNorthCentralUs, AzureLocationNorthEurope, + AzureLocationNorwayEast, + AzureLocationNorwayWest, + AzureLocationPolandCentral, + AzureLocationQatarCentral, + AzureLocationSouthAfricaNorth, + AzureLocationSouthAfricaWest, AzureLocationSouthCentralUs, AzureLocationSouthIndia, AzureLocationSoutheastAsia, + AzureLocationSpainCentral, + AzureLocationSwedenCentral, + AzureLocationSwitzerlandNorth, + AzureLocationSwitzerlandWest, + AzureLocationUAECentral, + AzureLocationUAENorth, AzureLocationUSDoDCentral, AzureLocationUSDoDEast, AzureLocationUSGovArizona, @@ -341,6 +497,11 @@ func PossibleAzureLocationValues() []AzureLocation { AzureLocationUkSouth, AzureLocationUkWest, AzureLocationUnknown, + AzureLocationUsNatEast, + AzureLocationUsNatWest, + AzureLocationUsSecCentral, + AzureLocationUsSecEast, + AzureLocationUsSecWest, AzureLocationWestCentralUs, AzureLocationWestEurope, AzureLocationWestIndia, @@ -349,139 +510,85 @@ func PossibleAzureLocationValues() []AzureLocation { } } -// AzureNetworkAdapterSuitabilityDetail - If network adapter is not suitable for cloud, this explains the reasons. -type AzureNetworkAdapterSuitabilityDetail string +// AzureManagementOfferingType - Azure management Offering type +type AzureManagementOfferingType string const ( - AzureNetworkAdapterSuitabilityDetailMegabytesOfDataTransmittedMissing AzureNetworkAdapterSuitabilityDetail = "MegabytesOfDataTransmittedMissing" - AzureNetworkAdapterSuitabilityDetailMegabytesOfDataTransmittedOutOfRange AzureNetworkAdapterSuitabilityDetail = "MegabytesOfDataTransmittedOutOfRange" - AzureNetworkAdapterSuitabilityDetailNone AzureNetworkAdapterSuitabilityDetail = "None" + // AzureManagementOfferingTypeAUM - AUM - Azure management Offering type + AzureManagementOfferingTypeAUM AzureManagementOfferingType = "AUM" + // AzureManagementOfferingTypeAzMon - AzMon - Azure management Offering type + AzureManagementOfferingTypeAzMon AzureManagementOfferingType = "AzMon" + // AzureManagementOfferingTypeAzureBackup - AzureBackup - Azure management Offering type + AzureManagementOfferingTypeAzureBackup AzureManagementOfferingType = "AzureBackup" + // AzureManagementOfferingTypeNo - No - Azure management Offering type + AzureManagementOfferingTypeNo AzureManagementOfferingType = "No" + // AzureManagementOfferingTypeSCOMMI - SCOMMI - Azure management Offering type + AzureManagementOfferingTypeSCOMMI AzureManagementOfferingType = "SCOMMI" ) -// PossibleAzureNetworkAdapterSuitabilityDetailValues returns the possible values for the AzureNetworkAdapterSuitabilityDetail const type. -func PossibleAzureNetworkAdapterSuitabilityDetailValues() []AzureNetworkAdapterSuitabilityDetail { - return []AzureNetworkAdapterSuitabilityDetail{ - AzureNetworkAdapterSuitabilityDetailMegabytesOfDataTransmittedMissing, - AzureNetworkAdapterSuitabilityDetailMegabytesOfDataTransmittedOutOfRange, - AzureNetworkAdapterSuitabilityDetailNone, +// PossibleAzureManagementOfferingTypeValues returns the possible values for the AzureManagementOfferingType const type. +func PossibleAzureManagementOfferingTypeValues() []AzureManagementOfferingType { + return []AzureManagementOfferingType{ + AzureManagementOfferingTypeAUM, + AzureManagementOfferingTypeAzMon, + AzureManagementOfferingTypeAzureBackup, + AzureManagementOfferingTypeNo, + AzureManagementOfferingTypeSCOMMI, } } -// AzureNetworkAdapterSuitabilityExplanation - If network adapter is suitable, this explains the reasons and mitigation steps. -type AzureNetworkAdapterSuitabilityExplanation string +// AzureOffer - Azure Offer +type AzureOffer string const ( - AzureNetworkAdapterSuitabilityExplanationInternalErrorOccurred AzureNetworkAdapterSuitabilityExplanation = "InternalErrorOccurred" - AzureNetworkAdapterSuitabilityExplanationNotApplicable AzureNetworkAdapterSuitabilityExplanation = "NotApplicable" - AzureNetworkAdapterSuitabilityExplanationUnknown AzureNetworkAdapterSuitabilityExplanation = "Unknown" + // AzureOfferEA - EA Azure Offer + AzureOfferEA AzureOffer = "EA" + // AzureOfferMsazr0003P - MSAZR0003P Azure Offer + AzureOfferMsazr0003P AzureOffer = "MSAZR0003P" + // AzureOfferMsazr0023P - MSAZR0023P Azure Offer + AzureOfferMsazr0023P AzureOffer = "MSAZR0023P" + // AzureOfferMsazrusgov0003P - MSAZRUSGOV0003P Azure Offer + AzureOfferMsazrusgov0003P AzureOffer = "MSAZRUSGOV0003P" + // AzureOfferMsmcazr0044P - MSMCAZR0044P Azure Offer + AzureOfferMsmcazr0044P AzureOffer = "MSMCAZR0044P" + // AzureOfferMsmcazr0059P - MSMCAZR0059P Azure Offer + AzureOfferMsmcazr0059P AzureOffer = "MSMCAZR0059P" + // AzureOfferMsmcazr0060P - MSMCAZR0060P Azure Offer + AzureOfferMsmcazr0060P AzureOffer = "MSMCAZR0060P" + // AzureOfferMsmcazr0063P - MSMCAZR0063P Azure Offer + AzureOfferMsmcazr0063P AzureOffer = "MSMCAZR0063P" + // AzureOfferSavingsPlan1Year - SavingsPlan1Year Azure Offer + AzureOfferSavingsPlan1Year AzureOffer = "SavingsPlan1Year" + // AzureOfferSavingsPlan3Year - SavingsPlan3Year Azure Offer + AzureOfferSavingsPlan3Year AzureOffer = "SavingsPlan3Year" + // AzureOfferUnknown - Unknown - Azure Offer + AzureOfferUnknown AzureOffer = "Unknown" ) -// PossibleAzureNetworkAdapterSuitabilityExplanationValues returns the possible values for the AzureNetworkAdapterSuitabilityExplanation const type. -func PossibleAzureNetworkAdapterSuitabilityExplanationValues() []AzureNetworkAdapterSuitabilityExplanation { - return []AzureNetworkAdapterSuitabilityExplanation{ - AzureNetworkAdapterSuitabilityExplanationInternalErrorOccurred, - AzureNetworkAdapterSuitabilityExplanationNotApplicable, - AzureNetworkAdapterSuitabilityExplanationUnknown, +// PossibleAzureOfferValues returns the possible values for the AzureOffer const type. +func PossibleAzureOfferValues() []AzureOffer { + return []AzureOffer{ + AzureOfferEA, + AzureOfferMsazr0003P, + AzureOfferMsazr0023P, + AzureOfferMsazrusgov0003P, + AzureOfferMsmcazr0044P, + AzureOfferMsmcazr0059P, + AzureOfferMsmcazr0060P, + AzureOfferMsmcazr0063P, + AzureOfferSavingsPlan1Year, + AzureOfferSavingsPlan3Year, + AzureOfferUnknown, } } -// AzureOfferCode - Offer code according to which cost estimation is done. -type AzureOfferCode string - -const ( - AzureOfferCodeEA AzureOfferCode = "EA" - AzureOfferCodeMSAZR0003P AzureOfferCode = "MSAZR0003P" - AzureOfferCodeMSAZR0022P AzureOfferCode = "MSAZR0022P" - AzureOfferCodeMSAZR0023P AzureOfferCode = "MSAZR0023P" - AzureOfferCodeMSAZR0025P AzureOfferCode = "MSAZR0025P" - AzureOfferCodeMSAZR0029P AzureOfferCode = "MSAZR0029P" - AzureOfferCodeMSAZR0036P AzureOfferCode = "MSAZR0036P" - AzureOfferCodeMSAZR0044P AzureOfferCode = "MSAZR0044P" - AzureOfferCodeMSAZR0059P AzureOfferCode = "MSAZR0059P" - AzureOfferCodeMSAZR0060P AzureOfferCode = "MSAZR0060P" - AzureOfferCodeMSAZR0062P AzureOfferCode = "MSAZR0062P" - AzureOfferCodeMSAZR0063P AzureOfferCode = "MSAZR0063P" - AzureOfferCodeMSAZR0064P AzureOfferCode = "MSAZR0064P" - AzureOfferCodeMSAZR0111P AzureOfferCode = "MSAZR0111P" - AzureOfferCodeMSAZR0120P AzureOfferCode = "MSAZR0120P" - AzureOfferCodeMSAZR0121P AzureOfferCode = "MSAZR0121P" - AzureOfferCodeMSAZR0122P AzureOfferCode = "MSAZR0122P" - AzureOfferCodeMSAZR0123P AzureOfferCode = "MSAZR0123P" - AzureOfferCodeMSAZR0124P AzureOfferCode = "MSAZR0124P" - AzureOfferCodeMSAZR0125P AzureOfferCode = "MSAZR0125P" - AzureOfferCodeMSAZR0126P AzureOfferCode = "MSAZR0126P" - AzureOfferCodeMSAZR0127P AzureOfferCode = "MSAZR0127P" - AzureOfferCodeMSAZR0128P AzureOfferCode = "MSAZR0128P" - AzureOfferCodeMSAZR0129P AzureOfferCode = "MSAZR0129P" - AzureOfferCodeMSAZR0130P AzureOfferCode = "MSAZR0130P" - AzureOfferCodeMSAZR0144P AzureOfferCode = "MSAZR0144P" - AzureOfferCodeMSAZR0148P AzureOfferCode = "MSAZR0148P" - AzureOfferCodeMSAZR0149P AzureOfferCode = "MSAZR0149P" - AzureOfferCodeMSAZRDE0003P AzureOfferCode = "MSAZRDE0003P" - AzureOfferCodeMSAZRDE0044P AzureOfferCode = "MSAZRDE0044P" - AzureOfferCodeMSAZRUSGOV0003P AzureOfferCode = "MSAZRUSGOV0003P" - AzureOfferCodeMSMCAZR0044P AzureOfferCode = "MSMCAZR0044P" - AzureOfferCodeMSMCAZR0059P AzureOfferCode = "MSMCAZR0059P" - AzureOfferCodeMSMCAZR0060P AzureOfferCode = "MSMCAZR0060P" - AzureOfferCodeMSMCAZR0063P AzureOfferCode = "MSMCAZR0063P" - AzureOfferCodeMSMCAZR0120P AzureOfferCode = "MSMCAZR0120P" - AzureOfferCodeMSMCAZR0121P AzureOfferCode = "MSMCAZR0121P" - AzureOfferCodeMSMCAZR0125P AzureOfferCode = "MSMCAZR0125P" - AzureOfferCodeMSMCAZR0128P AzureOfferCode = "MSMCAZR0128P" - AzureOfferCodeUnknown AzureOfferCode = "Unknown" -) - -// PossibleAzureOfferCodeValues returns the possible values for the AzureOfferCode const type. -func PossibleAzureOfferCodeValues() []AzureOfferCode { - return []AzureOfferCode{ - AzureOfferCodeEA, - AzureOfferCodeMSAZR0003P, - AzureOfferCodeMSAZR0022P, - AzureOfferCodeMSAZR0023P, - AzureOfferCodeMSAZR0025P, - AzureOfferCodeMSAZR0029P, - AzureOfferCodeMSAZR0036P, - AzureOfferCodeMSAZR0044P, - AzureOfferCodeMSAZR0059P, - AzureOfferCodeMSAZR0060P, - AzureOfferCodeMSAZR0062P, - AzureOfferCodeMSAZR0063P, - AzureOfferCodeMSAZR0064P, - AzureOfferCodeMSAZR0111P, - AzureOfferCodeMSAZR0120P, - AzureOfferCodeMSAZR0121P, - AzureOfferCodeMSAZR0122P, - AzureOfferCodeMSAZR0123P, - AzureOfferCodeMSAZR0124P, - AzureOfferCodeMSAZR0125P, - AzureOfferCodeMSAZR0126P, - AzureOfferCodeMSAZR0127P, - AzureOfferCodeMSAZR0128P, - AzureOfferCodeMSAZR0129P, - AzureOfferCodeMSAZR0130P, - AzureOfferCodeMSAZR0144P, - AzureOfferCodeMSAZR0148P, - AzureOfferCodeMSAZR0149P, - AzureOfferCodeMSAZRDE0003P, - AzureOfferCodeMSAZRDE0044P, - AzureOfferCodeMSAZRUSGOV0003P, - AzureOfferCodeMSMCAZR0044P, - AzureOfferCodeMSMCAZR0059P, - AzureOfferCodeMSMCAZR0060P, - AzureOfferCodeMSMCAZR0063P, - AzureOfferCodeMSMCAZR0120P, - AzureOfferCodeMSMCAZR0121P, - AzureOfferCodeMSMCAZR0125P, - AzureOfferCodeMSMCAZR0128P, - AzureOfferCodeUnknown, - } -} - -// AzurePricingTier - Pricing tier for Size evaluation. +// AzurePricingTier - Azure Pricing Tier type AzurePricingTier string const ( - AzurePricingTierBasic AzurePricingTier = "Basic" + // AzurePricingTierBasic - Basic Azure Pricing Tier + AzurePricingTierBasic AzurePricingTier = "Basic" + // AzurePricingTierStandard - Standard Azure Pricing Tier AzurePricingTierStandard AzurePricingTier = "Standard" ) @@ -493,15 +600,38 @@ func PossibleAzurePricingTierValues() []AzurePricingTier { } } -// AzureStorageRedundancy - Storage Redundancy type offered by Azure. +// AzureSecurityOfferingType - Azure Security Offering Type +type AzureSecurityOfferingType string + +const ( + // AzureSecurityOfferingTypeMDC - MDC - Azure Security Offering Type + AzureSecurityOfferingTypeMDC AzureSecurityOfferingType = "MDC" + // AzureSecurityOfferingTypeNO - NO - Azure Security Offering Type + AzureSecurityOfferingTypeNO AzureSecurityOfferingType = "NO" +) + +// PossibleAzureSecurityOfferingTypeValues returns the possible values for the AzureSecurityOfferingType const type. +func PossibleAzureSecurityOfferingTypeValues() []AzureSecurityOfferingType { + return []AzureSecurityOfferingType{ + AzureSecurityOfferingTypeMDC, + AzureSecurityOfferingTypeNO, + } +} + +// AzureStorageRedundancy - Azure Storage Redundancy type AzureStorageRedundancy string const ( - AzureStorageRedundancyGeoRedundant AzureStorageRedundancy = "GeoRedundant" - AzureStorageRedundancyLocallyRedundant AzureStorageRedundancy = "LocallyRedundant" + // AzureStorageRedundancyGeoRedundant - GeoRedundant Azure Storage Redundancy + AzureStorageRedundancyGeoRedundant AzureStorageRedundancy = "GeoRedundant" + // AzureStorageRedundancyLocallyRedundant - LocallyRedundant Azure Storage Redundancy + AzureStorageRedundancyLocallyRedundant AzureStorageRedundancy = "LocallyRedundant" + // AzureStorageRedundancyReadAccessGeoRedundant - ReadAccessGeoRedundant Azure Storage Redundancy AzureStorageRedundancyReadAccessGeoRedundant AzureStorageRedundancy = "ReadAccessGeoRedundant" - AzureStorageRedundancyUnknown AzureStorageRedundancy = "Unknown" - AzureStorageRedundancyZoneRedundant AzureStorageRedundancy = "ZoneRedundant" + // AzureStorageRedundancyUnknown - Unknown Azure Storage Redundancy + AzureStorageRedundancyUnknown AzureStorageRedundancy = "Unknown" + // AzureStorageRedundancyZoneRedundant - ZoneRedundant Azure Storage Redundancy + AzureStorageRedundancyZoneRedundant AzureStorageRedundancy = "ZoneRedundant" ) // PossibleAzureStorageRedundancyValues returns the possible values for the AzureStorageRedundancy const type. @@ -515,32 +645,168 @@ func PossibleAzureStorageRedundancyValues() []AzureStorageRedundancy { } } -// AzureVMFamily - Azure VM family. +// AzureTarget - Azure Target +type AzureTarget string + +const ( + // AzureTargetAKS - AKS - Azure Target + AzureTargetAKS AzureTarget = "AKS" + // AzureTargetAvs - Avs - Azure Target + AzureTargetAvs AzureTarget = "Avs" + // AzureTargetAzureAppService - AzureAppService - Azure Target + AzureTargetAzureAppService AzureTarget = "AzureAppService" + // AzureTargetAzureAppServiceContainer - AzureAppServiceContainer - Azure Target + AzureTargetAzureAppServiceContainer AzureTarget = "AzureAppServiceContainer" + // AzureTargetAzureSQLVM - AzureSQLVM - Azure Target + AzureTargetAzureSQLVM AzureTarget = "AzureSQLVM" + // AzureTargetAzureSpringApps - AzureSpringApps - Azure Target + AzureTargetAzureSpringApps AzureTarget = "AzureSpringApps" + // AzureTargetAzureVM - AzureVM - Azure Target + AzureTargetAzureVM AzureTarget = "AzureVM" + // AzureTargetFlexServerPG - FlexServerPG - Azure Target + AzureTargetFlexServerPG AzureTarget = "FlexServerPG" + // AzureTargetMySQLAzureFlexServer - MySQLAzureFlexServer - Azure Target + AzureTargetMySQLAzureFlexServer AzureTarget = "MySQLAzureFlexServer" + // AzureTargetOracleIaasVM - OracleIaasVM - Azure Target + AzureTargetOracleIaasVM AzureTarget = "OracleIaasVM" + // AzureTargetSAPAzureInstance - SAPAzureInstance - Azure Target + AzureTargetSAPAzureInstance AzureTarget = "SAPAzureInstance" + // AzureTargetSQLDatabase - SqlDatabase - Azure Target + AzureTargetSQLDatabase AzureTarget = "SqlDatabase" + // AzureTargetSQLMI - SqlMI - Azure Target + AzureTargetSQLMI AzureTarget = "SqlMI" + // AzureTargetUnknown - Unknown - Azure Target + AzureTargetUnknown AzureTarget = "Unknown" +) + +// PossibleAzureTargetValues returns the possible values for the AzureTarget const type. +func PossibleAzureTargetValues() []AzureTarget { + return []AzureTarget{ + AzureTargetAKS, + AzureTargetAvs, + AzureTargetAzureAppService, + AzureTargetAzureAppServiceContainer, + AzureTargetAzureSQLVM, + AzureTargetAzureSpringApps, + AzureTargetAzureVM, + AzureTargetFlexServerPG, + AzureTargetMySQLAzureFlexServer, + AzureTargetOracleIaasVM, + AzureTargetSAPAzureInstance, + AzureTargetSQLDatabase, + AzureTargetSQLMI, + AzureTargetUnknown, + } +} + +// AzureVMFamily - Azure VM Family type AzureVMFamily string const ( - AzureVMFamilyAv2Series AzureVMFamily = "Av2_series" - AzureVMFamilyBasicA0A4 AzureVMFamily = "Basic_A0_A4" - AzureVMFamilyDCSeries AzureVMFamily = "DC_Series" - AzureVMFamilyDSSeries AzureVMFamily = "DS_series" - AzureVMFamilyDSeries AzureVMFamily = "D_series" - AzureVMFamilyDSv2Series AzureVMFamily = "DSv2_series" - AzureVMFamilyDsv3Series AzureVMFamily = "Dsv3_series" - AzureVMFamilyDv2Series AzureVMFamily = "Dv2_series" - AzureVMFamilyDv3Series AzureVMFamily = "Dv3_series" - AzureVMFamilyEsv3Series AzureVMFamily = "Esv3_series" - AzureVMFamilyEv3Series AzureVMFamily = "Ev3_series" - AzureVMFamilyFSeries AzureVMFamily = "F_series" - AzureVMFamilyFsSeries AzureVMFamily = "Fs_series" - AzureVMFamilyFsv2Series AzureVMFamily = "Fsv2_series" - AzureVMFamilyGSSeries AzureVMFamily = "GS_series" - AzureVMFamilyGSeries AzureVMFamily = "G_series" - AzureVMFamilyHSeries AzureVMFamily = "H_series" - AzureVMFamilyLsSeries AzureVMFamily = "Ls_series" - AzureVMFamilyMSeries AzureVMFamily = "M_series" - AzureVMFamilyStandardA0A7 AzureVMFamily = "Standard_A0_A7" + // AzureVMFamilyAv2Series - Av2_series + AzureVMFamilyAv2Series AzureVMFamily = "Av2_series" + // AzureVMFamilyBasicA0A4 - Basic_A0_A4 + AzureVMFamilyBasicA0A4 AzureVMFamily = "Basic_A0_A4" + // AzureVMFamilyDCSeries - DC_Series + AzureVMFamilyDCSeries AzureVMFamily = "DC_Series" + // AzureVMFamilyDSSeries - DS_series + AzureVMFamilyDSSeries AzureVMFamily = "DS_series" + // AzureVMFamilyDSeries - D_series + AzureVMFamilyDSeries AzureVMFamily = "D_series" + // AzureVMFamilyDSv2Series - DSv2_series + AzureVMFamilyDSv2Series AzureVMFamily = "DSv2_series" + // AzureVMFamilyDadsv5Series - Dadsv5_series + AzureVMFamilyDadsv5Series AzureVMFamily = "Dadsv5_series" + // AzureVMFamilyDasv4Series - Dasv4_series + AzureVMFamilyDasv4Series AzureVMFamily = "Dasv4_series" + // AzureVMFamilyDasv5Series - Dasv5_series + AzureVMFamilyDasv5Series AzureVMFamily = "Dasv5_series" + // AzureVMFamilyDav4Series - Dav4_series + AzureVMFamilyDav4Series AzureVMFamily = "Dav4_series" + // AzureVMFamilyDdsv4Series - Ddsv4_series + AzureVMFamilyDdsv4Series AzureVMFamily = "Ddsv4_series" + // AzureVMFamilyDdsv5Series - Ddsv5_series + AzureVMFamilyDdsv5Series AzureVMFamily = "Ddsv5_series" + // AzureVMFamilyDdv4Series - Ddv4_series + AzureVMFamilyDdv4Series AzureVMFamily = "Ddv4_series" + // AzureVMFamilyDdv5Series - Ddv5_series + AzureVMFamilyDdv5Series AzureVMFamily = "Ddv5_series" + // AzureVMFamilyDsv3Series - Dsv3_series + AzureVMFamilyDsv3Series AzureVMFamily = "Dsv3_series" + // AzureVMFamilyDsv4Series - Dsv4_series + AzureVMFamilyDsv4Series AzureVMFamily = "Dsv4_series" + // AzureVMFamilyDsv5Series - Dsv5_series + AzureVMFamilyDsv5Series AzureVMFamily = "Dsv5_series" + // AzureVMFamilyDv2Series - Dv2_series + AzureVMFamilyDv2Series AzureVMFamily = "Dv2_series" + // AzureVMFamilyDv3Series - Dv3_series + AzureVMFamilyDv3Series AzureVMFamily = "Dv3_series" + // AzureVMFamilyDv4Series - Dv4_series + AzureVMFamilyDv4Series AzureVMFamily = "Dv4_series" + // AzureVMFamilyDv5Series - Dv5_series + AzureVMFamilyDv5Series AzureVMFamily = "Dv5_series" + // AzureVMFamilyEadsv5Series - Eadsv5_series + AzureVMFamilyEadsv5Series AzureVMFamily = "Eadsv5_series" + // AzureVMFamilyEasv4Series - Easv4_series + AzureVMFamilyEasv4Series AzureVMFamily = "Easv4_series" + // AzureVMFamilyEasv5Series - Easv5_series + AzureVMFamilyEasv5Series AzureVMFamily = "Easv5_series" + // AzureVMFamilyEav4Series - Eav4_series + AzureVMFamilyEav4Series AzureVMFamily = "Eav4_series" + // AzureVMFamilyEbdsv5Series - Ebdsv5_series + AzureVMFamilyEbdsv5Series AzureVMFamily = "Ebdsv5_series" + // AzureVMFamilyEbsv5Series - Ebsv5_series + AzureVMFamilyEbsv5Series AzureVMFamily = "Ebsv5_series" + // AzureVMFamilyEdsv4Series - Edsv4_series + AzureVMFamilyEdsv4Series AzureVMFamily = "Edsv4_series" + // AzureVMFamilyEdsv5Series - Edsv5_series + AzureVMFamilyEdsv5Series AzureVMFamily = "Edsv5_series" + // AzureVMFamilyEdv4Series - Edv4_series + AzureVMFamilyEdv4Series AzureVMFamily = "Edv4_series" + // AzureVMFamilyEdv5Series - Edv5_series + AzureVMFamilyEdv5Series AzureVMFamily = "Edv5_series" + // AzureVMFamilyEsv3Series - Esv3_series + AzureVMFamilyEsv3Series AzureVMFamily = "Esv3_series" + // AzureVMFamilyEsv4Series - Esv4_series + AzureVMFamilyEsv4Series AzureVMFamily = "Esv4_series" + // AzureVMFamilyEsv5Series - Esv5_series + AzureVMFamilyEsv5Series AzureVMFamily = "Esv5_series" + // AzureVMFamilyEv3Series - Ev3_series + AzureVMFamilyEv3Series AzureVMFamily = "Ev3_series" + // AzureVMFamilyEv4Series - Ev4_series + AzureVMFamilyEv4Series AzureVMFamily = "Ev4_series" + // AzureVMFamilyEv5Series - Ev5_series + AzureVMFamilyEv5Series AzureVMFamily = "Ev5_series" + // AzureVMFamilyFSeries - F_series + AzureVMFamilyFSeries AzureVMFamily = "F_series" + // AzureVMFamilyFsSeries - Fs_series + AzureVMFamilyFsSeries AzureVMFamily = "Fs_series" + // AzureVMFamilyFsv2Series - Fsv2_series + AzureVMFamilyFsv2Series AzureVMFamily = "Fsv2_series" + // AzureVMFamilyGSSeries - GS_series + AzureVMFamilyGSSeries AzureVMFamily = "GS_series" + // AzureVMFamilyGSeries - G_series + AzureVMFamilyGSeries AzureVMFamily = "G_series" + // AzureVMFamilyHSeries - H_series + AzureVMFamilyHSeries AzureVMFamily = "H_series" + // AzureVMFamilyLsSeries - Ls_series + AzureVMFamilyLsSeries AzureVMFamily = "Ls_series" + // AzureVMFamilyLsv2Series - Lsv2_series + AzureVMFamilyLsv2Series AzureVMFamily = "Lsv2_series" + // AzureVMFamilyMSeries - M_series + AzureVMFamilyMSeries AzureVMFamily = "M_series" + // AzureVMFamilyMdsv2Series - Mdsv2_series + AzureVMFamilyMdsv2Series AzureVMFamily = "Mdsv2_series" + // AzureVMFamilyMsv2Series - Msv2_series + AzureVMFamilyMsv2Series AzureVMFamily = "Msv2_series" + // AzureVMFamilyMv2Series - Mv2_series + AzureVMFamilyMv2Series AzureVMFamily = "Mv2_series" + // AzureVMFamilyStandardA0A7 - Standard_A0_A7 + AzureVMFamilyStandardA0A7 AzureVMFamily = "Standard_A0_A7" + // AzureVMFamilyStandardA8A11 - Standard_A8_A11 AzureVMFamilyStandardA8A11 AzureVMFamily = "Standard_A8_A11" - AzureVMFamilyUnknown AzureVMFamily = "Unknown" + // AzureVMFamilyUnknown - Unknown - Azure VM Family + AzureVMFamilyUnknown AzureVMFamily = "Unknown" ) // PossibleAzureVMFamilyValues returns the possible values for the AzureVMFamily const type. @@ -552,11 +818,37 @@ func PossibleAzureVMFamilyValues() []AzureVMFamily { AzureVMFamilyDSSeries, AzureVMFamilyDSeries, AzureVMFamilyDSv2Series, + AzureVMFamilyDadsv5Series, + AzureVMFamilyDasv4Series, + AzureVMFamilyDasv5Series, + AzureVMFamilyDav4Series, + AzureVMFamilyDdsv4Series, + AzureVMFamilyDdsv5Series, + AzureVMFamilyDdv4Series, + AzureVMFamilyDdv5Series, AzureVMFamilyDsv3Series, + AzureVMFamilyDsv4Series, + AzureVMFamilyDsv5Series, AzureVMFamilyDv2Series, AzureVMFamilyDv3Series, + AzureVMFamilyDv4Series, + AzureVMFamilyDv5Series, + AzureVMFamilyEadsv5Series, + AzureVMFamilyEasv4Series, + AzureVMFamilyEasv5Series, + AzureVMFamilyEav4Series, + AzureVMFamilyEbdsv5Series, + AzureVMFamilyEbsv5Series, + AzureVMFamilyEdsv4Series, + AzureVMFamilyEdsv5Series, + AzureVMFamilyEdv4Series, + AzureVMFamilyEdv5Series, AzureVMFamilyEsv3Series, + AzureVMFamilyEsv4Series, + AzureVMFamilyEsv5Series, AzureVMFamilyEv3Series, + AzureVMFamilyEv4Series, + AzureVMFamilyEv5Series, AzureVMFamilyFSeries, AzureVMFamilyFsSeries, AzureVMFamilyFsv2Series, @@ -564,541 +856,511 @@ func PossibleAzureVMFamilyValues() []AzureVMFamily { AzureVMFamilyGSeries, AzureVMFamilyHSeries, AzureVMFamilyLsSeries, + AzureVMFamilyLsv2Series, AzureVMFamilyMSeries, + AzureVMFamilyMdsv2Series, + AzureVMFamilyMsv2Series, + AzureVMFamilyMv2Series, AzureVMFamilyStandardA0A7, AzureVMFamilyStandardA8A11, AzureVMFamilyUnknown, } } -// AzureVMSize - Recommended Azure size for this machine. -type AzureVMSize string +// AzureVMSecuritySuitabilityDetail - Azure Vm Security Suitability Detail +type AzureVMSecuritySuitabilityDetail string const ( - AzureVMSizeBasicA0 AzureVMSize = "Basic_A0" - AzureVMSizeBasicA1 AzureVMSize = "Basic_A1" - AzureVMSizeBasicA2 AzureVMSize = "Basic_A2" - AzureVMSizeBasicA3 AzureVMSize = "Basic_A3" - AzureVMSizeBasicA4 AzureVMSize = "Basic_A4" - AzureVMSizeStandardA0 AzureVMSize = "Standard_A0" - AzureVMSizeStandardA1 AzureVMSize = "Standard_A1" - AzureVMSizeStandardA10 AzureVMSize = "Standard_A10" - AzureVMSizeStandardA11 AzureVMSize = "Standard_A11" - AzureVMSizeStandardA1V2 AzureVMSize = "Standard_A1_v2" - AzureVMSizeStandardA2 AzureVMSize = "Standard_A2" - AzureVMSizeStandardA2MV2 AzureVMSize = "Standard_A2m_v2" - AzureVMSizeStandardA2V2 AzureVMSize = "Standard_A2_v2" - AzureVMSizeStandardA3 AzureVMSize = "Standard_A3" - AzureVMSizeStandardA4 AzureVMSize = "Standard_A4" - AzureVMSizeStandardA4MV2 AzureVMSize = "Standard_A4m_v2" - AzureVMSizeStandardA4V2 AzureVMSize = "Standard_A4_v2" - AzureVMSizeStandardA5 AzureVMSize = "Standard_A5" - AzureVMSizeStandardA6 AzureVMSize = "Standard_A6" - AzureVMSizeStandardA7 AzureVMSize = "Standard_A7" - AzureVMSizeStandardA8 AzureVMSize = "Standard_A8" - AzureVMSizeStandardA8MV2 AzureVMSize = "Standard_A8m_v2" - AzureVMSizeStandardA8V2 AzureVMSize = "Standard_A8_v2" - AzureVMSizeStandardA9 AzureVMSize = "Standard_A9" - AzureVMSizeStandardD1 AzureVMSize = "Standard_D1" - AzureVMSizeStandardD11 AzureVMSize = "Standard_D11" - AzureVMSizeStandardD11V2 AzureVMSize = "Standard_D11_v2" - AzureVMSizeStandardD12 AzureVMSize = "Standard_D12" - AzureVMSizeStandardD12V2 AzureVMSize = "Standard_D12_v2" - AzureVMSizeStandardD13 AzureVMSize = "Standard_D13" - AzureVMSizeStandardD13V2 AzureVMSize = "Standard_D13_v2" - AzureVMSizeStandardD14 AzureVMSize = "Standard_D14" - AzureVMSizeStandardD14V2 AzureVMSize = "Standard_D14_v2" - AzureVMSizeStandardD15V2 AzureVMSize = "Standard_D15_v2" - AzureVMSizeStandardD16SV3 AzureVMSize = "Standard_D16s_v3" - AzureVMSizeStandardD16V3 AzureVMSize = "Standard_D16_v3" - AzureVMSizeStandardD1V2 AzureVMSize = "Standard_D1_v2" - AzureVMSizeStandardD2 AzureVMSize = "Standard_D2" - AzureVMSizeStandardD2SV3 AzureVMSize = "Standard_D2s_v3" - AzureVMSizeStandardD2V2 AzureVMSize = "Standard_D2_v2" - AzureVMSizeStandardD2V3 AzureVMSize = "Standard_D2_v3" - AzureVMSizeStandardD3 AzureVMSize = "Standard_D3" - AzureVMSizeStandardD32SV3 AzureVMSize = "Standard_D32s_v3" - AzureVMSizeStandardD32V3 AzureVMSize = "Standard_D32_v3" - AzureVMSizeStandardD3V2 AzureVMSize = "Standard_D3_v2" - AzureVMSizeStandardD4 AzureVMSize = "Standard_D4" - AzureVMSizeStandardD4SV3 AzureVMSize = "Standard_D4s_v3" - AzureVMSizeStandardD4V2 AzureVMSize = "Standard_D4_v2" - AzureVMSizeStandardD4V3 AzureVMSize = "Standard_D4_v3" - AzureVMSizeStandardD5V2 AzureVMSize = "Standard_D5_v2" - AzureVMSizeStandardD64SV3 AzureVMSize = "Standard_D64s_v3" - AzureVMSizeStandardD64V3 AzureVMSize = "Standard_D64_v3" - AzureVMSizeStandardD8SV3 AzureVMSize = "Standard_D8s_v3" - AzureVMSizeStandardD8V3 AzureVMSize = "Standard_D8_v3" - AzureVMSizeStandardDS1 AzureVMSize = "Standard_DS1" - AzureVMSizeStandardDS11 AzureVMSize = "Standard_DS11" - AzureVMSizeStandardDS11V2 AzureVMSize = "Standard_DS11_v2" - AzureVMSizeStandardDS12 AzureVMSize = "Standard_DS12" - AzureVMSizeStandardDS12V2 AzureVMSize = "Standard_DS12_v2" - AzureVMSizeStandardDS13 AzureVMSize = "Standard_DS13" - AzureVMSizeStandardDS13V2 AzureVMSize = "Standard_DS13_v2" - AzureVMSizeStandardDS14 AzureVMSize = "Standard_DS14" - AzureVMSizeStandardDS14V2 AzureVMSize = "Standard_DS14_v2" - AzureVMSizeStandardDS15V2 AzureVMSize = "Standard_DS15_v2" - AzureVMSizeStandardDS1V2 AzureVMSize = "Standard_DS1_v2" - AzureVMSizeStandardDS2 AzureVMSize = "Standard_DS2" - AzureVMSizeStandardDS2V2 AzureVMSize = "Standard_DS2_v2" - AzureVMSizeStandardDS3 AzureVMSize = "Standard_DS3" - AzureVMSizeStandardDS3V2 AzureVMSize = "Standard_DS3_v2" - AzureVMSizeStandardDS4 AzureVMSize = "Standard_DS4" - AzureVMSizeStandardDS4V2 AzureVMSize = "Standard_DS4_v2" - AzureVMSizeStandardDS5V2 AzureVMSize = "Standard_DS5_v2" - AzureVMSizeStandardE16SV3 AzureVMSize = "Standard_E16s_v3" - AzureVMSizeStandardE16V3 AzureVMSize = "Standard_E16_v3" - AzureVMSizeStandardE2SV3 AzureVMSize = "Standard_E2s_v3" - AzureVMSizeStandardE2V3 AzureVMSize = "Standard_E2_v3" - AzureVMSizeStandardE32SV3 AzureVMSize = "Standard_E32s_v3" - AzureVMSizeStandardE32V3 AzureVMSize = "Standard_E32_v3" - AzureVMSizeStandardE4SV3 AzureVMSize = "Standard_E4s_v3" - AzureVMSizeStandardE4V3 AzureVMSize = "Standard_E4_v3" - AzureVMSizeStandardE64SV3 AzureVMSize = "Standard_E64s_v3" - AzureVMSizeStandardE64V3 AzureVMSize = "Standard_E64_v3" - AzureVMSizeStandardE8SV3 AzureVMSize = "Standard_E8s_v3" - AzureVMSizeStandardE8V3 AzureVMSize = "Standard_E8_v3" - AzureVMSizeStandardF1 AzureVMSize = "Standard_F1" - AzureVMSizeStandardF16 AzureVMSize = "Standard_F16" - AzureVMSizeStandardF16S AzureVMSize = "Standard_F16s" - AzureVMSizeStandardF16SV2 AzureVMSize = "Standard_F16s_v2" - AzureVMSizeStandardF1S AzureVMSize = "Standard_F1s" - AzureVMSizeStandardF2 AzureVMSize = "Standard_F2" - AzureVMSizeStandardF2S AzureVMSize = "Standard_F2s" - AzureVMSizeStandardF2SV2 AzureVMSize = "Standard_F2s_v2" - AzureVMSizeStandardF32SV2 AzureVMSize = "Standard_F32s_v2" - AzureVMSizeStandardF4 AzureVMSize = "Standard_F4" - AzureVMSizeStandardF4S AzureVMSize = "Standard_F4s" - AzureVMSizeStandardF4SV2 AzureVMSize = "Standard_F4s_v2" - AzureVMSizeStandardF64SV2 AzureVMSize = "Standard_F64s_v2" - AzureVMSizeStandardF72SV2 AzureVMSize = "Standard_F72s_v2" - AzureVMSizeStandardF8 AzureVMSize = "Standard_F8" - AzureVMSizeStandardF8S AzureVMSize = "Standard_F8s" - AzureVMSizeStandardF8SV2 AzureVMSize = "Standard_F8s_v2" - AzureVMSizeStandardG1 AzureVMSize = "Standard_G1" - AzureVMSizeStandardG2 AzureVMSize = "Standard_G2" - AzureVMSizeStandardG3 AzureVMSize = "Standard_G3" - AzureVMSizeStandardG4 AzureVMSize = "Standard_G4" - AzureVMSizeStandardG5 AzureVMSize = "Standard_G5" - AzureVMSizeStandardGS1 AzureVMSize = "Standard_GS1" - AzureVMSizeStandardGS2 AzureVMSize = "Standard_GS2" - AzureVMSizeStandardGS3 AzureVMSize = "Standard_GS3" - AzureVMSizeStandardGS4 AzureVMSize = "Standard_GS4" - AzureVMSizeStandardGS5 AzureVMSize = "Standard_GS5" - AzureVMSizeStandardH16 AzureVMSize = "Standard_H16" - AzureVMSizeStandardH16M AzureVMSize = "Standard_H16m" - AzureVMSizeStandardH16Mr AzureVMSize = "Standard_H16mr" - AzureVMSizeStandardH16R AzureVMSize = "Standard_H16r" - AzureVMSizeStandardH8 AzureVMSize = "Standard_H8" - AzureVMSizeStandardH8M AzureVMSize = "Standard_H8m" - AzureVMSizeStandardL16S AzureVMSize = "Standard_L16s" - AzureVMSizeStandardL32S AzureVMSize = "Standard_L32s" - AzureVMSizeStandardL4S AzureVMSize = "Standard_L4s" - AzureVMSizeStandardL8S AzureVMSize = "Standard_L8s" - AzureVMSizeStandardM128Ms AzureVMSize = "Standard_M128ms" - AzureVMSizeStandardM128S AzureVMSize = "Standard_M128s" - AzureVMSizeStandardM64Ms AzureVMSize = "Standard_M64ms" - AzureVMSizeStandardM64S AzureVMSize = "Standard_M64s" - AzureVMSizeUnknown AzureVMSize = "Unknown" + // AzureVMSecuritySuitabilityDetailAllDiskSizeExceeds2TB - The VM is not ready to be migrated to Azure with Trusted launch + // VM security type. Azure does not support OS disk size greater than 2TB for VMs with BIOS boot type. + AzureVMSecuritySuitabilityDetailAllDiskSizeExceeds2TB AzureVMSecuritySuitabilityDetail = "AllDiskSizeExceeds2TB" + // AzureVMSecuritySuitabilityDetailAllDiskSizeExceeds4TB - Azure does not support VM with OS disk size greater than 4TB. + AzureVMSecuritySuitabilityDetailAllDiskSizeExceeds4TB AzureVMSecuritySuitabilityDetail = "AllDiskSizeExceeds4TB" + // AzureVMSecuritySuitabilityDetailAnyDiskSizeExceeds4TB - Azure does not support VM with OS disk size greater than 4TB. If + // OS disk size is less than 4TB, proceed with migration. + AzureVMSecuritySuitabilityDetailAnyDiskSizeExceeds4TB AzureVMSecuritySuitabilityDetail = "AnyDiskSizeExceeds4TB" + // AzureVMSecuritySuitabilityDetailAnyDiskSizeExceeds4TBConditional - Azure does not support VM with any disk size greater + // than 4TB. Please proceed only if you know the OS disk size is less than 4TB. + AzureVMSecuritySuitabilityDetailAnyDiskSizeExceeds4TBConditional AzureVMSecuritySuitabilityDetail = "AnyDiskSizeExceeds4TBConditional" + // AzureVMSecuritySuitabilityDetailBootTypeNotSupported - BootTypeNotSupported Azure Vm Security Suitability Detail + AzureVMSecuritySuitabilityDetailBootTypeNotSupported AzureVMSecuritySuitabilityDetail = "BootTypeNotSupported" + // AzureVMSecuritySuitabilityDetailDiskSize2TBConditionalReadyBiosBoot - The VM readiness is unknown. Azure does not support + // OS disk size greater than 2TB for VMs with BIOS boot type. Please proceed with migration only if OS disk size is less than + // 2TB. + AzureVMSecuritySuitabilityDetailDiskSize2TBConditionalReadyBiosBoot AzureVMSecuritySuitabilityDetail = "DiskSize2TBConditionalReadyBiosBoot" + // AzureVMSecuritySuitabilityDetailDiskSizeLarge - DiskSizeLarge Azure Vm Security Suitability Detail + AzureVMSecuritySuitabilityDetailDiskSizeLarge AzureVMSecuritySuitabilityDetail = "DiskSizeLarge" + // AzureVMSecuritySuitabilityDetailGuestOperatingSystemNotSupported - GuestOperatingSystemNotSupported Azure Vm Security Suitability + // Detail + AzureVMSecuritySuitabilityDetailGuestOperatingSystemNotSupported AzureVMSecuritySuitabilityDetail = "GuestOperatingSystemNotSupported" + // AzureVMSecuritySuitabilityDetailNotApplicable - NotApplicable - Azure Vm Security Suitability Detail + AzureVMSecuritySuitabilityDetailNotApplicable AzureVMSecuritySuitabilityDetail = "NotApplicable" + // AzureVMSecuritySuitabilityDetailOSNameCannotBeRead - Readiness is marked as unknown because the OS name cannot be read. + AzureVMSecuritySuitabilityDetailOSNameCannotBeRead AzureVMSecuritySuitabilityDetail = "OSNameCannotBeRead" + // AzureVMSecuritySuitabilityDetailOSNotSupported - The VM is not ready to be migrated to Azure because the OS is not supported. + AzureVMSecuritySuitabilityDetailOSNotSupported AzureVMSecuritySuitabilityDetail = "OSNotSupported" + // AzureVMSecuritySuitabilityDetailStandardCanMigrate - The VM can be migrated to Azure with standard VM security type. + AzureVMSecuritySuitabilityDetailStandardCanMigrate AzureVMSecuritySuitabilityDetail = "StandardCanMigrate" + // AzureVMSecuritySuitabilityDetailStandardCannotMigrateOSNotSupported - The VM cannot be migrated to Azure because the OS + // is not supported. + AzureVMSecuritySuitabilityDetailStandardCannotMigrateOSNotSupported AzureVMSecuritySuitabilityDetail = "StandardCannotMigrateOSNotSupported" + // AzureVMSecuritySuitabilityDetailStandardNotReady2TBBiosBoot - The VM is not ready to be migrated to Azure with standard + // VM security type. Azure does not support OS disk size greater than 2TB for VMs with BIOS boot type. + AzureVMSecuritySuitabilityDetailStandardNotReady2TBBiosBoot AzureVMSecuritySuitabilityDetail = "StandardNotReady2TBBiosBoot" + // AzureVMSecuritySuitabilityDetailStandardNotReadyOSNotSupported - The VM is not ready to be migrated to Azure with standard + // VM security type because the OS is not supported. + AzureVMSecuritySuitabilityDetailStandardNotReadyOSNotSupported AzureVMSecuritySuitabilityDetail = "StandardNotReadyOSNotSupported" + // AzureVMSecuritySuitabilityDetailStandardReady - The VM is ready to be migrated to Azure with standard VM security type. + AzureVMSecuritySuitabilityDetailStandardReady AzureVMSecuritySuitabilityDetail = "StandardReady" + // AzureVMSecuritySuitabilityDetailTVMCanMigrateConditional - The VM can be migrated to Trusted launch VM. Currently, Azure + // Migrate does not support migration to Trusted launch for VM with BIOS boot type. You can convert the VM post-migration + // to Trusted Launch VM. The steps are mentioned in this documentation. + AzureVMSecuritySuitabilityDetailTVMCanMigrateConditional AzureVMSecuritySuitabilityDetail = "TVMCanMigrateConditional" + // AzureVMSecuritySuitabilityDetailTVMCannotMigrateOSNotSupported - The VM cannot be migrated to Trusted launch VM because + // the OS is not supported. Learn more [here]. + AzureVMSecuritySuitabilityDetailTVMCannotMigrateOSNotSupported AzureVMSecuritySuitabilityDetail = "TVMCannotMigrateOSNotSupported" + // AzureVMSecuritySuitabilityDetailTVMNotReadyOSNotSupported - The VM is not ready to be migrated to Azure with Trusted launch + // VM security type because the OS is not supported for Trusted launch VM. Get more information [here]. + AzureVMSecuritySuitabilityDetailTVMNotReadyOSNotSupported AzureVMSecuritySuitabilityDetail = "TVMNotReadyOSNotSupported" + // AzureVMSecuritySuitabilityDetailTVMNotSupportedForBiosBoot - Migration to Trusted Launch VM is not supported for BIOS boot + // type VMs at this time. + AzureVMSecuritySuitabilityDetailTVMNotSupportedForBiosBoot AzureVMSecuritySuitabilityDetail = "TVMNotSupportedForBiosBoot" + // AzureVMSecuritySuitabilityDetailTVMReady - The VM is ready to be migrated to Azure with Trusted launch VM security type. + AzureVMSecuritySuitabilityDetailTVMReady AzureVMSecuritySuitabilityDetail = "TVMReady" + // AzureVMSecuritySuitabilityDetailUnknown - Unknown - Azure Vm Security Suitability Detail + AzureVMSecuritySuitabilityDetailUnknown AzureVMSecuritySuitabilityDetail = "Unknown" ) -// PossibleAzureVMSizeValues returns the possible values for the AzureVMSize const type. -func PossibleAzureVMSizeValues() []AzureVMSize { - return []AzureVMSize{ - AzureVMSizeBasicA0, - AzureVMSizeBasicA1, - AzureVMSizeBasicA2, - AzureVMSizeBasicA3, - AzureVMSizeBasicA4, - AzureVMSizeStandardA0, - AzureVMSizeStandardA1, - AzureVMSizeStandardA10, - AzureVMSizeStandardA11, - AzureVMSizeStandardA1V2, - AzureVMSizeStandardA2, - AzureVMSizeStandardA2MV2, - AzureVMSizeStandardA2V2, - AzureVMSizeStandardA3, - AzureVMSizeStandardA4, - AzureVMSizeStandardA4MV2, - AzureVMSizeStandardA4V2, - AzureVMSizeStandardA5, - AzureVMSizeStandardA6, - AzureVMSizeStandardA7, - AzureVMSizeStandardA8, - AzureVMSizeStandardA8MV2, - AzureVMSizeStandardA8V2, - AzureVMSizeStandardA9, - AzureVMSizeStandardD1, - AzureVMSizeStandardD11, - AzureVMSizeStandardD11V2, - AzureVMSizeStandardD12, - AzureVMSizeStandardD12V2, - AzureVMSizeStandardD13, - AzureVMSizeStandardD13V2, - AzureVMSizeStandardD14, - AzureVMSizeStandardD14V2, - AzureVMSizeStandardD15V2, - AzureVMSizeStandardD16SV3, - AzureVMSizeStandardD16V3, - AzureVMSizeStandardD1V2, - AzureVMSizeStandardD2, - AzureVMSizeStandardD2SV3, - AzureVMSizeStandardD2V2, - AzureVMSizeStandardD2V3, - AzureVMSizeStandardD3, - AzureVMSizeStandardD32SV3, - AzureVMSizeStandardD32V3, - AzureVMSizeStandardD3V2, - AzureVMSizeStandardD4, - AzureVMSizeStandardD4SV3, - AzureVMSizeStandardD4V2, - AzureVMSizeStandardD4V3, - AzureVMSizeStandardD5V2, - AzureVMSizeStandardD64SV3, - AzureVMSizeStandardD64V3, - AzureVMSizeStandardD8SV3, - AzureVMSizeStandardD8V3, - AzureVMSizeStandardDS1, - AzureVMSizeStandardDS11, - AzureVMSizeStandardDS11V2, - AzureVMSizeStandardDS12, - AzureVMSizeStandardDS12V2, - AzureVMSizeStandardDS13, - AzureVMSizeStandardDS13V2, - AzureVMSizeStandardDS14, - AzureVMSizeStandardDS14V2, - AzureVMSizeStandardDS15V2, - AzureVMSizeStandardDS1V2, - AzureVMSizeStandardDS2, - AzureVMSizeStandardDS2V2, - AzureVMSizeStandardDS3, - AzureVMSizeStandardDS3V2, - AzureVMSizeStandardDS4, - AzureVMSizeStandardDS4V2, - AzureVMSizeStandardDS5V2, - AzureVMSizeStandardE16SV3, - AzureVMSizeStandardE16V3, - AzureVMSizeStandardE2SV3, - AzureVMSizeStandardE2V3, - AzureVMSizeStandardE32SV3, - AzureVMSizeStandardE32V3, - AzureVMSizeStandardE4SV3, - AzureVMSizeStandardE4V3, - AzureVMSizeStandardE64SV3, - AzureVMSizeStandardE64V3, - AzureVMSizeStandardE8SV3, - AzureVMSizeStandardE8V3, - AzureVMSizeStandardF1, - AzureVMSizeStandardF16, - AzureVMSizeStandardF16S, - AzureVMSizeStandardF16SV2, - AzureVMSizeStandardF1S, - AzureVMSizeStandardF2, - AzureVMSizeStandardF2S, - AzureVMSizeStandardF2SV2, - AzureVMSizeStandardF32SV2, - AzureVMSizeStandardF4, - AzureVMSizeStandardF4S, - AzureVMSizeStandardF4SV2, - AzureVMSizeStandardF64SV2, - AzureVMSizeStandardF72SV2, - AzureVMSizeStandardF8, - AzureVMSizeStandardF8S, - AzureVMSizeStandardF8SV2, - AzureVMSizeStandardG1, - AzureVMSizeStandardG2, - AzureVMSizeStandardG3, - AzureVMSizeStandardG4, - AzureVMSizeStandardG5, - AzureVMSizeStandardGS1, - AzureVMSizeStandardGS2, - AzureVMSizeStandardGS3, - AzureVMSizeStandardGS4, - AzureVMSizeStandardGS5, - AzureVMSizeStandardH16, - AzureVMSizeStandardH16M, - AzureVMSizeStandardH16Mr, - AzureVMSizeStandardH16R, - AzureVMSizeStandardH8, - AzureVMSizeStandardH8M, - AzureVMSizeStandardL16S, - AzureVMSizeStandardL32S, - AzureVMSizeStandardL4S, - AzureVMSizeStandardL8S, - AzureVMSizeStandardM128Ms, - AzureVMSizeStandardM128S, - AzureVMSizeStandardM64Ms, - AzureVMSizeStandardM64S, - AzureVMSizeUnknown, +// PossibleAzureVMSecuritySuitabilityDetailValues returns the possible values for the AzureVMSecuritySuitabilityDetail const type. +func PossibleAzureVMSecuritySuitabilityDetailValues() []AzureVMSecuritySuitabilityDetail { + return []AzureVMSecuritySuitabilityDetail{ + AzureVMSecuritySuitabilityDetailAllDiskSizeExceeds2TB, + AzureVMSecuritySuitabilityDetailAllDiskSizeExceeds4TB, + AzureVMSecuritySuitabilityDetailAnyDiskSizeExceeds4TB, + AzureVMSecuritySuitabilityDetailAnyDiskSizeExceeds4TBConditional, + AzureVMSecuritySuitabilityDetailBootTypeNotSupported, + AzureVMSecuritySuitabilityDetailDiskSize2TBConditionalReadyBiosBoot, + AzureVMSecuritySuitabilityDetailDiskSizeLarge, + AzureVMSecuritySuitabilityDetailGuestOperatingSystemNotSupported, + AzureVMSecuritySuitabilityDetailNotApplicable, + AzureVMSecuritySuitabilityDetailOSNameCannotBeRead, + AzureVMSecuritySuitabilityDetailOSNotSupported, + AzureVMSecuritySuitabilityDetailStandardCanMigrate, + AzureVMSecuritySuitabilityDetailStandardCannotMigrateOSNotSupported, + AzureVMSecuritySuitabilityDetailStandardNotReady2TBBiosBoot, + AzureVMSecuritySuitabilityDetailStandardNotReadyOSNotSupported, + AzureVMSecuritySuitabilityDetailStandardReady, + AzureVMSecuritySuitabilityDetailTVMCanMigrateConditional, + AzureVMSecuritySuitabilityDetailTVMCannotMigrateOSNotSupported, + AzureVMSecuritySuitabilityDetailTVMNotReadyOSNotSupported, + AzureVMSecuritySuitabilityDetailTVMNotSupportedForBiosBoot, + AzureVMSecuritySuitabilityDetailTVMReady, + AzureVMSecuritySuitabilityDetailUnknown, } } -// AzureVMSuitabilityDetail - If machine is not suitable for cloud, this explains the reasons. -type AzureVMSuitabilityDetail string +// AzureVMSecurityType - Azure Vm Security Type +type AzureVMSecurityType string const ( - AzureVMSuitabilityDetailCannotReportBandwidthCosts AzureVMSuitabilityDetail = "CannotReportBandwidthCosts" - AzureVMSuitabilityDetailCannotReportComputeCost AzureVMSuitabilityDetail = "CannotReportComputeCost" - AzureVMSuitabilityDetailCannotReportStorageCost AzureVMSuitabilityDetail = "CannotReportStorageCost" - AzureVMSuitabilityDetailNone AzureVMSuitabilityDetail = "None" - AzureVMSuitabilityDetailPercentageOfCoresUtilizedMissing AzureVMSuitabilityDetail = "PercentageOfCoresUtilizedMissing" - AzureVMSuitabilityDetailPercentageOfCoresUtilizedOutOfRange AzureVMSuitabilityDetail = "PercentageOfCoresUtilizedOutOfRange" - AzureVMSuitabilityDetailPercentageOfMemoryUtilizedMissing AzureVMSuitabilityDetail = "PercentageOfMemoryUtilizedMissing" - AzureVMSuitabilityDetailPercentageOfMemoryUtilizedOutOfRange AzureVMSuitabilityDetail = "PercentageOfMemoryUtilizedOutOfRange" - AzureVMSuitabilityDetailRecommendedSizeHasLessNetworkAdapters AzureVMSuitabilityDetail = "RecommendedSizeHasLessNetworkAdapters" + // AzureVMSecurityTypeCVM - CVM Azure Vm Security Type + AzureVMSecurityTypeCVM AzureVMSecurityType = "CVM" + // AzureVMSecurityTypeStandard - Standard Azure Vm Security Type + AzureVMSecurityTypeStandard AzureVMSecurityType = "Standard" + // AzureVMSecurityTypeTVM - TVM Azure Vm Security Type + AzureVMSecurityTypeTVM AzureVMSecurityType = "TVM" + // AzureVMSecurityTypeUnknown - Unknown - Azure Vm Security Type + AzureVMSecurityTypeUnknown AzureVMSecurityType = "Unknown" ) -// PossibleAzureVMSuitabilityDetailValues returns the possible values for the AzureVMSuitabilityDetail const type. -func PossibleAzureVMSuitabilityDetailValues() []AzureVMSuitabilityDetail { - return []AzureVMSuitabilityDetail{ - AzureVMSuitabilityDetailCannotReportBandwidthCosts, - AzureVMSuitabilityDetailCannotReportComputeCost, - AzureVMSuitabilityDetailCannotReportStorageCost, - AzureVMSuitabilityDetailNone, - AzureVMSuitabilityDetailPercentageOfCoresUtilizedMissing, - AzureVMSuitabilityDetailPercentageOfCoresUtilizedOutOfRange, - AzureVMSuitabilityDetailPercentageOfMemoryUtilizedMissing, - AzureVMSuitabilityDetailPercentageOfMemoryUtilizedOutOfRange, - AzureVMSuitabilityDetailRecommendedSizeHasLessNetworkAdapters, +// PossibleAzureVMSecurityTypeValues returns the possible values for the AzureVMSecurityType const type. +func PossibleAzureVMSecurityTypeValues() []AzureVMSecurityType { + return []AzureVMSecurityType{ + AzureVMSecurityTypeCVM, + AzureVMSecurityTypeStandard, + AzureVMSecurityTypeTVM, + AzureVMSecurityTypeUnknown, } } -// AzureVMSuitabilityExplanation - If machine is not ready to be migrated, this explains the reasons and mitigation steps. -type AzureVMSuitabilityExplanation string +// CloudSuitabilityCommon - Cloud Suitability Common +type CloudSuitabilityCommon string const ( - AzureVMSuitabilityExplanationBootTypeNotSupported AzureVMSuitabilityExplanation = "BootTypeNotSupported" - AzureVMSuitabilityExplanationBootTypeUnknown AzureVMSuitabilityExplanation = "BootTypeUnknown" - AzureVMSuitabilityExplanationCheckCentOsVersion AzureVMSuitabilityExplanation = "CheckCentOsVersion" - AzureVMSuitabilityExplanationCheckCoreOsLinuxVersion AzureVMSuitabilityExplanation = "CheckCoreOsLinuxVersion" - AzureVMSuitabilityExplanationCheckDebianLinuxVersion AzureVMSuitabilityExplanation = "CheckDebianLinuxVersion" - AzureVMSuitabilityExplanationCheckOpenSuseLinuxVersion AzureVMSuitabilityExplanation = "CheckOpenSuseLinuxVersion" - AzureVMSuitabilityExplanationCheckOracleLinuxVersion AzureVMSuitabilityExplanation = "CheckOracleLinuxVersion" - AzureVMSuitabilityExplanationCheckRedHatLinuxVersion AzureVMSuitabilityExplanation = "CheckRedHatLinuxVersion" - AzureVMSuitabilityExplanationCheckSuseLinuxVersion AzureVMSuitabilityExplanation = "CheckSuseLinuxVersion" - AzureVMSuitabilityExplanationCheckUbuntuLinuxVersion AzureVMSuitabilityExplanation = "CheckUbuntuLinuxVersion" - AzureVMSuitabilityExplanationCheckWindowsServer2008R2Version AzureVMSuitabilityExplanation = "CheckWindowsServer2008R2Version" - AzureVMSuitabilityExplanationEndorsedWithConditionsLinuxDistributions AzureVMSuitabilityExplanation = "EndorsedWithConditionsLinuxDistributions" - AzureVMSuitabilityExplanationGuestOperatingSystemArchitectureNotSupported AzureVMSuitabilityExplanation = "GuestOperatingSystemArchitectureNotSupported" - AzureVMSuitabilityExplanationGuestOperatingSystemNotSupported AzureVMSuitabilityExplanation = "GuestOperatingSystemNotSupported" - AzureVMSuitabilityExplanationGuestOperatingSystemUnknown AzureVMSuitabilityExplanation = "GuestOperatingSystemUnknown" - AzureVMSuitabilityExplanationInternalErrorOccurredDuringComputeEvaluation AzureVMSuitabilityExplanation = "InternalErrorOccurredDuringComputeEvaluation" - AzureVMSuitabilityExplanationInternalErrorOccurredDuringNetworkEvaluation AzureVMSuitabilityExplanation = "InternalErrorOccurredDuringNetworkEvaluation" - AzureVMSuitabilityExplanationInternalErrorOccurredDuringStorageEvaluation AzureVMSuitabilityExplanation = "InternalErrorOccurredDuringStorageEvaluation" - AzureVMSuitabilityExplanationMoreDisksThanSupported AzureVMSuitabilityExplanation = "MoreDisksThanSupported" - AzureVMSuitabilityExplanationNoGuestOperatingSystemConditionallySupported AzureVMSuitabilityExplanation = "NoGuestOperatingSystemConditionallySupported" - AzureVMSuitabilityExplanationNoSuitableVMSizeFound AzureVMSuitabilityExplanation = "NoSuitableVmSizeFound" - AzureVMSuitabilityExplanationNoVMSizeForBasicPricingTier AzureVMSuitabilityExplanation = "NoVmSizeForBasicPricingTier" - AzureVMSuitabilityExplanationNoVMSizeForSelectedAzureLocation AzureVMSuitabilityExplanation = "NoVmSizeForSelectedAzureLocation" - AzureVMSuitabilityExplanationNoVMSizeForSelectedPricingTier AzureVMSuitabilityExplanation = "NoVmSizeForSelectedPricingTier" - AzureVMSuitabilityExplanationNoVMSizeForStandardPricingTier AzureVMSuitabilityExplanation = "NoVmSizeForStandardPricingTier" - AzureVMSuitabilityExplanationNoVMSizeSupportsNetworkPerformance AzureVMSuitabilityExplanation = "NoVmSizeSupportsNetworkPerformance" - AzureVMSuitabilityExplanationNoVMSizeSupportsStoragePerformance AzureVMSuitabilityExplanation = "NoVmSizeSupportsStoragePerformance" - AzureVMSuitabilityExplanationNotApplicable AzureVMSuitabilityExplanation = "NotApplicable" - AzureVMSuitabilityExplanationOneOrMoreAdaptersNotSuitable AzureVMSuitabilityExplanation = "OneOrMoreAdaptersNotSuitable" - AzureVMSuitabilityExplanationOneOrMoreDisksNotSuitable AzureVMSuitabilityExplanation = "OneOrMoreDisksNotSuitable" - AzureVMSuitabilityExplanationUnendorsedLinuxDistributions AzureVMSuitabilityExplanation = "UnendorsedLinuxDistributions" - AzureVMSuitabilityExplanationUnknown AzureVMSuitabilityExplanation = "Unknown" - AzureVMSuitabilityExplanationWindowsClientVersionsConditionallySupported AzureVMSuitabilityExplanation = "WindowsClientVersionsConditionallySupported" - AzureVMSuitabilityExplanationWindowsOSNoLongerUnderMSSupport AzureVMSuitabilityExplanation = "WindowsOSNoLongerUnderMSSupport" - AzureVMSuitabilityExplanationWindowsServerVersionConditionallySupported AzureVMSuitabilityExplanation = "WindowsServerVersionConditionallySupported" - AzureVMSuitabilityExplanationWindowsServerVersionsSupportedWithCaveat AzureVMSuitabilityExplanation = "WindowsServerVersionsSupportedWithCaveat" + // CloudSuitabilityCommonConditionallySuitable - ConditionallySuitable - Cloud Suitability Common + CloudSuitabilityCommonConditionallySuitable CloudSuitabilityCommon = "ConditionallySuitable" + // CloudSuitabilityCommonNotSuitable - NotSuitable - Cloud Suitability Common + CloudSuitabilityCommonNotSuitable CloudSuitabilityCommon = "NotSuitable" + // CloudSuitabilityCommonReadinessUnknown - ReadinessUnknown - Cloud Suitability Common + CloudSuitabilityCommonReadinessUnknown CloudSuitabilityCommon = "ReadinessUnknown" + // CloudSuitabilityCommonSuitable - Suitable - Cloud Suitability Common + CloudSuitabilityCommonSuitable CloudSuitabilityCommon = "Suitable" + // CloudSuitabilityCommonSuitableWithWarnings - SuitableWithWarnings - Cloud Suitability Common + CloudSuitabilityCommonSuitableWithWarnings CloudSuitabilityCommon = "SuitableWithWarnings" + // CloudSuitabilityCommonUnknown - Unknown - Cloud Suitability Common + CloudSuitabilityCommonUnknown CloudSuitabilityCommon = "Unknown" ) -// PossibleAzureVMSuitabilityExplanationValues returns the possible values for the AzureVMSuitabilityExplanation const type. -func PossibleAzureVMSuitabilityExplanationValues() []AzureVMSuitabilityExplanation { - return []AzureVMSuitabilityExplanation{ - AzureVMSuitabilityExplanationBootTypeNotSupported, - AzureVMSuitabilityExplanationBootTypeUnknown, - AzureVMSuitabilityExplanationCheckCentOsVersion, - AzureVMSuitabilityExplanationCheckCoreOsLinuxVersion, - AzureVMSuitabilityExplanationCheckDebianLinuxVersion, - AzureVMSuitabilityExplanationCheckOpenSuseLinuxVersion, - AzureVMSuitabilityExplanationCheckOracleLinuxVersion, - AzureVMSuitabilityExplanationCheckRedHatLinuxVersion, - AzureVMSuitabilityExplanationCheckSuseLinuxVersion, - AzureVMSuitabilityExplanationCheckUbuntuLinuxVersion, - AzureVMSuitabilityExplanationCheckWindowsServer2008R2Version, - AzureVMSuitabilityExplanationEndorsedWithConditionsLinuxDistributions, - AzureVMSuitabilityExplanationGuestOperatingSystemArchitectureNotSupported, - AzureVMSuitabilityExplanationGuestOperatingSystemNotSupported, - AzureVMSuitabilityExplanationGuestOperatingSystemUnknown, - AzureVMSuitabilityExplanationInternalErrorOccurredDuringComputeEvaluation, - AzureVMSuitabilityExplanationInternalErrorOccurredDuringNetworkEvaluation, - AzureVMSuitabilityExplanationInternalErrorOccurredDuringStorageEvaluation, - AzureVMSuitabilityExplanationMoreDisksThanSupported, - AzureVMSuitabilityExplanationNoGuestOperatingSystemConditionallySupported, - AzureVMSuitabilityExplanationNoSuitableVMSizeFound, - AzureVMSuitabilityExplanationNoVMSizeForBasicPricingTier, - AzureVMSuitabilityExplanationNoVMSizeForSelectedAzureLocation, - AzureVMSuitabilityExplanationNoVMSizeForSelectedPricingTier, - AzureVMSuitabilityExplanationNoVMSizeForStandardPricingTier, - AzureVMSuitabilityExplanationNoVMSizeSupportsNetworkPerformance, - AzureVMSuitabilityExplanationNoVMSizeSupportsStoragePerformance, - AzureVMSuitabilityExplanationNotApplicable, - AzureVMSuitabilityExplanationOneOrMoreAdaptersNotSuitable, - AzureVMSuitabilityExplanationOneOrMoreDisksNotSuitable, - AzureVMSuitabilityExplanationUnendorsedLinuxDistributions, - AzureVMSuitabilityExplanationUnknown, - AzureVMSuitabilityExplanationWindowsClientVersionsConditionallySupported, - AzureVMSuitabilityExplanationWindowsOSNoLongerUnderMSSupport, - AzureVMSuitabilityExplanationWindowsServerVersionConditionallySupported, - AzureVMSuitabilityExplanationWindowsServerVersionsSupportedWithCaveat, +// PossibleCloudSuitabilityCommonValues returns the possible values for the CloudSuitabilityCommon const type. +func PossibleCloudSuitabilityCommonValues() []CloudSuitabilityCommon { + return []CloudSuitabilityCommon{ + CloudSuitabilityCommonConditionallySuitable, + CloudSuitabilityCommonNotSuitable, + CloudSuitabilityCommonReadinessUnknown, + CloudSuitabilityCommonSuitable, + CloudSuitabilityCommonSuitableWithWarnings, + CloudSuitabilityCommonUnknown, } } -// CloudSuitability - Whether this disk is suitable for Azure. -type CloudSuitability string +// CostType - Cost type +type CostType string const ( - CloudSuitabilityConditionallySuitable CloudSuitability = "ConditionallySuitable" - CloudSuitabilityNotSuitable CloudSuitability = "NotSuitable" - CloudSuitabilityReadinessUnknown CloudSuitability = "ReadinessUnknown" - CloudSuitabilitySuitable CloudSuitability = "Suitable" - CloudSuitabilityUnknown CloudSuitability = "Unknown" + // CostTypeDataProtectionService - DataProtectionService - Cost type + CostTypeDataProtectionService CostType = "DataProtectionService" + // CostTypeMonitoringService - MonitoringService - Cost type + CostTypeMonitoringService CostType = "MonitoringService" + // CostTypeMonthlyAvsExternalStorageCost - MonthlyAvsExternalStorageCost - Cost type + CostTypeMonthlyAvsExternalStorageCost CostType = "MonthlyAvsExternalStorageCost" + // CostTypeMonthlyAvsNetworkCost - MonthlyAvsNetworkCost - Cost type + CostTypeMonthlyAvsNetworkCost CostType = "MonthlyAvsNetworkCost" + // CostTypeMonthlyAvsNodeCost - MonthlyAvsNodeCost - Cost type + CostTypeMonthlyAvsNodeCost CostType = "MonthlyAvsNodeCost" + // CostTypeMonthlyAzureHybridCost - MonthlyAzureHybridCost - Cost type + CostTypeMonthlyAzureHybridCost CostType = "MonthlyAzureHybridCost" + // CostTypeMonthlyBandwidthCost - MonthlyBandwidthCost - Cost type + CostTypeMonthlyBandwidthCost CostType = "MonthlyBandwidthCost" + // CostTypeMonthlyComputeCost - MonthlyComputeCost - Cost type + CostTypeMonthlyComputeCost CostType = "MonthlyComputeCost" + // CostTypeMonthlyLicensingCost - MonthlyLicensingCost - Cost type + CostTypeMonthlyLicensingCost CostType = "MonthlyLicensingCost" + // CostTypeMonthlyLinuxAzureHybridCost - MonthlyLinuxAzureHybridCost - Cost type + CostTypeMonthlyLinuxAzureHybridCost CostType = "MonthlyLinuxAzureHybridCost" + // CostTypeMonthlyManagementCost - MonthlyManagementCost - Cost type + CostTypeMonthlyManagementCost CostType = "MonthlyManagementCost" + // CostTypeMonthlyPremiumStorageCost - MonthlyPremiumStorageCost - Cost type + CostTypeMonthlyPremiumStorageCost CostType = "MonthlyPremiumStorageCost" + // CostTypeMonthlyPremiumV2StorageCost - MonthlyPremiumV2StorageCost - Cost type + CostTypeMonthlyPremiumV2StorageCost CostType = "MonthlyPremiumV2StorageCost" + // CostTypeMonthlySecurityCost - MonthlySecurityCost - Cost type + CostTypeMonthlySecurityCost CostType = "MonthlySecurityCost" + // CostTypeMonthlyStandardHddStorageCost - MonthlyStandardHddStorageCost - Cost type + CostTypeMonthlyStandardHddStorageCost CostType = "MonthlyStandardHddStorageCost" + // CostTypeMonthlyStandardSsdStorageCost - MonthlyStandardSsdStorageCost - Cost type + CostTypeMonthlyStandardSsdStorageCost CostType = "MonthlyStandardSsdStorageCost" + // CostTypeMonthlyStorageCost - MonthlyStorageCost - Cost type + CostTypeMonthlyStorageCost CostType = "MonthlyStorageCost" + // CostTypeMonthlyUltraDiskCost - MonthlyUltraDiskCost - Cost type + CostTypeMonthlyUltraDiskCost CostType = "MonthlyUltraDiskCost" + // CostTypeMonthlyUltraStorageCost - MonthlyUltraStorageCost - Cost type + CostTypeMonthlyUltraStorageCost CostType = "MonthlyUltraStorageCost" + // CostTypePatchingService - PatchingService - Cost type + CostTypePatchingService CostType = "PatchingService" + // CostTypeTotalMonthlyCost - TotalMonthlyCost - Cost type + CostTypeTotalMonthlyCost CostType = "TotalMonthlyCost" ) -// PossibleCloudSuitabilityValues returns the possible values for the CloudSuitability const type. -func PossibleCloudSuitabilityValues() []CloudSuitability { - return []CloudSuitability{ - CloudSuitabilityConditionallySuitable, - CloudSuitabilityNotSuitable, - CloudSuitabilityReadinessUnknown, - CloudSuitabilitySuitable, - CloudSuitabilityUnknown, +// PossibleCostTypeValues returns the possible values for the CostType const type. +func PossibleCostTypeValues() []CostType { + return []CostType{ + CostTypeDataProtectionService, + CostTypeMonitoringService, + CostTypeMonthlyAvsExternalStorageCost, + CostTypeMonthlyAvsNetworkCost, + CostTypeMonthlyAvsNodeCost, + CostTypeMonthlyAzureHybridCost, + CostTypeMonthlyBandwidthCost, + CostTypeMonthlyComputeCost, + CostTypeMonthlyLicensingCost, + CostTypeMonthlyLinuxAzureHybridCost, + CostTypeMonthlyManagementCost, + CostTypeMonthlyPremiumStorageCost, + CostTypeMonthlyPremiumV2StorageCost, + CostTypeMonthlySecurityCost, + CostTypeMonthlyStandardHddStorageCost, + CostTypeMonthlyStandardSsdStorageCost, + CostTypeMonthlyStorageCost, + CostTypeMonthlyUltraDiskCost, + CostTypeMonthlyUltraStorageCost, + CostTypePatchingService, + CostTypeTotalMonthlyCost, } } -// Currency - Currency to report prices in. -type Currency string +// CreatedByType - The kind of entity that created the resource. +type CreatedByType string const ( - CurrencyARS Currency = "ARS" - CurrencyAUD Currency = "AUD" - CurrencyBRL Currency = "BRL" - CurrencyCAD Currency = "CAD" - CurrencyCHF Currency = "CHF" - CurrencyCNY Currency = "CNY" - CurrencyDKK Currency = "DKK" - CurrencyEUR Currency = "EUR" - CurrencyGBP Currency = "GBP" - CurrencyHKD Currency = "HKD" - CurrencyIDR Currency = "IDR" - CurrencyINR Currency = "INR" - CurrencyJPY Currency = "JPY" - CurrencyKRW Currency = "KRW" - CurrencyMXN Currency = "MXN" - CurrencyMYR Currency = "MYR" - CurrencyNOK Currency = "NOK" - CurrencyNZD Currency = "NZD" - CurrencyRUB Currency = "RUB" - CurrencySAR Currency = "SAR" - CurrencySEK Currency = "SEK" - CurrencyTRY Currency = "TRY" - CurrencyTWD Currency = "TWD" - CurrencyUSD Currency = "USD" - CurrencyUnknown Currency = "Unknown" - CurrencyZAR Currency = "ZAR" + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" ) -// PossibleCurrencyValues returns the possible values for the Currency const type. -func PossibleCurrencyValues() []Currency { - return []Currency{ - CurrencyARS, - CurrencyAUD, - CurrencyBRL, - CurrencyCAD, - CurrencyCHF, - CurrencyCNY, - CurrencyDKK, - CurrencyEUR, - CurrencyGBP, - CurrencyHKD, - CurrencyIDR, - CurrencyINR, - CurrencyJPY, - CurrencyKRW, - CurrencyMXN, - CurrencyMYR, - CurrencyNOK, - CurrencyNZD, - CurrencyRUB, - CurrencySAR, - CurrencySEK, - CurrencyTRY, - CurrencyTWD, - CurrencyUSD, - CurrencyUnknown, - CurrencyZAR, +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, } } -// GroupStatus - Whether the group has been created and is valid. -type GroupStatus string +// EnvironmentType - Environment Type +type EnvironmentType string const ( - GroupStatusCompleted GroupStatus = "Completed" - GroupStatusCreated GroupStatus = "Created" - GroupStatusInvalid GroupStatus = "Invalid" - GroupStatusRunning GroupStatus = "Running" - GroupStatusUpdated GroupStatus = "Updated" + // EnvironmentTypeDevTest - DevTest - Environment Type + EnvironmentTypeDevTest EnvironmentType = "DevTest" + // EnvironmentTypeProduction - Production - Environment Type + EnvironmentTypeProduction EnvironmentType = "Production" + // EnvironmentTypeUnknown - Unknown - Environment Type + EnvironmentTypeUnknown EnvironmentType = "Unknown" ) -// PossibleGroupStatusValues returns the possible values for the GroupStatus const type. -func PossibleGroupStatusValues() []GroupStatus { - return []GroupStatus{ - GroupStatusCompleted, - GroupStatusCreated, - GroupStatusInvalid, - GroupStatusRunning, - GroupStatusUpdated, +// PossibleEnvironmentTypeValues returns the possible values for the EnvironmentType const type. +func PossibleEnvironmentTypeValues() []EnvironmentType { + return []EnvironmentType{ + EnvironmentTypeDevTest, + EnvironmentTypeProduction, + EnvironmentTypeUnknown, } } -// GroupUpdateOperation - Whether to add or remove the machines. -type GroupUpdateOperation string +// GuestOperatingSystemArchitecture - Guest operating system architecture +type GuestOperatingSystemArchitecture string const ( - GroupUpdateOperationAdd GroupUpdateOperation = "Add" - GroupUpdateOperationRemove GroupUpdateOperation = "Remove" + // GuestOperatingSystemArchitectureUnknown - Unknown - Guest operating system architecture + GuestOperatingSystemArchitectureUnknown GuestOperatingSystemArchitecture = "Unknown" + // GuestOperatingSystemArchitectureX64 - X64 - Guest operating system architecture + GuestOperatingSystemArchitectureX64 GuestOperatingSystemArchitecture = "X64" + // GuestOperatingSystemArchitectureX86 - X86 - Guest operating system architecture + GuestOperatingSystemArchitectureX86 GuestOperatingSystemArchitecture = "X86" ) -// PossibleGroupUpdateOperationValues returns the possible values for the GroupUpdateOperation const type. -func PossibleGroupUpdateOperationValues() []GroupUpdateOperation { - return []GroupUpdateOperation{ - GroupUpdateOperationAdd, - GroupUpdateOperationRemove, +// PossibleGuestOperatingSystemArchitectureValues returns the possible values for the GuestOperatingSystemArchitecture const type. +func PossibleGuestOperatingSystemArchitectureValues() []GuestOperatingSystemArchitecture { + return []GuestOperatingSystemArchitecture{ + GuestOperatingSystemArchitectureUnknown, + GuestOperatingSystemArchitectureX64, + GuestOperatingSystemArchitectureX86, } } -// MachineBootType - Boot type of the machine. +// LicensingProgram - The licensing program. +type LicensingProgram string + +const ( + // LicensingProgramEA - Enterprise agreement. + LicensingProgramEA LicensingProgram = "EA" + // LicensingProgramMCA - Microsoft customer agreement. + LicensingProgramMCA LicensingProgram = "MCA" + // LicensingProgramRetail - Retail/Pay as you go. + LicensingProgramRetail LicensingProgram = "Retail" + // LicensingProgramUnknown - Not known + LicensingProgramUnknown LicensingProgram = "Unknown" +) + +// PossibleLicensingProgramValues returns the possible values for the LicensingProgram const type. +func PossibleLicensingProgramValues() []LicensingProgram { + return []LicensingProgram{ + LicensingProgramEA, + LicensingProgramMCA, + LicensingProgramRetail, + LicensingProgramUnknown, + } +} + +// LinkageKind - Linkage kind +type LinkageKind string + +const ( + // LinkageKindDatabase - Database - Linkage kind + LinkageKindDatabase LinkageKind = "Database" + // LinkageKindInstance - Instance - Linkage kind + LinkageKindInstance LinkageKind = "Instance" + // LinkageKindMachine - Machine - Linkage kind + LinkageKindMachine LinkageKind = "Machine" + // LinkageKindServer - Server - Linkage kind + LinkageKindServer LinkageKind = "Server" + // LinkageKindUnknown - Unknown - Linkage kind + LinkageKindUnknown LinkageKind = "Unknown" + // LinkageKindWebApplication - WebApplication - Linkage kind + LinkageKindWebApplication LinkageKind = "WebApplication" + // LinkageKindWebServer - WebServer - Linkage kind + LinkageKindWebServer LinkageKind = "WebServer" +) + +// PossibleLinkageKindValues returns the possible values for the LinkageKind const type. +func PossibleLinkageKindValues() []LinkageKind { + return []LinkageKind{ + LinkageKindDatabase, + LinkageKindInstance, + LinkageKindMachine, + LinkageKindServer, + LinkageKindUnknown, + LinkageKindWebApplication, + LinkageKindWebServer, + } +} + +// LinkageType - Linkage type +type LinkageType string + +const ( + // LinkageTypeParent - Parent - Linkage type + LinkageTypeParent LinkageType = "Parent" + // LinkageTypeSource - Source - Linkage type + LinkageTypeSource LinkageType = "Source" +) + +// PossibleLinkageTypeValues returns the possible values for the LinkageType const type. +func PossibleLinkageTypeValues() []LinkageType { + return []LinkageType{ + LinkageTypeParent, + LinkageTypeSource, + } +} + +// MachineBootType - Machine Boot Type type MachineBootType string const ( - MachineBootTypeBIOS MachineBootType = "BIOS" - MachineBootTypeEFI MachineBootType = "EFI" + // MachineBootTypeBios - BIOS - Machine Boot Type + MachineBootTypeBios MachineBootType = "BIOS" + // MachineBootTypeEFI - EFI - Machine Boot Type + MachineBootTypeEFI MachineBootType = "EFI" + // MachineBootTypeNotSpecified - NotSpecified - Machine Boot Type + MachineBootTypeNotSpecified MachineBootType = "NotSpecified" + // MachineBootTypeUnknown - Unknown - Machine Boot Type MachineBootTypeUnknown MachineBootType = "Unknown" ) // PossibleMachineBootTypeValues returns the possible values for the MachineBootType const type. func PossibleMachineBootTypeValues() []MachineBootType { return []MachineBootType{ - MachineBootTypeBIOS, + MachineBootTypeBios, MachineBootTypeEFI, + MachineBootTypeNotSpecified, MachineBootTypeUnknown, } } -// Percentile - Percentile of performance data used to recommend Azure size. +// MigrationIssuesCategory - Migration Issues Category +type MigrationIssuesCategory string + +const ( + // MigrationIssuesCategoryInternal - Internal - Migration Issues Category + MigrationIssuesCategoryInternal MigrationIssuesCategory = "Internal" + // MigrationIssuesCategoryIssue - Issue - Migration Issues Category + MigrationIssuesCategoryIssue MigrationIssuesCategory = "Issue" + // MigrationIssuesCategoryWarning - Warning - Migration Issues Category + MigrationIssuesCategoryWarning MigrationIssuesCategory = "Warning" +) + +// PossibleMigrationIssuesCategoryValues returns the possible values for the MigrationIssuesCategory const type. +func PossibleMigrationIssuesCategoryValues() []MigrationIssuesCategory { + return []MigrationIssuesCategory{ + MigrationIssuesCategoryInternal, + MigrationIssuesCategoryIssue, + MigrationIssuesCategoryWarning, + } +} + +// MigrationPlatform - Migration Platform +type MigrationPlatform string + +const ( + // MigrationPlatformIaaS - IaaS - Migration Platform + MigrationPlatformIaaS MigrationPlatform = "IaaS" + // MigrationPlatformPaaS - PaaS - Migration Platform + MigrationPlatformPaaS MigrationPlatform = "PaaS" + // MigrationPlatformSaaS - SaaS - Migration Platform + MigrationPlatformSaaS MigrationPlatform = "SaaS" + // MigrationPlatformUnknown - Unknown - Migration Platform + MigrationPlatformUnknown MigrationPlatform = "Unknown" +) + +// PossibleMigrationPlatformValues returns the possible values for the MigrationPlatform const type. +func PossibleMigrationPlatformValues() []MigrationPlatform { + return []MigrationPlatform{ + MigrationPlatformIaaS, + MigrationPlatformPaaS, + MigrationPlatformSaaS, + MigrationPlatformUnknown, + } +} + +// MigrationType - Migration Type +type MigrationType string + +const ( + // MigrationTypeRearchitect - Rearchitect - Migration Type + MigrationTypeRearchitect MigrationType = "Rearchitect" + // MigrationTypeRehost - Rehost - Migration Type + MigrationTypeRehost MigrationType = "Rehost" + // MigrationTypeReplatform - Replatform - Migration Type + MigrationTypeReplatform MigrationType = "Replatform" + // MigrationTypeRetain - Retain - Migration Type + MigrationTypeRetain MigrationType = "Retain" + // MigrationTypeUnknown - Unknown - Migration Type + MigrationTypeUnknown MigrationType = "Unknown" +) + +// PossibleMigrationTypeValues returns the possible values for the MigrationType const type. +func PossibleMigrationTypeValues() []MigrationType { + return []MigrationType{ + MigrationTypeRearchitect, + MigrationTypeRehost, + MigrationTypeReplatform, + MigrationTypeRetain, + MigrationTypeUnknown, + } +} + +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + // OriginSystem - Indicates the operation is initiated by a system. + OriginSystem Origin = "system" + // OriginUser - Indicates the operation is initiated by a user. + OriginUser Origin = "user" + // OriginUserSystem - Indicates the operation is initiated by a user or system. + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// Percentile - Percentile for Performance Data. type Percentile string const ( + // PercentilePercentile50 - Percentile 50. PercentilePercentile50 Percentile = "Percentile50" + // PercentilePercentile90 - Percentile 90. PercentilePercentile90 Percentile = "Percentile90" + // PercentilePercentile95 - Percentile 95. PercentilePercentile95 Percentile = "Percentile95" + // PercentilePercentile99 - Percentile 99. PercentilePercentile99 Percentile = "Percentile99" + // PercentilePercentileUnknown - Percentile unknown. + PercentilePercentileUnknown Percentile = "PercentileUnknown" ) // PossiblePercentileValues returns the possible values for the Percentile const type. @@ -1108,115 +1370,235 @@ func PossiblePercentileValues() []Percentile { PercentilePercentile90, PercentilePercentile95, PercentilePercentile99, + PercentilePercentileUnknown, + } +} + +// PremiumDiskSupport - Premium Disk Support +type PremiumDiskSupport string + +const ( + // PremiumDiskSupportPremiumDiskNotSupported - Premium Disk Not Supported + PremiumDiskSupportPremiumDiskNotSupported PremiumDiskSupport = "PremiumDiskNotSupported" + // PremiumDiskSupportPremiumDiskSupported - Premium Disk Supported + PremiumDiskSupportPremiumDiskSupported PremiumDiskSupport = "PremiumDiskSupported" +) + +// PossiblePremiumDiskSupportValues returns the possible values for the PremiumDiskSupport const type. +func PossiblePremiumDiskSupportValues() []PremiumDiskSupport { + return []PremiumDiskSupport{ + PremiumDiskSupportPremiumDiskNotSupported, + PremiumDiskSupportPremiumDiskSupported, } } -// PrivateEndpointConnectionPropertiesProvisioningState - Indicates whether there is an ongoing operation on the private endpoint. -type PrivateEndpointConnectionPropertiesProvisioningState string +// ProvisioningState - The status of the current operation. +type ProvisioningState string const ( - PrivateEndpointConnectionPropertiesProvisioningStateAccepted PrivateEndpointConnectionPropertiesProvisioningState = "Accepted" - PrivateEndpointConnectionPropertiesProvisioningStateFailed PrivateEndpointConnectionPropertiesProvisioningState = "Failed" - PrivateEndpointConnectionPropertiesProvisioningStateInProgress PrivateEndpointConnectionPropertiesProvisioningState = "InProgress" - PrivateEndpointConnectionPropertiesProvisioningStateSucceeded PrivateEndpointConnectionPropertiesProvisioningState = "Succeeded" + // ProvisioningStateAccepted - Resource is being Accepted. + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled - Resource provisioning Canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting - Resource is being Deleted. + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource provisioning Failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateProvisioning - Resource is being Provisioned. + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + // ProvisioningStateSucceeded - Resource provisioning Successful. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - Resource is being Updated. + ProvisioningStateUpdating ProvisioningState = "Updating" ) -// PossiblePrivateEndpointConnectionPropertiesProvisioningStateValues returns the possible values for the PrivateEndpointConnectionPropertiesProvisioningState const type. -func PossiblePrivateEndpointConnectionPropertiesProvisioningStateValues() []PrivateEndpointConnectionPropertiesProvisioningState { - return []PrivateEndpointConnectionPropertiesProvisioningState{ - PrivateEndpointConnectionPropertiesProvisioningStateAccepted, - PrivateEndpointConnectionPropertiesProvisioningStateFailed, - PrivateEndpointConnectionPropertiesProvisioningStateInProgress, - PrivateEndpointConnectionPropertiesProvisioningStateSucceeded, +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateProvisioning, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, } } -// PrivateLinkServiceConnectionStateStatus - Connection status of the private endpoint connection. -type PrivateLinkServiceConnectionStateStatus string +// SKUKind - Sku Kind +type SKUKind string const ( - PrivateLinkServiceConnectionStateStatusApproved PrivateLinkServiceConnectionStateStatus = "Approved" - PrivateLinkServiceConnectionStateStatusDisconnected PrivateLinkServiceConnectionStateStatus = "Disconnected" - PrivateLinkServiceConnectionStateStatusPending PrivateLinkServiceConnectionStateStatus = "Pending" - PrivateLinkServiceConnectionStateStatusRejected PrivateLinkServiceConnectionStateStatus = "Rejected" + // SKUKindDetails - Details - Sku Kind + SKUKindDetails SKUKind = "Details" + // SKUKindEndpoint - Endpoint - Sku Kind + SKUKindEndpoint SKUKind = "Endpoint" ) -// PossiblePrivateLinkServiceConnectionStateStatusValues returns the possible values for the PrivateLinkServiceConnectionStateStatus const type. -func PossiblePrivateLinkServiceConnectionStateStatusValues() []PrivateLinkServiceConnectionStateStatus { - return []PrivateLinkServiceConnectionStateStatus{ - PrivateLinkServiceConnectionStateStatusApproved, - PrivateLinkServiceConnectionStateStatusDisconnected, - PrivateLinkServiceConnectionStateStatusPending, - PrivateLinkServiceConnectionStateStatusRejected, +// PossibleSKUKindValues returns the possible values for the SKUKind const type. +func PossibleSKUKindValues() []SKUKind { + return []SKUKind{ + SKUKindDetails, + SKUKindEndpoint, } } -// ProjectStatus - Assessment project status. -type ProjectStatus string +// SKUType - Sku type +type SKUType string const ( - ProjectStatusActive ProjectStatus = "Active" - ProjectStatusInactive ProjectStatus = "Inactive" + // SKUTypeAppServicePlan - AppServicePlan - Sku type + SKUTypeAppServicePlan SKUType = "AppServicePlan" + // SKUTypeAzureSpringApps - AzureSpringApps - Sku type + SKUTypeAzureSpringApps SKUType = "AzureSpringApps" + // SKUTypeCompute - Compute - Sku type + SKUTypeCompute SKUType = "Compute" + // SKUTypeNetwork - Network - Sku type + SKUTypeNetwork SKUType = "Network" + // SKUTypeStorage - Storage - Sku type + SKUTypeStorage SKUType = "Storage" + // SKUTypeUnknown - Unknown - Sku type + SKUTypeUnknown SKUType = "Unknown" ) -// PossibleProjectStatusValues returns the possible values for the ProjectStatus const type. -func PossibleProjectStatusValues() []ProjectStatus { - return []ProjectStatus{ - ProjectStatusActive, - ProjectStatusInactive, +// PossibleSKUTypeValues returns the possible values for the SKUType const type. +func PossibleSKUTypeValues() []SKUType { + return []SKUType{ + SKUTypeAppServicePlan, + SKUTypeAzureSpringApps, + SKUTypeCompute, + SKUTypeNetwork, + SKUTypeStorage, + SKUTypeUnknown, } } -// ProvisioningState - Provisioning state of the project. -type ProvisioningState string +// SavingsOptions - The savings options. +type SavingsOptions string const ( - ProvisioningStateAccepted ProvisioningState = "Accepted" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateMoving ProvisioningState = "Moving" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // SavingsOptionsCustomAzureOfferCode - Custom azure offer code. + SavingsOptionsCustomAzureOfferCode SavingsOptions = "CustomAzureOfferCode" + // SavingsOptionsNone - No savings options. + SavingsOptionsNone SavingsOptions = "None" + // SavingsOptionsRI1Year - Reserved Instance for 1 year. + SavingsOptionsRI1Year SavingsOptions = "RI1Year" + // SavingsOptionsRI3Year - Reserved Instance for 3 years. + SavingsOptionsRI3Year SavingsOptions = "RI3Year" + // SavingsOptionsSavingsPlan1Year - The savings plan for 1 year. + SavingsOptionsSavingsPlan1Year SavingsOptions = "SavingsPlan1Year" + // SavingsOptionsSavingsPlan3Year - The savings plan for 3 years. + SavingsOptionsSavingsPlan3Year SavingsOptions = "SavingsPlan3Year" ) -// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ - ProvisioningStateAccepted, - ProvisioningStateCreating, - ProvisioningStateDeleting, - ProvisioningStateFailed, - ProvisioningStateMoving, - ProvisioningStateSucceeded, +// PossibleSavingsOptionsValues returns the possible values for the SavingsOptions const type. +func PossibleSavingsOptionsValues() []SavingsOptions { + return []SavingsOptions{ + SavingsOptionsCustomAzureOfferCode, + SavingsOptionsNone, + SavingsOptionsRI1Year, + SavingsOptionsRI3Year, + SavingsOptionsSavingsPlan1Year, + SavingsOptionsSavingsPlan3Year, } } -// ReservedInstance - Azure reserved instance. -type ReservedInstance string +// SavingsType - Savings type +type SavingsType string const ( - ReservedInstanceNone ReservedInstance = "None" - ReservedInstanceRI1Year ReservedInstance = "RI1Year" - ReservedInstanceRI3Year ReservedInstance = "RI3Year" + // SavingsTypeMonthlyAhubSQLCostSavings - MonthlyAhubSqlCostSavings - Savings type + SavingsTypeMonthlyAhubSQLCostSavings SavingsType = "MonthlyAhubSqlCostSavings" + // SavingsTypeMonthlyAzureHybridCostSavings - MonthlyAzureHybridCostSavings - Savings type + SavingsTypeMonthlyAzureHybridCostSavings SavingsType = "MonthlyAzureHybridCostSavings" + // SavingsTypeMonthlyLinuxAzureHybridCostSavings - MonthlyLinuxAzureHybridCostSavings - Savings type + SavingsTypeMonthlyLinuxAzureHybridCostSavings SavingsType = "MonthlyLinuxAzureHybridCostSavings" + // SavingsTypeMonthlyVcfByolCostDifference - MonthlyVcfByolCostDifference - Savings type + SavingsTypeMonthlyVcfByolCostDifference SavingsType = "MonthlyVcfByolCostDifference" ) -// PossibleReservedInstanceValues returns the possible values for the ReservedInstance const type. -func PossibleReservedInstanceValues() []ReservedInstance { - return []ReservedInstance{ - ReservedInstanceNone, - ReservedInstanceRI1Year, - ReservedInstanceRI3Year, +// PossibleSavingsTypeValues returns the possible values for the SavingsType const type. +func PossibleSavingsTypeValues() []SavingsType { + return []SavingsType{ + SavingsTypeMonthlyAhubSQLCostSavings, + SavingsTypeMonthlyAzureHybridCostSavings, + SavingsTypeMonthlyLinuxAzureHybridCostSavings, + SavingsTypeMonthlyVcfByolCostDifference, } } -// TimeRange - Time range of performance data used to recommend a size. +// ScopeType - Scope type +type ScopeType string + +const ( + // ScopeTypeAzureResourceGraphQuery - AzureResourceGraphQuery - Scope type + ScopeTypeAzureResourceGraphQuery ScopeType = "AzureResourceGraphQuery" + // ScopeTypeServerGroupID - ServerGroupId - Scope type + ScopeTypeServerGroupID ScopeType = "ServerGroupId" +) + +// PossibleScopeTypeValues returns the possible values for the ScopeType const type. +func PossibleScopeTypeValues() []ScopeType { + return []ScopeType{ + ScopeTypeAzureResourceGraphQuery, + ScopeTypeServerGroupID, + } +} + +// StrategyType - Strategy type +type StrategyType string + +const ( + // StrategyTypeCostOptimized - CostOptimized - Strategy type + StrategyTypeCostOptimized StrategyType = "CostOptimized" + // StrategyTypeEffortOptimized - EffortOptimized - Strategy type + StrategyTypeEffortOptimized StrategyType = "EffortOptimized" + // StrategyTypePaaSPreferred - PaaSPreferred - Strategy type + StrategyTypePaaSPreferred StrategyType = "PaaSPreferred" +) + +// PossibleStrategyTypeValues returns the possible values for the StrategyType const type. +func PossibleStrategyTypeValues() []StrategyType { + return []StrategyType{ + StrategyTypeCostOptimized, + StrategyTypeEffortOptimized, + StrategyTypePaaSPreferred, + } +} + +// SummaryType - Summary Type +type SummaryType string + +const ( + // SummaryTypeStrategy - Strategy - Summary Type + SummaryTypeStrategy SummaryType = "Strategy" + // SummaryTypeTarget - Target - Summary Type + SummaryTypeTarget SummaryType = "Target" + // SummaryTypeUnknown - Unknown - Summary Type + SummaryTypeUnknown SummaryType = "Unknown" +) + +// PossibleSummaryTypeValues returns the possible values for the SummaryType const type. +func PossibleSummaryTypeValues() []SummaryType { + return []SummaryType{ + SummaryTypeStrategy, + SummaryTypeTarget, + SummaryTypeUnknown, + } +} + +// TimeRange - Time Range for Performance Data. type TimeRange string const ( + // TimeRangeCustom - Custom Time Range. TimeRangeCustom TimeRange = "Custom" - TimeRangeDay TimeRange = "Day" - TimeRangeMonth TimeRange = "Month" - TimeRangeWeek TimeRange = "Week" + // TimeRangeDay - Daily. + TimeRangeDay TimeRange = "Day" + // TimeRangeMonth - Monthly. + TimeRangeMonth TimeRange = "Month" + // TimeRangeWeek - Weekly. + TimeRangeWeek TimeRange = "Week" ) // PossibleTimeRangeValues returns the possible values for the TimeRange const type. @@ -1228,3 +1610,102 @@ func PossibleTimeRangeValues() []TimeRange { TimeRangeWeek, } } + +// UltraDiskSupport - Ultra Disk Support +type UltraDiskSupport string + +const ( + // UltraDiskSupportUltraDiskNotSupported - Ultra Disk Not Supported + UltraDiskSupportUltraDiskNotSupported UltraDiskSupport = "UltraDiskNotSupported" + // UltraDiskSupportUltraDiskSupported - Ultra Disk Supported + UltraDiskSupportUltraDiskSupported UltraDiskSupport = "UltraDiskSupported" +) + +// PossibleUltraDiskSupportValues returns the possible values for the UltraDiskSupport const type. +func PossibleUltraDiskSupportValues() []UltraDiskSupport { + return []UltraDiskSupport{ + UltraDiskSupportUltraDiskNotSupported, + UltraDiskSupportUltraDiskSupported, + } +} + +// VMFamilyCategoryItem - Vm Family Category Item +type VMFamilyCategoryItem string + +const ( + // VMFamilyCategoryItemComputeOptimized - ComputeOptimized Vm Family Category Item + VMFamilyCategoryItemComputeOptimized VMFamilyCategoryItem = "ComputeOptimized" + // VMFamilyCategoryItemConfidential - Confidential Vm Family Category Item + VMFamilyCategoryItemConfidential VMFamilyCategoryItem = "Confidential" + // VMFamilyCategoryItemGeneralPurpose - GeneralPurpose Vm Family Category Item + VMFamilyCategoryItemGeneralPurpose VMFamilyCategoryItem = "GeneralPurpose" + // VMFamilyCategoryItemGpuOptimized - GpuOptimized Vm Family Category Item + VMFamilyCategoryItemGpuOptimized VMFamilyCategoryItem = "GpuOptimized" + // VMFamilyCategoryItemHighPerformanceCompute - HighPerformanceCompute Vm Family Category Item + VMFamilyCategoryItemHighPerformanceCompute VMFamilyCategoryItem = "HighPerformanceCompute" + // VMFamilyCategoryItemMemoryOptimized - MemoryOptimized Vm Family Category Item + VMFamilyCategoryItemMemoryOptimized VMFamilyCategoryItem = "MemoryOptimized" + // VMFamilyCategoryItemStorageOptimized - StorageOptimized Vm Family Category Item + VMFamilyCategoryItemStorageOptimized VMFamilyCategoryItem = "StorageOptimized" + // VMFamilyCategoryItemSupportsPremiumStorage - SupportsPremiumStorage Vm Family Category Item + VMFamilyCategoryItemSupportsPremiumStorage VMFamilyCategoryItem = "SupportsPremiumStorage" + // VMFamilyCategoryItemSupportsUltraDiskStorage - SupportsUltraDiskStorage Vm Family Category Item + VMFamilyCategoryItemSupportsUltraDiskStorage VMFamilyCategoryItem = "SupportsUltraDiskStorage" + // VMFamilyCategoryItemUnknown - Unknown - Vm Family Category Item + VMFamilyCategoryItemUnknown VMFamilyCategoryItem = "Unknown" +) + +// PossibleVMFamilyCategoryItemValues returns the possible values for the VMFamilyCategoryItem const type. +func PossibleVMFamilyCategoryItemValues() []VMFamilyCategoryItem { + return []VMFamilyCategoryItem{ + VMFamilyCategoryItemComputeOptimized, + VMFamilyCategoryItemConfidential, + VMFamilyCategoryItemGeneralPurpose, + VMFamilyCategoryItemGpuOptimized, + VMFamilyCategoryItemHighPerformanceCompute, + VMFamilyCategoryItemMemoryOptimized, + VMFamilyCategoryItemStorageOptimized, + VMFamilyCategoryItemSupportsPremiumStorage, + VMFamilyCategoryItemSupportsUltraDiskStorage, + VMFamilyCategoryItemUnknown, + } +} + +// WorkloadType - Migration Workload type +type WorkloadType string + +const ( + // WorkloadTypeDatabase - Database - Migration Workload type + WorkloadTypeDatabase WorkloadType = "Database" + // WorkloadTypeHost - Host - Migration Workload type + WorkloadTypeHost WorkloadType = "Host" + // WorkloadTypeInstance - Instance - Migration Workload type + WorkloadTypeInstance WorkloadType = "Instance" + // WorkloadTypeMachine - Machine - Migration Workload type + WorkloadTypeMachine WorkloadType = "Machine" + // WorkloadTypeManagementServer - ManagementServer - Migration Workload type + WorkloadTypeManagementServer WorkloadType = "ManagementServer" + // WorkloadTypeServer - Server - Migration Workload type + WorkloadTypeServer WorkloadType = "Server" + // WorkloadTypeUnknown - Unknown - Migration Workload type + WorkloadTypeUnknown WorkloadType = "Unknown" + // WorkloadTypeWebApplication - WebApplication - Migration Workload type + WorkloadTypeWebApplication WorkloadType = "WebApplication" + // WorkloadTypeWebServer - WebServer - Migration Workload type + WorkloadTypeWebServer WorkloadType = "WebServer" +) + +// PossibleWorkloadTypeValues returns the possible values for the WorkloadType const type. +func PossibleWorkloadTypeValues() []WorkloadType { + return []WorkloadType{ + WorkloadTypeDatabase, + WorkloadTypeHost, + WorkloadTypeInstance, + WorkloadTypeMachine, + WorkloadTypeManagementServer, + WorkloadTypeServer, + WorkloadTypeUnknown, + WorkloadTypeWebApplication, + WorkloadTypeWebServer, + } +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/assessedmachines_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/assessedmachines_server.go deleted file mode 100644 index 6b7631a4c6c7..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/assessedmachines_server.go +++ /dev/null @@ -1,175 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "regexp" -) - -// AssessedMachinesServer is a fake server for instances of the armmigrate.AssessedMachinesClient type. -type AssessedMachinesServer struct { - // Get is the fake for method AssessedMachinesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, assessedMachineName string, options *armmigrate.AssessedMachinesClientGetOptions) (resp azfake.Responder[armmigrate.AssessedMachinesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByAssessmentPager is the fake for method AssessedMachinesClient.NewListByAssessmentPager - // HTTP status codes to indicate success: http.StatusOK - NewListByAssessmentPager func(resourceGroupName string, projectName string, groupName string, assessmentName string, options *armmigrate.AssessedMachinesClientListByAssessmentOptions) (resp azfake.PagerResponder[armmigrate.AssessedMachinesClientListByAssessmentResponse]) -} - -// NewAssessedMachinesServerTransport creates a new instance of AssessedMachinesServerTransport with the provided implementation. -// The returned AssessedMachinesServerTransport instance is connected to an instance of armmigrate.AssessedMachinesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAssessedMachinesServerTransport(srv *AssessedMachinesServer) *AssessedMachinesServerTransport { - return &AssessedMachinesServerTransport{ - srv: srv, - newListByAssessmentPager: newTracker[azfake.PagerResponder[armmigrate.AssessedMachinesClientListByAssessmentResponse]](), - } -} - -// AssessedMachinesServerTransport connects instances of armmigrate.AssessedMachinesClient to instances of AssessedMachinesServer. -// Don't use this type directly, use NewAssessedMachinesServerTransport instead. -type AssessedMachinesServerTransport struct { - srv *AssessedMachinesServer - newListByAssessmentPager *tracker[azfake.PagerResponder[armmigrate.AssessedMachinesClientListByAssessmentResponse]] -} - -// Do implements the policy.Transporter interface for AssessedMachinesServerTransport. -func (a *AssessedMachinesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "AssessedMachinesClient.Get": - resp, err = a.dispatchGet(req) - case "AssessedMachinesClient.NewListByAssessmentPager": - resp, err = a.dispatchNewListByAssessmentPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AssessedMachinesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if a.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessedMachines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) - if err != nil { - return nil, err - } - assessedMachineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessedMachineName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, groupNameParam, assessmentNameParam, assessedMachineNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AssessedMachine, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (a *AssessedMachinesServerTransport) dispatchNewListByAssessmentPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByAssessmentPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByAssessmentPager not implemented")} - } - newListByAssessmentPager := a.newListByAssessmentPager.get(req) - if newListByAssessmentPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessedMachines` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListByAssessmentPager(resourceGroupNameParam, projectNameParam, groupNameParam, assessmentNameParam, nil) - newListByAssessmentPager = &resp - a.newListByAssessmentPager.add(req, newListByAssessmentPager) - server.PagerResponderInjectNextLinks(newListByAssessmentPager, req, func(page *armmigrate.AssessedMachinesClientListByAssessmentResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByAssessmentPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListByAssessmentPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByAssessmentPager) { - a.newListByAssessmentPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/assessedmachinesv2operations_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/assessedmachinesv2operations_server.go new file mode 100644 index 000000000000..cf6e65cdcb63 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/assessedmachinesv2operations_server.go @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// AssessedMachinesV2OperationsServer is a fake server for instances of the armmigrate.AssessedMachinesV2OperationsClient type. +type AssessedMachinesV2OperationsServer struct { + // Get is the fake for method AssessedMachinesV2OperationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, assessedMachineName string, options *armmigrate.AssessedMachinesV2OperationsClientGetOptions) (resp azfake.Responder[armmigrate.AssessedMachinesV2OperationsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByParentPager is the fake for method AssessedMachinesV2OperationsClient.NewListByParentPager + // HTTP status codes to indicate success: http.StatusOK + NewListByParentPager func(resourceGroupName string, projectName string, assessmentName string, options *armmigrate.AssessedMachinesV2OperationsClientListByParentOptions) (resp azfake.PagerResponder[armmigrate.AssessedMachinesV2OperationsClientListByParentResponse]) +} + +// NewAssessedMachinesV2OperationsServerTransport creates a new instance of AssessedMachinesV2OperationsServerTransport with the provided implementation. +// The returned AssessedMachinesV2OperationsServerTransport instance is connected to an instance of armmigrate.AssessedMachinesV2OperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAssessedMachinesV2OperationsServerTransport(srv *AssessedMachinesV2OperationsServer) *AssessedMachinesV2OperationsServerTransport { + return &AssessedMachinesV2OperationsServerTransport{ + srv: srv, + newListByParentPager: newTracker[azfake.PagerResponder[armmigrate.AssessedMachinesV2OperationsClientListByParentResponse]](), + } +} + +// AssessedMachinesV2OperationsServerTransport connects instances of armmigrate.AssessedMachinesV2OperationsClient to instances of AssessedMachinesV2OperationsServer. +// Don't use this type directly, use NewAssessedMachinesV2OperationsServerTransport instead. +type AssessedMachinesV2OperationsServerTransport struct { + srv *AssessedMachinesV2OperationsServer + newListByParentPager *tracker[azfake.PagerResponder[armmigrate.AssessedMachinesV2OperationsClientListByParentResponse]] +} + +// Do implements the policy.Transporter interface for AssessedMachinesV2OperationsServerTransport. +func (a *AssessedMachinesV2OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return a.dispatchToMethodFake(req, method) +} + +func (a *AssessedMachinesV2OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if assessedMachinesV2OperationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = assessedMachinesV2OperationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AssessedMachinesV2OperationsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AssessedMachinesV2OperationsClient.NewListByParentPager": + res.resp, res.err = a.dispatchNewListByParentPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (a *AssessedMachinesV2OperationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessedMachines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) + if err != nil { + return nil, err + } + assessedMachineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessedMachineName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, assessmentNameParam, assessedMachineNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AssessedMachineV2, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AssessedMachinesV2OperationsServerTransport) dispatchNewListByParentPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListByParentPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByParentPager not implemented")} + } + newListByParentPager := a.newListByParentPager.get(req) + if newListByParentPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessedMachines` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + pageSizeUnescaped, err := url.QueryUnescape(qp.Get("pageSize")) + if err != nil { + return nil, err + } + pageSizeParam, err := parseOptional(pageSizeUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + if err != nil { + return nil, err + } + continuationTokenParam := getOptional(continuationTokenUnescaped) + totalRecordCountUnescaped, err := url.QueryUnescape(qp.Get("totalRecordCount")) + if err != nil { + return nil, err + } + totalRecordCountParam, err := parseOptional(totalRecordCountUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) + if err != nil { + return nil, err + } + var options *armmigrate.AssessedMachinesV2OperationsClientListByParentOptions + if filterParam != nil || pageSizeParam != nil || continuationTokenParam != nil || totalRecordCountParam != nil { + options = &armmigrate.AssessedMachinesV2OperationsClientListByParentOptions{ + Filter: filterParam, + PageSize: pageSizeParam, + ContinuationToken: continuationTokenParam, + TotalRecordCount: totalRecordCountParam, + } + } + resp := a.srv.NewListByParentPager(resourceGroupNameParam, projectNameParam, assessmentNameParam, options) + newListByParentPager = &resp + a.newListByParentPager.add(req, newListByParentPager) + server.PagerResponderInjectNextLinks(newListByParentPager, req, func(page *armmigrate.AssessedMachinesV2OperationsClientListByParentResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByParentPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListByParentPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByParentPager) { + a.newListByParentPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to AssessedMachinesV2OperationsServerTransport +var assessedMachinesV2OperationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/assessments_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/assessments_server.go deleted file mode 100644 index 4909db066929..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/assessments_server.go +++ /dev/null @@ -1,370 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// AssessmentsServer is a fake server for instances of the armmigrate.AssessmentsClient type. -type AssessmentsServer struct { - // Create is the fake for method AssessmentsClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *armmigrate.AssessmentsClientCreateOptions) (resp azfake.Responder[armmigrate.AssessmentsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method AssessmentsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *armmigrate.AssessmentsClientDeleteOptions) (resp azfake.Responder[armmigrate.AssessmentsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AssessmentsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *armmigrate.AssessmentsClientGetOptions) (resp azfake.Responder[armmigrate.AssessmentsClientGetResponse], errResp azfake.ErrorResponder) - - // GetReportDownloadURL is the fake for method AssessmentsClient.GetReportDownloadURL - // HTTP status codes to indicate success: http.StatusOK - GetReportDownloadURL func(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *armmigrate.AssessmentsClientGetReportDownloadURLOptions) (resp azfake.Responder[armmigrate.AssessmentsClientGetReportDownloadURLResponse], errResp azfake.ErrorResponder) - - // NewListByGroupPager is the fake for method AssessmentsClient.NewListByGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByGroupPager func(resourceGroupName string, projectName string, groupName string, options *armmigrate.AssessmentsClientListByGroupOptions) (resp azfake.PagerResponder[armmigrate.AssessmentsClientListByGroupResponse]) - - // NewListByProjectPager is the fake for method AssessmentsClient.NewListByProjectPager - // HTTP status codes to indicate success: http.StatusOK - NewListByProjectPager func(resourceGroupName string, projectName string, options *armmigrate.AssessmentsClientListByProjectOptions) (resp azfake.PagerResponder[armmigrate.AssessmentsClientListByProjectResponse]) -} - -// NewAssessmentsServerTransport creates a new instance of AssessmentsServerTransport with the provided implementation. -// The returned AssessmentsServerTransport instance is connected to an instance of armmigrate.AssessmentsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAssessmentsServerTransport(srv *AssessmentsServer) *AssessmentsServerTransport { - return &AssessmentsServerTransport{ - srv: srv, - newListByGroupPager: newTracker[azfake.PagerResponder[armmigrate.AssessmentsClientListByGroupResponse]](), - newListByProjectPager: newTracker[azfake.PagerResponder[armmigrate.AssessmentsClientListByProjectResponse]](), - } -} - -// AssessmentsServerTransport connects instances of armmigrate.AssessmentsClient to instances of AssessmentsServer. -// Don't use this type directly, use NewAssessmentsServerTransport instead. -type AssessmentsServerTransport struct { - srv *AssessmentsServer - newListByGroupPager *tracker[azfake.PagerResponder[armmigrate.AssessmentsClientListByGroupResponse]] - newListByProjectPager *tracker[azfake.PagerResponder[armmigrate.AssessmentsClientListByProjectResponse]] -} - -// Do implements the policy.Transporter interface for AssessmentsServerTransport. -func (a *AssessmentsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "AssessmentsClient.Create": - resp, err = a.dispatchCreate(req) - case "AssessmentsClient.Delete": - resp, err = a.dispatchDelete(req) - case "AssessmentsClient.Get": - resp, err = a.dispatchGet(req) - case "AssessmentsClient.GetReportDownloadURL": - resp, err = a.dispatchGetReportDownloadURL(req) - case "AssessmentsClient.NewListByGroupPager": - resp, err = a.dispatchNewListByGroupPager(req) - case "AssessmentsClient.NewListByProjectPager": - resp, err = a.dispatchNewListByProjectPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AssessmentsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if a.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmigrate.Assessment](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) - if err != nil { - return nil, err - } - var options *armmigrate.AssessmentsClientCreateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmigrate.AssessmentsClientCreateOptions{ - Assessment: &body, - } - } - respr, errRespr := a.srv.Create(req.Context(), resourceGroupNameParam, projectNameParam, groupNameParam, assessmentNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Assessment, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (a *AssessmentsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if a.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Delete(req.Context(), resourceGroupNameParam, projectNameParam, groupNameParam, assessmentNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (a *AssessmentsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if a.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, groupNameParam, assessmentNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Assessment, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (a *AssessmentsServerTransport) dispatchGetReportDownloadURL(req *http.Request) (*http.Response, error) { - if a.srv.GetReportDownloadURL == nil { - return nil, &nonRetriableError{errors.New("fake for method GetReportDownloadURL not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/downloadUrl` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.GetReportDownloadURL(req.Context(), resourceGroupNameParam, projectNameParam, groupNameParam, assessmentNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DownloadURL, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (a *AssessmentsServerTransport) dispatchNewListByGroupPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByGroupPager not implemented")} - } - newListByGroupPager := a.newListByGroupPager.get(req) - if newListByGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListByGroupPager(resourceGroupNameParam, projectNameParam, groupNameParam, nil) - newListByGroupPager = &resp - a.newListByGroupPager.add(req, newListByGroupPager) - } - resp, err := server.PagerResponderNext(newListByGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListByGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByGroupPager) { - a.newListByGroupPager.remove(req) - } - return resp, nil -} - -func (a *AssessmentsServerTransport) dispatchNewListByProjectPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByProjectPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByProjectPager not implemented")} - } - newListByProjectPager := a.newListByProjectPager.get(req) - if newListByProjectPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListByProjectPager(resourceGroupNameParam, projectNameParam, nil) - newListByProjectPager = &resp - a.newListByProjectPager.add(req, newListByProjectPager) - } - resp, err := server.PagerResponderNext(newListByProjectPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListByProjectPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByProjectPager) { - a.newListByProjectPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/groups_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/groups_server.go deleted file mode 100644 index efe64e023873..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/groups_server.go +++ /dev/null @@ -1,314 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// GroupsServer is a fake server for instances of the armmigrate.GroupsClient type. -type GroupsServer struct { - // Create is the fake for method GroupsClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *armmigrate.GroupsClientCreateOptions) (resp azfake.Responder[armmigrate.GroupsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method GroupsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *armmigrate.GroupsClientDeleteOptions) (resp azfake.Responder[armmigrate.GroupsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method GroupsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *armmigrate.GroupsClientGetOptions) (resp azfake.Responder[armmigrate.GroupsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByProjectPager is the fake for method GroupsClient.NewListByProjectPager - // HTTP status codes to indicate success: http.StatusOK - NewListByProjectPager func(resourceGroupName string, projectName string, options *armmigrate.GroupsClientListByProjectOptions) (resp azfake.PagerResponder[armmigrate.GroupsClientListByProjectResponse]) - - // UpdateMachines is the fake for method GroupsClient.UpdateMachines - // HTTP status codes to indicate success: http.StatusOK - UpdateMachines func(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *armmigrate.GroupsClientUpdateMachinesOptions) (resp azfake.Responder[armmigrate.GroupsClientUpdateMachinesResponse], errResp azfake.ErrorResponder) -} - -// NewGroupsServerTransport creates a new instance of GroupsServerTransport with the provided implementation. -// The returned GroupsServerTransport instance is connected to an instance of armmigrate.GroupsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewGroupsServerTransport(srv *GroupsServer) *GroupsServerTransport { - return &GroupsServerTransport{ - srv: srv, - newListByProjectPager: newTracker[azfake.PagerResponder[armmigrate.GroupsClientListByProjectResponse]](), - } -} - -// GroupsServerTransport connects instances of armmigrate.GroupsClient to instances of GroupsServer. -// Don't use this type directly, use NewGroupsServerTransport instead. -type GroupsServerTransport struct { - srv *GroupsServer - newListByProjectPager *tracker[azfake.PagerResponder[armmigrate.GroupsClientListByProjectResponse]] -} - -// Do implements the policy.Transporter interface for GroupsServerTransport. -func (g *GroupsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "GroupsClient.Create": - resp, err = g.dispatchCreate(req) - case "GroupsClient.Delete": - resp, err = g.dispatchDelete(req) - case "GroupsClient.Get": - resp, err = g.dispatchGet(req) - case "GroupsClient.NewListByProjectPager": - resp, err = g.dispatchNewListByProjectPager(req) - case "GroupsClient.UpdateMachines": - resp, err = g.dispatchUpdateMachines(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (g *GroupsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if g.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmigrate.Group](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - var options *armmigrate.GroupsClientCreateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmigrate.GroupsClientCreateOptions{ - Group: &body, - } - } - respr, errRespr := g.srv.Create(req.Context(), resourceGroupNameParam, projectNameParam, groupNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Group, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (g *GroupsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if g.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - respr, errRespr := g.srv.Delete(req.Context(), resourceGroupNameParam, projectNameParam, groupNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (g *GroupsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if g.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - respr, errRespr := g.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, groupNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Group, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (g *GroupsServerTransport) dispatchNewListByProjectPager(req *http.Request) (*http.Response, error) { - if g.srv.NewListByProjectPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByProjectPager not implemented")} - } - newListByProjectPager := g.newListByProjectPager.get(req) - if newListByProjectPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - resp := g.srv.NewListByProjectPager(resourceGroupNameParam, projectNameParam, nil) - newListByProjectPager = &resp - g.newListByProjectPager.add(req, newListByProjectPager) - } - resp, err := server.PagerResponderNext(newListByProjectPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - g.newListByProjectPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByProjectPager) { - g.newListByProjectPager.remove(req) - } - return resp, nil -} - -func (g *GroupsServerTransport) dispatchUpdateMachines(req *http.Request) (*http.Response, error) { - if g.srv.UpdateMachines == nil { - return nil, &nonRetriableError{errors.New("fake for method UpdateMachines not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateMachines` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmigrate.UpdateGroupBody](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - var options *armmigrate.GroupsClientUpdateMachinesOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmigrate.GroupsClientUpdateMachinesOptions{ - GroupUpdateProperties: &body, - } - } - respr, errRespr := g.srv.UpdateMachines(req.Context(), resourceGroupNameParam, projectNameParam, groupNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Group, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/hypervcollectors_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/hypervcollectors_server.go deleted file mode 100644 index 29de5c408260..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/hypervcollectors_server.go +++ /dev/null @@ -1,258 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// HyperVCollectorsServer is a fake server for instances of the armmigrate.HyperVCollectorsClient type. -type HyperVCollectorsServer struct { - // Create is the fake for method HyperVCollectorsClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *armmigrate.HyperVCollectorsClientCreateOptions) (resp azfake.Responder[armmigrate.HyperVCollectorsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method HyperVCollectorsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *armmigrate.HyperVCollectorsClientDeleteOptions) (resp azfake.Responder[armmigrate.HyperVCollectorsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method HyperVCollectorsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *armmigrate.HyperVCollectorsClientGetOptions) (resp azfake.Responder[armmigrate.HyperVCollectorsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByProjectPager is the fake for method HyperVCollectorsClient.NewListByProjectPager - // HTTP status codes to indicate success: http.StatusOK - NewListByProjectPager func(resourceGroupName string, projectName string, options *armmigrate.HyperVCollectorsClientListByProjectOptions) (resp azfake.PagerResponder[armmigrate.HyperVCollectorsClientListByProjectResponse]) -} - -// NewHyperVCollectorsServerTransport creates a new instance of HyperVCollectorsServerTransport with the provided implementation. -// The returned HyperVCollectorsServerTransport instance is connected to an instance of armmigrate.HyperVCollectorsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewHyperVCollectorsServerTransport(srv *HyperVCollectorsServer) *HyperVCollectorsServerTransport { - return &HyperVCollectorsServerTransport{ - srv: srv, - newListByProjectPager: newTracker[azfake.PagerResponder[armmigrate.HyperVCollectorsClientListByProjectResponse]](), - } -} - -// HyperVCollectorsServerTransport connects instances of armmigrate.HyperVCollectorsClient to instances of HyperVCollectorsServer. -// Don't use this type directly, use NewHyperVCollectorsServerTransport instead. -type HyperVCollectorsServerTransport struct { - srv *HyperVCollectorsServer - newListByProjectPager *tracker[azfake.PagerResponder[armmigrate.HyperVCollectorsClientListByProjectResponse]] -} - -// Do implements the policy.Transporter interface for HyperVCollectorsServerTransport. -func (h *HyperVCollectorsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "HyperVCollectorsClient.Create": - resp, err = h.dispatchCreate(req) - case "HyperVCollectorsClient.Delete": - resp, err = h.dispatchDelete(req) - case "HyperVCollectorsClient.Get": - resp, err = h.dispatchGet(req) - case "HyperVCollectorsClient.NewListByProjectPager": - resp, err = h.dispatchNewListByProjectPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (h *HyperVCollectorsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if h.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/hypervcollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmigrate.HyperVCollector](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - hyperVCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hyperVCollectorName")]) - if err != nil { - return nil, err - } - var options *armmigrate.HyperVCollectorsClientCreateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmigrate.HyperVCollectorsClientCreateOptions{ - CollectorBody: &body, - } - } - respr, errRespr := h.srv.Create(req.Context(), resourceGroupNameParam, projectNameParam, hyperVCollectorNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HyperVCollector, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (h *HyperVCollectorsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if h.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/hypervcollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - hyperVCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hyperVCollectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := h.srv.Delete(req.Context(), resourceGroupNameParam, projectNameParam, hyperVCollectorNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (h *HyperVCollectorsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if h.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/hypervcollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - hyperVCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hyperVCollectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := h.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, hyperVCollectorNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HyperVCollector, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (h *HyperVCollectorsServerTransport) dispatchNewListByProjectPager(req *http.Request) (*http.Response, error) { - if h.srv.NewListByProjectPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByProjectPager not implemented")} - } - newListByProjectPager := h.newListByProjectPager.get(req) - if newListByProjectPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/hypervcollectors` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - resp := h.srv.NewListByProjectPager(resourceGroupNameParam, projectNameParam, nil) - newListByProjectPager = &resp - h.newListByProjectPager.add(req, newListByProjectPager) - } - resp, err := server.PagerResponderNext(newListByProjectPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - h.newListByProjectPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByProjectPager) { - h.newListByProjectPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/importcollectors_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/importcollectors_server.go deleted file mode 100644 index 836bfd4b48bb..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/importcollectors_server.go +++ /dev/null @@ -1,258 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// ImportCollectorsServer is a fake server for instances of the armmigrate.ImportCollectorsClient type. -type ImportCollectorsServer struct { - // Create is the fake for method ImportCollectorsClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *armmigrate.ImportCollectorsClientCreateOptions) (resp azfake.Responder[armmigrate.ImportCollectorsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method ImportCollectorsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *armmigrate.ImportCollectorsClientDeleteOptions) (resp azfake.Responder[armmigrate.ImportCollectorsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ImportCollectorsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *armmigrate.ImportCollectorsClientGetOptions) (resp azfake.Responder[armmigrate.ImportCollectorsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByProjectPager is the fake for method ImportCollectorsClient.NewListByProjectPager - // HTTP status codes to indicate success: http.StatusOK - NewListByProjectPager func(resourceGroupName string, projectName string, options *armmigrate.ImportCollectorsClientListByProjectOptions) (resp azfake.PagerResponder[armmigrate.ImportCollectorsClientListByProjectResponse]) -} - -// NewImportCollectorsServerTransport creates a new instance of ImportCollectorsServerTransport with the provided implementation. -// The returned ImportCollectorsServerTransport instance is connected to an instance of armmigrate.ImportCollectorsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewImportCollectorsServerTransport(srv *ImportCollectorsServer) *ImportCollectorsServerTransport { - return &ImportCollectorsServerTransport{ - srv: srv, - newListByProjectPager: newTracker[azfake.PagerResponder[armmigrate.ImportCollectorsClientListByProjectResponse]](), - } -} - -// ImportCollectorsServerTransport connects instances of armmigrate.ImportCollectorsClient to instances of ImportCollectorsServer. -// Don't use this type directly, use NewImportCollectorsServerTransport instead. -type ImportCollectorsServerTransport struct { - srv *ImportCollectorsServer - newListByProjectPager *tracker[azfake.PagerResponder[armmigrate.ImportCollectorsClientListByProjectResponse]] -} - -// Do implements the policy.Transporter interface for ImportCollectorsServerTransport. -func (i *ImportCollectorsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ImportCollectorsClient.Create": - resp, err = i.dispatchCreate(req) - case "ImportCollectorsClient.Delete": - resp, err = i.dispatchDelete(req) - case "ImportCollectorsClient.Get": - resp, err = i.dispatchGet(req) - case "ImportCollectorsClient.NewListByProjectPager": - resp, err = i.dispatchNewListByProjectPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (i *ImportCollectorsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if i.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/importcollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmigrate.ImportCollector](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - importCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("importCollectorName")]) - if err != nil { - return nil, err - } - var options *armmigrate.ImportCollectorsClientCreateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmigrate.ImportCollectorsClientCreateOptions{ - CollectorBody: &body, - } - } - respr, errRespr := i.srv.Create(req.Context(), resourceGroupNameParam, projectNameParam, importCollectorNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ImportCollector, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (i *ImportCollectorsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if i.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/importcollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - importCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("importCollectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.Delete(req.Context(), resourceGroupNameParam, projectNameParam, importCollectorNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (i *ImportCollectorsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if i.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/importcollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - importCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("importCollectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, importCollectorNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ImportCollector, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (i *ImportCollectorsServerTransport) dispatchNewListByProjectPager(req *http.Request) (*http.Response, error) { - if i.srv.NewListByProjectPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByProjectPager not implemented")} - } - newListByProjectPager := i.newListByProjectPager.get(req) - if newListByProjectPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/importcollectors` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - resp := i.srv.NewListByProjectPager(resourceGroupNameParam, projectNameParam, nil) - newListByProjectPager = &resp - i.newListByProjectPager.add(req, newListByProjectPager) - } - resp, err := server.PagerResponderNext(newListByProjectPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - i.newListByProjectPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByProjectPager) { - i.newListByProjectPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/internal.go b/sdk/resourcemanager/migrate/armmigrate/fake/internal.go index 5f75802a569e..41e62ec29233 100644 --- a/sdk/resourcemanager/migrate/armmigrate/fake/internal.go +++ b/sdk/resourcemanager/migrate/armmigrate/fake/internal.go @@ -1,19 +1,21 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "net/http" + "reflect" "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } @@ -31,6 +33,24 @@ func contains[T comparable](s []T, v T) bool { return false } +func getOptional[T any](v T) *T { + if reflect.ValueOf(v).IsZero() { + return nil + } + return &v +} + +func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) { + if v == "" { + return nil, nil + } + t, err := parse(v) + if err != nil { + return nil, err + } + return &t, err +} + func newTracker[T any]() *tracker[T] { return &tracker[T]{ items: map[string]*T{}, diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/machineassessmentsv2operations_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/machineassessmentsv2operations_server.go new file mode 100644 index 000000000000..d13a816bc2df --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/machineassessmentsv2operations_server.go @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// MachineAssessmentsV2OperationsServer is a fake server for instances of the armmigrate.MachineAssessmentsV2OperationsClient type. +type MachineAssessmentsV2OperationsServer struct { + // BeginCreate is the fake for method MachineAssessmentsV2OperationsClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, resource armmigrate.MachineAssessmentV2, options *armmigrate.MachineAssessmentsV2OperationsClientBeginCreateOptions) (resp azfake.PollerResponder[armmigrate.MachineAssessmentsV2OperationsClientCreateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method MachineAssessmentsV2OperationsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, options *armmigrate.MachineAssessmentsV2OperationsClientDeleteOptions) (resp azfake.Responder[armmigrate.MachineAssessmentsV2OperationsClientDeleteResponse], errResp azfake.ErrorResponder) + + // BeginDownloadURL is the fake for method MachineAssessmentsV2OperationsClient.BeginDownloadURL + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginDownloadURL func(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, body armmigrate.DownloadURLRequest, options *armmigrate.MachineAssessmentsV2OperationsClientBeginDownloadURLOptions) (resp azfake.PollerResponder[armmigrate.MachineAssessmentsV2OperationsClientDownloadURLResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method MachineAssessmentsV2OperationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, options *armmigrate.MachineAssessmentsV2OperationsClientGetOptions) (resp azfake.Responder[armmigrate.MachineAssessmentsV2OperationsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByParentPager is the fake for method MachineAssessmentsV2OperationsClient.NewListByParentPager + // HTTP status codes to indicate success: http.StatusOK + NewListByParentPager func(resourceGroupName string, projectName string, options *armmigrate.MachineAssessmentsV2OperationsClientListByParentOptions) (resp azfake.PagerResponder[armmigrate.MachineAssessmentsV2OperationsClientListByParentResponse]) +} + +// NewMachineAssessmentsV2OperationsServerTransport creates a new instance of MachineAssessmentsV2OperationsServerTransport with the provided implementation. +// The returned MachineAssessmentsV2OperationsServerTransport instance is connected to an instance of armmigrate.MachineAssessmentsV2OperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewMachineAssessmentsV2OperationsServerTransport(srv *MachineAssessmentsV2OperationsServer) *MachineAssessmentsV2OperationsServerTransport { + return &MachineAssessmentsV2OperationsServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armmigrate.MachineAssessmentsV2OperationsClientCreateResponse]](), + beginDownloadURL: newTracker[azfake.PollerResponder[armmigrate.MachineAssessmentsV2OperationsClientDownloadURLResponse]](), + newListByParentPager: newTracker[azfake.PagerResponder[armmigrate.MachineAssessmentsV2OperationsClientListByParentResponse]](), + } +} + +// MachineAssessmentsV2OperationsServerTransport connects instances of armmigrate.MachineAssessmentsV2OperationsClient to instances of MachineAssessmentsV2OperationsServer. +// Don't use this type directly, use NewMachineAssessmentsV2OperationsServerTransport instead. +type MachineAssessmentsV2OperationsServerTransport struct { + srv *MachineAssessmentsV2OperationsServer + beginCreate *tracker[azfake.PollerResponder[armmigrate.MachineAssessmentsV2OperationsClientCreateResponse]] + beginDownloadURL *tracker[azfake.PollerResponder[armmigrate.MachineAssessmentsV2OperationsClientDownloadURLResponse]] + newListByParentPager *tracker[azfake.PagerResponder[armmigrate.MachineAssessmentsV2OperationsClientListByParentResponse]] +} + +// Do implements the policy.Transporter interface for MachineAssessmentsV2OperationsServerTransport. +func (m *MachineAssessmentsV2OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return m.dispatchToMethodFake(req, method) +} + +func (m *MachineAssessmentsV2OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if machineAssessmentsV2OperationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = machineAssessmentsV2OperationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "MachineAssessmentsV2OperationsClient.BeginCreate": + res.resp, res.err = m.dispatchBeginCreate(req) + case "MachineAssessmentsV2OperationsClient.Delete": + res.resp, res.err = m.dispatchDelete(req) + case "MachineAssessmentsV2OperationsClient.BeginDownloadURL": + res.resp, res.err = m.dispatchBeginDownloadURL(req) + case "MachineAssessmentsV2OperationsClient.Get": + res.resp, res.err = m.dispatchGet(req) + case "MachineAssessmentsV2OperationsClient.NewListByParentPager": + res.resp, res.err = m.dispatchNewListByParentPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (m *MachineAssessmentsV2OperationsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if m.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := m.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.MachineAssessmentV2](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginCreate(req.Context(), resourceGroupNameParam, projectNameParam, assessmentNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + m.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + m.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + m.beginCreate.remove(req) + } + + return resp, nil +} + +func (m *MachineAssessmentsV2OperationsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if m.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Delete(req.Context(), resourceGroupNameParam, projectNameParam, assessmentNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MachineAssessmentsV2OperationsServerTransport) dispatchBeginDownloadURL(req *http.Request) (*http.Response, error) { + if m.srv.BeginDownloadURL == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDownloadURL not implemented")} + } + beginDownloadURL := m.beginDownloadURL.get(req) + if beginDownloadURL == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/downloadUrl` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.DownloadURLRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginDownloadURL(req.Context(), resourceGroupNameParam, projectNameParam, assessmentNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDownloadURL = &respr + m.beginDownloadURL.add(req, beginDownloadURL) + } + + resp, err := server.PollerResponderNext(beginDownloadURL, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + m.beginDownloadURL.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDownloadURL) { + m.beginDownloadURL.remove(req) + } + + return resp, nil +} + +func (m *MachineAssessmentsV2OperationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if m.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, assessmentNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MachineAssessmentV2, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MachineAssessmentsV2OperationsServerTransport) dispatchNewListByParentPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListByParentPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByParentPager not implemented")} + } + newListByParentPager := m.newListByParentPager.get(req) + if newListByParentPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + resp := m.srv.NewListByParentPager(resourceGroupNameParam, projectNameParam, nil) + newListByParentPager = &resp + m.newListByParentPager.add(req, newListByParentPager) + server.PagerResponderInjectNextLinks(newListByParentPager, req, func(page *armmigrate.MachineAssessmentsV2OperationsClientListByParentResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByParentPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListByParentPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByParentPager) { + m.newListByParentPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to MachineAssessmentsV2OperationsServerTransport +var machineAssessmentsV2OperationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/machineassessmentv2summaryoperations_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/machineassessmentv2summaryoperations_server.go new file mode 100644 index 000000000000..b0193c88aa00 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/machineassessmentv2summaryoperations_server.go @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// MachineAssessmentV2SummaryOperationsServer is a fake server for instances of the armmigrate.MachineAssessmentV2SummaryOperationsClient type. +type MachineAssessmentV2SummaryOperationsServer struct { + // Get is the fake for method MachineAssessmentV2SummaryOperationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, summaryName string, options *armmigrate.MachineAssessmentV2SummaryOperationsClientGetOptions) (resp azfake.Responder[armmigrate.MachineAssessmentV2SummaryOperationsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByParentPager is the fake for method MachineAssessmentV2SummaryOperationsClient.NewListByParentPager + // HTTP status codes to indicate success: http.StatusOK + NewListByParentPager func(resourceGroupName string, projectName string, assessmentName string, options *armmigrate.MachineAssessmentV2SummaryOperationsClientListByParentOptions) (resp azfake.PagerResponder[armmigrate.MachineAssessmentV2SummaryOperationsClientListByParentResponse]) +} + +// NewMachineAssessmentV2SummaryOperationsServerTransport creates a new instance of MachineAssessmentV2SummaryOperationsServerTransport with the provided implementation. +// The returned MachineAssessmentV2SummaryOperationsServerTransport instance is connected to an instance of armmigrate.MachineAssessmentV2SummaryOperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewMachineAssessmentV2SummaryOperationsServerTransport(srv *MachineAssessmentV2SummaryOperationsServer) *MachineAssessmentV2SummaryOperationsServerTransport { + return &MachineAssessmentV2SummaryOperationsServerTransport{ + srv: srv, + newListByParentPager: newTracker[azfake.PagerResponder[armmigrate.MachineAssessmentV2SummaryOperationsClientListByParentResponse]](), + } +} + +// MachineAssessmentV2SummaryOperationsServerTransport connects instances of armmigrate.MachineAssessmentV2SummaryOperationsClient to instances of MachineAssessmentV2SummaryOperationsServer. +// Don't use this type directly, use NewMachineAssessmentV2SummaryOperationsServerTransport instead. +type MachineAssessmentV2SummaryOperationsServerTransport struct { + srv *MachineAssessmentV2SummaryOperationsServer + newListByParentPager *tracker[azfake.PagerResponder[armmigrate.MachineAssessmentV2SummaryOperationsClientListByParentResponse]] +} + +// Do implements the policy.Transporter interface for MachineAssessmentV2SummaryOperationsServerTransport. +func (m *MachineAssessmentV2SummaryOperationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return m.dispatchToMethodFake(req, method) +} + +func (m *MachineAssessmentV2SummaryOperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if machineAssessmentV2SummaryOperationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = machineAssessmentV2SummaryOperationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "MachineAssessmentV2SummaryOperationsClient.Get": + res.resp, res.err = m.dispatchGet(req) + case "MachineAssessmentV2SummaryOperationsClient.NewListByParentPager": + res.resp, res.err = m.dispatchNewListByParentPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (m *MachineAssessmentV2SummaryOperationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if m.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/summaries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) + if err != nil { + return nil, err + } + summaryNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("summaryName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, assessmentNameParam, summaryNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MachineAssessmentV2Summary, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MachineAssessmentV2SummaryOperationsServerTransport) dispatchNewListByParentPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListByParentPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByParentPager not implemented")} + } + newListByParentPager := m.newListByParentPager.get(req) + if newListByParentPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/summaries` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) + if err != nil { + return nil, err + } + resp := m.srv.NewListByParentPager(resourceGroupNameParam, projectNameParam, assessmentNameParam, nil) + newListByParentPager = &resp + m.newListByParentPager.add(req, newListByParentPager) + server.PagerResponderInjectNextLinks(newListByParentPager, req, func(page *armmigrate.MachineAssessmentV2SummaryOperationsClientListByParentResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByParentPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListByParentPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByParentPager) { + m.newListByParentPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to MachineAssessmentV2SummaryOperationsServerTransport +var machineAssessmentV2SummaryOperationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/machinegraphassessmentoptionsoperations_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/machinegraphassessmentoptionsoperations_server.go new file mode 100644 index 000000000000..f76a3a94de1c --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/machinegraphassessmentoptionsoperations_server.go @@ -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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// MachineGraphAssessmentOptionsOperationsServer is a fake server for instances of the armmigrate.MachineGraphAssessmentOptionsOperationsClient type. +type MachineGraphAssessmentOptionsOperationsServer struct { + // Get is the fake for method MachineGraphAssessmentOptionsOperationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, projectName string, options *armmigrate.MachineGraphAssessmentOptionsOperationsClientGetOptions) (resp azfake.Responder[armmigrate.MachineGraphAssessmentOptionsOperationsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByParentPager is the fake for method MachineGraphAssessmentOptionsOperationsClient.NewListByParentPager + // HTTP status codes to indicate success: http.StatusOK + NewListByParentPager func(resourceGroupName string, projectName string, options *armmigrate.MachineGraphAssessmentOptionsOperationsClientListByParentOptions) (resp azfake.PagerResponder[armmigrate.MachineGraphAssessmentOptionsOperationsClientListByParentResponse]) +} + +// NewMachineGraphAssessmentOptionsOperationsServerTransport creates a new instance of MachineGraphAssessmentOptionsOperationsServerTransport with the provided implementation. +// The returned MachineGraphAssessmentOptionsOperationsServerTransport instance is connected to an instance of armmigrate.MachineGraphAssessmentOptionsOperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewMachineGraphAssessmentOptionsOperationsServerTransport(srv *MachineGraphAssessmentOptionsOperationsServer) *MachineGraphAssessmentOptionsOperationsServerTransport { + return &MachineGraphAssessmentOptionsOperationsServerTransport{ + srv: srv, + newListByParentPager: newTracker[azfake.PagerResponder[armmigrate.MachineGraphAssessmentOptionsOperationsClientListByParentResponse]](), + } +} + +// MachineGraphAssessmentOptionsOperationsServerTransport connects instances of armmigrate.MachineGraphAssessmentOptionsOperationsClient to instances of MachineGraphAssessmentOptionsOperationsServer. +// Don't use this type directly, use NewMachineGraphAssessmentOptionsOperationsServerTransport instead. +type MachineGraphAssessmentOptionsOperationsServerTransport struct { + srv *MachineGraphAssessmentOptionsOperationsServer + newListByParentPager *tracker[azfake.PagerResponder[armmigrate.MachineGraphAssessmentOptionsOperationsClientListByParentResponse]] +} + +// Do implements the policy.Transporter interface for MachineGraphAssessmentOptionsOperationsServerTransport. +func (m *MachineGraphAssessmentOptionsOperationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return m.dispatchToMethodFake(req, method) +} + +func (m *MachineGraphAssessmentOptionsOperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if machineGraphAssessmentOptionsOperationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = machineGraphAssessmentOptionsOperationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "MachineGraphAssessmentOptionsOperationsClient.Get": + res.resp, res.err = m.dispatchGet(req) + case "MachineGraphAssessmentOptionsOperationsClient.NewListByParentPager": + res.resp, res.err = m.dispatchNewListByParentPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (m *MachineGraphAssessmentOptionsOperationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if m.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessmentOptions/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MachineGraphAssessmentOptions, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MachineGraphAssessmentOptionsOperationsServerTransport) dispatchNewListByParentPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListByParentPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByParentPager not implemented")} + } + newListByParentPager := m.newListByParentPager.get(req) + if newListByParentPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessmentOptions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + resp := m.srv.NewListByParentPager(resourceGroupNameParam, projectNameParam, nil) + newListByParentPager = &resp + m.newListByParentPager.add(req, newListByParentPager) + server.PagerResponderInjectNextLinks(newListByParentPager, req, func(page *armmigrate.MachineGraphAssessmentOptionsOperationsClientListByParentResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByParentPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListByParentPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByParentPager) { + m.newListByParentPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to MachineGraphAssessmentOptionsOperationsServerTransport +var machineGraphAssessmentOptionsOperationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/machines_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/machines_server.go deleted file mode 100644 index 6beefa2d10a2..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/machines_server.go +++ /dev/null @@ -1,159 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "regexp" -) - -// MachinesServer is a fake server for instances of the armmigrate.MachinesClient type. -type MachinesServer struct { - // Get is the fake for method MachinesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, machineName string, options *armmigrate.MachinesClientGetOptions) (resp azfake.Responder[armmigrate.MachinesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByProjectPager is the fake for method MachinesClient.NewListByProjectPager - // HTTP status codes to indicate success: http.StatusOK - NewListByProjectPager func(resourceGroupName string, projectName string, options *armmigrate.MachinesClientListByProjectOptions) (resp azfake.PagerResponder[armmigrate.MachinesClientListByProjectResponse]) -} - -// NewMachinesServerTransport creates a new instance of MachinesServerTransport with the provided implementation. -// The returned MachinesServerTransport instance is connected to an instance of armmigrate.MachinesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewMachinesServerTransport(srv *MachinesServer) *MachinesServerTransport { - return &MachinesServerTransport{ - srv: srv, - newListByProjectPager: newTracker[azfake.PagerResponder[armmigrate.MachinesClientListByProjectResponse]](), - } -} - -// MachinesServerTransport connects instances of armmigrate.MachinesClient to instances of MachinesServer. -// Don't use this type directly, use NewMachinesServerTransport instead. -type MachinesServerTransport struct { - srv *MachinesServer - newListByProjectPager *tracker[azfake.PagerResponder[armmigrate.MachinesClientListByProjectResponse]] -} - -// Do implements the policy.Transporter interface for MachinesServerTransport. -func (m *MachinesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "MachinesClient.Get": - resp, err = m.dispatchGet(req) - case "MachinesClient.NewListByProjectPager": - resp, err = m.dispatchNewListByProjectPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (m *MachinesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if m.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, machineNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Machine, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (m *MachinesServerTransport) dispatchNewListByProjectPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListByProjectPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByProjectPager not implemented")} - } - newListByProjectPager := m.newListByProjectPager.get(req) - if newListByProjectPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - resp := m.srv.NewListByProjectPager(resourceGroupNameParam, projectNameParam, nil) - newListByProjectPager = &resp - m.newListByProjectPager.add(req, newListByProjectPager) - server.PagerResponderInjectNextLinks(newListByProjectPager, req, func(page *armmigrate.MachinesClientListByProjectResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByProjectPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListByProjectPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByProjectPager) { - m.newListByProjectPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/operations_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/operations_server.go index 58fb7b499c74..cb42585e5aa0 100644 --- a/sdk/resourcemanager/migrate/armmigrate/fake/operations_server.go +++ b/sdk/resourcemanager/migrate/armmigrate/fake/operations_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -14,7 +10,8 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" "net/http" ) @@ -50,21 +47,40 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -76,6 +92,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht resp := o.srv.NewListPager(nil) newListPager = &resp o.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armmigrate.OperationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListPager, req) if err != nil { @@ -90,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/privateendpointconnection_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/privateendpointconnection_server.go deleted file mode 100644 index b760b5f351ba..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/privateendpointconnection_server.go +++ /dev/null @@ -1,252 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// PrivateEndpointConnectionServer is a fake server for instances of the armmigrate.PrivateEndpointConnectionClient type. -type PrivateEndpointConnectionServer struct { - // Delete is the fake for method PrivateEndpointConnectionClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *armmigrate.PrivateEndpointConnectionClientDeleteOptions) (resp azfake.Responder[armmigrate.PrivateEndpointConnectionClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method PrivateEndpointConnectionClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *armmigrate.PrivateEndpointConnectionClientGetOptions) (resp azfake.Responder[armmigrate.PrivateEndpointConnectionClientGetResponse], errResp azfake.ErrorResponder) - - // ListByProject is the fake for method PrivateEndpointConnectionClient.ListByProject - // HTTP status codes to indicate success: http.StatusOK - ListByProject func(ctx context.Context, resourceGroupName string, projectName string, options *armmigrate.PrivateEndpointConnectionClientListByProjectOptions) (resp azfake.Responder[armmigrate.PrivateEndpointConnectionClientListByProjectResponse], errResp azfake.ErrorResponder) - - // Update is the fake for method PrivateEndpointConnectionClient.Update - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - Update func(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *armmigrate.PrivateEndpointConnectionClientUpdateOptions) (resp azfake.Responder[armmigrate.PrivateEndpointConnectionClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewPrivateEndpointConnectionServerTransport creates a new instance of PrivateEndpointConnectionServerTransport with the provided implementation. -// The returned PrivateEndpointConnectionServerTransport instance is connected to an instance of armmigrate.PrivateEndpointConnectionClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPrivateEndpointConnectionServerTransport(srv *PrivateEndpointConnectionServer) *PrivateEndpointConnectionServerTransport { - return &PrivateEndpointConnectionServerTransport{srv: srv} -} - -// PrivateEndpointConnectionServerTransport connects instances of armmigrate.PrivateEndpointConnectionClient to instances of PrivateEndpointConnectionServer. -// Don't use this type directly, use NewPrivateEndpointConnectionServerTransport instead. -type PrivateEndpointConnectionServerTransport struct { - srv *PrivateEndpointConnectionServer -} - -// Do implements the policy.Transporter interface for PrivateEndpointConnectionServerTransport. -func (p *PrivateEndpointConnectionServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PrivateEndpointConnectionClient.Delete": - resp, err = p.dispatchDelete(req) - case "PrivateEndpointConnectionClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateEndpointConnectionClient.ListByProject": - resp, err = p.dispatchListByProject(req) - case "PrivateEndpointConnectionClient.Update": - resp, err = p.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PrivateEndpointConnectionServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if p.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentprojects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Delete(req.Context(), resourceGroupNameParam, projectNameParam, privateEndpointConnectionNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (p *PrivateEndpointConnectionServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentprojects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, privateEndpointConnectionNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (p *PrivateEndpointConnectionServerTransport) dispatchListByProject(req *http.Request) (*http.Response, error) { - if p.srv.ListByProject == nil { - return nil, &nonRetriableError{errors.New("fake for method ListByProject not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentprojects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.ListByProject(req.Context(), resourceGroupNameParam, projectNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnectionCollection, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (p *PrivateEndpointConnectionServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if p.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentprojects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmigrate.PrivateEndpointConnection](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - var options *armmigrate.PrivateEndpointConnectionClientUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmigrate.PrivateEndpointConnectionClientUpdateOptions{ - PrivateEndpointConnectionBody: &body, - } - } - respr, errRespr := p.srv.Update(req.Context(), resourceGroupNameParam, projectNameParam, privateEndpointConnectionNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusAccepted}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/privatelinkresource_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/privatelinkresource_server.go deleted file mode 100644 index f3ea06be5bcf..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/privatelinkresource_server.go +++ /dev/null @@ -1,149 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "regexp" -) - -// PrivateLinkResourceServer is a fake server for instances of the armmigrate.PrivateLinkResourceClient type. -type PrivateLinkResourceServer struct { - // Get is the fake for method PrivateLinkResourceClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, privateLinkResourceName string, options *armmigrate.PrivateLinkResourceClientGetOptions) (resp azfake.Responder[armmigrate.PrivateLinkResourceClientGetResponse], errResp azfake.ErrorResponder) - - // ListByProject is the fake for method PrivateLinkResourceClient.ListByProject - // HTTP status codes to indicate success: http.StatusOK - ListByProject func(ctx context.Context, resourceGroupName string, projectName string, options *armmigrate.PrivateLinkResourceClientListByProjectOptions) (resp azfake.Responder[armmigrate.PrivateLinkResourceClientListByProjectResponse], errResp azfake.ErrorResponder) -} - -// NewPrivateLinkResourceServerTransport creates a new instance of PrivateLinkResourceServerTransport with the provided implementation. -// The returned PrivateLinkResourceServerTransport instance is connected to an instance of armmigrate.PrivateLinkResourceClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPrivateLinkResourceServerTransport(srv *PrivateLinkResourceServer) *PrivateLinkResourceServerTransport { - return &PrivateLinkResourceServerTransport{srv: srv} -} - -// PrivateLinkResourceServerTransport connects instances of armmigrate.PrivateLinkResourceClient to instances of PrivateLinkResourceServer. -// Don't use this type directly, use NewPrivateLinkResourceServerTransport instead. -type PrivateLinkResourceServerTransport struct { - srv *PrivateLinkResourceServer -} - -// Do implements the policy.Transporter interface for PrivateLinkResourceServerTransport. -func (p *PrivateLinkResourceServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PrivateLinkResourceClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateLinkResourceClient.ListByProject": - resp, err = p.dispatchListByProject(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PrivateLinkResourceServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentprojects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - privateLinkResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateLinkResourceName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, privateLinkResourceNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateLinkResource, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (p *PrivateLinkResourceServerTransport) dispatchListByProject(req *http.Request) (*http.Response, error) { - if p.srv.ListByProject == nil { - return nil, &nonRetriableError{errors.New("fake for method ListByProject not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentprojects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.ListByProject(req.Context(), resourceGroupNameParam, projectNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateLinkResourceCollection, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/projects_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/projects_server.go deleted file mode 100644 index 08f175924815..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/projects_server.go +++ /dev/null @@ -1,431 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// ProjectsServer is a fake server for instances of the armmigrate.ProjectsClient type. -type ProjectsServer struct { - // AssessmentOptions is the fake for method ProjectsClient.AssessmentOptions - // HTTP status codes to indicate success: http.StatusOK - AssessmentOptions func(ctx context.Context, resourceGroupName string, projectName string, assessmentOptionsName string, options *armmigrate.ProjectsClientAssessmentOptionsOptions) (resp azfake.Responder[armmigrate.ProjectsClientAssessmentOptionsResponse], errResp azfake.ErrorResponder) - - // NewAssessmentOptionsListPager is the fake for method ProjectsClient.NewAssessmentOptionsListPager - // HTTP status codes to indicate success: http.StatusOK - NewAssessmentOptionsListPager func(resourceGroupName string, projectName string, options *armmigrate.ProjectsClientAssessmentOptionsListOptions) (resp azfake.PagerResponder[armmigrate.ProjectsClientAssessmentOptionsListResponse]) - - // Create is the fake for method ProjectsClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, projectName string, options *armmigrate.ProjectsClientCreateOptions) (resp azfake.Responder[armmigrate.ProjectsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method ProjectsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, projectName string, options *armmigrate.ProjectsClientDeleteOptions) (resp azfake.Responder[armmigrate.ProjectsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ProjectsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, options *armmigrate.ProjectsClientGetOptions) (resp azfake.Responder[armmigrate.ProjectsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method ProjectsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, options *armmigrate.ProjectsClientListOptions) (resp azfake.PagerResponder[armmigrate.ProjectsClientListResponse]) - - // NewListBySubscriptionPager is the fake for method ProjectsClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armmigrate.ProjectsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmigrate.ProjectsClientListBySubscriptionResponse]) - - // Update is the fake for method ProjectsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, projectName string, options *armmigrate.ProjectsClientUpdateOptions) (resp azfake.Responder[armmigrate.ProjectsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewProjectsServerTransport creates a new instance of ProjectsServerTransport with the provided implementation. -// The returned ProjectsServerTransport instance is connected to an instance of armmigrate.ProjectsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewProjectsServerTransport(srv *ProjectsServer) *ProjectsServerTransport { - return &ProjectsServerTransport{ - srv: srv, - newAssessmentOptionsListPager: newTracker[azfake.PagerResponder[armmigrate.ProjectsClientAssessmentOptionsListResponse]](), - newListPager: newTracker[azfake.PagerResponder[armmigrate.ProjectsClientListResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmigrate.ProjectsClientListBySubscriptionResponse]](), - } -} - -// ProjectsServerTransport connects instances of armmigrate.ProjectsClient to instances of ProjectsServer. -// Don't use this type directly, use NewProjectsServerTransport instead. -type ProjectsServerTransport struct { - srv *ProjectsServer - newAssessmentOptionsListPager *tracker[azfake.PagerResponder[armmigrate.ProjectsClientAssessmentOptionsListResponse]] - newListPager *tracker[azfake.PagerResponder[armmigrate.ProjectsClientListResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armmigrate.ProjectsClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for ProjectsServerTransport. -func (p *ProjectsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ProjectsClient.AssessmentOptions": - resp, err = p.dispatchAssessmentOptions(req) - case "ProjectsClient.NewAssessmentOptionsListPager": - resp, err = p.dispatchNewAssessmentOptionsListPager(req) - case "ProjectsClient.Create": - resp, err = p.dispatchCreate(req) - case "ProjectsClient.Delete": - resp, err = p.dispatchDelete(req) - case "ProjectsClient.Get": - resp, err = p.dispatchGet(req) - case "ProjectsClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - case "ProjectsClient.NewListBySubscriptionPager": - resp, err = p.dispatchNewListBySubscriptionPager(req) - case "ProjectsClient.Update": - resp, err = p.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *ProjectsServerTransport) dispatchAssessmentOptions(req *http.Request) (*http.Response, error) { - if p.srv.AssessmentOptions == nil { - return nil, &nonRetriableError{errors.New("fake for method AssessmentOptions not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessmentOptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - assessmentOptionsNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentOptionsName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.AssessmentOptions(req.Context(), resourceGroupNameParam, projectNameParam, assessmentOptionsNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AssessmentOptions, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (p *ProjectsServerTransport) dispatchNewAssessmentOptionsListPager(req *http.Request) (*http.Response, error) { - if p.srv.NewAssessmentOptionsListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewAssessmentOptionsListPager not implemented")} - } - newAssessmentOptionsListPager := p.newAssessmentOptionsListPager.get(req) - if newAssessmentOptionsListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessmentOptions` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - resp := p.srv.NewAssessmentOptionsListPager(resourceGroupNameParam, projectNameParam, nil) - newAssessmentOptionsListPager = &resp - p.newAssessmentOptionsListPager.add(req, newAssessmentOptionsListPager) - } - resp, err := server.PagerResponderNext(newAssessmentOptionsListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - p.newAssessmentOptionsListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newAssessmentOptionsListPager) { - p.newAssessmentOptionsListPager.remove(req) - } - return resp, nil -} - -func (p *ProjectsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if p.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmigrate.Project](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - var options *armmigrate.ProjectsClientCreateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmigrate.ProjectsClientCreateOptions{ - Project: &body, - } - } - respr, errRespr := p.srv.Create(req.Context(), resourceGroupNameParam, projectNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Project, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (p *ProjectsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if p.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Delete(req.Context(), resourceGroupNameParam, projectNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (p *ProjectsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Project, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (p *ProjectsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if p.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := p.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := p.srv.NewListPager(resourceGroupNameParam, nil) - newListPager = &resp - p.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armmigrate.ProjectsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - p.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - p.newListPager.remove(req) - } - return resp, nil -} - -func (p *ProjectsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { - if p.srv.NewListBySubscriptionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} - } - newListBySubscriptionPager := p.newListBySubscriptionPager.get(req) - if newListBySubscriptionPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := p.srv.NewListBySubscriptionPager(nil) - newListBySubscriptionPager = &resp - p.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmigrate.ProjectsClientListBySubscriptionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - p.newListBySubscriptionPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListBySubscriptionPager) { - p.newListBySubscriptionPager.remove(req) - } - return resp, nil -} - -func (p *ProjectsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if p.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmigrate.Project](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - var options *armmigrate.ProjectsClientUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmigrate.ProjectsClientUpdateOptions{ - Project: &body, - } - } - respr, errRespr := p.srv.Update(req.Context(), resourceGroupNameParam, projectNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Project, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/server_factory.go b/sdk/resourcemanager/migrate/armmigrate/fake/server_factory.go index 905e4613e293..a76328d995bf 100644 --- a/sdk/resourcemanager/migrate/armmigrate/fake/server_factory.go +++ b/sdk/resourcemanager/migrate/armmigrate/fake/server_factory.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -19,18 +15,20 @@ import ( // ServerFactory is a fake server for instances of the armmigrate.ClientFactory type. type ServerFactory struct { - AssessedMachinesServer AssessedMachinesServer - AssessmentsServer AssessmentsServer - GroupsServer GroupsServer - HyperVCollectorsServer HyperVCollectorsServer - ImportCollectorsServer ImportCollectorsServer - MachinesServer MachinesServer - OperationsServer OperationsServer - PrivateEndpointConnectionServer PrivateEndpointConnectionServer - PrivateLinkResourceServer PrivateLinkResourceServer - ProjectsServer ProjectsServer - ServerCollectorsServer ServerCollectorsServer - VMwareCollectorsServer VMwareCollectorsServer + // AssessedMachinesV2OperationsServer contains the fakes for client AssessedMachinesV2OperationsClient + AssessedMachinesV2OperationsServer AssessedMachinesV2OperationsServer + + // MachineAssessmentV2SummaryOperationsServer contains the fakes for client MachineAssessmentV2SummaryOperationsClient + MachineAssessmentV2SummaryOperationsServer MachineAssessmentV2SummaryOperationsServer + + // MachineAssessmentsV2OperationsServer contains the fakes for client MachineAssessmentsV2OperationsClient + MachineAssessmentsV2OperationsServer MachineAssessmentsV2OperationsServer + + // MachineGraphAssessmentOptionsOperationsServer contains the fakes for client MachineGraphAssessmentOptionsOperationsClient + MachineGraphAssessmentOptionsOperationsServer MachineGraphAssessmentOptionsOperationsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -45,20 +43,13 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armmigrate.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trAssessedMachinesServer *AssessedMachinesServerTransport - trAssessmentsServer *AssessmentsServerTransport - trGroupsServer *GroupsServerTransport - trHyperVCollectorsServer *HyperVCollectorsServerTransport - trImportCollectorsServer *ImportCollectorsServerTransport - trMachinesServer *MachinesServerTransport - trOperationsServer *OperationsServerTransport - trPrivateEndpointConnectionServer *PrivateEndpointConnectionServerTransport - trPrivateLinkResourceServer *PrivateLinkResourceServerTransport - trProjectsServer *ProjectsServerTransport - trServerCollectorsServer *ServerCollectorsServerTransport - trVMwareCollectorsServer *VMwareCollectorsServerTransport + srv *ServerFactory + trMu sync.Mutex + trAssessedMachinesV2OperationsServer *AssessedMachinesV2OperationsServerTransport + trMachineAssessmentV2SummaryOperationsServer *MachineAssessmentV2SummaryOperationsServerTransport + trMachineAssessmentsV2OperationsServer *MachineAssessmentsV2OperationsServerTransport + trMachineGraphAssessmentOptionsOperationsServer *MachineGraphAssessmentOptionsOperationsServerTransport + trOperationsServer *OperationsServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -74,56 +65,29 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { - case "AssessedMachinesClient": - initServer(s, &s.trAssessedMachinesServer, func() *AssessedMachinesServerTransport { - return NewAssessedMachinesServerTransport(&s.srv.AssessedMachinesServer) + case "AssessedMachinesV2OperationsClient": + initServer(s, &s.trAssessedMachinesV2OperationsServer, func() *AssessedMachinesV2OperationsServerTransport { + return NewAssessedMachinesV2OperationsServerTransport(&s.srv.AssessedMachinesV2OperationsServer) }) - resp, err = s.trAssessedMachinesServer.Do(req) - case "AssessmentsClient": - initServer(s, &s.trAssessmentsServer, func() *AssessmentsServerTransport { return NewAssessmentsServerTransport(&s.srv.AssessmentsServer) }) - resp, err = s.trAssessmentsServer.Do(req) - case "GroupsClient": - initServer(s, &s.trGroupsServer, func() *GroupsServerTransport { return NewGroupsServerTransport(&s.srv.GroupsServer) }) - resp, err = s.trGroupsServer.Do(req) - case "HyperVCollectorsClient": - initServer(s, &s.trHyperVCollectorsServer, func() *HyperVCollectorsServerTransport { - return NewHyperVCollectorsServerTransport(&s.srv.HyperVCollectorsServer) + resp, err = s.trAssessedMachinesV2OperationsServer.Do(req) + case "MachineAssessmentV2SummaryOperationsClient": + initServer(s, &s.trMachineAssessmentV2SummaryOperationsServer, func() *MachineAssessmentV2SummaryOperationsServerTransport { + return NewMachineAssessmentV2SummaryOperationsServerTransport(&s.srv.MachineAssessmentV2SummaryOperationsServer) }) - resp, err = s.trHyperVCollectorsServer.Do(req) - case "ImportCollectorsClient": - initServer(s, &s.trImportCollectorsServer, func() *ImportCollectorsServerTransport { - return NewImportCollectorsServerTransport(&s.srv.ImportCollectorsServer) + resp, err = s.trMachineAssessmentV2SummaryOperationsServer.Do(req) + case "MachineAssessmentsV2OperationsClient": + initServer(s, &s.trMachineAssessmentsV2OperationsServer, func() *MachineAssessmentsV2OperationsServerTransport { + return NewMachineAssessmentsV2OperationsServerTransport(&s.srv.MachineAssessmentsV2OperationsServer) }) - resp, err = s.trImportCollectorsServer.Do(req) - case "MachinesClient": - initServer(s, &s.trMachinesServer, func() *MachinesServerTransport { return NewMachinesServerTransport(&s.srv.MachinesServer) }) - resp, err = s.trMachinesServer.Do(req) + resp, err = s.trMachineAssessmentsV2OperationsServer.Do(req) + case "MachineGraphAssessmentOptionsOperationsClient": + initServer(s, &s.trMachineGraphAssessmentOptionsOperationsServer, func() *MachineGraphAssessmentOptionsOperationsServerTransport { + return NewMachineGraphAssessmentOptionsOperationsServerTransport(&s.srv.MachineGraphAssessmentOptionsOperationsServer) + }) + resp, err = s.trMachineGraphAssessmentOptionsOperationsServer.Do(req) case "OperationsClient": initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) - case "PrivateEndpointConnectionClient": - initServer(s, &s.trPrivateEndpointConnectionServer, func() *PrivateEndpointConnectionServerTransport { - return NewPrivateEndpointConnectionServerTransport(&s.srv.PrivateEndpointConnectionServer) - }) - resp, err = s.trPrivateEndpointConnectionServer.Do(req) - case "PrivateLinkResourceClient": - initServer(s, &s.trPrivateLinkResourceServer, func() *PrivateLinkResourceServerTransport { - return NewPrivateLinkResourceServerTransport(&s.srv.PrivateLinkResourceServer) - }) - resp, err = s.trPrivateLinkResourceServer.Do(req) - case "ProjectsClient": - initServer(s, &s.trProjectsServer, func() *ProjectsServerTransport { return NewProjectsServerTransport(&s.srv.ProjectsServer) }) - resp, err = s.trProjectsServer.Do(req) - case "ServerCollectorsClient": - initServer(s, &s.trServerCollectorsServer, func() *ServerCollectorsServerTransport { - return NewServerCollectorsServerTransport(&s.srv.ServerCollectorsServer) - }) - resp, err = s.trServerCollectorsServer.Do(req) - case "VMwareCollectorsClient": - initServer(s, &s.trVMwareCollectorsServer, func() *VMwareCollectorsServerTransport { - return NewVMwareCollectorsServerTransport(&s.srv.VMwareCollectorsServer) - }) - resp, err = s.trVMwareCollectorsServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/servercollectors_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/servercollectors_server.go deleted file mode 100644 index 151979dcf612..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/servercollectors_server.go +++ /dev/null @@ -1,258 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// ServerCollectorsServer is a fake server for instances of the armmigrate.ServerCollectorsClient type. -type ServerCollectorsServer struct { - // Create is the fake for method ServerCollectorsClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *armmigrate.ServerCollectorsClientCreateOptions) (resp azfake.Responder[armmigrate.ServerCollectorsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method ServerCollectorsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *armmigrate.ServerCollectorsClientDeleteOptions) (resp azfake.Responder[armmigrate.ServerCollectorsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ServerCollectorsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *armmigrate.ServerCollectorsClientGetOptions) (resp azfake.Responder[armmigrate.ServerCollectorsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByProjectPager is the fake for method ServerCollectorsClient.NewListByProjectPager - // HTTP status codes to indicate success: http.StatusOK - NewListByProjectPager func(resourceGroupName string, projectName string, options *armmigrate.ServerCollectorsClientListByProjectOptions) (resp azfake.PagerResponder[armmigrate.ServerCollectorsClientListByProjectResponse]) -} - -// NewServerCollectorsServerTransport creates a new instance of ServerCollectorsServerTransport with the provided implementation. -// The returned ServerCollectorsServerTransport instance is connected to an instance of armmigrate.ServerCollectorsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewServerCollectorsServerTransport(srv *ServerCollectorsServer) *ServerCollectorsServerTransport { - return &ServerCollectorsServerTransport{ - srv: srv, - newListByProjectPager: newTracker[azfake.PagerResponder[armmigrate.ServerCollectorsClientListByProjectResponse]](), - } -} - -// ServerCollectorsServerTransport connects instances of armmigrate.ServerCollectorsClient to instances of ServerCollectorsServer. -// Don't use this type directly, use NewServerCollectorsServerTransport instead. -type ServerCollectorsServerTransport struct { - srv *ServerCollectorsServer - newListByProjectPager *tracker[azfake.PagerResponder[armmigrate.ServerCollectorsClientListByProjectResponse]] -} - -// Do implements the policy.Transporter interface for ServerCollectorsServerTransport. -func (s *ServerCollectorsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ServerCollectorsClient.Create": - resp, err = s.dispatchCreate(req) - case "ServerCollectorsClient.Delete": - resp, err = s.dispatchDelete(req) - case "ServerCollectorsClient.Get": - resp, err = s.dispatchGet(req) - case "ServerCollectorsClient.NewListByProjectPager": - resp, err = s.dispatchNewListByProjectPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (s *ServerCollectorsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if s.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/servercollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmigrate.ServerCollector](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - serverCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serverCollectorName")]) - if err != nil { - return nil, err - } - var options *armmigrate.ServerCollectorsClientCreateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmigrate.ServerCollectorsClientCreateOptions{ - CollectorBody: &body, - } - } - respr, errRespr := s.srv.Create(req.Context(), resourceGroupNameParam, projectNameParam, serverCollectorNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ServerCollector, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (s *ServerCollectorsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if s.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/servercollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - serverCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serverCollectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.Delete(req.Context(), resourceGroupNameParam, projectNameParam, serverCollectorNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (s *ServerCollectorsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if s.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/servercollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - serverCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serverCollectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, serverCollectorNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ServerCollector, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (s *ServerCollectorsServerTransport) dispatchNewListByProjectPager(req *http.Request) (*http.Response, error) { - if s.srv.NewListByProjectPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByProjectPager not implemented")} - } - newListByProjectPager := s.newListByProjectPager.get(req) - if newListByProjectPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/servercollectors` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - resp := s.srv.NewListByProjectPager(resourceGroupNameParam, projectNameParam, nil) - newListByProjectPager = &resp - s.newListByProjectPager.add(req, newListByProjectPager) - } - resp, err := server.PagerResponderNext(newListByProjectPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - s.newListByProjectPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByProjectPager) { - s.newListByProjectPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/time_rfc3339.go b/sdk/resourcemanager/migrate/armmigrate/fake/time_rfc3339.go index b0535a7b63e6..87ee11e83b32 100644 --- a/sdk/resourcemanager/migrate/armmigrate/fake/time_rfc3339.go +++ b/sdk/resourcemanager/migrate/armmigrate/fake/time_rfc3339.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -19,12 +15,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +40,36 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +80,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +97,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/vmwarecollectors_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/vmwarecollectors_server.go deleted file mode 100644 index 6cf3f68c910e..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/vmwarecollectors_server.go +++ /dev/null @@ -1,258 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// VMwareCollectorsServer is a fake server for instances of the armmigrate.VMwareCollectorsClient type. -type VMwareCollectorsServer struct { - // Create is the fake for method VMwareCollectorsClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *armmigrate.VMwareCollectorsClientCreateOptions) (resp azfake.Responder[armmigrate.VMwareCollectorsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method VMwareCollectorsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *armmigrate.VMwareCollectorsClientDeleteOptions) (resp azfake.Responder[armmigrate.VMwareCollectorsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method VMwareCollectorsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *armmigrate.VMwareCollectorsClientGetOptions) (resp azfake.Responder[armmigrate.VMwareCollectorsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByProjectPager is the fake for method VMwareCollectorsClient.NewListByProjectPager - // HTTP status codes to indicate success: http.StatusOK - NewListByProjectPager func(resourceGroupName string, projectName string, options *armmigrate.VMwareCollectorsClientListByProjectOptions) (resp azfake.PagerResponder[armmigrate.VMwareCollectorsClientListByProjectResponse]) -} - -// NewVMwareCollectorsServerTransport creates a new instance of VMwareCollectorsServerTransport with the provided implementation. -// The returned VMwareCollectorsServerTransport instance is connected to an instance of armmigrate.VMwareCollectorsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewVMwareCollectorsServerTransport(srv *VMwareCollectorsServer) *VMwareCollectorsServerTransport { - return &VMwareCollectorsServerTransport{ - srv: srv, - newListByProjectPager: newTracker[azfake.PagerResponder[armmigrate.VMwareCollectorsClientListByProjectResponse]](), - } -} - -// VMwareCollectorsServerTransport connects instances of armmigrate.VMwareCollectorsClient to instances of VMwareCollectorsServer. -// Don't use this type directly, use NewVMwareCollectorsServerTransport instead. -type VMwareCollectorsServerTransport struct { - srv *VMwareCollectorsServer - newListByProjectPager *tracker[azfake.PagerResponder[armmigrate.VMwareCollectorsClientListByProjectResponse]] -} - -// Do implements the policy.Transporter interface for VMwareCollectorsServerTransport. -func (v *VMwareCollectorsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "VMwareCollectorsClient.Create": - resp, err = v.dispatchCreate(req) - case "VMwareCollectorsClient.Delete": - resp, err = v.dispatchDelete(req) - case "VMwareCollectorsClient.Get": - resp, err = v.dispatchGet(req) - case "VMwareCollectorsClient.NewListByProjectPager": - resp, err = v.dispatchNewListByProjectPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (v *VMwareCollectorsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if v.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/vmwarecollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmigrate.VMwareCollector](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - vmWareCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vmWareCollectorName")]) - if err != nil { - return nil, err - } - var options *armmigrate.VMwareCollectorsClientCreateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmigrate.VMwareCollectorsClientCreateOptions{ - CollectorBody: &body, - } - } - respr, errRespr := v.srv.Create(req.Context(), resourceGroupNameParam, projectNameParam, vmWareCollectorNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).VMwareCollector, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (v *VMwareCollectorsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if v.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/vmwarecollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - vmWareCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vmWareCollectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := v.srv.Delete(req.Context(), resourceGroupNameParam, projectNameParam, vmWareCollectorNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (v *VMwareCollectorsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if v.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/vmwarecollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - vmWareCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vmWareCollectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := v.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, vmWareCollectorNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).VMwareCollector, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (v *VMwareCollectorsServerTransport) dispatchNewListByProjectPager(req *http.Request) (*http.Response, error) { - if v.srv.NewListByProjectPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByProjectPager not implemented")} - } - newListByProjectPager := v.newListByProjectPager.get(req) - if newListByProjectPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/vmwarecollectors` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - resp := v.srv.NewListByProjectPager(resourceGroupNameParam, projectNameParam, nil) - newListByProjectPager = &resp - v.newListByProjectPager.add(req, newListByProjectPager) - } - resp, err := server.PagerResponderNext(newListByProjectPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - v.newListByProjectPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByProjectPager) { - v.newListByProjectPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/go.mod b/sdk/resourcemanager/migrate/armmigrate/go.mod index d0af5280341f..e05f6f3a0266 100644 --- a/sdk/resourcemanager/migrate/armmigrate/go.mod +++ b/sdk/resourcemanager/migrate/armmigrate/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2 go 1.23.0 diff --git a/sdk/resourcemanager/migrate/armmigrate/groups_client.go b/sdk/resourcemanager/migrate/armmigrate/groups_client.go deleted file mode 100644 index e4a940a6f6d6..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/groups_client.go +++ /dev/null @@ -1,416 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// GroupsClient contains the methods for the Groups group. -// Don't use this type directly, use NewGroupsClient() instead. -type GroupsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewGroupsClient creates a new instance of GroupsClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GroupsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &GroupsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Create a new group by sending a json object of type 'group' as given in Models section as part of the Request -// Body. The group name in a project is unique. -// This operation is Idempotent. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - options - GroupsClientCreateOptions contains the optional parameters for the GroupsClient.Create method. -func (client *GroupsClient) Create(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientCreateOptions) (GroupsClientCreateResponse, error) { - var err error - const operationName = "GroupsClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, groupName, options) - if err != nil { - return GroupsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GroupsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return GroupsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *GroupsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Group != nil { - if err := runtime.MarshalAsJSON(req, *options.Group); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *GroupsClient) createHandleResponse(resp *http.Response) (GroupsClientCreateResponse, error) { - result := GroupsClientCreateResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.Group); err != nil { - return GroupsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Delete the group from the project. The machines remain in the project. Deleting a non-existent group results in -// a no-operation. -// A group is an aggregation mechanism for machines in a project. Therefore, deleting group does not delete machines in it. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - options - GroupsClientDeleteOptions contains the optional parameters for the GroupsClient.Delete method. -func (client *GroupsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientDeleteOptions) (GroupsClientDeleteResponse, error) { - var err error - const operationName = "GroupsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, groupName, options) - if err != nil { - return GroupsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GroupsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return GroupsClientDeleteResponse{}, err - } - resp, err := client.deleteHandleResponse(httpResp) - return resp, err -} - -// deleteCreateRequest creates the Delete request. -func (client *GroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteHandleResponse handles the Delete response. -func (client *GroupsClient) deleteHandleResponse(resp *http.Response) (GroupsClientDeleteResponse, error) { - result := GroupsClientDeleteResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - return result, nil -} - -// Get - Get information related to a specific group in the project. Returns a json object of type 'group' as specified in -// the models section. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - options - GroupsClientGetOptions contains the optional parameters for the GroupsClient.Get method. -func (client *GroupsClient) Get(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientGetOptions) (GroupsClientGetResponse, error) { - var err error - const operationName = "GroupsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, groupName, options) - if err != nil { - return GroupsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GroupsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return GroupsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *GroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *GroupsClient) getHandleResponse(resp *http.Response) (GroupsClientGetResponse, error) { - result := GroupsClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.Group); err != nil { - return GroupsClientGetResponse{}, err - } - return result, nil -} - -// NewListByProjectPager - Get all groups created in the project. Returns a json array of objects of type 'group' as specified -// in the Models section. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - GroupsClientListByProjectOptions contains the optional parameters for the GroupsClient.NewListByProjectPager -// method. -func (client *GroupsClient) NewListByProjectPager(resourceGroupName string, projectName string, options *GroupsClientListByProjectOptions) *runtime.Pager[GroupsClientListByProjectResponse] { - return runtime.NewPager(runtime.PagingHandler[GroupsClientListByProjectResponse]{ - More: func(page GroupsClientListByProjectResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *GroupsClientListByProjectResponse) (GroupsClientListByProjectResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GroupsClient.NewListByProjectPager") - req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return GroupsClientListByProjectResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GroupsClientListByProjectResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GroupsClientListByProjectResponse{}, runtime.NewResponseError(resp) - } - return client.listByProjectHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByProjectCreateRequest creates the ListByProject request. -func (client *GroupsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *GroupsClientListByProjectOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByProjectHandleResponse handles the ListByProject response. -func (client *GroupsClient) listByProjectHandleResponse(resp *http.Response) (GroupsClientListByProjectResponse, error) { - result := GroupsClientListByProjectResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.GroupResultList); err != nil { - return GroupsClientListByProjectResponse{}, err - } - return result, nil -} - -// UpdateMachines - Update machines in group by adding or removing machines. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - options - GroupsClientUpdateMachinesOptions contains the optional parameters for the GroupsClient.UpdateMachines method. -func (client *GroupsClient) UpdateMachines(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientUpdateMachinesOptions) (GroupsClientUpdateMachinesResponse, error) { - var err error - const operationName = "GroupsClient.UpdateMachines" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateMachinesCreateRequest(ctx, resourceGroupName, projectName, groupName, options) - if err != nil { - return GroupsClientUpdateMachinesResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GroupsClientUpdateMachinesResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return GroupsClientUpdateMachinesResponse{}, err - } - resp, err := client.updateMachinesHandleResponse(httpResp) - return resp, err -} - -// updateMachinesCreateRequest creates the UpdateMachines request. -func (client *GroupsClient) updateMachinesCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientUpdateMachinesOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/updateMachines" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.GroupUpdateProperties != nil { - if err := runtime.MarshalAsJSON(req, *options.GroupUpdateProperties); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// updateMachinesHandleResponse handles the UpdateMachines response. -func (client *GroupsClient) updateMachinesHandleResponse(resp *http.Response) (GroupsClientUpdateMachinesResponse, error) { - result := GroupsClientUpdateMachinesResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.Group); err != nil { - return GroupsClientUpdateMachinesResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/groups_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/groups_client_example_test.go deleted file mode 100644 index a6e0775e1793..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/groups_client_example_test.go +++ /dev/null @@ -1,204 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Groups_ListByProject.json -func ExampleGroupsClient_NewListByProjectPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGroupsClient().NewListByProjectPager("abgoyal-westEurope", "abgoyalWEselfhostb72bproject", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GroupResultList = armmigrate.GroupResultList{ - // Value: []*armmigrate.Group{ - // { - // Name: to.Ptr("Test1"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups"), - // ETag: to.Ptr("\"21009c31-0000-0d00-0000-5cd585ad0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1"), - // Properties: &armmigrate.GroupProperties{ - // AreAssessmentsRunning: to.Ptr(false), - // Assessments: []*string{ - // to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1/assessments/assessment_5_9_2019_16_22_14")}, - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:07.736Z"); return t}()), - // GroupStatus: to.Ptr(armmigrate.GroupStatusCompleted), - // MachineCount: to.Ptr[int32](26), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-10T14:07:41.752Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("Group2"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups"), - // ETag: to.Ptr("\"1e000c2c-0000-0d00-0000-5cdaa4190000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Group2"), - // Properties: &armmigrate.GroupProperties{ - // AreAssessmentsRunning: to.Ptr(false), - // Assessments: []*string{ - // to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Group2/assessments/assessment_5_9_2019_17_0_56"), - // to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Group2/assessments/assessment_5_14_2019_16_48_47")}, - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:56.157Z"); return t}()), - // GroupStatus: to.Ptr(armmigrate.GroupStatusCompleted), - // MachineCount: to.Ptr[int32](5), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:49.548Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Groups_Get.json -func ExampleGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGroupsClient().Get(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Test1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Group = armmigrate.Group{ - // Name: to.Ptr("Test1"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups"), - // ETag: to.Ptr("\"21009c31-0000-0d00-0000-5cd585ad0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1"), - // Properties: &armmigrate.GroupProperties{ - // AreAssessmentsRunning: to.Ptr(false), - // Assessments: []*string{ - // to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1/assessments/assessment_5_9_2019_16_22_14")}, - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:07.736Z"); return t}()), - // GroupStatus: to.Ptr(armmigrate.GroupStatusCompleted), - // MachineCount: to.Ptr[int32](26), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-10T14:07:41.752Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Groups_Create.json -func ExampleGroupsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGroupsClient().Create(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Group2", &armmigrate.GroupsClientCreateOptions{Group: &armmigrate.Group{ - ETag: to.Ptr("\"1e000c2c-0000-0d00-0000-5cdaa4190000\""), - Properties: &armmigrate.GroupProperties{}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Group = armmigrate.Group{ - // Name: to.Ptr("Group2"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups"), - // ETag: to.Ptr("\"1e000c2c-0000-0d00-0000-5cdaa4190000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Group2"), - // Properties: &armmigrate.GroupProperties{ - // AreAssessmentsRunning: to.Ptr(false), - // Assessments: []*string{ - // }, - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:56.157Z"); return t}()), - // GroupStatus: to.Ptr(armmigrate.GroupStatusCompleted), - // MachineCount: to.Ptr[int32](0), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:49.548Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Groups_Delete.json -func ExampleGroupsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewGroupsClient().Delete(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Test1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Groups_UpdateMachines.json -func ExampleGroupsClient_UpdateMachines() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGroupsClient().UpdateMachines(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Group2", &armmigrate.GroupsClientUpdateMachinesOptions{GroupUpdateProperties: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Group = armmigrate.Group{ - // Name: to.Ptr("Group2"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups"), - // ETag: to.Ptr("\"1e000c2c-0000-0d00-0000-5cdaa4190000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1"), - // Properties: &armmigrate.GroupProperties{ - // AreAssessmentsRunning: to.Ptr(false), - // Assessments: []*string{ - // to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1/assessments/assessment_5_9_2019_16_22_14")}, - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:07.736Z"); return t}()), - // GroupStatus: to.Ptr(armmigrate.GroupStatusCompleted), - // MachineCount: to.Ptr[int32](26), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-10T14:07:41.752Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/hypervcollectors_client.go b/sdk/resourcemanager/migrate/armmigrate/hypervcollectors_client.go deleted file mode 100644 index 89be6d5d146f..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/hypervcollectors_client.go +++ /dev/null @@ -1,332 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// HyperVCollectorsClient contains the methods for the HyperVCollectors group. -// Don't use this type directly, use NewHyperVCollectorsClient() instead. -type HyperVCollectorsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewHyperVCollectorsClient creates a new instance of HyperVCollectorsClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewHyperVCollectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HyperVCollectorsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &HyperVCollectorsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Create or Update Hyper-V collector -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - hyperVCollectorName - Unique name of a Hyper-V collector within a project. -// - options - HyperVCollectorsClientCreateOptions contains the optional parameters for the HyperVCollectorsClient.Create method. -func (client *HyperVCollectorsClient) Create(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *HyperVCollectorsClientCreateOptions) (HyperVCollectorsClientCreateResponse, error) { - var err error - const operationName = "HyperVCollectorsClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, hyperVCollectorName, options) - if err != nil { - return HyperVCollectorsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return HyperVCollectorsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return HyperVCollectorsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *HyperVCollectorsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *HyperVCollectorsClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/hypervcollectors/{hyperVCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if hyperVCollectorName == "" { - return nil, errors.New("parameter hyperVCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{hyperVCollectorName}", url.PathEscape(hyperVCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.CollectorBody != nil { - if err := runtime.MarshalAsJSON(req, *options.CollectorBody); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *HyperVCollectorsClient) createHandleResponse(resp *http.Response) (HyperVCollectorsClientCreateResponse, error) { - result := HyperVCollectorsClientCreateResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.HyperVCollector); err != nil { - return HyperVCollectorsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Delete a Hyper-V collector from the project. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - hyperVCollectorName - Unique name of a Hyper-V collector within a project. -// - options - HyperVCollectorsClientDeleteOptions contains the optional parameters for the HyperVCollectorsClient.Delete method. -func (client *HyperVCollectorsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *HyperVCollectorsClientDeleteOptions) (HyperVCollectorsClientDeleteResponse, error) { - var err error - const operationName = "HyperVCollectorsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, hyperVCollectorName, options) - if err != nil { - return HyperVCollectorsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return HyperVCollectorsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return HyperVCollectorsClientDeleteResponse{}, err - } - resp, err := client.deleteHandleResponse(httpResp) - return resp, err -} - -// deleteCreateRequest creates the Delete request. -func (client *HyperVCollectorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *HyperVCollectorsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/hypervcollectors/{hyperVCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if hyperVCollectorName == "" { - return nil, errors.New("parameter hyperVCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{hyperVCollectorName}", url.PathEscape(hyperVCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteHandleResponse handles the Delete response. -func (client *HyperVCollectorsClient) deleteHandleResponse(resp *http.Response) (HyperVCollectorsClientDeleteResponse, error) { - result := HyperVCollectorsClientDeleteResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - return result, nil -} - -// Get - Get a Hyper-V collector. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - hyperVCollectorName - Unique name of a Hyper-V collector within a project. -// - options - HyperVCollectorsClientGetOptions contains the optional parameters for the HyperVCollectorsClient.Get method. -func (client *HyperVCollectorsClient) Get(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *HyperVCollectorsClientGetOptions) (HyperVCollectorsClientGetResponse, error) { - var err error - const operationName = "HyperVCollectorsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, hyperVCollectorName, options) - if err != nil { - return HyperVCollectorsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return HyperVCollectorsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return HyperVCollectorsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *HyperVCollectorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *HyperVCollectorsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/hypervcollectors/{hyperVCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if hyperVCollectorName == "" { - return nil, errors.New("parameter hyperVCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{hyperVCollectorName}", url.PathEscape(hyperVCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *HyperVCollectorsClient) getHandleResponse(resp *http.Response) (HyperVCollectorsClientGetResponse, error) { - result := HyperVCollectorsClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.HyperVCollector); err != nil { - return HyperVCollectorsClientGetResponse{}, err - } - return result, nil -} - -// NewListByProjectPager - Get a list of Hyper-V collector. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - HyperVCollectorsClientListByProjectOptions contains the optional parameters for the HyperVCollectorsClient.NewListByProjectPager -// method. -func (client *HyperVCollectorsClient) NewListByProjectPager(resourceGroupName string, projectName string, options *HyperVCollectorsClientListByProjectOptions) *runtime.Pager[HyperVCollectorsClientListByProjectResponse] { - return runtime.NewPager(runtime.PagingHandler[HyperVCollectorsClientListByProjectResponse]{ - More: func(page HyperVCollectorsClientListByProjectResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *HyperVCollectorsClientListByProjectResponse) (HyperVCollectorsClientListByProjectResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HyperVCollectorsClient.NewListByProjectPager") - req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return HyperVCollectorsClientListByProjectResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return HyperVCollectorsClientListByProjectResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return HyperVCollectorsClientListByProjectResponse{}, runtime.NewResponseError(resp) - } - return client.listByProjectHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByProjectCreateRequest creates the ListByProject request. -func (client *HyperVCollectorsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *HyperVCollectorsClientListByProjectOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/hypervcollectors" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByProjectHandleResponse handles the ListByProject response. -func (client *HyperVCollectorsClient) listByProjectHandleResponse(resp *http.Response) (HyperVCollectorsClientListByProjectResponse, error) { - result := HyperVCollectorsClientListByProjectResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.HyperVCollectorList); err != nil { - return HyperVCollectorsClientListByProjectResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/hypervcollectors_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/hypervcollectors_client_example_test.go deleted file mode 100644 index 3c3f410d860e..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/hypervcollectors_client_example_test.go +++ /dev/null @@ -1,188 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/HyperVCollectors_ListByProject.json -func ExampleHyperVCollectorsClient_NewListByProjectPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewHyperVCollectorsClient().NewListByProjectPager("contosoithyperv", "migrateprojectce73project", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.HyperVCollectorList = armmigrate.HyperVCollectorList{ - // Value: []*armmigrate.HyperVCollector{ - // { - // Name: to.Ptr("migrateprojectce73collector"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/hypervcollectors"), - // ETag: to.Ptr("\"00000981-0000-0300-0000-5d74cd5f0000\""), - // ID: to.Ptr("/subscriptions/8c3c936a-c09b-4de3-830b-3f5f244d72e9/resourceGroups/contosoithyperv/providers/Microsoft.Migrate/assessmentprojects/migrateprojectce73project/hypervcollectors/migrateprojectce73collector"), - // Properties: &armmigrate.CollectorProperties{ - // AgentProperties: &armmigrate.CollectorAgentProperties{ - // ID: to.Ptr("d86c7d5a-2103-5157-bb20-9026b75e5de8"), - // LastHeartbeatUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-08T09:43:59.057Z"); return t}()), - // SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - // ApplicationID: to.Ptr("827f1053-44dc-439f-b832-05416dcce12b"), - // Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/migrateprojectce73agentauthaadapp"), - // Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ObjectID: to.Ptr("be75098e-c0fc-4ac4-98c7-282ebbcf8370"), - // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // Version: to.Ptr("1.0.8.218"), - // }, - // CreatedTimestamp: to.Ptr("2019-04-10T10:22:51.6271816Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/8c3c936a-c09b-4de3-830b-3f5f244d72e9/resourceGroups/ContosoITHyperV/providers/Microsoft.OffAzure/HyperVSites/migrateprojectce73site"), - // UpdatedTimestamp: to.Ptr("2019-09-08T09:43:59.0573145Z"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/HyperVCollectors_Get.json -func ExampleHyperVCollectorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHyperVCollectorsClient().Get(ctx, "contosoithyperv", "migrateprojectce73project", "migrateprojectce73collector", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HyperVCollector = armmigrate.HyperVCollector{ - // Name: to.Ptr("migrateprojectce73collector"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/hypervcollectors"), - // ETag: to.Ptr("\"00000981-0000-0300-0000-5d74cd5f0000\""), - // ID: to.Ptr("/subscriptions/8c3c936a-c09b-4de3-830b-3f5f244d72e9/resourceGroups/contosoithyperv/providers/Microsoft.Migrate/assessmentprojects/migrateprojectce73project/hypervcollectors/migrateprojectce73collector"), - // Properties: &armmigrate.CollectorProperties{ - // AgentProperties: &armmigrate.CollectorAgentProperties{ - // ID: to.Ptr("d86c7d5a-2103-5157-bb20-9026b75e5de8"), - // LastHeartbeatUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-08T09:43:59.057Z"); return t}()), - // SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - // ApplicationID: to.Ptr("827f1053-44dc-439f-b832-05416dcce12b"), - // Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/migrateprojectce73agentauthaadapp"), - // Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ObjectID: to.Ptr("be75098e-c0fc-4ac4-98c7-282ebbcf8370"), - // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // Version: to.Ptr("1.0.8.218"), - // }, - // CreatedTimestamp: to.Ptr("2019-04-10T10:22:51.6271816Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/8c3c936a-c09b-4de3-830b-3f5f244d72e9/resourceGroups/ContosoITHyperV/providers/Microsoft.OffAzure/HyperVSites/migrateprojectce73site"), - // UpdatedTimestamp: to.Ptr("2019-09-08T09:43:59.0573145Z"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/HyperVCollectors_Create.json -func ExampleHyperVCollectorsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHyperVCollectorsClient().Create(ctx, "contosoithyperv", "migrateprojectce73project", "migrateprojectce73collector", &armmigrate.HyperVCollectorsClientCreateOptions{CollectorBody: &armmigrate.HyperVCollector{ - ETag: to.Ptr("\"00000981-0000-0300-0000-5d74cd5f0000\""), - Properties: &armmigrate.CollectorProperties{ - AgentProperties: &armmigrate.CollectorAgentProperties{ - SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - ApplicationID: to.Ptr("827f1053-44dc-439f-b832-05416dcce12b"), - Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/migrateprojectce73agentauthaadapp"), - Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - ObjectID: to.Ptr("be75098e-c0fc-4ac4-98c7-282ebbcf8370"), - TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - }, - }, - DiscoverySiteID: to.Ptr("/subscriptions/8c3c936a-c09b-4de3-830b-3f5f244d72e9/resourceGroups/ContosoITHyperV/providers/Microsoft.OffAzure/HyperVSites/migrateprojectce73site"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HyperVCollector = armmigrate.HyperVCollector{ - // Name: to.Ptr("migrateprojectce73collector"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/hypervcollectors"), - // ETag: to.Ptr("\"00000981-0000-0300-0000-5d74cd5f0000\""), - // ID: to.Ptr("/subscriptions/8c3c936a-c09b-4de3-830b-3f5f244d72e9/resourceGroups/contosoithyperv/providers/Microsoft.Migrate/assessmentprojects/migrateprojectce73project/hypervcollectors/migrateprojectce73collector"), - // Properties: &armmigrate.CollectorProperties{ - // AgentProperties: &armmigrate.CollectorAgentProperties{ - // ID: to.Ptr("d86c7d5a-2103-5157-bb20-9026b75e5de8"), - // LastHeartbeatUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-08T09:43:59.057Z"); return t}()), - // SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - // ApplicationID: to.Ptr("827f1053-44dc-439f-b832-05416dcce12b"), - // Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/migrateprojectce73agentauthaadapp"), - // Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ObjectID: to.Ptr("be75098e-c0fc-4ac4-98c7-282ebbcf8370"), - // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // Version: to.Ptr("1.0.8.218"), - // }, - // CreatedTimestamp: to.Ptr("2019-04-10T10:22:51.6271816Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/8c3c936a-c09b-4de3-830b-3f5f244d72e9/resourceGroups/ContosoITHyperV/providers/Microsoft.OffAzure/HyperVSites/migrateprojectce73site"), - // UpdatedTimestamp: to.Ptr("2019-09-08T09:43:59.0573145Z"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/HyperVCollectors_Delete.json -func ExampleHyperVCollectorsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewHyperVCollectorsClient().Delete(ctx, "contosoithyperv", "migrateprojectce73project", "migrateprojectce73collector", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/importcollectors_client.go b/sdk/resourcemanager/migrate/armmigrate/importcollectors_client.go deleted file mode 100644 index 24dced0ce8df..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/importcollectors_client.go +++ /dev/null @@ -1,332 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ImportCollectorsClient contains the methods for the ImportCollectors group. -// Don't use this type directly, use NewImportCollectorsClient() instead. -type ImportCollectorsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewImportCollectorsClient creates a new instance of ImportCollectorsClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewImportCollectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ImportCollectorsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ImportCollectorsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Create or Update Import collector -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - importCollectorName - Unique name of a Import collector within a project. -// - options - ImportCollectorsClientCreateOptions contains the optional parameters for the ImportCollectorsClient.Create method. -func (client *ImportCollectorsClient) Create(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *ImportCollectorsClientCreateOptions) (ImportCollectorsClientCreateResponse, error) { - var err error - const operationName = "ImportCollectorsClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, importCollectorName, options) - if err != nil { - return ImportCollectorsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ImportCollectorsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return ImportCollectorsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *ImportCollectorsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *ImportCollectorsClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/importcollectors/{importCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if importCollectorName == "" { - return nil, errors.New("parameter importCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{importCollectorName}", url.PathEscape(importCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.CollectorBody != nil { - if err := runtime.MarshalAsJSON(req, *options.CollectorBody); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *ImportCollectorsClient) createHandleResponse(resp *http.Response) (ImportCollectorsClientCreateResponse, error) { - result := ImportCollectorsClientCreateResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.ImportCollector); err != nil { - return ImportCollectorsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Delete a Import collector from the project. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - importCollectorName - Unique name of a Import collector within a project. -// - options - ImportCollectorsClientDeleteOptions contains the optional parameters for the ImportCollectorsClient.Delete method. -func (client *ImportCollectorsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *ImportCollectorsClientDeleteOptions) (ImportCollectorsClientDeleteResponse, error) { - var err error - const operationName = "ImportCollectorsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, importCollectorName, options) - if err != nil { - return ImportCollectorsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ImportCollectorsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ImportCollectorsClientDeleteResponse{}, err - } - resp, err := client.deleteHandleResponse(httpResp) - return resp, err -} - -// deleteCreateRequest creates the Delete request. -func (client *ImportCollectorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *ImportCollectorsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/importcollectors/{importCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if importCollectorName == "" { - return nil, errors.New("parameter importCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{importCollectorName}", url.PathEscape(importCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteHandleResponse handles the Delete response. -func (client *ImportCollectorsClient) deleteHandleResponse(resp *http.Response) (ImportCollectorsClientDeleteResponse, error) { - result := ImportCollectorsClientDeleteResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - return result, nil -} - -// Get - Get a Import collector. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - importCollectorName - Unique name of a Import collector within a project. -// - options - ImportCollectorsClientGetOptions contains the optional parameters for the ImportCollectorsClient.Get method. -func (client *ImportCollectorsClient) Get(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *ImportCollectorsClientGetOptions) (ImportCollectorsClientGetResponse, error) { - var err error - const operationName = "ImportCollectorsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, importCollectorName, options) - if err != nil { - return ImportCollectorsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ImportCollectorsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ImportCollectorsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ImportCollectorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *ImportCollectorsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/importcollectors/{importCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if importCollectorName == "" { - return nil, errors.New("parameter importCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{importCollectorName}", url.PathEscape(importCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ImportCollectorsClient) getHandleResponse(resp *http.Response) (ImportCollectorsClientGetResponse, error) { - result := ImportCollectorsClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.ImportCollector); err != nil { - return ImportCollectorsClientGetResponse{}, err - } - return result, nil -} - -// NewListByProjectPager - Get a list of Import collector. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - ImportCollectorsClientListByProjectOptions contains the optional parameters for the ImportCollectorsClient.NewListByProjectPager -// method. -func (client *ImportCollectorsClient) NewListByProjectPager(resourceGroupName string, projectName string, options *ImportCollectorsClientListByProjectOptions) *runtime.Pager[ImportCollectorsClientListByProjectResponse] { - return runtime.NewPager(runtime.PagingHandler[ImportCollectorsClientListByProjectResponse]{ - More: func(page ImportCollectorsClientListByProjectResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *ImportCollectorsClientListByProjectResponse) (ImportCollectorsClientListByProjectResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ImportCollectorsClient.NewListByProjectPager") - req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return ImportCollectorsClientListByProjectResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ImportCollectorsClientListByProjectResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ImportCollectorsClientListByProjectResponse{}, runtime.NewResponseError(resp) - } - return client.listByProjectHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByProjectCreateRequest creates the ListByProject request. -func (client *ImportCollectorsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ImportCollectorsClientListByProjectOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/importcollectors" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByProjectHandleResponse handles the ListByProject response. -func (client *ImportCollectorsClient) listByProjectHandleResponse(resp *http.Response) (ImportCollectorsClientListByProjectResponse, error) { - result := ImportCollectorsClientListByProjectResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.ImportCollectorList); err != nil { - return ImportCollectorsClientListByProjectResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/importcollectors_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/importcollectors_client_example_test.go deleted file mode 100644 index d73f1848e233..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/importcollectors_client_example_test.go +++ /dev/null @@ -1,146 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ImportCollectors_ListByProject.json -func ExampleImportCollectorsClient_NewListByProjectPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewImportCollectorsClient().NewListByProjectPager("markusavstestrg", "rajoshCCY9671project", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ImportCollectorList = armmigrate.ImportCollectorList{ - // Value: []*armmigrate.ImportCollector{ - // { - // Name: to.Ptr("importCollector2951"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/importcollectors"), - // ETag: to.Ptr("\"000098a2-0000-3300-0000-605995620000\""), - // ID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourceGroups/markusavstestrg/providers/Microsoft.Migrate/assessmentprojects/rajoshCCY9671project/importcollectors/importCollector2951"), - // Properties: &armmigrate.ImportCollectorProperties{ - // CreatedTimestamp: to.Ptr("2021-02-11T04:46:54.9582099Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourcegroups/MarkusAVStestRG/providers/microsoft.offazure/importsites/rajoshCCY54cbimportSite"), - // UpdatedTimestamp: to.Ptr("2021-03-23T07:14:42.9238657Z"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ImportCollectors_Get.json -func ExampleImportCollectorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewImportCollectorsClient().Get(ctx, "markusavstestrg", "rajoshCCY9671project", "importCollector2951", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ImportCollector = armmigrate.ImportCollector{ - // Name: to.Ptr("importCollector2951"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/importcollectors"), - // ETag: to.Ptr("\"000064a2-0000-3300-0000-605994800000\""), - // ID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourceGroups/markusavstestrg/providers/Microsoft.Migrate/assessmentprojects/rajoshCCY9671project/importcollectors/importCollector2951"), - // Properties: &armmigrate.ImportCollectorProperties{ - // CreatedTimestamp: to.Ptr("2021-02-11T04:46:54.9582099Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourcegroups/MarkusAVStestRG/providers/microsoft.offazure/importsites/rajoshCCY54cbimportSite"), - // UpdatedTimestamp: to.Ptr("2021-03-23T07:10:56.3588497Z"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ImportCollectors_Create.json -func ExampleImportCollectorsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewImportCollectorsClient().Create(ctx, "markusavstestrg", "rajoshCCY9671project", "importCollector2952", &armmigrate.ImportCollectorsClientCreateOptions{CollectorBody: &armmigrate.ImportCollector{ - Name: to.Ptr("importCollector2951"), - Type: to.Ptr("Microsoft.Migrate/assessmentprojects/importcollectors"), - ETag: to.Ptr("\"000064a2-0000-3300-0000-605994800000\""), - ID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourceGroups/markusavstestrg/providers/Microsoft.Migrate/assessmentprojects/rajoshCCY9671project/importcollectors/importCollector2951"), - Properties: &armmigrate.ImportCollectorProperties{ - DiscoverySiteID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourcegroups/MarkusAVStestRG/providers/microsoft.offazure/importsites/rajoshCCY54cbimportSite"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ImportCollector = armmigrate.ImportCollector{ - // Name: to.Ptr("importCollector2952"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/importcollectors"), - // ETag: to.Ptr("\"0000a7a2-0000-3300-0000-6059964d0000\""), - // ID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourceGroups/markusavstestrg/providers/Microsoft.Migrate/assessmentprojects/rajoshCCY9671project/importcollectors/importCollector2952"), - // Properties: &armmigrate.ImportCollectorProperties{ - // CreatedTimestamp: to.Ptr("2021-03-23T07:18:37.2247735Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourcegroups/MarkusAVStestRG/providers/microsoft.offazure/importsites/rajoshCCY54cbimportSite"), - // UpdatedTimestamp: to.Ptr("2021-03-23T07:18:37.2247735Z"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ImportCollectors_Delete.json -func ExampleImportCollectorsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewImportCollectorsClient().Delete(ctx, "markusavstestrg", "rajoshCCY9671project", "importCollector2952", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/machineassessmentsv2operations_client.go b/sdk/resourcemanager/migrate/armmigrate/machineassessmentsv2operations_client.go new file mode 100644 index 000000000000..3878b1957d8d --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/machineassessmentsv2operations_client.go @@ -0,0 +1,411 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// MachineAssessmentsV2OperationsClient contains the methods for the MachineAssessmentsV2Operations group. +// Don't use this type directly, use NewMachineAssessmentsV2OperationsClient() instead. +type MachineAssessmentsV2OperationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewMachineAssessmentsV2OperationsClient creates a new instance of MachineAssessmentsV2OperationsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewMachineAssessmentsV2OperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MachineAssessmentsV2OperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &MachineAssessmentsV2OperationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Create a MachineAssessmentV2 +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-03-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - Assessment Project Name +// - assessmentName - Machine Assessment V2 ARM name +// - resource - Resource create parameters. +// - options - MachineAssessmentsV2OperationsClientBeginCreateOptions contains the optional parameters for the MachineAssessmentsV2OperationsClient.BeginCreate +// method. +func (client *MachineAssessmentsV2OperationsClient) BeginCreate(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, resource MachineAssessmentV2, options *MachineAssessmentsV2OperationsClientBeginCreateOptions) (*runtime.Poller[MachineAssessmentsV2OperationsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, projectName, assessmentName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MachineAssessmentsV2OperationsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MachineAssessmentsV2OperationsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Create a MachineAssessmentV2 +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-03-preview +func (client *MachineAssessmentsV2OperationsClient) create(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, resource MachineAssessmentV2, options *MachineAssessmentsV2OperationsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "MachineAssessmentsV2OperationsClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, assessmentName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *MachineAssessmentsV2OperationsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, resource MachineAssessmentV2, _ *MachineAssessmentsV2OperationsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessments/{assessmentName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if assessmentName == "" { + return nil, errors.New("parameter assessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-03-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// Delete - Delete a MachineAssessmentV2 +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-03-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - Assessment Project Name +// - assessmentName - Machine Assessment V2 ARM name +// - options - MachineAssessmentsV2OperationsClientDeleteOptions contains the optional parameters for the MachineAssessmentsV2OperationsClient.Delete +// method. +func (client *MachineAssessmentsV2OperationsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, options *MachineAssessmentsV2OperationsClientDeleteOptions) (MachineAssessmentsV2OperationsClientDeleteResponse, error) { + var err error + const operationName = "MachineAssessmentsV2OperationsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, assessmentName, options) + if err != nil { + return MachineAssessmentsV2OperationsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MachineAssessmentsV2OperationsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return MachineAssessmentsV2OperationsClientDeleteResponse{}, err + } + return MachineAssessmentsV2OperationsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *MachineAssessmentsV2OperationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, _ *MachineAssessmentsV2OperationsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessments/{assessmentName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if assessmentName == "" { + return nil, errors.New("parameter assessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-03-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDownloadURL - Get download URL for the assessment report. +// +// Get the URL for downloading the assessment in a report format. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-03-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - Assessment Project Name +// - assessmentName - Machine Assessment V2 ARM name +// - body - The content of the action request +// - options - MachineAssessmentsV2OperationsClientBeginDownloadURLOptions contains the optional parameters for the MachineAssessmentsV2OperationsClient.BeginDownloadURL +// method. +func (client *MachineAssessmentsV2OperationsClient) BeginDownloadURL(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, body DownloadURLRequest, options *MachineAssessmentsV2OperationsClientBeginDownloadURLOptions) (*runtime.Poller[MachineAssessmentsV2OperationsClientDownloadURLResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.downloadURL(ctx, resourceGroupName, projectName, assessmentName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MachineAssessmentsV2OperationsClientDownloadURLResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MachineAssessmentsV2OperationsClientDownloadURLResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// DownloadURL - Get download URL for the assessment report. +// +// Get the URL for downloading the assessment in a report format. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-03-preview +func (client *MachineAssessmentsV2OperationsClient) downloadURL(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, body DownloadURLRequest, options *MachineAssessmentsV2OperationsClientBeginDownloadURLOptions) (*http.Response, error) { + var err error + const operationName = "MachineAssessmentsV2OperationsClient.BeginDownloadURL" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.downloadURLCreateRequest(ctx, resourceGroupName, projectName, assessmentName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// downloadURLCreateRequest creates the DownloadURL request. +func (client *MachineAssessmentsV2OperationsClient) downloadURLCreateRequest(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, body DownloadURLRequest, _ *MachineAssessmentsV2OperationsClientBeginDownloadURLOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessments/{assessmentName}/downloadUrl" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if assessmentName == "" { + return nil, errors.New("parameter assessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-03-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// Get - Get a MachineAssessmentV2 +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-03-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - Assessment Project Name +// - assessmentName - Machine Assessment V2 ARM name +// - options - MachineAssessmentsV2OperationsClientGetOptions contains the optional parameters for the MachineAssessmentsV2OperationsClient.Get +// method. +func (client *MachineAssessmentsV2OperationsClient) Get(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, options *MachineAssessmentsV2OperationsClientGetOptions) (MachineAssessmentsV2OperationsClientGetResponse, error) { + var err error + const operationName = "MachineAssessmentsV2OperationsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, assessmentName, options) + if err != nil { + return MachineAssessmentsV2OperationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MachineAssessmentsV2OperationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MachineAssessmentsV2OperationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *MachineAssessmentsV2OperationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, _ *MachineAssessmentsV2OperationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessments/{assessmentName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if assessmentName == "" { + return nil, errors.New("parameter assessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-03-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *MachineAssessmentsV2OperationsClient) getHandleResponse(resp *http.Response) (MachineAssessmentsV2OperationsClientGetResponse, error) { + result := MachineAssessmentsV2OperationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MachineAssessmentV2); err != nil { + return MachineAssessmentsV2OperationsClientGetResponse{}, err + } + return result, nil +} + +// NewListByParentPager - List MachineAssessmentV2 resources by AssessmentProject +// +// Generated from API version 2024-03-03-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - Assessment Project Name +// - options - MachineAssessmentsV2OperationsClientListByParentOptions contains the optional parameters for the MachineAssessmentsV2OperationsClient.NewListByParentPager +// method. +func (client *MachineAssessmentsV2OperationsClient) NewListByParentPager(resourceGroupName string, projectName string, options *MachineAssessmentsV2OperationsClientListByParentOptions) *runtime.Pager[MachineAssessmentsV2OperationsClientListByParentResponse] { + return runtime.NewPager(runtime.PagingHandler[MachineAssessmentsV2OperationsClientListByParentResponse]{ + More: func(page MachineAssessmentsV2OperationsClientListByParentResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *MachineAssessmentsV2OperationsClientListByParentResponse) (MachineAssessmentsV2OperationsClientListByParentResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MachineAssessmentsV2OperationsClient.NewListByParentPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByParentCreateRequest(ctx, resourceGroupName, projectName, options) + }, nil) + if err != nil { + return MachineAssessmentsV2OperationsClientListByParentResponse{}, err + } + return client.listByParentHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByParentCreateRequest creates the ListByParent request. +func (client *MachineAssessmentsV2OperationsClient) listByParentCreateRequest(ctx context.Context, resourceGroupName string, projectName string, _ *MachineAssessmentsV2OperationsClientListByParentOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessments" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-03-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByParentHandleResponse handles the ListByParent response. +func (client *MachineAssessmentsV2OperationsClient) listByParentHandleResponse(resp *http.Response) (MachineAssessmentsV2OperationsClientListByParentResponse, error) { + result := MachineAssessmentsV2OperationsClientListByParentResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MachineAssessmentV2ListResult); err != nil { + return MachineAssessmentsV2OperationsClientListByParentResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/machineassessmentsv2operations_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/machineassessmentsv2operations_client_example_test.go new file mode 100644 index 000000000000..37a7d4d4290c --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/machineassessmentsv2operations_client_example_test.go @@ -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) Go Code Generator. DO NOT EDIT. + +package armmigrate_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "log" + "time" +) + +// Generated from example definition: 2024-03-03-preview/MachineAssessmentsV2Operations_Create_MaximumSet_Gen.json +func ExampleMachineAssessmentsV2OperationsClient_BeginCreate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmigrate.NewClientFactory("AEDD0824-BBE9-4E7C-8909-F46C68EA6BB9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewMachineAssessmentsV2OperationsClient().BeginCreate(ctx, "rgmachineAssessments", "contosoProject", "assessmentName", armmigrate.MachineAssessmentV2{ + Properties: &armmigrate.MachineAssessmentV2Properties{ + Scope: &armmigrate.Scope{ + ScopeType: to.Ptr(armmigrate.ScopeTypeServerGroupID), + ServerGroupID: to.Ptr("f"), + AzureResourceGraphQuery: to.Ptr("hfhwuqalmenpcttboxvo"), + }, + Settings: &armmigrate.MachineAssessmentSettings{ + AzureLocation: to.Ptr("rsequlcso"), + Currency: to.Ptr(armmigrate.AzureCurrencyUnknown), + ScalingFactor: to.Ptr[float32](9), + DiscountPercentage: to.Ptr[float32](5), + SizingCriterion: to.Ptr(armmigrate.AssessmentSizingCriterionPerformanceBased), + PerformanceData: &armmigrate.PerformanceData{ + Percentile: to.Ptr(armmigrate.Percentile("Unknown")), + TimeRange: to.Ptr(armmigrate.TimeRangeDay), + PerfDataStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-21T05:47:51.336Z"); return t }()), + PerfDataEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-21T05:47:51.336Z"); return t }()), + }, + SavingsSettings: &armmigrate.SavingsSettings{ + SavingsOptions: to.Ptr(armmigrate.SavingsOptionsNone), + AzureOfferCode: to.Ptr(armmigrate.AzureOfferUnknown), + }, + BillingSettings: &armmigrate.BillingSettings{ + LicensingProgram: to.Ptr(armmigrate.LicensingProgramRetail), + SubscriptionID: to.Ptr("lee"), + }, + EnvironmentType: to.Ptr(armmigrate.EnvironmentTypeProduction), + AzureSecurityOfferingType: to.Ptr(armmigrate.AzureSecurityOfferingTypeNO), + AzureDiskTypes: []*armmigrate.AzureDiskType{ + to.Ptr(armmigrate.AzureDiskTypeUnknown), + }, + AzurePricingTier: to.Ptr(armmigrate.AzurePricingTierStandard), + AzureStorageRedundancy: to.Ptr(armmigrate.AzureStorageRedundancyUnknown), + AzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitUnknown), + LinuxAzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitUnknown), + AzureVMFamilies: []*armmigrate.AzureVMFamily{ + to.Ptr(armmigrate.AzureVMFamilyUnknown), + }, + VMUptime: &armmigrate.VMUptime{ + DaysPerMonth: to.Ptr[int32](9), + HoursPerDay: to.Ptr[int32](10), + }, + }, + Details: &armmigrate.AssessmentDetails{ + Status: to.Ptr(armmigrate.AssessmentStatusCreated), + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armmigrate.MachineAssessmentsV2OperationsClientCreateResponse{ + // MachineAssessmentV2: &armmigrate.MachineAssessmentV2{ + // Properties: &armmigrate.MachineAssessmentV2Properties{ + // Scope: &armmigrate.Scope{ + // ScopeType: to.Ptr(armmigrate.ScopeTypeServerGroupID), + // ServerGroupID: to.Ptr("f"), + // AzureResourceGraphQuery: to.Ptr("hfhwuqalmenpcttboxvo"), + // }, + // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), + // Settings: &armmigrate.MachineAssessmentSettings{ + // AzureLocation: to.Ptr("rsequlcso"), + // Currency: to.Ptr(armmigrate.AzureCurrencyUnknown), + // ScalingFactor: to.Ptr[float32](9), + // DiscountPercentage: to.Ptr[float32](5), + // SizingCriterion: to.Ptr(armmigrate.AssessmentSizingCriterionPerformanceBased), + // PerformanceData: &armmigrate.PerformanceData{ + // Percentile: to.Ptr(armmigrate.Percentile("Unknown")), + // TimeRange: to.Ptr(armmigrate.TimeRangeDay), + // PerfDataStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-21T05:47:51.336Z"); return t}()), + // PerfDataEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-21T05:47:51.336Z"); return t}()), + // }, + // SavingsSettings: &armmigrate.SavingsSettings{ + // SavingsOptions: to.Ptr(armmigrate.SavingsOptionsNone), + // AzureOfferCode: to.Ptr(armmigrate.AzureOfferUnknown), + // }, + // BillingSettings: &armmigrate.BillingSettings{ + // LicensingProgram: to.Ptr(armmigrate.LicensingProgramRetail), + // SubscriptionID: to.Ptr("lee"), + // }, + // EnvironmentType: to.Ptr(armmigrate.EnvironmentTypeProduction), + // AzureSecurityOfferingType: to.Ptr(armmigrate.AzureSecurityOfferingTypeNO), + // AzureDiskTypes: []*armmigrate.AzureDiskType{ + // to.Ptr(armmigrate.AzureDiskTypeUnknown), + // }, + // AzurePricingTier: to.Ptr(armmigrate.AzurePricingTierStandard), + // AzureStorageRedundancy: to.Ptr(armmigrate.AzureStorageRedundancyUnknown), + // AzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitUnknown), + // LinuxAzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitUnknown), + // AzureVMFamilies: []*armmigrate.AzureVMFamily{ + // to.Ptr(armmigrate.AzureVMFamilyUnknown), + // }, + // VMUptime: &armmigrate.VMUptime{ + // DaysPerMonth: to.Ptr[int32](9), + // HoursPerDay: to.Ptr[int32](10), + // }, + // }, + // Details: &armmigrate.AssessmentDetails{ + // ConfidenceRatingInPercentage: to.Ptr[float32](6), + // PricesTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-21T05:47:51.337Z"); return t}()), + // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-21T05:47:51.337Z"); return t}()), + // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-21T05:47:51.337Z"); return t}()), + // Status: to.Ptr(armmigrate.AssessmentStatusCreated), + // }, + // }, + // ID: to.Ptr("/subscriptions/AEDD0824-BBE9-4E7C-8909-F46C68EA6BB9/resourceGroups/rgmachineAssessments/providers/Microsoft.Migrate/assessmentProjects/contosoProject/assessments/assessmentName"), + // Name: to.Ptr("assessmentName"), + // Type: to.Ptr("Microsoft.Migrate/assessmentProjects/assessments"), + // SystemData: &armmigrate.SystemData{ + // CreatedBy: to.Ptr("drvgxn"), + // CreatedByType: to.Ptr(armmigrate.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:25.000Z"); return t}()), + // LastModifiedBy: to.Ptr("qfyznkjasypfwyfmmkc"), + // LastModifiedByType: to.Ptr(armmigrate.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:25.000Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-03-03-preview/MachineAssessmentsV2Operations_Delete_MaximumSet_Gen.json +func ExampleMachineAssessmentsV2OperationsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmigrate.NewClientFactory("AEDD0824-BBE9-4E7C-8909-F46C68EA6BB9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewMachineAssessmentsV2OperationsClient().Delete(ctx, "rgmachineAssessments", "contosoProject", "assessmentName", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armmigrate.MachineAssessmentsV2OperationsClientDeleteResponse{ + // } +} + +// Generated from example definition: 2024-03-03-preview/MachineAssessmentsV2Operations_DownloadUrl_MaximumSet_Gen.json +func ExampleMachineAssessmentsV2OperationsClient_BeginDownloadURL() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmigrate.NewClientFactory("AEDD0824-BBE9-4E7C-8909-F46C68EA6BB9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewMachineAssessmentsV2OperationsClient().BeginDownloadURL(ctx, "rgmachineAssessments", "contosoProject", "assessmentName", armmigrate.DownloadURLRequest{}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armmigrate.MachineAssessmentsV2OperationsClientDownloadURLResponse{ + // DownloadURL: &armmigrate.DownloadURL{ + // AssessmentReportURL: to.Ptr("mjdgkjydzectxvypt"), + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:26.692Z"); return t}()), + // }, + // } +} + +// Generated from example definition: 2024-03-03-preview/MachineAssessmentsV2Operations_Get_MaximumSet_Gen.json +func ExampleMachineAssessmentsV2OperationsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmigrate.NewClientFactory("AEDD0824-BBE9-4E7C-8909-F46C68EA6BB9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewMachineAssessmentsV2OperationsClient().Get(ctx, "rgmachineAssessments", "contosoProject", "assessmentName", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armmigrate.MachineAssessmentsV2OperationsClientGetResponse{ + // MachineAssessmentV2: &armmigrate.MachineAssessmentV2{ + // Properties: &armmigrate.MachineAssessmentV2Properties{ + // Scope: &armmigrate.Scope{ + // ScopeType: to.Ptr(armmigrate.ScopeTypeServerGroupID), + // ServerGroupID: to.Ptr("f"), + // AzureResourceGraphQuery: to.Ptr("hfhwuqalmenpcttboxvo"), + // }, + // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), + // Settings: &armmigrate.MachineAssessmentSettings{ + // AzureLocation: to.Ptr("rsequlcso"), + // Currency: to.Ptr(armmigrate.AzureCurrencyUnknown), + // ScalingFactor: to.Ptr[float32](9), + // DiscountPercentage: to.Ptr[float32](5), + // SizingCriterion: to.Ptr(armmigrate.AssessmentSizingCriterionPerformanceBased), + // PerformanceData: &armmigrate.PerformanceData{ + // Percentile: to.Ptr(armmigrate.Percentile("Unknown")), + // TimeRange: to.Ptr(armmigrate.TimeRangeDay), + // PerfDataStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-21T05:47:51.336Z"); return t}()), + // PerfDataEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-21T05:47:51.336Z"); return t}()), + // }, + // SavingsSettings: &armmigrate.SavingsSettings{ + // SavingsOptions: to.Ptr(armmigrate.SavingsOptionsNone), + // AzureOfferCode: to.Ptr(armmigrate.AzureOfferUnknown), + // }, + // BillingSettings: &armmigrate.BillingSettings{ + // LicensingProgram: to.Ptr(armmigrate.LicensingProgramRetail), + // SubscriptionID: to.Ptr("lee"), + // }, + // EnvironmentType: to.Ptr(armmigrate.EnvironmentTypeProduction), + // AzureSecurityOfferingType: to.Ptr(armmigrate.AzureSecurityOfferingTypeNO), + // AzureDiskTypes: []*armmigrate.AzureDiskType{ + // to.Ptr(armmigrate.AzureDiskTypeUnknown), + // }, + // AzurePricingTier: to.Ptr(armmigrate.AzurePricingTierStandard), + // AzureStorageRedundancy: to.Ptr(armmigrate.AzureStorageRedundancyUnknown), + // AzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitUnknown), + // LinuxAzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitUnknown), + // AzureVMFamilies: []*armmigrate.AzureVMFamily{ + // to.Ptr(armmigrate.AzureVMFamilyUnknown), + // }, + // VMUptime: &armmigrate.VMUptime{ + // DaysPerMonth: to.Ptr[int32](9), + // HoursPerDay: to.Ptr[int32](10), + // }, + // }, + // Details: &armmigrate.AssessmentDetails{ + // ConfidenceRatingInPercentage: to.Ptr[float32](6), + // PricesTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-21T05:47:51.337Z"); return t}()), + // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-21T05:47:51.337Z"); return t}()), + // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-21T05:47:51.337Z"); return t}()), + // Status: to.Ptr(armmigrate.AssessmentStatusCreated), + // }, + // }, + // ID: to.Ptr("/subscriptions/AEDD0824-BBE9-4E7C-8909-F46C68EA6BB9/resourceGroups/rgmachineAssessments/providers/Microsoft.Migrate/assessmentProjects/contosoProject/assessments/assessmentName"), + // Name: to.Ptr("assessmentName"), + // Type: to.Ptr("Microsoft.Migrate/assessmentProjects/assessments"), + // SystemData: &armmigrate.SystemData{ + // CreatedBy: to.Ptr("drvgxn"), + // CreatedByType: to.Ptr(armmigrate.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:25.000Z"); return t}()), + // LastModifiedBy: to.Ptr("qfyznkjasypfwyfmmkc"), + // LastModifiedByType: to.Ptr(armmigrate.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:25.000Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-03-03-preview/MachineAssessmentsV2Operations_ListByParent_MaximumSet_Gen.json +func ExampleMachineAssessmentsV2OperationsClient_NewListByParentPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmigrate.NewClientFactory("AEDD0824-BBE9-4E7C-8909-F46C68EA6BB9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewMachineAssessmentsV2OperationsClient().NewListByParentPager("rgmachineAssessments", "contosoProject", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armmigrate.MachineAssessmentsV2OperationsClientListByParentResponse{ + // MachineAssessmentV2ListResult: armmigrate.MachineAssessmentV2ListResult{ + // Value: []*armmigrate.MachineAssessmentV2{ + // { + // Properties: &armmigrate.MachineAssessmentV2Properties{ + // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), + // Scope: &armmigrate.Scope{ + // ScopeType: to.Ptr(armmigrate.ScopeTypeServerGroupID), + // ServerGroupID: to.Ptr("f"), + // AzureResourceGraphQuery: to.Ptr("hfhwuqalmenpcttboxvo"), + // }, + // Settings: &armmigrate.MachineAssessmentSettings{ + // AzureLocation: to.Ptr("rsequlcso"), + // Currency: to.Ptr(armmigrate.AzureCurrencyUnknown), + // ScalingFactor: to.Ptr[float32](9), + // DiscountPercentage: to.Ptr[float32](5), + // SizingCriterion: to.Ptr(armmigrate.AssessmentSizingCriterionPerformanceBased), + // PerformanceData: &armmigrate.PerformanceData{ + // Percentile: to.Ptr(armmigrate.Percentile("Unknown")), + // TimeRange: to.Ptr(armmigrate.TimeRangeDay), + // PerfDataStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-21T05:47:51.336Z"); return t}()), + // PerfDataEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-21T05:47:51.336Z"); return t}()), + // }, + // SavingsSettings: &armmigrate.SavingsSettings{ + // SavingsOptions: to.Ptr(armmigrate.SavingsOptionsNone), + // AzureOfferCode: to.Ptr(armmigrate.AzureOfferUnknown), + // }, + // BillingSettings: &armmigrate.BillingSettings{ + // LicensingProgram: to.Ptr(armmigrate.LicensingProgramRetail), + // SubscriptionID: to.Ptr("lee"), + // }, + // EnvironmentType: to.Ptr(armmigrate.EnvironmentTypeProduction), + // AzureSecurityOfferingType: to.Ptr(armmigrate.AzureSecurityOfferingTypeNO), + // AzureDiskTypes: []*armmigrate.AzureDiskType{ + // to.Ptr(armmigrate.AzureDiskTypeUnknown), + // }, + // AzurePricingTier: to.Ptr(armmigrate.AzurePricingTierStandard), + // AzureStorageRedundancy: to.Ptr(armmigrate.AzureStorageRedundancyUnknown), + // AzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitUnknown), + // LinuxAzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitUnknown), + // AzureVMFamilies: []*armmigrate.AzureVMFamily{ + // to.Ptr(armmigrate.AzureVMFamilyUnknown), + // }, + // VMUptime: &armmigrate.VMUptime{ + // DaysPerMonth: to.Ptr[int32](9), + // HoursPerDay: to.Ptr[int32](10), + // }, + // }, + // Details: &armmigrate.AssessmentDetails{ + // ConfidenceRatingInPercentage: to.Ptr[float32](6), + // PricesTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-21T05:47:51.337Z"); return t}()), + // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-21T05:47:51.337Z"); return t}()), + // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-21T05:47:51.337Z"); return t}()), + // Status: to.Ptr(armmigrate.AssessmentStatusCreated), + // }, + // }, + // ID: to.Ptr("/subscriptions/AEDD0824-BBE9-4E7C-8909-F46C68EA6BB9/resourceGroups/rgmachineAssessments/providers/Microsoft.Migrate/assessmentProjects/contosoProject/assessments/assessmentName"), + // Name: to.Ptr("assessmentName"), + // Type: to.Ptr("Microsoft.Migrate/assessmentProjects/assessments"), + // SystemData: &armmigrate.SystemData{ + // CreatedBy: to.Ptr("drvgxn"), + // CreatedByType: to.Ptr(armmigrate.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:25.000Z"); return t}()), + // LastModifiedBy: to.Ptr("qfyznkjasypfwyfmmkc"), + // LastModifiedByType: to.Ptr(armmigrate.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:25.000Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/migrate/armmigrate/machineassessmentv2summaryoperations_client.go b/sdk/resourcemanager/migrate/armmigrate/machineassessmentv2summaryoperations_client.go new file mode 100644 index 000000000000..1a4d1cda1208 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/machineassessmentv2summaryoperations_client.go @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// MachineAssessmentV2SummaryOperationsClient contains the methods for the MachineAssessmentV2SummaryOperations group. +// Don't use this type directly, use NewMachineAssessmentV2SummaryOperationsClient() instead. +type MachineAssessmentV2SummaryOperationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewMachineAssessmentV2SummaryOperationsClient creates a new instance of MachineAssessmentV2SummaryOperationsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewMachineAssessmentV2SummaryOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MachineAssessmentV2SummaryOperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &MachineAssessmentV2SummaryOperationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a MachineAssessmentV2Summary +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-03-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - Assessment Project Name +// - assessmentName - Machine Assessment V2 ARM name +// - summaryName - Gets the Name of the Machine Summary. +// - options - MachineAssessmentV2SummaryOperationsClientGetOptions contains the optional parameters for the MachineAssessmentV2SummaryOperationsClient.Get +// method. +func (client *MachineAssessmentV2SummaryOperationsClient) Get(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, summaryName string, options *MachineAssessmentV2SummaryOperationsClientGetOptions) (MachineAssessmentV2SummaryOperationsClientGetResponse, error) { + var err error + const operationName = "MachineAssessmentV2SummaryOperationsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, assessmentName, summaryName, options) + if err != nil { + return MachineAssessmentV2SummaryOperationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MachineAssessmentV2SummaryOperationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MachineAssessmentV2SummaryOperationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *MachineAssessmentV2SummaryOperationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, summaryName string, _ *MachineAssessmentV2SummaryOperationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessments/{assessmentName}/summaries/{summaryName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if assessmentName == "" { + return nil, errors.New("parameter assessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) + if summaryName == "" { + return nil, errors.New("parameter summaryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{summaryName}", url.PathEscape(summaryName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-03-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *MachineAssessmentV2SummaryOperationsClient) getHandleResponse(resp *http.Response) (MachineAssessmentV2SummaryOperationsClientGetResponse, error) { + result := MachineAssessmentV2SummaryOperationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MachineAssessmentV2Summary); err != nil { + return MachineAssessmentV2SummaryOperationsClientGetResponse{}, err + } + return result, nil +} + +// NewListByParentPager - List MachineAssessmentV2Summary resources by MachineAssessmentV2 +// +// Generated from API version 2024-03-03-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - Assessment Project Name +// - assessmentName - Machine Assessment V2 ARM name +// - options - MachineAssessmentV2SummaryOperationsClientListByParentOptions contains the optional parameters for the MachineAssessmentV2SummaryOperationsClient.NewListByParentPager +// method. +func (client *MachineAssessmentV2SummaryOperationsClient) NewListByParentPager(resourceGroupName string, projectName string, assessmentName string, options *MachineAssessmentV2SummaryOperationsClientListByParentOptions) *runtime.Pager[MachineAssessmentV2SummaryOperationsClientListByParentResponse] { + return runtime.NewPager(runtime.PagingHandler[MachineAssessmentV2SummaryOperationsClientListByParentResponse]{ + More: func(page MachineAssessmentV2SummaryOperationsClientListByParentResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *MachineAssessmentV2SummaryOperationsClientListByParentResponse) (MachineAssessmentV2SummaryOperationsClientListByParentResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MachineAssessmentV2SummaryOperationsClient.NewListByParentPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByParentCreateRequest(ctx, resourceGroupName, projectName, assessmentName, options) + }, nil) + if err != nil { + return MachineAssessmentV2SummaryOperationsClientListByParentResponse{}, err + } + return client.listByParentHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByParentCreateRequest creates the ListByParent request. +func (client *MachineAssessmentV2SummaryOperationsClient) listByParentCreateRequest(ctx context.Context, resourceGroupName string, projectName string, assessmentName string, _ *MachineAssessmentV2SummaryOperationsClientListByParentOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessments/{assessmentName}/summaries" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if assessmentName == "" { + return nil, errors.New("parameter assessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-03-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByParentHandleResponse handles the ListByParent response. +func (client *MachineAssessmentV2SummaryOperationsClient) listByParentHandleResponse(resp *http.Response) (MachineAssessmentV2SummaryOperationsClientListByParentResponse, error) { + result := MachineAssessmentV2SummaryOperationsClientListByParentResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MachineAssessmentV2SummaryListResult); err != nil { + return MachineAssessmentV2SummaryOperationsClientListByParentResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/machineassessmentv2summaryoperations_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/machineassessmentv2summaryoperations_client_example_test.go new file mode 100644 index 000000000000..6fb547867515 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/machineassessmentv2summaryoperations_client_example_test.go @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armmigrate_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "log" +) + +// Generated from example definition: 2024-03-03-preview/MachineAssessmentV2SummaryOperations_Get_MaximumSet_Gen.json +func ExampleMachineAssessmentV2SummaryOperationsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmigrate.NewClientFactory("AEDD0824-BBE9-4E7C-8909-F46C68EA6BB9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewMachineAssessmentV2SummaryOperationsClient().Get(ctx, "rgmachineAssessments", "contosoProject", "assessmentName", "PaaSPreferred", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armmigrate.MachineAssessmentV2SummaryOperationsClientGetResponse{ + // MachineAssessmentV2Summary: &armmigrate.MachineAssessmentV2Summary{ + // Properties: &armmigrate.SummaryProperties{ + // SummaryType: to.Ptr(armmigrate.SummaryTypeUnknown), + // SummaryName: to.Ptr("tuwdzpdatrpmmmbaydfthidla"), + // Sources: []*armmigrate.SourceDetails{ + // { + // SourceName: to.Ptr(armmigrate.AssessmentSourceUnknown), + // SourceType: to.Ptr(armmigrate.WorkloadTypeUnknown), + // Platform: to.Ptr(armmigrate.MigrationPlatformUnknown), + // Count: to.Ptr[int32](2), + // }, + // }, + // Targets: []*armmigrate.TargetDetails{ + // { + // TargetName: to.Ptr(armmigrate.AzureTargetUnknown), + // TargetType: to.Ptr(armmigrate.WorkloadTypeUnknown), + // Platform: to.Ptr(armmigrate.MigrationPlatformUnknown), + // Count: to.Ptr[int32](15), + // }, + // }, + // TargetSourceMapping: []*armmigrate.TargetSourcePair{ + // { + // SourceRef: to.Ptr(armmigrate.AssessmentSourceUnknown), + // TargetRef: to.Ptr(armmigrate.AzureTargetUnknown), + // SourceCount: to.Ptr[int32](25), + // TargetCount: to.Ptr[int32](17), + // MigrationDetails: &armmigrate.MigrationDetails{ + // ReadinessSummary: []*armmigrate.NameValuePairCloudSuitabilityCommon{ + // { + // Name: to.Ptr(armmigrate.CloudSuitabilityCommonUnknown), + // Value: to.Ptr[int32](12), + // }, + // }, + // MigrationType: to.Ptr(armmigrate.MigrationTypeUnknown), + // }, + // ManagementDetails: []*armmigrate.ManagementDetails{ + // { + // Name: to.Ptr(armmigrate.AzureManagementOfferingTypeNo), + // ReadinessSummary: []*armmigrate.NameValuePairCloudSuitabilityCommon{ + // { + // Name: to.Ptr(armmigrate.CloudSuitabilityCommonUnknown), + // Value: to.Ptr[int32](30), + // }, + // }, + // }, + // }, + // CostDetails: []*armmigrate.CostDetailsCommon{ + // { + // CostDetail: []*armmigrate.NameValuePairCostType{ + // { + // Name: to.Ptr(armmigrate.CostTypeMonthlyStorageCost), + // Value: to.Ptr[float32](16), + // }, + // }, + // SavingOptions: to.Ptr(armmigrate.SavingsOptionsNone), + // }, + // }, + // SavingsDetails: []*armmigrate.SavingsDetailsCommon{ + // { + // SavingsDetail: []*armmigrate.NameValuePairSavingsType{ + // { + // Name: to.Ptr(armmigrate.SavingsTypeMonthlyAzureHybridCostSavings), + // Value: to.Ptr[float32](5), + // }, + // }, + // SavingOptions: to.Ptr(armmigrate.SavingsOptionsNone), + // }, + // }, + // ConfidenceScore: to.Ptr[float64](28), + // }, + // }, + // CostComponents: []*armmigrate.CostDetailsCommon{ + // { + // CostDetail: []*armmigrate.NameValuePairCostType{ + // { + // Name: to.Ptr(armmigrate.CostTypeMonthlyStorageCost), + // Value: to.Ptr[float32](16), + // }, + // }, + // SavingOptions: to.Ptr(armmigrate.SavingsOptionsNone), + // }, + // }, + // SavingsComponents: []*armmigrate.SavingsDetailsCommon{ + // { + // SavingsDetail: []*armmigrate.NameValuePairSavingsType{ + // { + // Name: to.Ptr(armmigrate.SavingsTypeMonthlyAzureHybridCostSavings), + // Value: to.Ptr[float32](5), + // }, + // }, + // SavingOptions: to.Ptr(armmigrate.SavingsOptionsNone), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/AEDD0824-BBE9-4E7C-8909-F46C68EA6BB9/resourceGroups/rgmachineAssessments/providers/Microsoft.Migrate/assessmentProjects/contosoProject/assessments/assessmentName/summaries/PaaSPreferred"), + // Name: to.Ptr("PaaSPreferred"), + // Type: to.Ptr("Microsoft.Migrate/assessmentProjects/assessments/summaries"), + // SystemData: &armmigrate.SystemData{ + // CreatedBy: to.Ptr("drvgxn"), + // CreatedByType: to.Ptr(armmigrate.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:25.000Z"); return t}()), + // LastModifiedBy: to.Ptr("qfyznkjasypfwyfmmkc"), + // LastModifiedByType: to.Ptr(armmigrate.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:25.000Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-03-03-preview/MachineAssessmentV2SummaryOperations_ListByParent_MaximumSet_Gen.json +func ExampleMachineAssessmentV2SummaryOperationsClient_NewListByParentPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmigrate.NewClientFactory("AEDD0824-BBE9-4E7C-8909-F46C68EA6BB9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewMachineAssessmentV2SummaryOperationsClient().NewListByParentPager("rgmachineAssessments", "contosoProject", "assessmentName", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armmigrate.MachineAssessmentV2SummaryOperationsClientListByParentResponse{ + // MachineAssessmentV2SummaryListResult: armmigrate.MachineAssessmentV2SummaryListResult{ + // Value: []*armmigrate.MachineAssessmentV2Summary{ + // { + // Properties: &armmigrate.SummaryProperties{ + // SummaryType: to.Ptr(armmigrate.SummaryTypeUnknown), + // SummaryName: to.Ptr("tuwdzpdatrpmmmbaydfthidla"), + // Sources: []*armmigrate.SourceDetails{ + // { + // SourceName: to.Ptr(armmigrate.AssessmentSourceUnknown), + // SourceType: to.Ptr(armmigrate.WorkloadTypeUnknown), + // Platform: to.Ptr(armmigrate.MigrationPlatformUnknown), + // Count: to.Ptr[int32](2), + // }, + // }, + // Targets: []*armmigrate.TargetDetails{ + // { + // TargetName: to.Ptr(armmigrate.AzureTargetUnknown), + // TargetType: to.Ptr(armmigrate.WorkloadTypeUnknown), + // Platform: to.Ptr(armmigrate.MigrationPlatformUnknown), + // Count: to.Ptr[int32](15), + // }, + // }, + // TargetSourceMapping: []*armmigrate.TargetSourcePair{ + // { + // SourceRef: to.Ptr(armmigrate.AssessmentSourceUnknown), + // TargetRef: to.Ptr(armmigrate.AzureTargetUnknown), + // SourceCount: to.Ptr[int32](25), + // TargetCount: to.Ptr[int32](17), + // MigrationDetails: &armmigrate.MigrationDetails{ + // ReadinessSummary: []*armmigrate.NameValuePairCloudSuitabilityCommon{ + // { + // Name: to.Ptr(armmigrate.CloudSuitabilityCommonUnknown), + // Value: to.Ptr[int32](12), + // }, + // }, + // MigrationType: to.Ptr(armmigrate.MigrationTypeUnknown), + // }, + // ManagementDetails: []*armmigrate.ManagementDetails{ + // { + // Name: to.Ptr(armmigrate.AzureManagementOfferingTypeNo), + // ReadinessSummary: []*armmigrate.NameValuePairCloudSuitabilityCommon{ + // { + // Name: to.Ptr(armmigrate.CloudSuitabilityCommonUnknown), + // Value: to.Ptr[int32](30), + // }, + // }, + // }, + // }, + // CostDetails: []*armmigrate.CostDetailsCommon{ + // { + // CostDetail: []*armmigrate.NameValuePairCostType{ + // { + // Name: to.Ptr(armmigrate.CostTypeMonthlyStorageCost), + // Value: to.Ptr[float32](16), + // }, + // }, + // SavingOptions: to.Ptr(armmigrate.SavingsOptionsNone), + // }, + // }, + // SavingsDetails: []*armmigrate.SavingsDetailsCommon{ + // { + // SavingsDetail: []*armmigrate.NameValuePairSavingsType{ + // { + // Name: to.Ptr(armmigrate.SavingsTypeMonthlyAzureHybridCostSavings), + // Value: to.Ptr[float32](5), + // }, + // }, + // SavingOptions: to.Ptr(armmigrate.SavingsOptionsNone), + // }, + // }, + // ConfidenceScore: to.Ptr[float64](28), + // }, + // }, + // CostComponents: []*armmigrate.CostDetailsCommon{ + // { + // CostDetail: []*armmigrate.NameValuePairCostType{ + // { + // Name: to.Ptr(armmigrate.CostTypeMonthlyStorageCost), + // Value: to.Ptr[float32](16), + // }, + // }, + // SavingOptions: to.Ptr(armmigrate.SavingsOptionsNone), + // }, + // }, + // SavingsComponents: []*armmigrate.SavingsDetailsCommon{ + // { + // SavingsDetail: []*armmigrate.NameValuePairSavingsType{ + // { + // Name: to.Ptr(armmigrate.SavingsTypeMonthlyAzureHybridCostSavings), + // Value: to.Ptr[float32](5), + // }, + // }, + // SavingOptions: to.Ptr(armmigrate.SavingsOptionsNone), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/AEDD0824-BBE9-4E7C-8909-F46C68EA6BB9/resourceGroups/rgmachineAssessments/providers/Microsoft.Migrate/assessmentProjects/contosoProject/assessments/assessmentName/summaries/PaaSPreferred"), + // Name: to.Ptr("PaaSPreferred"), + // Type: to.Ptr("Microsoft.Migrate/assessmentProjects/assessments/summaries"), + // SystemData: &armmigrate.SystemData{ + // CreatedBy: to.Ptr("drvgxn"), + // CreatedByType: to.Ptr(armmigrate.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:25.000Z"); return t}()), + // LastModifiedBy: to.Ptr("qfyznkjasypfwyfmmkc"), + // LastModifiedByType: to.Ptr(armmigrate.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:25.000Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/migrate/armmigrate/machinegraphassessmentoptionsoperations_client.go b/sdk/resourcemanager/migrate/armmigrate/machinegraphassessmentoptionsoperations_client.go new file mode 100644 index 000000000000..c9a6342a7100 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/machinegraphassessmentoptionsoperations_client.go @@ -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) Go Code Generator. DO NOT EDIT. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// MachineGraphAssessmentOptionsOperationsClient contains the methods for the MachineGraphAssessmentOptionsOperations group. +// Don't use this type directly, use NewMachineGraphAssessmentOptionsOperationsClient() instead. +type MachineGraphAssessmentOptionsOperationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewMachineGraphAssessmentOptionsOperationsClient creates a new instance of MachineGraphAssessmentOptionsOperationsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewMachineGraphAssessmentOptionsOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MachineGraphAssessmentOptionsOperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &MachineGraphAssessmentOptionsOperationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a MachineGraphAssessmentOptions +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-03-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - Assessment Project Name +// - options - MachineGraphAssessmentOptionsOperationsClientGetOptions contains the optional parameters for the MachineGraphAssessmentOptionsOperationsClient.Get +// method. +func (client *MachineGraphAssessmentOptionsOperationsClient) Get(ctx context.Context, resourceGroupName string, projectName string, options *MachineGraphAssessmentOptionsOperationsClientGetOptions) (MachineGraphAssessmentOptionsOperationsClientGetResponse, error) { + var err error + const operationName = "MachineGraphAssessmentOptionsOperationsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, options) + if err != nil { + return MachineGraphAssessmentOptionsOperationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MachineGraphAssessmentOptionsOperationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MachineGraphAssessmentOptionsOperationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *MachineGraphAssessmentOptionsOperationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, _ *MachineGraphAssessmentOptionsOperationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessmentOptions/default" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-03-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *MachineGraphAssessmentOptionsOperationsClient) getHandleResponse(resp *http.Response) (MachineGraphAssessmentOptionsOperationsClientGetResponse, error) { + result := MachineGraphAssessmentOptionsOperationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MachineGraphAssessmentOptions); err != nil { + return MachineGraphAssessmentOptionsOperationsClientGetResponse{}, err + } + return result, nil +} + +// NewListByParentPager - List MachineGraphAssessmentOptions resources by AssessmentProject +// +// Generated from API version 2024-03-03-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - Assessment Project Name +// - options - MachineGraphAssessmentOptionsOperationsClientListByParentOptions contains the optional parameters for the MachineGraphAssessmentOptionsOperationsClient.NewListByParentPager +// method. +func (client *MachineGraphAssessmentOptionsOperationsClient) NewListByParentPager(resourceGroupName string, projectName string, options *MachineGraphAssessmentOptionsOperationsClientListByParentOptions) *runtime.Pager[MachineGraphAssessmentOptionsOperationsClientListByParentResponse] { + return runtime.NewPager(runtime.PagingHandler[MachineGraphAssessmentOptionsOperationsClientListByParentResponse]{ + More: func(page MachineGraphAssessmentOptionsOperationsClientListByParentResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *MachineGraphAssessmentOptionsOperationsClientListByParentResponse) (MachineGraphAssessmentOptionsOperationsClientListByParentResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MachineGraphAssessmentOptionsOperationsClient.NewListByParentPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByParentCreateRequest(ctx, resourceGroupName, projectName, options) + }, nil) + if err != nil { + return MachineGraphAssessmentOptionsOperationsClientListByParentResponse{}, err + } + return client.listByParentHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByParentCreateRequest creates the ListByParent request. +func (client *MachineGraphAssessmentOptionsOperationsClient) listByParentCreateRequest(ctx context.Context, resourceGroupName string, projectName string, _ *MachineGraphAssessmentOptionsOperationsClientListByParentOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessmentOptions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-03-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByParentHandleResponse handles the ListByParent response. +func (client *MachineGraphAssessmentOptionsOperationsClient) listByParentHandleResponse(resp *http.Response) (MachineGraphAssessmentOptionsOperationsClientListByParentResponse, error) { + result := MachineGraphAssessmentOptionsOperationsClientListByParentResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MachineGraphAssessmentOptionsListResult); err != nil { + return MachineGraphAssessmentOptionsOperationsClientListByParentResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/machinegraphassessmentoptionsoperations_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/machinegraphassessmentoptionsoperations_client_example_test.go new file mode 100644 index 000000000000..5f5330a352f5 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/machinegraphassessmentoptionsoperations_client_example_test.go @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armmigrate_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "log" +) + +// Generated from example definition: 2024-03-03-preview/MachineGraphAssessmentOptionsOperations_Get_MaximumSet_Gen.json +func ExampleMachineGraphAssessmentOptionsOperationsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmigrate.NewClientFactory("AEDD0824-BBE9-4E7C-8909-F46C68EA6BB9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewMachineGraphAssessmentOptionsOperationsClient().Get(ctx, "rgmachineAssessments", "contosoProject", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armmigrate.MachineGraphAssessmentOptionsOperationsClientGetResponse{ + // MachineGraphAssessmentOptions: &armmigrate.MachineGraphAssessmentOptions{ + // Properties: &armmigrate.MachineGraphAssessmentOptionsProperties{ + // Edges: map[string]*armmigrate.MachineAssessmentOptionsOutboundEdgeGroup{ + // "key1407": &armmigrate.MachineAssessmentOptionsOutboundEdgeGroup{ + // AzureVMFamilies: []*armmigrate.AzureVMFamily{ + // to.Ptr(armmigrate.AzureVMFamilyUnknown), + // }, + // AzureVMFamilyCategories: []*armmigrate.VMFamilyCategoryItem{ + // to.Ptr(armmigrate.VMFamilyCategoryItemUnknown), + // }, + // PremiumDiskSupport: []*armmigrate.PremiumDiskSupport{ + // to.Ptr(armmigrate.PremiumDiskSupportPremiumDiskSupported), + // }, + // UltraDiskSupport: []*armmigrate.UltraDiskSupport{ + // to.Ptr(armmigrate.UltraDiskSupportUltraDiskSupported), + // }, + // TargetLocations: []*armmigrate.AzureLocation{ + // to.Ptr(armmigrate.AzureLocationUnknown), + // }, + // Currencies: []*armmigrate.AzureCurrency{ + // to.Ptr(armmigrate.AzureCurrencyUnknown), + // }, + // SavingsOptions: []*armmigrate.SavingsOptions{ + // to.Ptr(armmigrate.SavingsOptions("Unknown")), + // }, + // AzureOfferCode: []*armmigrate.AzureOffer{ + // to.Ptr(armmigrate.AzureOfferUnknown), + // }, + // LicensingProgram: []*armmigrate.LicensingProgram{ + // to.Ptr(armmigrate.LicensingProgram("Pay-As-You-Go")), + // }, + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/AEDD0824-BBE9-4E7C-8909-F46C68EA6BB9/resourceGroups/rgsqlAssessments/providers/Microsoft.Migrate/assessmentProjects/contosoProject/assessmentOptions/default"), + // Name: to.Ptr("assessmentOptions"), + // Type: to.Ptr("Microsoft.Migrate/assessmentProjects/assessmentOptions/default"), + // SystemData: &armmigrate.SystemData{ + // CreatedBy: to.Ptr("drvgxn"), + // CreatedByType: to.Ptr(armmigrate.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:25.000Z"); return t}()), + // LastModifiedBy: to.Ptr("qfyznkjasypfwyfmmkc"), + // LastModifiedByType: to.Ptr(armmigrate.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:25.000Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-03-03-preview/MachineGraphAssessmentOptionsOperations_ListByParent_MaximumSet_Gen.json +func ExampleMachineGraphAssessmentOptionsOperationsClient_NewListByParentPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmigrate.NewClientFactory("AEDD0824-BBE9-4E7C-8909-F46C68EA6BB9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewMachineGraphAssessmentOptionsOperationsClient().NewListByParentPager("rgmachineAssessments", "contosoProject", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armmigrate.MachineGraphAssessmentOptionsOperationsClientListByParentResponse{ + // MachineGraphAssessmentOptionsListResult: armmigrate.MachineGraphAssessmentOptionsListResult{ + // Value: []*armmigrate.MachineGraphAssessmentOptions{ + // { + // Properties: &armmigrate.MachineGraphAssessmentOptionsProperties{ + // Edges: map[string]*armmigrate.MachineAssessmentOptionsOutboundEdgeGroup{ + // "key1407": &armmigrate.MachineAssessmentOptionsOutboundEdgeGroup{ + // AzureVMFamilies: []*armmigrate.AzureVMFamily{ + // to.Ptr(armmigrate.AzureVMFamilyUnknown), + // }, + // AzureVMFamilyCategories: []*armmigrate.VMFamilyCategoryItem{ + // to.Ptr(armmigrate.VMFamilyCategoryItemUnknown), + // }, + // PremiumDiskSupport: []*armmigrate.PremiumDiskSupport{ + // to.Ptr(armmigrate.PremiumDiskSupportPremiumDiskSupported), + // }, + // UltraDiskSupport: []*armmigrate.UltraDiskSupport{ + // to.Ptr(armmigrate.UltraDiskSupportUltraDiskSupported), + // }, + // TargetLocations: []*armmigrate.AzureLocation{ + // to.Ptr(armmigrate.AzureLocationUnknown), + // }, + // Currencies: []*armmigrate.AzureCurrency{ + // to.Ptr(armmigrate.AzureCurrencyUnknown), + // }, + // SavingsOptions: []*armmigrate.SavingsOptions{ + // to.Ptr(armmigrate.SavingsOptions("Unknown")), + // }, + // AzureOfferCode: []*armmigrate.AzureOffer{ + // to.Ptr(armmigrate.AzureOfferUnknown), + // }, + // LicensingProgram: []*armmigrate.LicensingProgram{ + // to.Ptr(armmigrate.LicensingProgram("Pay-As-You-Go")), + // }, + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/AEDD0824-BBE9-4E7C-8909-F46C68EA6BB9/resourceGroups/rgsqlAssessments/providers/Microsoft.Migrate/assessmentProjects/contosoProject/assessmentOptions/default"), + // Name: to.Ptr("assessmentoptions"), + // Type: to.Ptr("Microsoft.Migrate/assessmentProjects/assessmentOptions/default"), + // SystemData: &armmigrate.SystemData{ + // CreatedBy: to.Ptr("drvgxn"), + // CreatedByType: to.Ptr(armmigrate.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:25.000Z"); return t}()), + // LastModifiedBy: to.Ptr("qfyznkjasypfwyfmmkc"), + // LastModifiedByType: to.Ptr(armmigrate.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T10:38:25.000Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/migrate/armmigrate/machines_client.go b/sdk/resourcemanager/migrate/armmigrate/machines_client.go deleted file mode 100644 index 5008bd92f197..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/machines_client.go +++ /dev/null @@ -1,185 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// MachinesClient contains the methods for the Machines group. -// Don't use this type directly, use NewMachinesClient() instead. -type MachinesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewMachinesClient creates a new instance of MachinesClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewMachinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MachinesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &MachinesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Get the machine with the specified name. Returns a json object of type 'machine' defined in Models section. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - machineName - Unique name of a machine in private datacenter. -// - options - MachinesClientGetOptions contains the optional parameters for the MachinesClient.Get method. -func (client *MachinesClient) Get(ctx context.Context, resourceGroupName string, projectName string, machineName string, options *MachinesClientGetOptions) (MachinesClientGetResponse, error) { - var err error - const operationName = "MachinesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, machineName, options) - if err != nil { - return MachinesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MachinesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MachinesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *MachinesClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, machineName string, options *MachinesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/machines/{machineName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if machineName == "" { - return nil, errors.New("parameter machineName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *MachinesClient) getHandleResponse(resp *http.Response) (MachinesClientGetResponse, error) { - result := MachinesClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.Machine); err != nil { - return MachinesClientGetResponse{}, err - } - return result, nil -} - -// NewListByProjectPager - Get data of all the machines available in the project. Returns a json array of objects of type -// 'machine' defined in Models section. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - MachinesClientListByProjectOptions contains the optional parameters for the MachinesClient.NewListByProjectPager -// method. -func (client *MachinesClient) NewListByProjectPager(resourceGroupName string, projectName string, options *MachinesClientListByProjectOptions) *runtime.Pager[MachinesClientListByProjectResponse] { - return runtime.NewPager(runtime.PagingHandler[MachinesClientListByProjectResponse]{ - More: func(page MachinesClientListByProjectResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *MachinesClientListByProjectResponse) (MachinesClientListByProjectResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MachinesClient.NewListByProjectPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) - }, nil) - if err != nil { - return MachinesClientListByProjectResponse{}, err - } - return client.listByProjectHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByProjectCreateRequest creates the ListByProject request. -func (client *MachinesClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *MachinesClientListByProjectOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/machines" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByProjectHandleResponse handles the ListByProject response. -func (client *MachinesClient) listByProjectHandleResponse(resp *http.Response) (MachinesClientListByProjectResponse, error) { - result := MachinesClientListByProjectResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.MachineResultList); err != nil { - return MachinesClientListByProjectResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/machines_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/machines_client_example_test.go deleted file mode 100644 index 64549afab5ce..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/machines_client_example_test.go +++ /dev/null @@ -1,174 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Machines_ListByProject.json -func ExampleMachinesClient_NewListByProjectPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMachinesClient().NewListByProjectPager("abgoyal-westEurope", "abgoyalWEselfhostb72bproject", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MachineResultList = armmigrate.MachineResultList{ - // Value: []*armmigrate.Machine{ - // { - // Name: to.Ptr("269ef295-a38d-4f8f-9779-77ce79088311"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/machines"), - // ETag: to.Ptr("\"04006052-0000-0d00-0000-5cd4065a0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/machines/269ef295-a38d-4f8f-9779-77ce79088311"), - // Properties: &armmigrate.MachineProperties{ - // Description: to.Ptr("Microsoft Azure Migration Image on Windows Server 2016"), - // BootType: to.Ptr(armmigrate.MachineBootTypeBIOS), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T09:58:22.173Z"); return t}()), - // DatacenterManagementServerArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.OffAzure/VMwareSites/PortalvCenterbc2fsite/vcenters/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3"), - // DatacenterManagementServerName: to.Ptr("IDCLAB-A360.fareast.corp.microsoft.com"), - // DiscoveryMachineArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.offazure/vmwaresites/portalvcenterbc2fsite/machines/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_52bd4eeb-faf4-7d95-4dd5-5524350ce2bb"), - // Disks: map[string]*armmigrate.Disk{ - // "6000C29f-9065-8fe0-ab83-7e58ff6ba442": &armmigrate.Disk{ - // DisplayName: to.Ptr("scsi0:0"), - // GigabytesAllocated: to.Ptr[float64](80), - // }, - // }, - // DisplayName: to.Ptr("ShubhamFirstAndThird"), - // Groups: []*string{ - // to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/test1")}, - // MegabytesOfMemory: to.Ptr[float32](16384), - // NetworkAdapters: map[string]*armmigrate.NetworkAdapter{ - // "4000": &armmigrate.NetworkAdapter{ - // DisplayName: to.Ptr("VM Network"), - // IPAddresses: []*string{ - // }, - // MacAddress: to.Ptr("00:0c:29:ac:e3:6d"), - // }, - // }, - // NumberOfCores: to.Ptr[int32](8), - // OperatingSystemName: to.Ptr("Microsoft Windows Server 2016 (64-bit)"), - // OperatingSystemType: to.Ptr("windowsGuest"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T09:58:22.299Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("3ad6c8b7-08d6-45dc-87f5-cd533501f553"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/machines"), - // ETag: to.Ptr("\"04005652-0000-0d00-0000-5cd4065a0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/machines/3ad6c8b7-08d6-45dc-87f5-cd533501f553"), - // Properties: &armmigrate.MachineProperties{ - // Description: to.Ptr("Microsoft Azure Migration Image on Windows Server 2016"), - // BootType: to.Ptr(armmigrate.MachineBootTypeBIOS), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T09:58:22.173Z"); return t}()), - // DatacenterManagementServerArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.OffAzure/VMwareSites/PortalvCenterbc2fsite/vcenters/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3"), - // DatacenterManagementServerName: to.Ptr("IDCLAB-A360.fareast.corp.microsoft.com"), - // DiscoveryMachineArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.offazure/vmwaresites/portalvcenterbc2fsite/machines/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_52e5be9c-2758-a483-c252-eeef7919095c"), - // Disks: map[string]*armmigrate.Disk{ - // "6000C296-54c9-e29c-51be-125e76850958": &armmigrate.Disk{ - // DisplayName: to.Ptr("scsi0:0"), - // GigabytesAllocated: to.Ptr[float64](80), - // }, - // }, - // DisplayName: to.Ptr("shsinglaVM5"), - // Groups: []*string{ - // to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/test1")}, - // MegabytesOfMemory: to.Ptr[float32](16384), - // NetworkAdapters: map[string]*armmigrate.NetworkAdapter{ - // "4000": &armmigrate.NetworkAdapter{ - // DisplayName: to.Ptr("VM Network"), - // IPAddresses: []*string{ - // }, - // MacAddress: to.Ptr("00:0c:29:1f:ac:0a"), - // }, - // }, - // NumberOfCores: to.Ptr[int32](8), - // OperatingSystemName: to.Ptr("Microsoft Windows Server 2016 (64-bit)"), - // OperatingSystemType: to.Ptr("windowsGuest"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T09:58:22.314Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Machines_Get.json -func ExampleMachinesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMachinesClient().Get(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "269ef295-a38d-4f8f-9779-77ce79088311", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Machine = armmigrate.Machine{ - // Name: to.Ptr("269ef295-a38d-4f8f-9779-77ce79088311"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/machines"), - // ETag: to.Ptr("\"04006052-0000-0d00-0000-5cd4065a0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/machines/269ef295-a38d-4f8f-9779-77ce79088311"), - // Properties: &armmigrate.MachineProperties{ - // Description: to.Ptr("Microsoft Azure Migration Image on Windows Server 2016"), - // BootType: to.Ptr(armmigrate.MachineBootTypeBIOS), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T09:58:22.173Z"); return t}()), - // DatacenterManagementServerArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.OffAzure/VMwareSites/PortalvCenterbc2fsite/vcenters/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3"), - // DatacenterManagementServerName: to.Ptr("IDCLAB-A360.fareast.corp.microsoft.com"), - // DiscoveryMachineArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.offazure/vmwaresites/portalvcenterbc2fsite/machines/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_52bd4eeb-faf4-7d95-4dd5-5524350ce2bb"), - // Disks: map[string]*armmigrate.Disk{ - // "6000C29f-9065-8fe0-ab83-7e58ff6ba442": &armmigrate.Disk{ - // DisplayName: to.Ptr("scsi0:0"), - // GigabytesAllocated: to.Ptr[float64](80), - // }, - // }, - // DisplayName: to.Ptr("ShubhamFirstAndThird"), - // Groups: []*string{ - // to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/test1")}, - // MegabytesOfMemory: to.Ptr[float32](16384), - // NetworkAdapters: map[string]*armmigrate.NetworkAdapter{ - // "4000": &armmigrate.NetworkAdapter{ - // DisplayName: to.Ptr("VM Network"), - // IPAddresses: []*string{ - // }, - // MacAddress: to.Ptr("00:0c:29:ac:e3:6d"), - // }, - // }, - // NumberOfCores: to.Ptr[int32](8), - // OperatingSystemName: to.Ptr("Microsoft Windows Server 2016 (64-bit)"), - // OperatingSystemType: to.Ptr("windowsGuest"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T09:58:22.299Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/models.go b/sdk/resourcemanager/migrate/armmigrate/models.go index 8b49a68aebd1..ed88c777fdf3 100644 --- a/sdk/resourcemanager/migrate/armmigrate/models.go +++ b/sdk/resourcemanager/migrate/armmigrate/models.go @@ -1,892 +1,928 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmigrate import "time" -// AssessedDisk - A disk assessed for an assessment. -type AssessedDisk struct { - // READ-ONLY; User friendly name of the assessed disk. - DisplayName *string +// AssessedDiskDataV3 - Assessed disk data for normalized contract. +type AssessedDiskDataV3 struct { + // Gets the gigabytes provisioned. + GigabytesProvisioned *float32 - // READ-ONLY; Gigabytes of storage provided by the recommended Azure disk size. - GigabytesForRecommendedDiskSize *int32 + // Gets the megabytes per second of read. + MegabytesPerSecondOfRead *float32 - // READ-ONLY; Gigabytes of storage provisioned for this disk. - GigabytesProvisioned *float64 + // Gets the megabytes per second of write. + MegabytesPerSecondOfWrite *float32 - // READ-ONLY; Disk throughput in MegaBytes per second. - MegabytesPerSecondOfRead *float64 + // Gets the number of read operations per second. + NumberOfReadOperationsPerSecond *float32 - // READ-ONLY; Disk throughput in MegaBytes per second. - MegabytesPerSecondOfWrite *float64 + // Gets the number of write operations per second. + NumberOfWriteOperationsPerSecond *float32 - // READ-ONLY; Estimated aggregate storage cost for a 31-day month for this disk. - MonthlyStorageCost *float64 + // READ-ONLY; The disk display name. + DisplayName *string - // READ-ONLY; Name of the assessed disk. + // READ-ONLY; The disk name. Name *string +} - // READ-ONLY; Number of read operations per second for the disk. - NumberOfReadOperationsPerSecond *float64 +// AssessedMachineExtendedDetails - The assessed machine extended details. +type AssessedMachineExtendedDetails struct { + // Gets or sets the processor details of the host. + HostProcessor *ProcessorInfo - // READ-ONLY; Number of read and write operations per second for the disk. - NumberOfWriteOperationsPerSecond *float64 + // READ-ONLY; Assessed machine type. + AssessedMachineType *AssessedMachineType - // READ-ONLY; Recommended Azure size for the disk, given utilization data and preferences set on Assessment. - RecommendedDiskSize *AzureDiskSize + // READ-ONLY; Boot type of machine discovered in private data center. + BootType *MachineBootType - // READ-ONLY; Storage type selected for this disk. - RecommendedDiskType *AzureDiskType + // READ-ONLY; Description for the machine. + Description *string - // READ-ONLY; Whether this disk is suitable for Azure. - Suitability *CloudSuitability + // READ-ONLY; Dictionary of disks attached to the machine. Key is ID of disk. Value is a disk object. + Disks []*AssessedDiskDataV3 - // READ-ONLY; If disk is suitable to be migrate but some conditions/checks were not considered while calculating suitability, - // this explains the details. - SuitabilityDetail *AzureDiskSuitabilityDetail + // READ-ONLY; Display Name of the Machine. + DisplayName *string - // READ-ONLY; If disk is not suitable to be migrated, this explains the reasons and mitigation steps. - SuitabilityExplanation *AzureDiskSuitabilityExplanation -} + // READ-ONLY; List of errors for this machine. + Errors []*Error -// AssessedMachine - A machine evaluated as part of an assessment. -type AssessedMachine struct { - // For optimistic concurrency control. - ETag *string + // READ-ONLY; Megabytes of memory found allocated for the machine in private data center. + MegabytesOfMemory *float32 - // Properties of an assessed machine. - Properties *AssessedMachineProperties + // READ-ONLY; List of Network Adapters that were assessed as part of this machine's + // assessment. + NetworkAdapters []*AssessedMachineNetworkAdaptersV3 - // READ-ONLY; Path reference to this assessed machine. - // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}/assessedMachines/{assessedMachineName} - ID *string + // READ-ONLY; Number of CPU cores found on the machine. + NumberOfCores *int32 - // READ-ONLY; Name of the machine. - Name *string + // READ-ONLY; Operating system architecture as reported by datacenter management solution. + OperatingSystemArchitecture *GuestOperatingSystemArchitecture - // READ-ONLY; Type of the object = [Microsoft.Migrate/assessmentProjects/groups/assessments/assessedMachines]. - Type *string -} + // READ-ONLY; Operating system as reported by datacenter management solution. + OperatingSystemName *string -// AssessedMachineProperties - Properties of an assessed machine. -type AssessedMachineProperties struct { - // READ-ONLY; Boot type of the machine. - BootType *MachineBootType + // READ-ONLY; Operating system as reported by datacenter management solution. + OperatingSystemType *string - // READ-ONLY; Confidence rating of assessed machine. - ConfidenceRatingInPercentage *float64 + // READ-ONLY; Operating system version as reported by datacenter management solution. + OperatingSystemVersion *string - // READ-ONLY; Time when this machine was created. Date-Time represented in ISO-8601 format. - CreatedTimestamp *time.Time + // READ-ONLY; Percentile of Percentage of Cores Utilized noted during time period T. + // Here N and T are settings on Assessment. + PercentageCoresUtilization *float32 + + // READ-ONLY; Percentile of Percentage of Memory Utilized noted during time period T. + // Here N and T are settings on Assessment. + PercentageMemoryUtilization *float32 - // READ-ONLY; ARM ID of the discovered machine. - DatacenterMachineArmID *string + // READ-ONLY; Gets the product support status related details. + ProductSupportStatus *ProductSupportStatus +} - // READ-ONLY; ARM ID of the discovered datacenter. - DatacenterManagementServerArmID *string +// AssessedMachineNetworkAdaptersV3 - Assessed network adapter data for normalized contract for sql machines. +type AssessedMachineNetworkAdaptersV3 struct { + // Gets the mac address. + MacAddress *string - // READ-ONLY; Name of the server hosting the datacenter management solution. - DatacenterManagementServerName *string + // Gets the megabytes per second received. + MegabytesPerSecondRecieved *float32 - // READ-ONLY; Description of the machine - Description *string + // Gets the megabytes per second transmitted. + MegabytesPerSecondTransmitted *float32 - // READ-ONLY; Dictionary of disks attached to the machine. Key is ID of disk. Value is a disk object. - Disks map[string]*AssessedDisk + // Gets the net gigabytes transmitted per month. + NetGigabytesTransmittedPerMonth *float32 - // READ-ONLY; User readable name of the machine as defined by the user in their private datacenter. + // READ-ONLY; Display Name of the Machine. DisplayName *string - // READ-ONLY; Memory in Megabytes. - MegabytesOfMemory *float64 + // READ-ONLY; Gets the ip addresses. + IPAddresses []*string - // READ-ONLY; Megabytes of memory in the Recommended Azure VM Size. - MegabytesOfMemoryForRecommendedSize *float64 + // READ-ONLY; The disk name. + Name *string +} - // READ-ONLY; Monthly network cost estimate for the network adapters that are attached to this machine as a group, for a 31-day - // month. - MonthlyBandwidthCost *float64 +// AssessedMachineV2 - Machine assessment V2 Assessed Machine resource. +type AssessedMachineV2 struct { + // The resource-specific properties for this resource. + Properties *AssessedMachineV2Properties - // READ-ONLY; Compute Cost for a 31-day month, if the machine is migrated to Azure with the Recommended Size. - MonthlyComputeCostForRecommendedSize *float64 + // READ-ONLY; Machine assessment V2 Assessed Machine ARM name + Name *string - // READ-ONLY; Monthly premium storage cost estimate for the disks that are attached to this machine as a group, for a 31-day - // month. - MonthlyPremiumStorageCost *float64 + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // READ-ONLY; Monthly standard SSD storage cost estimate for the disks that are attached to this machine as a group, for a - // 31-day month. - MonthlyStandardSSDStorageCost *float64 + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; Monthly storage cost estimate for the disks that are attached to this machine as a group, for a 31-day month. - MonthlyStorageCost *float64 + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} - // READ-ONLY; Dictionary of network adapters attached to the machine. Key is name of the adapter. Value is a network adapter - // object. - NetworkAdapters map[string]*AssessedNetworkAdapter +// AssessedMachineV2ListResult - The response of a AssessedMachineV2 list operation. +type AssessedMachineV2ListResult struct { + // REQUIRED; The AssessedMachineV2 items on this page + Value []*AssessedMachineV2 - // READ-ONLY; Processor count. - NumberOfCores *int32 + // The link to the next page of items + NextLink *string +} - // READ-ONLY; Number of CPU cores in the Recommended Azure VM Size. - NumberOfCoresForRecommendedSize *int32 +// AssessedMachineV2Properties - Assessed machine properties class. +type AssessedMachineV2Properties struct { + // READ-ONLY; When was machine first created. + CreatedTimestamp *time.Time - // READ-ONLY; Operating System name of the machine. - OperatingSystemName *string + // READ-ONLY; The assessed machine extended details. + ExtendedDetails *AssessedMachineExtendedDetails - // READ-ONLY; Operating System type of the machine. - OperatingSystemType *string + // READ-ONLY; The linkages list. + Linkages []*Linkages - // READ-ONLY; Operating System version of the machine. - OperatingSystemVersion *string + // READ-ONLY; The recommendation list. + Recommendations []*MachineAssessmentRecommendation - // READ-ONLY; Utilization percentage of the processor core as observed in the private data center, in the Time Range selected - // on Assessment, reported as the Percentile value based on the percentile number selected - // in assessment. - PercentageCoresUtilization *float64 + // READ-ONLY; When was machine last updated. + UpdatedTimestamp *time.Time - // READ-ONLY; Utilization percentage of the memory as observed in the private data center, in the Time Range selected on Assessment, - // reported as the Percentile value based on the percentile number selected in - // assessment. - PercentageMemoryUtilization *float64 + // READ-ONLY; The workload type + WorkloadType *WorkloadType +} - // READ-ONLY; Recommended Azure size for this machine. - RecommendedSize *AzureVMSize +// AssessmentDetails - Assessment details class. +type AssessmentDetails struct { + // READ-ONLY; Confidence Rating in Percentage. + ConfidenceRatingInPercentage *float32 - // READ-ONLY; Whether machine is suitable for migration to Azure. - Suitability *CloudSuitability + // READ-ONLY; Date and Time when assessment was created. + CreatedTimestamp *time.Time - // READ-ONLY; If machine is not suitable for cloud, this explains the reasons. - SuitabilityDetail *AzureVMSuitabilityDetail + // READ-ONLY; Last time when rates were queried. + PricesTimestamp *time.Time - // READ-ONLY; If machine is not ready to be migrated, this explains the reasons and mitigation steps. - SuitabilityExplanation *AzureVMSuitabilityExplanation + // READ-ONLY; Whether assessment is in valid state and all machines have been assessed. + Status *AssessmentStatus - // READ-ONLY; Time when this machine was last updated. Date-Time represented in ISO-8601 format. + // READ-ONLY; Date and Time when assessment was last updated. UpdatedTimestamp *time.Time } -// AssessedMachineResultList - List of assessed machines. -type AssessedMachineResultList struct { - NextLink *string +// BillingSettings - Billing settings class. +type BillingSettings struct { + // Gets or sets the licensing program. + LicensingProgram *LicensingProgram - // List of assessed machines. - Value []*AssessedMachine + // Gets or sets the subscription ID for licensing program selected. + SubscriptionID *string } -// AssessedNetworkAdapter - A network adapter assessed for an assessment. -type AssessedNetworkAdapter struct { - // Gigabytes transmitted through this adapter each month. - NetGigabytesTransmittedPerMonth *float64 - - // READ-ONLY; User friendly name of the assessed network adapter. - DisplayName *string - - // READ-ONLY; List of IP Addresses on the network adapter. - IPAddresses []*string - - // READ-ONLY; MAC Address of the network adapter. - MacAddress *string - - // READ-ONLY; Adapter throughput for incoming traffic in MegaBytes per second. - MegabytesPerSecondReceived *float64 +// Configuration details. +type Configuration struct { + // READ-ONLY; The azure target. + AzureTarget *AzureTarget - // READ-ONLY; Adapter throughput for outgoing traffic in MegaBytes per second. - MegabytesPerSecondTransmitted *float64 + // READ-ONLY; The azure target. + SizingCriterion *AssessmentSizingCriterion +} - // READ-ONLY; Monthly cost estimate for network bandwidth used by this network adapter. - MonthlyBandwidthCosts *float64 +// CostDetailsCommon - The cost details. +type CostDetailsCommon struct { + // READ-ONLY; The sku cost details per azure offer type. + CostDetail []*NameValuePairCostType - // READ-ONLY; Whether this adapter is suitable for Azure. - Suitability *CloudSuitability + // READ-ONLY; The savings options. + SavingOptions *SavingsOptions +} - // READ-ONLY; If network adapter is not suitable for cloud, this explains the reasons. - SuitabilityDetail *AzureNetworkAdapterSuitabilityDetail +// DownloadURL - Data model of Download URL for assessment report. +type DownloadURL struct { + // READ-ONLY; Hyperlink to download report. + AssessmentReportURL *string - // READ-ONLY; If network adapter is suitable, this explains the reasons and mitigation steps. - SuitabilityExplanation *AzureNetworkAdapterSuitabilityExplanation + // READ-ONLY; Expiry date of download url. + ExpirationTime *time.Time } -// Assessment - An assessment created for a group in the Migration project. -type Assessment struct { - // REQUIRED; Properties of the assessment. - Properties *AssessmentProperties +type DownloadURLRequest struct { +} - // For optimistic concurrency control. - ETag *string +// Error web model class. +type Error struct { + // READ-ONLY; Gets the agent scenario where this error occurred. + AgentScenario *string - // READ-ONLY; Path reference to this assessment. - // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessment/{assessmentName} - ID *string + // READ-ONLY; Gets the Appliance name. + ApplianceName *string - // READ-ONLY; Unique name of an assessment. - Name *string + // READ-ONLY; Gets the error code. + Code *string - // READ-ONLY; Type of the object = [Microsoft.Migrate/assessmentProjects/groups/assessments]. - Type *string -} + // READ-ONLY; Gets the error ID. + ID *int32 -// AssessmentOptions - Assessment options. -type AssessmentOptions struct { - // REQUIRED; Properties of the assessment options. - Properties *AssessmentOptionsProperties + // READ-ONLY; Gets the type of assessment impacted by this error. + ImpactedAssessmentType *string - // READ-ONLY; Unique identifier of an assessment options. - ID *string + // READ-ONLY; Gets the error message. + Message *string - // READ-ONLY; Unique name of an assessment options. - Name *string -} + // READ-ONLY; Gets the error message parameters. + MessageParameters []*NameValuePair -// AssessmentOptionsProperties - Assessment options properties. -type AssessmentOptionsProperties struct { - // READ-ONLY; List of supported currencies for reserved instances. - ReservedInstanceSupportedCurrencies []*string + // READ-ONLY; Gets the error possible causes. + PossibleCauses *string - // READ-ONLY; List of supported Azure regions for reserved instances. - ReservedInstanceSupportedLocations []*string + // READ-ONLY; Gets the recommended action for the error. + RecommendedAction *string - // READ-ONLY; List of supported Azure offer codes for reserved instances. - ReservedInstanceSupportedOffers []*string + // READ-ONLY; Gets the Run as account ID. + RunAsAccountID *string - // READ-ONLY; List of supported VM Families. - ReservedInstanceVMFamilies []*string + // READ-ONLY; Gets the error severity. + Severity *string - // READ-ONLY; Dictionary of VM families grouped by vm family name describing the targeted azure locations of VM family and - // the category of the family. - VMFamilies []*VMFamily -} + // READ-ONLY; Gets the error summary message. + SummaryMessage *string -// AssessmentOptionsResultList - List of API operations. -type AssessmentOptionsResultList struct { - // List of operations. - Value []*AssessmentOptions + // READ-ONLY; Gets the time stamp when the error was updated. + UpdatedTimeStamp *time.Time } -// AssessmentProperties - Properties of an assessment. -type AssessmentProperties struct { - // REQUIRED; Storage type selected for this disk. - AzureDiskType *AzureDiskType +// Linkages details +type Linkages struct { + // READ-ONLY; The arm id. + ArmID *string - // REQUIRED; AHUB discount on windows virtual machines. - AzureHybridUseBenefit *AzureHybridUseBenefit + // READ-ONLY; The linkage kind. + Kind *LinkageKind - // REQUIRED; Target Azure location for which the machines should be assessed. These enums are the same as used by Compute - // API. - AzureLocation *AzureLocation + // READ-ONLY; The linkage type. + LinkageType *LinkageType - // REQUIRED; Offer code according to which cost estimation is done. - AzureOfferCode *AzureOfferCode + // READ-ONLY; The workload name + WorkloadName *string +} - // REQUIRED; Pricing tier for Size evaluation. - AzurePricingTier *AzurePricingTier +// MachineAssessmentOptionsOutboundEdgeGroup - A class that represents the outbound edges from a given node. +type MachineAssessmentOptionsOutboundEdgeGroup struct { + // REQUIRED; Gets or sets the Azure Offer Code. + AzureOfferCode []*AzureOffer - // REQUIRED; Storage Redundancy type offered by Azure. - AzureStorageRedundancy *AzureStorageRedundancy - - // REQUIRED; List of azure VM families. + // REQUIRED; Gets or sets the Azure VM families. AzureVMFamilies []*AzureVMFamily - // REQUIRED; Currency to report prices in. - Currency *Currency - - // REQUIRED; Custom discount percentage to be applied on final costs. Can be in the range [0, 100]. - DiscountPercentage *float64 - - // REQUIRED; Percentile of performance data used to recommend Azure size. - Percentile *Percentile + // REQUIRED; Gets or sets the Azure VM family categories. + AzureVMFamilyCategories []*VMFamilyCategoryItem - // REQUIRED; Azure reserved instance. - ReservedInstance *ReservedInstance + // REQUIRED; Gets or sets the Azure VM security options. + AzureVMSecurityOptions []*AzureVMSecurityType - // REQUIRED; Scaling factor used over utilization data to add a performance buffer for new machines to be created in Azure. - // Min Value = 1.0, Max value = 1.9, Default = 1.3. - ScalingFactor *float64 + // REQUIRED; Gets or sets the Azure Currency. + Currencies []*AzureCurrency - // REQUIRED; Assessment sizing criterion. - SizingCriterion *AssessmentSizingCriterion + // REQUIRED; Gets or sets the Licensing Program. + LicensingProgram []*LicensingProgram - // REQUIRED; User configurable setting that describes the status of the assessment. - Stage *AssessmentStage + // REQUIRED; Gets or sets the premium disk support. + PremiumDiskSupport []*PremiumDiskSupport - // REQUIRED; Time range of performance data used to recommend a size. - TimeRange *TimeRange + // REQUIRED; Gets or sets the Assessment Savings Options. + SavingsOptions []*SavingsOptions - // REQUIRED; Specify the duration for which the VMs are up in the on-premises environment. - VMUptime *VMUptime + // REQUIRED; Gets or sets the Azure Locations. + TargetLocations []*AzureLocation - // READ-ONLY; Confidence rating percentage for assessment. Can be in the range [0, 100]. - ConfidenceRatingInPercentage *float64 - - // READ-ONLY; Time when this project was created. Date-Time represented in ISO-8601 format. - CreatedTimestamp *time.Time + // REQUIRED; Gets or sets the premium disk support. + UltraDiskSupport []*UltraDiskSupport +} - // READ-ONLY; Enterprise agreement subscription arm id. - EaSubscriptionID *string +// MachineAssessmentRecommendation - Machine Assessment Recommendation with additional properties. +type MachineAssessmentRecommendation struct { + // READ-ONLY; The confidence score. + ConfidenceScore *float32 - // READ-ONLY; Monthly network cost estimate for the machines that are part of this assessment as a group, for a 31-day month. - MonthlyBandwidthCost *float64 + // READ-ONLY; The configuration data. + Configuration *Configuration - // READ-ONLY; Monthly compute cost estimate for the machines that are part of this assessment as a group, for a 31-day month. - MonthlyComputeCost *float64 + // READ-ONLY; The migration issues list. + MigrationIssues []*MigrationIssues - // READ-ONLY; Monthly premium storage cost estimate for the machines that are part of this assessment as a group, for a 31-day - // month. - MonthlyPremiumStorageCost *float64 + // READ-ONLY; The migration Platform. + MigrationPlatform *MigrationPlatform - // READ-ONLY; Monthly standard SSD storage cost estimate for the machines that are part of this assessment as a group, for - // a 31-day month. - MonthlyStandardSSDStorageCost *float64 + // READ-ONLY; The migration suitability. + MigrationSuitability *MigrationSuitability - // READ-ONLY; Monthly storage cost estimate for the machines that are part of this assessment as a group, for a 31-day month. - MonthlyStorageCost *float64 + // READ-ONLY; The recommended details. + RecommendedFor *RecommendedFor - // READ-ONLY; Number of assessed machines part of this assessment. - NumberOfMachines *int32 + // READ-ONLY; Recommended security type for the VM. + RecommendedVMSecurityType *AzureVMSecurityType - // READ-ONLY; End time to consider performance data for assessment - PerfDataEndTime *time.Time + // READ-ONLY; The Skus list. + SKUs []*SKUsMigrationSuitability - // READ-ONLY; Start time to consider performance data for assessment - PerfDataStartTime *time.Time + // READ-ONLY; The security suitability. + SecuritySuitability *SecuritySuitability - // READ-ONLY; Time when the Azure Prices were queried. Date-Time represented in ISO-8601 format. - PricesTimestamp *time.Time + // READ-ONLY; The total cost details. + TotalCost []*CostDetailsCommon - // READ-ONLY; Whether the assessment has been created and is valid. - Status *AssessmentStatus + // READ-ONLY; The total cost details. + TotalSavings []*SavingsDetailsCommon - // READ-ONLY; Time when this project was last updated. Date-Time represented in ISO-8601 format. - UpdatedTimestamp *time.Time + // READ-ONLY; VM Security Suitability Results. + VMSecuritySuitabilityResults []*VMSecuritySuitability } -// AssessmentResultList - List of assessments. -type AssessmentResultList struct { - // List of assessments. - Value []*Assessment -} +// MachineAssessmentSettings - Properties of an assessment. +type MachineAssessmentSettings struct { + // The disk type for the assessment. + AzureDiskTypes []*AzureDiskType -type CollectorAgentProperties struct { - SpnDetails *CollectorBodyAgentSpnProperties + // Gets or sets the user configurable setting to display the azure hybrid use + // benefit. + AzureHybridUseBenefit *AzureHybridUseBenefit - // READ-ONLY - ID *string + // Azure Location or Azure region where to which the machines will be migrated. + AzureLocation *string - // READ-ONLY - LastHeartbeatUTC *time.Time + // Gets or sets Azure Pricing Tier - Free, Basic, etc. + AzurePricingTier *AzurePricingTier - // READ-ONLY - Version *string -} + // The azure security offering type. + AzureSecurityOfferingType *AzureSecurityOfferingType -type CollectorBodyAgentSpnProperties struct { - // Application/client Id for the service principal with which the on-premise management/data plane components would communicate - // with our Azure services. - ApplicationID *string + // Gets or sets the Azure Storage Redundancy. Example: Locally Redundant Storage. + AzureStorageRedundancy *AzureStorageRedundancy - // Intended audience for the service principal. - Audience *string + // Gets or sets the Azure VM families. + AzureVMFamilies []*AzureVMFamily - // AAD Authority URL which was used to request the token for the service principal. - Authority *string + // Gets or sets the Azure VM security options. + AzureVMSecurityOptions []*AzureVMSecurityType - // Object Id of the service principal with which the on-premise management/data plane components would communicate with our - // Azure services. - ObjectID *string + // Gets or sets the billing settings. + BillingSettings *BillingSettings - // Tenant Id for the service principal with which the on-premise management/data plane components would communicate with our - // Azure services. - TenantID *string -} + // Currency in which prices should be reported. + Currency *AzureCurrency -type CollectorProperties struct { - AgentProperties *CollectorAgentProperties + // Custom discount percentage. + DiscountPercentage *float32 - // The ARM id of the discovery service site. - DiscoverySiteID *string + // Gets or sets user configurable setting to display the environment type. + EnvironmentType *EnvironmentType - // READ-ONLY; Time when this collector was created. Date-Time represented in ISO-8601 format. - CreatedTimestamp *string + // Gets or sets the user configurable setting to display the linux azure hybrid use + // benefit. + LinuxAzureHybridUseBenefit *AzureHybridUseBenefit - // READ-ONLY; Time when this collector was updated. Date-Time represented in ISO-8601 format. - UpdatedTimestamp *string -} + // Gets or sets the performance data. + PerformanceData *PerformanceData -// Disk - A disk discovered on a machine. -type Disk struct { - // READ-ONLY; User friendly name of the disk. - DisplayName *string + // Gets or sets the savings settings. + SavingsSettings *SavingsSettings - // READ-ONLY; Gigabytes of storage provisioned for this disk. - GigabytesAllocated *float64 -} + // Percentage of buffer that user wants on performance metrics when recommending + // Azure sizes. + ScalingFactor *float32 -// DownloadURL - Download URL for assessment report. -type DownloadURL struct { - // READ-ONLY; Hyperlink to download report. - AssessmentReportURL *string + // Assessment sizing criterion. + SizingCriterion *AssessmentSizingCriterion - // READ-ONLY; Expiry date of download url. - ExpirationTime *time.Time + // Gets or sets the duration for which the VMs are up in the on-premises + // environment. + VMUptime *VMUptime } -// Group - A group created in a Migration project. -type Group struct { - // REQUIRED; Properties of the group. - Properties *GroupProperties +// MachineAssessmentV2 - Machine assessment V2 resource. +type MachineAssessmentV2 struct { + // The resource-specific properties for this resource. + Properties *MachineAssessmentV2Properties - // For optimistic concurrency control. - ETag *string + // READ-ONLY; Machine Assessment V2 ARM name + Name *string - // READ-ONLY; Path reference to this group. /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName} + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Name of the group. - Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; Type of the object = [Microsoft.Migrate/assessmentProjects/groups]. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// GroupBodyProperties - Body properties of group update. -type GroupBodyProperties struct { - // List of machine names that are part of this group. - Machines []*string +// MachineAssessmentV2ListResult - The response of a MachineAssessmentV2 list operation. +type MachineAssessmentV2ListResult struct { + // REQUIRED; The MachineAssessmentV2 items on this page + Value []*MachineAssessmentV2 - // Whether to add or remove the machines. - OperationType *GroupUpdateOperation + // The link to the next page of items + NextLink *string } -// GroupProperties - Properties of group resource. -type GroupProperties struct { - // The type of group. - GroupType *string - - // READ-ONLY; If the assessments are in running state. - AreAssessmentsRunning *bool +// MachineAssessmentV2Properties - Assessment properties class. +type MachineAssessmentV2Properties struct { + // Gets or sets the details of the assessment. + Details *AssessmentDetails - // READ-ONLY; List of References to Assessments created on this group. - Assessments []*string + // Gets or sets the scope of assessment. + Scope *Scope - // READ-ONLY; Time when this group was created. Date-Time represented in ISO-8601 format. - CreatedTimestamp *time.Time + // Gets or sets the settings for the assessment. + Settings *MachineAssessmentSettings - // READ-ONLY; Whether the group has been created and is valid. - GroupStatus *GroupStatus - - // READ-ONLY; Number of machines part of this group. - MachineCount *int32 - - // READ-ONLY; Time when this group was last updated. Date-Time represented in ISO-8601 format. - UpdatedTimestamp *time.Time + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState } -// GroupResultList - List of groups. -type GroupResultList struct { - // List of groups. - Value []*Group -} +// MachineAssessmentV2Summary - Machine Assessment REST resource. +type MachineAssessmentV2Summary struct { + // The resource-specific properties for this resource. + Properties *SummaryProperties -type HyperVCollector struct { - ETag *string - Properties *CollectorProperties + // READ-ONLY; Gets the Name of the Machine Summary. + Name *string - // READ-ONLY + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY - Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// HyperVCollectorList - List of Hyper-V collectors. -type HyperVCollectorList struct { - // List of Hyper-V collectors. - Value []*HyperVCollector +// MachineAssessmentV2SummaryListResult - The response of a MachineAssessmentV2Summary list operation. +type MachineAssessmentV2SummaryListResult struct { + // REQUIRED; The MachineAssessmentV2Summary items on this page + Value []*MachineAssessmentV2Summary + + // The link to the next page of items + NextLink *string } -type ImportCollector struct { - ETag *string - Properties *ImportCollectorProperties +// MachineGraphAssessmentOptions - Machine Assessment REST resource. +type MachineGraphAssessmentOptions struct { + // The resource-specific properties for this resource. + Properties *MachineGraphAssessmentOptionsProperties + + // READ-ONLY; Machine Assessment options. + Name *string - // READ-ONLY + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY - Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// ImportCollectorList - List of Import collectors. -type ImportCollectorList struct { - // List of Import collectors. - Value []*ImportCollector -} - -type ImportCollectorProperties struct { - DiscoverySiteID *string +// MachineGraphAssessmentOptionsListResult - The response of a MachineGraphAssessmentOptions list operation. +type MachineGraphAssessmentOptionsListResult struct { + // REQUIRED; The MachineGraphAssessmentOptions items on this page + Value []*MachineGraphAssessmentOptions - // READ-ONLY - CreatedTimestamp *string - - // READ-ONLY - UpdatedTimestamp *string + // The link to the next page of items + NextLink *string } -// Machine - A machine in a migration project. -type Machine struct { - // For optimistic concurrency control. - ETag *string - - // Properties of the machine. - Properties *MachineProperties - - // READ-ONLY; Path reference to this machine. /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/machines/{machineName} - ID *string +// MachineGraphAssessmentOptionsProperties - The properties of the assessment options. +type MachineGraphAssessmentOptionsProperties struct { + // REQUIRED; Gets or sets the edges. + Edges map[string]*MachineAssessmentOptionsOutboundEdgeGroup +} - // READ-ONLY; Name of the machine. It is a GUID which is unique identifier of machine in private data center. For user-readable - // name, we have a displayName property on this machine. - Name *string +// ManagementDetails - Management details. +type ManagementDetails struct { + // READ-ONLY; The management summary name. + Name *AzureManagementOfferingType - // READ-ONLY; Type of the object = [Microsoft.Migrate/assessmentProjects/machines]. - Type *string + // READ-ONLY; The management suitability summary. + ReadinessSummary []*NameValuePairCloudSuitabilityCommon } -// MachineProperties - Properties of a machine. -type MachineProperties struct { - // READ-ONLY; Boot type of the machine. - BootType *MachineBootType - - // READ-ONLY; Time when this machine was created. Date-Time represented in ISO-8601 format. - CreatedTimestamp *time.Time +// MigrationDetails - Migration details. +type MigrationDetails struct { + // READ-ONLY; The migration type + MigrationType *MigrationType - // READ-ONLY; ARM ID of the data center as tracked by the Microsoft.OffAzure. - DatacenterManagementServerArmID *string + // READ-ONLY; The readiness summary. + ReadinessSummary []*NameValuePairCloudSuitabilityCommon +} - // READ-ONLY; Name of the server hosting the datacenter management solution. - DatacenterManagementServerName *string +// MigrationIssues - Migration issues. +type MigrationIssues struct { + // READ-ONLY; The issue category. + IssueCategory *MigrationIssuesCategory - // READ-ONLY; Description of the machine - Description *string + // READ-ONLY; The issue id. + IssueCode *string - // READ-ONLY; ARM ID of the machine as tracked by the Microsoft.OffAzure. - DiscoveryMachineArmID *string + // READ-ONLY; The issue description. + IssueDescription *string - // READ-ONLY; Dictionary of disks attached to the machine. Key is ID of disk. Value is a disk object - Disks map[string]*Disk + // READ-ONLY; The more information list. + MoreInformation []*MoreInformation - // READ-ONLY; User readable name of the machine as defined by the user in their private datacenter. - DisplayName *string + // READ-ONLY; The possible causes. + PossibleCause *string - // READ-ONLY; List of references to the groups that the machine is member of. - Groups []*string + // READ-ONLY; The recommended action. + RecommendedActions []*string +} - // READ-ONLY; Memory in Megabytes. - MegabytesOfMemory *float32 +// MigrationSuitability - The migration suitability. +type MigrationSuitability struct { + // READ-ONLY; The migration suitability. + Readiness *CloudSuitabilityCommon +} - // READ-ONLY; Dictionary of network adapters attached to the machine. Key is ID of network adapter. Value is a network adapter - // object - NetworkAdapters map[string]*NetworkAdapter +// MoreInformation - More information details. +type MoreInformation struct { + // READ-ONLY; The title of the information. + Title *string - // READ-ONLY; Processor count. - NumberOfCores *int32 + // READ-ONLY; The URL of the information. + URL *string +} - // READ-ONLY; Operating System name of the machine. - OperatingSystemName *string +// NameValuePair - The generic name value pair. +type NameValuePair struct { + // READ-ONLY; The name. + Name *string - // READ-ONLY; Operating System type of the machine. - OperatingSystemType *string + // READ-ONLY; The value. + Value *string +} - // READ-ONLY; Operating System version of the machine. - OperatingSystemVersion *string +// NameValuePairCloudSuitabilityCommon - The generic name value pair. +type NameValuePairCloudSuitabilityCommon struct { + // READ-ONLY; The name. + Name *CloudSuitabilityCommon - // READ-ONLY; Time when this machine was last updated. Date-Time represented in ISO-8601 format. - UpdatedTimestamp *time.Time + // READ-ONLY; The value. + Value *int32 } -// MachineResultList - List of machines. -type MachineResultList struct { - NextLink *string +// NameValuePairCostType - The generic name value pair. +type NameValuePairCostType struct { + // READ-ONLY; The name. + Name *CostType - // List of machines. - Value []*Machine + // READ-ONLY; The value. + Value *float32 } -// NetworkAdapter - A network adapter discovered on a machine. -type NetworkAdapter struct { - // READ-ONLY; User friendly name of the network adapter. - DisplayName *string - - // READ-ONLY; List of IP Addresses on the network adapter. - IPAddresses []*string +// NameValuePairSavingsType - The generic name value pair. +type NameValuePairSavingsType struct { + // READ-ONLY; The name. + Name *SavingsType - // READ-ONLY; MAC Address of the network adapter. - MacAddress *string + // READ-ONLY; The value. + Value *float32 } -// Operation - A REST API operation supported by the provider. +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { - // READ-ONLY; Displayable properties of the operation. + // Localized display information for this particular operation. Display *OperationDisplay - // READ-ONLY; Name of the operation. + // READ-ONLY; Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + // Resource Manager/control-plane operations. + IsDataAction *bool + + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" Name *string - // READ-ONLY; Origin of the operation. - Origin *string + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin } -// OperationDisplay - Displayable properties of the operation. +// OperationDisplay - Localized display information for and operation. type OperationDisplay struct { - // READ-ONLY; Description of the operation. + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string - // READ-ONLY; Operation Type. + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". Operation *string - // READ-ONLY; Provider of the operation. + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". Provider *string - // READ-ONLY; Resource operated on by the operation. + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". Resource *string } -// OperationResultList - List of API operations. -type OperationResultList struct { - // List of operations. +// 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. +type OperationListResult struct { + // REQUIRED; The Operation items on this page Value []*Operation + + // The link to the next page of items + NextLink *string } -// PrivateEndpointConnection - A private endpoint connection for a project. -type PrivateEndpointConnection struct { - // REQUIRED; Properties of the private endpoint endpoint connection. - Properties *PrivateEndpointConnectionProperties +// PerformanceData - Performance data class. +type PerformanceData struct { + // Percentile of the utilization data values to be considered while assessing + // machines. + Percentile *Percentile + + // Gets or sets the end time to consider performance data for assessment. + PerfDataEndTime *time.Time - // For optimistic concurrency control. - ETag *string + // Gets or sets the start time to consider performance data for assessment. + PerfDataStartTime *time.Time - // READ-ONLY; Path reference to this private endpoint endpoint connection. - // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/privateEndpointConnections/{privateEndpointConnectionName} - ID *string + // Time Range for which the historic utilization data should be considered for + // assessment. + TimeRange *TimeRange +} - // READ-ONLY; Name of the private endpoint endpoint connection. +// ProcessorInfo - Represents a information \ details of a processor. +type ProcessorInfo struct { + // Gets or sets the name \ model of a processor. Name *string - // READ-ONLY; Type of the object = [Microsoft.Migrate/assessmentProjects/privateEndpointConnections]. - Type *string + // Gets or sets the number of cores in a socket. + NumberOfCoresPerSocket *int32 + + // Gets or sets the number of sockets. + NumberOfSockets *int32 } -// PrivateEndpointConnectionCollection - A collection of private endpoint connections for a project. -type PrivateEndpointConnectionCollection struct { - // READ-ONLY - NextLink *string +// ProductSupportStatus - Class to represent the Product Support Status. +type ProductSupportStatus struct { + // READ-ONLY; Gets or sets the current ESU support year. + CurrentEsuYear *string + + // READ-ONLY; Gets or sets current version of ServicePack. + CurrentVersion *string + + // READ-ONLY; Gets or sets the Extended Security Update ESU status. + EsuStatus *string + + // READ-ONLY; Gets or sets the ETA. + Eta *int32 + + // READ-ONLY; Gets or sets the extended security update year 1 end date of the product. + ExtendedSecurityUpdateYear1EndDate *time.Time + + // READ-ONLY; Gets or sets the extended security update year 2 end date of the product. + ExtendedSecurityUpdateYear2EndDate *time.Time + + // READ-ONLY; Gets or sets the extended security update year 3 end date of the product. + ExtendedSecurityUpdateYear3EndDate *time.Time + + // READ-ONLY; Gets or sets the extended support end date of the product. + ExtendedSupportEndDate *time.Time + + // READ-ONLY; Gets or sets the main stream end date of the product. + MainstreamEndDate *time.Time + + // READ-ONLY; Gets or sets ServicePack of the product. + ServicePackStatus *string + + // READ-ONLY; Gets or sets the support status of the product. + SupportStatus *string +} - // READ-ONLY; A list of private endpoint connections for a project. - Value []*PrivateEndpointConnection +// RecommendedFor - The recommended details. +type RecommendedFor struct { + // READ-ONLY; The list of strategy type. + Strategies []*StrategyType } -// PrivateEndpointConnectionProperties - Private endpoint connection properties. -type PrivateEndpointConnectionProperties struct { - // State of the private endpoint connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState +// SKUDetails - Sku details. +type SKUDetails struct { + // READ-ONLY; The capabilities. + Capabilities []*NameValuePair - // READ-ONLY; ARM id for the private endpoint resource corresponding to the connection. - PrivateEndpoint *ResourceID + // READ-ONLY; The sku name. + SKUName *string - // READ-ONLY; Indicates whether there is an ongoing operation on the private endpoint. - ProvisioningState *PrivateEndpointConnectionPropertiesProvisioningState + // READ-ONLY; The sku type. + SKUType *SKUType + + // READ-ONLY; The sku cost details. + TotalCost []*CostDetailsCommon + + // READ-ONLY; The sku savings details. + TotalSavings []*SavingsDetailsCommon } -// PrivateLinkResource - A private link resource for a project for which a private endpoint can be created. -type PrivateLinkResource struct { - // READ-ONLY; Path reference to this private link resource. - // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/privateLinkResources/{privateLinkResourceName} +// SKUsMigrationSuitability - Skus details. +type SKUsMigrationSuitability struct { + // READ-ONLY; The sku details. + Details *SKUDetails + + // READ-ONLY; The sku name. + DisplayName *string + + // READ-ONLY; The sku id. ID *string - // READ-ONLY; Name of the private link resource. - Name *string + // READ-ONLY; The Sku kind. + Kind *SKUKind - // READ-ONLY; Properties of the private link resource. - Properties *PrivateLinkResourceProperties + // READ-ONLY; The resource uri. + ResourceURI *string - // READ-ONLY; Type of the object = [Microsoft.Migrate/assessmentProjects/privateLinkResources]. - Type *string + // READ-ONLY; The source name. + Sources []*SourceRecommendationMigrationSuitability + + // READ-ONLY; The sku type. + Type *SKUType } -// PrivateLinkResourceCollection - A list of private link resources -type PrivateLinkResourceCollection struct { - // READ-ONLY; Link to retrieve next page of results. - NextLink *string +// SavingsDetailsCommon - The savings details. +type SavingsDetailsCommon struct { + // READ-ONLY; The savings options. + SavingOptions *SavingsOptions - // READ-ONLY; Array of results. - Value []*PrivateLinkResource + // READ-ONLY; The sku cost details per azure offer type. + SavingsDetail []*NameValuePairSavingsType } -// PrivateLinkResourceProperties - Properties of a private link resource. -type PrivateLinkResourceProperties struct { - // READ-ONLY; The private link resource group id. - GroupID *string +// SavingsSettings - Savings settings class. +type SavingsSettings struct { + // Gets or sets the Azure offer code. + AzureOfferCode *AzureOffer - // READ-ONLY; The private link resource required member names. - RequiredMembers []*string - - // READ-ONLY; Required DNS zone names of the the private link resource. - RequiredZoneNames []*string + // Gets or sets the savings options. + SavingsOptions *SavingsOptions } -// PrivateLinkServiceConnectionState - State of a private endpoint connection. -type PrivateLinkServiceConnectionState struct { - // Actions required on the private endpoint connection. - ActionsRequired *string +// Scope of the assessment. +type Scope struct { + // The ARG query. + AzureResourceGraphQuery *string - // Description of the private endpoint connection. - Description *string + // The scope type + ScopeType *ScopeType - // Connection status of the private endpoint connection. - Status *PrivateLinkServiceConnectionStateStatus + // The server group arm id. + ServerGroupID *string } -// Project - Azure Migrate Project. -type Project struct { - // For optimistic concurrency control. - ETag *string +// SecuritySuitability - The security suitability. +type SecuritySuitability struct { + // READ-ONLY; The security suitability. + Readiness *CloudSuitabilityCommon +} - // Azure location in which project is created. - Location *string +// SourceDetails - Source details +type SourceDetails struct { + // READ-ONLY; The count of a type of source. + Count *int32 - // Properties of the project. - Properties *ProjectProperties + // READ-ONLY; The migration platform. + Platform *MigrationPlatform - // Tags provided by Azure Tagging service. - Tags any + // READ-ONLY; The source name. + SourceName *AssessmentSource - // READ-ONLY; Path reference to this project /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName} - ID *string + // READ-ONLY; The source type. + SourceType *WorkloadType +} - // READ-ONLY; Name of the project. - Name *string +// SourceRecommendationMigrationSuitability - Source recommendation details. +type SourceRecommendationMigrationSuitability struct { + // READ-ONLY; The sku type. + MigrationSuitability *MigrationSuitability - // READ-ONLY; Type of the object = [Microsoft.Migrate/assessmentProjects]. - Type *string + // READ-ONLY; The sku name. + Name *string } -// ProjectProperties - Properties of a project. -type ProjectProperties struct { - // Assessment solution ARM id tracked by Microsoft.Migrate/migrateProjects. - AssessmentSolutionID *string +// SummaryProperties - Summary properties class. +type SummaryProperties struct { + // READ-ONLY; The cost components. + CostComponents []*CostDetailsCommon - // The ARM id of the storage account used for interactions when public access is disabled. - CustomerStorageAccountArmID *string + // READ-ONLY; The cost components. + SavingsComponents []*SavingsDetailsCommon - // The ARM id of service map workspace created by customer. - CustomerWorkspaceID *string + // READ-ONLY; The source details list. + Sources []*SourceDetails - // Location of service map workspace created by customer. - CustomerWorkspaceLocation *string + // READ-ONLY; The summary name + SummaryName *string - // Assessment project status. - ProjectStatus *ProjectStatus + // READ-ONLY; The summary type + SummaryType *SummaryType - // This value can be set to 'enabled' to avoid breaking changes on existing customer resources and templates. If set to 'disabled', - // traffic over public interface is not allowed, and private endpoint - // connections would be the exclusive access method. - PublicNetworkAccess *string + // READ-ONLY; The target source mapping. + TargetSourceMapping []*TargetSourcePair - // READ-ONLY; Time when this project was created. Date-Time represented in ISO-8601 format. - CreatedTimestamp *time.Time + // READ-ONLY; The target details list. + Targets []*TargetDetails +} - // READ-ONLY; Time when last assessment was created. Date-Time represented in ISO-8601 format. This value will be null until - // assessment is created. - LastAssessmentTimestamp *time.Time +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time - // READ-ONLY; Number of assessments created in the project. - NumberOfAssessments *int32 + // The identity that created the resource. + CreatedBy *string - // READ-ONLY; Number of groups created in the project. - NumberOfGroups *int32 + // The type of identity that created the resource. + CreatedByType *CreatedByType - // READ-ONLY; Number of machines in the project. - NumberOfMachines *int32 + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time - // READ-ONLY; The list of private endpoint connections to the project. - PrivateEndpointConnections []*PrivateEndpointConnection + // The identity that last modified the resource. + LastModifiedBy *string - // READ-ONLY; Provisioning state of the project. - ProvisioningState *ProvisioningState + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} - // READ-ONLY; Endpoint at which the collector agent can call agent REST API. - ServiceEndpoint *string +// TargetDetails - Target details +type TargetDetails struct { + // READ-ONLY; The count of a type of source. + Count *int32 - // READ-ONLY; Time when this project was last updated. Date-Time represented in ISO-8601 format. - UpdatedTimestamp *time.Time -} + // READ-ONLY; The migration platform. + Platform *MigrationPlatform -// ProjectResultList - List of projects. -type ProjectResultList struct { - NextLink *string + // READ-ONLY; The target name. + TargetName *AzureTarget - // List of projects. - Value []*Project + // READ-ONLY; The target type. + TargetType *WorkloadType } -// ResourceID - ARM id for a resource. -type ResourceID struct { - // READ-ONLY - ID *string -} +// TargetSourcePair - Target source pair +type TargetSourcePair struct { + // READ-ONLY; The confidence score. + ConfidenceScore *float64 -type ServerCollector struct { - ETag *string - Properties *CollectorProperties + // READ-ONLY; The cost details. + CostDetails []*CostDetailsCommon - // READ-ONLY - ID *string + // READ-ONLY; The management details. + ManagementDetails []*ManagementDetails - // READ-ONLY - Name *string + // READ-ONLY; The migration details. + MigrationDetails *MigrationDetails - // READ-ONLY - Type *string -} + // READ-ONLY; The savings details. + SavingsDetails []*SavingsDetailsCommon -// ServerCollectorList - List of Server collectors. -type ServerCollectorList struct { - // List of Server collectors. - Value []*ServerCollector -} + // READ-ONLY; The count of a type of source. + SourceCount *int32 + + // READ-ONLY; The source name. + SourceRef *AssessmentSource -// UpdateGroupBody - Properties of group update. -type UpdateGroupBody struct { - // For optimistic concurrency control. - ETag *string + // READ-ONLY; The count of a type of target. + TargetCount *int32 - // Properties of the group. - Properties *GroupBodyProperties + // READ-ONLY; The target name. + TargetRef *AzureTarget } -// VMFamily - VM family name, the list of targeted azure locations and the category of the family. -type VMFamily struct { - // READ-ONLY; Category of the VM family. - Category []*string +// VMSecuritySuitability - VM Security Suitability +type VMSecuritySuitability struct { + // READ-ONLY; Gets the suitability for this secure VM. + SecuritySuitability *CloudSuitabilityCommon - // READ-ONLY; Name of the VM family. - FamilyName *string + // READ-ONLY; Gets the security suitability details for this VM. + SecuritySuitabilityDetails []*AzureVMSecuritySuitabilityDetail - // READ-ONLY; List of Azure regions. - TargetLocations []*string + // READ-ONLY; Gets and sets the security type for this secure VM. + VMSecurityType *AzureVMSecurityType } +// VMUptime - Details on the total up-time for the VM. type VMUptime struct { // Number of days in a month for VM uptime. DaysPerMonth *int32 @@ -894,23 +930,3 @@ type VMUptime struct { // Number of hours per day for VM uptime. HoursPerDay *int32 } - -type VMwareCollector struct { - ETag *string - Properties *CollectorProperties - - // READ-ONLY - ID *string - - // READ-ONLY - Name *string - - // READ-ONLY - Type *string -} - -// VMwareCollectorList - List of VMware collectors. -type VMwareCollectorList struct { - // List of VMware collectors. - Value []*VMwareCollector -} diff --git a/sdk/resourcemanager/migrate/armmigrate/models_serde.go b/sdk/resourcemanager/migrate/armmigrate/models_serde.go index 0e6743119aed..5410057ab548 100644 --- a/sdk/resourcemanager/migrate/armmigrate/models_serde.go +++ b/sdk/resourcemanager/migrate/armmigrate/models_serde.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmigrate @@ -15,28 +11,21 @@ import ( "reflect" ) -// MarshalJSON implements the json.Marshaller interface for type AssessedDisk. -func (a AssessedDisk) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AssessedDiskDataV3. +func (a AssessedDiskDataV3) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "gigabytesForRecommendedDiskSize", a.GigabytesForRecommendedDiskSize) populate(objectMap, "gigabytesProvisioned", a.GigabytesProvisioned) populate(objectMap, "megabytesPerSecondOfRead", a.MegabytesPerSecondOfRead) populate(objectMap, "megabytesPerSecondOfWrite", a.MegabytesPerSecondOfWrite) - populate(objectMap, "monthlyStorageCost", a.MonthlyStorageCost) populate(objectMap, "name", a.Name) populate(objectMap, "numberOfReadOperationsPerSecond", a.NumberOfReadOperationsPerSecond) populate(objectMap, "numberOfWriteOperationsPerSecond", a.NumberOfWriteOperationsPerSecond) - populate(objectMap, "recommendedDiskSize", a.RecommendedDiskSize) - populate(objectMap, "recommendedDiskType", a.RecommendedDiskType) - populate(objectMap, "suitability", a.Suitability) - populate(objectMap, "suitabilityDetail", a.SuitabilityDetail) - populate(objectMap, "suitabilityExplanation", a.SuitabilityExplanation) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessedDisk. -func (a *AssessedDisk) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessedDiskDataV3. +func (a *AssessedDiskDataV3) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -47,9 +36,6 @@ func (a *AssessedDisk) UnmarshalJSON(data []byte) error { case "displayName": err = unpopulate(val, "DisplayName", &a.DisplayName) delete(rawMsg, key) - case "gigabytesForRecommendedDiskSize": - err = unpopulate(val, "GigabytesForRecommendedDiskSize", &a.GigabytesForRecommendedDiskSize) - delete(rawMsg, key) case "gigabytesProvisioned": err = unpopulate(val, "GigabytesProvisioned", &a.GigabytesProvisioned) delete(rawMsg, key) @@ -59,9 +45,6 @@ func (a *AssessedDisk) UnmarshalJSON(data []byte) error { case "megabytesPerSecondOfWrite": err = unpopulate(val, "MegabytesPerSecondOfWrite", &a.MegabytesPerSecondOfWrite) delete(rawMsg, key) - case "monthlyStorageCost": - err = unpopulate(val, "MonthlyStorageCost", &a.MonthlyStorageCost) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) @@ -71,21 +54,6 @@ func (a *AssessedDisk) UnmarshalJSON(data []byte) error { case "numberOfWriteOperationsPerSecond": err = unpopulate(val, "NumberOfWriteOperationsPerSecond", &a.NumberOfWriteOperationsPerSecond) delete(rawMsg, key) - case "recommendedDiskSize": - err = unpopulate(val, "RecommendedDiskSize", &a.RecommendedDiskSize) - delete(rawMsg, key) - case "recommendedDiskType": - err = unpopulate(val, "RecommendedDiskType", &a.RecommendedDiskType) - delete(rawMsg, key) - case "suitability": - err = unpopulate(val, "Suitability", &a.Suitability) - delete(rawMsg, key) - case "suitabilityDetail": - err = unpopulate(val, "SuitabilityDetail", &a.SuitabilityDetail) - delete(rawMsg, key) - case "suitabilityExplanation": - err = unpopulate(val, "SuitabilityExplanation", &a.SuitabilityExplanation) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -94,86 +62,31 @@ func (a *AssessedDisk) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AssessedMachine. -func (a AssessedMachine) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eTag", a.ETag) - populate(objectMap, "id", a.ID) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessedMachine. -func (a *AssessedMachine) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eTag": - err = unpopulate(val, "ETag", &a.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AssessedMachineProperties. -func (a AssessedMachineProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AssessedMachineExtendedDetails. +func (a AssessedMachineExtendedDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "assessedMachineType", a.AssessedMachineType) populate(objectMap, "bootType", a.BootType) - populate(objectMap, "confidenceRatingInPercentage", a.ConfidenceRatingInPercentage) - populateDateTimeRFC3339(objectMap, "createdTimestamp", a.CreatedTimestamp) - populate(objectMap, "datacenterMachineArmId", a.DatacenterMachineArmID) - populate(objectMap, "datacenterManagementServerArmId", a.DatacenterManagementServerArmID) - populate(objectMap, "datacenterManagementServerName", a.DatacenterManagementServerName) populate(objectMap, "description", a.Description) populate(objectMap, "disks", a.Disks) populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "errors", a.Errors) + populate(objectMap, "hostProcessor", a.HostProcessor) populate(objectMap, "megabytesOfMemory", a.MegabytesOfMemory) - populate(objectMap, "megabytesOfMemoryForRecommendedSize", a.MegabytesOfMemoryForRecommendedSize) - populate(objectMap, "monthlyBandwidthCost", a.MonthlyBandwidthCost) - populate(objectMap, "monthlyComputeCostForRecommendedSize", a.MonthlyComputeCostForRecommendedSize) - populate(objectMap, "monthlyPremiumStorageCost", a.MonthlyPremiumStorageCost) - populate(objectMap, "monthlyStandardSSDStorageCost", a.MonthlyStandardSSDStorageCost) - populate(objectMap, "monthlyStorageCost", a.MonthlyStorageCost) populate(objectMap, "networkAdapters", a.NetworkAdapters) populate(objectMap, "numberOfCores", a.NumberOfCores) - populate(objectMap, "numberOfCoresForRecommendedSize", a.NumberOfCoresForRecommendedSize) + populate(objectMap, "operatingSystemArchitecture", a.OperatingSystemArchitecture) populate(objectMap, "operatingSystemName", a.OperatingSystemName) populate(objectMap, "operatingSystemType", a.OperatingSystemType) populate(objectMap, "operatingSystemVersion", a.OperatingSystemVersion) populate(objectMap, "percentageCoresUtilization", a.PercentageCoresUtilization) populate(objectMap, "percentageMemoryUtilization", a.PercentageMemoryUtilization) - populate(objectMap, "recommendedSize", a.RecommendedSize) - populate(objectMap, "suitability", a.Suitability) - populate(objectMap, "suitabilityDetail", a.SuitabilityDetail) - populate(objectMap, "suitabilityExplanation", a.SuitabilityExplanation) - populateDateTimeRFC3339(objectMap, "updatedTimestamp", a.UpdatedTimestamp) + populate(objectMap, "productSupportStatus", a.ProductSupportStatus) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessedMachineProperties. -func (a *AssessedMachineProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessedMachineExtendedDetails. +func (a *AssessedMachineExtendedDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -181,24 +94,12 @@ func (a *AssessedMachineProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "assessedMachineType": + err = unpopulate(val, "AssessedMachineType", &a.AssessedMachineType) + delete(rawMsg, key) case "bootType": err = unpopulate(val, "BootType", &a.BootType) delete(rawMsg, key) - case "confidenceRatingInPercentage": - err = unpopulate(val, "ConfidenceRatingInPercentage", &a.ConfidenceRatingInPercentage) - delete(rawMsg, key) - case "createdTimestamp": - err = unpopulateDateTimeRFC3339(val, "CreatedTimestamp", &a.CreatedTimestamp) - delete(rawMsg, key) - case "datacenterMachineArmId": - err = unpopulate(val, "DatacenterMachineArmID", &a.DatacenterMachineArmID) - delete(rawMsg, key) - case "datacenterManagementServerArmId": - err = unpopulate(val, "DatacenterManagementServerArmID", &a.DatacenterManagementServerArmID) - delete(rawMsg, key) - case "datacenterManagementServerName": - err = unpopulate(val, "DatacenterManagementServerName", &a.DatacenterManagementServerName) - delete(rawMsg, key) case "description": err = unpopulate(val, "Description", &a.Description) delete(rawMsg, key) @@ -208,26 +109,14 @@ func (a *AssessedMachineProperties) UnmarshalJSON(data []byte) error { case "displayName": err = unpopulate(val, "DisplayName", &a.DisplayName) delete(rawMsg, key) - case "megabytesOfMemory": - err = unpopulate(val, "MegabytesOfMemory", &a.MegabytesOfMemory) - delete(rawMsg, key) - case "megabytesOfMemoryForRecommendedSize": - err = unpopulate(val, "MegabytesOfMemoryForRecommendedSize", &a.MegabytesOfMemoryForRecommendedSize) - delete(rawMsg, key) - case "monthlyBandwidthCost": - err = unpopulate(val, "MonthlyBandwidthCost", &a.MonthlyBandwidthCost) - delete(rawMsg, key) - case "monthlyComputeCostForRecommendedSize": - err = unpopulate(val, "MonthlyComputeCostForRecommendedSize", &a.MonthlyComputeCostForRecommendedSize) - delete(rawMsg, key) - case "monthlyPremiumStorageCost": - err = unpopulate(val, "MonthlyPremiumStorageCost", &a.MonthlyPremiumStorageCost) + case "errors": + err = unpopulate(val, "Errors", &a.Errors) delete(rawMsg, key) - case "monthlyStandardSSDStorageCost": - err = unpopulate(val, "MonthlyStandardSSDStorageCost", &a.MonthlyStandardSSDStorageCost) + case "hostProcessor": + err = unpopulate(val, "HostProcessor", &a.HostProcessor) delete(rawMsg, key) - case "monthlyStorageCost": - err = unpopulate(val, "MonthlyStorageCost", &a.MonthlyStorageCost) + case "megabytesOfMemory": + err = unpopulate(val, "MegabytesOfMemory", &a.MegabytesOfMemory) delete(rawMsg, key) case "networkAdapters": err = unpopulate(val, "NetworkAdapters", &a.NetworkAdapters) @@ -235,8 +124,8 @@ func (a *AssessedMachineProperties) UnmarshalJSON(data []byte) error { case "numberOfCores": err = unpopulate(val, "NumberOfCores", &a.NumberOfCores) delete(rawMsg, key) - case "numberOfCoresForRecommendedSize": - err = unpopulate(val, "NumberOfCoresForRecommendedSize", &a.NumberOfCoresForRecommendedSize) + case "operatingSystemArchitecture": + err = unpopulate(val, "OperatingSystemArchitecture", &a.OperatingSystemArchitecture) delete(rawMsg, key) case "operatingSystemName": err = unpopulate(val, "OperatingSystemName", &a.OperatingSystemName) @@ -253,20 +142,8 @@ func (a *AssessedMachineProperties) UnmarshalJSON(data []byte) error { case "percentageMemoryUtilization": err = unpopulate(val, "PercentageMemoryUtilization", &a.PercentageMemoryUtilization) delete(rawMsg, key) - case "recommendedSize": - err = unpopulate(val, "RecommendedSize", &a.RecommendedSize) - delete(rawMsg, key) - case "suitability": - err = unpopulate(val, "Suitability", &a.Suitability) - delete(rawMsg, key) - case "suitabilityDetail": - err = unpopulate(val, "SuitabilityDetail", &a.SuitabilityDetail) - delete(rawMsg, key) - case "suitabilityExplanation": - err = unpopulate(val, "SuitabilityExplanation", &a.SuitabilityExplanation) - delete(rawMsg, key) - case "updatedTimestamp": - err = unpopulateDateTimeRFC3339(val, "UpdatedTimestamp", &a.UpdatedTimestamp) + case "productSupportStatus": + err = unpopulate(val, "ProductSupportStatus", &a.ProductSupportStatus) delete(rawMsg, key) } if err != nil { @@ -276,55 +153,21 @@ func (a *AssessedMachineProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AssessedMachineResultList. -func (a AssessedMachineResultList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessedMachineResultList. -func (a *AssessedMachineResultList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AssessedNetworkAdapter. -func (a AssessedNetworkAdapter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AssessedMachineNetworkAdaptersV3. +func (a AssessedMachineNetworkAdaptersV3) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "displayName", a.DisplayName) populate(objectMap, "ipAddresses", a.IPAddresses) populate(objectMap, "macAddress", a.MacAddress) - populate(objectMap, "megabytesPerSecondReceived", a.MegabytesPerSecondReceived) + populate(objectMap, "megabytesPerSecondRecieved", a.MegabytesPerSecondRecieved) populate(objectMap, "megabytesPerSecondTransmitted", a.MegabytesPerSecondTransmitted) - populate(objectMap, "monthlyBandwidthCosts", a.MonthlyBandwidthCosts) + populate(objectMap, "name", a.Name) populate(objectMap, "netGigabytesTransmittedPerMonth", a.NetGigabytesTransmittedPerMonth) - populate(objectMap, "suitability", a.Suitability) - populate(objectMap, "suitabilityDetail", a.SuitabilityDetail) - populate(objectMap, "suitabilityExplanation", a.SuitabilityExplanation) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessedNetworkAdapter. -func (a *AssessedNetworkAdapter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessedMachineNetworkAdaptersV3. +func (a *AssessedMachineNetworkAdaptersV3) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -341,27 +184,18 @@ func (a *AssessedNetworkAdapter) UnmarshalJSON(data []byte) error { case "macAddress": err = unpopulate(val, "MacAddress", &a.MacAddress) delete(rawMsg, key) - case "megabytesPerSecondReceived": - err = unpopulate(val, "MegabytesPerSecondReceived", &a.MegabytesPerSecondReceived) + case "megabytesPerSecondRecieved": + err = unpopulate(val, "MegabytesPerSecondRecieved", &a.MegabytesPerSecondRecieved) delete(rawMsg, key) case "megabytesPerSecondTransmitted": err = unpopulate(val, "MegabytesPerSecondTransmitted", &a.MegabytesPerSecondTransmitted) delete(rawMsg, key) - case "monthlyBandwidthCosts": - err = unpopulate(val, "MonthlyBandwidthCosts", &a.MonthlyBandwidthCosts) + case "name": + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) case "netGigabytesTransmittedPerMonth": err = unpopulate(val, "NetGigabytesTransmittedPerMonth", &a.NetGigabytesTransmittedPerMonth) delete(rawMsg, key) - case "suitability": - err = unpopulate(val, "Suitability", &a.Suitability) - delete(rawMsg, key) - case "suitabilityDetail": - err = unpopulate(val, "SuitabilityDetail", &a.SuitabilityDetail) - delete(rawMsg, key) - case "suitabilityExplanation": - err = unpopulate(val, "SuitabilityExplanation", &a.SuitabilityExplanation) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -370,19 +204,19 @@ func (a *AssessedNetworkAdapter) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Assessment. -func (a Assessment) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AssessedMachineV2. +func (a AssessedMachineV2) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", a.ETag) populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Assessment. -func (a *Assessment) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessedMachineV2. +func (a *AssessedMachineV2) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -390,9 +224,6 @@ func (a *Assessment) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &a.ETag) - delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) @@ -402,6 +233,9 @@ func (a *Assessment) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) @@ -413,17 +247,16 @@ func (a *Assessment) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AssessmentOptions. -func (a AssessmentOptions) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AssessedMachineV2ListResult. +func (a AssessedMachineV2ListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentOptions. -func (a *AssessmentOptions) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessedMachineV2ListResult. +func (a *AssessedMachineV2ListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -431,14 +264,11 @@ func (a *AssessmentOptions) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) + case "value": + err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) } if err != nil { @@ -448,19 +278,20 @@ func (a *AssessmentOptions) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AssessmentOptionsProperties. -func (a AssessmentOptionsProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AssessedMachineV2Properties. +func (a AssessedMachineV2Properties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "reservedInstanceSupportedCurrencies", a.ReservedInstanceSupportedCurrencies) - populate(objectMap, "reservedInstanceSupportedLocations", a.ReservedInstanceSupportedLocations) - populate(objectMap, "reservedInstanceSupportedOffers", a.ReservedInstanceSupportedOffers) - populate(objectMap, "reservedInstanceVmFamilies", a.ReservedInstanceVMFamilies) - populate(objectMap, "vmFamilies", a.VMFamilies) + populateDateTimeRFC3339(objectMap, "createdTimestamp", a.CreatedTimestamp) + populate(objectMap, "extendedDetails", a.ExtendedDetails) + populate(objectMap, "linkages", a.Linkages) + populate(objectMap, "recommendations", a.Recommendations) + populateDateTimeRFC3339(objectMap, "updatedTimestamp", a.UpdatedTimestamp) + populate(objectMap, "workloadType", a.WorkloadType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentOptionsProperties. -func (a *AssessmentOptionsProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessedMachineV2Properties. +func (a *AssessedMachineV2Properties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -468,20 +299,23 @@ func (a *AssessmentOptionsProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "reservedInstanceSupportedCurrencies": - err = unpopulate(val, "ReservedInstanceSupportedCurrencies", &a.ReservedInstanceSupportedCurrencies) + case "createdTimestamp": + err = unpopulateDateTimeRFC3339(val, "CreatedTimestamp", &a.CreatedTimestamp) delete(rawMsg, key) - case "reservedInstanceSupportedLocations": - err = unpopulate(val, "ReservedInstanceSupportedLocations", &a.ReservedInstanceSupportedLocations) + case "extendedDetails": + err = unpopulate(val, "ExtendedDetails", &a.ExtendedDetails) delete(rawMsg, key) - case "reservedInstanceSupportedOffers": - err = unpopulate(val, "ReservedInstanceSupportedOffers", &a.ReservedInstanceSupportedOffers) + case "linkages": + err = unpopulate(val, "Linkages", &a.Linkages) delete(rawMsg, key) - case "reservedInstanceVmFamilies": - err = unpopulate(val, "ReservedInstanceVMFamilies", &a.ReservedInstanceVMFamilies) + case "recommendations": + err = unpopulate(val, "Recommendations", &a.Recommendations) delete(rawMsg, key) - case "vmFamilies": - err = unpopulate(val, "VMFamilies", &a.VMFamilies) + case "updatedTimestamp": + err = unpopulateDateTimeRFC3339(val, "UpdatedTimestamp", &a.UpdatedTimestamp) + delete(rawMsg, key) + case "workloadType": + err = unpopulate(val, "WorkloadType", &a.WorkloadType) delete(rawMsg, key) } if err != nil { @@ -491,15 +325,19 @@ func (a *AssessmentOptionsProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AssessmentOptionsResultList. -func (a AssessmentOptionsResultList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AssessmentDetails. +func (a AssessmentDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", a.Value) + populate(objectMap, "confidenceRatingInPercentage", a.ConfidenceRatingInPercentage) + populateDateTimeRFC3339(objectMap, "createdTimestamp", a.CreatedTimestamp) + populateDateTimeRFC3339(objectMap, "pricesTimestamp", a.PricesTimestamp) + populate(objectMap, "status", a.Status) + populateDateTimeRFC3339(objectMap, "updatedTimestamp", a.UpdatedTimestamp) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentOptionsResultList. -func (a *AssessmentOptionsResultList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentDetails. +func (a *AssessmentDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -507,8 +345,20 @@ func (a *AssessmentOptionsResultList) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &a.Value) + case "confidenceRatingInPercentage": + err = unpopulate(val, "ConfidenceRatingInPercentage", &a.ConfidenceRatingInPercentage) + delete(rawMsg, key) + case "createdTimestamp": + err = unpopulateDateTimeRFC3339(val, "CreatedTimestamp", &a.CreatedTimestamp) + delete(rawMsg, key) + case "pricesTimestamp": + err = unpopulateDateTimeRFC3339(val, "PricesTimestamp", &a.PricesTimestamp) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulateDateTimeRFC3339(val, "UpdatedTimestamp", &a.UpdatedTimestamp) delete(rawMsg, key) } if err != nil { @@ -518,858 +368,1031 @@ func (a *AssessmentOptionsResultList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AssessmentProperties. -func (a AssessmentProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BillingSettings. +func (b BillingSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "azureDiskType", a.AzureDiskType) - populate(objectMap, "azureHybridUseBenefit", a.AzureHybridUseBenefit) - populate(objectMap, "azureLocation", a.AzureLocation) - populate(objectMap, "azureOfferCode", a.AzureOfferCode) - populate(objectMap, "azurePricingTier", a.AzurePricingTier) - populate(objectMap, "azureStorageRedundancy", a.AzureStorageRedundancy) - populate(objectMap, "azureVmFamilies", a.AzureVMFamilies) - populate(objectMap, "confidenceRatingInPercentage", a.ConfidenceRatingInPercentage) - populateDateTimeRFC3339(objectMap, "createdTimestamp", a.CreatedTimestamp) - populate(objectMap, "currency", a.Currency) - populate(objectMap, "discountPercentage", a.DiscountPercentage) - populate(objectMap, "eaSubscriptionId", a.EaSubscriptionID) - populate(objectMap, "monthlyBandwidthCost", a.MonthlyBandwidthCost) - populate(objectMap, "monthlyComputeCost", a.MonthlyComputeCost) - populate(objectMap, "monthlyPremiumStorageCost", a.MonthlyPremiumStorageCost) - populate(objectMap, "monthlyStandardSSDStorageCost", a.MonthlyStandardSSDStorageCost) - populate(objectMap, "monthlyStorageCost", a.MonthlyStorageCost) - populate(objectMap, "numberOfMachines", a.NumberOfMachines) - populate(objectMap, "percentile", a.Percentile) - populateDateTimeRFC3339(objectMap, "perfDataEndTime", a.PerfDataEndTime) - populateDateTimeRFC3339(objectMap, "perfDataStartTime", a.PerfDataStartTime) - populateDateTimeRFC3339(objectMap, "pricesTimestamp", a.PricesTimestamp) - populate(objectMap, "reservedInstance", a.ReservedInstance) - populate(objectMap, "scalingFactor", a.ScalingFactor) - populate(objectMap, "sizingCriterion", a.SizingCriterion) - populate(objectMap, "stage", a.Stage) - populate(objectMap, "status", a.Status) - populate(objectMap, "timeRange", a.TimeRange) - populateDateTimeRFC3339(objectMap, "updatedTimestamp", a.UpdatedTimestamp) - populate(objectMap, "vmUptime", a.VMUptime) + populate(objectMap, "licensingProgram", b.LicensingProgram) + populate(objectMap, "subscriptionId", b.SubscriptionID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentProperties. -func (a *AssessmentProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BillingSettings. +func (b *BillingSettings) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { - case "azureDiskType": - err = unpopulate(val, "AzureDiskType", &a.AzureDiskType) + case "licensingProgram": + err = unpopulate(val, "LicensingProgram", &b.LicensingProgram) delete(rawMsg, key) - case "azureHybridUseBenefit": - err = unpopulate(val, "AzureHybridUseBenefit", &a.AzureHybridUseBenefit) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &b.SubscriptionID) delete(rawMsg, key) - case "azureLocation": - err = unpopulate(val, "AzureLocation", &a.AzureLocation) - delete(rawMsg, key) - case "azureOfferCode": - err = unpopulate(val, "AzureOfferCode", &a.AzureOfferCode) - delete(rawMsg, key) - case "azurePricingTier": - err = unpopulate(val, "AzurePricingTier", &a.AzurePricingTier) - delete(rawMsg, key) - case "azureStorageRedundancy": - err = unpopulate(val, "AzureStorageRedundancy", &a.AzureStorageRedundancy) - delete(rawMsg, key) - case "azureVmFamilies": - err = unpopulate(val, "AzureVMFamilies", &a.AzureVMFamilies) - delete(rawMsg, key) - case "confidenceRatingInPercentage": - err = unpopulate(val, "ConfidenceRatingInPercentage", &a.ConfidenceRatingInPercentage) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Configuration. +func (c Configuration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureTarget", c.AzureTarget) + populate(objectMap, "sizingCriterion", c.SizingCriterion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Configuration. +func (c *Configuration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureTarget": + err = unpopulate(val, "AzureTarget", &c.AzureTarget) delete(rawMsg, key) - case "createdTimestamp": - err = unpopulateDateTimeRFC3339(val, "CreatedTimestamp", &a.CreatedTimestamp) + case "sizingCriterion": + err = unpopulate(val, "SizingCriterion", &c.SizingCriterion) delete(rawMsg, key) - case "currency": - err = unpopulate(val, "Currency", &a.Currency) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CostDetailsCommon. +func (c CostDetailsCommon) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "costDetail", c.CostDetail) + populate(objectMap, "savingOptions", c.SavingOptions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CostDetailsCommon. +func (c *CostDetailsCommon) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "costDetail": + err = unpopulate(val, "CostDetail", &c.CostDetail) delete(rawMsg, key) - case "discountPercentage": - err = unpopulate(val, "DiscountPercentage", &a.DiscountPercentage) + case "savingOptions": + err = unpopulate(val, "SavingOptions", &c.SavingOptions) delete(rawMsg, key) - case "eaSubscriptionId": - err = unpopulate(val, "EaSubscriptionID", &a.EaSubscriptionID) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DownloadURL. +func (d DownloadURL) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "assessmentReportUrl", d.AssessmentReportURL) + populateDateTimeRFC3339(objectMap, "expirationTime", d.ExpirationTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DownloadURL. +func (d *DownloadURL) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assessmentReportUrl": + err = unpopulate(val, "AssessmentReportURL", &d.AssessmentReportURL) delete(rawMsg, key) - case "monthlyBandwidthCost": - err = unpopulate(val, "MonthlyBandwidthCost", &a.MonthlyBandwidthCost) + case "expirationTime": + err = unpopulateDateTimeRFC3339(val, "ExpirationTime", &d.ExpirationTime) delete(rawMsg, key) - case "monthlyComputeCost": - err = unpopulate(val, "MonthlyComputeCost", &a.MonthlyComputeCost) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Error. +func (e Error) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentScenario", e.AgentScenario) + populate(objectMap, "applianceName", e.ApplianceName) + populate(objectMap, "code", e.Code) + populate(objectMap, "id", e.ID) + populate(objectMap, "impactedAssessmentType", e.ImpactedAssessmentType) + populate(objectMap, "message", e.Message) + populate(objectMap, "messageParameters", e.MessageParameters) + populate(objectMap, "possibleCauses", e.PossibleCauses) + populate(objectMap, "recommendedAction", e.RecommendedAction) + populate(objectMap, "runAsAccountId", e.RunAsAccountID) + populate(objectMap, "severity", e.Severity) + populate(objectMap, "summaryMessage", e.SummaryMessage) + populateDateTimeRFC3339(objectMap, "updatedTimeStamp", e.UpdatedTimeStamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Error. +func (e *Error) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "agentScenario": + err = unpopulate(val, "AgentScenario", &e.AgentScenario) delete(rawMsg, key) - case "monthlyPremiumStorageCost": - err = unpopulate(val, "MonthlyPremiumStorageCost", &a.MonthlyPremiumStorageCost) + case "applianceName": + err = unpopulate(val, "ApplianceName", &e.ApplianceName) delete(rawMsg, key) - case "monthlyStandardSSDStorageCost": - err = unpopulate(val, "MonthlyStandardSSDStorageCost", &a.MonthlyStandardSSDStorageCost) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "monthlyStorageCost": - err = unpopulate(val, "MonthlyStorageCost", &a.MonthlyStorageCost) + case "id": + err = unpopulate(val, "ID", &e.ID) delete(rawMsg, key) - case "numberOfMachines": - err = unpopulate(val, "NumberOfMachines", &a.NumberOfMachines) + case "impactedAssessmentType": + err = unpopulate(val, "ImpactedAssessmentType", &e.ImpactedAssessmentType) delete(rawMsg, key) - case "percentile": - err = unpopulate(val, "Percentile", &a.Percentile) + case "message": + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) - case "perfDataEndTime": - err = unpopulateDateTimeRFC3339(val, "PerfDataEndTime", &a.PerfDataEndTime) + case "messageParameters": + err = unpopulate(val, "MessageParameters", &e.MessageParameters) delete(rawMsg, key) - case "perfDataStartTime": - err = unpopulateDateTimeRFC3339(val, "PerfDataStartTime", &a.PerfDataStartTime) + case "possibleCauses": + err = unpopulate(val, "PossibleCauses", &e.PossibleCauses) delete(rawMsg, key) - case "pricesTimestamp": - err = unpopulateDateTimeRFC3339(val, "PricesTimestamp", &a.PricesTimestamp) + case "recommendedAction": + err = unpopulate(val, "RecommendedAction", &e.RecommendedAction) delete(rawMsg, key) - case "reservedInstance": - err = unpopulate(val, "ReservedInstance", &a.ReservedInstance) + case "runAsAccountId": + err = unpopulate(val, "RunAsAccountID", &e.RunAsAccountID) delete(rawMsg, key) - case "scalingFactor": - err = unpopulate(val, "ScalingFactor", &a.ScalingFactor) + case "severity": + err = unpopulate(val, "Severity", &e.Severity) delete(rawMsg, key) - case "sizingCriterion": - err = unpopulate(val, "SizingCriterion", &a.SizingCriterion) + case "summaryMessage": + err = unpopulate(val, "SummaryMessage", &e.SummaryMessage) delete(rawMsg, key) - case "stage": - err = unpopulate(val, "Stage", &a.Stage) + case "updatedTimeStamp": + err = unpopulateDateTimeRFC3339(val, "UpdatedTimeStamp", &e.UpdatedTimeStamp) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &a.Status) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Linkages. +func (l Linkages) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "armId", l.ArmID) + populate(objectMap, "kind", l.Kind) + populate(objectMap, "linkageType", l.LinkageType) + populate(objectMap, "workloadName", l.WorkloadName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Linkages. +func (l *Linkages) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "armId": + err = unpopulate(val, "ArmID", &l.ArmID) delete(rawMsg, key) - case "timeRange": - err = unpopulate(val, "TimeRange", &a.TimeRange) + case "kind": + err = unpopulate(val, "Kind", &l.Kind) delete(rawMsg, key) - case "updatedTimestamp": - err = unpopulateDateTimeRFC3339(val, "UpdatedTimestamp", &a.UpdatedTimestamp) + case "linkageType": + err = unpopulate(val, "LinkageType", &l.LinkageType) delete(rawMsg, key) - case "vmUptime": - err = unpopulate(val, "VMUptime", &a.VMUptime) + case "workloadName": + err = unpopulate(val, "WorkloadName", &l.WorkloadName) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AssessmentResultList. -func (a AssessmentResultList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MachineAssessmentOptionsOutboundEdgeGroup. +func (m MachineAssessmentOptionsOutboundEdgeGroup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", a.Value) + populate(objectMap, "azureOfferCode", m.AzureOfferCode) + populate(objectMap, "azureVmFamilies", m.AzureVMFamilies) + populate(objectMap, "azureVmFamilyCategories", m.AzureVMFamilyCategories) + populate(objectMap, "azureVmSecurityOptions", m.AzureVMSecurityOptions) + populate(objectMap, "currencies", m.Currencies) + populate(objectMap, "licensingProgram", m.LicensingProgram) + populate(objectMap, "premiumDiskSupport", m.PremiumDiskSupport) + populate(objectMap, "savingsOptions", m.SavingsOptions) + populate(objectMap, "targetLocations", m.TargetLocations) + populate(objectMap, "ultraDiskSupport", m.UltraDiskSupport) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentResultList. -func (a *AssessmentResultList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineAssessmentOptionsOutboundEdgeGroup. +func (m *MachineAssessmentOptionsOutboundEdgeGroup) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &a.Value) + case "azureOfferCode": + err = unpopulate(val, "AzureOfferCode", &m.AzureOfferCode) + delete(rawMsg, key) + case "azureVmFamilies": + err = unpopulate(val, "AzureVMFamilies", &m.AzureVMFamilies) + delete(rawMsg, key) + case "azureVmFamilyCategories": + err = unpopulate(val, "AzureVMFamilyCategories", &m.AzureVMFamilyCategories) + delete(rawMsg, key) + case "azureVmSecurityOptions": + err = unpopulate(val, "AzureVMSecurityOptions", &m.AzureVMSecurityOptions) + delete(rawMsg, key) + case "currencies": + err = unpopulate(val, "Currencies", &m.Currencies) + delete(rawMsg, key) + case "licensingProgram": + err = unpopulate(val, "LicensingProgram", &m.LicensingProgram) + delete(rawMsg, key) + case "premiumDiskSupport": + err = unpopulate(val, "PremiumDiskSupport", &m.PremiumDiskSupport) + delete(rawMsg, key) + case "savingsOptions": + err = unpopulate(val, "SavingsOptions", &m.SavingsOptions) + delete(rawMsg, key) + case "targetLocations": + err = unpopulate(val, "TargetLocations", &m.TargetLocations) + delete(rawMsg, key) + case "ultraDiskSupport": + err = unpopulate(val, "UltraDiskSupport", &m.UltraDiskSupport) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CollectorAgentProperties. -func (c CollectorAgentProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MachineAssessmentRecommendation. +func (m MachineAssessmentRecommendation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populateDateTimeRFC3339(objectMap, "lastHeartbeatUtc", c.LastHeartbeatUTC) - populate(objectMap, "spnDetails", c.SpnDetails) - populate(objectMap, "version", c.Version) + populate(objectMap, "confidenceScore", m.ConfidenceScore) + populate(objectMap, "configuration", m.Configuration) + populate(objectMap, "migrationIssues", m.MigrationIssues) + populate(objectMap, "migrationPlatform", m.MigrationPlatform) + populate(objectMap, "migrationSuitability", m.MigrationSuitability) + populate(objectMap, "recommendedFor", m.RecommendedFor) + populate(objectMap, "recommendedVmSecurityType", m.RecommendedVMSecurityType) + populate(objectMap, "skus", m.SKUs) + populate(objectMap, "securitySuitability", m.SecuritySuitability) + populate(objectMap, "totalCost", m.TotalCost) + populate(objectMap, "totalSavings", m.TotalSavings) + populate(objectMap, "vmSecuritySuitabilityResults", m.VMSecuritySuitabilityResults) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CollectorAgentProperties. -func (c *CollectorAgentProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineAssessmentRecommendation. +func (m *MachineAssessmentRecommendation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) + case "confidenceScore": + err = unpopulate(val, "ConfidenceScore", &m.ConfidenceScore) + delete(rawMsg, key) + case "configuration": + err = unpopulate(val, "Configuration", &m.Configuration) delete(rawMsg, key) - case "lastHeartbeatUtc": - err = unpopulateDateTimeRFC3339(val, "LastHeartbeatUTC", &c.LastHeartbeatUTC) + case "migrationIssues": + err = unpopulate(val, "MigrationIssues", &m.MigrationIssues) delete(rawMsg, key) - case "spnDetails": - err = unpopulate(val, "SpnDetails", &c.SpnDetails) + case "migrationPlatform": + err = unpopulate(val, "MigrationPlatform", &m.MigrationPlatform) delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &c.Version) + case "migrationSuitability": + err = unpopulate(val, "MigrationSuitability", &m.MigrationSuitability) + delete(rawMsg, key) + case "recommendedFor": + err = unpopulate(val, "RecommendedFor", &m.RecommendedFor) + delete(rawMsg, key) + case "recommendedVmSecurityType": + err = unpopulate(val, "RecommendedVMSecurityType", &m.RecommendedVMSecurityType) + delete(rawMsg, key) + case "skus": + err = unpopulate(val, "SKUs", &m.SKUs) + delete(rawMsg, key) + case "securitySuitability": + err = unpopulate(val, "SecuritySuitability", &m.SecuritySuitability) + delete(rawMsg, key) + case "totalCost": + err = unpopulate(val, "TotalCost", &m.TotalCost) + delete(rawMsg, key) + case "totalSavings": + err = unpopulate(val, "TotalSavings", &m.TotalSavings) + delete(rawMsg, key) + case "vmSecuritySuitabilityResults": + err = unpopulate(val, "VMSecuritySuitabilityResults", &m.VMSecuritySuitabilityResults) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CollectorBodyAgentSpnProperties. -func (c CollectorBodyAgentSpnProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MachineAssessmentSettings. +func (m MachineAssessmentSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "applicationId", c.ApplicationID) - populate(objectMap, "audience", c.Audience) - populate(objectMap, "authority", c.Authority) - populate(objectMap, "objectId", c.ObjectID) - populate(objectMap, "tenantId", c.TenantID) + populate(objectMap, "azureDiskTypes", m.AzureDiskTypes) + populate(objectMap, "azureHybridUseBenefit", m.AzureHybridUseBenefit) + populate(objectMap, "azureLocation", m.AzureLocation) + populate(objectMap, "azurePricingTier", m.AzurePricingTier) + populate(objectMap, "azureSecurityOfferingType", m.AzureSecurityOfferingType) + populate(objectMap, "azureStorageRedundancy", m.AzureStorageRedundancy) + populate(objectMap, "azureVmFamilies", m.AzureVMFamilies) + populate(objectMap, "azureVmSecurityOptions", m.AzureVMSecurityOptions) + populate(objectMap, "billingSettings", m.BillingSettings) + populate(objectMap, "currency", m.Currency) + populate(objectMap, "discountPercentage", m.DiscountPercentage) + populate(objectMap, "environmentType", m.EnvironmentType) + populate(objectMap, "linuxAzureHybridUseBenefit", m.LinuxAzureHybridUseBenefit) + populate(objectMap, "performanceData", m.PerformanceData) + populate(objectMap, "savingsSettings", m.SavingsSettings) + populate(objectMap, "scalingFactor", m.ScalingFactor) + populate(objectMap, "sizingCriterion", m.SizingCriterion) + populate(objectMap, "vmUptime", m.VMUptime) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CollectorBodyAgentSpnProperties. -func (c *CollectorBodyAgentSpnProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineAssessmentSettings. +func (m *MachineAssessmentSettings) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "applicationId": - err = unpopulate(val, "ApplicationID", &c.ApplicationID) + case "azureDiskTypes": + err = unpopulate(val, "AzureDiskTypes", &m.AzureDiskTypes) + delete(rawMsg, key) + case "azureHybridUseBenefit": + err = unpopulate(val, "AzureHybridUseBenefit", &m.AzureHybridUseBenefit) + delete(rawMsg, key) + case "azureLocation": + err = unpopulate(val, "AzureLocation", &m.AzureLocation) + delete(rawMsg, key) + case "azurePricingTier": + err = unpopulate(val, "AzurePricingTier", &m.AzurePricingTier) + delete(rawMsg, key) + case "azureSecurityOfferingType": + err = unpopulate(val, "AzureSecurityOfferingType", &m.AzureSecurityOfferingType) + delete(rawMsg, key) + case "azureStorageRedundancy": + err = unpopulate(val, "AzureStorageRedundancy", &m.AzureStorageRedundancy) + delete(rawMsg, key) + case "azureVmFamilies": + err = unpopulate(val, "AzureVMFamilies", &m.AzureVMFamilies) + delete(rawMsg, key) + case "azureVmSecurityOptions": + err = unpopulate(val, "AzureVMSecurityOptions", &m.AzureVMSecurityOptions) + delete(rawMsg, key) + case "billingSettings": + err = unpopulate(val, "BillingSettings", &m.BillingSettings) + delete(rawMsg, key) + case "currency": + err = unpopulate(val, "Currency", &m.Currency) + delete(rawMsg, key) + case "discountPercentage": + err = unpopulate(val, "DiscountPercentage", &m.DiscountPercentage) + delete(rawMsg, key) + case "environmentType": + err = unpopulate(val, "EnvironmentType", &m.EnvironmentType) + delete(rawMsg, key) + case "linuxAzureHybridUseBenefit": + err = unpopulate(val, "LinuxAzureHybridUseBenefit", &m.LinuxAzureHybridUseBenefit) + delete(rawMsg, key) + case "performanceData": + err = unpopulate(val, "PerformanceData", &m.PerformanceData) delete(rawMsg, key) - case "audience": - err = unpopulate(val, "Audience", &c.Audience) + case "savingsSettings": + err = unpopulate(val, "SavingsSettings", &m.SavingsSettings) delete(rawMsg, key) - case "authority": - err = unpopulate(val, "Authority", &c.Authority) + case "scalingFactor": + err = unpopulate(val, "ScalingFactor", &m.ScalingFactor) delete(rawMsg, key) - case "objectId": - err = unpopulate(val, "ObjectID", &c.ObjectID) + case "sizingCriterion": + err = unpopulate(val, "SizingCriterion", &m.SizingCriterion) delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &c.TenantID) + case "vmUptime": + err = unpopulate(val, "VMUptime", &m.VMUptime) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CollectorProperties. -func (c CollectorProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MachineAssessmentV2. +func (m MachineAssessmentV2) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "agentProperties", c.AgentProperties) - populate(objectMap, "createdTimestamp", c.CreatedTimestamp) - populate(objectMap, "discoverySiteId", c.DiscoverySiteID) - populate(objectMap, "updatedTimestamp", c.UpdatedTimestamp) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CollectorProperties. -func (c *CollectorProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineAssessmentV2. +func (m *MachineAssessmentV2) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "agentProperties": - err = unpopulate(val, "AgentProperties", &c.AgentProperties) + case "id": + err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) - case "createdTimestamp": - err = unpopulate(val, "CreatedTimestamp", &c.CreatedTimestamp) + case "name": + err = unpopulate(val, "Name", &m.Name) delete(rawMsg, key) - case "discoverySiteId": - err = unpopulate(val, "DiscoverySiteID", &c.DiscoverySiteID) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) delete(rawMsg, key) - case "updatedTimestamp": - err = unpopulate(val, "UpdatedTimestamp", &c.UpdatedTimestamp) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Disk. -func (d Disk) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MachineAssessmentV2ListResult. +func (m MachineAssessmentV2ListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", d.DisplayName) - populate(objectMap, "gigabytesAllocated", d.GigabytesAllocated) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Disk. -func (d *Disk) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineAssessmentV2ListResult. +func (m *MachineAssessmentV2ListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &d.DisplayName) + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) delete(rawMsg, key) - case "gigabytesAllocated": - err = unpopulate(val, "GigabytesAllocated", &d.GigabytesAllocated) + case "value": + err = unpopulate(val, "Value", &m.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DownloadURL. -func (d DownloadURL) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MachineAssessmentV2Properties. +func (m MachineAssessmentV2Properties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "assessmentReportUrl", d.AssessmentReportURL) - populateDateTimeRFC3339(objectMap, "expirationTime", d.ExpirationTime) + populate(objectMap, "details", m.Details) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "scope", m.Scope) + populate(objectMap, "settings", m.Settings) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DownloadURL. -func (d *DownloadURL) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineAssessmentV2Properties. +func (m *MachineAssessmentV2Properties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "assessmentReportUrl": - err = unpopulate(val, "AssessmentReportURL", &d.AssessmentReportURL) + case "details": + err = unpopulate(val, "Details", &m.Details) delete(rawMsg, key) - case "expirationTime": - err = unpopulateDateTimeRFC3339(val, "ExpirationTime", &d.ExpirationTime) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &m.Scope) + delete(rawMsg, key) + case "settings": + err = unpopulate(val, "Settings", &m.Settings) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Group. -func (g Group) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MachineAssessmentV2Summary. +func (m MachineAssessmentV2Summary) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", g.ETag) - populate(objectMap, "id", g.ID) - populate(objectMap, "name", g.Name) - populate(objectMap, "properties", g.Properties) - populate(objectMap, "type", g.Type) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Group. -func (g *Group) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineAssessmentV2Summary. +func (m *MachineAssessmentV2Summary) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &g.ETag) - delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &g.ID) + err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &g.Name) + err = unpopulate(val, "Name", &m.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &g.Properties) + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &g.Type) + err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GroupBodyProperties. -func (g GroupBodyProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MachineAssessmentV2SummaryListResult. +func (m MachineAssessmentV2SummaryListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "machines", g.Machines) - populate(objectMap, "operationType", g.OperationType) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GroupBodyProperties. -func (g *GroupBodyProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineAssessmentV2SummaryListResult. +func (m *MachineAssessmentV2SummaryListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "machines": - err = unpopulate(val, "Machines", &g.Machines) + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) delete(rawMsg, key) - case "operationType": - err = unpopulate(val, "OperationType", &g.OperationType) + case "value": + err = unpopulate(val, "Value", &m.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GroupProperties. -func (g GroupProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MachineGraphAssessmentOptions. +func (m MachineGraphAssessmentOptions) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "areAssessmentsRunning", g.AreAssessmentsRunning) - populate(objectMap, "assessments", g.Assessments) - populateDateTimeRFC3339(objectMap, "createdTimestamp", g.CreatedTimestamp) - populate(objectMap, "groupStatus", g.GroupStatus) - populate(objectMap, "groupType", g.GroupType) - populate(objectMap, "machineCount", g.MachineCount) - populateDateTimeRFC3339(objectMap, "updatedTimestamp", g.UpdatedTimestamp) + populate(objectMap, "id", m.ID) + objectMap["name"] = "default" + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GroupProperties. -func (g *GroupProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineGraphAssessmentOptions. +func (m *MachineGraphAssessmentOptions) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "areAssessmentsRunning": - err = unpopulate(val, "AreAssessmentsRunning", &g.AreAssessmentsRunning) - delete(rawMsg, key) - case "assessments": - err = unpopulate(val, "Assessments", &g.Assessments) - delete(rawMsg, key) - case "createdTimestamp": - err = unpopulateDateTimeRFC3339(val, "CreatedTimestamp", &g.CreatedTimestamp) + case "id": + err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) - case "groupStatus": - err = unpopulate(val, "GroupStatus", &g.GroupStatus) + case "name": + err = unpopulate(val, "Name", &m.Name) delete(rawMsg, key) - case "groupType": - err = unpopulate(val, "GroupType", &g.GroupType) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) delete(rawMsg, key) - case "machineCount": - err = unpopulate(val, "MachineCount", &g.MachineCount) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) delete(rawMsg, key) - case "updatedTimestamp": - err = unpopulateDateTimeRFC3339(val, "UpdatedTimestamp", &g.UpdatedTimestamp) + case "type": + err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GroupResultList. -func (g GroupResultList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MachineGraphAssessmentOptionsListResult. +func (m MachineGraphAssessmentOptionsListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", g.Value) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GroupResultList. -func (g *GroupResultList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineGraphAssessmentOptionsListResult. +func (m *MachineGraphAssessmentOptionsListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &g.Value) + err = unpopulate(val, "Value", &m.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type HyperVCollector. -func (h HyperVCollector) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MachineGraphAssessmentOptionsProperties. +func (m MachineGraphAssessmentOptionsProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", h.ETag) - populate(objectMap, "id", h.ID) - populate(objectMap, "name", h.Name) - populate(objectMap, "properties", h.Properties) - populate(objectMap, "type", h.Type) + populate(objectMap, "edges", m.Edges) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HyperVCollector. -func (h *HyperVCollector) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineGraphAssessmentOptionsProperties. +func (m *MachineGraphAssessmentOptionsProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &h.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &h.ID) + case "edges": + err = unpopulate(val, "Edges", &m.Edges) delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagementDetails. +func (m ManagementDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", m.Name) + populate(objectMap, "readinessSummary", m.ReadinessSummary) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementDetails. +func (m *ManagementDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { case "name": - err = unpopulate(val, "Name", &h.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &h.Properties) + err = unpopulate(val, "Name", &m.Name) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &h.Type) + case "readinessSummary": + err = unpopulate(val, "ReadinessSummary", &m.ReadinessSummary) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type HyperVCollectorList. -func (h HyperVCollectorList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MigrationDetails. +func (m MigrationDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", h.Value) + populate(objectMap, "migrationType", m.MigrationType) + populate(objectMap, "readinessSummary", m.ReadinessSummary) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HyperVCollectorList. -func (h *HyperVCollectorList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MigrationDetails. +func (m *MigrationDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &h.Value) + case "migrationType": + err = unpopulate(val, "MigrationType", &m.MigrationType) + delete(rawMsg, key) + case "readinessSummary": + err = unpopulate(val, "ReadinessSummary", &m.ReadinessSummary) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ImportCollector. -func (i ImportCollector) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MigrationIssues. +func (m MigrationIssues) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", i.ETag) - populate(objectMap, "id", i.ID) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "type", i.Type) + populate(objectMap, "issueCategory", m.IssueCategory) + populate(objectMap, "issueCode", m.IssueCode) + populate(objectMap, "issueDescription", m.IssueDescription) + populate(objectMap, "moreInformation", m.MoreInformation) + populate(objectMap, "possibleCause", m.PossibleCause) + populate(objectMap, "recommendedActions", m.RecommendedActions) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ImportCollector. -func (i *ImportCollector) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MigrationIssues. +func (m *MigrationIssues) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &i.ETag) + case "issueCategory": + err = unpopulate(val, "IssueCategory", &m.IssueCategory) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &i.ID) + case "issueCode": + err = unpopulate(val, "IssueCode", &m.IssueCode) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) + case "issueDescription": + err = unpopulate(val, "IssueDescription", &m.IssueDescription) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &i.Properties) + case "moreInformation": + err = unpopulate(val, "MoreInformation", &m.MoreInformation) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) + case "possibleCause": + err = unpopulate(val, "PossibleCause", &m.PossibleCause) + delete(rawMsg, key) + case "recommendedActions": + err = unpopulate(val, "RecommendedActions", &m.RecommendedActions) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ImportCollectorList. -func (i ImportCollectorList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MigrationSuitability. +func (m MigrationSuitability) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", i.Value) + populate(objectMap, "readiness", m.Readiness) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ImportCollectorList. -func (i *ImportCollectorList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MigrationSuitability. +func (m *MigrationSuitability) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &i.Value) + case "readiness": + err = unpopulate(val, "Readiness", &m.Readiness) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ImportCollectorProperties. -func (i ImportCollectorProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MoreInformation. +func (m MoreInformation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "createdTimestamp", i.CreatedTimestamp) - populate(objectMap, "discoverySiteId", i.DiscoverySiteID) - populate(objectMap, "updatedTimestamp", i.UpdatedTimestamp) + populate(objectMap, "title", m.Title) + populate(objectMap, "url", m.URL) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ImportCollectorProperties. -func (i *ImportCollectorProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MoreInformation. +func (m *MoreInformation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "createdTimestamp": - err = unpopulate(val, "CreatedTimestamp", &i.CreatedTimestamp) + case "title": + err = unpopulate(val, "Title", &m.Title) delete(rawMsg, key) - case "discoverySiteId": - err = unpopulate(val, "DiscoverySiteID", &i.DiscoverySiteID) - delete(rawMsg, key) - case "updatedTimestamp": - err = unpopulate(val, "UpdatedTimestamp", &i.UpdatedTimestamp) + case "url": + err = unpopulate(val, "URL", &m.URL) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Machine. -func (m Machine) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NameValuePair. +func (n NameValuePair) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", m.ETag) - populate(objectMap, "id", m.ID) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "type", m.Type) + populate(objectMap, "name", n.Name) + populate(objectMap, "value", n.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Machine. -func (m *Machine) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NameValuePair. +func (n *NameValuePair) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { - var err error - switch key { - case "eTag": - err = unpopulate(val, "ETag", &m.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) + var err error + switch key { case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) + err = unpopulate(val, "Name", &n.Name) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) + case "value": + err = unpopulate(val, "Value", &n.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MachineProperties. -func (m MachineProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NameValuePairCloudSuitabilityCommon. +func (n NameValuePairCloudSuitabilityCommon) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "bootType", m.BootType) - populateDateTimeRFC3339(objectMap, "createdTimestamp", m.CreatedTimestamp) - populate(objectMap, "datacenterManagementServerArmId", m.DatacenterManagementServerArmID) - populate(objectMap, "datacenterManagementServerName", m.DatacenterManagementServerName) - populate(objectMap, "description", m.Description) - populate(objectMap, "discoveryMachineArmId", m.DiscoveryMachineArmID) - populate(objectMap, "disks", m.Disks) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "groups", m.Groups) - populate(objectMap, "megabytesOfMemory", m.MegabytesOfMemory) - populate(objectMap, "networkAdapters", m.NetworkAdapters) - populate(objectMap, "numberOfCores", m.NumberOfCores) - populate(objectMap, "operatingSystemName", m.OperatingSystemName) - populate(objectMap, "operatingSystemType", m.OperatingSystemType) - populate(objectMap, "operatingSystemVersion", m.OperatingSystemVersion) - populateDateTimeRFC3339(objectMap, "updatedTimestamp", m.UpdatedTimestamp) + populate(objectMap, "name", n.Name) + populate(objectMap, "value", n.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MachineProperties. -func (m *MachineProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NameValuePairCloudSuitabilityCommon. +func (n *NameValuePairCloudSuitabilityCommon) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "bootType": - err = unpopulate(val, "BootType", &m.BootType) - delete(rawMsg, key) - case "createdTimestamp": - err = unpopulateDateTimeRFC3339(val, "CreatedTimestamp", &m.CreatedTimestamp) - delete(rawMsg, key) - case "datacenterManagementServerArmId": - err = unpopulate(val, "DatacenterManagementServerArmID", &m.DatacenterManagementServerArmID) - delete(rawMsg, key) - case "datacenterManagementServerName": - err = unpopulate(val, "DatacenterManagementServerName", &m.DatacenterManagementServerName) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &m.Description) - delete(rawMsg, key) - case "discoveryMachineArmId": - err = unpopulate(val, "DiscoveryMachineArmID", &m.DiscoveryMachineArmID) - delete(rawMsg, key) - case "disks": - err = unpopulate(val, "Disks", &m.Disks) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &m.DisplayName) - delete(rawMsg, key) - case "groups": - err = unpopulate(val, "Groups", &m.Groups) - delete(rawMsg, key) - case "megabytesOfMemory": - err = unpopulate(val, "MegabytesOfMemory", &m.MegabytesOfMemory) - delete(rawMsg, key) - case "networkAdapters": - err = unpopulate(val, "NetworkAdapters", &m.NetworkAdapters) - delete(rawMsg, key) - case "numberOfCores": - err = unpopulate(val, "NumberOfCores", &m.NumberOfCores) - delete(rawMsg, key) - case "operatingSystemName": - err = unpopulate(val, "OperatingSystemName", &m.OperatingSystemName) - delete(rawMsg, key) - case "operatingSystemType": - err = unpopulate(val, "OperatingSystemType", &m.OperatingSystemType) - delete(rawMsg, key) - case "operatingSystemVersion": - err = unpopulate(val, "OperatingSystemVersion", &m.OperatingSystemVersion) + case "name": + err = unpopulate(val, "Name", &n.Name) delete(rawMsg, key) - case "updatedTimestamp": - err = unpopulateDateTimeRFC3339(val, "UpdatedTimestamp", &m.UpdatedTimestamp) + case "value": + err = unpopulate(val, "Value", &n.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MachineResultList. -func (m MachineResultList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NameValuePairCostType. +func (n NameValuePairCostType) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", m.NextLink) - populate(objectMap, "value", m.Value) + populate(objectMap, "name", n.Name) + populate(objectMap, "value", n.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MachineResultList. -func (m *MachineResultList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NameValuePairCostType. +func (n *NameValuePairCostType) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &m.NextLink) + case "name": + err = unpopulate(val, "Name", &n.Name) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &m.Value) + err = unpopulate(val, "Value", &n.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkAdapter. -func (n NetworkAdapter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NameValuePairSavingsType. +func (n NameValuePairSavingsType) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", n.DisplayName) - populate(objectMap, "ipAddresses", n.IPAddresses) - populate(objectMap, "macAddress", n.MacAddress) + populate(objectMap, "name", n.Name) + populate(objectMap, "value", n.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkAdapter. -func (n *NetworkAdapter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NameValuePairSavingsType. +func (n *NameValuePairSavingsType) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) @@ -1377,14 +1400,11 @@ func (n *NetworkAdapter) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &n.DisplayName) - delete(rawMsg, key) - case "ipAddresses": - err = unpopulate(val, "IPAddresses", &n.IPAddresses) + case "name": + err = unpopulate(val, "Name", &n.Name) delete(rawMsg, key) - case "macAddress": - err = unpopulate(val, "MacAddress", &n.MacAddress) + case "value": + err = unpopulate(val, "Value", &n.Value) delete(rawMsg, key) } if err != nil { @@ -1397,7 +1417,9 @@ func (n *NetworkAdapter) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Operation. func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) populate(objectMap, "name", o.Name) populate(objectMap, "origin", o.Origin) return json.Marshal(objectMap) @@ -1412,9 +1434,15 @@ func (o *Operation) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) case "display": err = unpopulate(val, "Display", &o.Display) delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) @@ -1468,15 +1496,16 @@ func (o *OperationDisplay) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationResultList. -func (o OperationResultList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) populate(objectMap, "value", o.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResultList. -func (o *OperationResultList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) @@ -1484,6 +1513,9 @@ func (o *OperationResultList) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &o.Value) delete(rawMsg, key) @@ -1495,19 +1527,18 @@ func (o *OperationResultList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. -func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PerformanceData. +func (p PerformanceData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", p.ETag) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) + populate(objectMap, "percentile", p.Percentile) + populateDateTimeRFC3339(objectMap, "perfDataEndTime", p.PerfDataEndTime) + populateDateTimeRFC3339(objectMap, "perfDataStartTime", p.PerfDataStartTime) + populate(objectMap, "timeRange", p.TimeRange) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. -func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PerformanceData. +func (p *PerformanceData) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -1515,20 +1546,17 @@ func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &p.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) + case "percentile": + err = unpopulate(val, "Percentile", &p.Percentile) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) + case "perfDataEndTime": + err = unpopulateDateTimeRFC3339(val, "PerfDataEndTime", &p.PerfDataEndTime) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) + case "perfDataStartTime": + err = unpopulateDateTimeRFC3339(val, "PerfDataStartTime", &p.PerfDataStartTime) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "timeRange": + err = unpopulate(val, "TimeRange", &p.TimeRange) delete(rawMsg, key) } if err != nil { @@ -1538,16 +1566,17 @@ func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionCollection. -func (p PrivateEndpointConnectionCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProcessorInfo. +func (p ProcessorInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "name", p.Name) + populate(objectMap, "numberOfCoresPerSocket", p.NumberOfCoresPerSocket) + populate(objectMap, "numberOfSockets", p.NumberOfSockets) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionCollection. -func (p *PrivateEndpointConnectionCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProcessorInfo. +func (p *ProcessorInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -1555,11 +1584,14 @@ func (p *PrivateEndpointConnectionCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) + case "name": + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + case "numberOfCoresPerSocket": + err = unpopulate(val, "NumberOfCoresPerSocket", &p.NumberOfCoresPerSocket) + delete(rawMsg, key) + case "numberOfSockets": + err = unpopulate(val, "NumberOfSockets", &p.NumberOfSockets) delete(rawMsg, key) } if err != nil { @@ -1569,17 +1601,25 @@ func (p *PrivateEndpointConnectionCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. -func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProductSupportStatus. +func (p ProductSupportStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "privateEndpoint", p.PrivateEndpoint) - populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) - populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "currentEsuYear", p.CurrentEsuYear) + populate(objectMap, "currentVersion", p.CurrentVersion) + populate(objectMap, "esuStatus", p.EsuStatus) + populate(objectMap, "eta", p.Eta) + populateDateTimeRFC3339(objectMap, "extendedSecurityUpdateYear1EndDate", p.ExtendedSecurityUpdateYear1EndDate) + populateDateTimeRFC3339(objectMap, "extendedSecurityUpdateYear2EndDate", p.ExtendedSecurityUpdateYear2EndDate) + populateDateTimeRFC3339(objectMap, "extendedSecurityUpdateYear3EndDate", p.ExtendedSecurityUpdateYear3EndDate) + populateDateTimeRFC3339(objectMap, "extendedSupportEndDate", p.ExtendedSupportEndDate) + populateDateTimeRFC3339(objectMap, "mainstreamEndDate", p.MainstreamEndDate) + populate(objectMap, "servicePackStatus", p.ServicePackStatus) + populate(objectMap, "supportStatus", p.SupportStatus) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. -func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductSupportStatus. +func (p *ProductSupportStatus) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -1587,14 +1627,38 @@ func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "privateEndpoint": - err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + case "currentEsuYear": + err = unpopulate(val, "CurrentEsuYear", &p.CurrentEsuYear) delete(rawMsg, key) - case "privateLinkServiceConnectionState": - err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + case "currentVersion": + err = unpopulate(val, "CurrentVersion", &p.CurrentVersion) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + case "esuStatus": + err = unpopulate(val, "EsuStatus", &p.EsuStatus) + delete(rawMsg, key) + case "eta": + err = unpopulate(val, "Eta", &p.Eta) + delete(rawMsg, key) + case "extendedSecurityUpdateYear1EndDate": + err = unpopulateDateTimeRFC3339(val, "ExtendedSecurityUpdateYear1EndDate", &p.ExtendedSecurityUpdateYear1EndDate) + delete(rawMsg, key) + case "extendedSecurityUpdateYear2EndDate": + err = unpopulateDateTimeRFC3339(val, "ExtendedSecurityUpdateYear2EndDate", &p.ExtendedSecurityUpdateYear2EndDate) + delete(rawMsg, key) + case "extendedSecurityUpdateYear3EndDate": + err = unpopulateDateTimeRFC3339(val, "ExtendedSecurityUpdateYear3EndDate", &p.ExtendedSecurityUpdateYear3EndDate) + delete(rawMsg, key) + case "extendedSupportEndDate": + err = unpopulateDateTimeRFC3339(val, "ExtendedSupportEndDate", &p.ExtendedSupportEndDate) + delete(rawMsg, key) + case "mainstreamEndDate": + err = unpopulateDateTimeRFC3339(val, "MainstreamEndDate", &p.MainstreamEndDate) + delete(rawMsg, key) + case "servicePackStatus": + err = unpopulate(val, "ServicePackStatus", &p.ServicePackStatus) + delete(rawMsg, key) + case "supportStatus": + err = unpopulate(val, "SupportStatus", &p.SupportStatus) delete(rawMsg, key) } if err != nil { @@ -1604,351 +1668,300 @@ func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. -func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecommendedFor. +func (r RecommendedFor) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) + populate(objectMap, "strategies", r.Strategies) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. -func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedFor. +func (r *RecommendedFor) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "strategies": + err = unpopulate(val, "Strategies", &r.Strategies) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceCollection. -func (p PrivateLinkResourceCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SKUDetails. +func (s SKUDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "capabilities", s.Capabilities) + populate(objectMap, "skuName", s.SKUName) + populate(objectMap, "skuType", s.SKUType) + populate(objectMap, "totalCost", s.TotalCost) + populate(objectMap, "totalSavings", s.TotalSavings) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceCollection. -func (p *PrivateLinkResourceCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUDetails. +func (s *SKUDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) + case "capabilities": + err = unpopulate(val, "Capabilities", &s.Capabilities) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + case "skuName": + err = unpopulate(val, "SKUName", &s.SKUName) + delete(rawMsg, key) + case "skuType": + err = unpopulate(val, "SKUType", &s.SKUType) + delete(rawMsg, key) + case "totalCost": + err = unpopulate(val, "TotalCost", &s.TotalCost) + delete(rawMsg, key) + case "totalSavings": + err = unpopulate(val, "TotalSavings", &s.TotalSavings) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. -func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SKUsMigrationSuitability. +func (s SKUsMigrationSuitability) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "groupId", p.GroupID) - populate(objectMap, "requiredMembers", p.RequiredMembers) - populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + populate(objectMap, "details", s.Details) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "id", s.ID) + populate(objectMap, "kind", s.Kind) + populate(objectMap, "resourceUri", s.ResourceURI) + populate(objectMap, "sources", s.Sources) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. -func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUsMigrationSuitability. +func (s *SKUsMigrationSuitability) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "groupId": - err = unpopulate(val, "GroupID", &p.GroupID) + case "details": + err = unpopulate(val, "Details", &s.Details) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "requiredMembers": - err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) delete(rawMsg, key) - case "requiredZoneNames": - err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + case "resourceUri": + err = unpopulate(val, "ResourceURI", &s.ResourceURI) + delete(rawMsg, key) + case "sources": + err = unpopulate(val, "Sources", &s.Sources) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. -func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SavingsDetailsCommon. +func (s SavingsDetailsCommon) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actionsRequired", p.ActionsRequired) - populate(objectMap, "description", p.Description) - populate(objectMap, "status", p.Status) + populate(objectMap, "savingOptions", s.SavingOptions) + populate(objectMap, "savingsDetail", s.SavingsDetail) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. -func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsDetailsCommon. +func (s *SavingsDetailsCommon) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "actionsRequired": - err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + case "savingOptions": + err = unpopulate(val, "SavingOptions", &s.SavingOptions) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &p.Description) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &p.Status) + case "savingsDetail": + err = unpopulate(val, "SavingsDetail", &s.SavingsDetail) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Project. -func (p Project) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SavingsSettings. +func (s SavingsSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", p.ETag) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populateAny(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) + populate(objectMap, "azureOfferCode", s.AzureOfferCode) + populate(objectMap, "savingsOptions", s.SavingsOptions) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Project. -func (p *Project) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsSettings. +func (s *SavingsSettings) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &p.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &p.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &p.Tags) + case "azureOfferCode": + err = unpopulate(val, "AzureOfferCode", &s.AzureOfferCode) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "savingsOptions": + err = unpopulate(val, "SavingsOptions", &s.SavingsOptions) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProjectProperties. -func (p ProjectProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Scope. +func (s Scope) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "assessmentSolutionId", p.AssessmentSolutionID) - populateDateTimeRFC3339(objectMap, "createdTimestamp", p.CreatedTimestamp) - populate(objectMap, "customerStorageAccountArmId", p.CustomerStorageAccountArmID) - populate(objectMap, "customerWorkspaceId", p.CustomerWorkspaceID) - populate(objectMap, "customerWorkspaceLocation", p.CustomerWorkspaceLocation) - populateDateTimeRFC3339(objectMap, "lastAssessmentTimestamp", p.LastAssessmentTimestamp) - populate(objectMap, "numberOfAssessments", p.NumberOfAssessments) - populate(objectMap, "numberOfGroups", p.NumberOfGroups) - populate(objectMap, "numberOfMachines", p.NumberOfMachines) - populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) - populate(objectMap, "projectStatus", p.ProjectStatus) - populate(objectMap, "provisioningState", p.ProvisioningState) - populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) - populate(objectMap, "serviceEndpoint", p.ServiceEndpoint) - populateDateTimeRFC3339(objectMap, "updatedTimestamp", p.UpdatedTimestamp) + populate(objectMap, "azureResourceGraphQuery", s.AzureResourceGraphQuery) + populate(objectMap, "scopeType", s.ScopeType) + populate(objectMap, "serverGroupId", s.ServerGroupID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProjectProperties. -func (p *ProjectProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Scope. +func (s *Scope) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "assessmentSolutionId": - err = unpopulate(val, "AssessmentSolutionID", &p.AssessmentSolutionID) - delete(rawMsg, key) - case "createdTimestamp": - err = unpopulateDateTimeRFC3339(val, "CreatedTimestamp", &p.CreatedTimestamp) - delete(rawMsg, key) - case "customerStorageAccountArmId": - err = unpopulate(val, "CustomerStorageAccountArmID", &p.CustomerStorageAccountArmID) - delete(rawMsg, key) - case "customerWorkspaceId": - err = unpopulate(val, "CustomerWorkspaceID", &p.CustomerWorkspaceID) - delete(rawMsg, key) - case "customerWorkspaceLocation": - err = unpopulate(val, "CustomerWorkspaceLocation", &p.CustomerWorkspaceLocation) - delete(rawMsg, key) - case "lastAssessmentTimestamp": - err = unpopulateDateTimeRFC3339(val, "LastAssessmentTimestamp", &p.LastAssessmentTimestamp) - delete(rawMsg, key) - case "numberOfAssessments": - err = unpopulate(val, "NumberOfAssessments", &p.NumberOfAssessments) - delete(rawMsg, key) - case "numberOfGroups": - err = unpopulate(val, "NumberOfGroups", &p.NumberOfGroups) - delete(rawMsg, key) - case "numberOfMachines": - err = unpopulate(val, "NumberOfMachines", &p.NumberOfMachines) + case "azureResourceGraphQuery": + err = unpopulate(val, "AzureResourceGraphQuery", &s.AzureResourceGraphQuery) delete(rawMsg, key) - case "privateEndpointConnections": - err = unpopulate(val, "PrivateEndpointConnections", &p.PrivateEndpointConnections) + case "scopeType": + err = unpopulate(val, "ScopeType", &s.ScopeType) delete(rawMsg, key) - case "projectStatus": - err = unpopulate(val, "ProjectStatus", &p.ProjectStatus) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) - delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &p.PublicNetworkAccess) - delete(rawMsg, key) - case "serviceEndpoint": - err = unpopulate(val, "ServiceEndpoint", &p.ServiceEndpoint) - delete(rawMsg, key) - case "updatedTimestamp": - err = unpopulateDateTimeRFC3339(val, "UpdatedTimestamp", &p.UpdatedTimestamp) + case "serverGroupId": + err = unpopulate(val, "ServerGroupID", &s.ServerGroupID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProjectResultList. -func (p ProjectResultList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SecuritySuitability. +func (s SecuritySuitability) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "readiness", s.Readiness) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProjectResultList. -func (p *ProjectResultList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SecuritySuitability. +func (s *SecuritySuitability) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + case "readiness": + err = unpopulate(val, "Readiness", &s.Readiness) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceID. -func (r ResourceID) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SourceDetails. +func (s SourceDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) + populate(objectMap, "count", s.Count) + populate(objectMap, "platform", s.Platform) + populate(objectMap, "sourceName", s.SourceName) + populate(objectMap, "sourceType", s.SourceType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceID. -func (r *ResourceID) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceDetails. +func (s *SourceDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) + case "count": + err = unpopulate(val, "Count", &s.Count) + delete(rawMsg, key) + case "platform": + err = unpopulate(val, "Platform", &s.Platform) + delete(rawMsg, key) + case "sourceName": + err = unpopulate(val, "SourceName", &s.SourceName) + delete(rawMsg, key) + case "sourceType": + err = unpopulate(val, "SourceType", &s.SourceType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerCollector. -func (s ServerCollector) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SourceRecommendationMigrationSuitability. +func (s SourceRecommendationMigrationSuitability) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", s.ETag) - populate(objectMap, "id", s.ID) + populate(objectMap, "migrationSuitability", s.MigrationSuitability) populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerCollector. -func (s *ServerCollector) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceRecommendationMigrationSuitability. +func (s *SourceRecommendationMigrationSuitability) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -1956,21 +1969,12 @@ func (s *ServerCollector) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &s.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &s.ID) + case "migrationSuitability": + err = unpopulate(val, "MigrationSuitability", &s.MigrationSuitability) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -1979,15 +1983,21 @@ func (s *ServerCollector) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerCollectorList. -func (s ServerCollectorList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SummaryProperties. +func (s SummaryProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", s.Value) + populate(objectMap, "costComponents", s.CostComponents) + populate(objectMap, "savingsComponents", s.SavingsComponents) + populate(objectMap, "sources", s.Sources) + populate(objectMap, "summaryName", s.SummaryName) + populate(objectMap, "summaryType", s.SummaryType) + populate(objectMap, "targetSourceMapping", s.TargetSourceMapping) + populate(objectMap, "targets", s.Targets) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerCollectorList. -func (s *ServerCollectorList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SummaryProperties. +func (s *SummaryProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -1995,8 +2005,26 @@ func (s *ServerCollectorList) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &s.Value) + case "costComponents": + err = unpopulate(val, "CostComponents", &s.CostComponents) + delete(rawMsg, key) + case "savingsComponents": + err = unpopulate(val, "SavingsComponents", &s.SavingsComponents) + delete(rawMsg, key) + case "sources": + err = unpopulate(val, "Sources", &s.Sources) + delete(rawMsg, key) + case "summaryName": + err = unpopulate(val, "SummaryName", &s.SummaryName) + delete(rawMsg, key) + case "summaryType": + err = unpopulate(val, "SummaryType", &s.SummaryType) + delete(rawMsg, key) + case "targetSourceMapping": + err = unpopulate(val, "TargetSourceMapping", &s.TargetSourceMapping) + delete(rawMsg, key) + case "targets": + err = unpopulate(val, "Targets", &s.Targets) delete(rawMsg, key) } if err != nil { @@ -2006,116 +2034,162 @@ func (s *ServerCollectorList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type UpdateGroupBody. -func (u UpdateGroupBody) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", u.ETag) - populate(objectMap, "properties", u.Properties) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateGroupBody. -func (u *UpdateGroupBody) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &u.ETag) + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &u.Properties) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VMFamily. -func (v VMFamily) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TargetDetails. +func (t TargetDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "category", v.Category) - populate(objectMap, "familyName", v.FamilyName) - populate(objectMap, "targetLocations", v.TargetLocations) + populate(objectMap, "count", t.Count) + populate(objectMap, "platform", t.Platform) + populate(objectMap, "targetName", t.TargetName) + populate(objectMap, "targetType", t.TargetType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VMFamily. -func (v *VMFamily) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TargetDetails. +func (t *TargetDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "category": - err = unpopulate(val, "Category", &v.Category) + case "count": + err = unpopulate(val, "Count", &t.Count) delete(rawMsg, key) - case "familyName": - err = unpopulate(val, "FamilyName", &v.FamilyName) + case "platform": + err = unpopulate(val, "Platform", &t.Platform) delete(rawMsg, key) - case "targetLocations": - err = unpopulate(val, "TargetLocations", &v.TargetLocations) + case "targetName": + err = unpopulate(val, "TargetName", &t.TargetName) + delete(rawMsg, key) + case "targetType": + err = unpopulate(val, "TargetType", &t.TargetType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VMUptime. -func (v VMUptime) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TargetSourcePair. +func (t TargetSourcePair) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "daysPerMonth", v.DaysPerMonth) - populate(objectMap, "hoursPerDay", v.HoursPerDay) + populate(objectMap, "confidenceScore", t.ConfidenceScore) + populate(objectMap, "costDetails", t.CostDetails) + populate(objectMap, "managementDetails", t.ManagementDetails) + populate(objectMap, "migrationDetails", t.MigrationDetails) + populate(objectMap, "savingsDetails", t.SavingsDetails) + populate(objectMap, "sourceCount", t.SourceCount) + populate(objectMap, "sourceRef", t.SourceRef) + populate(objectMap, "targetCount", t.TargetCount) + populate(objectMap, "targetRef", t.TargetRef) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VMUptime. -func (v *VMUptime) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TargetSourcePair. +func (t *TargetSourcePair) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "daysPerMonth": - err = unpopulate(val, "DaysPerMonth", &v.DaysPerMonth) + case "confidenceScore": + err = unpopulate(val, "ConfidenceScore", &t.ConfidenceScore) delete(rawMsg, key) - case "hoursPerDay": - err = unpopulate(val, "HoursPerDay", &v.HoursPerDay) + case "costDetails": + err = unpopulate(val, "CostDetails", &t.CostDetails) + delete(rawMsg, key) + case "managementDetails": + err = unpopulate(val, "ManagementDetails", &t.ManagementDetails) + delete(rawMsg, key) + case "migrationDetails": + err = unpopulate(val, "MigrationDetails", &t.MigrationDetails) + delete(rawMsg, key) + case "savingsDetails": + err = unpopulate(val, "SavingsDetails", &t.SavingsDetails) + delete(rawMsg, key) + case "sourceCount": + err = unpopulate(val, "SourceCount", &t.SourceCount) + delete(rawMsg, key) + case "sourceRef": + err = unpopulate(val, "SourceRef", &t.SourceRef) + delete(rawMsg, key) + case "targetCount": + err = unpopulate(val, "TargetCount", &t.TargetCount) + delete(rawMsg, key) + case "targetRef": + err = unpopulate(val, "TargetRef", &t.TargetRef) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VMwareCollector. -func (v VMwareCollector) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VMSecuritySuitability. +func (v VMSecuritySuitability) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", v.ETag) - populate(objectMap, "id", v.ID) - populate(objectMap, "name", v.Name) - populate(objectMap, "properties", v.Properties) - populate(objectMap, "type", v.Type) + populate(objectMap, "securitySuitability", v.SecuritySuitability) + populate(objectMap, "securitySuitabilityDetails", v.SecuritySuitabilityDetails) + populate(objectMap, "vmSecurityType", v.VMSecurityType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VMwareCollector. -func (v *VMwareCollector) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VMSecuritySuitability. +func (v *VMSecuritySuitability) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -2123,20 +2197,14 @@ func (v *VMwareCollector) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &v.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &v.ID) + case "securitySuitability": + err = unpopulate(val, "SecuritySuitability", &v.SecuritySuitability) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &v.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &v.Properties) + case "securitySuitabilityDetails": + err = unpopulate(val, "SecuritySuitabilityDetails", &v.SecuritySuitabilityDetails) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &v.Type) + case "vmSecurityType": + err = unpopulate(val, "VMSecurityType", &v.VMSecurityType) delete(rawMsg, key) } if err != nil { @@ -2146,15 +2214,16 @@ func (v *VMwareCollector) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VMwareCollectorList. -func (v VMwareCollectorList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VMUptime. +func (v VMUptime) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", v.Value) + populate(objectMap, "daysPerMonth", v.DaysPerMonth) + populate(objectMap, "hoursPerDay", v.HoursPerDay) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VMwareCollectorList. -func (v *VMwareCollectorList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VMUptime. +func (v *VMUptime) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -2162,8 +2231,11 @@ func (v *VMwareCollectorList) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &v.Value) + case "daysPerMonth": + err = unpopulate(val, "DaysPerMonth", &v.DaysPerMonth) + delete(rawMsg, key) + case "hoursPerDay": + err = unpopulate(val, "HoursPerDay", &v.HoursPerDay) delete(rawMsg, key) } if err != nil { @@ -2183,18 +2255,8 @@ func populate(m map[string]any, k string, v any) { } } -func populateAny(m map[string]any, k string, v any) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else { - m[k] = v - } -} - func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/migrate/armmigrate/operations_client.go b/sdk/resourcemanager/migrate/armmigrate/operations_client.go index 6b386c87504c..2afb70a31865 100644 --- a/sdk/resourcemanager/migrate/armmigrate/operations_client.go +++ b/sdk/resourcemanager/migrate/armmigrate/operations_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmigrate @@ -37,28 +33,27 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - Get a list of REST API supported by Microsoft.Migrate provider. +// NewListPager - List the operations for the provider // -// Generated from API version 2019-10-01 +// Generated from API version 2024-03-03-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ More: func(page OperationsClientListResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") - req, err := client.listCreateRequest(ctx, options) - if err != nil { - return OperationsClientListResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) if err != nil { return OperationsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return OperationsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -66,12 +61,15 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Migrate/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-03-03-preview") + req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -79,7 +77,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { result := OperationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationResultList); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { return OperationsClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/migrate/armmigrate/operations_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/operations_client_example_test.go index 010dbea04578..2cd912f88949 100644 --- a/sdk/resourcemanager/migrate/armmigrate/operations_client_example_test.go +++ b/sdk/resourcemanager/migrate/armmigrate/operations_client_example_test.go @@ -1,30 +1,24 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmigrate_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Operations_List.json +// Generated from example definition: 2024-03-03-preview/Operations_List_MaximumSet_Gen.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) + clientFactory, err := armmigrate.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -39,28 +33,24 @@ func ExampleOperationsClient_NewListPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationResultList = armmigrate.OperationResultList{ - // Value: []*armmigrate.Operation{ - // { - // Name: to.Ptr("Read"), - // Display: &armmigrate.OperationDisplay{ - // Description: to.Ptr("Reads a project"), - // Operation: to.Ptr("Read"), - // Provider: to.Ptr("Microsoft.Migrate"), - // Resource: to.Ptr("Microsoft.Migrate/assessmentProjects"), + // page = armmigrate.OperationsClientListResponse{ + // OperationListResult: armmigrate.OperationListResult{ + // Value: []*armmigrate.Operation{ + // { + // Name: to.Ptr("guffjdxaatvfwz"), + // IsDataAction: to.Ptr(true), + // Display: &armmigrate.OperationDisplay{ + // Provider: to.Ptr("oqsbmbvstckgydurxyxupnmooi"), + // Resource: to.Ptr("yjfklnzpnoec"), + // Operation: to.Ptr("vvlsgfbhvnicusuzhnpyhg"), + // Description: to.Ptr("lvkrcrokkyhvpjrtumiusmbyktwwop"), + // }, + // Origin: to.Ptr(armmigrate.OriginUser), + // ActionType: to.Ptr(armmigrate.ActionTypeInternal), // }, - // Origin: to.Ptr("user,system"), // }, - // { - // Name: to.Ptr("Write"), - // Display: &armmigrate.OperationDisplay{ - // Description: to.Ptr("Creates or updates a project"), - // Operation: to.Ptr("Write"), - // Provider: to.Ptr("Microsoft.Migrate"), - // Resource: to.Ptr("Microsoft.Migrate/assessmentProjects"), - // }, - // Origin: to.Ptr("user,system"), - // }}, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, // } } } diff --git a/sdk/resourcemanager/migrate/armmigrate/options.go b/sdk/resourcemanager/migrate/armmigrate/options.go index 49e70067f93c..56d1327d0fc1 100644 --- a/sdk/resourcemanager/migrate/armmigrate/options.go +++ b/sdk/resourcemanager/migrate/armmigrate/options.go @@ -1,263 +1,88 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmigrate -// AssessedMachinesClientGetOptions contains the optional parameters for the AssessedMachinesClient.Get method. -type AssessedMachinesClientGetOptions struct { - // placeholder for future optional parameters -} - -// AssessedMachinesClientListByAssessmentOptions contains the optional parameters for the AssessedMachinesClient.NewListByAssessmentPager +// AssessedMachinesV2OperationsClientGetOptions contains the optional parameters for the AssessedMachinesV2OperationsClient.Get // method. -type AssessedMachinesClientListByAssessmentOptions struct { - // placeholder for future optional parameters -} - -// AssessmentsClientCreateOptions contains the optional parameters for the AssessmentsClient.Create method. -type AssessmentsClientCreateOptions struct { - // New or Updated Assessment object. - Assessment *Assessment -} - -// AssessmentsClientDeleteOptions contains the optional parameters for the AssessmentsClient.Delete method. -type AssessmentsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// AssessmentsClientGetOptions contains the optional parameters for the AssessmentsClient.Get method. -type AssessmentsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AssessmentsClientGetReportDownloadURLOptions contains the optional parameters for the AssessmentsClient.GetReportDownloadURL -// method. -type AssessmentsClientGetReportDownloadURLOptions struct { - // placeholder for future optional parameters -} - -// AssessmentsClientListByGroupOptions contains the optional parameters for the AssessmentsClient.NewListByGroupPager method. -type AssessmentsClientListByGroupOptions struct { - // placeholder for future optional parameters -} - -// AssessmentsClientListByProjectOptions contains the optional parameters for the AssessmentsClient.NewListByProjectPager -// method. -type AssessmentsClientListByProjectOptions struct { - // placeholder for future optional parameters -} - -// GroupsClientCreateOptions contains the optional parameters for the GroupsClient.Create method. -type GroupsClientCreateOptions struct { - // New or Updated Group object. - Group *Group -} - -// GroupsClientDeleteOptions contains the optional parameters for the GroupsClient.Delete method. -type GroupsClientDeleteOptions struct { +type AssessedMachinesV2OperationsClientGetOptions struct { // placeholder for future optional parameters } -// GroupsClientGetOptions contains the optional parameters for the GroupsClient.Get method. -type GroupsClientGetOptions struct { - // placeholder for future optional parameters -} - -// GroupsClientListByProjectOptions contains the optional parameters for the GroupsClient.NewListByProjectPager method. -type GroupsClientListByProjectOptions struct { - // placeholder for future optional parameters -} - -// GroupsClientUpdateMachinesOptions contains the optional parameters for the GroupsClient.UpdateMachines method. -type GroupsClientUpdateMachinesOptions struct { - // Machines list to be added or removed from group. - GroupUpdateProperties *UpdateGroupBody -} - -// HyperVCollectorsClientCreateOptions contains the optional parameters for the HyperVCollectorsClient.Create method. -type HyperVCollectorsClientCreateOptions struct { - // New or Updated Hyper-V collector. - CollectorBody *HyperVCollector -} - -// HyperVCollectorsClientDeleteOptions contains the optional parameters for the HyperVCollectorsClient.Delete method. -type HyperVCollectorsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// HyperVCollectorsClientGetOptions contains the optional parameters for the HyperVCollectorsClient.Get method. -type HyperVCollectorsClientGetOptions struct { - // placeholder for future optional parameters -} - -// HyperVCollectorsClientListByProjectOptions contains the optional parameters for the HyperVCollectorsClient.NewListByProjectPager +// AssessedMachinesV2OperationsClientListByParentOptions contains the optional parameters for the AssessedMachinesV2OperationsClient.NewListByParentPager // method. -type HyperVCollectorsClientListByProjectOptions struct { - // placeholder for future optional parameters -} +type AssessedMachinesV2OperationsClientListByParentOptions struct { + // Filter query. + Filter *string -// ImportCollectorsClientCreateOptions contains the optional parameters for the ImportCollectorsClient.Create method. -type ImportCollectorsClientCreateOptions struct { - // New or Updated Import collector. - CollectorBody *ImportCollector -} + // Optional parameter for continuation token. + ContinuationToken *string -// ImportCollectorsClientDeleteOptions contains the optional parameters for the ImportCollectorsClient.Delete method. -type ImportCollectorsClientDeleteOptions struct { - // placeholder for future optional parameters -} + // Optional parameter for page size. + PageSize *int32 -// ImportCollectorsClientGetOptions contains the optional parameters for the ImportCollectorsClient.Get method. -type ImportCollectorsClientGetOptions struct { - // placeholder for future optional parameters + // Total record count. + TotalRecordCount *int32 } -// ImportCollectorsClientListByProjectOptions contains the optional parameters for the ImportCollectorsClient.NewListByProjectPager +// MachineAssessmentV2SummaryOperationsClientGetOptions contains the optional parameters for the MachineAssessmentV2SummaryOperationsClient.Get // method. -type ImportCollectorsClientListByProjectOptions struct { +type MachineAssessmentV2SummaryOperationsClientGetOptions struct { // placeholder for future optional parameters } -// MachinesClientGetOptions contains the optional parameters for the MachinesClient.Get method. -type MachinesClientGetOptions struct { - // placeholder for future optional parameters -} - -// MachinesClientListByProjectOptions contains the optional parameters for the MachinesClient.NewListByProjectPager method. -type MachinesClientListByProjectOptions struct { - // placeholder for future optional parameters -} - -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionClientDeleteOptions contains the optional parameters for the PrivateEndpointConnectionClient.Delete +// MachineAssessmentV2SummaryOperationsClientListByParentOptions contains the optional parameters for the MachineAssessmentV2SummaryOperationsClient.NewListByParentPager // method. -type PrivateEndpointConnectionClientDeleteOptions struct { +type MachineAssessmentV2SummaryOperationsClientListByParentOptions struct { // placeholder for future optional parameters } -// PrivateEndpointConnectionClientGetOptions contains the optional parameters for the PrivateEndpointConnectionClient.Get +// MachineAssessmentsV2OperationsClientBeginCreateOptions contains the optional parameters for the MachineAssessmentsV2OperationsClient.BeginCreate // method. -type PrivateEndpointConnectionClientGetOptions struct { - // placeholder for future optional parameters +type MachineAssessmentsV2OperationsClientBeginCreateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string } -// PrivateEndpointConnectionClientListByProjectOptions contains the optional parameters for the PrivateEndpointConnectionClient.ListByProject +// MachineAssessmentsV2OperationsClientBeginDownloadURLOptions contains the optional parameters for the MachineAssessmentsV2OperationsClient.BeginDownloadURL // method. -type PrivateEndpointConnectionClientListByProjectOptions struct { - // placeholder for future optional parameters +type MachineAssessmentsV2OperationsClientBeginDownloadURLOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string } -// PrivateEndpointConnectionClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionClient.Update +// MachineAssessmentsV2OperationsClientDeleteOptions contains the optional parameters for the MachineAssessmentsV2OperationsClient.Delete // method. -type PrivateEndpointConnectionClientUpdateOptions struct { - // New or Updated Private Endpoint Connection object. - PrivateEndpointConnectionBody *PrivateEndpointConnection -} - -// PrivateLinkResourceClientGetOptions contains the optional parameters for the PrivateLinkResourceClient.Get method. -type PrivateLinkResourceClientGetOptions struct { +type MachineAssessmentsV2OperationsClientDeleteOptions struct { // placeholder for future optional parameters } -// PrivateLinkResourceClientListByProjectOptions contains the optional parameters for the PrivateLinkResourceClient.ListByProject +// MachineAssessmentsV2OperationsClientGetOptions contains the optional parameters for the MachineAssessmentsV2OperationsClient.Get // method. -type PrivateLinkResourceClientListByProjectOptions struct { +type MachineAssessmentsV2OperationsClientGetOptions struct { // placeholder for future optional parameters } -// ProjectsClientAssessmentOptionsListOptions contains the optional parameters for the ProjectsClient.NewAssessmentOptionsListPager +// MachineAssessmentsV2OperationsClientListByParentOptions contains the optional parameters for the MachineAssessmentsV2OperationsClient.NewListByParentPager // method. -type ProjectsClientAssessmentOptionsListOptions struct { - // placeholder for future optional parameters -} - -// ProjectsClientAssessmentOptionsOptions contains the optional parameters for the ProjectsClient.AssessmentOptions method. -type ProjectsClientAssessmentOptionsOptions struct { - // placeholder for future optional parameters -} - -// ProjectsClientCreateOptions contains the optional parameters for the ProjectsClient.Create method. -type ProjectsClientCreateOptions struct { - // New or Updated project object. - Project *Project -} - -// ProjectsClientDeleteOptions contains the optional parameters for the ProjectsClient.Delete method. -type ProjectsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ProjectsClientGetOptions contains the optional parameters for the ProjectsClient.Get method. -type ProjectsClientGetOptions struct { +type MachineAssessmentsV2OperationsClientListByParentOptions struct { // placeholder for future optional parameters } -// ProjectsClientListBySubscriptionOptions contains the optional parameters for the ProjectsClient.NewListBySubscriptionPager +// MachineGraphAssessmentOptionsOperationsClientGetOptions contains the optional parameters for the MachineGraphAssessmentOptionsOperationsClient.Get // method. -type ProjectsClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// ProjectsClientListOptions contains the optional parameters for the ProjectsClient.NewListPager method. -type ProjectsClientListOptions struct { +type MachineGraphAssessmentOptionsOperationsClientGetOptions struct { // placeholder for future optional parameters } -// ProjectsClientUpdateOptions contains the optional parameters for the ProjectsClient.Update method. -type ProjectsClientUpdateOptions struct { - // Updated project object. - Project *Project -} - -// ServerCollectorsClientCreateOptions contains the optional parameters for the ServerCollectorsClient.Create method. -type ServerCollectorsClientCreateOptions struct { - // New or Updated Server collector. - CollectorBody *ServerCollector -} - -// ServerCollectorsClientDeleteOptions contains the optional parameters for the ServerCollectorsClient.Delete method. -type ServerCollectorsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ServerCollectorsClientGetOptions contains the optional parameters for the ServerCollectorsClient.Get method. -type ServerCollectorsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServerCollectorsClientListByProjectOptions contains the optional parameters for the ServerCollectorsClient.NewListByProjectPager +// MachineGraphAssessmentOptionsOperationsClientListByParentOptions contains the optional parameters for the MachineGraphAssessmentOptionsOperationsClient.NewListByParentPager // method. -type ServerCollectorsClientListByProjectOptions struct { - // placeholder for future optional parameters -} - -// VMwareCollectorsClientCreateOptions contains the optional parameters for the VMwareCollectorsClient.Create method. -type VMwareCollectorsClientCreateOptions struct { - // New or Updated VMware collector. - CollectorBody *VMwareCollector -} - -// VMwareCollectorsClientDeleteOptions contains the optional parameters for the VMwareCollectorsClient.Delete method. -type VMwareCollectorsClientDeleteOptions struct { +type MachineGraphAssessmentOptionsOperationsClientListByParentOptions struct { // placeholder for future optional parameters } -// VMwareCollectorsClientGetOptions contains the optional parameters for the VMwareCollectorsClient.Get method. -type VMwareCollectorsClientGetOptions struct { - // placeholder for future optional parameters -} - -// VMwareCollectorsClientListByProjectOptions contains the optional parameters for the VMwareCollectorsClient.NewListByProjectPager -// method. -type VMwareCollectorsClientListByProjectOptions struct { +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { // placeholder for future optional parameters } diff --git a/sdk/resourcemanager/migrate/armmigrate/privateendpointconnection_client.go b/sdk/resourcemanager/migrate/armmigrate/privateendpointconnection_client.go deleted file mode 100644 index 8496f510fbfc..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/privateendpointconnection_client.go +++ /dev/null @@ -1,336 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// PrivateEndpointConnectionClient contains the methods for the PrivateEndpointConnection group. -// Don't use this type directly, use NewPrivateEndpointConnectionClient() instead. -type PrivateEndpointConnectionClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPrivateEndpointConnectionClient creates a new instance of PrivateEndpointConnectionClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewPrivateEndpointConnectionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PrivateEndpointConnectionClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Delete - Delete the private endpoint connection from the project. T. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - privateEndpointConnectionName - Unique name of a private endpoint connection within a project. -// - options - PrivateEndpointConnectionClientDeleteOptions contains the optional parameters for the PrivateEndpointConnectionClient.Delete -// method. -func (client *PrivateEndpointConnectionClient) Delete(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientDeleteOptions) (PrivateEndpointConnectionClientDeleteResponse, error) { - var err error - const operationName = "PrivateEndpointConnectionClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, privateEndpointConnectionName, options) - if err != nil { - return PrivateEndpointConnectionClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateEndpointConnectionClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return PrivateEndpointConnectionClientDeleteResponse{}, err - } - resp, err := client.deleteHandleResponse(httpResp) - return resp, err -} - -// deleteCreateRequest creates the Delete request. -func (client *PrivateEndpointConnectionClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentprojects/{projectName}/privateEndpointConnections/{privateEndpointConnectionName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if privateEndpointConnectionName == "" { - return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteHandleResponse handles the Delete response. -func (client *PrivateEndpointConnectionClient) deleteHandleResponse(resp *http.Response) (PrivateEndpointConnectionClientDeleteResponse, error) { - result := PrivateEndpointConnectionClientDeleteResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - return result, nil -} - -// Get - Get information related to a specific private endpoint connection in the project. Returns a json object of type 'privateEndpointConnections' -// as specified in the models section. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - privateEndpointConnectionName - Unique name of a private endpoint connection within a project. -// - options - PrivateEndpointConnectionClientGetOptions contains the optional parameters for the PrivateEndpointConnectionClient.Get -// method. -func (client *PrivateEndpointConnectionClient) Get(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientGetOptions) (PrivateEndpointConnectionClientGetResponse, error) { - var err error - const operationName = "PrivateEndpointConnectionClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, privateEndpointConnectionName, options) - if err != nil { - return PrivateEndpointConnectionClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateEndpointConnectionClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateEndpointConnectionClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PrivateEndpointConnectionClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentprojects/{projectName}/privateEndpointConnections/{privateEndpointConnectionName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if privateEndpointConnectionName == "" { - return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PrivateEndpointConnectionClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionClientGetResponse, error) { - result := PrivateEndpointConnectionClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionClientGetResponse{}, err - } - return result, nil -} - -// ListByProject - Get all private endpoint connections in the project. Returns a json array of objects of type 'privateEndpointConnections' -// as specified in the Models section. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - PrivateEndpointConnectionClientListByProjectOptions contains the optional parameters for the PrivateEndpointConnectionClient.ListByProject -// method. -func (client *PrivateEndpointConnectionClient) ListByProject(ctx context.Context, resourceGroupName string, projectName string, options *PrivateEndpointConnectionClientListByProjectOptions) (PrivateEndpointConnectionClientListByProjectResponse, error) { - var err error - const operationName = "PrivateEndpointConnectionClient.ListByProject" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return PrivateEndpointConnectionClientListByProjectResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateEndpointConnectionClientListByProjectResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateEndpointConnectionClientListByProjectResponse{}, err - } - resp, err := client.listByProjectHandleResponse(httpResp) - return resp, err -} - -// listByProjectCreateRequest creates the ListByProject request. -func (client *PrivateEndpointConnectionClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *PrivateEndpointConnectionClientListByProjectOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentprojects/{projectName}/privateEndpointConnections" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByProjectHandleResponse handles the ListByProject response. -func (client *PrivateEndpointConnectionClient) listByProjectHandleResponse(resp *http.Response) (PrivateEndpointConnectionClientListByProjectResponse, error) { - result := PrivateEndpointConnectionClientListByProjectResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionCollection); err != nil { - return PrivateEndpointConnectionClientListByProjectResponse{}, err - } - return result, nil -} - -// Update - Update a specific private endpoint connection in the project. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - privateEndpointConnectionName - Unique name of a private endpoint connection within a project. -// - options - PrivateEndpointConnectionClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionClient.Update -// method. -func (client *PrivateEndpointConnectionClient) Update(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientUpdateOptions) (PrivateEndpointConnectionClientUpdateResponse, error) { - var err error - const operationName = "PrivateEndpointConnectionClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, projectName, privateEndpointConnectionName, options) - if err != nil { - return PrivateEndpointConnectionClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateEndpointConnectionClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return PrivateEndpointConnectionClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *PrivateEndpointConnectionClient) updateCreateRequest(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentprojects/{projectName}/privateEndpointConnections/{privateEndpointConnectionName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if privateEndpointConnectionName == "" { - return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.PrivateEndpointConnectionBody != nil { - if err := runtime.MarshalAsJSON(req, *options.PrivateEndpointConnectionBody); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *PrivateEndpointConnectionClient) updateHandleResponse(resp *http.Response) (PrivateEndpointConnectionClientUpdateResponse, error) { - result := PrivateEndpointConnectionClientUpdateResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/privateendpointconnection_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/privateendpointconnection_client_example_test.go deleted file mode 100644 index 9d5406ed8d4c..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/privateendpointconnection_client_example_test.go +++ /dev/null @@ -1,156 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/PrivateEndpointConnections_ListByProject.json -func ExamplePrivateEndpointConnectionClient_ListByProject() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionClient().ListByProject(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnectionCollection = armmigrate.PrivateEndpointConnectionCollection{ - // Value: []*armmigrate.PrivateEndpointConnection{ - // { - // Name: to.Ptr("custestpece80project3980pe.7e35576b-3df4-478e-9759-f64351cf4f43"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/privateEndpointConnections"), - // ETag: to.Ptr("\"00009300-0000-0300-0000-602b967b0000\""), - // ID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/madhavicus/providers/Microsoft.Migrate/assessmentprojects/custestpece80project/privateEndpointConnections/custestpece80project3980pe.7e35576b-3df4-478e-9759-f64351cf4f43"), - // Properties: &armmigrate.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmigrate.ResourceID{ - // ID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourceGroups/PrivLink-SelfHost/providers/Microsoft.Network/privateEndpoints/custestpece80project3980pe"), - // }, - // PrivateLinkServiceConnectionState: &armmigrate.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr(""), - // Status: to.Ptr(armmigrate.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armmigrate.PrivateEndpointConnectionPropertiesProvisioningStateSucceeded), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/PrivateEndpointConnections_Get.json -func ExamplePrivateEndpointConnectionClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionClient().Get(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "custestpece80project3980pe.7e35576b-3df4-478e-9759-f64351cf4f43", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armmigrate.PrivateEndpointConnection{ - // Name: to.Ptr("custestpece80project3980pe.7e35576b-3df4-478e-9759-f64351cf4f43"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/privateEndpointConnections"), - // ETag: to.Ptr("\"00009300-0000-0300-0000-602b967b0000\""), - // ID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/madhavicus/providers/Microsoft.Migrate/assessmentprojects/custestpece80project/privateEndpointConnections/custestpece80project3980pe.7e35576b-3df4-478e-9759-f64351cf4f43"), - // Properties: &armmigrate.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmigrate.ResourceID{ - // ID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourceGroups/PrivLink-SelfHost/providers/Microsoft.Network/privateEndpoints/custestpece80project3980pe"), - // }, - // PrivateLinkServiceConnectionState: &armmigrate.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr(""), - // Status: to.Ptr(armmigrate.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armmigrate.PrivateEndpointConnectionPropertiesProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/PrivateEndpointConnections_Create.json -func ExamplePrivateEndpointConnectionClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionClient().Update(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "custestpece80project3980pe.7e35576b-3df4-478e-9759-f64351cf4f43", &armmigrate.PrivateEndpointConnectionClientUpdateOptions{PrivateEndpointConnectionBody: &armmigrate.PrivateEndpointConnection{ - ETag: to.Ptr("\"00009300-0000-0300-0000-602b967b0000\""), - Properties: &armmigrate.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armmigrate.PrivateLinkServiceConnectionState{ - ActionsRequired: to.Ptr(""), - Status: to.Ptr(armmigrate.PrivateLinkServiceConnectionStateStatusApproved), - }, - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armmigrate.PrivateEndpointConnection{ - // Name: to.Ptr("custestpece80project3980pe.7e35576b-3df4-478e-9759-f64351cf4f43"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/privateEndpointConnections"), - // ETag: to.Ptr("\"00009300-0000-0300-0000-602b967b0000\""), - // ID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/madhavicus/providers/Microsoft.Migrate/assessmentprojects/custestpece80project/privateEndpointConnections/custestpece80project3980pe.7e35576b-3df4-478e-9759-f64351cf4f43"), - // Properties: &armmigrate.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmigrate.ResourceID{ - // ID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourceGroups/PrivLink-SelfHost/providers/Microsoft.Network/privateEndpoints/custestpece80project3980pe"), - // }, - // PrivateLinkServiceConnectionState: &armmigrate.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr(""), - // Status: to.Ptr(armmigrate.PrivateLinkServiceConnectionStateStatusPending), - // }, - // ProvisioningState: to.Ptr(armmigrate.PrivateEndpointConnectionPropertiesProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/PrivateEndpointConnections_Delete.json -func ExamplePrivateEndpointConnectionClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewPrivateEndpointConnectionClient().Delete(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "custestpece80project3980pe.7e35576b-3df4-478e-9759-f64351cf4f43", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/privatelinkresource_client.go b/sdk/resourcemanager/migrate/armmigrate/privatelinkresource_client.go deleted file mode 100644 index e67386210cdc..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/privatelinkresource_client.go +++ /dev/null @@ -1,186 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// PrivateLinkResourceClient contains the methods for the PrivateLinkResource group. -// Don't use this type directly, use NewPrivateLinkResourceClient() instead. -type PrivateLinkResourceClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPrivateLinkResourceClient creates a new instance of PrivateLinkResourceClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewPrivateLinkResourceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourceClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PrivateLinkResourceClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Get information related to a specific private Link Resource in the project. Returns a json object of type 'privateLinkResources' -// as specified in the models section. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - privateLinkResourceName - Unique name of a private link resource within a project. -// - options - PrivateLinkResourceClientGetOptions contains the optional parameters for the PrivateLinkResourceClient.Get method. -func (client *PrivateLinkResourceClient) Get(ctx context.Context, resourceGroupName string, projectName string, privateLinkResourceName string, options *PrivateLinkResourceClientGetOptions) (PrivateLinkResourceClientGetResponse, error) { - var err error - const operationName = "PrivateLinkResourceClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, privateLinkResourceName, options) - if err != nil { - return PrivateLinkResourceClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateLinkResourceClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateLinkResourceClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PrivateLinkResourceClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, privateLinkResourceName string, options *PrivateLinkResourceClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentprojects/{projectName}/privateLinkResources/{privateLinkResourceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if privateLinkResourceName == "" { - return nil, errors.New("parameter privateLinkResourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{privateLinkResourceName}", url.PathEscape(privateLinkResourceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PrivateLinkResourceClient) getHandleResponse(resp *http.Response) (PrivateLinkResourceClientGetResponse, error) { - result := PrivateLinkResourceClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { - return PrivateLinkResourceClientGetResponse{}, err - } - return result, nil -} - -// ListByProject - Get all private link resources created in the project. Returns a json array of objects of type 'privateLinkResources' -// as specified in the Models section. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - PrivateLinkResourceClientListByProjectOptions contains the optional parameters for the PrivateLinkResourceClient.ListByProject -// method. -func (client *PrivateLinkResourceClient) ListByProject(ctx context.Context, resourceGroupName string, projectName string, options *PrivateLinkResourceClientListByProjectOptions) (PrivateLinkResourceClientListByProjectResponse, error) { - var err error - const operationName = "PrivateLinkResourceClient.ListByProject" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return PrivateLinkResourceClientListByProjectResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateLinkResourceClientListByProjectResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateLinkResourceClientListByProjectResponse{}, err - } - resp, err := client.listByProjectHandleResponse(httpResp) - return resp, err -} - -// listByProjectCreateRequest creates the ListByProject request. -func (client *PrivateLinkResourceClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *PrivateLinkResourceClientListByProjectOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentprojects/{projectName}/privateLinkResources" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByProjectHandleResponse handles the ListByProject response. -func (client *PrivateLinkResourceClient) listByProjectHandleResponse(resp *http.Response) (PrivateLinkResourceClientListByProjectResponse, error) { - result := PrivateLinkResourceClientListByProjectResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceCollection); err != nil { - return PrivateLinkResourceClientListByProjectResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/privatelinkresource_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/privatelinkresource_client_example_test.go deleted file mode 100644 index b4db883810ed..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/privatelinkresource_client_example_test.go +++ /dev/null @@ -1,85 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/PrivateLinkResources_Get.json -func ExamplePrivateLinkResourceClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourceClient().Get(ctx, "madhavicus", "custestpece80project", "Default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResource = armmigrate.PrivateLinkResource{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/privateLinkResources"), - // ID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/madhavicus/providers/Microsoft.Migrate/assessmentprojects/custestpece80project/privateLinkResources/Default"), - // Properties: &armmigrate.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("Default"), - // RequiredMembers: []*string{ - // to.Ptr("CollectorAgent")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.prod.migration.windowsazure.com")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/PrivateLinkResources_ListByProject.json -func ExamplePrivateLinkResourceClient_ListByProject() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourceClient().ListByProject(ctx, "madhavicus", "custestpece80project", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResourceCollection = armmigrate.PrivateLinkResourceCollection{ - // Value: []*armmigrate.PrivateLinkResource{ - // { - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/privateLinkResources"), - // ID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/madhavicus/providers/Microsoft.Migrate/assessmentprojects/custestpece80project/privateLinkResources/Default"), - // Properties: &armmigrate.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("Default"), - // RequiredMembers: []*string{ - // to.Ptr("CollectorAgent")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.prod.migration.windowsazure.com")}, - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/projects_client.go b/sdk/resourcemanager/migrate/armmigrate/projects_client.go deleted file mode 100644 index 0966a23806c3..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/projects_client.go +++ /dev/null @@ -1,583 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ProjectsClient contains the methods for the Projects group. -// Don't use this type directly, use NewProjectsClient() instead. -type ProjectsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewProjectsClient creates a new instance of ProjectsClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewProjectsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProjectsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ProjectsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// AssessmentOptions - Get all available options for the properties of an assessment on a project. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - assessmentOptionsName - Name of the assessment options. The only name accepted in default. -// - options - ProjectsClientAssessmentOptionsOptions contains the optional parameters for the ProjectsClient.AssessmentOptions -// method. -func (client *ProjectsClient) AssessmentOptions(ctx context.Context, resourceGroupName string, projectName string, assessmentOptionsName string, options *ProjectsClientAssessmentOptionsOptions) (ProjectsClientAssessmentOptionsResponse, error) { - var err error - const operationName = "ProjectsClient.AssessmentOptions" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.assessmentOptionsCreateRequest(ctx, resourceGroupName, projectName, assessmentOptionsName, options) - if err != nil { - return ProjectsClientAssessmentOptionsResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProjectsClientAssessmentOptionsResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ProjectsClientAssessmentOptionsResponse{}, err - } - resp, err := client.assessmentOptionsHandleResponse(httpResp) - return resp, err -} - -// assessmentOptionsCreateRequest creates the AssessmentOptions request. -func (client *ProjectsClient) assessmentOptionsCreateRequest(ctx context.Context, resourceGroupName string, projectName string, assessmentOptionsName string, options *ProjectsClientAssessmentOptionsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessmentOptions/{assessmentOptionsName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if assessmentOptionsName == "" { - return nil, errors.New("parameter assessmentOptionsName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentOptionsName}", url.PathEscape(assessmentOptionsName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// assessmentOptionsHandleResponse handles the AssessmentOptions response. -func (client *ProjectsClient) assessmentOptionsHandleResponse(resp *http.Response) (ProjectsClientAssessmentOptionsResponse, error) { - result := ProjectsClientAssessmentOptionsResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.AssessmentOptions); err != nil { - return ProjectsClientAssessmentOptionsResponse{}, err - } - return result, nil -} - -// NewAssessmentOptionsListPager - Gets list of all available options for the properties of an assessment on a project. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - ProjectsClientAssessmentOptionsListOptions contains the optional parameters for the ProjectsClient.NewAssessmentOptionsListPager -// method. -func (client *ProjectsClient) NewAssessmentOptionsListPager(resourceGroupName string, projectName string, options *ProjectsClientAssessmentOptionsListOptions) *runtime.Pager[ProjectsClientAssessmentOptionsListResponse] { - return runtime.NewPager(runtime.PagingHandler[ProjectsClientAssessmentOptionsListResponse]{ - More: func(page ProjectsClientAssessmentOptionsListResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *ProjectsClientAssessmentOptionsListResponse) (ProjectsClientAssessmentOptionsListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProjectsClient.NewAssessmentOptionsListPager") - req, err := client.assessmentOptionsListCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return ProjectsClientAssessmentOptionsListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProjectsClientAssessmentOptionsListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProjectsClientAssessmentOptionsListResponse{}, runtime.NewResponseError(resp) - } - return client.assessmentOptionsListHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// assessmentOptionsListCreateRequest creates the AssessmentOptionsList request. -func (client *ProjectsClient) assessmentOptionsListCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientAssessmentOptionsListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessmentOptions" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// assessmentOptionsListHandleResponse handles the AssessmentOptionsList response. -func (client *ProjectsClient) assessmentOptionsListHandleResponse(resp *http.Response) (ProjectsClientAssessmentOptionsListResponse, error) { - result := ProjectsClientAssessmentOptionsListResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.AssessmentOptionsResultList); err != nil { - return ProjectsClientAssessmentOptionsListResponse{}, err - } - return result, nil -} - -// Create - Create a project with specified name. If a project already exists, update it. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - ProjectsClientCreateOptions contains the optional parameters for the ProjectsClient.Create method. -func (client *ProjectsClient) Create(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientCreateOptions) (ProjectsClientCreateResponse, error) { - var err error - const operationName = "ProjectsClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return ProjectsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProjectsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return ProjectsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *ProjectsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Project != nil { - if err := runtime.MarshalAsJSON(req, *options.Project); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *ProjectsClient) createHandleResponse(resp *http.Response) (ProjectsClientCreateResponse, error) { - result := ProjectsClientCreateResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.Project); err != nil { - return ProjectsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Delete the project. Deleting non-existent project is a no-operation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - ProjectsClientDeleteOptions contains the optional parameters for the ProjectsClient.Delete method. -func (client *ProjectsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientDeleteOptions) (ProjectsClientDeleteResponse, error) { - var err error - const operationName = "ProjectsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return ProjectsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProjectsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ProjectsClientDeleteResponse{}, err - } - resp, err := client.deleteHandleResponse(httpResp) - return resp, err -} - -// deleteCreateRequest creates the Delete request. -func (client *ProjectsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteHandleResponse handles the Delete response. -func (client *ProjectsClient) deleteHandleResponse(resp *http.Response) (ProjectsClientDeleteResponse, error) { - result := ProjectsClientDeleteResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - return result, nil -} - -// Get - Get the project with the specified name. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - ProjectsClientGetOptions contains the optional parameters for the ProjectsClient.Get method. -func (client *ProjectsClient) Get(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientGetOptions) (ProjectsClientGetResponse, error) { - var err error - const operationName = "ProjectsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return ProjectsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProjectsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ProjectsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ProjectsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ProjectsClient) getHandleResponse(resp *http.Response) (ProjectsClientGetResponse, error) { - result := ProjectsClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.Project); err != nil { - return ProjectsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Get all the projects in the resource group. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - options - ProjectsClientListOptions contains the optional parameters for the ProjectsClient.NewListPager method. -func (client *ProjectsClient) NewListPager(resourceGroupName string, options *ProjectsClientListOptions) *runtime.Pager[ProjectsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ProjectsClientListResponse]{ - More: func(page ProjectsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ProjectsClientListResponse) (ProjectsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProjectsClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, options) - }, nil) - if err != nil { - return ProjectsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *ProjectsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *ProjectsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *ProjectsClient) listHandleResponse(resp *http.Response) (ProjectsClientListResponse, error) { - result := ProjectsClientListResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.ProjectResultList); err != nil { - return ProjectsClientListResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - Get all the projects in the subscription. -// -// Generated from API version 2019-10-01 -// - options - ProjectsClientListBySubscriptionOptions contains the optional parameters for the ProjectsClient.NewListBySubscriptionPager -// method. -func (client *ProjectsClient) NewListBySubscriptionPager(options *ProjectsClientListBySubscriptionOptions) *runtime.Pager[ProjectsClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[ProjectsClientListBySubscriptionResponse]{ - More: func(page ProjectsClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ProjectsClientListBySubscriptionResponse) (ProjectsClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProjectsClient.NewListBySubscriptionPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) - }, nil) - if err != nil { - return ProjectsClientListBySubscriptionResponse{}, err - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *ProjectsClient) listBySubscriptionCreateRequest(ctx context.Context, options *ProjectsClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Migrate/assessmentProjects" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *ProjectsClient) listBySubscriptionHandleResponse(resp *http.Response) (ProjectsClientListBySubscriptionResponse, error) { - result := ProjectsClientListBySubscriptionResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.ProjectResultList); err != nil { - return ProjectsClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// Update - Update a project with specified name. Supports partial updates, for example only tags can be provided. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - ProjectsClientUpdateOptions contains the optional parameters for the ProjectsClient.Update method. -func (client *ProjectsClient) Update(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientUpdateOptions) (ProjectsClientUpdateResponse, error) { - var err error - const operationName = "ProjectsClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return ProjectsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProjectsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ProjectsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *ProjectsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Project != nil { - if err := runtime.MarshalAsJSON(req, *options.Project); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *ProjectsClient) updateHandleResponse(resp *http.Response) (ProjectsClientUpdateResponse, error) { - result := ProjectsClientUpdateResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.Project); err != nil { - return ProjectsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/projects_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/projects_client_example_test.go deleted file mode 100644 index 33b1e362f1d3..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/projects_client_example_test.go +++ /dev/null @@ -1,1968 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ProjectsInSubscription_List.json -func ExampleProjectsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProjectsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProjectResultList = armmigrate.ProjectResultList{ - // Value: []*armmigrate.Project{ - // { - // Name: to.Ptr("site1493ae9ea68project"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"0500be57-0000-0300-0000-5cb893f70000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/SMSValidations/providers/Microsoft.Migrate/assessmentprojects/site1493ae9ea68project"), - // Location: to.Ptr("centralus"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/SMSValidations/providers/Microsoft.Migrate/MigrateProjects/SMSValidations-MigrateProject/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-02-15T09:18:02.572Z"); return t}()), - // CustomerWorkspaceID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/SMSValidations/providers/Microsoft.OperationalInsights/workspaces/test-haili-01"), - // CustomerWorkspaceLocation: to.Ptr("southeastasia"), - // LastAssessmentTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-18T15:12:55.238Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](12), - // NumberOfGroups: to.Ptr[int32](8), - // NumberOfMachines: to.Ptr[int32](26), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodcus.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-18T03:31:20.836Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("site1ad5aa6cc09project"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"8300bdec-0000-0300-0000-5cd678410000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/ppValidation/providers/Microsoft.Migrate/assessmentprojects/site1ad5aa6cc09project"), - // Location: to.Ptr("centralus"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/ppValidation/providers/Microsoft.Migrate/MigrateProjects/ppValidation-MigrateProject/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-02-18T16:46:46.084Z"); return t}()), - // LastAssessmentTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-11T07:22:41.555Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](12), - // NumberOfGroups: to.Ptr[int32](7), - // NumberOfMachines: to.Ptr[int32](29), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodcus.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-02-18T16:46:46.084Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("migrateproject0720project"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"0d00efcf-0000-0300-0000-5d6fdac70000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/SDKUpgradeValidations/providers/Microsoft.Migrate/assessmentprojects/migrateproject0720project"), - // Location: to.Ptr("centralus"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/SDKUpgradeValidations/providers/Microsoft.Migrate/MigrateProjects/SDKUpgradeValidations-MigrateProject/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-22T07:06:04.972Z"); return t}()), - // LastAssessmentTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-04T15:39:51.304Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](2), - // NumberOfGroups: to.Ptr[int32](1), - // NumberOfMachines: to.Ptr[int32](24), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodcus.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-22T07:06:04.972Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("migrateproject03acproject"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"00004d14-0000-0300-0000-5cb820290000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/AccessibilityTesting/providers/Microsoft.Migrate/assessmentprojects/migrateproject03acproject"), - // Location: to.Ptr("centralus"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/AccessibilityTesting/providers/Microsoft.Migrate/MigrateProjects/AccessibilityTesting-MigrateProject/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-18T06:53:59.419Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](0), - // NumberOfGroups: to.Ptr[int32](0), - // NumberOfMachines: to.Ptr[int32](16), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodcus.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-18T06:53:59.419Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("migrateprojecta961project"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"1300df9f-0000-0300-0000-5d6e6d860000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/vmwaretesting/providers/Microsoft.Migrate/assessmentprojects/migrateprojecta961project"), - // Location: to.Ptr("centralus"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/vmwaretesting/providers/Microsoft.Migrate/MigrateProjects/vmwaretesting-MigrateProject/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-20T11:59:42.735Z"); return t}()), - // CustomerWorkspaceID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/vmwaretesting/providers/Microsoft.OperationalInsights/workspaces/mahpar324211"), - // CustomerWorkspaceLocation: to.Ptr("westeurope"), - // NumberOfAssessments: to.Ptr[int32](0), - // NumberOfGroups: to.Ptr[int32](1), - // NumberOfMachines: to.Ptr[int32](47), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodcus.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-03T13:41:26.677Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("PortalGAValidations43bbproject"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"02006b1f-0000-0300-0000-5d24a44a0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/GARegressionTesting/providers/Microsoft.Migrate/assessmentprojects/PortalGAValidations43bbproject"), - // Location: to.Ptr("centralus"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/GARegressionTesting/providers/Microsoft.Migrate/MigrateProjects/PortalGAValidations/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-04T03:56:50.853Z"); return t}()), - // LastAssessmentTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-09T14:27:22.885Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](4), - // NumberOfGroups: to.Ptr[int32](4), - // NumberOfMachines: to.Ptr[int32](49), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodcus.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-04T03:56:50.853Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("vaindana-pre-ga120dproject"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"0400d98a-0000-0d00-0000-5cd3ff790000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/vaindana-migrate-ga-rg/providers/Microsoft.Migrate/assessmentprojects/vaindana-pre-ga120dproject"), - // Location: to.Ptr("westeurope"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/vaindana-migrate-ga-rg/providers/Microsoft.Migrate/MigrateProjects/vaindana-pre-ga/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-08T15:09:37.856Z"); return t}()), - // CustomerWorkspaceID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/vaindana-migrate-ga-rg/providers/Microsoft.OperationalInsights/workspaces/vaindana-pre-ga-oms"), - // CustomerWorkspaceLocation: to.Ptr("westeurope"), - // LastAssessmentTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:22:48.973Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](2), - // NumberOfGroups: to.Ptr[int32](2), - // NumberOfMachines: to.Ptr[int32](14), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodwe.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-08T17:12:42.178Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("Mahesh-V2-Europe-Bugbash181eproject"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"0b00349d-0000-0d00-0000-5d22eb5b0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/Mahesh-RG-Eurpe-Bugbash/providers/Microsoft.Migrate/assessmentprojects/Mahesh-V2-Europe-Bugbash181eproject"), - // Location: to.Ptr("westeurope"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/Mahesh-RG-Eurpe-Bugbash/providers/Microsoft.Migrate/MigrateProjects/Mahesh-V2-Europe-Bugbash/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T07:38:23.034Z"); return t}()), - // LastAssessmentTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-02T06:38:34.281Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](6), - // NumberOfGroups: to.Ptr[int32](3), - // NumberOfMachines: to.Ptr[int32](36), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodwe.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T07:38:23.034Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("abgoyalWEselfhostb72bproject"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"0600c777-0000-0d00-0000-5cdaa4170000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject"), - // Location: to.Ptr("westeurope"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.migrate/migrateprojects/abgoyalweselfhost/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T08:28:53.330Z"); return t}()), - // LastAssessmentTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:47.789Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](3), - // NumberOfGroups: to.Ptr[int32](2), - // NumberOfMachines: to.Ptr[int32](28), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodwe.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:11:16.022Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("vaindana-pre-ga-10180project"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"01003c88-0000-0d00-0000-5d41601b0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/vaindana-migrate-ga-rg/providers/Microsoft.Migrate/assessmentprojects/vaindana-pre-ga-10180project"), - // Location: to.Ptr("westeurope"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/vaindana-migrate-ga-rg/providers/Microsoft.Migrate/MigrateProjects/vaindana-pre-ga-1/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T11:58:13.021Z"); return t}()), - // LastAssessmentTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-31T09:32:11.496Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](4), - // NumberOfGroups: to.Ptr[int32](2), - // NumberOfMachines: to.Ptr[int32](101), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodwe.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-15T16:52:08.918Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Projects_List.json -func ExampleProjectsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProjectsClient().NewListPager("abgoyal-westEurope", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProjectResultList = armmigrate.ProjectResultList{ - // Value: []*armmigrate.Project{ - // { - // Name: to.Ptr("abgoyalWEselfhostb72bproject"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"0600c777-0000-0d00-0000-5cdaa4170000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject"), - // Location: to.Ptr("westeurope"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.migrate/migrateprojects/abgoyalweselfhost/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T08:28:53.330Z"); return t}()), - // LastAssessmentTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:47.789Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](3), - // NumberOfGroups: to.Ptr[int32](2), - // NumberOfMachines: to.Ptr[int32](28), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodwe.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:11:16.022Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Projects_Get.json -func ExampleProjectsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProjectsClient().Get(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Project = armmigrate.Project{ - // Name: to.Ptr("abgoyalWEselfhostb72bproject"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"0600c777-0000-0d00-0000-5cdaa4170000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject"), - // Location: to.Ptr("westeurope"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.migrate/migrateprojects/abgoyalweselfhost/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T08:28:53.330Z"); return t}()), - // LastAssessmentTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:47.789Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](3), - // NumberOfGroups: to.Ptr[int32](2), - // NumberOfMachines: to.Ptr[int32](28), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodwe.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:11:16.022Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Projects_Create.json -func ExampleProjectsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProjectsClient().Create(ctx, "abgoyal-westEurope", "abGoyalProject2", &armmigrate.ProjectsClientCreateOptions{Project: &armmigrate.Project{ - ETag: to.Ptr(""), - Location: to.Ptr("West Europe"), - Properties: &armmigrate.ProjectProperties{ - AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.migrate/migrateprojects/abgoyalweselfhost/Solutions/Servers-Assessment-ServerAssessment"), - ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - }, - Tags: map[string]any{}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Project = armmigrate.Project{ - // Name: to.Ptr("abGoyalProject2"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr(""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abGoyalProject2"), - // Location: to.Ptr("West Europe"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.Migrate/assessmentprojects/abGoyalProject2"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-26T05:56:58.752Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](0), - // NumberOfGroups: to.Ptr[int32](0), - // NumberOfMachines: to.Ptr[int32](0), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ServiceEndpoint: to.Ptr("https://localhost/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-26T05:56:58.799Z"); return t}()), - // }, - // Tags: map[string]any{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Projects_Update.json -func ExampleProjectsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProjectsClient().Update(ctx, "abgoyal-westEurope", "abGoyalProject2", &armmigrate.ProjectsClientUpdateOptions{Project: &armmigrate.Project{ - ETag: to.Ptr(""), - Location: to.Ptr("West Europe"), - Properties: &armmigrate.ProjectProperties{ - AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.migrate/migrateprojects/abgoyalweselfhost/Solutions/Servers-Assessment-ServerAssessment"), - ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - }, - Tags: map[string]any{}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Project = armmigrate.Project{ - // Name: to.Ptr("abGoyalProject2"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr(""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abGoyalProject2"), - // Location: to.Ptr("West Europe"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.Migrate/assessmentprojects/abGoyalProject2"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-26T05:56:58.752Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](0), - // NumberOfGroups: to.Ptr[int32](0), - // NumberOfMachines: to.Ptr[int32](0), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ServiceEndpoint: to.Ptr("https://localhost/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-26T05:56:58.799Z"); return t}()), - // }, - // Tags: map[string]any{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Projects_Delete.json -func ExampleProjectsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewProjectsClient().Delete(ctx, "abgoyal-westEurope", "abGoyalProject2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/AssessmentOptions_Get.json -func ExampleProjectsClient_AssessmentOptions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProjectsClient().AssessmentOptions(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AssessmentOptions = armmigrate.AssessmentOptions{ - // Name: to.Ptr("default"), - // ID: to.Ptr("/subscriptions/5cbd71ba-5a65-4f0c-aea2-33dadde87b4e/resourceGroups/shsinglarg/providers/Microsoft.Migrate/assessmentprojects/shProject/assessmentOptions/default"), - // Properties: &armmigrate.AssessmentOptionsProperties{ - // ReservedInstanceSupportedCurrencies: []*string{ - // to.Ptr("USD"), - // to.Ptr("DKK"), - // to.Ptr("CAD"), - // to.Ptr("JPY"), - // to.Ptr("KRW"), - // to.Ptr("NZD"), - // to.Ptr("NOK"), - // to.Ptr("RUB"), - // to.Ptr("SEK"), - // to.Ptr("GBP"), - // to.Ptr("INR"), - // to.Ptr("BRL"), - // to.Ptr("TWD"), - // to.Ptr("EUR"), - // to.Ptr("CHF"), - // to.Ptr("AUD")}, - // ReservedInstanceSupportedLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs")}, - // ReservedInstanceSupportedOffers: []*string{ - // to.Ptr("MSAZR0003P")}, - // ReservedInstanceVMFamilies: []*string{ - // to.Ptr("Dv2_series"), - // to.Ptr("F_series"), - // to.Ptr("Dv3_series"), - // to.Ptr("DS_series"), - // to.Ptr("DSv2_series"), - // to.Ptr("Fs_series"), - // to.Ptr("Dsv3_series"), - // to.Ptr("Ev3_series"), - // to.Ptr("Esv3_series"), - // to.Ptr("D_series"), - // to.Ptr("Fsv2_series"), - // to.Ptr("M_series"), - // to.Ptr("Ls_series"), - // to.Ptr("H_series")}, - // VMFamilies: []*armmigrate.VMFamily{ - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose")}, - // FamilyName: to.Ptr("Standard_A0_A7"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose")}, - // FamilyName: to.Ptr("Basic_A0_A4"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose"), - // to.Ptr("MemoryOptimized")}, - // FamilyName: to.Ptr("Dv2_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("ComputeOptimized")}, - // FamilyName: to.Ptr("F_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose")}, - // FamilyName: to.Ptr("Av2_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose")}, - // FamilyName: to.Ptr("Dv3_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose"), - // to.Ptr("MemoryOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("DS_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("EastUs"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("USGovVirginia"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose"), - // to.Ptr("MemoryOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("DSv2_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("ComputeOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("Fs_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("Dsv3_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("MemoryOptimized")}, - // FamilyName: to.Ptr("Ev3_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("MemoryOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("Esv3_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose")}, - // FamilyName: to.Ptr("D_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("USGovVirginia"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("ComputeOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("Fsv2_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("MemoryOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("M_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("MemoryOptimized")}, - // FamilyName: to.Ptr("G_series"), - // TargetLocations: []*string{ - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("JapanEast"), - // to.Ptr("UkSouth"), - // to.Ptr("WestUs2"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("MemoryOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("GS_series"), - // TargetLocations: []*string{ - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("JapanEast"), - // to.Ptr("UkSouth"), - // to.Ptr("WestUs2"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("StorageOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("Ls_series"), - // TargetLocations: []*string{ - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("JapanEast"), - // to.Ptr("UkSouth"), - // to.Ptr("WestUs2"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("HighPerformanceCompute")}, - // FamilyName: to.Ptr("H_series"), - // TargetLocations: []*string{ - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("WestUs"), - // to.Ptr("USGovArizona")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose"), - // to.Ptr("SupportsPremiumStorage"), - // to.Ptr("Confidential")}, - // FamilyName: to.Ptr("DC_Series"), - // TargetLocations: []*string{ - // to.Ptr("WestEurope"), - // to.Ptr("EastUs")}, - // }, - // { - // Category: []*string{ - // to.Ptr("HighPerformanceCompute")}, - // FamilyName: to.Ptr("Standard_A8_A11"), - // TargetLocations: []*string{ - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("WestUs")}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/AssessmentOptions_List.json -func ExampleProjectsClient_NewAssessmentOptionsListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProjectsClient().NewAssessmentOptionsListPager("abgoyal-westEurope", "abgoyalWEselfhostb72bproject", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AssessmentOptionsResultList = armmigrate.AssessmentOptionsResultList{ - // Value: []*armmigrate.AssessmentOptions{ - // { - // Name: to.Ptr("default"), - // ID: to.Ptr("/subscriptions/5cbd71ba-5a65-4f0c-aea2-33dadde87b4e/resourceGroups/shsinglarg/providers/Microsoft.Migrate/assessmentprojects/shProject/assessmentOptions/default"), - // Properties: &armmigrate.AssessmentOptionsProperties{ - // ReservedInstanceSupportedCurrencies: []*string{ - // to.Ptr("USD"), - // to.Ptr("DKK"), - // to.Ptr("CAD"), - // to.Ptr("JPY"), - // to.Ptr("KRW"), - // to.Ptr("NZD"), - // to.Ptr("NOK"), - // to.Ptr("RUB"), - // to.Ptr("SEK"), - // to.Ptr("GBP"), - // to.Ptr("INR"), - // to.Ptr("BRL"), - // to.Ptr("TWD"), - // to.Ptr("EUR"), - // to.Ptr("CHF"), - // to.Ptr("AUD")}, - // ReservedInstanceSupportedLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs")}, - // ReservedInstanceSupportedOffers: []*string{ - // to.Ptr("MSAZR0003P")}, - // ReservedInstanceVMFamilies: []*string{ - // to.Ptr("Dv2_series"), - // to.Ptr("F_series"), - // to.Ptr("Dv3_series"), - // to.Ptr("DS_series"), - // to.Ptr("DSv2_series"), - // to.Ptr("Fs_series"), - // to.Ptr("Dsv3_series"), - // to.Ptr("Ev3_series"), - // to.Ptr("Esv3_series"), - // to.Ptr("D_series"), - // to.Ptr("Fsv2_series"), - // to.Ptr("M_series"), - // to.Ptr("Ls_series"), - // to.Ptr("H_series")}, - // VMFamilies: []*armmigrate.VMFamily{ - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose")}, - // FamilyName: to.Ptr("Standard_A0_A7"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose")}, - // FamilyName: to.Ptr("Basic_A0_A4"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose"), - // to.Ptr("MemoryOptimized")}, - // FamilyName: to.Ptr("Dv2_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("ComputeOptimized")}, - // FamilyName: to.Ptr("F_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose")}, - // FamilyName: to.Ptr("Av2_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose")}, - // FamilyName: to.Ptr("Dv3_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose"), - // to.Ptr("MemoryOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("DS_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("EastUs"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("USGovVirginia"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose"), - // to.Ptr("MemoryOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("DSv2_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("ComputeOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("Fs_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("Dsv3_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("MemoryOptimized")}, - // FamilyName: to.Ptr("Ev3_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("MemoryOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("Esv3_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose")}, - // FamilyName: to.Ptr("D_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("USGovVirginia"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("ComputeOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("Fsv2_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("MemoryOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("M_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("MemoryOptimized")}, - // FamilyName: to.Ptr("G_series"), - // TargetLocations: []*string{ - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("JapanEast"), - // to.Ptr("UkSouth"), - // to.Ptr("WestUs2"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("MemoryOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("GS_series"), - // TargetLocations: []*string{ - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("JapanEast"), - // to.Ptr("UkSouth"), - // to.Ptr("WestUs2"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("StorageOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("Ls_series"), - // TargetLocations: []*string{ - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("JapanEast"), - // to.Ptr("UkSouth"), - // to.Ptr("WestUs2"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("HighPerformanceCompute")}, - // FamilyName: to.Ptr("H_series"), - // TargetLocations: []*string{ - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("WestUs"), - // to.Ptr("USGovArizona")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose"), - // to.Ptr("SupportsPremiumStorage"), - // to.Ptr("Confidential")}, - // FamilyName: to.Ptr("DC_Series"), - // TargetLocations: []*string{ - // to.Ptr("WestEurope"), - // to.Ptr("EastUs")}, - // }, - // { - // Category: []*string{ - // to.Ptr("HighPerformanceCompute")}, - // FamilyName: to.Ptr("Standard_A8_A11"), - // TargetLocations: []*string{ - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("WestUs")}, - // }}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/response_types.go b/sdk/resourcemanager/migrate/armmigrate/response_types.go deleted file mode 100644 index 4340953383fb..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/response_types.go +++ /dev/null @@ -1,388 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -// AssessedMachinesClientGetResponse contains the response from method AssessedMachinesClient.Get. -type AssessedMachinesClientGetResponse struct { - // A machine evaluated as part of an assessment. - AssessedMachine - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// AssessedMachinesClientListByAssessmentResponse contains the response from method AssessedMachinesClient.NewListByAssessmentPager. -type AssessedMachinesClientListByAssessmentResponse struct { - // List of assessed machines. - AssessedMachineResultList - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// AssessmentsClientCreateResponse contains the response from method AssessmentsClient.Create. -type AssessmentsClientCreateResponse struct { - // An assessment created for a group in the Migration project. - Assessment - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// AssessmentsClientDeleteResponse contains the response from method AssessmentsClient.Delete. -type AssessmentsClientDeleteResponse struct { - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// AssessmentsClientGetReportDownloadURLResponse contains the response from method AssessmentsClient.GetReportDownloadURL. -type AssessmentsClientGetReportDownloadURLResponse struct { - // Download URL for assessment report. - DownloadURL - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// AssessmentsClientGetResponse contains the response from method AssessmentsClient.Get. -type AssessmentsClientGetResponse struct { - // An assessment created for a group in the Migration project. - Assessment - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// AssessmentsClientListByGroupResponse contains the response from method AssessmentsClient.NewListByGroupPager. -type AssessmentsClientListByGroupResponse struct { - // List of assessments. - AssessmentResultList - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// AssessmentsClientListByProjectResponse contains the response from method AssessmentsClient.NewListByProjectPager. -type AssessmentsClientListByProjectResponse struct { - // List of assessments. - AssessmentResultList - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// GroupsClientCreateResponse contains the response from method GroupsClient.Create. -type GroupsClientCreateResponse struct { - // A group created in a Migration project. - Group - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// GroupsClientDeleteResponse contains the response from method GroupsClient.Delete. -type GroupsClientDeleteResponse struct { - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// GroupsClientGetResponse contains the response from method GroupsClient.Get. -type GroupsClientGetResponse struct { - // A group created in a Migration project. - Group - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// GroupsClientListByProjectResponse contains the response from method GroupsClient.NewListByProjectPager. -type GroupsClientListByProjectResponse struct { - // List of groups. - GroupResultList - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// GroupsClientUpdateMachinesResponse contains the response from method GroupsClient.UpdateMachines. -type GroupsClientUpdateMachinesResponse struct { - // A group created in a Migration project. - Group - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// HyperVCollectorsClientCreateResponse contains the response from method HyperVCollectorsClient.Create. -type HyperVCollectorsClientCreateResponse struct { - HyperVCollector - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// HyperVCollectorsClientDeleteResponse contains the response from method HyperVCollectorsClient.Delete. -type HyperVCollectorsClientDeleteResponse struct { - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// HyperVCollectorsClientGetResponse contains the response from method HyperVCollectorsClient.Get. -type HyperVCollectorsClientGetResponse struct { - HyperVCollector - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// HyperVCollectorsClientListByProjectResponse contains the response from method HyperVCollectorsClient.NewListByProjectPager. -type HyperVCollectorsClientListByProjectResponse struct { - // List of Hyper-V collectors. - HyperVCollectorList - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// ImportCollectorsClientCreateResponse contains the response from method ImportCollectorsClient.Create. -type ImportCollectorsClientCreateResponse struct { - ImportCollector - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// ImportCollectorsClientDeleteResponse contains the response from method ImportCollectorsClient.Delete. -type ImportCollectorsClientDeleteResponse struct { - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// ImportCollectorsClientGetResponse contains the response from method ImportCollectorsClient.Get. -type ImportCollectorsClientGetResponse struct { - ImportCollector - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// ImportCollectorsClientListByProjectResponse contains the response from method ImportCollectorsClient.NewListByProjectPager. -type ImportCollectorsClientListByProjectResponse struct { - // List of Import collectors. - ImportCollectorList - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// MachinesClientGetResponse contains the response from method MachinesClient.Get. -type MachinesClientGetResponse struct { - // A machine in a migration project. - Machine - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// MachinesClientListByProjectResponse contains the response from method MachinesClient.NewListByProjectPager. -type MachinesClientListByProjectResponse struct { - // List of machines. - MachineResultList - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. -type OperationsClientListResponse struct { - // List of API operations. - OperationResultList -} - -// PrivateEndpointConnectionClientDeleteResponse contains the response from method PrivateEndpointConnectionClient.Delete. -type PrivateEndpointConnectionClientDeleteResponse struct { - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// PrivateEndpointConnectionClientGetResponse contains the response from method PrivateEndpointConnectionClient.Get. -type PrivateEndpointConnectionClientGetResponse struct { - // A private endpoint connection for a project. - PrivateEndpointConnection - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// PrivateEndpointConnectionClientListByProjectResponse contains the response from method PrivateEndpointConnectionClient.ListByProject. -type PrivateEndpointConnectionClientListByProjectResponse struct { - // A collection of private endpoint connections for a project. - PrivateEndpointConnectionCollection - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// PrivateEndpointConnectionClientUpdateResponse contains the response from method PrivateEndpointConnectionClient.Update. -type PrivateEndpointConnectionClientUpdateResponse struct { - // A private endpoint connection for a project. - PrivateEndpointConnection - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// PrivateLinkResourceClientGetResponse contains the response from method PrivateLinkResourceClient.Get. -type PrivateLinkResourceClientGetResponse struct { - // A private link resource for a project for which a private endpoint can be created. - PrivateLinkResource - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// PrivateLinkResourceClientListByProjectResponse contains the response from method PrivateLinkResourceClient.ListByProject. -type PrivateLinkResourceClientListByProjectResponse struct { - // A list of private link resources - PrivateLinkResourceCollection - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// ProjectsClientAssessmentOptionsListResponse contains the response from method ProjectsClient.NewAssessmentOptionsListPager. -type ProjectsClientAssessmentOptionsListResponse struct { - // List of API operations. - AssessmentOptionsResultList - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// ProjectsClientAssessmentOptionsResponse contains the response from method ProjectsClient.AssessmentOptions. -type ProjectsClientAssessmentOptionsResponse struct { - // Assessment options. - AssessmentOptions - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// ProjectsClientCreateResponse contains the response from method ProjectsClient.Create. -type ProjectsClientCreateResponse struct { - // Azure Migrate Project. - Project - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// ProjectsClientDeleteResponse contains the response from method ProjectsClient.Delete. -type ProjectsClientDeleteResponse struct { - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// ProjectsClientGetResponse contains the response from method ProjectsClient.Get. -type ProjectsClientGetResponse struct { - // Azure Migrate Project. - Project - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// ProjectsClientListBySubscriptionResponse contains the response from method ProjectsClient.NewListBySubscriptionPager. -type ProjectsClientListBySubscriptionResponse struct { - // List of projects. - ProjectResultList - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// ProjectsClientListResponse contains the response from method ProjectsClient.NewListPager. -type ProjectsClientListResponse struct { - // List of projects. - ProjectResultList - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// ProjectsClientUpdateResponse contains the response from method ProjectsClient.Update. -type ProjectsClientUpdateResponse struct { - // Azure Migrate Project. - Project - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// ServerCollectorsClientCreateResponse contains the response from method ServerCollectorsClient.Create. -type ServerCollectorsClientCreateResponse struct { - ServerCollector - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// ServerCollectorsClientDeleteResponse contains the response from method ServerCollectorsClient.Delete. -type ServerCollectorsClientDeleteResponse struct { - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// ServerCollectorsClientGetResponse contains the response from method ServerCollectorsClient.Get. -type ServerCollectorsClientGetResponse struct { - ServerCollector - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// ServerCollectorsClientListByProjectResponse contains the response from method ServerCollectorsClient.NewListByProjectPager. -type ServerCollectorsClientListByProjectResponse struct { - // List of Server collectors. - ServerCollectorList - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// VMwareCollectorsClientCreateResponse contains the response from method VMwareCollectorsClient.Create. -type VMwareCollectorsClientCreateResponse struct { - VMwareCollector - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// VMwareCollectorsClientDeleteResponse contains the response from method VMwareCollectorsClient.Delete. -type VMwareCollectorsClientDeleteResponse struct { - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// VMwareCollectorsClientGetResponse contains the response from method VMwareCollectorsClient.Get. -type VMwareCollectorsClientGetResponse struct { - VMwareCollector - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} - -// VMwareCollectorsClientListByProjectResponse contains the response from method VMwareCollectorsClient.NewListByProjectPager. -type VMwareCollectorsClientListByProjectResponse struct { - // List of VMware collectors. - VMwareCollectorList - - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string -} diff --git a/sdk/resourcemanager/migrate/armmigrate/responses.go b/sdk/resourcemanager/migrate/armmigrate/responses.go new file mode 100644 index 000000000000..9886526e3fd2 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/responses.go @@ -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) Go Code Generator. DO NOT EDIT. + +package armmigrate + +// AssessedMachinesV2OperationsClientGetResponse contains the response from method AssessedMachinesV2OperationsClient.Get. +type AssessedMachinesV2OperationsClientGetResponse struct { + // Machine assessment V2 Assessed Machine resource. + AssessedMachineV2 +} + +// AssessedMachinesV2OperationsClientListByParentResponse contains the response from method AssessedMachinesV2OperationsClient.NewListByParentPager. +type AssessedMachinesV2OperationsClientListByParentResponse struct { + // The response of a AssessedMachineV2 list operation. + AssessedMachineV2ListResult +} + +// MachineAssessmentV2SummaryOperationsClientGetResponse contains the response from method MachineAssessmentV2SummaryOperationsClient.Get. +type MachineAssessmentV2SummaryOperationsClientGetResponse struct { + // Machine Assessment REST resource. + MachineAssessmentV2Summary +} + +// MachineAssessmentV2SummaryOperationsClientListByParentResponse contains the response from method MachineAssessmentV2SummaryOperationsClient.NewListByParentPager. +type MachineAssessmentV2SummaryOperationsClientListByParentResponse struct { + // The response of a MachineAssessmentV2Summary list operation. + MachineAssessmentV2SummaryListResult +} + +// MachineAssessmentsV2OperationsClientCreateResponse contains the response from method MachineAssessmentsV2OperationsClient.BeginCreate. +type MachineAssessmentsV2OperationsClientCreateResponse struct { + // Machine assessment V2 resource. + MachineAssessmentV2 +} + +// MachineAssessmentsV2OperationsClientDeleteResponse contains the response from method MachineAssessmentsV2OperationsClient.Delete. +type MachineAssessmentsV2OperationsClientDeleteResponse struct { + // placeholder for future response values +} + +// MachineAssessmentsV2OperationsClientDownloadURLResponse contains the response from method MachineAssessmentsV2OperationsClient.BeginDownloadURL. +type MachineAssessmentsV2OperationsClientDownloadURLResponse struct { + // Data model of Download URL for assessment report. + DownloadURL +} + +// MachineAssessmentsV2OperationsClientGetResponse contains the response from method MachineAssessmentsV2OperationsClient.Get. +type MachineAssessmentsV2OperationsClientGetResponse struct { + // Machine assessment V2 resource. + MachineAssessmentV2 +} + +// MachineAssessmentsV2OperationsClientListByParentResponse contains the response from method MachineAssessmentsV2OperationsClient.NewListByParentPager. +type MachineAssessmentsV2OperationsClientListByParentResponse struct { + // The response of a MachineAssessmentV2 list operation. + MachineAssessmentV2ListResult +} + +// MachineGraphAssessmentOptionsOperationsClientGetResponse contains the response from method MachineGraphAssessmentOptionsOperationsClient.Get. +type MachineGraphAssessmentOptionsOperationsClientGetResponse struct { + // Machine Assessment REST resource. + MachineGraphAssessmentOptions +} + +// MachineGraphAssessmentOptionsOperationsClientListByParentResponse contains the response from method MachineGraphAssessmentOptionsOperationsClient.NewListByParentPager. +type MachineGraphAssessmentOptionsOperationsClientListByParentResponse struct { + // The response of a MachineGraphAssessmentOptions list operation. + MachineGraphAssessmentOptionsListResult +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult +} diff --git a/sdk/resourcemanager/migrate/armmigrate/servercollectors_client.go b/sdk/resourcemanager/migrate/armmigrate/servercollectors_client.go deleted file mode 100644 index b10d4151f5b0..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/servercollectors_client.go +++ /dev/null @@ -1,332 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ServerCollectorsClient contains the methods for the ServerCollectors group. -// Don't use this type directly, use NewServerCollectorsClient() instead. -type ServerCollectorsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewServerCollectorsClient creates a new instance of ServerCollectorsClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewServerCollectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServerCollectorsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ServerCollectorsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Create or Update Server collector -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - serverCollectorName - Unique name of a Server collector within a project. -// - options - ServerCollectorsClientCreateOptions contains the optional parameters for the ServerCollectorsClient.Create method. -func (client *ServerCollectorsClient) Create(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *ServerCollectorsClientCreateOptions) (ServerCollectorsClientCreateResponse, error) { - var err error - const operationName = "ServerCollectorsClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, serverCollectorName, options) - if err != nil { - return ServerCollectorsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServerCollectorsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return ServerCollectorsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *ServerCollectorsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *ServerCollectorsClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/servercollectors/{serverCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if serverCollectorName == "" { - return nil, errors.New("parameter serverCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverCollectorName}", url.PathEscape(serverCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.CollectorBody != nil { - if err := runtime.MarshalAsJSON(req, *options.CollectorBody); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *ServerCollectorsClient) createHandleResponse(resp *http.Response) (ServerCollectorsClientCreateResponse, error) { - result := ServerCollectorsClientCreateResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.ServerCollector); err != nil { - return ServerCollectorsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Delete a Server collector from the project. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - serverCollectorName - Unique name of a Server collector within a project. -// - options - ServerCollectorsClientDeleteOptions contains the optional parameters for the ServerCollectorsClient.Delete method. -func (client *ServerCollectorsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *ServerCollectorsClientDeleteOptions) (ServerCollectorsClientDeleteResponse, error) { - var err error - const operationName = "ServerCollectorsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, serverCollectorName, options) - if err != nil { - return ServerCollectorsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServerCollectorsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ServerCollectorsClientDeleteResponse{}, err - } - resp, err := client.deleteHandleResponse(httpResp) - return resp, err -} - -// deleteCreateRequest creates the Delete request. -func (client *ServerCollectorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *ServerCollectorsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/servercollectors/{serverCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if serverCollectorName == "" { - return nil, errors.New("parameter serverCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverCollectorName}", url.PathEscape(serverCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteHandleResponse handles the Delete response. -func (client *ServerCollectorsClient) deleteHandleResponse(resp *http.Response) (ServerCollectorsClientDeleteResponse, error) { - result := ServerCollectorsClientDeleteResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - return result, nil -} - -// Get - Get a Server collector. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - serverCollectorName - Unique name of a Server collector within a project. -// - options - ServerCollectorsClientGetOptions contains the optional parameters for the ServerCollectorsClient.Get method. -func (client *ServerCollectorsClient) Get(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *ServerCollectorsClientGetOptions) (ServerCollectorsClientGetResponse, error) { - var err error - const operationName = "ServerCollectorsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, serverCollectorName, options) - if err != nil { - return ServerCollectorsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServerCollectorsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ServerCollectorsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ServerCollectorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *ServerCollectorsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/servercollectors/{serverCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if serverCollectorName == "" { - return nil, errors.New("parameter serverCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverCollectorName}", url.PathEscape(serverCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ServerCollectorsClient) getHandleResponse(resp *http.Response) (ServerCollectorsClientGetResponse, error) { - result := ServerCollectorsClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.ServerCollector); err != nil { - return ServerCollectorsClientGetResponse{}, err - } - return result, nil -} - -// NewListByProjectPager - Get a list of Server collector. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - ServerCollectorsClientListByProjectOptions contains the optional parameters for the ServerCollectorsClient.NewListByProjectPager -// method. -func (client *ServerCollectorsClient) NewListByProjectPager(resourceGroupName string, projectName string, options *ServerCollectorsClientListByProjectOptions) *runtime.Pager[ServerCollectorsClientListByProjectResponse] { - return runtime.NewPager(runtime.PagingHandler[ServerCollectorsClientListByProjectResponse]{ - More: func(page ServerCollectorsClientListByProjectResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *ServerCollectorsClientListByProjectResponse) (ServerCollectorsClientListByProjectResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ServerCollectorsClient.NewListByProjectPager") - req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return ServerCollectorsClientListByProjectResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServerCollectorsClientListByProjectResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerCollectorsClientListByProjectResponse{}, runtime.NewResponseError(resp) - } - return client.listByProjectHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByProjectCreateRequest creates the ListByProject request. -func (client *ServerCollectorsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ServerCollectorsClientListByProjectOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/servercollectors" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByProjectHandleResponse handles the ListByProject response. -func (client *ServerCollectorsClient) listByProjectHandleResponse(resp *http.Response) (ServerCollectorsClientListByProjectResponse, error) { - result := ServerCollectorsClientListByProjectResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.ServerCollectorList); err != nil { - return ServerCollectorsClientListByProjectResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/servercollectors_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/servercollectors_client_example_test.go deleted file mode 100644 index d6939731cb21..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/servercollectors_client_example_test.go +++ /dev/null @@ -1,188 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ServerCollectors_ListByProject.json -func ExampleServerCollectorsClient_NewListByProjectPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerCollectorsClient().NewListByProjectPager("pajindtest", "app11141project", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerCollectorList = armmigrate.ServerCollectorList{ - // Value: []*armmigrate.ServerCollector{ - // { - // Name: to.Ptr("app23df4collector"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/servercollectors"), - // ETag: to.Ptr("\"00000606-0000-0d00-0000-605999bf0000\""), - // ID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/pajindtest/providers/Microsoft.Migrate/assessmentprojects/app11141project/servercollectors/app23df4collector"), - // Properties: &armmigrate.CollectorProperties{ - // AgentProperties: &armmigrate.CollectorAgentProperties{ - // ID: to.Ptr("dc984f5a-58a3-4f84-818c-a19febefa66a"), - // LastHeartbeatUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-17T03:51:30.206Z"); return t}()), - // SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - // ApplicationID: to.Ptr("ad9f701a-cc08-4421-b51f-b5762d58e9ba"), - // Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/app23df4authandaccessaadapp"), - // Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ObjectID: to.Ptr("b4975e42-9248-4a36-b99f-37eca377ea00"), - // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // Version: to.Ptr("1.0.8.393"), - // }, - // CreatedTimestamp: to.Ptr("2020-09-11T07:15:52.4361521Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/pajindTest/providers/Microsoft.OffAzure/ServerSites/app21141site"), - // UpdatedTimestamp: to.Ptr("2021-03-23T07:33:19.697297Z"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ServerCollectors_Get.json -func ExampleServerCollectorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerCollectorsClient().Get(ctx, "pajindtest", "app11141project", "app23df4collector", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerCollector = armmigrate.ServerCollector{ - // Name: to.Ptr("app23df4collector"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/servercollectors"), - // ETag: to.Ptr("\"00000606-0000-0d00-0000-605999bf0000\""), - // ID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/pajindtest/providers/Microsoft.Migrate/assessmentprojects/app11141project/servercollectors/app23df4collector"), - // Properties: &armmigrate.CollectorProperties{ - // AgentProperties: &armmigrate.CollectorAgentProperties{ - // ID: to.Ptr("dc984f5a-58a3-4f84-818c-a19febefa66a"), - // LastHeartbeatUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-17T03:51:30.206Z"); return t}()), - // SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - // ApplicationID: to.Ptr("ad9f701a-cc08-4421-b51f-b5762d58e9ba"), - // Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/app23df4authandaccessaadapp"), - // Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ObjectID: to.Ptr("b4975e42-9248-4a36-b99f-37eca377ea00"), - // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // Version: to.Ptr("1.0.8.393"), - // }, - // CreatedTimestamp: to.Ptr("2020-09-11T07:15:52.4361521Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/pajindTest/providers/Microsoft.OffAzure/ServerSites/app21141site"), - // UpdatedTimestamp: to.Ptr("2021-03-23T07:33:19.697297Z"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ServerCollectors_Create.json -func ExampleServerCollectorsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerCollectorsClient().Create(ctx, "pajindtest", "app11141project", "app23df4collector", &armmigrate.ServerCollectorsClientCreateOptions{CollectorBody: &armmigrate.ServerCollector{ - ETag: to.Ptr("\"00000606-0000-0d00-0000-605999bf0000\""), - Properties: &armmigrate.CollectorProperties{ - AgentProperties: &armmigrate.CollectorAgentProperties{ - SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - ApplicationID: to.Ptr("ad9f701a-cc08-4421-b51f-b5762d58e9ba"), - Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/app23df4authandaccessaadapp"), - Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - ObjectID: to.Ptr("b4975e42-9248-4a36-b99f-37eca377ea00"), - TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - }, - }, - DiscoverySiteID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/pajindTest/providers/Microsoft.OffAzure/ServerSites/app21141site"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerCollector = armmigrate.ServerCollector{ - // Name: to.Ptr("app23df4collector"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/servercollectors"), - // ETag: to.Ptr("\"00000606-0000-0d00-0000-605999bf0000\""), - // ID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/pajindtest/providers/Microsoft.Migrate/assessmentprojects/app11141project/servercollectors/app23df4collector"), - // Properties: &armmigrate.CollectorProperties{ - // AgentProperties: &armmigrate.CollectorAgentProperties{ - // ID: to.Ptr("dc984f5a-58a3-4f84-818c-a19febefa66a"), - // LastHeartbeatUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-17T03:51:30.206Z"); return t}()), - // SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - // ApplicationID: to.Ptr("ad9f701a-cc08-4421-b51f-b5762d58e9ba"), - // Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/app23df4authandaccessaadapp"), - // Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ObjectID: to.Ptr("b4975e42-9248-4a36-b99f-37eca377ea00"), - // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // Version: to.Ptr("1.0.8.393"), - // }, - // CreatedTimestamp: to.Ptr("2020-09-11T07:15:52.4361521Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/pajindTest/providers/Microsoft.OffAzure/ServerSites/app21141site"), - // UpdatedTimestamp: to.Ptr("2021-03-23T07:33:19.697297Z"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ServerCollectors_Delete.json -func ExampleServerCollectorsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewServerCollectorsClient().Delete(ctx, "pajindtest", "app11141project", "app23df4collector", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/time_rfc3339.go b/sdk/resourcemanager/migrate/armmigrate/time_rfc3339.go index 6a10a9f9fd57..d709544c7223 100644 --- a/sdk/resourcemanager/migrate/armmigrate/time_rfc3339.go +++ b/sdk/resourcemanager/migrate/armmigrate/time_rfc3339.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armmigrate @@ -19,12 +15,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +40,36 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +80,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +97,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/migrate/armmigrate/tsp-location.yaml b/sdk/resourcemanager/migrate/armmigrate/tsp-location.yaml new file mode 100644 index 000000000000..a6cb9a218029 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/tsp-location.yaml @@ -0,0 +1,5 @@ +directory: specification/migrate/AssessmentProjects.Management/MachineAssessments.Management +commit: 09d9fd97a0477ab6301b1447dc2ae26b98f15414 +repo: Azure/azure-rest-api-specs +additionalDirectories: +- specification/migrate/AssessmentProjects.Management/Common diff --git a/sdk/resourcemanager/migrate/armmigrate/vmwarecollectors_client.go b/sdk/resourcemanager/migrate/armmigrate/vmwarecollectors_client.go deleted file mode 100644 index 082ec10ad6e9..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/vmwarecollectors_client.go +++ /dev/null @@ -1,332 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// VMwareCollectorsClient contains the methods for the VMwareCollectors group. -// Don't use this type directly, use NewVMwareCollectorsClient() instead. -type VMwareCollectorsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewVMwareCollectorsClient creates a new instance of VMwareCollectorsClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewVMwareCollectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VMwareCollectorsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &VMwareCollectorsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Create or Update VMware collector -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - vmWareCollectorName - Unique name of a VMware collector within a project. -// - options - VMwareCollectorsClientCreateOptions contains the optional parameters for the VMwareCollectorsClient.Create method. -func (client *VMwareCollectorsClient) Create(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *VMwareCollectorsClientCreateOptions) (VMwareCollectorsClientCreateResponse, error) { - var err error - const operationName = "VMwareCollectorsClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, vmWareCollectorName, options) - if err != nil { - return VMwareCollectorsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return VMwareCollectorsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return VMwareCollectorsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *VMwareCollectorsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *VMwareCollectorsClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/vmwarecollectors/{vmWareCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if vmWareCollectorName == "" { - return nil, errors.New("parameter vmWareCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vmWareCollectorName}", url.PathEscape(vmWareCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.CollectorBody != nil { - if err := runtime.MarshalAsJSON(req, *options.CollectorBody); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *VMwareCollectorsClient) createHandleResponse(resp *http.Response) (VMwareCollectorsClientCreateResponse, error) { - result := VMwareCollectorsClientCreateResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.VMwareCollector); err != nil { - return VMwareCollectorsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Delete a VMware collector from the project. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - vmWareCollectorName - Unique name of a VMware collector within a project. -// - options - VMwareCollectorsClientDeleteOptions contains the optional parameters for the VMwareCollectorsClient.Delete method. -func (client *VMwareCollectorsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *VMwareCollectorsClientDeleteOptions) (VMwareCollectorsClientDeleteResponse, error) { - var err error - const operationName = "VMwareCollectorsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, vmWareCollectorName, options) - if err != nil { - return VMwareCollectorsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return VMwareCollectorsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return VMwareCollectorsClientDeleteResponse{}, err - } - resp, err := client.deleteHandleResponse(httpResp) - return resp, err -} - -// deleteCreateRequest creates the Delete request. -func (client *VMwareCollectorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *VMwareCollectorsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/vmwarecollectors/{vmWareCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if vmWareCollectorName == "" { - return nil, errors.New("parameter vmWareCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vmWareCollectorName}", url.PathEscape(vmWareCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteHandleResponse handles the Delete response. -func (client *VMwareCollectorsClient) deleteHandleResponse(resp *http.Response) (VMwareCollectorsClientDeleteResponse, error) { - result := VMwareCollectorsClientDeleteResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - return result, nil -} - -// Get - Get a VMware collector. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - vmWareCollectorName - Unique name of a VMware collector within a project. -// - options - VMwareCollectorsClientGetOptions contains the optional parameters for the VMwareCollectorsClient.Get method. -func (client *VMwareCollectorsClient) Get(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *VMwareCollectorsClientGetOptions) (VMwareCollectorsClientGetResponse, error) { - var err error - const operationName = "VMwareCollectorsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, vmWareCollectorName, options) - if err != nil { - return VMwareCollectorsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return VMwareCollectorsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return VMwareCollectorsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *VMwareCollectorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *VMwareCollectorsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/vmwarecollectors/{vmWareCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if vmWareCollectorName == "" { - return nil, errors.New("parameter vmWareCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vmWareCollectorName}", url.PathEscape(vmWareCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *VMwareCollectorsClient) getHandleResponse(resp *http.Response) (VMwareCollectorsClientGetResponse, error) { - result := VMwareCollectorsClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.VMwareCollector); err != nil { - return VMwareCollectorsClientGetResponse{}, err - } - return result, nil -} - -// NewListByProjectPager - Get a list of VMware collector. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - VMwareCollectorsClientListByProjectOptions contains the optional parameters for the VMwareCollectorsClient.NewListByProjectPager -// method. -func (client *VMwareCollectorsClient) NewListByProjectPager(resourceGroupName string, projectName string, options *VMwareCollectorsClientListByProjectOptions) *runtime.Pager[VMwareCollectorsClientListByProjectResponse] { - return runtime.NewPager(runtime.PagingHandler[VMwareCollectorsClientListByProjectResponse]{ - More: func(page VMwareCollectorsClientListByProjectResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *VMwareCollectorsClientListByProjectResponse) (VMwareCollectorsClientListByProjectResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VMwareCollectorsClient.NewListByProjectPager") - req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return VMwareCollectorsClientListByProjectResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return VMwareCollectorsClientListByProjectResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VMwareCollectorsClientListByProjectResponse{}, runtime.NewResponseError(resp) - } - return client.listByProjectHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByProjectCreateRequest creates the ListByProject request. -func (client *VMwareCollectorsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *VMwareCollectorsClientListByProjectOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/vmwarecollectors" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByProjectHandleResponse handles the ListByProject response. -func (client *VMwareCollectorsClient) listByProjectHandleResponse(resp *http.Response) (VMwareCollectorsClientListByProjectResponse, error) { - result := VMwareCollectorsClientListByProjectResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.VMwareCollectorList); err != nil { - return VMwareCollectorsClientListByProjectResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/vmwarecollectors_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/vmwarecollectors_client_example_test.go deleted file mode 100644 index c21c07c2be7e..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/vmwarecollectors_client_example_test.go +++ /dev/null @@ -1,188 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/VMwareCollectors_ListByProject.json -func ExampleVMwareCollectorsClient_NewListByProjectPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVMwareCollectorsClient().NewListByProjectPager("abgoyal-westEurope", "abgoyalWEselfhostb72bproject", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VMwareCollectorList = armmigrate.VMwareCollectorList{ - // Value: []*armmigrate.VMwareCollector{ - // { - // Name: to.Ptr("PortalvCenterbc2fcollector"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/vmwarecollectors"), - // ETag: to.Ptr("\"01003d32-0000-0d00-0000-5d74d2e50000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/vmwarecollectors/PortalvCenterbc2fcollector"), - // Properties: &armmigrate.CollectorProperties{ - // AgentProperties: &armmigrate.CollectorAgentProperties{ - // ID: to.Ptr("75b0f71e-1272-4f29-a801-29cfa4b34a6e"), - // LastHeartbeatUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-28T06:21:28.779Z"); return t}()), - // SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - // ApplicationID: to.Ptr("fc717575-8173-4b21-92a5-658b655e613e"), - // Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/PortalvCenterbc2fagentauthaadapp"), - // Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ObjectID: to.Ptr("29d94f38-db94-4980-aec0-0cfd55ab1cd0"), - // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // Version: to.Ptr("1.0.8.227"), - // }, - // CreatedTimestamp: to.Ptr("2019-05-09T09:58:21.4988104Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.OffAzure/VMwareSites/PortalvCenterbc2fsite"), - // UpdatedTimestamp: to.Ptr("2019-09-08T10:07:33.1996006Z"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/VMwareCollectors_Get.json -func ExampleVMwareCollectorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMwareCollectorsClient().Get(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "PortalvCenterbc2fcollector", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMwareCollector = armmigrate.VMwareCollector{ - // Name: to.Ptr("PortalvCenterbc2fcollector"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/vmwarecollectors"), - // ETag: to.Ptr("\"01003d32-0000-0d00-0000-5d74d2e50000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/vmwarecollectors/PortalvCenterbc2fcollector"), - // Properties: &armmigrate.CollectorProperties{ - // AgentProperties: &armmigrate.CollectorAgentProperties{ - // ID: to.Ptr("75b0f71e-1272-4f29-a801-29cfa4b34a6e"), - // LastHeartbeatUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-28T06:21:28.779Z"); return t}()), - // SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - // ApplicationID: to.Ptr("fc717575-8173-4b21-92a5-658b655e613e"), - // Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/PortalvCenterbc2fagentauthaadapp"), - // Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ObjectID: to.Ptr("29d94f38-db94-4980-aec0-0cfd55ab1cd0"), - // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // Version: to.Ptr("1.0.8.227"), - // }, - // CreatedTimestamp: to.Ptr("2019-05-09T09:58:21.4988104Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.OffAzure/VMwareSites/PortalvCenterbc2fsite"), - // UpdatedTimestamp: to.Ptr("2019-09-08T10:07:33.1996006Z"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/VMwareCollectors_Create.json -func ExampleVMwareCollectorsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMwareCollectorsClient().Create(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "PortalvCenterbc2fcollector", &armmigrate.VMwareCollectorsClientCreateOptions{CollectorBody: &armmigrate.VMwareCollector{ - ETag: to.Ptr("\"01003d32-0000-0d00-0000-5d74d2e50000\""), - Properties: &armmigrate.CollectorProperties{ - AgentProperties: &armmigrate.CollectorAgentProperties{ - SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - ApplicationID: to.Ptr("fc717575-8173-4b21-92a5-658b655e613e"), - Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/PortalvCenterbc2fagentauthaadapp"), - Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - ObjectID: to.Ptr("29d94f38-db94-4980-aec0-0cfd55ab1cd0"), - TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - }, - }, - DiscoverySiteID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.OffAzure/VMwareSites/PortalvCenterbc2fsite"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMwareCollector = armmigrate.VMwareCollector{ - // Name: to.Ptr("PortalvCenterbc2fcollector"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/vmwarecollectors"), - // ETag: to.Ptr("\"01003d32-0000-0d00-0000-5d74d2e50000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/vmwarecollectors/PortalvCenterbc2fcollector"), - // Properties: &armmigrate.CollectorProperties{ - // AgentProperties: &armmigrate.CollectorAgentProperties{ - // ID: to.Ptr("75b0f71e-1272-4f29-a801-29cfa4b34a6e"), - // LastHeartbeatUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-28T06:21:28.779Z"); return t}()), - // SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - // ApplicationID: to.Ptr("fc717575-8173-4b21-92a5-658b655e613e"), - // Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/PortalvCenterbc2fagentauthaadapp"), - // Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ObjectID: to.Ptr("29d94f38-db94-4980-aec0-0cfd55ab1cd0"), - // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // Version: to.Ptr("1.0.8.227"), - // }, - // CreatedTimestamp: to.Ptr("2019-05-09T09:58:21.4988104Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.OffAzure/VMwareSites/PortalvCenterbc2fsite"), - // UpdatedTimestamp: to.Ptr("2019-09-08T10:07:33.1996006Z"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/VMwareCollectors_Delete.json -func ExampleVMwareCollectorsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewVMwareCollectorsClient().Delete(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "PortalvCenterbc2fcollector", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -}