diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/CHANGELOG.md b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/CHANGELOG.md index b1718bc8b92b..69efb06a7dec 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/CHANGELOG.md +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/CHANGELOG.md @@ -1,5 +1,262 @@ # Release History +## 1.0.0 (2025-05-09) +### Breaking Changes + +- Function `*ProtectedItemClient.BeginPlannedFailover` parameter(s) have been changed from `(context.Context, string, string, string, *ProtectedItemClientBeginPlannedFailoverOptions)` to `(context.Context, string, string, string, PlannedFailoverModel, *ProtectedItemClientBeginPlannedFailoverOptions)` +- Type of `EmailConfigurationModel.SystemData` has been changed from `*EmailConfigurationModelSystemData` to `*SystemData` +- Type of `EventModel.SystemData` has been changed from `*EventModelSystemData` to `*SystemData` +- Type of `FabricModel.SystemData` has been changed from `*FabricModelSystemData` to `*SystemData` +- Type of `FabricModelUpdate.SystemData` has been changed from `*FabricModelUpdateSystemData` to `*SystemData` +- Type of `PolicyModel.SystemData` has been changed from `*PolicyModelSystemData` to `*SystemData` +- Type of `ProtectedItemModel.SystemData` has been changed from `*ProtectedItemModelSystemData` to `*SystemData` +- Type of `ProtectedItemModelProperties.CurrentJob` has been changed from `*ProtectedItemModelPropertiesCurrentJob` to `*ProtectedItemJobProperties` +- Type of `ProtectedItemModelProperties.LastFailedEnableProtectionJob` has been changed from `*ProtectedItemModelPropertiesLastFailedEnableProtectionJob` to `*ProtectedItemJobProperties` +- Type of `ProtectedItemModelProperties.LastFailedPlannedFailoverJob` has been changed from `*ProtectedItemModelPropertiesLastFailedPlannedFailoverJob` to `*ProtectedItemJobProperties` +- Type of `ProtectedItemModelProperties.LastTestFailoverJob` has been changed from `*ProtectedItemModelPropertiesLastTestFailoverJob` to `*ProtectedItemJobProperties` +- Type of `RecoveryPointModel.SystemData` has been changed from `*RecoveryPointModelSystemData` to `*SystemData` +- Type of `ReplicationExtensionModel.SystemData` has been changed from `*ReplicationExtensionModelSystemData` to `*SystemData` +- Type of `VaultModel.SystemData` has been changed from `*VaultModelSystemData` to `*SystemData` +- Type of `VaultModelUpdate.SystemData` has been changed from `*VaultModelUpdateSystemData` to `*SystemData` +- Enum `WorkflowObjectType` has been removed +- Enum `WorkflowState` has been removed +- Function `NewAzureSiteRecoveryManagementServiceAPIClient` has been removed +- Function `*AzureSiteRecoveryManagementServiceAPIClient.CheckNameAvailability` has been removed +- Function `*AzureSiteRecoveryManagementServiceAPIClient.DeploymentPreflight` has been removed +- Function `*ClientFactory.NewAzureSiteRecoveryManagementServiceAPIClient` has been removed +- Function `*ClientFactory.NewDraClient` has been removed +- Function `*ClientFactory.NewDraOperationStatusClient` has been removed +- Function `*ClientFactory.NewFabricOperationsStatusClient` has been removed +- Function `*ClientFactory.NewPolicyOperationStatusClient` has been removed +- Function `*ClientFactory.NewProtectedItemOperationStatusClient` has been removed +- Function `*ClientFactory.NewRecoveryPointsClient` has been removed +- Function `*ClientFactory.NewReplicationExtensionOperationStatusClient` has been removed +- Function `*ClientFactory.NewVaultOperationStatusClient` has been removed +- Function `*ClientFactory.NewWorkflowClient` has been removed +- Function `*ClientFactory.NewWorkflowOperationStatusClient` has been removed +- Function `NewDraClient` has been removed +- Function `*DraClient.BeginCreate` has been removed +- Function `*DraClient.BeginDelete` has been removed +- Function `*DraClient.Get` has been removed +- Function `*DraClient.NewListPager` has been removed +- Function `*DraModelCustomProperties.GetDraModelCustomProperties` has been removed +- Function `NewDraOperationStatusClient` has been removed +- Function `*DraOperationStatusClient.Get` has been removed +- Function `NewFabricOperationsStatusClient` has been removed +- Function `*FabricOperationsStatusClient.Get` has been removed +- Function `*FailoverWorkflowModelCustomProperties.GetWorkflowModelCustomProperties` has been removed +- Function `NewPolicyOperationStatusClient` has been removed +- Function `*PolicyOperationStatusClient.Get` has been removed +- Function `NewProtectedItemOperationStatusClient` has been removed +- Function `*ProtectedItemOperationStatusClient.Get` has been removed +- Function `NewRecoveryPointsClient` has been removed +- Function `*RecoveryPointsClient.Get` has been removed +- Function `*RecoveryPointsClient.NewListPager` has been removed +- Function `NewReplicationExtensionOperationStatusClient` has been removed +- Function `*ReplicationExtensionOperationStatusClient.Get` has been removed +- Function `*TestFailoverCleanupWorkflowModelCustomProperties.GetWorkflowModelCustomProperties` has been removed +- Function `*TestFailoverWorkflowModelCustomProperties.GetWorkflowModelCustomProperties` has been removed +- Function `*VMwareDraModelCustomProperties.GetDraModelCustomProperties` has been removed +- Function `NewVaultOperationStatusClient` has been removed +- Function `*VaultOperationStatusClient.Get` has been removed +- Function `NewWorkflowClient` has been removed +- Function `*WorkflowClient.Get` has been removed +- Function `*WorkflowClient.NewListPager` has been removed +- Function `*WorkflowModelCustomProperties.GetWorkflowModelCustomProperties` has been removed +- Function `NewWorkflowOperationStatusClient` has been removed +- Function `*WorkflowOperationStatusClient.Get` has been removed +- Struct `DraModel` has been removed +- Struct `DraModelCollection` has been removed +- Struct `DraModelProperties` has been removed +- Struct `DraModelSystemData` has been removed +- Struct `EmailConfigurationModelCollection` has been removed +- Struct `EmailConfigurationModelSystemData` has been removed +- Struct `EventModelCollection` has been removed +- Struct `EventModelSystemData` has been removed +- Struct `FabricModelCollection` has been removed +- Struct `FabricModelSystemData` has been removed +- Struct `FabricModelUpdateSystemData` has been removed +- Struct `FailoverWorkflowModelCustomProperties` has been removed +- Struct `PolicyModelCollection` has been removed +- Struct `PolicyModelSystemData` has been removed +- Struct `ProtectedItemModelCollection` has been removed +- Struct `ProtectedItemModelPropertiesCurrentJob` has been removed +- Struct `ProtectedItemModelPropertiesLastFailedEnableProtectionJob` has been removed +- Struct `ProtectedItemModelPropertiesLastFailedPlannedFailoverJob` has been removed +- Struct `ProtectedItemModelPropertiesLastTestFailoverJob` has been removed +- Struct `ProtectedItemModelSystemData` has been removed +- Struct `RecoveryPointModelCollection` has been removed +- Struct `RecoveryPointModelSystemData` has been removed +- Struct `ReplicationExtensionModelCollection` has been removed +- Struct `ReplicationExtensionModelSystemData` has been removed +- Struct `TestFailoverCleanupWorkflowModelCustomProperties` has been removed +- Struct `TestFailoverWorkflowModelCustomProperties` has been removed +- Struct `VMwareDraModelCustomProperties` has been removed +- Struct `VaultModelCollection` has been removed +- Struct `VaultModelSystemData` has been removed +- Struct `VaultModelUpdateSystemData` has been removed +- Struct `WorkflowModel` has been removed +- Struct `WorkflowModelCollection` has been removed +- Struct `WorkflowModelProperties` has been removed +- Struct `WorkflowModelSystemData` has been removed +- Field `EmailConfigurationModelCollection` of struct `EmailConfigurationClientListResponse` has been removed +- Field `Filter` of struct `EventClientListOptions` has been removed +- Field `EventModelCollection` of struct `EventClientListResponse` has been removed +- Field `ContinuationToken` of struct `FabricClientListBySubscriptionOptions` has been removed +- Field `FabricModelCollection` of struct `FabricClientListBySubscriptionResponse` has been removed +- Field `FabricModelCollection` of struct `FabricClientListResponse` has been removed +- Field `SourceDraName`, `TargetDraName` of struct `HyperVToAzStackHCIProtectedItemModelCustomProperties` has been removed +- Field `PolicyModelCollection` of struct `PolicyClientListResponse` has been removed +- Field `Body` of struct `ProtectedItemClientBeginPlannedFailoverOptions` has been removed +- Field `ProtectedItemModelCollection` of struct `ProtectedItemClientListResponse` has been removed +- Field `DraID`, `TargetDraID` of struct `ProtectedItemModelProperties` has been removed +- Field `ReplicationExtensionModelCollection` of struct `ReplicationExtensionClientListResponse` has been removed +- Field `ChildrenWorkflows` of struct `TaskModel` has been removed +- Field `SourceDraName`, `TargetDraName` of struct `VMwareToAzStackHCIProtectedItemModelCustomProperties` has been removed +- Field `ContinuationToken` of struct `VaultClientListBySubscriptionOptions` has been removed +- Field `VaultModelCollection` of struct `VaultClientListBySubscriptionResponse` has been removed +- Field `VaultModelCollection` of struct `VaultClientListResponse` has been removed + +### Features Added + +- New enum type `CreatedByType` with values `CreatedByTypeApplication`, `CreatedByTypeKey`, `CreatedByTypeManagedIdentity`, `CreatedByTypeUser` +- New enum type `JobObjectType` with values `JobObjectTypeAvsDiskPool`, `JobObjectTypeFabric`, `JobObjectTypeFabricAgent`, `JobObjectTypePolicy`, `JobObjectTypeProtectedItem`, `JobObjectTypeRecoveryPlan`, `JobObjectTypeReplicationExtension`, `JobObjectTypeVault` +- New enum type `JobState` with values `JobStateCancelled`, `JobStateCancelling`, `JobStateCompletedWithErrors`, `JobStateCompletedWithInformation`, `JobStateCompletedWithWarnings`, `JobStateFailed`, `JobStatePending`, `JobStateStarted`, `JobStateSucceeded` +- New enum type `ManagedServiceIdentityType` with values `ManagedServiceIdentityTypeNone`, `ManagedServiceIdentityTypeSystemAssigned`, `ManagedServiceIdentityTypeSystemAssignedUserAssigned`, `ManagedServiceIdentityTypeUserAssigned` +- New enum type `PrivateEndpointConnectionStatus` with values `PrivateEndpointConnectionStatusApproved`, `PrivateEndpointConnectionStatusDisconnected`, `PrivateEndpointConnectionStatusPending`, `PrivateEndpointConnectionStatusRejected` +- New enum type `VaultIdentityType` with values `VaultIdentityTypeNone`, `VaultIdentityTypeSystemAssigned`, `VaultIdentityTypeUserAssigned` +- New function `NewCheckNameAvailabilityClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CheckNameAvailabilityClient, error)` +- New function `*CheckNameAvailabilityClient.Post(context.Context, string, *CheckNameAvailabilityClientPostOptions) (CheckNameAvailabilityClientPostResponse, error)` +- New function `*ClientFactory.NewCheckNameAvailabilityClient() *CheckNameAvailabilityClient` +- New function `*ClientFactory.NewDeploymentPreflightClient() *DeploymentPreflightClient` +- New function `*ClientFactory.NewFabricAgentClient() *FabricAgentClient` +- New function `*ClientFactory.NewJobClient() *JobClient` +- New function `*ClientFactory.NewLocationBasedOperationResultsClient() *LocationBasedOperationResultsClient` +- New function `*ClientFactory.NewOperationResultsClient() *OperationResultsClient` +- New function `*ClientFactory.NewPrivateEndpointConnectionProxiesClient() *PrivateEndpointConnectionProxiesClient` +- New function `*ClientFactory.NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient` +- New function `*ClientFactory.NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient` +- New function `*ClientFactory.NewRecoveryPointClient() *RecoveryPointClient` +- New function `NewDeploymentPreflightClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DeploymentPreflightClient, error)` +- New function `*DeploymentPreflightClient.Post(context.Context, string, string, *DeploymentPreflightClientPostOptions) (DeploymentPreflightClientPostResponse, error)` +- New function `NewFabricAgentClient(string, azcore.TokenCredential, *arm.ClientOptions) (*FabricAgentClient, error)` +- New function `*FabricAgentClient.BeginCreate(context.Context, string, string, string, FabricAgentModel, *FabricAgentClientBeginCreateOptions) (*runtime.Poller[FabricAgentClientCreateResponse], error)` +- New function `*FabricAgentClient.BeginDelete(context.Context, string, string, string, *FabricAgentClientBeginDeleteOptions) (*runtime.Poller[FabricAgentClientDeleteResponse], error)` +- New function `*FabricAgentClient.Get(context.Context, string, string, string, *FabricAgentClientGetOptions) (FabricAgentClientGetResponse, error)` +- New function `*FabricAgentClient.NewListPager(string, string, *FabricAgentClientListOptions) *runtime.Pager[FabricAgentClientListResponse]` +- New function `*FabricAgentModelCustomProperties.GetFabricAgentModelCustomProperties() *FabricAgentModelCustomProperties` +- New function `*FailoverJobModelCustomProperties.GetJobModelCustomProperties() *JobModelCustomProperties` +- New function `*HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate.GetProtectedItemModelCustomPropertiesUpdate() *ProtectedItemModelCustomPropertiesUpdate` +- New function `NewJobClient(string, azcore.TokenCredential, *arm.ClientOptions) (*JobClient, error)` +- New function `*JobClient.Get(context.Context, string, string, string, *JobClientGetOptions) (JobClientGetResponse, error)` +- New function `*JobClient.NewListPager(string, string, *JobClientListOptions) *runtime.Pager[JobClientListResponse]` +- New function `*JobModelCustomProperties.GetJobModelCustomProperties() *JobModelCustomProperties` +- New function `NewLocationBasedOperationResultsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*LocationBasedOperationResultsClient, error)` +- New function `*LocationBasedOperationResultsClient.Get(context.Context, string, string, string, *LocationBasedOperationResultsClientGetOptions) (LocationBasedOperationResultsClientGetResponse, error)` +- New function `NewOperationResultsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*OperationResultsClient, error)` +- New function `*OperationResultsClient.Get(context.Context, string, string, *OperationResultsClientGetOptions) (OperationResultsClientGetResponse, error)` +- New function `NewPrivateEndpointConnectionProxiesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PrivateEndpointConnectionProxiesClient, error)` +- New function `*PrivateEndpointConnectionProxiesClient.Create(context.Context, string, string, string, PrivateEndpointConnectionProxy, *PrivateEndpointConnectionProxiesClientCreateOptions) (PrivateEndpointConnectionProxiesClientCreateResponse, error)` +- New function `*PrivateEndpointConnectionProxiesClient.BeginDelete(context.Context, string, string, string, *PrivateEndpointConnectionProxiesClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionProxiesClientDeleteResponse], error)` +- New function `*PrivateEndpointConnectionProxiesClient.Get(context.Context, string, string, string, *PrivateEndpointConnectionProxiesClientGetOptions) (PrivateEndpointConnectionProxiesClientGetResponse, error)` +- New function `*PrivateEndpointConnectionProxiesClient.NewListPager(string, string, *PrivateEndpointConnectionProxiesClientListOptions) *runtime.Pager[PrivateEndpointConnectionProxiesClientListResponse]` +- New function `*PrivateEndpointConnectionProxiesClient.Validate(context.Context, string, string, string, PrivateEndpointConnectionProxy, *PrivateEndpointConnectionProxiesClientValidateOptions) (PrivateEndpointConnectionProxiesClientValidateResponse, error)` +- New function `NewPrivateEndpointConnectionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error)` +- New function `*PrivateEndpointConnectionsClient.BeginDelete(context.Context, string, string, string, *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error)` +- New function `*PrivateEndpointConnectionsClient.Get(context.Context, string, string, string, *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error)` +- New function `*PrivateEndpointConnectionsClient.NewListPager(string, string, *PrivateEndpointConnectionsClientListOptions) *runtime.Pager[PrivateEndpointConnectionsClientListResponse]` +- New function `*PrivateEndpointConnectionsClient.Update(context.Context, string, string, string, PrivateEndpointConnection, *PrivateEndpointConnectionsClientUpdateOptions) (PrivateEndpointConnectionsClientUpdateResponse, error)` +- New function `NewPrivateLinkResourcesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PrivateLinkResourcesClient, error)` +- New function `*PrivateLinkResourcesClient.Get(context.Context, string, string, string, *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error)` +- New function `*PrivateLinkResourcesClient.NewListPager(string, string, *PrivateLinkResourcesClientListOptions) *runtime.Pager[PrivateLinkResourcesClientListResponse]` +- New function `*ProtectedItemClient.BeginUpdate(context.Context, string, string, string, ProtectedItemModelUpdate, *ProtectedItemClientBeginUpdateOptions) (*runtime.Poller[ProtectedItemClientUpdateResponse], error)` +- New function `*ProtectedItemModelCustomPropertiesUpdate.GetProtectedItemModelCustomPropertiesUpdate() *ProtectedItemModelCustomPropertiesUpdate` +- New function `NewRecoveryPointClient(string, azcore.TokenCredential, *arm.ClientOptions) (*RecoveryPointClient, error)` +- New function `*RecoveryPointClient.Get(context.Context, string, string, string, string, *RecoveryPointClientGetOptions) (RecoveryPointClientGetResponse, error)` +- New function `*RecoveryPointClient.NewListPager(string, string, string, *RecoveryPointClientListOptions) *runtime.Pager[RecoveryPointClientListResponse]` +- New function `*TestFailoverCleanupJobModelCustomProperties.GetJobModelCustomProperties() *JobModelCustomProperties` +- New function `*TestFailoverJobModelCustomProperties.GetJobModelCustomProperties() *JobModelCustomProperties` +- New function `*VMwareFabricAgentModelCustomProperties.GetFabricAgentModelCustomProperties() *FabricAgentModelCustomProperties` +- New function `*VMwareToAzStackHCIEventModelCustomProperties.GetEventModelCustomProperties() *EventModelCustomProperties` +- New function `*VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate.GetProtectedItemModelCustomPropertiesUpdate() *ProtectedItemModelCustomPropertiesUpdate` +- New function `*VMwareToAzStackHCIRecoveryPointModelCustomProperties.GetRecoveryPointModelCustomProperties() *RecoveryPointModelCustomProperties` +- New struct `ConnectionDetails` +- New struct `DiskControllerInputs` +- New struct `EmailConfigurationModelListResult` +- New struct `EventModelListResult` +- New struct `FabricAgentModel` +- New struct `FabricAgentModelListResult` +- New struct `FabricAgentModelProperties` +- New struct `FabricModelListResult` +- New struct `FailoverJobModelCustomProperties` +- New struct `GroupConnectivityInformation` +- New struct `HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate` +- New struct `JobModel` +- New struct `JobModelCustomPropertiesAffectedObjectDetails` +- New struct `JobModelListResult` +- New struct `JobModelProperties` +- New struct `ManagedServiceIdentity` +- New struct `PolicyModelListResult` +- New struct `PrivateEndpoint` +- New struct `PrivateEndpointConnection` +- New struct `PrivateEndpointConnectionListResult` +- New struct `PrivateEndpointConnectionProxy` +- New struct `PrivateEndpointConnectionProxyListResult` +- New struct `PrivateEndpointConnectionProxyProperties` +- New struct `PrivateEndpointConnectionResponseProperties` +- New struct `PrivateLinkResource` +- New struct `PrivateLinkResourceListResult` +- New struct `PrivateLinkResourceProperties` +- New struct `PrivateLinkServiceConnection` +- New struct `PrivateLinkServiceConnectionState` +- New struct `PrivateLinkServiceProxy` +- New struct `ProtectedItemJobProperties` +- New struct `ProtectedItemModelListResult` +- New struct `ProtectedItemModelPropertiesUpdate` +- New struct `ProtectedItemModelUpdate` +- New struct `RecoveryPointModelListResult` +- New struct `RemotePrivateEndpoint` +- New struct `RemotePrivateEndpointConnection` +- New struct `ReplicationExtensionModelListResult` +- New struct `SystemData` +- New struct `TestFailoverCleanupJobModelCustomProperties` +- New struct `TestFailoverJobModelCustomProperties` +- New struct `UserAssignedIdentity` +- New struct `VMwareFabricAgentModelCustomProperties` +- New struct `VMwareToAzStackHCIEventModelCustomProperties` +- New struct `VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate` +- New struct `VMwareToAzStackHCIRecoveryPointModelCustomProperties` +- New struct `VaultIdentityModel` +- New struct `VaultModelListResult` +- New field `Properties` in struct `DeploymentPreflightResource` +- New anonymous field `EmailConfigurationModelListResult` in struct `EmailConfigurationClientListResponse` +- New field `ProvisioningState` in struct `EmailConfigurationModelProperties` +- New field `OdataOptions`, `PageSize` in struct `EventClientListOptions` +- New anonymous field `EventModelListResult` in struct `EventClientListResponse` +- New field `ProvisioningState` in struct `EventModelProperties` +- New anonymous field `FabricModelListResult` in struct `FabricClientListBySubscriptionResponse` +- New anonymous field `FabricModelListResult` in struct `FabricClientListResponse` +- New field `DiskBlockSize`, `DiskController`, `DiskIdentifier`, `DiskLogicalSectorSize`, `DiskPhysicalSectorSize` in struct `HyperVToAzStackHCIDiskInput` +- New field `IsMacMigrationEnabled`, `IsStaticIPMigrationEnabled` in struct `HyperVToAzStackHCINicInput` +- New field `DiskBlockSize`, `DiskLogicalSectorSize`, `DiskPhysicalSectorSize` in struct `HyperVToAzStackHCIProtectedDiskProperties` +- New field `SourceFabricAgentName`, `TargetFabricAgentName` in struct `HyperVToAzStackHCIProtectedItemModelCustomProperties` +- New anonymous field `PolicyModelListResult` in struct `PolicyClientListResponse` +- New field `ContinuationToken`, `OdataOptions`, `PageSize` in struct `ProtectedItemClientListOptions` +- New anonymous field `ProtectedItemModelListResult` in struct `ProtectedItemClientListResponse` +- New field `FabricAgentID`, `TargetFabricAgentID` in struct `ProtectedItemModelProperties` +- New field `ProvisioningState` in struct `RecoveryPointModelProperties` +- New anonymous field `ReplicationExtensionModelListResult` in struct `ReplicationExtensionClientListResponse` +- New field `ChildrenJobs` in struct `TaskModel` +- New field `DiskBlockSize`, `DiskController`, `DiskIdentifier`, `DiskLogicalSectorSize`, `DiskPhysicalSectorSize` in struct `VMwareToAzStackHCIDiskInput` +- New field `IsMacMigrationEnabled`, `IsStaticIPMigrationEnabled` in struct `VMwareToAzStackHCINicInput` +- New field `DiskBlockSize`, `DiskLogicalSectorSize`, `DiskPhysicalSectorSize` in struct `VMwareToAzStackHCIProtectedDiskProperties` +- New field `SourceFabricAgentName`, `TargetFabricAgentName` in struct `VMwareToAzStackHCIProtectedItemModelCustomProperties` +- New anonymous field `VaultModelListResult` in struct `VaultClientListBySubscriptionResponse` +- New anonymous field `VaultModelListResult` in struct `VaultClientListResponse` +- New field `Identity` in struct `VaultModel` +- New field `Identity` in struct `VaultModelUpdate` + + ## 0.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/README.md b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/README.md index ff396a9bbd04..90230626d4de 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/README.md +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/README.md @@ -55,7 +55,7 @@ clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory( see https://aka.ms/autorest - -``` yaml -azure-arm: true -require: -- https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/readme.go.md -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.2.0 -tag: package-2021-02-16-preview -``` \ No newline at end of file diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/azuresiterecoverymanagementserviceapi_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/azuresiterecoverymanagementserviceapi_client.go deleted file mode 100644 index 2a3e44d70258..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/azuresiterecoverymanagementserviceapi_client.go +++ /dev/null @@ -1,181 +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 armrecoveryservicesdatareplication - -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" -) - -// AzureSiteRecoveryManagementServiceAPIClient contains the methods for the AzureSiteRecoveryManagementServiceAPI group. -// Don't use this type directly, use NewAzureSiteRecoveryManagementServiceAPIClient() instead. -type AzureSiteRecoveryManagementServiceAPIClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAzureSiteRecoveryManagementServiceAPIClient creates a new instance of AzureSiteRecoveryManagementServiceAPIClient 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 NewAzureSiteRecoveryManagementServiceAPIClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureSiteRecoveryManagementServiceAPIClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AzureSiteRecoveryManagementServiceAPIClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CheckNameAvailability - Checks the resource name availability. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-02-16-preview -// - location - The name of the Azure region. -// - options - AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions contains the optional parameters for -// the AzureSiteRecoveryManagementServiceAPIClient.CheckNameAvailability method. -func (client *AzureSiteRecoveryManagementServiceAPIClient) CheckNameAvailability(ctx context.Context, location string, options *AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions) (AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse, error) { - var err error - const operationName = "AzureSiteRecoveryManagementServiceAPIClient.CheckNameAvailability" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.checkNameAvailabilityCreateRequest(ctx, location, options) - if err != nil { - return AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse{}, err - } - resp, err := client.checkNameAvailabilityHandleResponse(httpResp) - return resp, err -} - -// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. -func (client *AzureSiteRecoveryManagementServiceAPIClient) checkNameAvailabilityCreateRequest(ctx context.Context, location string, options *AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/locations/{location}/checkNameAvailability" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if location == "" { - return nil, errors.New("parameter location cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) - 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", "2021-02-16-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. -func (client *AzureSiteRecoveryManagementServiceAPIClient) checkNameAvailabilityHandleResponse(resp *http.Response) (AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse, error) { - result := AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResponseModel); err != nil { - return AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse{}, err - } - return result, nil -} - -// DeploymentPreflight - Performs resource deployment validation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-02-16-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - deploymentID - Deployment Id. -// - options - AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions contains the optional parameters for the -// AzureSiteRecoveryManagementServiceAPIClient.DeploymentPreflight method. -func (client *AzureSiteRecoveryManagementServiceAPIClient) DeploymentPreflight(ctx context.Context, resourceGroupName string, deploymentID string, options *AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions) (AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse, error) { - var err error - const operationName = "AzureSiteRecoveryManagementServiceAPIClient.DeploymentPreflight" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deploymentPreflightCreateRequest(ctx, resourceGroupName, deploymentID, options) - if err != nil { - return AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse{}, err - } - resp, err := client.deploymentPreflightHandleResponse(httpResp) - return resp, err -} - -// deploymentPreflightCreateRequest creates the DeploymentPreflight request. -func (client *AzureSiteRecoveryManagementServiceAPIClient) deploymentPreflightCreateRequest(ctx context.Context, resourceGroupName string, deploymentID string, options *AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/deployments/{deploymentId}/preflight" - 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 deploymentID == "" { - return nil, errors.New("parameter deploymentID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{deploymentId}", url.PathEscape(deploymentID)) - 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", "2021-02-16-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// deploymentPreflightHandleResponse handles the DeploymentPreflight response. -func (client *AzureSiteRecoveryManagementServiceAPIClient) deploymentPreflightHandleResponse(resp *http.Response) (AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse, error) { - result := AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentPreflightModel); err != nil { - return AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/azuresiterecoverymanagementserviceapi_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/azuresiterecoverymanagementserviceapi_client_example_test.go deleted file mode 100644 index 2af8e81c4f31..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/azuresiterecoverymanagementserviceapi_client_example_test.go +++ /dev/null @@ -1,86 +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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/CheckNameAvailability.json -func ExampleAzureSiteRecoveryManagementServiceAPIClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureSiteRecoveryManagementServiceAPIClient().CheckNameAvailability(ctx, "trfqtbtmusswpibw", &armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions{Body: &armrecoveryservicesdatareplication.CheckNameAvailabilityModel{ - Name: to.Ptr("updkdcixs"), - Type: to.Ptr("gngmcancdauwhdixjjvqnfkvqc"), - }, - }) - 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.CheckNameAvailabilityResponseModel = armrecoveryservicesdatareplication.CheckNameAvailabilityResponseModel{ - // Message: to.Ptr("gddmrunlrhtuhm"), - // NameAvailable: to.Ptr(true), - // Reason: to.Ptr("wwbvswyrmghbmv"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/DeploymentPreflight.json -func ExampleAzureSiteRecoveryManagementServiceAPIClient_DeploymentPreflight() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureSiteRecoveryManagementServiceAPIClient().DeploymentPreflight(ctx, "rgrecoveryservicesdatareplication", "kjoiahxljomjcmvabaobumg", &armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions{Body: &armrecoveryservicesdatareplication.DeploymentPreflightModel{ - Resources: []*armrecoveryservicesdatareplication.DeploymentPreflightResource{ - { - Name: to.Ptr("xtgugoflfc"), - Type: to.Ptr("nsnaptduolqcxsikrewvgjbxqpt"), - APIVersion: to.Ptr("otihymhvzblycdoxo"), - Location: to.Ptr("cbsgtxkjdzwbyp"), - }}, - }, - }) - 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.DeploymentPreflightModel = armrecoveryservicesdatareplication.DeploymentPreflightModel{ - // Resources: []*armrecoveryservicesdatareplication.DeploymentPreflightResource{ - // { - // Name: to.Ptr("xtgugoflfc"), - // Type: to.Ptr("nsnaptduolqcxsikrewvgjbxqpt"), - // APIVersion: to.Ptr("otihymhvzblycdoxo"), - // Location: to.Ptr("cbsgtxkjdzwbyp"), - // }}, - // } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/build.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/build.go deleted file mode 100644 index cd5948344dab..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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 -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication - -package armrecoveryservicesdatareplication diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/checknameavailability_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/checknameavailability_client.go new file mode 100644 index 000000000000..75fb4c8569d3 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/checknameavailability_client.go @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armrecoveryservicesdatareplication + +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" +) + +// CheckNameAvailabilityClient contains the methods for the CheckNameAvailability group. +// Don't use this type directly, use NewCheckNameAvailabilityClient() instead. +type CheckNameAvailabilityClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCheckNameAvailabilityClient creates a new instance of CheckNameAvailabilityClient 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 NewCheckNameAvailabilityClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CheckNameAvailabilityClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CheckNameAvailabilityClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Post - Performs the resource name availability check. +// +// Checks the resource name availability. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - location - The name of the Azure region. +// - options - CheckNameAvailabilityClientPostOptions contains the optional parameters for the CheckNameAvailabilityClient.Post +// method. +func (client *CheckNameAvailabilityClient) Post(ctx context.Context, location string, options *CheckNameAvailabilityClientPostOptions) (CheckNameAvailabilityClientPostResponse, error) { + var err error + const operationName = "CheckNameAvailabilityClient.Post" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.postCreateRequest(ctx, location, options) + if err != nil { + return CheckNameAvailabilityClientPostResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CheckNameAvailabilityClientPostResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CheckNameAvailabilityClientPostResponse{}, err + } + resp, err := client.postHandleResponse(httpResp) + return resp, err +} + +// postCreateRequest creates the Post request. +func (client *CheckNameAvailabilityClient) postCreateRequest(ctx context.Context, location string, options *CheckNameAvailabilityClientPostOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/locations/{location}/checkNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + 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-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Body != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// postHandleResponse handles the Post response. +func (client *CheckNameAvailabilityClient) postHandleResponse(resp *http.Response) (CheckNameAvailabilityClientPostResponse, error) { + result := CheckNameAvailabilityClientPostResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResponseModel); err != nil { + return CheckNameAvailabilityClientPostResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vaultoperationstatus_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/checknameavailability_client_example_test.go similarity index 52% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vaultoperationstatus_client_example_test.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/checknameavailability_client_example_test.go index 19de2a72b6a0..7ff513da7eb9 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vaultoperationstatus_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/checknameavailability_client_example_test.go @@ -1,45 +1,44 @@ -//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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/VaultOperationStatus_Get.json -func ExampleVaultOperationStatusClient_Get() { +// Generated from example definition: 2024-09-01/CheckNameAvailability_Post.json +func ExampleCheckNameAvailabilityClient_Post() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewVaultOperationStatusClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "vsdvwe", nil) + res, err := clientFactory.NewCheckNameAvailabilityClient().Post(ctx, "trfqtbtmusswpibw", &CheckNameAvailabilityClientPostOptions{ + body: &armrecoveryservicesdatareplication.CheckNameAvailabilityModel{ + Name: to.Ptr("updkdcixs"), + Type: to.Ptr("gngmcancdauwhdixjjvqnfkvqc"), + }}) 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.OperationStatus = armrecoveryservicesdatareplication.OperationStatus{ - // Name: to.Ptr("wzdasptnwlxgobklayoqapjcgcf"), - // EndTime: to.Ptr("nauyrfh"), - // ID: to.Ptr("sf"), - // StartTime: to.Ptr("xuzwmfrhluafmwwsmzqxsytyehsh"), - // Status: to.Ptr("plbnngzfppdram"), + // res = armrecoveryservicesdatareplication.CheckNameAvailabilityClientPostResponse{ + // CheckNameAvailabilityResponseModel: &armrecoveryservicesdatareplication.CheckNameAvailabilityResponseModel{ + // NameAvailable: to.Ptr(true), + // Reason: to.Ptr("wwbvswyrmghbmv"), + // Message: to.Ptr("gddmrunlrhtuhm"), + // }, // } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/client_factory.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/client_factory.go index 5524eca60a1b..9e2e150e347d 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/client_factory.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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 armrecoveryservicesdatareplication @@ -17,8 +13,7 @@ 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. @@ -27,126 +22,155 @@ type ClientFactory struct { // - 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 } -// NewAzureSiteRecoveryManagementServiceAPIClient creates a new instance of AzureSiteRecoveryManagementServiceAPIClient. -func (c *ClientFactory) NewAzureSiteRecoveryManagementServiceAPIClient() *AzureSiteRecoveryManagementServiceAPIClient { - subClient, _ := NewAzureSiteRecoveryManagementServiceAPIClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewDraClient creates a new instance of DraClient. -func (c *ClientFactory) NewDraClient() *DraClient { - subClient, _ := NewDraClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewCheckNameAvailabilityClient creates a new instance of CheckNameAvailabilityClient. +func (c *ClientFactory) NewCheckNameAvailabilityClient() *CheckNameAvailabilityClient { + return &CheckNameAvailabilityClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewDraOperationStatusClient creates a new instance of DraOperationStatusClient. -func (c *ClientFactory) NewDraOperationStatusClient() *DraOperationStatusClient { - subClient, _ := NewDraOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewDeploymentPreflightClient creates a new instance of DeploymentPreflightClient. +func (c *ClientFactory) NewDeploymentPreflightClient() *DeploymentPreflightClient { + return &DeploymentPreflightClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewEmailConfigurationClient creates a new instance of EmailConfigurationClient. func (c *ClientFactory) NewEmailConfigurationClient() *EmailConfigurationClient { - subClient, _ := NewEmailConfigurationClient(c.subscriptionID, c.credential, c.options) - return subClient + return &EmailConfigurationClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewEventClient creates a new instance of EventClient. func (c *ClientFactory) NewEventClient() *EventClient { - subClient, _ := NewEventClient(c.subscriptionID, c.credential, c.options) - return subClient + return &EventClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewFabricAgentClient creates a new instance of FabricAgentClient. +func (c *ClientFactory) NewFabricAgentClient() *FabricAgentClient { + return &FabricAgentClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewFabricClient creates a new instance of FabricClient. func (c *ClientFactory) NewFabricClient() *FabricClient { - subClient, _ := NewFabricClient(c.subscriptionID, c.credential, c.options) - return subClient + return &FabricClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewFabricOperationsStatusClient creates a new instance of FabricOperationsStatusClient. -func (c *ClientFactory) NewFabricOperationsStatusClient() *FabricOperationsStatusClient { - subClient, _ := NewFabricOperationsStatusClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewJobClient creates a new instance of JobClient. +func (c *ClientFactory) NewJobClient() *JobClient { + return &JobClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewLocationBasedOperationResultsClient creates a new instance of LocationBasedOperationResultsClient. +func (c *ClientFactory) NewLocationBasedOperationResultsClient() *LocationBasedOperationResultsClient { + return &LocationBasedOperationResultsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOperationResultsClient creates a new instance of OperationResultsClient. +func (c *ClientFactory) NewOperationResultsClient() *OperationResultsClient { + return &OperationResultsClient{ + 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 + return &OperationsClient{ + internal: c.internal, + } } // NewPolicyClient creates a new instance of PolicyClient. func (c *ClientFactory) NewPolicyClient() *PolicyClient { - subClient, _ := NewPolicyClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PolicyClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewPolicyOperationStatusClient creates a new instance of PolicyOperationStatusClient. -func (c *ClientFactory) NewPolicyOperationStatusClient() *PolicyOperationStatusClient { - subClient, _ := NewPolicyOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewPrivateEndpointConnectionProxiesClient creates a new instance of PrivateEndpointConnectionProxiesClient. +func (c *ClientFactory) NewPrivateEndpointConnectionProxiesClient() *PrivateEndpointConnectionProxiesClient { + return &PrivateEndpointConnectionProxiesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewProtectedItemClient creates a new instance of ProtectedItemClient. -func (c *ClientFactory) NewProtectedItemClient() *ProtectedItemClient { - subClient, _ := NewProtectedItemClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + return &PrivateEndpointConnectionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewProtectedItemOperationStatusClient creates a new instance of ProtectedItemOperationStatusClient. -func (c *ClientFactory) NewProtectedItemOperationStatusClient() *ProtectedItemOperationStatusClient { - subClient, _ := NewProtectedItemOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient. +func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { + return &PrivateLinkResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewRecoveryPointsClient creates a new instance of RecoveryPointsClient. -func (c *ClientFactory) NewRecoveryPointsClient() *RecoveryPointsClient { - subClient, _ := NewRecoveryPointsClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewProtectedItemClient creates a new instance of ProtectedItemClient. +func (c *ClientFactory) NewProtectedItemClient() *ProtectedItemClient { + return &ProtectedItemClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewReplicationExtensionClient creates a new instance of ReplicationExtensionClient. -func (c *ClientFactory) NewReplicationExtensionClient() *ReplicationExtensionClient { - subClient, _ := NewReplicationExtensionClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewRecoveryPointClient creates a new instance of RecoveryPointClient. +func (c *ClientFactory) NewRecoveryPointClient() *RecoveryPointClient { + return &RecoveryPointClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewReplicationExtensionOperationStatusClient creates a new instance of ReplicationExtensionOperationStatusClient. -func (c *ClientFactory) NewReplicationExtensionOperationStatusClient() *ReplicationExtensionOperationStatusClient { - subClient, _ := NewReplicationExtensionOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewReplicationExtensionClient creates a new instance of ReplicationExtensionClient. +func (c *ClientFactory) NewReplicationExtensionClient() *ReplicationExtensionClient { + return &ReplicationExtensionClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewVaultClient creates a new instance of VaultClient. func (c *ClientFactory) NewVaultClient() *VaultClient { - subClient, _ := NewVaultClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewVaultOperationStatusClient creates a new instance of VaultOperationStatusClient. -func (c *ClientFactory) NewVaultOperationStatusClient() *VaultOperationStatusClient { - subClient, _ := NewVaultOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewWorkflowClient creates a new instance of WorkflowClient. -func (c *ClientFactory) NewWorkflowClient() *WorkflowClient { - subClient, _ := NewWorkflowClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewWorkflowOperationStatusClient creates a new instance of WorkflowOperationStatusClient. -func (c *ClientFactory) NewWorkflowOperationStatusClient() *WorkflowOperationStatusClient { - subClient, _ := NewWorkflowOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient + return &VaultClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/constants.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/constants.go index bde98da71bdc..9910189149e4 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/constants.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/constants.go @@ -1,22 +1,19 @@ -//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 armrecoveryservicesdatareplication const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - moduleVersion = "v0.2.0" + moduleVersion = "v1.0.0" ) -// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +// 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" ) @@ -27,13 +24,40 @@ func PossibleActionTypeValues() []ActionType { } } +// CreatedByType - The kind of entity that created the resource. +type CreatedByType string + +const ( + // 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" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + // HealthStatus - Gets or sets the fabric health. type HealthStatus string const ( + // HealthStatusCritical - Critical Status. HealthStatusCritical HealthStatus = "Critical" - HealthStatusNormal HealthStatus = "Normal" - HealthStatusWarning HealthStatus = "Warning" + // HealthStatusNormal - Healthy Status. + HealthStatusNormal HealthStatus = "Normal" + // HealthStatusWarning - Warning Status. + HealthStatusWarning HealthStatus = "Warning" ) // PossibleHealthStatusValues returns the possible values for the HealthStatus const type. @@ -45,13 +69,115 @@ func PossibleHealthStatusValues() []HealthStatus { } } +// JobObjectType - Gets or sets the object type. +type JobObjectType string + +const ( + // JobObjectTypeAvsDiskPool - AVS disk pool. + JobObjectTypeAvsDiskPool JobObjectType = "AvsDiskPool" + // JobObjectTypeFabric - Fabric level job. + JobObjectTypeFabric JobObjectType = "Fabric" + // JobObjectTypeFabricAgent - Fabric agent level workflow. + JobObjectTypeFabricAgent JobObjectType = "FabricAgent" + // JobObjectTypePolicy - Policy level job. + JobObjectTypePolicy JobObjectType = "Policy" + // JobObjectTypeProtectedItem - Protected item level job. + JobObjectTypeProtectedItem JobObjectType = "ProtectedItem" + // JobObjectTypeRecoveryPlan - Recovery plan level job. + JobObjectTypeRecoveryPlan JobObjectType = "RecoveryPlan" + // JobObjectTypeReplicationExtension - Replication extension level job. + JobObjectTypeReplicationExtension JobObjectType = "ReplicationExtension" + // JobObjectTypeVault - Vault level job. + JobObjectTypeVault JobObjectType = "Vault" +) + +// PossibleJobObjectTypeValues returns the possible values for the JobObjectType const type. +func PossibleJobObjectTypeValues() []JobObjectType { + return []JobObjectType{ + JobObjectTypeAvsDiskPool, + JobObjectTypeFabric, + JobObjectTypeFabricAgent, + JobObjectTypePolicy, + JobObjectTypeProtectedItem, + JobObjectTypeRecoveryPlan, + JobObjectTypeReplicationExtension, + JobObjectTypeVault, + } +} + +// JobState - Gets or sets the job state. +type JobState string + +const ( + // JobStateCancelled - Job has been cancelled. + JobStateCancelled JobState = "Cancelled" + // JobStateCancelling - Job cancellation is in progress. + JobStateCancelling JobState = "Cancelling" + // JobStateCompletedWithErrors - Job has completed with errors. + JobStateCompletedWithErrors JobState = "CompletedWithErrors" + // JobStateCompletedWithInformation - Job has completed with information. + JobStateCompletedWithInformation JobState = "CompletedWithInformation" + // JobStateCompletedWithWarnings - Job has completed with warnings. + JobStateCompletedWithWarnings JobState = "CompletedWithWarnings" + // JobStateFailed - Job failed. + JobStateFailed JobState = "Failed" + // JobStatePending - Job has not been started. + JobStatePending JobState = "Pending" + // JobStateStarted - Job is in progress. + JobStateStarted JobState = "Started" + // JobStateSucceeded - Job has completed successfully. + JobStateSucceeded JobState = "Succeeded" +) + +// PossibleJobStateValues returns the possible values for the JobState const type. +func PossibleJobStateValues() []JobState { + return []JobState{ + JobStateCancelled, + JobStateCancelling, + JobStateCompletedWithErrors, + JobStateCompletedWithInformation, + JobStateCompletedWithWarnings, + JobStateFailed, + JobStatePending, + JobStateStarted, + JobStateSucceeded, + } +} + +// ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). +type ManagedServiceIdentityType string + +const ( + // ManagedServiceIdentityTypeNone - No managed identity. + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + // ManagedServiceIdentityTypeSystemAssigned - System assigned managed identity. + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + // ManagedServiceIdentityTypeSystemAssignedUserAssigned - System and user assigned managed identity. + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" + // ManagedServiceIdentityTypeUserAssigned - User assigned managed identity. + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ + ManagedServiceIdentityTypeNone, + ManagedServiceIdentityTypeSystemAssigned, + ManagedServiceIdentityTypeSystemAssignedUserAssigned, + ManagedServiceIdentityTypeUserAssigned, + } +} + // 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 Origin = "system" - OriginUser Origin = "user" + // 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" ) @@ -64,11 +190,37 @@ func PossibleOriginValues() []Origin { } } +// PrivateEndpointConnectionStatus - Gets or sets the status. +type PrivateEndpointConnectionStatus string + +const ( + // PrivateEndpointConnectionStatusApproved - Approved Status. + PrivateEndpointConnectionStatusApproved PrivateEndpointConnectionStatus = "Approved" + // PrivateEndpointConnectionStatusDisconnected - Disconnected Status. + PrivateEndpointConnectionStatusDisconnected PrivateEndpointConnectionStatus = "Disconnected" + // PrivateEndpointConnectionStatusPending - Pending Status. + PrivateEndpointConnectionStatusPending PrivateEndpointConnectionStatus = "Pending" + // PrivateEndpointConnectionStatusRejected - Rejected Status. + PrivateEndpointConnectionStatusRejected PrivateEndpointConnectionStatus = "Rejected" +) + +// PossiblePrivateEndpointConnectionStatusValues returns the possible values for the PrivateEndpointConnectionStatus const type. +func PossiblePrivateEndpointConnectionStatusValues() []PrivateEndpointConnectionStatus { + return []PrivateEndpointConnectionStatus{ + PrivateEndpointConnectionStatusApproved, + PrivateEndpointConnectionStatusDisconnected, + PrivateEndpointConnectionStatusPending, + PrivateEndpointConnectionStatusRejected, + } +} + // ProtectedItemActiveLocation - Gets or sets the location of the protected item. type ProtectedItemActiveLocation string const ( - ProtectedItemActiveLocationPrimary ProtectedItemActiveLocation = "Primary" + // ProtectedItemActiveLocationPrimary - Protected item is active on Primary. + ProtectedItemActiveLocationPrimary ProtectedItemActiveLocation = "Primary" + // ProtectedItemActiveLocationRecovery - Protected item is active on Recovery. ProtectedItemActiveLocationRecovery ProtectedItemActiveLocation = "Recovery" ) @@ -84,58 +236,112 @@ func PossibleProtectedItemActiveLocationValues() []ProtectedItemActiveLocation { type ProtectionState string const ( - ProtectionStateCancelFailoverFailedOnPrimary ProtectionState = "CancelFailoverFailedOnPrimary" - ProtectionStateCancelFailoverFailedOnRecovery ProtectionState = "CancelFailoverFailedOnRecovery" - ProtectionStateCancelFailoverInProgressOnPrimary ProtectionState = "CancelFailoverInProgressOnPrimary" - ProtectionStateCancelFailoverInProgressOnRecovery ProtectionState = "CancelFailoverInProgressOnRecovery" - ProtectionStateCancelFailoverStatesBegin ProtectionState = "CancelFailoverStatesBegin" - ProtectionStateCancelFailoverStatesEnd ProtectionState = "CancelFailoverStatesEnd" - ProtectionStateChangeRecoveryPointCompleted ProtectionState = "ChangeRecoveryPointCompleted" - ProtectionStateChangeRecoveryPointFailed ProtectionState = "ChangeRecoveryPointFailed" - ProtectionStateChangeRecoveryPointInitiated ProtectionState = "ChangeRecoveryPointInitiated" - ProtectionStateChangeRecoveryPointStatesBegin ProtectionState = "ChangeRecoveryPointStatesBegin" - ProtectionStateChangeRecoveryPointStatesEnd ProtectionState = "ChangeRecoveryPointStatesEnd" - ProtectionStateCommitFailoverCompleted ProtectionState = "CommitFailoverCompleted" - ProtectionStateCommitFailoverFailedOnPrimary ProtectionState = "CommitFailoverFailedOnPrimary" - ProtectionStateCommitFailoverFailedOnRecovery ProtectionState = "CommitFailoverFailedOnRecovery" - ProtectionStateCommitFailoverInProgressOnPrimary ProtectionState = "CommitFailoverInProgressOnPrimary" - ProtectionStateCommitFailoverInProgressOnRecovery ProtectionState = "CommitFailoverInProgressOnRecovery" - ProtectionStateCommitFailoverStatesBegin ProtectionState = "CommitFailoverStatesBegin" - ProtectionStateCommitFailoverStatesEnd ProtectionState = "CommitFailoverStatesEnd" - ProtectionStateDisablingFailed ProtectionState = "DisablingFailed" - ProtectionStateDisablingProtection ProtectionState = "DisablingProtection" - ProtectionStateEnablingFailed ProtectionState = "EnablingFailed" - ProtectionStateEnablingProtection ProtectionState = "EnablingProtection" - ProtectionStateInitialReplicationCompletedOnPrimary ProtectionState = "InitialReplicationCompletedOnPrimary" - ProtectionStateInitialReplicationCompletedOnRecovery ProtectionState = "InitialReplicationCompletedOnRecovery" - ProtectionStateInitialReplicationFailed ProtectionState = "InitialReplicationFailed" - ProtectionStateInitialReplicationInProgress ProtectionState = "InitialReplicationInProgress" - ProtectionStateInitialReplicationStatesBegin ProtectionState = "InitialReplicationStatesBegin" - ProtectionStateInitialReplicationStatesEnd ProtectionState = "InitialReplicationStatesEnd" - ProtectionStateMarkedForDeletion ProtectionState = "MarkedForDeletion" - ProtectionStatePlannedFailoverCompleted ProtectionState = "PlannedFailoverCompleted" - ProtectionStatePlannedFailoverCompleting ProtectionState = "PlannedFailoverCompleting" - ProtectionStatePlannedFailoverCompletionFailed ProtectionState = "PlannedFailoverCompletionFailed" - ProtectionStatePlannedFailoverFailed ProtectionState = "PlannedFailoverFailed" - ProtectionStatePlannedFailoverInitiated ProtectionState = "PlannedFailoverInitiated" - ProtectionStatePlannedFailoverTransitionStatesBegin ProtectionState = "PlannedFailoverTransitionStatesBegin" - ProtectionStatePlannedFailoverTransitionStatesEnd ProtectionState = "PlannedFailoverTransitionStatesEnd" - ProtectionStateProtected ProtectionState = "Protected" - ProtectionStateProtectedStatesBegin ProtectionState = "ProtectedStatesBegin" - ProtectionStateProtectedStatesEnd ProtectionState = "ProtectedStatesEnd" - ProtectionStateReprotectFailed ProtectionState = "ReprotectFailed" - ProtectionStateReprotectInitiated ProtectionState = "ReprotectInitiated" - ProtectionStateReprotectStatesBegin ProtectionState = "ReprotectStatesBegin" - ProtectionStateReprotectStatesEnd ProtectionState = "ReprotectStatesEnd" - ProtectionStateUnplannedFailoverCompleted ProtectionState = "UnplannedFailoverCompleted" - ProtectionStateUnplannedFailoverCompleting ProtectionState = "UnplannedFailoverCompleting" - ProtectionStateUnplannedFailoverCompletionFailed ProtectionState = "UnplannedFailoverCompletionFailed" - ProtectionStateUnplannedFailoverFailed ProtectionState = "UnplannedFailoverFailed" - ProtectionStateUnplannedFailoverInitiated ProtectionState = "UnplannedFailoverInitiated" + // ProtectionStateCancelFailoverFailedOnPrimary - Cancel failover failed on the primary side. + ProtectionStateCancelFailoverFailedOnPrimary ProtectionState = "CancelFailoverFailedOnPrimary" + // ProtectionStateCancelFailoverFailedOnRecovery - Cancel failover failed on the recovery side. + ProtectionStateCancelFailoverFailedOnRecovery ProtectionState = "CancelFailoverFailedOnRecovery" + // ProtectionStateCancelFailoverInProgressOnPrimary - Cancel failover is in progress on the primary side. + ProtectionStateCancelFailoverInProgressOnPrimary ProtectionState = "CancelFailoverInProgressOnPrimary" + // ProtectionStateCancelFailoverInProgressOnRecovery - Cancel failover is in progress on the recovery side. + ProtectionStateCancelFailoverInProgressOnRecovery ProtectionState = "CancelFailoverInProgressOnRecovery" + // ProtectionStateCancelFailoverStatesBegin - Begin marker for cancel failover states. + ProtectionStateCancelFailoverStatesBegin ProtectionState = "CancelFailoverStatesBegin" + // ProtectionStateCancelFailoverStatesEnd - End marker for cancel failover states. + ProtectionStateCancelFailoverStatesEnd ProtectionState = "CancelFailoverStatesEnd" + // ProtectionStateChangeRecoveryPointCompleted - Change recovery point has been completed successfully. + ProtectionStateChangeRecoveryPointCompleted ProtectionState = "ChangeRecoveryPointCompleted" + // ProtectionStateChangeRecoveryPointFailed - Change recovery point has failed. + ProtectionStateChangeRecoveryPointFailed ProtectionState = "ChangeRecoveryPointFailed" + // ProtectionStateChangeRecoveryPointInitiated - Change recovery point has been initiated.. + ProtectionStateChangeRecoveryPointInitiated ProtectionState = "ChangeRecoveryPointInitiated" + // ProtectionStateChangeRecoveryPointStatesBegin - Begin marker for change recovery point states. + ProtectionStateChangeRecoveryPointStatesBegin ProtectionState = "ChangeRecoveryPointStatesBegin" + // ProtectionStateChangeRecoveryPointStatesEnd - End marker for change recovery point states. + ProtectionStateChangeRecoveryPointStatesEnd ProtectionState = "ChangeRecoveryPointStatesEnd" + // ProtectionStateCommitFailoverCompleted - Commit failover has been completed successfully. + ProtectionStateCommitFailoverCompleted ProtectionState = "CommitFailoverCompleted" + // ProtectionStateCommitFailoverFailedOnPrimary - Commit failover failed on the primary side. + ProtectionStateCommitFailoverFailedOnPrimary ProtectionState = "CommitFailoverFailedOnPrimary" + // ProtectionStateCommitFailoverFailedOnRecovery - Commit failover failed on the recovery side. + ProtectionStateCommitFailoverFailedOnRecovery ProtectionState = "CommitFailoverFailedOnRecovery" + // ProtectionStateCommitFailoverInProgressOnPrimary - Commit failover is in progress on the primary side. + ProtectionStateCommitFailoverInProgressOnPrimary ProtectionState = "CommitFailoverInProgressOnPrimary" + // ProtectionStateCommitFailoverInProgressOnRecovery - Commit failover is in progress on the recovery side. + ProtectionStateCommitFailoverInProgressOnRecovery ProtectionState = "CommitFailoverInProgressOnRecovery" + // ProtectionStateCommitFailoverStatesBegin - Begin marker for commit failover states. + ProtectionStateCommitFailoverStatesBegin ProtectionState = "CommitFailoverStatesBegin" + // ProtectionStateCommitFailoverStatesEnd - End marker for commit failover states. + ProtectionStateCommitFailoverStatesEnd ProtectionState = "CommitFailoverStatesEnd" + // ProtectionStateDisablingFailed - Disable protection failed. + ProtectionStateDisablingFailed ProtectionState = "DisablingFailed" + // ProtectionStateDisablingProtection - Disabling protection is in progress. + ProtectionStateDisablingProtection ProtectionState = "DisablingProtection" + // ProtectionStateEnablingFailed - Enable protection failed. + ProtectionStateEnablingFailed ProtectionState = "EnablingFailed" + // ProtectionStateEnablingProtection - Enable protection is in progress. + ProtectionStateEnablingProtection ProtectionState = "EnablingProtection" + // ProtectionStateInitialReplicationCompletedOnPrimary - Initial replication has completed on the primary side. + ProtectionStateInitialReplicationCompletedOnPrimary ProtectionState = "InitialReplicationCompletedOnPrimary" + // ProtectionStateInitialReplicationCompletedOnRecovery - Initial replication has completed on the recovery side. + ProtectionStateInitialReplicationCompletedOnRecovery ProtectionState = "InitialReplicationCompletedOnRecovery" + // ProtectionStateInitialReplicationFailed - Initial replication failed and would need to be started again. + ProtectionStateInitialReplicationFailed ProtectionState = "InitialReplicationFailed" + // ProtectionStateInitialReplicationInProgress - Initial replication is in progress. + ProtectionStateInitialReplicationInProgress ProtectionState = "InitialReplicationInProgress" + // ProtectionStateInitialReplicationStatesBegin - Begin marker for initial replication states. + ProtectionStateInitialReplicationStatesBegin ProtectionState = "InitialReplicationStatesBegin" + // ProtectionStateInitialReplicationStatesEnd - End marker for initial replication states. + ProtectionStateInitialReplicationStatesEnd ProtectionState = "InitialReplicationStatesEnd" + // ProtectionStateMarkedForDeletion - Disabling protection succeeded. This is a transient state before the protected item + // is deleted. + ProtectionStateMarkedForDeletion ProtectionState = "MarkedForDeletion" + // ProtectionStatePlannedFailoverCompleted - Planned failover has been completed successfully. + ProtectionStatePlannedFailoverCompleted ProtectionState = "PlannedFailoverCompleted" + // ProtectionStatePlannedFailoverCompleting - Planned failover preparing protected entities is in progress. + ProtectionStatePlannedFailoverCompleting ProtectionState = "PlannedFailoverCompleting" + // ProtectionStatePlannedFailoverCompletionFailed - Planned failover preparing protected entities failed. + ProtectionStatePlannedFailoverCompletionFailed ProtectionState = "PlannedFailoverCompletionFailed" + // ProtectionStatePlannedFailoverFailed - Planned failover initiation failed. + ProtectionStatePlannedFailoverFailed ProtectionState = "PlannedFailoverFailed" + // ProtectionStatePlannedFailoverInitiated - Planned failover has been initiated. + ProtectionStatePlannedFailoverInitiated ProtectionState = "PlannedFailoverInitiated" + // ProtectionStatePlannedFailoverTransitionStatesBegin - Begin marker for planned failover transition states. + ProtectionStatePlannedFailoverTransitionStatesBegin ProtectionState = "PlannedFailoverTransitionStatesBegin" + // ProtectionStatePlannedFailoverTransitionStatesEnd - End marker for planned failover transition states. + ProtectionStatePlannedFailoverTransitionStatesEnd ProtectionState = "PlannedFailoverTransitionStatesEnd" + // ProtectionStateProtected - Protected item is protected and replication is on-going. Any issues with replication will be + // surfaced separately via the health property and will not affect the state. + ProtectionStateProtected ProtectionState = "Protected" + // ProtectionStateProtectedStatesBegin - Begin marker for protected steady-state states. + ProtectionStateProtectedStatesBegin ProtectionState = "ProtectedStatesBegin" + // ProtectionStateProtectedStatesEnd - End marker for protected steady-state states. + ProtectionStateProtectedStatesEnd ProtectionState = "ProtectedStatesEnd" + // ProtectionStateReprotectFailed - Reprotect has failed. + ProtectionStateReprotectFailed ProtectionState = "ReprotectFailed" + // ProtectionStateReprotectInitiated - Reprotect has been initiated. + ProtectionStateReprotectInitiated ProtectionState = "ReprotectInitiated" + // ProtectionStateReprotectStatesBegin - Begin marker for reprotect states. + ProtectionStateReprotectStatesBegin ProtectionState = "ReprotectStatesBegin" + // ProtectionStateReprotectStatesEnd - End marker for reprotect states. + ProtectionStateReprotectStatesEnd ProtectionState = "ReprotectStatesEnd" + // ProtectionStateUnplannedFailoverCompleted - Unplanned failover preparing protected entities is in progress. + ProtectionStateUnplannedFailoverCompleted ProtectionState = "UnplannedFailoverCompleted" + // ProtectionStateUnplannedFailoverCompleting - Unplanned failover preparing protected entities is in progress. + ProtectionStateUnplannedFailoverCompleting ProtectionState = "UnplannedFailoverCompleting" + // ProtectionStateUnplannedFailoverCompletionFailed - Unplanned failover preparing protected entities failed. + ProtectionStateUnplannedFailoverCompletionFailed ProtectionState = "UnplannedFailoverCompletionFailed" + // ProtectionStateUnplannedFailoverFailed - Unplanned failover initiation failed. + ProtectionStateUnplannedFailoverFailed ProtectionState = "UnplannedFailoverFailed" + // ProtectionStateUnplannedFailoverInitiated - Unplanned failover has been initiated. + ProtectionStateUnplannedFailoverInitiated ProtectionState = "UnplannedFailoverInitiated" + // ProtectionStateUnplannedFailoverTransitionStatesBegin - Begin marker for unplanned failover transition states. ProtectionStateUnplannedFailoverTransitionStatesBegin ProtectionState = "UnplannedFailoverTransitionStatesBegin" - ProtectionStateUnplannedFailoverTransitionStatesEnd ProtectionState = "UnplannedFailoverTransitionStatesEnd" - ProtectionStateUnprotectedStatesBegin ProtectionState = "UnprotectedStatesBegin" - ProtectionStateUnprotectedStatesEnd ProtectionState = "UnprotectedStatesEnd" + // ProtectionStateUnplannedFailoverTransitionStatesEnd - End marker for unplanned failover transition states. + ProtectionStateUnplannedFailoverTransitionStatesEnd ProtectionState = "UnplannedFailoverTransitionStatesEnd" + // ProtectionStateUnprotectedStatesBegin - Begin marker for unprotected states. + ProtectionStateUnprotectedStatesBegin ProtectionState = "UnprotectedStatesBegin" + // ProtectionStateUnprotectedStatesEnd - End marker for unprotected states. + ProtectionStateUnprotectedStatesEnd ProtectionState = "UnprotectedStatesEnd" ) // PossibleProtectionStateValues returns the possible values for the ProtectionState const type. @@ -196,17 +402,24 @@ func PossibleProtectionStateValues() []ProtectionState { } } -// ProvisioningState - Gets or sets the provisioning state of the Dra. +// ProvisioningState - Gets or sets the provisioning state of the email configuration. type ProvisioningState string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleted ProvisioningState = "Deleted" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateCanceled - Resource creation has been canceled + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating - Resource is being created. + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleted - Resource has been deleted. + ProvisioningStateDeleted ProvisioningState = "Deleted" + // ProvisioningStateDeleting - Resource is being deleted. + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded - Resource creation/update succeeded. ProvisioningStateSucceeded ProvisioningState = "Succeeded" - ProvisioningStateUpdating ProvisioningState = "Updating" + // ProvisioningStateUpdating - Resource is being updated. + ProvisioningStateUpdating ProvisioningState = "Updating" ) // PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. @@ -226,8 +439,10 @@ func PossibleProvisioningStateValues() []ProvisioningState { type RecoveryPointType string const ( + // RecoveryPointTypeApplicationConsistent - Application consistent recovery point. RecoveryPointTypeApplicationConsistent RecoveryPointType = "ApplicationConsistent" - RecoveryPointTypeCrashConsistent RecoveryPointType = "CrashConsistent" + // RecoveryPointTypeCrashConsistent - Crash consistent recovery point. + RecoveryPointTypeCrashConsistent RecoveryPointType = "CrashConsistent" ) // PossibleRecoveryPointTypeValues returns the possible values for the RecoveryPointType const type. @@ -242,8 +457,10 @@ func PossibleRecoveryPointTypeValues() []RecoveryPointType { type ReplicationVaultType string const ( + // ReplicationVaultTypeDisasterRecovery - Disaster recovery vault. ReplicationVaultTypeDisasterRecovery ReplicationVaultType = "DisasterRecovery" - ReplicationVaultTypeMigrate ReplicationVaultType = "Migrate" + // ReplicationVaultTypeMigrate - Migrate vault. + ReplicationVaultTypeMigrate ReplicationVaultType = "Migrate" ) // PossibleReplicationVaultTypeValues returns the possible values for the ReplicationVaultType const type. @@ -258,9 +475,13 @@ func PossibleReplicationVaultTypeValues() []ReplicationVaultType { type ResynchronizationState string const ( - ResynchronizationStateNone ResynchronizationState = "None" + // ResynchronizationStateNone - Resynchronization is not active. + ResynchronizationStateNone ResynchronizationState = "None" + // ResynchronizationStateResynchronizationCompleted - Resynchronization has been completed successfully. ResynchronizationStateResynchronizationCompleted ResynchronizationState = "ResynchronizationCompleted" - ResynchronizationStateResynchronizationFailed ResynchronizationState = "ResynchronizationFailed" + // ResynchronizationStateResynchronizationFailed - Resynchronization has failed and would need to be started again. + ResynchronizationStateResynchronizationFailed ResynchronizationState = "ResynchronizationFailed" + // ResynchronizationStateResynchronizationInitiated - Resynchronization has been initiated. ResynchronizationStateResynchronizationInitiated ResynchronizationState = "ResynchronizationInitiated" ) @@ -278,11 +499,17 @@ func PossibleResynchronizationStateValues() []ResynchronizationState { type TaskState string const ( + // TaskStateCancelled - Task has been cancelled. TaskStateCancelled TaskState = "Cancelled" - TaskStateFailed TaskState = "Failed" - TaskStatePending TaskState = "Pending" - TaskStateSkipped TaskState = "Skipped" - TaskStateStarted TaskState = "Started" + // TaskStateFailed - Task failed. + TaskStateFailed TaskState = "Failed" + // TaskStatePending - Task has not been started. + TaskStatePending TaskState = "Pending" + // TaskStateSkipped - Task has been skipped. + TaskStateSkipped TaskState = "Skipped" + // TaskStateStarted - Task is in progress. + TaskStateStarted TaskState = "Started" + // TaskStateSucceeded - Task has completed successfully. TaskStateSucceeded TaskState = "Succeeded" ) @@ -302,15 +529,25 @@ func PossibleTaskStateValues() []TaskState { type TestFailoverState string const ( - TestFailoverStateMarkedForDeletion TestFailoverState = "MarkedForDeletion" - TestFailoverStateNone TestFailoverState = "None" + // TestFailoverStateMarkedForDeletion - Test failover cleanup has completed/failed. This is a transient state before the state + // is moved back to None. + TestFailoverStateMarkedForDeletion TestFailoverState = "MarkedForDeletion" + // TestFailoverStateNone - Test failover is not active. + TestFailoverStateNone TestFailoverState = "None" + // TestFailoverStateTestFailoverCleanupCompleting - Cleaning up test protected entities is in progress. TestFailoverStateTestFailoverCleanupCompleting TestFailoverState = "TestFailoverCleanupCompleting" - TestFailoverStateTestFailoverCleanupInitiated TestFailoverState = "TestFailoverCleanupInitiated" - TestFailoverStateTestFailoverCompleted TestFailoverState = "TestFailoverCompleted" - TestFailoverStateTestFailoverCompleting TestFailoverState = "TestFailoverCompleting" - TestFailoverStateTestFailoverCompletionFailed TestFailoverState = "TestFailoverCompletionFailed" - TestFailoverStateTestFailoverFailed TestFailoverState = "TestFailoverFailed" - TestFailoverStateTestFailoverInitiated TestFailoverState = "TestFailoverInitiated" + // TestFailoverStateTestFailoverCleanupInitiated - Test failover cleanup has been initiated. + TestFailoverStateTestFailoverCleanupInitiated TestFailoverState = "TestFailoverCleanupInitiated" + // TestFailoverStateTestFailoverCompleted - Test failover has been completed successfully. + TestFailoverStateTestFailoverCompleted TestFailoverState = "TestFailoverCompleted" + // TestFailoverStateTestFailoverCompleting - Preparing test protected entities is in progress. + TestFailoverStateTestFailoverCompleting TestFailoverState = "TestFailoverCompleting" + // TestFailoverStateTestFailoverCompletionFailed - Preparing test protected entities failed. + TestFailoverStateTestFailoverCompletionFailed TestFailoverState = "TestFailoverCompletionFailed" + // TestFailoverStateTestFailoverFailed - Test failover initiation failed.. + TestFailoverStateTestFailoverFailed TestFailoverState = "TestFailoverFailed" + // TestFailoverStateTestFailoverInitiated - Test failover has been initiated. + TestFailoverStateTestFailoverInitiated TestFailoverState = "TestFailoverInitiated" ) // PossibleTestFailoverStateValues returns the possible values for the TestFailoverState const type. @@ -332,9 +569,15 @@ func PossibleTestFailoverStateValues() []TestFailoverState { type VMNicSelection string const ( - VMNicSelectionNotSelected VMNicSelection = "NotSelected" - VMNicSelectionSelectedByDefault VMNicSelection = "SelectedByDefault" - VMNicSelectionSelectedByUser VMNicSelection = "SelectedByUser" + // VMNicSelectionNotSelected - Not Selected. + VMNicSelectionNotSelected VMNicSelection = "NotSelected" + // VMNicSelectionSelectedByDefault - Default selection by ASR. + VMNicSelectionSelectedByDefault VMNicSelection = "SelectedByDefault" + // VMNicSelectionSelectedByUser - Selected by user. + VMNicSelectionSelectedByUser VMNicSelection = "SelectedByUser" + // VMNicSelectionSelectedByUserOverride - NIC configuration overridden by user. Differs from SelectedByUser in the sense that + // the legacy SelectedByUser is used both for explicit modification by user and implicit approval of user if the settings + // are used for TFO/FO. SelectedByUserOverride implies user overriding at least one of the configurations. VMNicSelectionSelectedByUserOverride VMNicSelection = "SelectedByUserOverride" ) @@ -352,9 +595,12 @@ func PossibleVMNicSelectionValues() []VMNicSelection { type VMwareToAzureMigrateResyncState string const ( - VMwareToAzureMigrateResyncStateNone VMwareToAzureMigrateResyncState = "None" + // VMwareToAzureMigrateResyncStateNone - None state. + VMwareToAzureMigrateResyncStateNone VMwareToAzureMigrateResyncState = "None" + // VMwareToAzureMigrateResyncStatePreparedForResynchronization - Prepared for resynchronization state. VMwareToAzureMigrateResyncStatePreparedForResynchronization VMwareToAzureMigrateResyncState = "PreparedForResynchronization" - VMwareToAzureMigrateResyncStateStartedResynchronization VMwareToAzureMigrateResyncState = "StartedResynchronization" + // VMwareToAzureMigrateResyncStateStartedResynchronization - Started resynchronization state. + VMwareToAzureMigrateResyncStateStartedResynchronization VMwareToAzureMigrateResyncState = "StartedResynchronization" ) // PossibleVMwareToAzureMigrateResyncStateValues returns the possible values for the VMwareToAzureMigrateResyncState const type. @@ -366,60 +612,23 @@ func PossibleVMwareToAzureMigrateResyncStateValues() []VMwareToAzureMigrateResyn } } -// WorkflowObjectType - Gets or sets the object type. -type WorkflowObjectType string - -const ( - WorkflowObjectTypeAvsDiskPool WorkflowObjectType = "AvsDiskPool" - WorkflowObjectTypeDra WorkflowObjectType = "Dra" - WorkflowObjectTypeFabric WorkflowObjectType = "Fabric" - WorkflowObjectTypePolicy WorkflowObjectType = "Policy" - WorkflowObjectTypeProtectedItem WorkflowObjectType = "ProtectedItem" - WorkflowObjectTypeRecoveryPlan WorkflowObjectType = "RecoveryPlan" - WorkflowObjectTypeReplicationExtension WorkflowObjectType = "ReplicationExtension" - WorkflowObjectTypeVault WorkflowObjectType = "Vault" -) - -// PossibleWorkflowObjectTypeValues returns the possible values for the WorkflowObjectType const type. -func PossibleWorkflowObjectTypeValues() []WorkflowObjectType { - return []WorkflowObjectType{ - WorkflowObjectTypeAvsDiskPool, - WorkflowObjectTypeDra, - WorkflowObjectTypeFabric, - WorkflowObjectTypePolicy, - WorkflowObjectTypeProtectedItem, - WorkflowObjectTypeRecoveryPlan, - WorkflowObjectTypeReplicationExtension, - WorkflowObjectTypeVault, - } -} - -// WorkflowState - Gets or sets the workflow state. -type WorkflowState string +// VaultIdentityType - Gets or sets the identityType which can be either SystemAssigned or None. +type VaultIdentityType string const ( - WorkflowStateCancelled WorkflowState = "Cancelled" - WorkflowStateCancelling WorkflowState = "Cancelling" - WorkflowStateCompletedWithErrors WorkflowState = "CompletedWithErrors" - WorkflowStateCompletedWithInformation WorkflowState = "CompletedWithInformation" - WorkflowStateCompletedWithWarnings WorkflowState = "CompletedWithWarnings" - WorkflowStateFailed WorkflowState = "Failed" - WorkflowStatePending WorkflowState = "Pending" - WorkflowStateStarted WorkflowState = "Started" - WorkflowStateSucceeded WorkflowState = "Succeeded" + // VaultIdentityTypeNone - No identity. + VaultIdentityTypeNone VaultIdentityType = "None" + // VaultIdentityTypeSystemAssigned - System assigned identity. + VaultIdentityTypeSystemAssigned VaultIdentityType = "SystemAssigned" + // VaultIdentityTypeUserAssigned - User assigned identity. + VaultIdentityTypeUserAssigned VaultIdentityType = "UserAssigned" ) -// PossibleWorkflowStateValues returns the possible values for the WorkflowState const type. -func PossibleWorkflowStateValues() []WorkflowState { - return []WorkflowState{ - WorkflowStateCancelled, - WorkflowStateCancelling, - WorkflowStateCompletedWithErrors, - WorkflowStateCompletedWithInformation, - WorkflowStateCompletedWithWarnings, - WorkflowStateFailed, - WorkflowStatePending, - WorkflowStateStarted, - WorkflowStateSucceeded, +// PossibleVaultIdentityTypeValues returns the possible values for the VaultIdentityType const type. +func PossibleVaultIdentityTypeValues() []VaultIdentityType { + return []VaultIdentityType{ + VaultIdentityTypeNone, + VaultIdentityTypeSystemAssigned, + VaultIdentityTypeUserAssigned, } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/deploymentpreflight_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/deploymentpreflight_client.go new file mode 100644 index 000000000000..f6c80f1b24fd --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/deploymentpreflight_client.go @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armrecoveryservicesdatareplication + +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" +) + +// DeploymentPreflightClient contains the methods for the DeploymentPreflight group. +// Don't use this type directly, use NewDeploymentPreflightClient() instead. +type DeploymentPreflightClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDeploymentPreflightClient creates a new instance of DeploymentPreflightClient 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 NewDeploymentPreflightClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeploymentPreflightClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DeploymentPreflightClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Post - Performs resource deployment validation. +// +// Performs resource deployment preflight validation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - deploymentID - Deployment Id. +// - options - DeploymentPreflightClientPostOptions contains the optional parameters for the DeploymentPreflightClient.Post +// method. +func (client *DeploymentPreflightClient) Post(ctx context.Context, resourceGroupName string, deploymentID string, options *DeploymentPreflightClientPostOptions) (DeploymentPreflightClientPostResponse, error) { + var err error + const operationName = "DeploymentPreflightClient.Post" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.postCreateRequest(ctx, resourceGroupName, deploymentID, options) + if err != nil { + return DeploymentPreflightClientPostResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentPreflightClientPostResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentPreflightClientPostResponse{}, err + } + resp, err := client.postHandleResponse(httpResp) + return resp, err +} + +// postCreateRequest creates the Post request. +func (client *DeploymentPreflightClient) postCreateRequest(ctx context.Context, resourceGroupName string, deploymentID string, options *DeploymentPreflightClientPostOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/deployments/{deploymentId}/preflight" + 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 deploymentID == "" { + return nil, errors.New("parameter deploymentID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentId}", url.PathEscape(deploymentID)) + 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-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Body != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// postHandleResponse handles the Post response. +func (client *DeploymentPreflightClient) postHandleResponse(resp *http.Response) (DeploymentPreflightClientPostResponse, error) { + result := DeploymentPreflightClientPostResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentPreflightModel); err != nil { + return DeploymentPreflightClientPostResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/deploymentpreflight_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/deploymentpreflight_client_example_test.go new file mode 100644 index 000000000000..57a7be470294 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/deploymentpreflight_client_example_test.go @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" +) + +// Generated from example definition: 2024-09-01/DeploymentPreflight_Post.json +func ExampleDeploymentPreflightClient_Post() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewDeploymentPreflightClient().Post(ctx, "rgswagger_2024-09-01", "lnfcwsmlowbwkndkztzvaj", &DeploymentPreflightClientPostOptions{ + body: &armrecoveryservicesdatareplication.DeploymentPreflightModel{ + Resources: []*armrecoveryservicesdatareplication.DeploymentPreflightResource{ + { + Name: to.Ptr("xtgugoflfc"), + Type: to.Ptr("nsnaptduolqcxsikrewvgjbxqpt"), + Location: to.Ptr("cbsgtxkjdzwbyp"), + APIVersion: to.Ptr("otihymhvzblycdoxo"), + }, + }, + }}) + 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 = armrecoveryservicesdatareplication.DeploymentPreflightClientPostResponse{ + // DeploymentPreflightModel: &armrecoveryservicesdatareplication.DeploymentPreflightModel{ + // Resources: []*armrecoveryservicesdatareplication.DeploymentPreflightResource{ + // { + // Name: to.Ptr("xtgugoflfc"), + // Type: to.Ptr("nsnaptduolqcxsikrewvgjbxqpt"), + // Location: to.Ptr("cbsgtxkjdzwbyp"), + // APIVersion: to.Ptr("otihymhvzblycdoxo"), + // }, + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/draoperationstatus_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/draoperationstatus_client.go deleted file mode 100644 index 781754ee35fa..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/draoperationstatus_client.go +++ /dev/null @@ -1,118 +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 armrecoveryservicesdatareplication - -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" -) - -// DraOperationStatusClient contains the methods for the DraOperationStatus group. -// Don't use this type directly, use NewDraOperationStatusClient() instead. -type DraOperationStatusClient struct { - internal *arm.Client - subscriptionID string -} - -// NewDraOperationStatusClient creates a new instance of DraOperationStatusClient 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 NewDraOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DraOperationStatusClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &DraOperationStatusClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Tracks the results of an asynchronous operation on the fabric agent. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-02-16-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - fabricName - The fabric name. -// - fabricAgentName - The fabric agent (Dra) name. -// - operationID - The ID of an ongoing async operation. -// - options - DraOperationStatusClientGetOptions contains the optional parameters for the DraOperationStatusClient.Get method. -func (client *DraOperationStatusClient) Get(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, operationID string, options *DraOperationStatusClientGetOptions) (DraOperationStatusClientGetResponse, error) { - var err error - const operationName = "DraOperationStatusClient.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, fabricName, fabricAgentName, operationID, options) - if err != nil { - return DraOperationStatusClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DraOperationStatusClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DraOperationStatusClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *DraOperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, operationID string, options *DraOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}/operations/{operationId}" - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if fabricAgentName == "" { - return nil, errors.New("parameter fabricAgentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricAgentName}", url.PathEscape(fabricAgentName)) - if operationID == "" { - return nil, errors.New("parameter operationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - 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", "2021-02-16-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *DraOperationStatusClient) getHandleResponse(resp *http.Response) (DraOperationStatusClientGetResponse, error) { - result := DraOperationStatusClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return DraOperationStatusClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_client.go index 29623e9817c0..9ab3ce4e4563 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_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 armrecoveryservicesdatareplication @@ -46,20 +42,20 @@ func NewEmailConfigurationClient(subscriptionID string, credential azcore.TokenC // Create - Creates an alert configuration setting for the given vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - emailConfigurationName - The email configuration name. -// - body - EmailConfiguration model. +// - resource - EmailConfiguration model. // - options - EmailConfigurationClientCreateOptions contains the optional parameters for the EmailConfigurationClient.Create // method. -func (client *EmailConfigurationClient) Create(ctx context.Context, resourceGroupName string, vaultName string, emailConfigurationName string, body EmailConfigurationModel, options *EmailConfigurationClientCreateOptions) (EmailConfigurationClientCreateResponse, error) { +func (client *EmailConfigurationClient) Create(ctx context.Context, resourceGroupName string, vaultName string, emailConfigurationName string, resource EmailConfigurationModel, options *EmailConfigurationClientCreateOptions) (EmailConfigurationClientCreateResponse, error) { var err error const operationName = "EmailConfigurationClient.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, vaultName, emailConfigurationName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, vaultName, emailConfigurationName, resource, options) if err != nil { return EmailConfigurationClientCreateResponse{}, err } @@ -76,7 +72,7 @@ func (client *EmailConfigurationClient) Create(ctx context.Context, resourceGrou } // createCreateRequest creates the Create request. -func (client *EmailConfigurationClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, emailConfigurationName string, body EmailConfigurationModel, options *EmailConfigurationClientCreateOptions) (*policy.Request, error) { +func (client *EmailConfigurationClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, emailConfigurationName string, resource EmailConfigurationModel, _ *EmailConfigurationClientCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -99,10 +95,11 @@ func (client *EmailConfigurationClient) createCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil @@ -120,7 +117,7 @@ func (client *EmailConfigurationClient) createHandleResponse(resp *http.Response // Get - Gets the details of the alert configuration setting. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - emailConfigurationName - The email configuration name. @@ -148,7 +145,7 @@ func (client *EmailConfigurationClient) Get(ctx context.Context, resourceGroupNa } // getCreateRequest creates the Get request. -func (client *EmailConfigurationClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, emailConfigurationName string, options *EmailConfigurationClientGetOptions) (*policy.Request, error) { +func (client *EmailConfigurationClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, emailConfigurationName string, _ *EmailConfigurationClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -171,7 +168,7 @@ func (client *EmailConfigurationClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,7 +185,7 @@ func (client *EmailConfigurationClient) getHandleResponse(resp *http.Response) ( // NewListPager - Gets the list of alert configuration settings for the given vault. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - options - EmailConfigurationClientListOptions contains the optional parameters for the EmailConfigurationClient.NewListPager @@ -217,7 +214,7 @@ func (client *EmailConfigurationClient) NewListPager(resourceGroupName string, v } // listCreateRequest creates the List request. -func (client *EmailConfigurationClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *EmailConfigurationClientListOptions) (*policy.Request, error) { +func (client *EmailConfigurationClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *EmailConfigurationClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -236,7 +233,7 @@ func (client *EmailConfigurationClient) listCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -245,7 +242,7 @@ func (client *EmailConfigurationClient) listCreateRequest(ctx context.Context, r // listHandleResponse handles the List response. func (client *EmailConfigurationClient) listHandleResponse(resp *http.Response) (EmailConfigurationClientListResponse, error) { result := EmailConfigurationClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EmailConfigurationModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.EmailConfigurationModelListResult); err != nil { return EmailConfigurationClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_client_example_test.go index 5b8a05f0d56a..a6b0c61f8774 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_client_example_test.go @@ -1,120 +1,123 @@ -//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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/EmailConfiguration_Get.json -func ExampleEmailConfigurationClient_Get() { +// Generated from example definition: 2024-09-01/EmailConfiguration_Create.json +func ExampleEmailConfigurationClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEmailConfigurationClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "0", nil) + res, err := clientFactory.NewEmailConfigurationClient().Create(ctx, "rgswagger_2024-09-01", "4", "0", armrecoveryservicesdatareplication.EmailConfigurationModel{ + Properties: &armrecoveryservicesdatareplication.EmailConfigurationModelProperties{ + SendToOwners: to.Ptr(true), + CustomEmailAddresses: []*string{ + to.Ptr("ketvbducyailcny"), + }, + Locale: to.Ptr("vpnjxjvdqtebnucyxiyrjiko"), + }, + }, 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.EmailConfigurationModel = armrecoveryservicesdatareplication.EmailConfigurationModel{ - // Name: to.Ptr("ywjplnjzaeu"), - // Type: to.Ptr("bkaq"), - // ID: to.Ptr("bvbfy"), - // Properties: &armrecoveryservicesdatareplication.EmailConfigurationModelProperties{ - // CustomEmailAddresses: []*string{ - // to.Ptr("ketvbducyailcny")}, - // Locale: to.Ptr("vpnjxjvdqtebnucyxiyrjiko"), + // res = armrecoveryservicesdatareplication.EmailConfigurationClientCreateResponse{ + // EmailConfigurationModel: &armrecoveryservicesdatareplication.EmailConfigurationModel{ + // Properties: &armrecoveryservicesdatareplication.EmailConfigurationModelProperties{ // SendToOwners: to.Ptr(true), + // CustomEmailAddresses: []*string{ + // to.Ptr("ketvbducyailcny"), + // }, + // Locale: to.Ptr("vpnjxjvdqtebnucyxiyrjiko"), + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), // }, - // SystemData: &armrecoveryservicesdatareplication.EmailConfigurationModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/alertSettings/emailConfiguration1"), + // Name: to.Ptr("ywjplnjzaeu"), + // Type: to.Ptr("bkaq"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("ewufpudzcjrljhmmzhfnxoqdqwnya"), - // CreatedByType: to.Ptr("zioqm"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("zioqm")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), // LastModifiedBy: to.Ptr("rx"), - // LastModifiedByType: to.Ptr("tqbvuqoakaaqij"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("tqbvuqoakaaqij")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), // }, - // } + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/EmailConfiguration_Create.json -func ExampleEmailConfigurationClient_Create() { +// Generated from example definition: 2024-09-01/EmailConfiguration_Get.json +func ExampleEmailConfigurationClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEmailConfigurationClient().Create(ctx, "rgrecoveryservicesdatareplication", "4", "0", armrecoveryservicesdatareplication.EmailConfigurationModel{ - Properties: &armrecoveryservicesdatareplication.EmailConfigurationModelProperties{ - CustomEmailAddresses: []*string{ - to.Ptr("ketvbducyailcny")}, - Locale: to.Ptr("vpnjxjvdqtebnucyxiyrjiko"), - SendToOwners: to.Ptr(true), - }, - }, nil) + res, err := clientFactory.NewEmailConfigurationClient().Get(ctx, "rgswagger_2024-09-01", "4", "0", 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.EmailConfigurationModel = armrecoveryservicesdatareplication.EmailConfigurationModel{ - // Name: to.Ptr("ywjplnjzaeu"), - // Type: to.Ptr("bkaq"), - // ID: to.Ptr("bvbfy"), - // Properties: &armrecoveryservicesdatareplication.EmailConfigurationModelProperties{ - // CustomEmailAddresses: []*string{ - // to.Ptr("ketvbducyailcny")}, - // Locale: to.Ptr("vpnjxjvdqtebnucyxiyrjiko"), + // res = armrecoveryservicesdatareplication.EmailConfigurationClientGetResponse{ + // EmailConfigurationModel: &armrecoveryservicesdatareplication.EmailConfigurationModel{ + // Properties: &armrecoveryservicesdatareplication.EmailConfigurationModelProperties{ // SendToOwners: to.Ptr(true), + // CustomEmailAddresses: []*string{ + // to.Ptr("ketvbducyailcny"), + // }, + // Locale: to.Ptr("vpnjxjvdqtebnucyxiyrjiko"), + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), // }, - // SystemData: &armrecoveryservicesdatareplication.EmailConfigurationModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/alertSettings/emailConfiguration1"), + // Name: to.Ptr("ywjplnjzaeu"), + // Type: to.Ptr("bkaq"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("ewufpudzcjrljhmmzhfnxoqdqwnya"), - // CreatedByType: to.Ptr("zioqm"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("zioqm")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), // LastModifiedBy: to.Ptr("rx"), - // LastModifiedByType: to.Ptr("tqbvuqoakaaqij"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("tqbvuqoakaaqij")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), // }, - // } + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/EmailConfiguration_List.json +// Generated from example definition: 2024-09-01/EmailConfiguration_List.json func ExampleEmailConfigurationClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewEmailConfigurationClient().NewListPager("rgrecoveryservicesdatareplication", "4", nil) + pager := clientFactory.NewEmailConfigurationClient().NewListPager("rgswagger_2024-09-01", "4", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -125,27 +128,32 @@ func ExampleEmailConfigurationClient_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.EmailConfigurationModelCollection = armrecoveryservicesdatareplication.EmailConfigurationModelCollection{ - // Value: []*armrecoveryservicesdatareplication.EmailConfigurationModel{ - // { - // Name: to.Ptr("ywjplnjzaeu"), - // Type: to.Ptr("bkaq"), - // ID: to.Ptr("bvbfy"), - // Properties: &armrecoveryservicesdatareplication.EmailConfigurationModelProperties{ - // CustomEmailAddresses: []*string{ - // to.Ptr("ketvbducyailcny")}, - // Locale: to.Ptr("vpnjxjvdqtebnucyxiyrjiko"), + // page = armrecoveryservicesdatareplication.EmailConfigurationClientListResponse{ + // EmailConfigurationModelListResult: armrecoveryservicesdatareplication.EmailConfigurationModelListResult{ + // Value: []*armrecoveryservicesdatareplication.EmailConfigurationModel{ + // { + // Properties: &armrecoveryservicesdatareplication.EmailConfigurationModelProperties{ // SendToOwners: to.Ptr(true), + // CustomEmailAddresses: []*string{ + // to.Ptr("ketvbducyailcny"), + // }, + // Locale: to.Ptr("vpnjxjvdqtebnucyxiyrjiko"), + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), // }, - // SystemData: &armrecoveryservicesdatareplication.EmailConfigurationModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/alertSettings/emailConfiguration1"), + // Name: to.Ptr("ywjplnjzaeu"), + // Type: to.Ptr("bkaq"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("ewufpudzcjrljhmmzhfnxoqdqwnya"), - // CreatedByType: to.Ptr("zioqm"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("zioqm")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), // LastModifiedBy: to.Ptr("rx"), - // LastModifiedByType: to.Ptr("tqbvuqoakaaqij"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("tqbvuqoakaaqij")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), // }, - // }}, - // } + // }, + // }, + // }, + // } } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_client.go index 2e4d0ede5400..b2ddcfdd3684 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_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 armrecoveryservicesdatareplication @@ -17,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" + "strconv" "strings" ) @@ -46,7 +43,7 @@ func NewEventClient(subscriptionID string, credential azcore.TokenCredential, op // Get - Gets the details of the event. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - eventName - The event name. @@ -74,7 +71,7 @@ func (client *EventClient) Get(ctx context.Context, resourceGroupName string, va } // getCreateRequest creates the Get request. -func (client *EventClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, eventName string, options *EventClientGetOptions) (*policy.Request, error) { +func (client *EventClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, eventName string, _ *EventClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events/{eventName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -97,7 +94,7 @@ func (client *EventClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -114,7 +111,7 @@ func (client *EventClient) getHandleResponse(resp *http.Response) (EventClientGe // NewListPager - Gets the list of events in the given vault. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - options - EventClientListOptions contains the optional parameters for the EventClient.NewListPager method. @@ -161,13 +158,16 @@ func (client *EventClient) listCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } + reqQP.Set("api-version", "2024-09-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } - reqQP.Set("api-version", "2021-02-16-preview") + if options != nil && options.OdataOptions != nil { + reqQP.Set("odataOptions", *options.OdataOptions) + } + if options != nil && options.PageSize != nil { + reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -176,7 +176,7 @@ func (client *EventClient) listCreateRequest(ctx context.Context, resourceGroupN // listHandleResponse handles the List response. func (client *EventClient) listHandleResponse(resp *http.Response) (EventClientListResponse, error) { result := EventClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EventModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.EventModelListResult); err != nil { return EventClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_client_example_test.go index 27712dbc1d58..15cf58d53675 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_client_example_test.go @@ -1,114 +1,110 @@ -//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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Event_Get.json +// Generated from example definition: 2024-09-01/Event_Get.json func ExampleEventClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEventClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "231CIG", nil) + res, err := clientFactory.NewEventClient().Get(ctx, "rgswagger_2024-09-01", "4", "231CIG", 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.EventModel = armrecoveryservicesdatareplication.EventModel{ - // Name: to.Ptr("j"), - // Type: to.Ptr("lgk"), - // ID: to.Ptr("fgbppsytxctsrsxlfugyohhu"), - // Properties: &armrecoveryservicesdatareplication.EventModelProperties{ - // Description: to.Ptr("hkeiogebluvfpdgxogwesjmtbbok"), - // CorrelationID: to.Ptr("lwfsxforxnhvpmheujutjicflmxv"), - // CustomProperties: &armrecoveryservicesdatareplication.EventModelCustomProperties{ - // InstanceType: to.Ptr("EventModelCustomProperties"), - // }, - // EventName: to.Ptr("s"), - // EventType: to.Ptr("npumqmvspm"), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, + // res = armrecoveryservicesdatareplication.EventClientGetResponse{ + // EventModel: &armrecoveryservicesdatareplication.EventModel{ + // Properties: &armrecoveryservicesdatareplication.EventModelProperties{ + // ResourceType: to.Ptr("surgdzezskgregozynvlinfutyh"), + // ResourceName: to.Ptr("yhpkowkbvtqnbiklnjzc"), + // EventType: to.Ptr("npumqmvspm"), + // EventName: to.Ptr("s"), + // TimeOfOccurrence: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), + // Severity: to.Ptr("sjous"), + // CorrelationID: to.Ptr("lwfsxforxnhvpmheujutjicflmxv"), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // Category: to.Ptr("lcsdxrqxquke"), // Severity: to.Ptr("wqxxiuaqjyagq"), // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("djsmgrltruljo"), - // }}, + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // Category: to.Ptr("leigw"), // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // ResourceName: to.Ptr("yhpkowkbvtqnbiklnjzc"), - // ResourceType: to.Ptr("surgdzezskgregozynvlinfutyh"), - // Severity: to.Ptr("sjous"), - // TimeOfOccurrence: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, + // }, + // Description: to.Ptr("kwjzliiqagudb"), + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), // }, - // SystemData: &armrecoveryservicesdatareplication.EventModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/events/event1"), + // Name: to.Ptr("j"), + // Type: to.Ptr("lgk"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("uske"), - // CreatedByType: to.Ptr("luzowppyxjalugkef"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("luzowppyxjalugkef")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), // LastModifiedBy: to.Ptr("ufrixpmhben"), - // LastModifiedByType: to.Ptr("aubgraubkuaeipwzvbcgnlpseobx"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("aubgraubkuaeipwzvbcgnlpseobx")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), // }, - // } + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Event_List.json +// Generated from example definition: 2024-09-01/Event_List.json func ExampleEventClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewEventClient().NewListPager("rgrecoveryservicesdatareplication", "4", &armrecoveryservicesdatareplication.EventClientListOptions{Filter: to.Ptr("wbglupjzvkirtgnnyasxom"), - ContinuationToken: to.Ptr("cxtufi"), - }) + pager := clientFactory.NewEventClient().NewListPager("rgswagger_2024-09-01", "4", &EventClientListOptions{ + continuationToken: to.Ptr("gabpzsxrifposvleqqcjnvofz")}) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -119,65 +115,69 @@ func ExampleEventClient_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.EventModelCollection = armrecoveryservicesdatareplication.EventModelCollection{ - // Value: []*armrecoveryservicesdatareplication.EventModel{ - // { - // Name: to.Ptr("j"), - // Type: to.Ptr("lgk"), - // ID: to.Ptr("fgbppsytxctsrsxlfugyohhu"), - // Properties: &armrecoveryservicesdatareplication.EventModelProperties{ - // Description: to.Ptr("hkeiogebluvfpdgxogwesjmtbbok"), - // CorrelationID: to.Ptr("lwfsxforxnhvpmheujutjicflmxv"), - // CustomProperties: &armrecoveryservicesdatareplication.EventModelCustomProperties{ - // InstanceType: to.Ptr("EventModelCustomProperties"), - // }, - // EventName: to.Ptr("s"), - // EventType: to.Ptr("npumqmvspm"), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, + // page = armrecoveryservicesdatareplication.EventClientListResponse{ + // EventModelListResult: armrecoveryservicesdatareplication.EventModelListResult{ + // Value: []*armrecoveryservicesdatareplication.EventModel{ + // { + // Properties: &armrecoveryservicesdatareplication.EventModelProperties{ + // ResourceType: to.Ptr("surgdzezskgregozynvlinfutyh"), + // ResourceName: to.Ptr("yhpkowkbvtqnbiklnjzc"), + // EventType: to.Ptr("npumqmvspm"), + // EventName: to.Ptr("s"), + // TimeOfOccurrence: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), + // Severity: to.Ptr("sjous"), + // CorrelationID: to.Ptr("lwfsxforxnhvpmheujutjicflmxv"), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // Category: to.Ptr("lcsdxrqxquke"), // Severity: to.Ptr("wqxxiuaqjyagq"), // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("djsmgrltruljo"), - // }}, + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // Category: to.Ptr("leigw"), // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // ResourceName: to.Ptr("yhpkowkbvtqnbiklnjzc"), - // ResourceType: to.Ptr("surgdzezskgregozynvlinfutyh"), - // Severity: to.Ptr("sjous"), - // TimeOfOccurrence: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, + // }, + // Description: to.Ptr("dk"), + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), // }, - // SystemData: &armrecoveryservicesdatareplication.EventModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/events/event1"), + // Name: to.Ptr("j"), + // Type: to.Ptr("lgk"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("uske"), - // CreatedByType: to.Ptr("luzowppyxjalugkef"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("luzowppyxjalugkef")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), // LastModifiedBy: to.Ptr("ufrixpmhben"), - // LastModifiedByType: to.Ptr("aubgraubkuaeipwzvbcgnlpseobx"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("aubgraubkuaeipwzvbcgnlpseobx")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), // }, - // }}, - // } + // }, + // }, + // }, + // } } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_client.go index 26f1dd118309..9141c891f1d5 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_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 armrecoveryservicesdatareplication @@ -46,20 +42,19 @@ func NewFabricClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreate - Creates the fabric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. -// - body - Fabric properties. +// - resource - Fabric properties. // - options - FabricClientBeginCreateOptions contains the optional parameters for the FabricClient.BeginCreate method. -func (client *FabricClient) BeginCreate(ctx context.Context, resourceGroupName string, fabricName string, body FabricModel, options *FabricClientBeginCreateOptions) (*runtime.Poller[FabricClientCreateResponse], error) { +func (client *FabricClient) BeginCreate(ctx context.Context, resourceGroupName string, fabricName string, resource FabricModel, options *FabricClientBeginCreateOptions) (*runtime.Poller[FabricClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, fabricName, body, options) + resp, err := client.create(ctx, resourceGroupName, fabricName, resource, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FabricClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -72,14 +67,14 @@ func (client *FabricClient) BeginCreate(ctx context.Context, resourceGroupName s // Create - Creates the fabric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *FabricClient) create(ctx context.Context, resourceGroupName string, fabricName string, body FabricModel, options *FabricClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *FabricClient) create(ctx context.Context, resourceGroupName string, fabricName string, resource FabricModel, options *FabricClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "FabricClient.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, fabricName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, fabricName, resource, options) if err != nil { return nil, err } @@ -95,7 +90,7 @@ func (client *FabricClient) create(ctx context.Context, resourceGroupName string } // createCreateRequest creates the Create request. -func (client *FabricClient) createCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, body FabricModel, options *FabricClientBeginCreateOptions) (*policy.Request, error) { +func (client *FabricClient) createCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, resource FabricModel, _ *FabricClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -114,10 +109,11 @@ func (client *FabricClient) createCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil @@ -126,7 +122,7 @@ func (client *FabricClient) createCreateRequest(ctx context.Context, resourceGro // BeginDelete - Removes the fabric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. // - options - FabricClientBeginDeleteOptions contains the optional parameters for the FabricClient.BeginDelete method. @@ -137,8 +133,7 @@ func (client *FabricClient) BeginDelete(ctx context.Context, resourceGroupName s return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FabricClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -151,7 +146,7 @@ func (client *FabricClient) BeginDelete(ctx context.Context, resourceGroupName s // Delete - Removes the fabric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *FabricClient) deleteOperation(ctx context.Context, resourceGroupName string, fabricName string, options *FabricClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "FabricClient.BeginDelete" @@ -174,7 +169,7 @@ func (client *FabricClient) deleteOperation(ctx context.Context, resourceGroupNa } // deleteCreateRequest creates the Delete request. -func (client *FabricClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, options *FabricClientBeginDeleteOptions) (*policy.Request, error) { +func (client *FabricClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, _ *FabricClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -193,7 +188,7 @@ func (client *FabricClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +197,7 @@ func (client *FabricClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Gets the details of the fabric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. // - options - FabricClientGetOptions contains the optional parameters for the FabricClient.Get method. @@ -229,7 +224,7 @@ func (client *FabricClient) Get(ctx context.Context, resourceGroupName string, f } // getCreateRequest creates the Get request. -func (client *FabricClient) getCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, options *FabricClientGetOptions) (*policy.Request, error) { +func (client *FabricClient) getCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, _ *FabricClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -248,7 +243,7 @@ func (client *FabricClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +260,7 @@ func (client *FabricClient) getHandleResponse(resp *http.Response) (FabricClient // NewListPager - Gets the list of fabrics in the given subscription and resource group. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - FabricClientListOptions contains the optional parameters for the FabricClient.NewListPager method. func (client *FabricClient) NewListPager(resourceGroupName string, options *FabricClientListOptions) *runtime.Pager[FabricClientListResponse] { @@ -307,10 +302,10 @@ func (client *FabricClient) listCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } - reqQP.Set("api-version", "2021-02-16-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -319,7 +314,7 @@ func (client *FabricClient) listCreateRequest(ctx context.Context, resourceGroup // listHandleResponse handles the List response. func (client *FabricClient) listHandleResponse(resp *http.Response) (FabricClientListResponse, error) { result := FabricClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.FabricModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.FabricModelListResult); err != nil { return FabricClientListResponse{}, err } return result, nil @@ -327,7 +322,7 @@ func (client *FabricClient) listHandleResponse(resp *http.Response) (FabricClien // NewListBySubscriptionPager - Gets the list of fabrics in the given subscription. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - options - FabricClientListBySubscriptionOptions contains the optional parameters for the FabricClient.NewListBySubscriptionPager // method. func (client *FabricClient) NewListBySubscriptionPager(options *FabricClientListBySubscriptionOptions) *runtime.Pager[FabricClientListBySubscriptionResponse] { @@ -354,7 +349,7 @@ func (client *FabricClient) NewListBySubscriptionPager(options *FabricClientList } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *FabricClient) listBySubscriptionCreateRequest(ctx context.Context, options *FabricClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *FabricClient) listBySubscriptionCreateRequest(ctx context.Context, _ *FabricClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationFabrics" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -365,10 +360,7 @@ func (client *FabricClient) listBySubscriptionCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - if options != nil && options.ContinuationToken != nil { - reqQP.Set("continuationToken", *options.ContinuationToken) - } - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -377,7 +369,7 @@ func (client *FabricClient) listBySubscriptionCreateRequest(ctx context.Context, // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *FabricClient) listBySubscriptionHandleResponse(resp *http.Response) (FabricClientListBySubscriptionResponse, error) { result := FabricClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.FabricModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.FabricModelListResult); err != nil { return FabricClientListBySubscriptionResponse{}, err } return result, nil @@ -386,20 +378,19 @@ func (client *FabricClient) listBySubscriptionHandleResponse(resp *http.Response // BeginUpdate - Performs update on the fabric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. -// - body - Fabric properties. +// - properties - Fabric properties. // - options - FabricClientBeginUpdateOptions contains the optional parameters for the FabricClient.BeginUpdate method. -func (client *FabricClient) BeginUpdate(ctx context.Context, resourceGroupName string, fabricName string, body FabricModelUpdate, options *FabricClientBeginUpdateOptions) (*runtime.Poller[FabricClientUpdateResponse], error) { +func (client *FabricClient) BeginUpdate(ctx context.Context, resourceGroupName string, fabricName string, properties FabricModelUpdate, options *FabricClientBeginUpdateOptions) (*runtime.Poller[FabricClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, fabricName, body, options) + resp, err := client.update(ctx, resourceGroupName, fabricName, properties, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FabricClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -412,14 +403,14 @@ func (client *FabricClient) BeginUpdate(ctx context.Context, resourceGroupName s // Update - Performs update on the fabric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *FabricClient) update(ctx context.Context, resourceGroupName string, fabricName string, body FabricModelUpdate, options *FabricClientBeginUpdateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *FabricClient) update(ctx context.Context, resourceGroupName string, fabricName string, properties FabricModelUpdate, options *FabricClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "FabricClient.BeginUpdate" 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, fabricName, body, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, fabricName, properties, options) if err != nil { return nil, err } @@ -435,7 +426,7 @@ func (client *FabricClient) update(ctx context.Context, resourceGroupName string } // updateCreateRequest creates the Update request. -func (client *FabricClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, body FabricModelUpdate, options *FabricClientBeginUpdateOptions) (*policy.Request, error) { +func (client *FabricClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, properties FabricModelUpdate, _ *FabricClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -454,10 +445,11 @@ func (client *FabricClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } return req, nil diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_client_example_test.go index def3033daaf4..aa2899a31100 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_client_example_test.go @@ -1,314 +1,215 @@ -//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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Get.json -func ExampleFabricClient_Get() { +// Generated from example definition: 2024-09-01/Fabric_Create.json +func ExampleFabricClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewFabricClient().Get(ctx, "rgrecoveryservicesdatareplication", "wPR", nil) + poller, err := clientFactory.NewFabricClient().BeginCreate(ctx, "rgswagger_2024-09-01", "wPR", armrecoveryservicesdatareplication.FabricModel{ + Location: to.Ptr("tqygutlpob"), + Properties: &armrecoveryservicesdatareplication.FabricModelProperties{}, + }, 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.FabricModel = armrecoveryservicesdatareplication.FabricModel{ - // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), - // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), - // ID: to.Ptr("ycaxtshcmldt"), - // Location: to.Ptr("tqygutlpob"), - // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.FabricModelCustomProperties{ - // InstanceType: to.Ptr("FabricModelCustomProperties"), - // }, - // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, + // res = armrecoveryservicesdatareplication.FabricClientCreateResponse{ + // FabricModel: &armrecoveryservicesdatareplication.FabricModel{ + // Location: to.Ptr("tqygutlpob"), + // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ServiceEndpoint: to.Ptr("ilrfl"), + // ServiceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationFabrics/fabric1"), + // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // Category: to.Ptr("lcsdxrqxquke"), // Severity: to.Ptr("wqxxiuaqjyagq"), // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("djsmgrltruljo"), - // }}, + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // Category: to.Ptr("leigw"), // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("ilrfl"), - // ServiceResourceID: to.Ptr("xukigpdrbyyy"), - // }, - // SystemData: &armrecoveryservicesdatareplication.FabricModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), - // CreatedBy: to.Ptr("yhdmbqrsgimuucexvpas"), - // CreatedByType: to.Ptr("brnojz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), - // LastModifiedBy: to.Ptr("balecqnwu"), - // LastModifiedByType: to.Ptr("ukvqlncihf"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, + // }, // }, // Tags: map[string]*string{ - // "key3917": to.Ptr("vgralu"), // }, - // } + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationFabrics/fabric1"), + // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), + // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("ewufpudzcjrljhmmzhfnxoqdqwnya"), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("zioqm")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // LastModifiedBy: to.Ptr("rx"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("tqbvuqoakaaqij")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Create.json -func ExampleFabricClient_BeginCreate() { +// Generated from example definition: 2024-09-01/Fabric_Delete.json +func ExampleFabricClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewFabricClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "wPR", armrecoveryservicesdatareplication.FabricModel{ - Location: to.Ptr("tqygutlpob"), - Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ - CustomProperties: &armrecoveryservicesdatareplication.FabricModelCustomProperties{ - InstanceType: to.Ptr("FabricModelCustomProperties"), - }, - }, - Tags: map[string]*string{ - "key3917": to.Ptr("vgralu"), - }, - }, nil) + poller, err := clientFactory.NewFabricClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "wPR", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) + _, 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.FabricModel = armrecoveryservicesdatareplication.FabricModel{ - // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), - // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), - // ID: to.Ptr("ycaxtshcmldt"), - // Location: to.Ptr("tqygutlpob"), - // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.FabricModelCustomProperties{ - // InstanceType: to.Ptr("FabricModelCustomProperties"), - // }, - // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, - // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), - // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ - // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), - // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), - // Severity: to.Ptr("wqxxiuaqjyagq"), - // Source: to.Ptr("wevvftugwydzzw"), - // Summary: to.Ptr("djsmgrltruljo"), - // }}, - // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), - // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), - // Source: to.Ptr("iy"), - // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("ilrfl"), - // ServiceResourceID: to.Ptr("xukigpdrbyyy"), - // }, - // SystemData: &armrecoveryservicesdatareplication.FabricModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), - // CreatedBy: to.Ptr("yhdmbqrsgimuucexvpas"), - // CreatedByType: to.Ptr("brnojz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), - // LastModifiedBy: to.Ptr("balecqnwu"), - // LastModifiedByType: to.Ptr("ukvqlncihf"), - // }, - // Tags: map[string]*string{ - // "key3917": to.Ptr("vgralu"), - // }, - // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Update.json -func ExampleFabricClient_BeginUpdate() { +// Generated from example definition: 2024-09-01/Fabric_Get.json +func ExampleFabricClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewFabricClient().BeginUpdate(ctx, "rgrecoveryservicesdatareplication", "wPR", armrecoveryservicesdatareplication.FabricModelUpdate{ - Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ - CustomProperties: &armrecoveryservicesdatareplication.FabricModelCustomProperties{ - InstanceType: to.Ptr("FabricModelCustomProperties"), - }, - }, - Tags: map[string]*string{ - "key6664": to.Ptr("def"), - }, - }, nil) + res, err := clientFactory.NewFabricClient().Get(ctx, "rgrecoveryservicesdatareplication", "wPR", 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.FabricModel = armrecoveryservicesdatareplication.FabricModel{ - // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), - // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), - // ID: to.Ptr("ycaxtshcmldt"), - // Location: to.Ptr("tqygutlpob"), - // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.FabricModelCustomProperties{ - // InstanceType: to.Ptr("FabricModelCustomProperties"), - // }, - // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, + // res = armrecoveryservicesdatareplication.FabricClientGetResponse{ + // FabricModel: &armrecoveryservicesdatareplication.FabricModel{ + // Location: to.Ptr("tqygutlpob"), + // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ServiceEndpoint: to.Ptr("ilrfl"), + // ServiceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationFabrics/fabric1"), + // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // Category: to.Ptr("lcsdxrqxquke"), // Severity: to.Ptr("wqxxiuaqjyagq"), // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("djsmgrltruljo"), - // }}, + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // Category: to.Ptr("leigw"), // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("ilrfl"), - // ServiceResourceID: to.Ptr("xukigpdrbyyy"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, + // }, // }, - // SystemData: &armrecoveryservicesdatareplication.FabricModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationFabrics/fabric1"), + // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), + // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("yhdmbqrsgimuucexvpas"), - // CreatedByType: to.Ptr("brnojz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("brnojz")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), // LastModifiedBy: to.Ptr("balecqnwu"), - // LastModifiedByType: to.Ptr("ukvqlncihf"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("ukvqlncihf")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), // }, // Tags: map[string]*string{ // "key3917": to.Ptr("vgralu"), // }, - // } + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Delete.json -func ExampleFabricClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFabricClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "wPR", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_ListBySubscription.json -func ExampleFabricClient_NewListBySubscriptionPager() { +// Generated from example definition: 2024-09-01/Fabric_List.json +func ExampleFabricClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewFabricClient().NewListBySubscriptionPager(&armrecoveryservicesdatareplication.FabricClientListBySubscriptionOptions{ContinuationToken: to.Ptr("rmgqrpzucsizbyjscxzockbiyg")}) + pager := clientFactory.NewFabricClient().NewListPager("rgswagger_2024-09-01", &FabricClientListOptions{ + continuationToken: to.Ptr("jw")}) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -319,81 +220,83 @@ func ExampleFabricClient_NewListBySubscriptionPager() { _ = 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.FabricModelCollection = armrecoveryservicesdatareplication.FabricModelCollection{ - // Value: []*armrecoveryservicesdatareplication.FabricModel{ - // { - // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), - // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), - // ID: to.Ptr("ycaxtshcmldt"), - // Location: to.Ptr("tqygutlpob"), - // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.FabricModelCustomProperties{ - // InstanceType: to.Ptr("FabricModelCustomProperties"), - // }, - // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, + // page = armrecoveryservicesdatareplication.FabricClientListResponse{ + // FabricModelListResult: armrecoveryservicesdatareplication.FabricModelListResult{ + // Value: []*armrecoveryservicesdatareplication.FabricModel{ + // { + // Location: to.Ptr("tqygutlpob"), + // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ServiceEndpoint: to.Ptr("ilrfl"), + // ServiceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationFabrics/fabric1"), + // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // Category: to.Ptr("lcsdxrqxquke"), // Severity: to.Ptr("wqxxiuaqjyagq"), // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("djsmgrltruljo"), - // }}, + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // Category: to.Ptr("leigw"), // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("ilrfl"), - // ServiceResourceID: to.Ptr("xukigpdrbyyy"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, + // }, // }, - // SystemData: &armrecoveryservicesdatareplication.FabricModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationFabrics/fabric1"), + // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), + // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("yhdmbqrsgimuucexvpas"), - // CreatedByType: to.Ptr("brnojz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("brnojz")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), // LastModifiedBy: to.Ptr("balecqnwu"), - // LastModifiedByType: to.Ptr("ukvqlncihf"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("ukvqlncihf")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), // }, // Tags: map[string]*string{ - // "key3917": to.Ptr("vgralu"), // }, - // }}, - // } + // }, + // }, + // }, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_List.json -func ExampleFabricClient_NewListPager() { +// Generated from example definition: 2024-09-01/Fabric_ListBySubscription.json +func ExampleFabricClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewFabricClient().NewListPager("rgrecoveryservicesdatareplication", &armrecoveryservicesdatareplication.FabricClientListOptions{ContinuationToken: to.Ptr("mjzsxwwmtvd")}) + pager := clientFactory.NewFabricClient().NewListBySubscriptionPager(nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -404,65 +307,152 @@ func ExampleFabricClient_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.FabricModelCollection = armrecoveryservicesdatareplication.FabricModelCollection{ - // Value: []*armrecoveryservicesdatareplication.FabricModel{ - // { - // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), - // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), - // ID: to.Ptr("ycaxtshcmldt"), - // Location: to.Ptr("tqygutlpob"), - // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.FabricModelCustomProperties{ - // InstanceType: to.Ptr("FabricModelCustomProperties"), - // }, - // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, + // page = armrecoveryservicesdatareplication.FabricClientListBySubscriptionResponse{ + // FabricModelListResult: armrecoveryservicesdatareplication.FabricModelListResult{ + // Value: []*armrecoveryservicesdatareplication.FabricModel{ + // { + // Location: to.Ptr("tqygutlpob"), + // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ServiceEndpoint: to.Ptr("ilrfl"), + // ServiceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationFabrics/fabric1"), + // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // Category: to.Ptr("lcsdxrqxquke"), // Severity: to.Ptr("wqxxiuaqjyagq"), // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("djsmgrltruljo"), - // }}, + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // Category: to.Ptr("leigw"), // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("ilrfl"), - // ServiceResourceID: to.Ptr("xukigpdrbyyy"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, + // }, // }, - // SystemData: &armrecoveryservicesdatareplication.FabricModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DataReplication/replicationFabrics/fabric1"), + // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), + // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("yhdmbqrsgimuucexvpas"), - // CreatedByType: to.Ptr("brnojz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("brnojz")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), // LastModifiedBy: to.Ptr("balecqnwu"), - // LastModifiedByType: to.Ptr("ukvqlncihf"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("ukvqlncihf")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), // }, // Tags: map[string]*string{ - // "key3917": to.Ptr("vgralu"), // }, - // }}, - // } + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-09-01/Fabric_Update.json +func ExampleFabricClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFabricClient().BeginUpdate(ctx, "rgswagger_2024-09-01", "wPR", armrecoveryservicesdatareplication.FabricModelUpdate{ + Properties: &armrecoveryservicesdatareplication.FabricModelProperties{}, + Tags: map[string]*string{}, + }, 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 = armrecoveryservicesdatareplication.FabricClientUpdateResponse{ + // FabricModel: &armrecoveryservicesdatareplication.FabricModel{ + // Location: to.Ptr("tqygutlpob"), + // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ServiceEndpoint: to.Ptr("ilrfl"), + // ServiceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationFabrics/fabric1"), + // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { + // AffectedResourceType: to.Ptr("scfniv"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, + // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ + // { + // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), + // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), + // Category: to.Ptr("lcsdxrqxquke"), + // Severity: to.Ptr("wqxxiuaqjyagq"), + // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), + // Summary: to.Ptr("djsmgrltruljo"), + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, + // Code: to.Ptr("dgxkefzmeukd"), + // HealthCategory: to.Ptr("itc"), + // Category: to.Ptr("leigw"), + // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), + // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), + // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, + // }, + // }, + // Tags: map[string]*string{ + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationFabrics/fabric1"), + // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), + // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("ewufpudzcjrljhmmzhfnxoqdqwnya"), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("zioqm")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // LastModifiedBy: to.Ptr("rx"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("tqbvuqoakaaqij")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // }, + // }, + // } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/dra_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricagent_client.go similarity index 66% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/dra_client.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricagent_client.go index 72dc6e811e53..4e8a18a97512 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/dra_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricagent_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 armrecoveryservicesdatareplication @@ -20,23 +16,23 @@ import ( "strings" ) -// DraClient contains the methods for the Dra group. -// Don't use this type directly, use NewDraClient() instead. -type DraClient struct { +// FabricAgentClient contains the methods for the FabricAgent group. +// Don't use this type directly, use NewFabricAgentClient() instead. +type FabricAgentClient struct { internal *arm.Client subscriptionID string } -// NewDraClient creates a new instance of DraClient with the specified values. +// NewFabricAgentClient creates a new instance of FabricAgentClient 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 NewDraClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DraClient, error) { +func NewFabricAgentClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FabricAgentClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &DraClient{ + client := &FabricAgentClient{ subscriptionID: subscriptionID, internal: cl, } @@ -46,25 +42,24 @@ func NewDraClient(subscriptionID string, credential azcore.TokenCredential, opti // BeginCreate - Creates the fabric agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. -// - fabricAgentName - The fabric agent (Dra) name. -// - body - Dra model. -// - options - DraClientBeginCreateOptions contains the optional parameters for the DraClient.BeginCreate method. -func (client *DraClient) BeginCreate(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, body DraModel, options *DraClientBeginCreateOptions) (*runtime.Poller[DraClientCreateResponse], error) { +// - fabricAgentName - The fabric agent name. +// - resource - Fabric agent model. +// - options - FabricAgentClientBeginCreateOptions contains the optional parameters for the FabricAgentClient.BeginCreate method. +func (client *FabricAgentClient) BeginCreate(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, resource FabricAgentModel, options *FabricAgentClientBeginCreateOptions) (*runtime.Poller[FabricAgentClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, fabricName, fabricAgentName, body, options) + resp, err := client.create(ctx, resourceGroupName, fabricName, fabricAgentName, resource, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DraClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FabricAgentClientCreateResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DraClientCreateResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FabricAgentClientCreateResponse]{ Tracer: client.internal.Tracer(), }) } @@ -73,14 +68,14 @@ func (client *DraClient) BeginCreate(ctx context.Context, resourceGroupName stri // Create - Creates the fabric agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *DraClient) create(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, body DraModel, options *DraClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *FabricAgentClient) create(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, resource FabricAgentModel, options *FabricAgentClientBeginCreateOptions) (*http.Response, error) { var err error - const operationName = "DraClient.BeginCreate" + const operationName = "FabricAgentClient.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, fabricName, fabricAgentName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, fabricName, fabricAgentName, resource, options) if err != nil { return nil, err } @@ -96,7 +91,7 @@ func (client *DraClient) create(ctx context.Context, resourceGroupName string, f } // createCreateRequest creates the Create request. -func (client *DraClient) createCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, body DraModel, options *DraClientBeginCreateOptions) (*policy.Request, error) { +func (client *FabricAgentClient) createCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, resource FabricAgentModel, _ *FabricAgentClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -119,48 +114,48 @@ func (client *DraClient) createCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil } -// BeginDelete - Deletes the fabric agent. +// BeginDelete - Deletes fabric agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. -// - fabricAgentName - The fabric agent (Dra) name. -// - options - DraClientBeginDeleteOptions contains the optional parameters for the DraClient.BeginDelete method. -func (client *DraClient) BeginDelete(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *DraClientBeginDeleteOptions) (*runtime.Poller[DraClientDeleteResponse], error) { +// - fabricAgentName - The fabric agent name. +// - options - FabricAgentClientBeginDeleteOptions contains the optional parameters for the FabricAgentClient.BeginDelete method. +func (client *FabricAgentClient) BeginDelete(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *FabricAgentClientBeginDeleteOptions) (*runtime.Poller[FabricAgentClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, fabricName, fabricAgentName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DraClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FabricAgentClientDeleteResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DraClientDeleteResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FabricAgentClientDeleteResponse]{ Tracer: client.internal.Tracer(), }) } } -// Delete - Deletes the fabric agent. +// Delete - Deletes fabric agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *DraClient) deleteOperation(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *DraClientBeginDeleteOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *FabricAgentClient) deleteOperation(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *FabricAgentClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "DraClient.BeginDelete" + const operationName = "FabricAgentClient.BeginDelete" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() @@ -180,7 +175,7 @@ func (client *DraClient) deleteOperation(ctx context.Context, resourceGroupName } // deleteCreateRequest creates the Delete request. -func (client *DraClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *DraClientBeginDeleteOptions) (*policy.Request, error) { +func (client *FabricAgentClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, _ *FabricAgentClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -203,7 +198,7 @@ func (client *DraClient) deleteCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -212,35 +207,35 @@ func (client *DraClient) deleteCreateRequest(ctx context.Context, resourceGroupN // Get - Gets the details of the fabric agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. -// - fabricAgentName - The fabric agent (Dra) name. -// - options - DraClientGetOptions contains the optional parameters for the DraClient.Get method. -func (client *DraClient) Get(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *DraClientGetOptions) (DraClientGetResponse, error) { +// - fabricAgentName - The fabric agent name. +// - options - FabricAgentClientGetOptions contains the optional parameters for the FabricAgentClient.Get method. +func (client *FabricAgentClient) Get(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *FabricAgentClientGetOptions) (FabricAgentClientGetResponse, error) { var err error - const operationName = "DraClient.Get" + const operationName = "FabricAgentClient.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, fabricName, fabricAgentName, options) if err != nil { - return DraClientGetResponse{}, err + return FabricAgentClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return DraClientGetResponse{}, err + return FabricAgentClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return DraClientGetResponse{}, err + return FabricAgentClientGetResponse{}, err } resp, err := client.getHandleResponse(httpResp) return resp, err } // getCreateRequest creates the Get request. -func (client *DraClient) getCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *DraClientGetOptions) (*policy.Request, error) { +func (client *FabricAgentClient) getCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, _ *FabricAgentClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -263,34 +258,34 @@ func (client *DraClient) getCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getHandleResponse handles the Get response. -func (client *DraClient) getHandleResponse(resp *http.Response) (DraClientGetResponse, error) { - result := DraClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DraModel); err != nil { - return DraClientGetResponse{}, err +func (client *FabricAgentClient) getHandleResponse(resp *http.Response) (FabricAgentClientGetResponse, error) { + result := FabricAgentClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FabricAgentModel); err != nil { + return FabricAgentClientGetResponse{}, err } return result, nil } // NewListPager - Gets the list of fabric agents in the given fabric. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. -// - options - DraClientListOptions contains the optional parameters for the DraClient.NewListPager method. -func (client *DraClient) NewListPager(resourceGroupName string, fabricName string, options *DraClientListOptions) *runtime.Pager[DraClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[DraClientListResponse]{ - More: func(page DraClientListResponse) bool { +// - options - FabricAgentClientListOptions contains the optional parameters for the FabricAgentClient.NewListPager method. +func (client *FabricAgentClient) NewListPager(resourceGroupName string, fabricName string, options *FabricAgentClientListOptions) *runtime.Pager[FabricAgentClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[FabricAgentClientListResponse]{ + More: func(page FabricAgentClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *DraClientListResponse) (DraClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DraClient.NewListPager") + Fetcher: func(ctx context.Context, page *FabricAgentClientListResponse) (FabricAgentClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FabricAgentClient.NewListPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -299,7 +294,7 @@ func (client *DraClient) NewListPager(resourceGroupName string, fabricName strin return client.listCreateRequest(ctx, resourceGroupName, fabricName, options) }, nil) if err != nil { - return DraClientListResponse{}, err + return FabricAgentClientListResponse{}, err } return client.listHandleResponse(resp) }, @@ -308,7 +303,7 @@ func (client *DraClient) NewListPager(resourceGroupName string, fabricName strin } // listCreateRequest creates the List request. -func (client *DraClient) listCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, options *DraClientListOptions) (*policy.Request, error) { +func (client *FabricAgentClient) listCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, _ *FabricAgentClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -327,17 +322,17 @@ func (client *DraClient) listCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // listHandleResponse handles the List response. -func (client *DraClient) listHandleResponse(resp *http.Response) (DraClientListResponse, error) { - result := DraClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DraModelCollection); err != nil { - return DraClientListResponse{}, err +func (client *FabricAgentClient) listHandleResponse(resp *http.Response) (FabricAgentClientListResponse, error) { + result := FabricAgentClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FabricAgentModelListResult); err != nil { + return FabricAgentClientListResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/dra_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricagent_client_example_test.go similarity index 61% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/dra_client_example_test.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricagent_client_example_test.go index 2bdd8ac581b3..ac4a388fcb57 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/dra_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricagent_client_example_test.go @@ -1,262 +1,257 @@ -//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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_Get.json -func ExampleDraClient_Get() { +// Generated from example definition: 2024-09-01/FabricAgent_Create.json +func ExampleFabricAgentClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewDraClient().Get(ctx, "rgrecoveryservicesdatareplication", "wPR", "M", nil) + poller, err := clientFactory.NewFabricAgentClient().BeginCreate(ctx, "rgswagger_2024-09-01", "wPR", "M", armrecoveryservicesdatareplication.FabricAgentModel{ + Properties: &armrecoveryservicesdatareplication.FabricAgentModelProperties{ + MachineID: to.Ptr("envzcoijbqhtrpncbjbhk"), + MachineName: to.Ptr("y"), + AuthenticationIdentity: &armrecoveryservicesdatareplication.IdentityModel{ + TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), + ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), + ObjectID: to.Ptr("khsiaqfbpuhp"), + Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), + AADAuthority: to.Ptr("bubwwbowfhdmujrt"), + }, + ResourceAccessIdentity: &armrecoveryservicesdatareplication.IdentityModel{ + TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), + ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), + ObjectID: to.Ptr("khsiaqfbpuhp"), + Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), + AADAuthority: to.Ptr("bubwwbowfhdmujrt"), + }, + }, + }, 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.DraModel = armrecoveryservicesdatareplication.DraModel{ - // Name: to.Ptr("ioxmwhzrzdilxivkvhpvzexl"), - // Type: to.Ptr("ptgmahzsyv"), - // ID: to.Ptr("anp"), - // Properties: &armrecoveryservicesdatareplication.DraModelProperties{ - // AuthenticationIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - // ObjectID: to.Ptr("khsiaqfbpuhp"), - // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), - // }, - // CorrelationID: to.Ptr("t"), - // CustomProperties: &armrecoveryservicesdatareplication.DraModelCustomProperties{ - // InstanceType: to.Ptr("DraModelCustomProperties"), - // }, - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, + // res = armrecoveryservicesdatareplication.FabricAgentClientCreateResponse{ + // FabricAgentModel: &armrecoveryservicesdatareplication.FabricAgentModel{ + // Properties: &armrecoveryservicesdatareplication.FabricAgentModelProperties{ + // MachineID: to.Ptr("envzcoijbqhtrpncbjbhk"), + // MachineName: to.Ptr("y"), + // AuthenticationIdentity: &armrecoveryservicesdatareplication.IdentityModel{ + // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), + // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), + // ObjectID: to.Ptr("khsiaqfbpuhp"), + // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), + // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), + // }, + // ResourceAccessIdentity: &armrecoveryservicesdatareplication.IdentityModel{ + // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), + // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), + // ObjectID: to.Ptr("khsiaqfbpuhp"), + // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), + // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), + // }, + // CorrelationID: to.Ptr("t"), + // IsResponsive: to.Ptr(true), + // LastHeartbeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.127Z"); return t}()), + // VersionNumber: to.Ptr("wnksfnisrhs"), + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // Category: to.Ptr("lcsdxrqxquke"), // Severity: to.Ptr("wqxxiuaqjyagq"), // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("djsmgrltruljo"), - // }}, + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // Category: to.Ptr("leigw"), // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // IsResponsive: to.Ptr(true), - // LastHeartbeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.127Z"); return t}()), - // MachineID: to.Ptr("envzcoijbqhtrpncbjbhk"), - // MachineName: to.Ptr("y"), - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ResourceAccessIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - // ObjectID: to.Ptr("khsiaqfbpuhp"), - // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, // }, - // VersionNumber: to.Ptr("wnksfnisrhs"), // }, - // SystemData: &armrecoveryservicesdatareplication.DraModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // CreatedBy: to.Ptr("fazidmklka"), - // CreatedByType: to.Ptr("obpndgkaeyklqzmpjh"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // LastModifiedBy: to.Ptr("cfoopkrisaroztncgss"), - // LastModifiedByType: to.Ptr("dysxbvohxhrpl"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationFabrics/fabric1/fabricAgents/agent1"), + // Name: to.Ptr("ioxmwhzrzdilxivkvhpvzexl"), + // Type: to.Ptr("ptgmahzsyv"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("ewufpudzcjrljhmmzhfnxoqdqwnya"), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("zioqm")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // LastModifiedBy: to.Ptr("rx"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("tqbvuqoakaaqij")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), // }, - // } + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_Create.json -func ExampleDraClient_BeginCreate() { +// Generated from example definition: 2024-09-01/FabricAgent_Delete.json +func ExampleFabricAgentClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewDraClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "wPR", "M", armrecoveryservicesdatareplication.DraModel{ - Properties: &armrecoveryservicesdatareplication.DraModelProperties{ - AuthenticationIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - ObjectID: to.Ptr("khsiaqfbpuhp"), - TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), - }, - CustomProperties: &armrecoveryservicesdatareplication.DraModelCustomProperties{ - InstanceType: to.Ptr("DraModelCustomProperties"), - }, - MachineID: to.Ptr("envzcoijbqhtrpncbjbhk"), - MachineName: to.Ptr("y"), - ResourceAccessIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - ObjectID: to.Ptr("khsiaqfbpuhp"), - TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), - }, - }, - }, nil) + poller, err := clientFactory.NewFabricAgentClient().BeginDelete(ctx, "rgswagger_2024-09-01", "wPR", "M", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) + _, err = poller.PollUntilDone(ctx, nil) if err != nil { log.Fatalf("failed to pull the result: %v", err) } +} + +// Generated from example definition: 2024-09-01/FabricAgent_Get.json +func ExampleFabricAgentClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFabricAgentClient().Get(ctx, "rgrecoveryservicesdatareplication", "wPR", "M", 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.DraModel = armrecoveryservicesdatareplication.DraModel{ - // Name: to.Ptr("ioxmwhzrzdilxivkvhpvzexl"), - // Type: to.Ptr("ptgmahzsyv"), - // ID: to.Ptr("anp"), - // Properties: &armrecoveryservicesdatareplication.DraModelProperties{ - // AuthenticationIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - // ObjectID: to.Ptr("khsiaqfbpuhp"), - // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), - // }, - // CorrelationID: to.Ptr("t"), - // CustomProperties: &armrecoveryservicesdatareplication.DraModelCustomProperties{ - // InstanceType: to.Ptr("DraModelCustomProperties"), - // }, - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, + // res = armrecoveryservicesdatareplication.FabricAgentClientGetResponse{ + // FabricAgentModel: &armrecoveryservicesdatareplication.FabricAgentModel{ + // Properties: &armrecoveryservicesdatareplication.FabricAgentModelProperties{ + // CorrelationID: to.Ptr("t"), + // MachineID: to.Ptr("envzcoijbqhtrpncbjbhk"), + // MachineName: to.Ptr("y"), + // AuthenticationIdentity: &armrecoveryservicesdatareplication.IdentityModel{ + // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), + // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), + // ObjectID: to.Ptr("khsiaqfbpuhp"), + // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), + // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), + // }, + // ResourceAccessIdentity: &armrecoveryservicesdatareplication.IdentityModel{ + // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), + // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), + // ObjectID: to.Ptr("khsiaqfbpuhp"), + // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), + // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), + // }, + // IsResponsive: to.Ptr(true), + // LastHeartbeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.127Z"); return t}()), + // VersionNumber: to.Ptr("wnksfnisrhs"), + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // Category: to.Ptr("lcsdxrqxquke"), // Severity: to.Ptr("wqxxiuaqjyagq"), // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("djsmgrltruljo"), - // }}, + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // Category: to.Ptr("leigw"), // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // IsResponsive: to.Ptr(true), - // LastHeartbeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.127Z"); return t}()), - // MachineID: to.Ptr("envzcoijbqhtrpncbjbhk"), - // MachineName: to.Ptr("y"), - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ResourceAccessIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - // ObjectID: to.Ptr("khsiaqfbpuhp"), - // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, // }, - // VersionNumber: to.Ptr("wnksfnisrhs"), // }, - // SystemData: &armrecoveryservicesdatareplication.DraModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationFabrics/fabric1/fabricAgents/agent1"), + // Name: to.Ptr("ioxmwhzrzdilxivkvhpvzexl"), + // Type: to.Ptr("ptgmahzsyv"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("fazidmklka"), - // CreatedByType: to.Ptr("obpndgkaeyklqzmpjh"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("obpndgkaeyklqzmpjh")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // LastModifiedBy: to.Ptr("cfoopkrisaroztncgss"), - // LastModifiedByType: to.Ptr("dysxbvohxhrpl"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("dysxbvohxhrpl")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // }, - // } + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_Delete.json -func ExampleDraClient_BeginDelete() { +// Generated from example definition: 2024-09-01/FabricAgent_List.json +func ExampleFabricAgentClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewDraClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "wPR", "M", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_List.json -func ExampleDraClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDraClient().NewListPager("rgrecoveryservicesdatareplication", "wPR", nil) + pager := clientFactory.NewFabricAgentClient().NewListPager("rgswagger_2024-09-01", "wPR", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -267,78 +262,77 @@ func ExampleDraClient_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.DraModelCollection = armrecoveryservicesdatareplication.DraModelCollection{ - // Value: []*armrecoveryservicesdatareplication.DraModel{ - // { - // Name: to.Ptr("ioxmwhzrzdilxivkvhpvzexl"), - // Type: to.Ptr("ptgmahzsyv"), - // ID: to.Ptr("anp"), - // Properties: &armrecoveryservicesdatareplication.DraModelProperties{ - // AuthenticationIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - // ObjectID: to.Ptr("khsiaqfbpuhp"), - // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), - // }, - // CorrelationID: to.Ptr("t"), - // CustomProperties: &armrecoveryservicesdatareplication.DraModelCustomProperties{ - // InstanceType: to.Ptr("DraModelCustomProperties"), - // }, - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, + // page = armrecoveryservicesdatareplication.FabricAgentClientListResponse{ + // FabricAgentModelListResult: armrecoveryservicesdatareplication.FabricAgentModelListResult{ + // Value: []*armrecoveryservicesdatareplication.FabricAgentModel{ + // { + // Properties: &armrecoveryservicesdatareplication.FabricAgentModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // Category: to.Ptr("lcsdxrqxquke"), // Severity: to.Ptr("wqxxiuaqjyagq"), // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("djsmgrltruljo"), - // }}, + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // Category: to.Ptr("leigw"), // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // IsResponsive: to.Ptr(true), - // LastHeartbeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.127Z"); return t}()), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, + // }, // MachineID: to.Ptr("envzcoijbqhtrpncbjbhk"), // MachineName: to.Ptr("y"), - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ResourceAccessIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), + // AuthenticationIdentity: &armrecoveryservicesdatareplication.IdentityModel{ + // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), // ObjectID: to.Ptr("khsiaqfbpuhp"), + // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), + // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), + // }, + // ResourceAccessIdentity: &armrecoveryservicesdatareplication.IdentityModel{ // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), + // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), + // ObjectID: to.Ptr("khsiaqfbpuhp"), + // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), + // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), // }, - // VersionNumber: to.Ptr("wnksfnisrhs"), // }, - // SystemData: &armrecoveryservicesdatareplication.DraModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // CreatedBy: to.Ptr("fazidmklka"), - // CreatedByType: to.Ptr("obpndgkaeyklqzmpjh"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // LastModifiedBy: to.Ptr("cfoopkrisaroztncgss"), - // LastModifiedByType: to.Ptr("dysxbvohxhrpl"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationFabrics/fabric1/fabricAgents/agent1"), + // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), + // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("yhdmbqrsgimuucexvpas"), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("brnojz")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), + // LastModifiedBy: to.Ptr("balecqnwu"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("ukvqlncihf")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), // }, - // }}, - // } + // }, + // }, + // }, + // } } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/azuresiterecoverymanagementserviceapi_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/azuresiterecoverymanagementserviceapi_server.go deleted file mode 100644 index 0ee5620aab6e..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/azuresiterecoverymanagementserviceapi_server.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. 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// AzureSiteRecoveryManagementServiceAPIServer is a fake server for instances of the armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClient type. -type AzureSiteRecoveryManagementServiceAPIServer struct { - // CheckNameAvailability is the fake for method AzureSiteRecoveryManagementServiceAPIClient.CheckNameAvailability - // HTTP status codes to indicate success: http.StatusOK - CheckNameAvailability func(ctx context.Context, location string, options *armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse], errResp azfake.ErrorResponder) - - // DeploymentPreflight is the fake for method AzureSiteRecoveryManagementServiceAPIClient.DeploymentPreflight - // HTTP status codes to indicate success: http.StatusOK - DeploymentPreflight func(ctx context.Context, resourceGroupName string, deploymentID string, options *armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse], errResp azfake.ErrorResponder) -} - -// NewAzureSiteRecoveryManagementServiceAPIServerTransport creates a new instance of AzureSiteRecoveryManagementServiceAPIServerTransport with the provided implementation. -// The returned AzureSiteRecoveryManagementServiceAPIServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAzureSiteRecoveryManagementServiceAPIServerTransport(srv *AzureSiteRecoveryManagementServiceAPIServer) *AzureSiteRecoveryManagementServiceAPIServerTransport { - return &AzureSiteRecoveryManagementServiceAPIServerTransport{srv: srv} -} - -// AzureSiteRecoveryManagementServiceAPIServerTransport connects instances of armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClient to instances of AzureSiteRecoveryManagementServiceAPIServer. -// Don't use this type directly, use NewAzureSiteRecoveryManagementServiceAPIServerTransport instead. -type AzureSiteRecoveryManagementServiceAPIServerTransport struct { - srv *AzureSiteRecoveryManagementServiceAPIServer -} - -// Do implements the policy.Transporter interface for AzureSiteRecoveryManagementServiceAPIServerTransport. -func (a *AzureSiteRecoveryManagementServiceAPIServerTransport) 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 "AzureSiteRecoveryManagementServiceAPIClient.CheckNameAvailability": - resp, err = a.dispatchCheckNameAvailability(req) - case "AzureSiteRecoveryManagementServiceAPIClient.DeploymentPreflight": - resp, err = a.dispatchDeploymentPreflight(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AzureSiteRecoveryManagementServiceAPIServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { - if a.srv.CheckNameAvailability == nil { - return nil, &nonRetriableError{errors.New("fake for method CheckNameAvailability not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/checkNameAvailability` - 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) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.CheckNameAvailabilityModel](req) - if err != nil { - return nil, err - } - locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) - if err != nil { - return nil, err - } - var options *armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions - if !reflect.ValueOf(body).IsZero() { - options = &armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions{ - Body: &body, - } - } - respr, errRespr := a.srv.CheckNameAvailability(req.Context(), locationParam, 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).CheckNameAvailabilityResponseModel, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AzureSiteRecoveryManagementServiceAPIServerTransport) dispatchDeploymentPreflight(req *http.Request) (*http.Response, error) { - if a.srv.DeploymentPreflight == nil { - return nil, &nonRetriableError{errors.New("fake for method DeploymentPreflight not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/deployments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/preflight` - 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[armrecoveryservicesdatareplication.DeploymentPreflightModel](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - deploymentIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("deploymentId")]) - if err != nil { - return nil, err - } - var options *armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions - if !reflect.ValueOf(body).IsZero() { - options = &armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions{ - Body: &body, - } - } - respr, errRespr := a.srv.DeploymentPreflight(req.Context(), resourceGroupNameParam, deploymentIDParam, 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).DeploymentPreflightModel, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/checknameavailability_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/checknameavailability_server.go new file mode 100644 index 000000000000..4661b9493279 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/checknameavailability_server.go @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) 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/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "net/http" + "net/url" + "reflect" + "regexp" +) + +// CheckNameAvailabilityServer is a fake server for instances of the armrecoveryservicesdatareplication.CheckNameAvailabilityClient type. +type CheckNameAvailabilityServer struct { + // Post is the fake for method CheckNameAvailabilityClient.Post + // HTTP status codes to indicate success: http.StatusOK + Post func(ctx context.Context, location string, options *armrecoveryservicesdatareplication.CheckNameAvailabilityClientPostOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.CheckNameAvailabilityClientPostResponse], errResp azfake.ErrorResponder) +} + +// NewCheckNameAvailabilityServerTransport creates a new instance of CheckNameAvailabilityServerTransport with the provided implementation. +// The returned CheckNameAvailabilityServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.CheckNameAvailabilityClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCheckNameAvailabilityServerTransport(srv *CheckNameAvailabilityServer) *CheckNameAvailabilityServerTransport { + return &CheckNameAvailabilityServerTransport{srv: srv} +} + +// CheckNameAvailabilityServerTransport connects instances of armrecoveryservicesdatareplication.CheckNameAvailabilityClient to instances of CheckNameAvailabilityServer. +// Don't use this type directly, use NewCheckNameAvailabilityServerTransport instead. +type CheckNameAvailabilityServerTransport struct { + srv *CheckNameAvailabilityServer +} + +// Do implements the policy.Transporter interface for CheckNameAvailabilityServerTransport. +func (c *CheckNameAvailabilityServerTransport) 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 c.dispatchToMethodFake(req, method) +} + +func (c *CheckNameAvailabilityServerTransport) 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 checkNameAvailabilityServerTransportInterceptor != nil { + res.resp, res.err, intercepted = checkNameAvailabilityServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CheckNameAvailabilityClient.Post": + res.resp, res.err = c.dispatchPost(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 (c *CheckNameAvailabilityServerTransport) dispatchPost(req *http.Request) (*http.Response, error) { + if c.srv.Post == nil { + return nil, &nonRetriableError{errors.New("fake for method Post not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/checkNameAvailability` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.CheckNameAvailabilityModel](req) + if err != nil { + return nil, err + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + var options *armrecoveryservicesdatareplication.CheckNameAvailabilityClientPostOptions + if !reflect.ValueOf(body).IsZero() { + options = &armrecoveryservicesdatareplication.CheckNameAvailabilityClientPostOptions{ + Body: &body, + } + } + respr, errRespr := c.srv.Post(req.Context(), locationParam, 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).CheckNameAvailabilityResponseModel, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to CheckNameAvailabilityServerTransport +var checkNameAvailabilityServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/deploymentpreflight_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/deploymentpreflight_server.go new file mode 100644 index 000000000000..05e35cff013d --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/deploymentpreflight_server.go @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) 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/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "net/http" + "net/url" + "reflect" + "regexp" +) + +// DeploymentPreflightServer is a fake server for instances of the armrecoveryservicesdatareplication.DeploymentPreflightClient type. +type DeploymentPreflightServer struct { + // Post is the fake for method DeploymentPreflightClient.Post + // HTTP status codes to indicate success: http.StatusOK + Post func(ctx context.Context, resourceGroupName string, deploymentID string, options *armrecoveryservicesdatareplication.DeploymentPreflightClientPostOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.DeploymentPreflightClientPostResponse], errResp azfake.ErrorResponder) +} + +// NewDeploymentPreflightServerTransport creates a new instance of DeploymentPreflightServerTransport with the provided implementation. +// The returned DeploymentPreflightServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.DeploymentPreflightClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDeploymentPreflightServerTransport(srv *DeploymentPreflightServer) *DeploymentPreflightServerTransport { + return &DeploymentPreflightServerTransport{srv: srv} +} + +// DeploymentPreflightServerTransport connects instances of armrecoveryservicesdatareplication.DeploymentPreflightClient to instances of DeploymentPreflightServer. +// Don't use this type directly, use NewDeploymentPreflightServerTransport instead. +type DeploymentPreflightServerTransport struct { + srv *DeploymentPreflightServer +} + +// Do implements the policy.Transporter interface for DeploymentPreflightServerTransport. +func (d *DeploymentPreflightServerTransport) 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 d.dispatchToMethodFake(req, method) +} + +func (d *DeploymentPreflightServerTransport) 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 deploymentPreflightServerTransportInterceptor != nil { + res.resp, res.err, intercepted = deploymentPreflightServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DeploymentPreflightClient.Post": + res.resp, res.err = d.dispatchPost(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 (d *DeploymentPreflightServerTransport) dispatchPost(req *http.Request) (*http.Response, error) { + if d.srv.Post == nil { + return nil, &nonRetriableError{errors.New("fake for method Post not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/deployments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/preflight` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.DeploymentPreflightModel](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + deploymentIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("deploymentId")]) + if err != nil { + return nil, err + } + var options *armrecoveryservicesdatareplication.DeploymentPreflightClientPostOptions + if !reflect.ValueOf(body).IsZero() { + options = &armrecoveryservicesdatareplication.DeploymentPreflightClientPostOptions{ + Body: &body, + } + } + respr, errRespr := d.srv.Post(req.Context(), resourceGroupNameParam, deploymentIDParam, 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).DeploymentPreflightModel, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to DeploymentPreflightServerTransport +var deploymentPreflightServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/draoperationstatus_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/draoperationstatus_server.go deleted file mode 100644 index a75730929104..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/draoperationstatus_server.go +++ /dev/null @@ -1,108 +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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "regexp" -) - -// DraOperationStatusServer is a fake server for instances of the armrecoveryservicesdatareplication.DraOperationStatusClient type. -type DraOperationStatusServer struct { - // Get is the fake for method DraOperationStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, operationID string, options *armrecoveryservicesdatareplication.DraOperationStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.DraOperationStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewDraOperationStatusServerTransport creates a new instance of DraOperationStatusServerTransport with the provided implementation. -// The returned DraOperationStatusServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.DraOperationStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDraOperationStatusServerTransport(srv *DraOperationStatusServer) *DraOperationStatusServerTransport { - return &DraOperationStatusServerTransport{srv: srv} -} - -// DraOperationStatusServerTransport connects instances of armrecoveryservicesdatareplication.DraOperationStatusClient to instances of DraOperationStatusServer. -// Don't use this type directly, use NewDraOperationStatusServerTransport instead. -type DraOperationStatusServerTransport struct { - srv *DraOperationStatusServer -} - -// Do implements the policy.Transporter interface for DraOperationStatusServerTransport. -func (d *DraOperationStatusServerTransport) 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 "DraOperationStatusClient.Get": - resp, err = d.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (d *DraOperationStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if d.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\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fabricAgents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?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 - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - fabricAgentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricAgentName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, fabricNameParam, fabricAgentNameParam, operationIDParam, 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).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/emailconfiguration_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/emailconfiguration_server.go index f83de718be7b..b16ce767cf94 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/emailconfiguration_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/emailconfiguration_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 @@ -26,7 +22,7 @@ import ( type EmailConfigurationServer struct { // Create is the fake for method EmailConfigurationClient.Create // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, vaultName string, emailConfigurationName string, body armrecoveryservicesdatareplication.EmailConfigurationModel, options *armrecoveryservicesdatareplication.EmailConfigurationClientCreateOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.EmailConfigurationClientCreateResponse], errResp azfake.ErrorResponder) + Create func(ctx context.Context, resourceGroupName string, vaultName string, emailConfigurationName string, resource armrecoveryservicesdatareplication.EmailConfigurationModel, options *armrecoveryservicesdatareplication.EmailConfigurationClientCreateOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.EmailConfigurationClientCreateResponse], errResp azfake.ErrorResponder) // Get is the fake for method EmailConfigurationClient.Get // HTTP status codes to indicate success: http.StatusOK @@ -62,25 +58,44 @@ func (e *EmailConfigurationServerTransport) Do(req *http.Request) (*http.Respons return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return e.dispatchToMethodFake(req, method) +} - switch method { - case "EmailConfigurationClient.Create": - resp, err = e.dispatchCreate(req) - case "EmailConfigurationClient.Get": - resp, err = e.dispatchGet(req) - case "EmailConfigurationClient.NewListPager": - resp, err = e.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (e *EmailConfigurationServerTransport) 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 emailConfigurationServerTransportInterceptor != nil { + res.resp, res.err, intercepted = emailConfigurationServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "EmailConfigurationClient.Create": + res.resp, res.err = e.dispatchCreate(req) + case "EmailConfigurationClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "EmailConfigurationClient.NewListPager": + res.resp, res.err = e.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 (e *EmailConfigurationServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { @@ -90,7 +105,7 @@ func (e *EmailConfigurationServerTransport) dispatchCreate(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alertSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.EmailConfigurationModel](req) @@ -131,7 +146,7 @@ func (e *EmailConfigurationServerTransport) dispatchGet(req *http.Request) (*htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alertSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -170,7 +185,7 @@ func (e *EmailConfigurationServerTransport) dispatchNewListPager(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alertSettings` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -201,3 +216,9 @@ func (e *EmailConfigurationServerTransport) dispatchNewListPager(req *http.Reque } return resp, nil } + +// set this to conditionally intercept incoming requests to EmailConfigurationServerTransport +var emailConfigurationServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/event_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/event_server.go index d90d1ea812b1..561dcd54ed6e 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/event_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/event_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 @@ -20,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "strconv" ) // EventServer is a fake server for instances of the armrecoveryservicesdatareplication.EventClient type. @@ -58,23 +55,42 @@ func (e *EventServerTransport) 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 e.dispatchToMethodFake(req, method) +} - switch method { - case "EventClient.Get": - resp, err = e.dispatchGet(req) - case "EventClient.NewListPager": - resp, err = e.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (e *EventServerTransport) 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 eventServerTransportInterceptor != nil { + res.resp, res.err, intercepted = eventServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "EventClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "EventClient.NewListPager": + res.resp, res.err = e.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 (e *EventServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -84,7 +100,7 @@ func (e *EventServerTransport) dispatchGet(req *http.Request) (*http.Response, e const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/events/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -123,7 +139,7 @@ func (e *EventServerTransport) dispatchNewListPager(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/events` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -131,25 +147,40 @@ func (e *EventServerTransport) dispatchNewListPager(req *http.Request) (*http.Re if err != nil { return nil, err } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + odataOptionsUnescaped, err := url.QueryUnescape(qp.Get("odataOptions")) if err != nil { return nil, err } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + odataOptionsParam := getOptional(odataOptionsUnescaped) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) if err != nil { return nil, err } - filterParam := getOptional(filterUnescaped) - continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + continuationTokenParam := getOptional(continuationTokenUnescaped) + 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 + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) if err != nil { return nil, err } - continuationTokenParam := getOptional(continuationTokenUnescaped) var options *armrecoveryservicesdatareplication.EventClientListOptions - if filterParam != nil || continuationTokenParam != nil { + if odataOptionsParam != nil || continuationTokenParam != nil || pageSizeParam != nil { options = &armrecoveryservicesdatareplication.EventClientListOptions{ - Filter: filterParam, + OdataOptions: odataOptionsParam, ContinuationToken: continuationTokenParam, + PageSize: pageSizeParam, } } resp := e.srv.NewListPager(resourceGroupNameParam, vaultNameParam, options) @@ -172,3 +203,9 @@ func (e *EventServerTransport) dispatchNewListPager(req *http.Request) (*http.Re } return resp, nil } + +// set this to conditionally intercept incoming requests to EventServerTransport +var eventServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabric_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabric_server.go index 5796316ad798..73669e4a97f0 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabric_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabric_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 @@ -26,10 +22,10 @@ import ( type FabricServer struct { // BeginCreate is the fake for method FabricClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, fabricName string, body armrecoveryservicesdatareplication.FabricModel, options *armrecoveryservicesdatareplication.FabricClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.FabricClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, fabricName string, resource armrecoveryservicesdatareplication.FabricModel, options *armrecoveryservicesdatareplication.FabricClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.FabricClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method FabricClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, fabricName string, options *armrecoveryservicesdatareplication.FabricClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.FabricClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method FabricClient.Get @@ -46,7 +42,7 @@ type FabricServer struct { // BeginUpdate is the fake for method FabricClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, fabricName string, body armrecoveryservicesdatareplication.FabricModelUpdate, options *armrecoveryservicesdatareplication.FabricClientBeginUpdateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.FabricClientUpdateResponse], errResp azfake.ErrorResponder) + BeginUpdate func(ctx context.Context, resourceGroupName string, fabricName string, properties armrecoveryservicesdatareplication.FabricModelUpdate, options *armrecoveryservicesdatareplication.FabricClientBeginUpdateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.FabricClientUpdateResponse], errResp azfake.ErrorResponder) } // NewFabricServerTransport creates a new instance of FabricServerTransport with the provided implementation. @@ -82,31 +78,50 @@ func (f *FabricServerTransport) 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 f.dispatchToMethodFake(req, method) +} - switch method { - case "FabricClient.BeginCreate": - resp, err = f.dispatchBeginCreate(req) - case "FabricClient.BeginDelete": - resp, err = f.dispatchBeginDelete(req) - case "FabricClient.Get": - resp, err = f.dispatchGet(req) - case "FabricClient.NewListPager": - resp, err = f.dispatchNewListPager(req) - case "FabricClient.NewListBySubscriptionPager": - resp, err = f.dispatchNewListBySubscriptionPager(req) - case "FabricClient.BeginUpdate": - resp, err = f.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (f *FabricServerTransport) 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 fabricServerTransportInterceptor != nil { + res.resp, res.err, intercepted = fabricServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FabricClient.BeginCreate": + res.resp, res.err = f.dispatchBeginCreate(req) + case "FabricClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FabricClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FabricClient.NewListPager": + res.resp, res.err = f.dispatchNewListPager(req) + case "FabricClient.NewListBySubscriptionPager": + res.resp, res.err = f.dispatchNewListBySubscriptionPager(req) + case "FabricClient.BeginUpdate": + res.resp, res.err = f.dispatchBeginUpdate(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 (f *FabricServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -118,7 +133,7 @@ func (f *FabricServerTransport) dispatchBeginCreate(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.FabricModel](req) @@ -166,7 +181,7 @@ func (f *FabricServerTransport) dispatchBeginDelete(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -190,9 +205,9 @@ func (f *FabricServerTransport) dispatchBeginDelete(req *http.Request) (*http.Re return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { f.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { f.beginDelete.remove(req) @@ -208,7 +223,7 @@ func (f *FabricServerTransport) dispatchGet(req *http.Request) (*http.Response, const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -243,7 +258,7 @@ func (f *FabricServerTransport) dispatchNewListPager(req *http.Request) (*http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationFabrics` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -292,22 +307,10 @@ func (f *FabricServerTransport) dispatchNewListBySubscriptionPager(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationFabrics` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - qp := req.URL.Query() - continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) - if err != nil { - return nil, err - } - continuationTokenParam := getOptional(continuationTokenUnescaped) - var options *armrecoveryservicesdatareplication.FabricClientListBySubscriptionOptions - if continuationTokenParam != nil { - options = &armrecoveryservicesdatareplication.FabricClientListBySubscriptionOptions{ - ContinuationToken: continuationTokenParam, - } - } - resp := f.srv.NewListBySubscriptionPager(options) + resp := f.srv.NewListBySubscriptionPager(nil) newListBySubscriptionPager = &resp f.newListBySubscriptionPager.add(req, newListBySubscriptionPager) server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armrecoveryservicesdatareplication.FabricClientListBySubscriptionResponse, createLink func() string) { @@ -337,7 +340,7 @@ func (f *FabricServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.FabricModelUpdate](req) @@ -375,3 +378,9 @@ func (f *FabricServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Re return resp, nil } + +// set this to conditionally intercept incoming requests to FabricServerTransport +var fabricServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/dra_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabricagent_server.go similarity index 58% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/dra_server.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabricagent_server.go index a143f61daa2e..fb417f28a31b 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/dra_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabricagent_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 @@ -22,90 +18,109 @@ import ( "regexp" ) -// DraServer is a fake server for instances of the armrecoveryservicesdatareplication.DraClient type. -type DraServer struct { - // BeginCreate is the fake for method DraClient.BeginCreate +// FabricAgentServer is a fake server for instances of the armrecoveryservicesdatareplication.FabricAgentClient type. +type FabricAgentServer struct { + // BeginCreate is the fake for method FabricAgentClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, body armrecoveryservicesdatareplication.DraModel, options *armrecoveryservicesdatareplication.DraClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.DraClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, resource armrecoveryservicesdatareplication.FabricAgentModel, options *armrecoveryservicesdatareplication.FabricAgentClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.FabricAgentClientCreateResponse], errResp azfake.ErrorResponder) - // BeginDelete is the fake for method DraClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *armrecoveryservicesdatareplication.DraClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.DraClientDeleteResponse], errResp azfake.ErrorResponder) + // BeginDelete is the fake for method FabricAgentClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *armrecoveryservicesdatareplication.FabricAgentClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.FabricAgentClientDeleteResponse], errResp azfake.ErrorResponder) - // Get is the fake for method DraClient.Get + // Get is the fake for method FabricAgentClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *armrecoveryservicesdatareplication.DraClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.DraClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *armrecoveryservicesdatareplication.FabricAgentClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.FabricAgentClientGetResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method DraClient.NewListPager + // NewListPager is the fake for method FabricAgentClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, fabricName string, options *armrecoveryservicesdatareplication.DraClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.DraClientListResponse]) + NewListPager func(resourceGroupName string, fabricName string, options *armrecoveryservicesdatareplication.FabricAgentClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.FabricAgentClientListResponse]) } -// NewDraServerTransport creates a new instance of DraServerTransport with the provided implementation. -// The returned DraServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.DraClient via the +// NewFabricAgentServerTransport creates a new instance of FabricAgentServerTransport with the provided implementation. +// The returned FabricAgentServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.FabricAgentClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDraServerTransport(srv *DraServer) *DraServerTransport { - return &DraServerTransport{ +func NewFabricAgentServerTransport(srv *FabricAgentServer) *FabricAgentServerTransport { + return &FabricAgentServerTransport{ srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.DraClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.DraClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.DraClientListResponse]](), + beginCreate: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.FabricAgentClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.FabricAgentClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.FabricAgentClientListResponse]](), } } -// DraServerTransport connects instances of armrecoveryservicesdatareplication.DraClient to instances of DraServer. -// Don't use this type directly, use NewDraServerTransport instead. -type DraServerTransport struct { - srv *DraServer - beginCreate *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.DraClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.DraClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.DraClientListResponse]] +// FabricAgentServerTransport connects instances of armrecoveryservicesdatareplication.FabricAgentClient to instances of FabricAgentServer. +// Don't use this type directly, use NewFabricAgentServerTransport instead. +type FabricAgentServerTransport struct { + srv *FabricAgentServer + beginCreate *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.FabricAgentClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.FabricAgentClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.FabricAgentClientListResponse]] } -// Do implements the policy.Transporter interface for DraServerTransport. -func (d *DraServerTransport) Do(req *http.Request) (*http.Response, error) { +// Do implements the policy.Transporter interface for FabricAgentServerTransport. +func (f *FabricAgentServerTransport) 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 + return f.dispatchToMethodFake(req, method) +} - switch method { - case "DraClient.BeginCreate": - resp, err = d.dispatchBeginCreate(req) - case "DraClient.BeginDelete": - resp, err = d.dispatchBeginDelete(req) - case "DraClient.Get": - resp, err = d.dispatchGet(req) - case "DraClient.NewListPager": - resp, err = d.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (f *FabricAgentServerTransport) 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 fabricAgentServerTransportInterceptor != nil { + res.resp, res.err, intercepted = fabricAgentServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FabricAgentClient.BeginCreate": + res.resp, res.err = f.dispatchBeginCreate(req) + case "FabricAgentClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FabricAgentClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FabricAgentClient.NewListPager": + res.resp, res.err = f.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 (d *DraServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if d.srv.BeginCreate == nil { +func (f *FabricAgentServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if f.srv.BeginCreate == nil { return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} } - beginCreate := d.beginCreate.get(req) + beginCreate := f.beginCreate.get(req) if beginCreate == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fabricAgents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.DraModel](req) + body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.FabricAgentModel](req) if err != nil { return nil, err } @@ -121,12 +136,12 @@ func (d *DraServerTransport) dispatchBeginCreate(req *http.Request) (*http.Respo if err != nil { return nil, err } - respr, errRespr := d.srv.BeginCreate(req.Context(), resourceGroupNameParam, fabricNameParam, fabricAgentNameParam, body, nil) + respr, errRespr := f.srv.BeginCreate(req.Context(), resourceGroupNameParam, fabricNameParam, fabricAgentNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } beginCreate = &respr - d.beginCreate.add(req, beginCreate) + f.beginCreate.add(req, beginCreate) } resp, err := server.PollerResponderNext(beginCreate, req) @@ -135,26 +150,26 @@ func (d *DraServerTransport) dispatchBeginCreate(req *http.Request) (*http.Respo } if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - d.beginCreate.remove(req) + f.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) { - d.beginCreate.remove(req) + f.beginCreate.remove(req) } return resp, nil } -func (d *DraServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if d.srv.BeginDelete == nil { +func (f *FabricAgentServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if f.srv.BeginDelete == nil { return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} } - beginDelete := d.beginDelete.get(req) + beginDelete := f.beginDelete.get(req) if beginDelete == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fabricAgents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -169,12 +184,12 @@ func (d *DraServerTransport) dispatchBeginDelete(req *http.Request) (*http.Respo if err != nil { return nil, err } - respr, errRespr := d.srv.BeginDelete(req.Context(), resourceGroupNameParam, fabricNameParam, fabricAgentNameParam, nil) + respr, errRespr := f.srv.BeginDelete(req.Context(), resourceGroupNameParam, fabricNameParam, fabricAgentNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } beginDelete = &respr - d.beginDelete.add(req, beginDelete) + f.beginDelete.add(req, beginDelete) } resp, err := server.PollerResponderNext(beginDelete, req) @@ -182,25 +197,25 @@ func (d *DraServerTransport) dispatchBeginDelete(req *http.Request) (*http.Respo return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - d.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + f.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { - d.beginDelete.remove(req) + f.beginDelete.remove(req) } return resp, nil } -func (d *DraServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if d.srv.Get == nil { +func (f *FabricAgentServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if f.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\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fabricAgents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -215,7 +230,7 @@ func (d *DraServerTransport) dispatchGet(req *http.Request) (*http.Response, err if err != nil { return nil, err } - respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, fabricNameParam, fabricAgentNameParam, nil) + respr, errRespr := f.srv.Get(req.Context(), resourceGroupNameParam, fabricNameParam, fabricAgentNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -223,23 +238,23 @@ func (d *DraServerTransport) dispatchGet(req *http.Request) (*http.Response, err 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).DraModel, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FabricAgentModel, req) if err != nil { return nil, err } return resp, nil } -func (d *DraServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if d.srv.NewListPager == nil { +func (f *FabricAgentServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if f.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} } - newListPager := d.newListPager.get(req) + newListPager := f.newListPager.get(req) if newListPager == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fabricAgents` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -250,10 +265,10 @@ func (d *DraServerTransport) dispatchNewListPager(req *http.Request) (*http.Resp if err != nil { return nil, err } - resp := d.srv.NewListPager(resourceGroupNameParam, fabricNameParam, nil) + resp := f.srv.NewListPager(resourceGroupNameParam, fabricNameParam, nil) newListPager = &resp - d.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.DraClientListResponse, createLink func() string) { + f.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.FabricAgentClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -262,11 +277,17 @@ func (d *DraServerTransport) dispatchNewListPager(req *http.Request) (*http.Resp return nil, err } if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListPager.remove(req) + f.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } if !server.PagerResponderMore(newListPager) { - d.newListPager.remove(req) + f.newListPager.remove(req) } return resp, nil } + +// set this to conditionally intercept incoming requests to FabricAgentServerTransport +var fabricAgentServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabricoperationsstatus_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabricoperationsstatus_server.go deleted file mode 100644 index 0dfc5a817303..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabricoperationsstatus_server.go +++ /dev/null @@ -1,104 +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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "regexp" -) - -// FabricOperationsStatusServer is a fake server for instances of the armrecoveryservicesdatareplication.FabricOperationsStatusClient type. -type FabricOperationsStatusServer struct { - // Get is the fake for method FabricOperationsStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, fabricName string, operationID string, options *armrecoveryservicesdatareplication.FabricOperationsStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.FabricOperationsStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewFabricOperationsStatusServerTransport creates a new instance of FabricOperationsStatusServerTransport with the provided implementation. -// The returned FabricOperationsStatusServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.FabricOperationsStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewFabricOperationsStatusServerTransport(srv *FabricOperationsStatusServer) *FabricOperationsStatusServerTransport { - return &FabricOperationsStatusServerTransport{srv: srv} -} - -// FabricOperationsStatusServerTransport connects instances of armrecoveryservicesdatareplication.FabricOperationsStatusClient to instances of FabricOperationsStatusServer. -// Don't use this type directly, use NewFabricOperationsStatusServerTransport instead. -type FabricOperationsStatusServerTransport struct { - srv *FabricOperationsStatusServer -} - -// Do implements the policy.Transporter interface for FabricOperationsStatusServerTransport. -func (f *FabricOperationsStatusServerTransport) 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 "FabricOperationsStatusClient.Get": - resp, err = f.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (f *FabricOperationsStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if f.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\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?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 - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := f.srv.Get(req.Context(), resourceGroupNameParam, fabricNameParam, operationIDParam, 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).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/internal.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/internal.go index 7d2f89ba4bb2..41e62ec29233 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/internal.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/internal.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 @@ -15,6 +11,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/workflow_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/job_server.go similarity index 52% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/workflow_server.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/job_server.go index 5231a3fc89a7..f6010e15a02a 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/workflow_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/job_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 @@ -20,71 +16,91 @@ import ( "net/http" "net/url" "regexp" + "strconv" ) -// WorkflowServer is a fake server for instances of the armrecoveryservicesdatareplication.WorkflowClient type. -type WorkflowServer struct { - // Get is the fake for method WorkflowClient.Get +// JobServer is a fake server for instances of the armrecoveryservicesdatareplication.JobClient type. +type JobServer struct { + // Get is the fake for method JobClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, jobName string, options *armrecoveryservicesdatareplication.WorkflowClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.WorkflowClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, vaultName string, jobName string, options *armrecoveryservicesdatareplication.JobClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.JobClientGetResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method WorkflowClient.NewListPager + // NewListPager is the fake for method JobClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, vaultName string, options *armrecoveryservicesdatareplication.WorkflowClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.WorkflowClientListResponse]) + NewListPager func(resourceGroupName string, vaultName string, options *armrecoveryservicesdatareplication.JobClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.JobClientListResponse]) } -// NewWorkflowServerTransport creates a new instance of WorkflowServerTransport with the provided implementation. -// The returned WorkflowServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.WorkflowClient via the +// NewJobServerTransport creates a new instance of JobServerTransport with the provided implementation. +// The returned JobServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.JobClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewWorkflowServerTransport(srv *WorkflowServer) *WorkflowServerTransport { - return &WorkflowServerTransport{ +func NewJobServerTransport(srv *JobServer) *JobServerTransport { + return &JobServerTransport{ srv: srv, - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.WorkflowClientListResponse]](), + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.JobClientListResponse]](), } } -// WorkflowServerTransport connects instances of armrecoveryservicesdatareplication.WorkflowClient to instances of WorkflowServer. -// Don't use this type directly, use NewWorkflowServerTransport instead. -type WorkflowServerTransport struct { - srv *WorkflowServer - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.WorkflowClientListResponse]] +// JobServerTransport connects instances of armrecoveryservicesdatareplication.JobClient to instances of JobServer. +// Don't use this type directly, use NewJobServerTransport instead. +type JobServerTransport struct { + srv *JobServer + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.JobClientListResponse]] } -// Do implements the policy.Transporter interface for WorkflowServerTransport. -func (w *WorkflowServerTransport) Do(req *http.Request) (*http.Response, error) { +// Do implements the policy.Transporter interface for JobServerTransport. +func (j *JobServerTransport) 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 + return j.dispatchToMethodFake(req, method) +} - switch method { - case "WorkflowClient.Get": - resp, err = w.dispatchGet(req) - case "WorkflowClient.NewListPager": - resp, err = w.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (j *JobServerTransport) 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 jobServerTransportInterceptor != nil { + res.resp, res.err, intercepted = jobServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "JobClient.Get": + res.resp, res.err = j.dispatchGet(req) + case "JobClient.NewListPager": + res.resp, res.err = j.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 (w *WorkflowServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if w.srv.Get == nil { +func (j *JobServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if j.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\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -99,7 +115,7 @@ func (w *WorkflowServerTransport) dispatchGet(req *http.Request) (*http.Response if err != nil { return nil, err } - respr, errRespr := w.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, jobNameParam, nil) + respr, errRespr := j.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, jobNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -107,23 +123,23 @@ func (w *WorkflowServerTransport) dispatchGet(req *http.Request) (*http.Response 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).WorkflowModel, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).JobModel, req) if err != nil { return nil, err } return resp, nil } -func (w *WorkflowServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if w.srv.NewListPager == nil { +func (j *JobServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if j.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} } - newListPager := w.newListPager.get(req) + newListPager := j.newListPager.get(req) if newListPager == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jobs` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -131,31 +147,46 @@ func (w *WorkflowServerTransport) dispatchNewListPager(req *http.Request) (*http if err != nil { return nil, err } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + odataOptionsUnescaped, err := url.QueryUnescape(qp.Get("odataOptions")) if err != nil { return nil, err } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + odataOptionsParam := getOptional(odataOptionsUnescaped) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) if err != nil { return nil, err } - filterParam := getOptional(filterUnescaped) - continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + continuationTokenParam := getOptional(continuationTokenUnescaped) + pageSizeUnescaped, err := url.QueryUnescape(qp.Get("pageSize")) if err != nil { return nil, err } - continuationTokenParam := getOptional(continuationTokenUnescaped) - var options *armrecoveryservicesdatareplication.WorkflowClientListOptions - if filterParam != nil || continuationTokenParam != nil { - options = &armrecoveryservicesdatareplication.WorkflowClientListOptions{ - Filter: filterParam, + 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 + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + var options *armrecoveryservicesdatareplication.JobClientListOptions + if odataOptionsParam != nil || continuationTokenParam != nil || pageSizeParam != nil { + options = &armrecoveryservicesdatareplication.JobClientListOptions{ + OdataOptions: odataOptionsParam, ContinuationToken: continuationTokenParam, + PageSize: pageSizeParam, } } - resp := w.srv.NewListPager(resourceGroupNameParam, vaultNameParam, options) + resp := j.srv.NewListPager(resourceGroupNameParam, vaultNameParam, options) newListPager = &resp - w.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.WorkflowClientListResponse, createLink func() string) { + j.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.JobClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -164,11 +195,17 @@ func (w *WorkflowServerTransport) dispatchNewListPager(req *http.Request) (*http return nil, err } if !contains([]int{http.StatusOK}, resp.StatusCode) { - w.newListPager.remove(req) + j.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } if !server.PagerResponderMore(newListPager) { - w.newListPager.remove(req) + j.newListPager.remove(req) } return resp, nil } + +// set this to conditionally intercept incoming requests to JobServerTransport +var jobServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/locationbasedoperationresults_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/locationbasedoperationresults_server.go new file mode 100644 index 000000000000..df027a0e6565 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/locationbasedoperationresults_server.go @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) 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/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "net/http" + "net/url" + "regexp" +) + +// LocationBasedOperationResultsServer is a fake server for instances of the armrecoveryservicesdatareplication.LocationBasedOperationResultsClient type. +type LocationBasedOperationResultsServer struct { + // Get is the fake for method LocationBasedOperationResultsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, location string, operationID string, options *armrecoveryservicesdatareplication.LocationBasedOperationResultsClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.LocationBasedOperationResultsClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewLocationBasedOperationResultsServerTransport creates a new instance of LocationBasedOperationResultsServerTransport with the provided implementation. +// The returned LocationBasedOperationResultsServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.LocationBasedOperationResultsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewLocationBasedOperationResultsServerTransport(srv *LocationBasedOperationResultsServer) *LocationBasedOperationResultsServerTransport { + return &LocationBasedOperationResultsServerTransport{srv: srv} +} + +// LocationBasedOperationResultsServerTransport connects instances of armrecoveryservicesdatareplication.LocationBasedOperationResultsClient to instances of LocationBasedOperationResultsServer. +// Don't use this type directly, use NewLocationBasedOperationResultsServerTransport instead. +type LocationBasedOperationResultsServerTransport struct { + srv *LocationBasedOperationResultsServer +} + +// Do implements the policy.Transporter interface for LocationBasedOperationResultsServerTransport. +func (l *LocationBasedOperationResultsServerTransport) 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 l.dispatchToMethodFake(req, method) +} + +func (l *LocationBasedOperationResultsServerTransport) 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 locationBasedOperationResultsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = locationBasedOperationResultsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "LocationBasedOperationResultsClient.Get": + res.resp, res.err = l.dispatchGet(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 (l *LocationBasedOperationResultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if l.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\.DataReplication/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) + if err != nil { + return nil, err + } + respr, errRespr := l.srv.Get(req.Context(), resourceGroupNameParam, locationParam, operationIDParam, 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).OperationStatus, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to LocationBasedOperationResultsServerTransport +var locationBasedOperationResultsServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/operationresults_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/operationresults_server.go new file mode 100644 index 000000000000..0b2ab9d4e60b --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/operationresults_server.go @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) 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/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "net/http" + "net/url" + "regexp" +) + +// OperationResultsServer is a fake server for instances of the armrecoveryservicesdatareplication.OperationResultsClient type. +type OperationResultsServer struct { + // Get is the fake for method OperationResultsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, operationID string, options *armrecoveryservicesdatareplication.OperationResultsClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.OperationResultsClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewOperationResultsServerTransport creates a new instance of OperationResultsServerTransport with the provided implementation. +// The returned OperationResultsServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.OperationResultsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOperationResultsServerTransport(srv *OperationResultsServer) *OperationResultsServerTransport { + return &OperationResultsServerTransport{srv: srv} +} + +// OperationResultsServerTransport connects instances of armrecoveryservicesdatareplication.OperationResultsClient to instances of OperationResultsServer. +// Don't use this type directly, use NewOperationResultsServerTransport instead. +type OperationResultsServerTransport struct { + srv *OperationResultsServer +} + +// Do implements the policy.Transporter interface for OperationResultsServerTransport. +func (o *OperationResultsServerTransport) 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 o.dispatchToMethodFake(req, method) +} + +func (o *OperationResultsServerTransport) 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 operationResultsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationResultsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationResultsClient.Get": + res.resp, res.err = o.dispatchGet(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 (o *OperationResultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if o.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\.DataReplication/operationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/{operationId}` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.Get(req.Context(), resourceGroupNameParam, operationIDParam, 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).OperationStatus, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to OperationResultsServerTransport +var operationResultsServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/operations_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/operations_server.go index 920f9da41db7..bacd7046a40e 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/operations_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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 @@ -51,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) { @@ -94,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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policy_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policy_server.go index fed6a22b77d5..f37c1a7b9604 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policy_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policy_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 @@ -26,10 +22,10 @@ import ( type PolicyServer struct { // BeginCreate is the fake for method PolicyClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, vaultName string, policyName string, body armrecoveryservicesdatareplication.PolicyModel, options *armrecoveryservicesdatareplication.PolicyClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.PolicyClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, vaultName string, policyName string, resource armrecoveryservicesdatareplication.PolicyModel, options *armrecoveryservicesdatareplication.PolicyClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.PolicyClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method PolicyClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, vaultName string, policyName string, options *armrecoveryservicesdatareplication.PolicyClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.PolicyClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method PolicyClient.Get @@ -70,27 +66,46 @@ func (p *PolicyServerTransport) 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 p.dispatchToMethodFake(req, method) +} - switch method { - case "PolicyClient.BeginCreate": - resp, err = p.dispatchBeginCreate(req) - case "PolicyClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PolicyClient.Get": - resp, err = p.dispatchGet(req) - case "PolicyClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PolicyServerTransport) 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 policyServerTransportInterceptor != nil { + res.resp, res.err, intercepted = policyServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PolicyClient.BeginCreate": + res.resp, res.err = p.dispatchBeginCreate(req) + case "PolicyClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PolicyClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PolicyClient.NewListPager": + res.resp, res.err = p.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 (p *PolicyServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -102,7 +117,7 @@ func (p *PolicyServerTransport) dispatchBeginCreate(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicationPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.PolicyModel](req) @@ -154,7 +169,7 @@ func (p *PolicyServerTransport) dispatchBeginDelete(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicationPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -182,9 +197,9 @@ func (p *PolicyServerTransport) dispatchBeginDelete(req *http.Request) (*http.Re return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { p.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { p.beginDelete.remove(req) @@ -200,7 +215,7 @@ func (p *PolicyServerTransport) dispatchGet(req *http.Request) (*http.Response, const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicationPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -239,7 +254,7 @@ func (p *PolicyServerTransport) dispatchNewListPager(req *http.Request) (*http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicationPolicies` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -270,3 +285,9 @@ func (p *PolicyServerTransport) dispatchNewListPager(req *http.Request) (*http.R } return resp, nil } + +// set this to conditionally intercept incoming requests to PolicyServerTransport +var policyServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policyoperationstatus_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policyoperationstatus_server.go deleted file mode 100644 index 6f4cd781837c..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policyoperationstatus_server.go +++ /dev/null @@ -1,108 +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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "regexp" -) - -// PolicyOperationStatusServer is a fake server for instances of the armrecoveryservicesdatareplication.PolicyOperationStatusClient type. -type PolicyOperationStatusServer struct { - // Get is the fake for method PolicyOperationStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, policyName string, operationID string, options *armrecoveryservicesdatareplication.PolicyOperationStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.PolicyOperationStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewPolicyOperationStatusServerTransport creates a new instance of PolicyOperationStatusServerTransport with the provided implementation. -// The returned PolicyOperationStatusServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.PolicyOperationStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPolicyOperationStatusServerTransport(srv *PolicyOperationStatusServer) *PolicyOperationStatusServerTransport { - return &PolicyOperationStatusServerTransport{srv: srv} -} - -// PolicyOperationStatusServerTransport connects instances of armrecoveryservicesdatareplication.PolicyOperationStatusClient to instances of PolicyOperationStatusServer. -// Don't use this type directly, use NewPolicyOperationStatusServerTransport instead. -type PolicyOperationStatusServerTransport struct { - srv *PolicyOperationStatusServer -} - -// Do implements the policy.Transporter interface for PolicyOperationStatusServerTransport. -func (p *PolicyOperationStatusServerTransport) 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 "PolicyOperationStatusClient.Get": - resp, err = p.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PolicyOperationStatusServerTransport) 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\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicationPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?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 - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - policyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("policyName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, policyNameParam, operationIDParam, 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).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privateendpointconnectionproxies_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privateendpointconnectionproxies_server.go new file mode 100644 index 000000000000..9695fcb8d0e7 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privateendpointconnectionproxies_server.go @@ -0,0 +1,327 @@ +// Copyright (c) Microsoft 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "net/http" + "net/url" + "regexp" +) + +// PrivateEndpointConnectionProxiesServer is a fake server for instances of the armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClient type. +type PrivateEndpointConnectionProxiesServer struct { + // Create is the fake for method PrivateEndpointConnectionProxiesClient.Create + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Create func(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, resource armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientCreateOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method PrivateEndpointConnectionProxiesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PrivateEndpointConnectionProxiesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method PrivateEndpointConnectionProxiesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, vaultName string, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientListResponse]) + + // Validate is the fake for method PrivateEndpointConnectionProxiesClient.Validate + // HTTP status codes to indicate success: http.StatusOK + Validate func(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, body armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientValidateOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientValidateResponse], errResp azfake.ErrorResponder) +} + +// NewPrivateEndpointConnectionProxiesServerTransport creates a new instance of PrivateEndpointConnectionProxiesServerTransport with the provided implementation. +// The returned PrivateEndpointConnectionProxiesServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateEndpointConnectionProxiesServerTransport(srv *PrivateEndpointConnectionProxiesServer) *PrivateEndpointConnectionProxiesServerTransport { + return &PrivateEndpointConnectionProxiesServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientListResponse]](), + } +} + +// PrivateEndpointConnectionProxiesServerTransport connects instances of armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClient to instances of PrivateEndpointConnectionProxiesServer. +// Don't use this type directly, use NewPrivateEndpointConnectionProxiesServerTransport instead. +type PrivateEndpointConnectionProxiesServerTransport struct { + srv *PrivateEndpointConnectionProxiesServer + beginDelete *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientListResponse]] +} + +// Do implements the policy.Transporter interface for PrivateEndpointConnectionProxiesServerTransport. +func (p *PrivateEndpointConnectionProxiesServerTransport) 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 p.dispatchToMethodFake(req, method) +} + +func (p *PrivateEndpointConnectionProxiesServerTransport) 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 privateEndpointConnectionProxiesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateEndpointConnectionProxiesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateEndpointConnectionProxiesClient.Create": + res.resp, res.err = p.dispatchCreate(req) + case "PrivateEndpointConnectionProxiesClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PrivateEndpointConnectionProxiesClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateEndpointConnectionProxiesClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + case "PrivateEndpointConnectionProxiesClient.Validate": + res.resp, res.err = p.dispatchValidate(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 (p *PrivateEndpointConnectionProxiesServerTransport) 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\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnectionProxies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionProxyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionProxyName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Create(req.Context(), resourceGroupNameParam, vaultNameParam, privateEndpointConnectionProxyNameParam, body, nil) + 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).PrivateEndpointConnectionProxy, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateEndpointConnectionProxiesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnectionProxies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionProxyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionProxyName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, vaultNameParam, privateEndpointConnectionProxyNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *PrivateEndpointConnectionProxiesServerTransport) 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\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnectionProxies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionProxyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionProxyName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, privateEndpointConnectionProxyNameParam, 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).PrivateEndpointConnectionProxy, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateEndpointConnectionProxiesServerTransport) 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\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnectionProxies` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListPager(resourceGroupNameParam, vaultNameParam, nil) + newListPager = &resp + p.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientListResponse, 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 *PrivateEndpointConnectionProxiesServerTransport) dispatchValidate(req *http.Request) (*http.Response, error) { + if p.srv.Validate == nil { + return nil, &nonRetriableError{errors.New("fake for method Validate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnectionProxies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/validate` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionProxyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionProxyName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Validate(req.Context(), resourceGroupNameParam, vaultNameParam, privateEndpointConnectionProxyNameParam, body, 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).PrivateEndpointConnectionProxy, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to PrivateEndpointConnectionProxiesServerTransport +var privateEndpointConnectionProxiesServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privateendpointconnections_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privateendpointconnections_server.go new file mode 100644 index 000000000000..3f3be2682d8a --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privateendpointconnections_server.go @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "net/http" + "net/url" + "regexp" +) + +// PrivateEndpointConnectionsServer is a fake server for instances of the armrecoveryservicesdatareplication.PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsServer struct { + // BeginDelete is the fake for method PrivateEndpointConnectionsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PrivateEndpointConnectionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method PrivateEndpointConnectionsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, vaultName string, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientListResponse]) + + // Update is the fake for method PrivateEndpointConnectionsClient.Update + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Update func(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, resource armrecoveryservicesdatareplication.PrivateEndpointConnection, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientUpdateOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewPrivateEndpointConnectionsServerTransport creates a new instance of PrivateEndpointConnectionsServerTransport with the provided implementation. +// The returned PrivateEndpointConnectionsServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.PrivateEndpointConnectionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateEndpointConnectionsServerTransport(srv *PrivateEndpointConnectionsServer) *PrivateEndpointConnectionsServerTransport { + return &PrivateEndpointConnectionsServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientListResponse]](), + } +} + +// PrivateEndpointConnectionsServerTransport connects instances of armrecoveryservicesdatareplication.PrivateEndpointConnectionsClient to instances of PrivateEndpointConnectionsServer. +// Don't use this type directly, use NewPrivateEndpointConnectionsServerTransport instead. +type PrivateEndpointConnectionsServerTransport struct { + srv *PrivateEndpointConnectionsServer + beginDelete *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientListResponse]] +} + +// Do implements the policy.Transporter interface for PrivateEndpointConnectionsServerTransport. +func (p *PrivateEndpointConnectionsServerTransport) 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 p.dispatchToMethodFake(req, method) +} + +func (p *PrivateEndpointConnectionsServerTransport) 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 privateEndpointConnectionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateEndpointConnectionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateEndpointConnectionsClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PrivateEndpointConnectionsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateEndpointConnectionsClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + case "PrivateEndpointConnectionsClient.Update": + res.resp, res.err = p.dispatchUpdate(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 (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, vaultNameParam, privateEndpointConnectionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) 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\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + 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, vaultNameParam, 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 + } + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) 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\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListPager(resourceGroupNameParam, vaultNameParam, nil) + newListPager = &resp + p.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientListResponse, 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 *PrivateEndpointConnectionsServerTransport) 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\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.PrivateEndpointConnection](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Update(req.Context(), resourceGroupNameParam, vaultNameParam, privateEndpointConnectionNameParam, body, nil) + 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).PrivateEndpointConnection, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to PrivateEndpointConnectionsServerTransport +var privateEndpointConnectionsServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privatelinkresources_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privatelinkresources_server.go new file mode 100644 index 000000000000..661e45efc996 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privatelinkresources_server.go @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "net/http" + "net/url" + "regexp" +) + +// PrivateLinkResourcesServer is a fake server for instances of the armrecoveryservicesdatareplication.PrivateLinkResourcesClient type. +type PrivateLinkResourcesServer struct { + // Get is the fake for method PrivateLinkResourcesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, vaultName string, privateLinkResourceName string, options *armrecoveryservicesdatareplication.PrivateLinkResourcesClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.PrivateLinkResourcesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method PrivateLinkResourcesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, vaultName string, options *armrecoveryservicesdatareplication.PrivateLinkResourcesClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateLinkResourcesClientListResponse]) +} + +// NewPrivateLinkResourcesServerTransport creates a new instance of PrivateLinkResourcesServerTransport with the provided implementation. +// The returned PrivateLinkResourcesServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.PrivateLinkResourcesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateLinkResourcesServerTransport(srv *PrivateLinkResourcesServer) *PrivateLinkResourcesServerTransport { + return &PrivateLinkResourcesServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateLinkResourcesClientListResponse]](), + } +} + +// PrivateLinkResourcesServerTransport connects instances of armrecoveryservicesdatareplication.PrivateLinkResourcesClient to instances of PrivateLinkResourcesServer. +// Don't use this type directly, use NewPrivateLinkResourcesServerTransport instead. +type PrivateLinkResourcesServerTransport struct { + srv *PrivateLinkResourcesServer + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateLinkResourcesClientListResponse]] +} + +// Do implements the policy.Transporter interface for PrivateLinkResourcesServerTransport. +func (p *PrivateLinkResourcesServerTransport) 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 p.dispatchToMethodFake(req, method) +} + +func (p *PrivateLinkResourcesServerTransport) 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 privateLinkResourcesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateLinkResourcesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateLinkResourcesClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateLinkResourcesClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(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 (p *PrivateLinkResourcesServerTransport) 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\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + 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, vaultNameParam, 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 + } + return resp, nil +} + +func (p *PrivateLinkResourcesServerTransport) 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\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListPager(resourceGroupNameParam, vaultNameParam, nil) + newListPager = &resp + p.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.PrivateLinkResourcesClientListResponse, 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 +} + +// set this to conditionally intercept incoming requests to PrivateLinkResourcesServerTransport +var privateLinkResourcesServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditem_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditem_server.go index b68a8e66bd14..54c2659a9519 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditem_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditem_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 @@ -19,7 +15,6 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" "net/http" "net/url" - "reflect" "regexp" "strconv" ) @@ -28,10 +23,10 @@ import ( type ProtectedItemServer struct { // BeginCreate is the fake for method ProtectedItemClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body armrecoveryservicesdatareplication.ProtectedItemModel, options *armrecoveryservicesdatareplication.ProtectedItemClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, resource armrecoveryservicesdatareplication.ProtectedItemModel, options *armrecoveryservicesdatareplication.ProtectedItemClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method ProtectedItemClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *armrecoveryservicesdatareplication.ProtectedItemClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method ProtectedItemClient.Get @@ -44,7 +39,11 @@ type ProtectedItemServer struct { // BeginPlannedFailover is the fake for method ProtectedItemClient.BeginPlannedFailover // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginPlannedFailover func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *armrecoveryservicesdatareplication.ProtectedItemClientBeginPlannedFailoverOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientPlannedFailoverResponse], errResp azfake.ErrorResponder) + BeginPlannedFailover func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body armrecoveryservicesdatareplication.PlannedFailoverModel, options *armrecoveryservicesdatareplication.ProtectedItemClientBeginPlannedFailoverOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientPlannedFailoverResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method ProtectedItemClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, properties armrecoveryservicesdatareplication.ProtectedItemModelUpdate, options *armrecoveryservicesdatareplication.ProtectedItemClientBeginUpdateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientUpdateResponse], errResp azfake.ErrorResponder) } // NewProtectedItemServerTransport creates a new instance of ProtectedItemServerTransport with the provided implementation. @@ -57,6 +56,7 @@ func NewProtectedItemServerTransport(srv *ProtectedItemServer) *ProtectedItemSer beginDelete: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientDeleteResponse]](), newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.ProtectedItemClientListResponse]](), beginPlannedFailover: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientPlannedFailoverResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientUpdateResponse]](), } } @@ -68,6 +68,7 @@ type ProtectedItemServerTransport struct { beginDelete *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientDeleteResponse]] newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.ProtectedItemClientListResponse]] beginPlannedFailover *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientPlannedFailoverResponse]] + beginUpdate *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientUpdateResponse]] } // Do implements the policy.Transporter interface for ProtectedItemServerTransport. @@ -78,29 +79,50 @@ func (p *ProtectedItemServerTransport) Do(req *http.Request) (*http.Response, er return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "ProtectedItemClient.BeginCreate": - resp, err = p.dispatchBeginCreate(req) - case "ProtectedItemClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "ProtectedItemClient.Get": - resp, err = p.dispatchGet(req) - case "ProtectedItemClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - case "ProtectedItemClient.BeginPlannedFailover": - resp, err = p.dispatchBeginPlannedFailover(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *ProtectedItemServerTransport) 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 protectedItemServerTransportInterceptor != nil { + res.resp, res.err, intercepted = protectedItemServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ProtectedItemClient.BeginCreate": + res.resp, res.err = p.dispatchBeginCreate(req) + case "ProtectedItemClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "ProtectedItemClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "ProtectedItemClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + case "ProtectedItemClient.BeginPlannedFailover": + res.resp, res.err = p.dispatchBeginPlannedFailover(req) + case "ProtectedItemClient.BeginUpdate": + res.resp, res.err = p.dispatchBeginUpdate(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 (p *ProtectedItemServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -112,7 +134,7 @@ func (p *ProtectedItemServerTransport) dispatchBeginCreate(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.ProtectedItemModel](req) @@ -164,7 +186,7 @@ func (p *ProtectedItemServerTransport) dispatchBeginDelete(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -172,19 +194,19 @@ func (p *ProtectedItemServerTransport) dispatchBeginDelete(req *http.Request) (* if err != nil { return nil, err } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + forceDeleteUnescaped, err := url.QueryUnescape(qp.Get("forceDelete")) if err != nil { return nil, err } - protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) + forceDeleteParam, err := parseOptional(forceDeleteUnescaped, strconv.ParseBool) if err != nil { return nil, err } - forceDeleteUnescaped, err := url.QueryUnescape(qp.Get("forceDelete")) + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) if err != nil { return nil, err } - forceDeleteParam, err := parseOptional(forceDeleteUnescaped, strconv.ParseBool) + protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) if err != nil { return nil, err } @@ -207,9 +229,9 @@ func (p *ProtectedItemServerTransport) dispatchBeginDelete(req *http.Request) (* return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { p.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { p.beginDelete.remove(req) @@ -225,7 +247,7 @@ func (p *ProtectedItemServerTransport) dispatchGet(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -264,18 +286,51 @@ func (p *ProtectedItemServerTransport) dispatchNewListPager(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if 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 } + odataOptionsUnescaped, err := url.QueryUnescape(qp.Get("odataOptions")) + if err != nil { + return nil, err + } + odataOptionsParam := getOptional(odataOptionsUnescaped) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + if err != nil { + return nil, err + } + continuationTokenParam := getOptional(continuationTokenUnescaped) + 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 + } vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) if err != nil { return nil, err } - resp := p.srv.NewListPager(resourceGroupNameParam, vaultNameParam, nil) + var options *armrecoveryservicesdatareplication.ProtectedItemClientListOptions + if odataOptionsParam != nil || continuationTokenParam != nil || pageSizeParam != nil { + options = &armrecoveryservicesdatareplication.ProtectedItemClientListOptions{ + OdataOptions: odataOptionsParam, + ContinuationToken: continuationTokenParam, + PageSize: pageSizeParam, + } + } + resp := p.srv.NewListPager(resourceGroupNameParam, vaultNameParam, options) newListPager = &resp p.newListPager.add(req, newListPager) server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.ProtectedItemClientListResponse, createLink func() string) { @@ -305,7 +360,7 @@ func (p *ProtectedItemServerTransport) dispatchBeginPlannedFailover(req *http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/plannedFailover` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.PlannedFailoverModel](req) @@ -324,13 +379,7 @@ func (p *ProtectedItemServerTransport) dispatchBeginPlannedFailover(req *http.Re if err != nil { return nil, err } - var options *armrecoveryservicesdatareplication.ProtectedItemClientBeginPlannedFailoverOptions - if !reflect.ValueOf(body).IsZero() { - options = &armrecoveryservicesdatareplication.ProtectedItemClientBeginPlannedFailoverOptions{ - Body: &body, - } - } - respr, errRespr := p.srv.BeginPlannedFailover(req.Context(), resourceGroupNameParam, vaultNameParam, protectedItemNameParam, options) + respr, errRespr := p.srv.BeginPlannedFailover(req.Context(), resourceGroupNameParam, vaultNameParam, protectedItemNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -353,3 +402,61 @@ func (p *ProtectedItemServerTransport) dispatchBeginPlannedFailover(req *http.Re return resp, nil } + +func (p *ProtectedItemServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := p.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.ProtectedItemModelUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginUpdate(req.Context(), resourceGroupNameParam, vaultNameParam, protectedItemNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + p.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + p.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + p.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to ProtectedItemServerTransport +var protectedItemServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditemoperationstatus_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditemoperationstatus_server.go deleted file mode 100644 index 3065e3dcc190..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditemoperationstatus_server.go +++ /dev/null @@ -1,108 +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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "regexp" -) - -// ProtectedItemOperationStatusServer is a fake server for instances of the armrecoveryservicesdatareplication.ProtectedItemOperationStatusClient type. -type ProtectedItemOperationStatusServer struct { - // Get is the fake for method ProtectedItemOperationStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, operationID string, options *armrecoveryservicesdatareplication.ProtectedItemOperationStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.ProtectedItemOperationStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewProtectedItemOperationStatusServerTransport creates a new instance of ProtectedItemOperationStatusServerTransport with the provided implementation. -// The returned ProtectedItemOperationStatusServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.ProtectedItemOperationStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewProtectedItemOperationStatusServerTransport(srv *ProtectedItemOperationStatusServer) *ProtectedItemOperationStatusServerTransport { - return &ProtectedItemOperationStatusServerTransport{srv: srv} -} - -// ProtectedItemOperationStatusServerTransport connects instances of armrecoveryservicesdatareplication.ProtectedItemOperationStatusClient to instances of ProtectedItemOperationStatusServer. -// Don't use this type directly, use NewProtectedItemOperationStatusServerTransport instead. -type ProtectedItemOperationStatusServerTransport struct { - srv *ProtectedItemOperationStatusServer -} - -// Do implements the policy.Transporter interface for ProtectedItemOperationStatusServerTransport. -func (p *ProtectedItemOperationStatusServerTransport) 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 "ProtectedItemOperationStatusClient.Get": - resp, err = p.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *ProtectedItemOperationStatusServerTransport) 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\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?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 - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, protectedItemNameParam, operationIDParam, 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).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/recoverypoints_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/recoverypoint_server.go similarity index 61% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/recoverypoints_server.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/recoverypoint_server.go index ec18f4d60e6d..466b5cf71d73 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/recoverypoints_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/recoverypoint_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 @@ -22,69 +18,88 @@ import ( "regexp" ) -// RecoveryPointsServer is a fake server for instances of the armrecoveryservicesdatareplication.RecoveryPointsClient type. -type RecoveryPointsServer struct { - // Get is the fake for method RecoveryPointsClient.Get +// RecoveryPointServer is a fake server for instances of the armrecoveryservicesdatareplication.RecoveryPointClient type. +type RecoveryPointServer struct { + // Get is the fake for method RecoveryPointClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, recoveryPointName string, options *armrecoveryservicesdatareplication.RecoveryPointsClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.RecoveryPointsClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, recoveryPointName string, options *armrecoveryservicesdatareplication.RecoveryPointClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.RecoveryPointClientGetResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method RecoveryPointsClient.NewListPager + // NewListPager is the fake for method RecoveryPointClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, vaultName string, protectedItemName string, options *armrecoveryservicesdatareplication.RecoveryPointsClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.RecoveryPointsClientListResponse]) + NewListPager func(resourceGroupName string, vaultName string, protectedItemName string, options *armrecoveryservicesdatareplication.RecoveryPointClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.RecoveryPointClientListResponse]) } -// NewRecoveryPointsServerTransport creates a new instance of RecoveryPointsServerTransport with the provided implementation. -// The returned RecoveryPointsServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.RecoveryPointsClient via the +// NewRecoveryPointServerTransport creates a new instance of RecoveryPointServerTransport with the provided implementation. +// The returned RecoveryPointServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.RecoveryPointClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewRecoveryPointsServerTransport(srv *RecoveryPointsServer) *RecoveryPointsServerTransport { - return &RecoveryPointsServerTransport{ +func NewRecoveryPointServerTransport(srv *RecoveryPointServer) *RecoveryPointServerTransport { + return &RecoveryPointServerTransport{ srv: srv, - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.RecoveryPointsClientListResponse]](), + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.RecoveryPointClientListResponse]](), } } -// RecoveryPointsServerTransport connects instances of armrecoveryservicesdatareplication.RecoveryPointsClient to instances of RecoveryPointsServer. -// Don't use this type directly, use NewRecoveryPointsServerTransport instead. -type RecoveryPointsServerTransport struct { - srv *RecoveryPointsServer - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.RecoveryPointsClientListResponse]] +// RecoveryPointServerTransport connects instances of armrecoveryservicesdatareplication.RecoveryPointClient to instances of RecoveryPointServer. +// Don't use this type directly, use NewRecoveryPointServerTransport instead. +type RecoveryPointServerTransport struct { + srv *RecoveryPointServer + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.RecoveryPointClientListResponse]] } -// Do implements the policy.Transporter interface for RecoveryPointsServerTransport. -func (r *RecoveryPointsServerTransport) Do(req *http.Request) (*http.Response, error) { +// Do implements the policy.Transporter interface for RecoveryPointServerTransport. +func (r *RecoveryPointServerTransport) 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 + return r.dispatchToMethodFake(req, method) +} - switch method { - case "RecoveryPointsClient.Get": - resp, err = r.dispatchGet(req) - case "RecoveryPointsClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *RecoveryPointServerTransport) 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 recoveryPointServerTransportInterceptor != nil { + res.resp, res.err, intercepted = recoveryPointServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "RecoveryPointClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "RecoveryPointClient.NewListPager": + res.resp, res.err = r.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 (r *RecoveryPointsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { +func (r *RecoveryPointServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if r.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\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/recoveryPoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -118,7 +133,7 @@ func (r *RecoveryPointsServerTransport) dispatchGet(req *http.Request) (*http.Re return resp, nil } -func (r *RecoveryPointsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { +func (r *RecoveryPointServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { if r.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} } @@ -127,7 +142,7 @@ func (r *RecoveryPointsServerTransport) dispatchNewListPager(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/recoveryPoints` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -145,7 +160,7 @@ func (r *RecoveryPointsServerTransport) dispatchNewListPager(req *http.Request) resp := r.srv.NewListPager(resourceGroupNameParam, vaultNameParam, protectedItemNameParam, nil) newListPager = &resp r.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.RecoveryPointsClientListResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.RecoveryPointClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -162,3 +177,9 @@ func (r *RecoveryPointsServerTransport) dispatchNewListPager(req *http.Request) } return resp, nil } + +// set this to conditionally intercept incoming requests to RecoveryPointServerTransport +var recoveryPointServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextension_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextension_server.go index ef034f78cc16..9e8c2e44ba64 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextension_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextension_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 @@ -26,10 +22,10 @@ import ( type ReplicationExtensionServer struct { // BeginCreate is the fake for method ReplicationExtensionClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, body armrecoveryservicesdatareplication.ReplicationExtensionModel, options *armrecoveryservicesdatareplication.ReplicationExtensionClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ReplicationExtensionClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, resource armrecoveryservicesdatareplication.ReplicationExtensionModel, options *armrecoveryservicesdatareplication.ReplicationExtensionClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ReplicationExtensionClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method ReplicationExtensionClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, options *armrecoveryservicesdatareplication.ReplicationExtensionClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ReplicationExtensionClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method ReplicationExtensionClient.Get @@ -70,27 +66,46 @@ func (r *ReplicationExtensionServerTransport) Do(req *http.Request) (*http.Respo return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return r.dispatchToMethodFake(req, method) +} - switch method { - case "ReplicationExtensionClient.BeginCreate": - resp, err = r.dispatchBeginCreate(req) - case "ReplicationExtensionClient.BeginDelete": - resp, err = r.dispatchBeginDelete(req) - case "ReplicationExtensionClient.Get": - resp, err = r.dispatchGet(req) - case "ReplicationExtensionClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *ReplicationExtensionServerTransport) 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 replicationExtensionServerTransportInterceptor != nil { + res.resp, res.err, intercepted = replicationExtensionServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ReplicationExtensionClient.BeginCreate": + res.resp, res.err = r.dispatchBeginCreate(req) + case "ReplicationExtensionClient.BeginDelete": + res.resp, res.err = r.dispatchBeginDelete(req) + case "ReplicationExtensionClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "ReplicationExtensionClient.NewListPager": + res.resp, res.err = r.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 (r *ReplicationExtensionServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -102,7 +117,7 @@ func (r *ReplicationExtensionServerTransport) dispatchBeginCreate(req *http.Requ const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicationExtensions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.ReplicationExtensionModel](req) @@ -154,7 +169,7 @@ func (r *ReplicationExtensionServerTransport) dispatchBeginDelete(req *http.Requ const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicationExtensions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -182,9 +197,9 @@ func (r *ReplicationExtensionServerTransport) dispatchBeginDelete(req *http.Requ return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { r.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { r.beginDelete.remove(req) @@ -200,7 +215,7 @@ func (r *ReplicationExtensionServerTransport) dispatchGet(req *http.Request) (*h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicationExtensions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -239,7 +254,7 @@ func (r *ReplicationExtensionServerTransport) dispatchNewListPager(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicationExtensions` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -270,3 +285,9 @@ func (r *ReplicationExtensionServerTransport) dispatchNewListPager(req *http.Req } return resp, nil } + +// set this to conditionally intercept incoming requests to ReplicationExtensionServerTransport +var replicationExtensionServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextensionoperationstatus_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextensionoperationstatus_server.go deleted file mode 100644 index 7c20722dafe9..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextensionoperationstatus_server.go +++ /dev/null @@ -1,108 +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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "regexp" -) - -// ReplicationExtensionOperationStatusServer is a fake server for instances of the armrecoveryservicesdatareplication.ReplicationExtensionOperationStatusClient type. -type ReplicationExtensionOperationStatusServer struct { - // Get is the fake for method ReplicationExtensionOperationStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, operationID string, options *armrecoveryservicesdatareplication.ReplicationExtensionOperationStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.ReplicationExtensionOperationStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewReplicationExtensionOperationStatusServerTransport creates a new instance of ReplicationExtensionOperationStatusServerTransport with the provided implementation. -// The returned ReplicationExtensionOperationStatusServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.ReplicationExtensionOperationStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewReplicationExtensionOperationStatusServerTransport(srv *ReplicationExtensionOperationStatusServer) *ReplicationExtensionOperationStatusServerTransport { - return &ReplicationExtensionOperationStatusServerTransport{srv: srv} -} - -// ReplicationExtensionOperationStatusServerTransport connects instances of armrecoveryservicesdatareplication.ReplicationExtensionOperationStatusClient to instances of ReplicationExtensionOperationStatusServer. -// Don't use this type directly, use NewReplicationExtensionOperationStatusServerTransport instead. -type ReplicationExtensionOperationStatusServerTransport struct { - srv *ReplicationExtensionOperationStatusServer -} - -// Do implements the policy.Transporter interface for ReplicationExtensionOperationStatusServerTransport. -func (r *ReplicationExtensionOperationStatusServerTransport) 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 "ReplicationExtensionOperationStatusClient.Get": - resp, err = r.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (r *ReplicationExtensionOperationStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if r.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\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicationExtensions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?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 - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - replicationExtensionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("replicationExtensionName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, replicationExtensionNameParam, operationIDParam, 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).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/server_factory.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/server_factory.go index 0f5380690e21..7b9c084e9c0c 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/server_factory.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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,25 +15,59 @@ import ( // ServerFactory is a fake server for instances of the armrecoveryservicesdatareplication.ClientFactory type. type ServerFactory struct { - AzureSiteRecoveryManagementServiceAPIServer AzureSiteRecoveryManagementServiceAPIServer - DraServer DraServer - DraOperationStatusServer DraOperationStatusServer - EmailConfigurationServer EmailConfigurationServer - EventServer EventServer - FabricServer FabricServer - FabricOperationsStatusServer FabricOperationsStatusServer - OperationsServer OperationsServer - PolicyServer PolicyServer - PolicyOperationStatusServer PolicyOperationStatusServer - ProtectedItemServer ProtectedItemServer - ProtectedItemOperationStatusServer ProtectedItemOperationStatusServer - RecoveryPointsServer RecoveryPointsServer - ReplicationExtensionServer ReplicationExtensionServer - ReplicationExtensionOperationStatusServer ReplicationExtensionOperationStatusServer - VaultServer VaultServer - VaultOperationStatusServer VaultOperationStatusServer - WorkflowServer WorkflowServer - WorkflowOperationStatusServer WorkflowOperationStatusServer + // CheckNameAvailabilityServer contains the fakes for client CheckNameAvailabilityClient + CheckNameAvailabilityServer CheckNameAvailabilityServer + + // DeploymentPreflightServer contains the fakes for client DeploymentPreflightClient + DeploymentPreflightServer DeploymentPreflightServer + + // EmailConfigurationServer contains the fakes for client EmailConfigurationClient + EmailConfigurationServer EmailConfigurationServer + + // EventServer contains the fakes for client EventClient + EventServer EventServer + + // FabricAgentServer contains the fakes for client FabricAgentClient + FabricAgentServer FabricAgentServer + + // FabricServer contains the fakes for client FabricClient + FabricServer FabricServer + + // JobServer contains the fakes for client JobClient + JobServer JobServer + + // LocationBasedOperationResultsServer contains the fakes for client LocationBasedOperationResultsClient + LocationBasedOperationResultsServer LocationBasedOperationResultsServer + + // OperationResultsServer contains the fakes for client OperationResultsClient + OperationResultsServer OperationResultsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // PolicyServer contains the fakes for client PolicyClient + PolicyServer PolicyServer + + // PrivateEndpointConnectionProxiesServer contains the fakes for client PrivateEndpointConnectionProxiesClient + PrivateEndpointConnectionProxiesServer PrivateEndpointConnectionProxiesServer + + // PrivateEndpointConnectionsServer contains the fakes for client PrivateEndpointConnectionsClient + PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer + + // PrivateLinkResourcesServer contains the fakes for client PrivateLinkResourcesClient + PrivateLinkResourcesServer PrivateLinkResourcesServer + + // ProtectedItemServer contains the fakes for client ProtectedItemClient + ProtectedItemServer ProtectedItemServer + + // RecoveryPointServer contains the fakes for client RecoveryPointClient + RecoveryPointServer RecoveryPointServer + + // ReplicationExtensionServer contains the fakes for client ReplicationExtensionClient + ReplicationExtensionServer ReplicationExtensionServer + + // VaultServer contains the fakes for client VaultClient + VaultServer VaultServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -52,27 +82,26 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armrecoveryservicesdatareplication.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trAzureSiteRecoveryManagementServiceAPIServer *AzureSiteRecoveryManagementServiceAPIServerTransport - trDraServer *DraServerTransport - trDraOperationStatusServer *DraOperationStatusServerTransport - trEmailConfigurationServer *EmailConfigurationServerTransport - trEventServer *EventServerTransport - trFabricServer *FabricServerTransport - trFabricOperationsStatusServer *FabricOperationsStatusServerTransport - trOperationsServer *OperationsServerTransport - trPolicyServer *PolicyServerTransport - trPolicyOperationStatusServer *PolicyOperationStatusServerTransport - trProtectedItemServer *ProtectedItemServerTransport - trProtectedItemOperationStatusServer *ProtectedItemOperationStatusServerTransport - trRecoveryPointsServer *RecoveryPointsServerTransport - trReplicationExtensionServer *ReplicationExtensionServerTransport - trReplicationExtensionOperationStatusServer *ReplicationExtensionOperationStatusServerTransport - trVaultServer *VaultServerTransport - trVaultOperationStatusServer *VaultOperationStatusServerTransport - trWorkflowServer *WorkflowServerTransport - trWorkflowOperationStatusServer *WorkflowOperationStatusServerTransport + srv *ServerFactory + trMu sync.Mutex + trCheckNameAvailabilityServer *CheckNameAvailabilityServerTransport + trDeploymentPreflightServer *DeploymentPreflightServerTransport + trEmailConfigurationServer *EmailConfigurationServerTransport + trEventServer *EventServerTransport + trFabricAgentServer *FabricAgentServerTransport + trFabricServer *FabricServerTransport + trJobServer *JobServerTransport + trLocationBasedOperationResultsServer *LocationBasedOperationResultsServerTransport + trOperationResultsServer *OperationResultsServerTransport + trOperationsServer *OperationsServerTransport + trPolicyServer *PolicyServerTransport + trPrivateEndpointConnectionProxiesServer *PrivateEndpointConnectionProxiesServerTransport + trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport + trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport + trProtectedItemServer *ProtectedItemServerTransport + trRecoveryPointServer *RecoveryPointServerTransport + trReplicationExtensionServer *ReplicationExtensionServerTransport + trVaultServer *VaultServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -88,19 +117,16 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { - case "AzureSiteRecoveryManagementServiceAPIClient": - initServer(s, &s.trAzureSiteRecoveryManagementServiceAPIServer, func() *AzureSiteRecoveryManagementServiceAPIServerTransport { - return NewAzureSiteRecoveryManagementServiceAPIServerTransport(&s.srv.AzureSiteRecoveryManagementServiceAPIServer) + case "CheckNameAvailabilityClient": + initServer(s, &s.trCheckNameAvailabilityServer, func() *CheckNameAvailabilityServerTransport { + return NewCheckNameAvailabilityServerTransport(&s.srv.CheckNameAvailabilityServer) }) - resp, err = s.trAzureSiteRecoveryManagementServiceAPIServer.Do(req) - case "DraClient": - initServer(s, &s.trDraServer, func() *DraServerTransport { return NewDraServerTransport(&s.srv.DraServer) }) - resp, err = s.trDraServer.Do(req) - case "DraOperationStatusClient": - initServer(s, &s.trDraOperationStatusServer, func() *DraOperationStatusServerTransport { - return NewDraOperationStatusServerTransport(&s.srv.DraOperationStatusServer) + resp, err = s.trCheckNameAvailabilityServer.Do(req) + case "DeploymentPreflightClient": + initServer(s, &s.trDeploymentPreflightServer, func() *DeploymentPreflightServerTransport { + return NewDeploymentPreflightServerTransport(&s.srv.DeploymentPreflightServer) }) - resp, err = s.trDraOperationStatusServer.Do(req) + resp, err = s.trDeploymentPreflightServer.Do(req) case "EmailConfigurationClient": initServer(s, &s.trEmailConfigurationServer, func() *EmailConfigurationServerTransport { return NewEmailConfigurationServerTransport(&s.srv.EmailConfigurationServer) @@ -109,66 +135,64 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "EventClient": initServer(s, &s.trEventServer, func() *EventServerTransport { return NewEventServerTransport(&s.srv.EventServer) }) resp, err = s.trEventServer.Do(req) + case "FabricAgentClient": + initServer(s, &s.trFabricAgentServer, func() *FabricAgentServerTransport { return NewFabricAgentServerTransport(&s.srv.FabricAgentServer) }) + resp, err = s.trFabricAgentServer.Do(req) case "FabricClient": initServer(s, &s.trFabricServer, func() *FabricServerTransport { return NewFabricServerTransport(&s.srv.FabricServer) }) resp, err = s.trFabricServer.Do(req) - case "FabricOperationsStatusClient": - initServer(s, &s.trFabricOperationsStatusServer, func() *FabricOperationsStatusServerTransport { - return NewFabricOperationsStatusServerTransport(&s.srv.FabricOperationsStatusServer) + case "JobClient": + initServer(s, &s.trJobServer, func() *JobServerTransport { return NewJobServerTransport(&s.srv.JobServer) }) + resp, err = s.trJobServer.Do(req) + case "LocationBasedOperationResultsClient": + initServer(s, &s.trLocationBasedOperationResultsServer, func() *LocationBasedOperationResultsServerTransport { + return NewLocationBasedOperationResultsServerTransport(&s.srv.LocationBasedOperationResultsServer) + }) + resp, err = s.trLocationBasedOperationResultsServer.Do(req) + case "OperationResultsClient": + initServer(s, &s.trOperationResultsServer, func() *OperationResultsServerTransport { + return NewOperationResultsServerTransport(&s.srv.OperationResultsServer) }) - resp, err = s.trFabricOperationsStatusServer.Do(req) + resp, err = s.trOperationResultsServer.Do(req) case "OperationsClient": initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) case "PolicyClient": initServer(s, &s.trPolicyServer, func() *PolicyServerTransport { return NewPolicyServerTransport(&s.srv.PolicyServer) }) resp, err = s.trPolicyServer.Do(req) - case "PolicyOperationStatusClient": - initServer(s, &s.trPolicyOperationStatusServer, func() *PolicyOperationStatusServerTransport { - return NewPolicyOperationStatusServerTransport(&s.srv.PolicyOperationStatusServer) + case "PrivateEndpointConnectionProxiesClient": + initServer(s, &s.trPrivateEndpointConnectionProxiesServer, func() *PrivateEndpointConnectionProxiesServerTransport { + return NewPrivateEndpointConnectionProxiesServerTransport(&s.srv.PrivateEndpointConnectionProxiesServer) }) - resp, err = s.trPolicyOperationStatusServer.Do(req) + resp, err = s.trPrivateEndpointConnectionProxiesServer.Do(req) + case "PrivateEndpointConnectionsClient": + initServer(s, &s.trPrivateEndpointConnectionsServer, func() *PrivateEndpointConnectionsServerTransport { + return NewPrivateEndpointConnectionsServerTransport(&s.srv.PrivateEndpointConnectionsServer) + }) + resp, err = s.trPrivateEndpointConnectionsServer.Do(req) + case "PrivateLinkResourcesClient": + initServer(s, &s.trPrivateLinkResourcesServer, func() *PrivateLinkResourcesServerTransport { + return NewPrivateLinkResourcesServerTransport(&s.srv.PrivateLinkResourcesServer) + }) + resp, err = s.trPrivateLinkResourcesServer.Do(req) case "ProtectedItemClient": initServer(s, &s.trProtectedItemServer, func() *ProtectedItemServerTransport { return NewProtectedItemServerTransport(&s.srv.ProtectedItemServer) }) resp, err = s.trProtectedItemServer.Do(req) - case "ProtectedItemOperationStatusClient": - initServer(s, &s.trProtectedItemOperationStatusServer, func() *ProtectedItemOperationStatusServerTransport { - return NewProtectedItemOperationStatusServerTransport(&s.srv.ProtectedItemOperationStatusServer) - }) - resp, err = s.trProtectedItemOperationStatusServer.Do(req) - case "RecoveryPointsClient": - initServer(s, &s.trRecoveryPointsServer, func() *RecoveryPointsServerTransport { - return NewRecoveryPointsServerTransport(&s.srv.RecoveryPointsServer) + case "RecoveryPointClient": + initServer(s, &s.trRecoveryPointServer, func() *RecoveryPointServerTransport { + return NewRecoveryPointServerTransport(&s.srv.RecoveryPointServer) }) - resp, err = s.trRecoveryPointsServer.Do(req) + resp, err = s.trRecoveryPointServer.Do(req) case "ReplicationExtensionClient": initServer(s, &s.trReplicationExtensionServer, func() *ReplicationExtensionServerTransport { return NewReplicationExtensionServerTransport(&s.srv.ReplicationExtensionServer) }) resp, err = s.trReplicationExtensionServer.Do(req) - case "ReplicationExtensionOperationStatusClient": - initServer(s, &s.trReplicationExtensionOperationStatusServer, func() *ReplicationExtensionOperationStatusServerTransport { - return NewReplicationExtensionOperationStatusServerTransport(&s.srv.ReplicationExtensionOperationStatusServer) - }) - resp, err = s.trReplicationExtensionOperationStatusServer.Do(req) case "VaultClient": initServer(s, &s.trVaultServer, func() *VaultServerTransport { return NewVaultServerTransport(&s.srv.VaultServer) }) resp, err = s.trVaultServer.Do(req) - case "VaultOperationStatusClient": - initServer(s, &s.trVaultOperationStatusServer, func() *VaultOperationStatusServerTransport { - return NewVaultOperationStatusServerTransport(&s.srv.VaultOperationStatusServer) - }) - resp, err = s.trVaultOperationStatusServer.Do(req) - case "WorkflowClient": - initServer(s, &s.trWorkflowServer, func() *WorkflowServerTransport { return NewWorkflowServerTransport(&s.srv.WorkflowServer) }) - resp, err = s.trWorkflowServer.Do(req) - case "WorkflowOperationStatusClient": - initServer(s, &s.trWorkflowOperationStatusServer, func() *WorkflowOperationStatusServerTransport { - return NewWorkflowOperationStatusServerTransport(&s.srv.WorkflowOperationStatusServer) - }) - resp, err = s.trWorkflowOperationStatusServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/time_rfc3339.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/time_rfc3339.go deleted file mode 100644 index b0535a7b63e6..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/time_rfc3339.go +++ /dev/null @@ -1,86 +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 ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "regexp" - "strings" - "time" -) - -// 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+)*"*$`) - -const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { - layout = dateTimeJSON - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { - layout = time.RFC3339Nano - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vault_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vault_server.go index 632d5724589f..5640145d896b 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vault_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vault_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 @@ -26,10 +22,10 @@ import ( type VaultServer struct { // BeginCreate is the fake for method VaultClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, vaultName string, body armrecoveryservicesdatareplication.VaultModel, options *armrecoveryservicesdatareplication.VaultClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.VaultClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, vaultName string, resource armrecoveryservicesdatareplication.VaultModel, options *armrecoveryservicesdatareplication.VaultClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.VaultClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method VaultClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, vaultName string, options *armrecoveryservicesdatareplication.VaultClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.VaultClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method VaultClient.Get @@ -46,7 +42,7 @@ type VaultServer struct { // BeginUpdate is the fake for method VaultClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, vaultName string, body armrecoveryservicesdatareplication.VaultModelUpdate, options *armrecoveryservicesdatareplication.VaultClientBeginUpdateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.VaultClientUpdateResponse], errResp azfake.ErrorResponder) + BeginUpdate func(ctx context.Context, resourceGroupName string, vaultName string, properties armrecoveryservicesdatareplication.VaultModelUpdate, options *armrecoveryservicesdatareplication.VaultClientBeginUpdateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.VaultClientUpdateResponse], errResp azfake.ErrorResponder) } // NewVaultServerTransport creates a new instance of VaultServerTransport with the provided implementation. @@ -82,31 +78,50 @@ func (v *VaultServerTransport) 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 v.dispatchToMethodFake(req, method) +} - switch method { - case "VaultClient.BeginCreate": - resp, err = v.dispatchBeginCreate(req) - case "VaultClient.BeginDelete": - resp, err = v.dispatchBeginDelete(req) - case "VaultClient.Get": - resp, err = v.dispatchGet(req) - case "VaultClient.NewListPager": - resp, err = v.dispatchNewListPager(req) - case "VaultClient.NewListBySubscriptionPager": - resp, err = v.dispatchNewListBySubscriptionPager(req) - case "VaultClient.BeginUpdate": - resp, err = v.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (v *VaultServerTransport) 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 vaultServerTransportInterceptor != nil { + res.resp, res.err, intercepted = vaultServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "VaultClient.BeginCreate": + res.resp, res.err = v.dispatchBeginCreate(req) + case "VaultClient.BeginDelete": + res.resp, res.err = v.dispatchBeginDelete(req) + case "VaultClient.Get": + res.resp, res.err = v.dispatchGet(req) + case "VaultClient.NewListPager": + res.resp, res.err = v.dispatchNewListPager(req) + case "VaultClient.NewListBySubscriptionPager": + res.resp, res.err = v.dispatchNewListBySubscriptionPager(req) + case "VaultClient.BeginUpdate": + res.resp, res.err = v.dispatchBeginUpdate(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 (v *VaultServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -118,7 +133,7 @@ func (v *VaultServerTransport) dispatchBeginCreate(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.VaultModel](req) @@ -166,7 +181,7 @@ func (v *VaultServerTransport) dispatchBeginDelete(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -190,9 +205,9 @@ func (v *VaultServerTransport) dispatchBeginDelete(req *http.Request) (*http.Res return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { v.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { v.beginDelete.remove(req) @@ -208,7 +223,7 @@ func (v *VaultServerTransport) dispatchGet(req *http.Request) (*http.Response, e const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -243,7 +258,7 @@ func (v *VaultServerTransport) dispatchNewListPager(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -292,22 +307,10 @@ func (v *VaultServerTransport) dispatchNewListBySubscriptionPager(req *http.Requ const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - qp := req.URL.Query() - continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) - if err != nil { - return nil, err - } - continuationTokenParam := getOptional(continuationTokenUnescaped) - var options *armrecoveryservicesdatareplication.VaultClientListBySubscriptionOptions - if continuationTokenParam != nil { - options = &armrecoveryservicesdatareplication.VaultClientListBySubscriptionOptions{ - ContinuationToken: continuationTokenParam, - } - } - resp := v.srv.NewListBySubscriptionPager(options) + resp := v.srv.NewListBySubscriptionPager(nil) newListBySubscriptionPager = &resp v.newListBySubscriptionPager.add(req, newListBySubscriptionPager) server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armrecoveryservicesdatareplication.VaultClientListBySubscriptionResponse, createLink func() string) { @@ -337,7 +340,7 @@ func (v *VaultServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.VaultModelUpdate](req) @@ -375,3 +378,9 @@ func (v *VaultServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Res return resp, nil } + +// set this to conditionally intercept incoming requests to VaultServerTransport +var vaultServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vaultoperationstatus_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vaultoperationstatus_server.go deleted file mode 100644 index 510518d046ea..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vaultoperationstatus_server.go +++ /dev/null @@ -1,104 +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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "regexp" -) - -// VaultOperationStatusServer is a fake server for instances of the armrecoveryservicesdatareplication.VaultOperationStatusClient type. -type VaultOperationStatusServer struct { - // Get is the fake for method VaultOperationStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *armrecoveryservicesdatareplication.VaultOperationStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.VaultOperationStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewVaultOperationStatusServerTransport creates a new instance of VaultOperationStatusServerTransport with the provided implementation. -// The returned VaultOperationStatusServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.VaultOperationStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewVaultOperationStatusServerTransport(srv *VaultOperationStatusServer) *VaultOperationStatusServerTransport { - return &VaultOperationStatusServerTransport{srv: srv} -} - -// VaultOperationStatusServerTransport connects instances of armrecoveryservicesdatareplication.VaultOperationStatusClient to instances of VaultOperationStatusServer. -// Don't use this type directly, use NewVaultOperationStatusServerTransport instead. -type VaultOperationStatusServerTransport struct { - srv *VaultOperationStatusServer -} - -// Do implements the policy.Transporter interface for VaultOperationStatusServerTransport. -func (v *VaultOperationStatusServerTransport) 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 "VaultOperationStatusClient.Get": - resp, err = v.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (v *VaultOperationStatusServerTransport) 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\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?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 - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := v.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, operationIDParam, 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).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/workflowoperationstatus_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/workflowoperationstatus_server.go deleted file mode 100644 index f5a3d46502dd..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/workflowoperationstatus_server.go +++ /dev/null @@ -1,108 +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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "regexp" -) - -// WorkflowOperationStatusServer is a fake server for instances of the armrecoveryservicesdatareplication.WorkflowOperationStatusClient type. -type WorkflowOperationStatusServer struct { - // Get is the fake for method WorkflowOperationStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, jobName string, operationID string, options *armrecoveryservicesdatareplication.WorkflowOperationStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.WorkflowOperationStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewWorkflowOperationStatusServerTransport creates a new instance of WorkflowOperationStatusServerTransport with the provided implementation. -// The returned WorkflowOperationStatusServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.WorkflowOperationStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewWorkflowOperationStatusServerTransport(srv *WorkflowOperationStatusServer) *WorkflowOperationStatusServerTransport { - return &WorkflowOperationStatusServerTransport{srv: srv} -} - -// WorkflowOperationStatusServerTransport connects instances of armrecoveryservicesdatareplication.WorkflowOperationStatusClient to instances of WorkflowOperationStatusServer. -// Don't use this type directly, use NewWorkflowOperationStatusServerTransport instead. -type WorkflowOperationStatusServerTransport struct { - srv *WorkflowOperationStatusServer -} - -// Do implements the policy.Transporter interface for WorkflowOperationStatusServerTransport. -func (w *WorkflowOperationStatusServerTransport) 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 "WorkflowOperationStatusClient.Get": - resp, err = w.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (w *WorkflowOperationStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if w.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\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?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 - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := w.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, jobNameParam, operationIDParam, 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).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/interfaces.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/interfaces.go index 5cb38b340968..dbf598420a24 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/interfaces.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/interfaces.go @@ -1,31 +1,27 @@ -//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 armrecoveryservicesdatareplication -// DraModelCustomPropertiesClassification provides polymorphic access to related types. -// Call the interface's GetDraModelCustomProperties() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *DraModelCustomProperties, *VMwareDraModelCustomProperties -type DraModelCustomPropertiesClassification interface { - // GetDraModelCustomProperties returns the DraModelCustomProperties content of the underlying type. - GetDraModelCustomProperties() *DraModelCustomProperties -} - // EventModelCustomPropertiesClassification provides polymorphic access to related types. // Call the interface's GetEventModelCustomProperties() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *EventModelCustomProperties, *HyperVToAzStackHCIEventModelCustomProperties +// - *EventModelCustomProperties, *HyperVToAzStackHCIEventModelCustomProperties, *VMwareToAzStackHCIEventModelCustomProperties type EventModelCustomPropertiesClassification interface { // GetEventModelCustomProperties returns the EventModelCustomProperties content of the underlying type. GetEventModelCustomProperties() *EventModelCustomProperties } +// FabricAgentModelCustomPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetFabricAgentModelCustomProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *FabricAgentModelCustomProperties, *VMwareFabricAgentModelCustomProperties +type FabricAgentModelCustomPropertiesClassification interface { + // GetFabricAgentModelCustomProperties returns the FabricAgentModelCustomProperties content of the underlying type. + GetFabricAgentModelCustomProperties() *FabricAgentModelCustomProperties +} + // FabricModelCustomPropertiesClassification provides polymorphic access to related types. // Call the interface's GetFabricModelCustomProperties() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -35,6 +31,15 @@ type FabricModelCustomPropertiesClassification interface { GetFabricModelCustomProperties() *FabricModelCustomProperties } +// JobModelCustomPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetJobModelCustomProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *FailoverJobModelCustomProperties, *JobModelCustomProperties, *TestFailoverCleanupJobModelCustomProperties, *TestFailoverJobModelCustomProperties +type JobModelCustomPropertiesClassification interface { + // GetJobModelCustomProperties returns the JobModelCustomProperties content of the underlying type. + GetJobModelCustomProperties() *JobModelCustomProperties +} + // PlannedFailoverModelCustomPropertiesClassification provides polymorphic access to related types. // Call the interface's GetPlannedFailoverModelCustomProperties() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -62,10 +67,19 @@ type ProtectedItemModelCustomPropertiesClassification interface { GetProtectedItemModelCustomProperties() *ProtectedItemModelCustomProperties } +// ProtectedItemModelCustomPropertiesUpdateClassification provides polymorphic access to related types. +// Call the interface's GetProtectedItemModelCustomPropertiesUpdate() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate, *ProtectedItemModelCustomPropertiesUpdate, *VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate +type ProtectedItemModelCustomPropertiesUpdateClassification interface { + // GetProtectedItemModelCustomPropertiesUpdate returns the ProtectedItemModelCustomPropertiesUpdate content of the underlying type. + GetProtectedItemModelCustomPropertiesUpdate() *ProtectedItemModelCustomPropertiesUpdate +} + // RecoveryPointModelCustomPropertiesClassification provides polymorphic access to related types. // Call the interface's GetRecoveryPointModelCustomProperties() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *HyperVToAzStackHCIRecoveryPointModelCustomProperties, *RecoveryPointModelCustomProperties +// - *HyperVToAzStackHCIRecoveryPointModelCustomProperties, *RecoveryPointModelCustomProperties, *VMwareToAzStackHCIRecoveryPointModelCustomProperties type RecoveryPointModelCustomPropertiesClassification interface { // GetRecoveryPointModelCustomProperties returns the RecoveryPointModelCustomProperties content of the underlying type. GetRecoveryPointModelCustomProperties() *RecoveryPointModelCustomProperties @@ -79,13 +93,3 @@ type ReplicationExtensionModelCustomPropertiesClassification interface { // GetReplicationExtensionModelCustomProperties returns the ReplicationExtensionModelCustomProperties content of the underlying type. GetReplicationExtensionModelCustomProperties() *ReplicationExtensionModelCustomProperties } - -// WorkflowModelCustomPropertiesClassification provides polymorphic access to related types. -// Call the interface's GetWorkflowModelCustomProperties() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *FailoverWorkflowModelCustomProperties, *TestFailoverCleanupWorkflowModelCustomProperties, *TestFailoverWorkflowModelCustomProperties, -// - *WorkflowModelCustomProperties -type WorkflowModelCustomPropertiesClassification interface { - // GetWorkflowModelCustomProperties returns the WorkflowModelCustomProperties content of the underlying type. - GetWorkflowModelCustomProperties() *WorkflowModelCustomProperties -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflow_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/job_client.go similarity index 62% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflow_client.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/job_client.go index 65bfc24d57d1..f2f87a0c8e9c 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflow_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/job_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 armrecoveryservicesdatareplication @@ -17,26 +13,27 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" + "strconv" "strings" ) -// WorkflowClient contains the methods for the Workflow group. -// Don't use this type directly, use NewWorkflowClient() instead. -type WorkflowClient struct { +// JobClient contains the methods for the Job group. +// Don't use this type directly, use NewJobClient() instead. +type JobClient struct { internal *arm.Client subscriptionID string } -// NewWorkflowClient creates a new instance of WorkflowClient with the specified values. +// NewJobClient creates a new instance of JobClient 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 NewWorkflowClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkflowClient, error) { +func NewJobClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JobClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &WorkflowClient{ + client := &JobClient{ subscriptionID: subscriptionID, internal: cl, } @@ -46,35 +43,35 @@ func NewWorkflowClient(subscriptionID string, credential azcore.TokenCredential, // Get - Gets the details of the job. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. -// - jobName - The job (workflow) name. -// - options - WorkflowClientGetOptions contains the optional parameters for the WorkflowClient.Get method. -func (client *WorkflowClient) Get(ctx context.Context, resourceGroupName string, vaultName string, jobName string, options *WorkflowClientGetOptions) (WorkflowClientGetResponse, error) { +// - jobName - The job name. +// - options - JobClientGetOptions contains the optional parameters for the JobClient.Get method. +func (client *JobClient) Get(ctx context.Context, resourceGroupName string, vaultName string, jobName string, options *JobClientGetOptions) (JobClientGetResponse, error) { var err error - const operationName = "WorkflowClient.Get" + const operationName = "JobClient.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, vaultName, jobName, options) if err != nil { - return WorkflowClientGetResponse{}, err + return JobClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return WorkflowClientGetResponse{}, err + return JobClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return WorkflowClientGetResponse{}, err + return JobClientGetResponse{}, err } resp, err := client.getHandleResponse(httpResp) return resp, err } // getCreateRequest creates the Get request. -func (client *WorkflowClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, jobName string, options *WorkflowClientGetOptions) (*policy.Request, error) { +func (client *JobClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, jobName string, _ *JobClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -97,34 +94,34 @@ func (client *WorkflowClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getHandleResponse handles the Get response. -func (client *WorkflowClient) getHandleResponse(resp *http.Response) (WorkflowClientGetResponse, error) { - result := WorkflowClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowModel); err != nil { - return WorkflowClientGetResponse{}, err +func (client *JobClient) getHandleResponse(resp *http.Response) (JobClientGetResponse, error) { + result := JobClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.JobModel); err != nil { + return JobClientGetResponse{}, err } return result, nil } // NewListPager - Gets the list of jobs in the given vault. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. -// - options - WorkflowClientListOptions contains the optional parameters for the WorkflowClient.NewListPager method. -func (client *WorkflowClient) NewListPager(resourceGroupName string, vaultName string, options *WorkflowClientListOptions) *runtime.Pager[WorkflowClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[WorkflowClientListResponse]{ - More: func(page WorkflowClientListResponse) bool { +// - options - JobClientListOptions contains the optional parameters for the JobClient.NewListPager method. +func (client *JobClient) NewListPager(resourceGroupName string, vaultName string, options *JobClientListOptions) *runtime.Pager[JobClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[JobClientListResponse]{ + More: func(page JobClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *WorkflowClientListResponse) (WorkflowClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WorkflowClient.NewListPager") + Fetcher: func(ctx context.Context, page *JobClientListResponse) (JobClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "JobClient.NewListPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -133,7 +130,7 @@ func (client *WorkflowClient) NewListPager(resourceGroupName string, vaultName s return client.listCreateRequest(ctx, resourceGroupName, vaultName, options) }, nil) if err != nil { - return WorkflowClientListResponse{}, err + return JobClientListResponse{}, err } return client.listHandleResponse(resp) }, @@ -142,7 +139,7 @@ func (client *WorkflowClient) NewListPager(resourceGroupName string, vaultName s } // listCreateRequest creates the List request. -func (client *WorkflowClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *WorkflowClientListOptions) (*policy.Request, error) { +func (client *JobClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *JobClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -161,23 +158,26 @@ func (client *WorkflowClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } + reqQP.Set("api-version", "2024-09-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } - reqQP.Set("api-version", "2021-02-16-preview") + if options != nil && options.OdataOptions != nil { + reqQP.Set("odataOptions", *options.OdataOptions) + } + if options != nil && options.PageSize != nil { + reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // listHandleResponse handles the List response. -func (client *WorkflowClient) listHandleResponse(resp *http.Response) (WorkflowClientListResponse, error) { - result := WorkflowClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowModelCollection); err != nil { - return WorkflowClientListResponse{}, err +func (client *JobClient) listHandleResponse(resp *http.Response) (JobClientListResponse, error) { + result := JobClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.JobModelListResult); err != nil { + return JobClientListResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflow_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/job_client_example_test.go similarity index 64% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflow_client_example_test.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/job_client_example_test.go index 8d903c16530e..02925782b0c6 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflow_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/job_client_example_test.go @@ -1,115 +1,105 @@ -//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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Workflow_Get.json -func ExampleWorkflowClient_Get() { +// Generated from example definition: 2024-09-01/Job_Get.json +func ExampleJobClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewWorkflowClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "ZGH4y", nil) + res, err := clientFactory.NewJobClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "ZGH4y", 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.WorkflowModel = armrecoveryservicesdatareplication.WorkflowModel{ - // Name: to.Ptr("ukii"), - // Type: to.Ptr("cswros"), - // ID: to.Ptr("zsyhbwznbkaia"), - // Properties: &armrecoveryservicesdatareplication.WorkflowModelProperties{ - // ActivityID: to.Ptr("esjvxsa"), - // AllowedActions: []*string{ - // to.Ptr("mfsyvxzgmcpgdzfbbhoxrzhya")}, - // CustomProperties: &armrecoveryservicesdatareplication.WorkflowModelCustomProperties{ - // AffectedObjectDetails: map[string]*string{ - // "key7245": to.Ptr("yllr"), - // }, - // InstanceType: to.Ptr("WorkflowModelCustomProperties"), - // }, + // res = armrecoveryservicesdatareplication.JobClientGetResponse{ + // JobModel: &armrecoveryservicesdatareplication.JobModel{ + // Properties: &armrecoveryservicesdatareplication.JobModelProperties{ // DisplayName: to.Ptr("dhopzytkd"), + // State: to.Ptr(armrecoveryservicesdatareplication.JobStatePending), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // Errors: []*armrecoveryservicesdatareplication.ErrorModel{ - // { - // Type: to.Ptr("iyktxohrtrkshbjdhboscsu"), - // Causes: to.Ptr("iffxig"), - // Code: to.Ptr("ndcxzieiuwoxoklilcvjmglml"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // Message: to.Ptr("ltuufmxomfecqeyvzrfjqlelytkdwr"), - // Recommendation: to.Ptr("brridkskflo"), - // Severity: to.Ptr("ldgmfmbzmjtqjg"), - // }}, // ObjectID: to.Ptr("wvtmwiyxqrpqvljzn"), + // ObjectName: to.Ptr("ieieqaw"), // ObjectInternalID: to.Ptr("ahbtlwmbeivmlbj"), // ObjectInternalName: to.Ptr("mxikyrinkeyj"), - // ObjectName: to.Ptr("ieieqaw"), - // ObjectType: to.Ptr(armrecoveryservicesdatareplication.WorkflowObjectTypeAvsDiskPool), + // ObjectType: to.Ptr(armrecoveryservicesdatareplication.JobObjectTypeAvsDiskPool), // ReplicationProviderID: to.Ptr("ghxsbnvdkx"), // SourceFabricProviderID: to.Ptr("yqlertkmzdsgsplzgkmwcttsiagsa"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // State: to.Ptr(armrecoveryservicesdatareplication.WorkflowStatePending), // TargetFabricProviderID: to.Ptr("stjlmqzpgnrug"), + // AllowedActions: []*string{ + // to.Ptr("mfsyvxzgmcpgdzfbbhoxrzhya"), + // }, + // ActivityID: to.Ptr("esjvxsa"), // Tasks: []*armrecoveryservicesdatareplication.TaskModel{ // { - // ChildrenWorkflows: []*armrecoveryservicesdatareplication.WorkflowModel{ - // }, + // TaskName: to.Ptr("flkzfbbpngqbbjsdqysqfon"), + // State: to.Ptr(armrecoveryservicesdatareplication.TaskStatePending), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), // CustomProperties: &armrecoveryservicesdatareplication.TaskModelCustomProperties{ // InstanceType: to.Ptr("aaqgqvnhskxpsbnrdekxaghweon"), // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // State: to.Ptr(armrecoveryservicesdatareplication.TaskStatePending), - // TaskName: to.Ptr("flkzfbbpngqbbjsdqysqfon"), - // }}, + // }, + // }, + // Errors: []*armrecoveryservicesdatareplication.ErrorModel{ + // { + // Code: to.Ptr("ndcxzieiuwoxoklilcvjmglml"), + // Type: to.Ptr("iyktxohrtrkshbjdhboscsu"), + // Severity: to.Ptr("ldgmfmbzmjtqjg"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), + // Message: to.Ptr("ltuufmxomfecqeyvzrfjqlelytkdwr"), + // Causes: to.Ptr("iffxig"), + // Recommendation: to.Ptr("brridkskflo"), + // }, + // }, // }, - // SystemData: &armrecoveryservicesdatareplication.WorkflowModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.270Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/jobs/job1"), + // Name: to.Ptr("ukii"), + // Type: to.Ptr("cswros"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("jurgsdagntjg"), - // CreatedByType: to.Ptr("zowfl"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.270Z"); return t}()), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("zowfl")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.270Z"); return t}()), // LastModifiedBy: to.Ptr("vuw"), - // LastModifiedByType: to.Ptr("h"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("h")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.270Z"); return t}()), // }, - // } + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Workflow_List.json -func ExampleWorkflowClient_NewListPager() { +// Generated from example definition: 2024-09-01/Job_List.json +func ExampleJobClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewWorkflowClient().NewListPager("rgrecoveryservicesdatareplication", "4", &armrecoveryservicesdatareplication.WorkflowClientListOptions{Filter: to.Ptr("mnebpgmjcitjleipnttx"), - ContinuationToken: to.Ptr("rdavrzbethhslmkqgajontnxsue"), - }) + pager := clientFactory.NewJobClient().NewListPager("rgrecoveryservicesdatareplication", "4", &JobClientListOptions{ + continuationToken: to.Ptr("rdavrzbethhslmkqgajontnxsue")}) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -120,66 +110,64 @@ func ExampleWorkflowClient_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.WorkflowModelCollection = armrecoveryservicesdatareplication.WorkflowModelCollection{ - // Value: []*armrecoveryservicesdatareplication.WorkflowModel{ - // { - // Name: to.Ptr("ukii"), - // Type: to.Ptr("cswros"), - // ID: to.Ptr("zsyhbwznbkaia"), - // Properties: &armrecoveryservicesdatareplication.WorkflowModelProperties{ - // ActivityID: to.Ptr("esjvxsa"), - // AllowedActions: []*string{ - // to.Ptr("mfsyvxzgmcpgdzfbbhoxrzhya")}, - // CustomProperties: &armrecoveryservicesdatareplication.WorkflowModelCustomProperties{ - // AffectedObjectDetails: map[string]*string{ - // "key7245": to.Ptr("yllr"), - // }, - // InstanceType: to.Ptr("WorkflowModelCustomProperties"), - // }, + // page = armrecoveryservicesdatareplication.JobClientListResponse{ + // JobModelListResult: armrecoveryservicesdatareplication.JobModelListResult{ + // Value: []*armrecoveryservicesdatareplication.JobModel{ + // { + // Properties: &armrecoveryservicesdatareplication.JobModelProperties{ // DisplayName: to.Ptr("dhopzytkd"), + // State: to.Ptr(armrecoveryservicesdatareplication.JobStatePending), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // Errors: []*armrecoveryservicesdatareplication.ErrorModel{ - // { - // Type: to.Ptr("iyktxohrtrkshbjdhboscsu"), - // Causes: to.Ptr("iffxig"), - // Code: to.Ptr("ndcxzieiuwoxoklilcvjmglml"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // Message: to.Ptr("ltuufmxomfecqeyvzrfjqlelytkdwr"), - // Recommendation: to.Ptr("brridkskflo"), - // Severity: to.Ptr("ldgmfmbzmjtqjg"), - // }}, // ObjectID: to.Ptr("wvtmwiyxqrpqvljzn"), + // ObjectName: to.Ptr("ieieqaw"), // ObjectInternalID: to.Ptr("ahbtlwmbeivmlbj"), // ObjectInternalName: to.Ptr("mxikyrinkeyj"), - // ObjectName: to.Ptr("ieieqaw"), - // ObjectType: to.Ptr(armrecoveryservicesdatareplication.WorkflowObjectTypeAvsDiskPool), + // ObjectType: to.Ptr(armrecoveryservicesdatareplication.JobObjectTypeAvsDiskPool), // ReplicationProviderID: to.Ptr("ghxsbnvdkx"), // SourceFabricProviderID: to.Ptr("yqlertkmzdsgsplzgkmwcttsiagsa"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // State: to.Ptr(armrecoveryservicesdatareplication.WorkflowStatePending), // TargetFabricProviderID: to.Ptr("stjlmqzpgnrug"), + // AllowedActions: []*string{ + // to.Ptr("mfsyvxzgmcpgdzfbbhoxrzhya"), + // }, + // ActivityID: to.Ptr("esjvxsa"), // Tasks: []*armrecoveryservicesdatareplication.TaskModel{ // { - // ChildrenWorkflows: []*armrecoveryservicesdatareplication.WorkflowModel{ - // }, + // TaskName: to.Ptr("flkzfbbpngqbbjsdqysqfon"), + // State: to.Ptr(armrecoveryservicesdatareplication.TaskStatePending), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), // CustomProperties: &armrecoveryservicesdatareplication.TaskModelCustomProperties{ // InstanceType: to.Ptr("aaqgqvnhskxpsbnrdekxaghweon"), // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // State: to.Ptr(armrecoveryservicesdatareplication.TaskStatePending), - // TaskName: to.Ptr("flkzfbbpngqbbjsdqysqfon"), - // }}, + // }, + // }, + // Errors: []*armrecoveryservicesdatareplication.ErrorModel{ + // { + // Code: to.Ptr("ndcxzieiuwoxoklilcvjmglml"), + // Type: to.Ptr("iyktxohrtrkshbjdhboscsu"), + // Severity: to.Ptr("ldgmfmbzmjtqjg"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), + // Message: to.Ptr("ltuufmxomfecqeyvzrfjqlelytkdwr"), + // Causes: to.Ptr("iffxig"), + // Recommendation: to.Ptr("brridkskflo"), + // }, + // }, // }, - // SystemData: &armrecoveryservicesdatareplication.WorkflowModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.270Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/jobs/job1"), + // Name: to.Ptr("ukii"), + // Type: to.Ptr("cswros"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("jurgsdagntjg"), - // CreatedByType: to.Ptr("zowfl"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.270Z"); return t}()), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("zowfl")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.270Z"); return t}()), // LastModifiedBy: to.Ptr("vuw"), - // LastModifiedByType: to.Ptr("h"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("h")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.270Z"); return t}()), // }, - // }}, - // } + // }, + // }, + // }, + // } } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricoperationsstatus_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/locationbasedoperationresults_client.go similarity index 53% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricoperationsstatus_client.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/locationbasedoperationresults_client.go index 5040d6ee8038..815216b7306e 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricoperationsstatus_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/locationbasedoperationresults_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 armrecoveryservicesdatareplication @@ -20,63 +16,65 @@ import ( "strings" ) -// FabricOperationsStatusClient contains the methods for the FabricOperationsStatus group. -// Don't use this type directly, use NewFabricOperationsStatusClient() instead. -type FabricOperationsStatusClient struct { +// LocationBasedOperationResultsClient contains the methods for the LocationBasedOperationResults group. +// Don't use this type directly, use NewLocationBasedOperationResultsClient() instead. +type LocationBasedOperationResultsClient struct { internal *arm.Client subscriptionID string } -// NewFabricOperationsStatusClient creates a new instance of FabricOperationsStatusClient with the specified values. +// NewLocationBasedOperationResultsClient creates a new instance of LocationBasedOperationResultsClient 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 NewFabricOperationsStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FabricOperationsStatusClient, error) { +func NewLocationBasedOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocationBasedOperationResultsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &FabricOperationsStatusClient{ + client := &LocationBasedOperationResultsClient{ subscriptionID: subscriptionID, internal: cl, } return client, nil } -// Get - Tracks the results of an asynchronous operation on the fabric. +// Get - Gets the location based operation result status. +// +// Gets the location based operation result. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - fabricName - The fabric name. +// - location - The name of the Azure region. // - operationID - The ID of an ongoing async operation. -// - options - FabricOperationsStatusClientGetOptions contains the optional parameters for the FabricOperationsStatusClient.Get +// - options - LocationBasedOperationResultsClientGetOptions contains the optional parameters for the LocationBasedOperationResultsClient.Get // method. -func (client *FabricOperationsStatusClient) Get(ctx context.Context, resourceGroupName string, fabricName string, operationID string, options *FabricOperationsStatusClientGetOptions) (FabricOperationsStatusClientGetResponse, error) { +func (client *LocationBasedOperationResultsClient) Get(ctx context.Context, resourceGroupName string, location string, operationID string, options *LocationBasedOperationResultsClientGetOptions) (LocationBasedOperationResultsClientGetResponse, error) { var err error - const operationName = "FabricOperationsStatusClient.Get" + const operationName = "LocationBasedOperationResultsClient.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, fabricName, operationID, options) + req, err := client.getCreateRequest(ctx, resourceGroupName, location, operationID, options) if err != nil { - return FabricOperationsStatusClientGetResponse{}, err + return LocationBasedOperationResultsClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return FabricOperationsStatusClientGetResponse{}, err + return LocationBasedOperationResultsClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return FabricOperationsStatusClientGetResponse{}, err + return LocationBasedOperationResultsClientGetResponse{}, err } resp, err := client.getHandleResponse(httpResp) return resp, err } // getCreateRequest creates the Get request. -func (client *FabricOperationsStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, operationID string, options *FabricOperationsStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/operations/{operationId}" +func (client *LocationBasedOperationResultsClient) getCreateRequest(ctx context.Context, resourceGroupName string, location string, operationID string, _ *LocationBasedOperationResultsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/locations/{location}/operationResults/{operationId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -85,10 +83,10 @@ func (client *FabricOperationsStatusClient) getCreateRequest(ctx context.Context return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") + if location == "" { + return nil, errors.New("parameter location cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) if operationID == "" { return nil, errors.New("parameter operationID cannot be empty") } @@ -98,17 +96,17 @@ func (client *FabricOperationsStatusClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getHandleResponse handles the Get response. -func (client *FabricOperationsStatusClient) getHandleResponse(resp *http.Response) (FabricOperationsStatusClientGetResponse, error) { - result := FabricOperationsStatusClientGetResponse{} +func (client *LocationBasedOperationResultsClient) getHandleResponse(resp *http.Response) (LocationBasedOperationResultsClientGetResponse, error) { + result := LocationBasedOperationResultsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return FabricOperationsStatusClientGetResponse{}, err + return LocationBasedOperationResultsClientGetResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/draoperationstatus_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/locationbasedoperationresults_client_example_test.go similarity index 52% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/draoperationstatus_client_example_test.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/locationbasedoperationresults_client_example_test.go index 8a445501bb63..9b7df90a98a4 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/draoperationstatus_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/locationbasedoperationresults_client_example_test.go @@ -1,45 +1,41 @@ -//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 armrecoveryservicesdatareplication_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/DraOperationStatus_Get.json -func ExampleDraOperationStatusClient_Get() { +// Generated from example definition: 2024-09-01/LocationBasedOperationResults_Get.json +func ExampleLocationBasedOperationResultsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewDraOperationStatusClient().Get(ctx, "rgrecoveryservicesdatareplication", "wPR", "M", "dadsqwcq", nil) + res, err := clientFactory.NewLocationBasedOperationResultsClient().Get(ctx, "rgswagger_2024-09-01", "Central US EUAP", "lghle", 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.OperationStatus = armrecoveryservicesdatareplication.OperationStatus{ - // Name: to.Ptr("wzdasptnwlxgobklayoqapjcgcf"), - // EndTime: to.Ptr("nauyrfh"), - // ID: to.Ptr("sf"), - // StartTime: to.Ptr("xuzwmfrhluafmwwsmzqxsytyehsh"), - // Status: to.Ptr("plbnngzfppdram"), + // res = armrecoveryservicesdatareplication.LocationBasedOperationResultsClientGetResponse{ + // OperationStatus: &armrecoveryservicesdatareplication.OperationStatus{ + // ID: to.Ptr("inhnjrxtqtyumflbzdne"), + // Name: to.Ptr("eawsgzqm"), + // Status: to.Ptr("jjijbsrjfqvqzriekxfvynb"), + // StartTime: to.Ptr("slmhzgrfzkkrxdalacmidyxijq"), + // EndTime: to.Ptr("ixkalnbiajfpjtur"), + // }, // } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/models.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/models.go index 0efe2449ce05..15a0929f52a3 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/models.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/models.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 armrecoveryservicesdatareplication @@ -33,7 +29,8 @@ type AzStackHCIFabricModelCustomProperties struct { // REQUIRED; AzStackHCI cluster properties. Cluster *AzStackHCIClusterProperties - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "AzStackHCI", any specified value is ignored. InstanceType *string // REQUIRED; Gets or sets the Migration solution ARM Id. @@ -80,6 +77,24 @@ type CheckNameAvailabilityResponseModel struct { Reason *string } +// ConnectionDetails - Private endpoint connection details at member level. +type ConnectionDetails struct { + // Gets or sets group id. + GroupID *string + + // Gets or sets id. + ID *string + + // Gets or sets link identifier. + LinkIdentifier *string + + // Gets or sets member name. + MemberName *string + + // Gets or sets private IP address. + PrivateIPAddress *string +} + // DeploymentPreflightModel - Deployment preflight model. type DeploymentPreflightModel struct { // Gets or sets the list of resources. @@ -97,127 +112,50 @@ type DeploymentPreflightResource struct { // Gets or sets the resource name. Name *string - // Gets or sets the resource type. - Type *string -} - -// DraModel - Dra model. -type DraModel struct { - // REQUIRED; Dra model properties. - Properties *DraModelProperties - - // READ-ONLY; Gets or sets the Id of the resource. - ID *string - - // READ-ONLY; Gets or sets the name of the resource. - Name *string - - // READ-ONLY - SystemData *DraModelSystemData + // Gets or sets the properties of the resource. + Properties any - // READ-ONLY; Gets or sets the type of the resource. + // Gets or sets the resource type. Type *string } -// DraModelCollection - Dra model collection. -type DraModelCollection struct { - // Gets or sets the value of next link. - NextLink *string - - // Gets or sets the list of Dras. - Value []*DraModel -} - -// DraModelCustomProperties - Dra model custom properties. -type DraModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. - InstanceType *string -} - -// GetDraModelCustomProperties implements the DraModelCustomPropertiesClassification interface for type DraModelCustomProperties. -func (d *DraModelCustomProperties) GetDraModelCustomProperties() *DraModelCustomProperties { return d } - -// DraModelProperties - Dra model properties. -type DraModelProperties struct { - // REQUIRED; Identity model. - AuthenticationIdentity *IdentityModel - - // REQUIRED; Dra model custom properties. - CustomProperties DraModelCustomPropertiesClassification - - // REQUIRED; Gets or sets the machine Id where Dra is running. - MachineID *string - - // REQUIRED; Gets or sets the machine name where Dra is running. - MachineName *string - - // REQUIRED; Identity model. - ResourceAccessIdentity *IdentityModel - - // READ-ONLY; Gets or sets the Dra correlation Id. - CorrelationID *string - - // READ-ONLY; Gets or sets the list of health errors. - HealthErrors []*HealthErrorModel - - // READ-ONLY; Gets or sets a value indicating whether Dra is responsive. - IsResponsive *bool - - // READ-ONLY; Gets or sets the time when last heartbeat was sent by the Dra. - LastHeartbeat *time.Time - - // READ-ONLY; Gets or sets the provisioning state of the Dra. - ProvisioningState *ProvisioningState - - // READ-ONLY; Gets or sets the Dra version. - VersionNumber *string -} - -type DraModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string +// DiskControllerInputs - Disk controller. +type DiskControllerInputs struct { + // REQUIRED; Gets or sets the controller ID. + ControllerID *int32 - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time - - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string + // REQUIRED; Gets or sets the controller Location. + ControllerLocation *int32 - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string + // REQUIRED; Gets or sets the controller name (IDE,SCSI). + ControllerName *string } // EmailConfigurationModel - Email configuration model. type EmailConfigurationModel struct { - // REQUIRED; Email configuration model properties. + // The resource-specific properties for this resource. Properties *EmailConfigurationModelProperties - // READ-ONLY; Gets or sets the Id of the resource. - ID *string - - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; The email configuration name. Name *string - // READ-ONLY - SystemData *EmailConfigurationModelSystemData + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; Gets or sets the type of the resource. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// EmailConfigurationModelCollection - Email configuration model collection. -type EmailConfigurationModelCollection struct { - // Gets or sets the value of next link. - NextLink *string - - // Gets or sets the list of email configurations. +// EmailConfigurationModelListResult - The response of a EmailConfigurationModel list operation. +type EmailConfigurationModelListResult struct { + // REQUIRED; The EmailConfigurationModel items on this page Value []*EmailConfigurationModel + + // The link to the next page of items + NextLink *string } // EmailConfigurationModelProperties - Email configuration model properties. @@ -230,26 +168,9 @@ type EmailConfigurationModelProperties struct { // Gets or sets the locale for the email notification. Locale *string -} - -type EmailConfigurationModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time - - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string - - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string + // READ-ONLY; Gets or sets the provisioning state of the email configuration. + ProvisioningState *ProvisioningState } // ErrorModel - Error model. @@ -278,34 +199,25 @@ type ErrorModel struct { // EventModel - Event model. type EventModel struct { - // REQUIRED; Event model properties. + // The resource-specific properties for this resource. Properties *EventModelProperties - // READ-ONLY; Gets or sets the Id of the resource. - ID *string - - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; The event name. Name *string - // READ-ONLY - SystemData *EventModelSystemData - - // READ-ONLY; Gets or sets the type of the resource. - Type *string -} + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string -// EventModelCollection - Event model collection. -type EventModelCollection struct { - // Gets or sets the value of next link. - NextLink *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // Gets or sets the list of events. - Value []*EventModel + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } // EventModelCustomProperties - Event model custom properties. type EventModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for EventModelCustomProperties. InstanceType *string } @@ -314,6 +226,15 @@ func (e *EventModelCustomProperties) GetEventModelCustomProperties() *EventModel return e } +// EventModelListResult - The response of a EventModel list operation. +type EventModelListResult struct { + // REQUIRED; The EventModel items on this page + Value []*EventModel + + // The link to the next page of items + NextLink *string +} + // EventModelProperties - Event model properties. type EventModelProperties struct { // REQUIRED; Event model custom properties. @@ -334,6 +255,9 @@ type EventModelProperties struct { // READ-ONLY; Gets or sets the errors associated with this event. HealthErrors []*HealthErrorModel + // READ-ONLY; Gets or sets the provisioning state of the event. + ProvisioningState *ProvisioningState + // READ-ONLY; Gets or sets the resource name. ResourceName *string @@ -347,62 +271,107 @@ type EventModelProperties struct { TimeOfOccurrence *time.Time } -type EventModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time +// FabricAgentModel - Fabric agent model. +type FabricAgentModel struct { + // The resource-specific properties for this resource. + Properties *FabricAgentModelProperties - // Gets or sets identity that created the resource. - CreatedBy *string + // READ-ONLY; The fabric agent name. + Name *string - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// FabricAgentModelCustomProperties - Fabric agent model custom properties. +type FabricAgentModelCustomProperties struct { + // REQUIRED; Discriminator property for FabricAgentModelCustomProperties. + InstanceType *string +} + +// GetFabricAgentModelCustomProperties implements the FabricAgentModelCustomPropertiesClassification interface for type FabricAgentModelCustomProperties. +func (f *FabricAgentModelCustomProperties) GetFabricAgentModelCustomProperties() *FabricAgentModelCustomProperties { + return f +} + +// FabricAgentModelListResult - The response of a FabricAgentModel list operation. +type FabricAgentModelListResult struct { + // REQUIRED; The FabricAgentModel items on this page + Value []*FabricAgentModel + + // The link to the next page of items + NextLink *string +} + +// FabricAgentModelProperties - Fabric agent model properties. +type FabricAgentModelProperties struct { + // REQUIRED; Identity model. + AuthenticationIdentity *IdentityModel + + // REQUIRED; Fabric agent model custom properties. + CustomProperties FabricAgentModelCustomPropertiesClassification + + // REQUIRED; Gets or sets the machine Id where fabric agent is running. + MachineID *string + + // REQUIRED; Gets or sets the machine name where fabric agent is running. + MachineName *string + + // REQUIRED; Identity model. + ResourceAccessIdentity *IdentityModel + + // READ-ONLY; Gets or sets the fabric agent correlation Id. + CorrelationID *string + + // READ-ONLY; Gets or sets the list of health errors. + HealthErrors []*HealthErrorModel + + // READ-ONLY; Gets or sets a value indicating whether the fabric agent is responsive. + IsResponsive *bool + + // READ-ONLY; Gets or sets the time when last heartbeat was sent by the fabric agent. + LastHeartbeat *time.Time + + // READ-ONLY; Gets or sets the provisioning state of the fabric agent. + ProvisioningState *ProvisioningState - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string + // READ-ONLY; Gets or sets the fabric agent version. + VersionNumber *string } // FabricModel - Fabric model. type FabricModel struct { - // REQUIRED; Gets or sets the location of the fabric. + // REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; Fabric model properties. + // The resource-specific properties for this resource. Properties *FabricModelProperties - // Gets or sets the resource tags. + // Resource tags. Tags map[string]*string - // READ-ONLY; Gets or sets the Id of the resource. - ID *string - - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; The fabric name. Name *string - // READ-ONLY - SystemData *FabricModelSystemData - - // READ-ONLY; Gets or sets the type of the resource. - Type *string -} + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string -// FabricModelCollection - Fabric model collection. -type FabricModelCollection struct { - // Gets or sets the value of next link. - NextLink *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // Gets or sets the list of fabrics. - Value []*FabricModel + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } // FabricModelCustomProperties - Fabric model custom properties. type FabricModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for FabricModelCustomProperties. InstanceType *string } @@ -411,6 +380,15 @@ func (f *FabricModelCustomProperties) GetFabricModelCustomProperties() *FabricMo return f } +// FabricModelListResult - The response of a FabricModel list operation. +type FabricModelListResult struct { + // REQUIRED; The FabricModel items on this page + Value []*FabricModel + + // The link to the next page of items + NextLink *string +} + // FabricModelProperties - Fabric model properties. type FabricModelProperties struct { // REQUIRED; Fabric model custom properties. @@ -432,27 +410,7 @@ type FabricModelProperties struct { ServiceResourceID *string } -type FabricModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string - - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time - - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string - - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string -} - -// FabricModelUpdate - Fabric model for update. +// FabricModelUpdate - Fabric model update. type FabricModelUpdate struct { // Fabric model properties. Properties *FabricModelProperties @@ -466,31 +424,31 @@ type FabricModelUpdate struct { // READ-ONLY; Gets or sets the name of the resource. Name *string - // READ-ONLY - SystemData *FabricModelUpdateSystemData + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData // READ-ONLY; Gets or sets the type of the resource. Type *string } -type FabricModelUpdateSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string +// FailoverJobModelCustomProperties - Failover job model custom properties. +type FailoverJobModelCustomProperties struct { + // REQUIRED; Gets or sets the instance type. + InstanceType *string - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time + // READ-ONLY; Gets or sets any custom properties of the affected object. + AffectedObjectDetails *JobModelCustomPropertiesAffectedObjectDetails - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string + // READ-ONLY; Gets or sets the failed over protected item details. + ProtectedItemDetails []*FailoverProtectedItemProperties +} - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string +// GetJobModelCustomProperties implements the JobModelCustomPropertiesClassification interface for type FailoverJobModelCustomProperties. +func (f *FailoverJobModelCustomProperties) GetJobModelCustomProperties() *JobModelCustomProperties { + return &JobModelCustomProperties{ + AffectedObjectDetails: f.AffectedObjectDetails, + InstanceType: f.InstanceType, + } } // FailoverProtectedItemProperties - Failover properties of the protected item. @@ -517,31 +475,31 @@ type FailoverProtectedItemProperties struct { VMName *string } -// FailoverWorkflowModelCustomProperties - Failover workflow model custom properties. -type FailoverWorkflowModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. - InstanceType *string +// GroupConnectivityInformation - Represents of a connection's group information. +type GroupConnectivityInformation struct { + // Gets or sets customer visible FQDNs. + CustomerVisibleFqdns []*string - // READ-ONLY; Gets or sets any custom properties of the affected object. - AffectedObjectDetails map[string]*string + // Gets or sets group id. + GroupID *string - // READ-ONLY; Gets or sets the failed over protected item details. - ProtectedItemDetails []*FailoverProtectedItemProperties -} + // Gets or sets Internal Fqdn. + InternalFqdn *string -// GetWorkflowModelCustomProperties implements the WorkflowModelCustomPropertiesClassification interface for type FailoverWorkflowModelCustomProperties. -func (f *FailoverWorkflowModelCustomProperties) GetWorkflowModelCustomProperties() *WorkflowModelCustomProperties { - return &WorkflowModelCustomProperties{ - AffectedObjectDetails: f.AffectedObjectDetails, - InstanceType: f.InstanceType, - } + // Gets or sets member name. + MemberName *string + + // Gets or sets the private link service arm region. + PrivateLinkServiceArmRegion *string + + // Gets or sets the redirect map id. + RedirectMapID *string } // HealthErrorModel - Health error model. type HealthErrorModel struct { // Gets or sets the list of affected resource correlation Ids. This can be used to uniquely identify the count of items affected - // by a specific category and severity as well as count of item affected by - // an specific issue. + // by a specific category and severity as well as count of item affected by an specific issue. AffectedResourceCorrelationIDs []*string // Gets or sets the type of affected resource type. @@ -589,7 +547,8 @@ type HyperVMigrateFabricModelCustomProperties struct { // REQUIRED; Gets or sets the ARM Id of the HyperV site. HyperVSiteID *string - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "HyperVMigrate", any specified value is ignored. InstanceType *string // REQUIRED; Gets or sets the migration solution ARM Id. @@ -626,6 +585,21 @@ type HyperVToAzStackHCIDiskInput struct { // REQUIRED; Gets or sets a value indicating whether disk is os disk. IsOsDisk *bool + // Gets or sets a value of disk block size. + DiskBlockSize *int64 + + // Disk controller. + DiskController *DiskControllerInputs + + // Gets or sets a value of disk identifier. + DiskIdentifier *string + + // Gets or sets a value of disk logical sector size. + DiskLogicalSectorSize *int64 + + // Gets or sets a value of disk physical sector size. + DiskPhysicalSectorSize *int64 + // Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard disk. IsDynamic *bool @@ -634,8 +608,7 @@ type HyperVToAzStackHCIDiskInput struct { } // HyperVToAzStackHCIEventModelCustomProperties - HyperV to AzStackHCI event model custom properties. This class provides -// provider specific details for events of type DataContract.HealthEvents.HealthEventType.ProtectedItemHealth and -// DataContract.HealthEvents.HealthEventType.AgentHealth. +// provider specific details for events of type DataContract.HealthEvents.HealthEventType.ProtectedItemHealth and DataContract.HealthEvents.HealthEventType.AgentHealth. type HyperVToAzStackHCIEventModelCustomProperties struct { // REQUIRED; Gets or sets the instance type. InstanceType *string @@ -671,10 +644,16 @@ type HyperVToAzStackHCINicInput struct { // REQUIRED; Gets or sets the selection type of the NIC. SelectionTypeForFailover *VMNicSelection - // REQUIRED; Gets or sets the target network Id within AzStackHCI Cluster. + // Gets or sets a value indicating whether mac address migration is enabled. + IsMacMigrationEnabled *bool + + // Gets or sets a value indicating whether static ip migration is enabled. + IsStaticIPMigrationEnabled *bool + + // Gets or sets the target network Id within AzStackHCI Cluster. TargetNetworkID *string - // REQUIRED; Gets or sets the target test network Id within AzStackHCI Cluster. + // Gets or sets the target test network Id within AzStackHCI Cluster. TestNetworkID *string // READ-ONLY; Gets or sets the network name. @@ -683,7 +662,8 @@ type HyperVToAzStackHCINicInput struct { // HyperVToAzStackHCIPlannedFailoverModelCustomProperties - HyperV to AzStackHCI planned failover model custom properties. type HyperVToAzStackHCIPlannedFailoverModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "HyperVToAzStackHCI", any specified value is ignored. InstanceType *string // REQUIRED; Gets or sets a value indicating whether VM needs to be shut down. @@ -706,7 +686,8 @@ type HyperVToAzStackHCIPolicyModelCustomProperties struct { // REQUIRED; Gets or sets the crash consistent snapshot frequency (in minutes). CrashConsistentFrequencyInMinutes *int32 - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "HyperVToAzStackHCI", any specified value is ignored. InstanceType *string // REQUIRED; Gets or sets the duration in minutes until which the recovery points need to be stored. @@ -725,6 +706,15 @@ type HyperVToAzStackHCIProtectedDiskProperties struct { // READ-ONLY; Gets or sets the disk capacity in bytes. CapacityInBytes *int64 + // READ-ONLY; Gets or sets a value of disk block size. + DiskBlockSize *int64 + + // READ-ONLY; Gets or sets a value of disk logical sector size. + DiskLogicalSectorSize *int64 + + // READ-ONLY; Gets or sets a value of disk physical sector size. + DiskPhysicalSectorSize *int64 + // READ-ONLY; Gets or sets the disk type. DiskType *string @@ -770,7 +760,8 @@ type HyperVToAzStackHCIProtectedItemModelCustomProperties struct { // REQUIRED; Gets or sets the hypervisor generation of the virtual machine. HyperVGeneration *string - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "HyperVToAzStackHCI", any specified value is ignored. InstanceType *string // REQUIRED; Gets or sets the list of VM NIC to replicate. @@ -779,8 +770,8 @@ type HyperVToAzStackHCIProtectedItemModelCustomProperties struct { // REQUIRED; Gets or sets the Run As account Id. RunAsAccountID *string - // REQUIRED; Gets or sets the source DRA name. - SourceDraName *string + // REQUIRED; Gets or sets the source fabric agent name. + SourceFabricAgentName *string // REQUIRED; Gets or sets the target storage container ARM Id. StorageContainerID *string @@ -788,8 +779,8 @@ type HyperVToAzStackHCIProtectedItemModelCustomProperties struct { // REQUIRED; Gets or sets the Target Arc Cluster Custom Location ARM Id. TargetArcClusterCustomLocationID *string - // REQUIRED; Gets or sets the target DRA name. - TargetDraName *string + // REQUIRED; Gets or sets the target fabric agent name. + TargetFabricAgentName *string // REQUIRED; Gets or sets the Target HCI Cluster ARM Id. TargetHciClusterID *string @@ -889,6 +880,39 @@ func (h *HyperVToAzStackHCIProtectedItemModelCustomProperties) GetProtectedItemM } } +// HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate - HyperV to AzStackHCI Protected item model custom properties. +type HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate struct { + // CONSTANT; Gets or sets the instance type. + // Field has constant value "HyperVToAzStackHCI", any specified value is ignored. + InstanceType *string + + // Protected item dynamic memory config. + DynamicMemoryConfig *ProtectedItemDynamicMemoryConfig + + // Gets or sets a value indicating whether memory is dynamical. + IsDynamicRAM *bool + + // Gets or sets the list of VM NIC to replicate. + NicsToInclude []*HyperVToAzStackHCINicInput + + // Gets or sets the type of the OS. + OSType *string + + // Gets or sets the target CPU cores. + TargetCPUCores *int32 + + // Gets or sets the target memory in mega-bytes. + TargetMemoryInMegaBytes *int32 +} + +// GetProtectedItemModelCustomPropertiesUpdate implements the ProtectedItemModelCustomPropertiesUpdateClassification interface +// for type HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate. +func (h *HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate) GetProtectedItemModelCustomPropertiesUpdate() *ProtectedItemModelCustomPropertiesUpdate { + return &ProtectedItemModelCustomPropertiesUpdate{ + InstanceType: h.InstanceType, + } +} + // HyperVToAzStackHCIProtectedNicProperties - HyperVToAzStackHCI NIC properties. type HyperVToAzStackHCIProtectedNicProperties struct { // READ-ONLY; Gets or sets the NIC mac address. @@ -935,7 +959,8 @@ type HyperVToAzStackHCIReplicationExtensionModelCustomProperties struct { // REQUIRED; Gets or sets the ARM Id of the source HyperV fabric. HyperVFabricArmID *string - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "HyperVToAzStackHCI", any specified value is ignored. InstanceType *string // Gets or sets the storage account Id. @@ -991,19 +1016,19 @@ func (h *HyperVToAzStackHCIReplicationExtensionModelCustomProperties) GetReplica // IdentityModel - Identity model. type IdentityModel struct { - // REQUIRED; Gets or sets the authority of the SPN with which Dra communicates to service. + // REQUIRED; Gets or sets the authority of the SPN with which fabric agent communicates to service. AADAuthority *string - // REQUIRED; Gets or sets the client/application Id of the SPN with which Dra communicates to service. + // REQUIRED; Gets or sets the client/application Id of the SPN with which fabric agent communicates to service. ApplicationID *string - // REQUIRED; Gets or sets the audience of the SPN with which Dra communicates to service. + // REQUIRED; Gets or sets the audience of the SPN with which fabric agent communicates to service. Audience *string - // REQUIRED; Gets or sets the object Id of the SPN with which Dra communicates to service. + // REQUIRED; Gets or sets the object Id of the SPN with which fabric agent communicates to service. ObjectID *string - // REQUIRED; Gets or sets the tenant Id of the SPN with which Dra communicates to service. + // REQUIRED; Gets or sets the tenant Id of the SPN with which fabric agent communicates to service. TenantID *string } @@ -1043,28 +1068,149 @@ type InnerHealthErrorModel struct { Summary *string } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API -type Operation struct { - // Localized display information for this particular operation. - Display *OperationDisplay +// JobModel - Job model. +type JobModel struct { + // The resource-specific properties for this resource. + Properties *JobModelProperties - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - ActionType *ActionType + // READ-ONLY; The job name. + Name *string - // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane - // operations. - IsDataAction *bool + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // 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; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // 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 + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } -// OperationDisplay - Localized display information for this particular operation. +// JobModelCustomProperties - Job model custom properties. +type JobModelCustomProperties struct { + // REQUIRED; Discriminator property for JobModelCustomProperties. + InstanceType *string + + // READ-ONLY; Gets or sets any custom properties of the affected object. + AffectedObjectDetails *JobModelCustomPropertiesAffectedObjectDetails +} + +// GetJobModelCustomProperties implements the JobModelCustomPropertiesClassification interface for type JobModelCustomProperties. +func (j *JobModelCustomProperties) GetJobModelCustomProperties() *JobModelCustomProperties { return j } + +type JobModelCustomPropertiesAffectedObjectDetails struct { + Description *string + + // FLAG; CONSTANT + Type *string +} + +// JobModelListResult - The response of a JobModel list operation. +type JobModelListResult struct { + // REQUIRED; The JobModel items on this page + Value []*JobModel + + // The link to the next page of items + NextLink *string +} + +// JobModelProperties - Job model properties. +type JobModelProperties struct { + // REQUIRED; Job model custom properties. + CustomProperties JobModelCustomPropertiesClassification + + // READ-ONLY; Gets or sets the job activity id. + ActivityID *string + + // READ-ONLY; Gets or sets the list of allowed actions on the job. + AllowedActions []*string + + // READ-ONLY; Gets or sets the friendly display name. + DisplayName *string + + // READ-ONLY; Gets or sets the end time. + EndTime *time.Time + + // READ-ONLY; Gets or sets the list of errors. + Errors []*ErrorModel + + // READ-ONLY; Gets or sets the affected object Id. + ObjectID *string + + // READ-ONLY; Gets or sets the affected object internal Id. + ObjectInternalID *string + + // READ-ONLY; Gets or sets the affected object internal name. + ObjectInternalName *string + + // READ-ONLY; Gets or sets the affected object name. + ObjectName *string + + // READ-ONLY; Gets or sets the object type. + ObjectType *JobObjectType + + // READ-ONLY; Gets or sets the provisioning state of the job. + ProvisioningState *ProvisioningState + + // READ-ONLY; Gets or sets the replication provider. + ReplicationProviderID *string + + // READ-ONLY; Gets or sets the source fabric provider. + SourceFabricProviderID *string + + // READ-ONLY; Gets or sets the start time. + StartTime *time.Time + + // READ-ONLY; Gets or sets the job state. + State *JobState + + // READ-ONLY; Gets or sets the target fabric provider. + TargetFabricProviderID *string + + // READ-ONLY; Gets or sets the list of tasks. + Tasks []*TaskModel +} + +// ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) +type ManagedServiceIdentity struct { + // REQUIRED; The type of managed identity assigned to this resource. + Type *ManagedServiceIdentityType + + // The identities assigned to this resource by the user. + UserAssignedIdentities map[string]*UserAssignedIdentity + + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string + + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string +} + +// Operation - REST API Operation +// +// Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Localized display information for this particular operation. + Display *OperationDisplay + + // 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; 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 - Localized display information for and operation. type OperationDisplay struct { // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string @@ -1085,11 +1231,11 @@ type OperationDisplay struct { // 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 { - // READ-ONLY; URL to get the next set of operation list results (if there are any). - NextLink *string - - // READ-ONLY; List of operations supported by the resource provider + // REQUIRED; The Operation items on this page Value []*Operation + + // The link to the next page of items + NextLink *string } // OperationStatus - Defines the operation status. @@ -1119,7 +1265,7 @@ type PlannedFailoverModel struct { // PlannedFailoverModelCustomProperties - Planned failover model custom properties. type PlannedFailoverModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for PlannedFailoverModelCustomProperties. InstanceType *string } @@ -1137,34 +1283,25 @@ type PlannedFailoverModelProperties struct { // PolicyModel - Policy model. type PolicyModel struct { - // REQUIRED; Policy model properties. + // The resource-specific properties for this resource. Properties *PolicyModelProperties - // READ-ONLY; Gets or sets the Id of the resource. - ID *string - - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; The policy name. Name *string - // READ-ONLY - SystemData *PolicyModelSystemData - - // READ-ONLY; Gets or sets the type of the resource. - Type *string -} + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string -// PolicyModelCollection - Policy model collection. -type PolicyModelCollection struct { - // Gets or sets the value of next link. - NextLink *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // Gets or sets the list of policies. - Value []*PolicyModel + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } // PolicyModelCustomProperties - Policy model custom properties. type PolicyModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for PolicyModelCustomProperties. InstanceType *string } @@ -1173,6 +1310,15 @@ func (p *PolicyModelCustomProperties) GetPolicyModelCustomProperties() *PolicyMo return p } +// PolicyModelListResult - The response of a PolicyModel list operation. +type PolicyModelListResult struct { + // REQUIRED; The PolicyModel items on this page + Value []*PolicyModel + + // The link to the next page of items + NextLink *string +} + // PolicyModelProperties - Policy model properties. type PolicyModelProperties struct { // REQUIRED; Policy model custom properties. @@ -1182,24 +1328,170 @@ type PolicyModelProperties struct { ProvisioningState *ProvisioningState } -type PolicyModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time +// PrivateEndpoint - Represent private Endpoint network resource that is linked to the Private Endpoint connection. +type PrivateEndpoint struct { + // Gets or sets the id. + ID *string +} - // Gets or sets identity that created the resource. - CreatedBy *string +// PrivateEndpointConnection - Represents private endpoint connection. +type PrivateEndpointConnection struct { + // The resource-specific properties for this resource. + Properties *PrivateEndpointConnectionResponseProperties - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string + // READ-ONLY; The private endpoint connection name. + Name *string - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PrivateEndpointConnectionListResult - The response of a PrivateEndpointConnection list operation. +type PrivateEndpointConnectionListResult struct { + // REQUIRED; The PrivateEndpointConnection items on this page + Value []*PrivateEndpointConnection + + // The link to the next page of items + NextLink *string +} + +// PrivateEndpointConnectionProxy - Represents private endpoint connection proxy request. +type PrivateEndpointConnectionProxy struct { + // READ-ONLY; The private endpoint connection proxy name. + Name *string + + // Gets or sets ETag. + Etag *string + + // The resource-specific properties for this resource. + Properties *PrivateEndpointConnectionProxyProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PrivateEndpointConnectionProxyListResult - The response of a PrivateEndpointConnectionProxy list operation. +type PrivateEndpointConnectionProxyListResult struct { + // REQUIRED; The PrivateEndpointConnectionProxy items on this page + Value []*PrivateEndpointConnectionProxy + + // The link to the next page of items + NextLink *string +} + +// PrivateEndpointConnectionProxyProperties - Represents private endpoint connection proxy request. +type PrivateEndpointConnectionProxyProperties struct { + // Represent remote private endpoint information for the private endpoint connection proxy. + RemotePrivateEndpoint *RemotePrivateEndpoint + + // READ-ONLY; Gets or sets the provisioning state of the private endpoint connection proxy. + ProvisioningState *ProvisioningState +} + +// PrivateEndpointConnectionResponseProperties - Represents Private endpoint connection response properties. +type PrivateEndpointConnectionResponseProperties struct { + // Represent private Endpoint network resource that is linked to the Private Endpoint connection. + PrivateEndpoint *PrivateEndpoint + + // Represents Private link service connection state. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState + + // READ-ONLY; Gets or sets provisioning state of the private endpoint connection. + ProvisioningState *ProvisioningState +} + +// PrivateLinkResource - Represents private link resource. +type PrivateLinkResource struct { + // The resource-specific properties for this resource. + Properties *PrivateLinkResourceProperties + + // READ-ONLY; The private link name. + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PrivateLinkResourceListResult - The response of a PrivateLinkResource list operation. +type PrivateLinkResourceListResult struct { + // REQUIRED; The PrivateLinkResource items on this page + Value []*PrivateLinkResource - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string + // The link to the next page of items + NextLink *string +} + +// PrivateLinkResourceProperties - Represents private link resource properties. +type PrivateLinkResourceProperties struct { + // Gets or sets the group id. + GroupID *string + + // Gets or sets the required member. This translates to how many Private IPs should be created for each privately linkable + // resource. + RequiredMembers []*string + + // Gets or sets the private DNS zone names. + RequiredZoneNames []*string + + // READ-ONLY; Gets or sets the provisioning state of the private link resource. + ProvisioningState *ProvisioningState +} + +// PrivateLinkServiceConnection - Represents of an NRP private link service connection. +type PrivateLinkServiceConnection struct { + // Gets or sets group ids. + GroupIDs []*string + + // Gets or sets private link service connection name. + Name *string + + // Gets or sets the request message for the private link service connection. + RequestMessage *string +} + +// PrivateLinkServiceConnectionState - Represents Private link service connection state. +type PrivateLinkServiceConnectionState struct { + // Gets or sets actions required. + ActionsRequired *string + + // Gets or sets description. + Description *string + + // Gets or sets the status. + Status *PrivateEndpointConnectionStatus +} + +// PrivateLinkServiceProxy - Represents NRP private link service proxy. +type PrivateLinkServiceProxy struct { + // Gets or sets group connectivity information. + GroupConnectivityInformation []*GroupConnectivityInformation + + // Gets or sets private link service proxy id. + ID *string + + // Represent remote private endpoint connection. + RemotePrivateEndpointConnection *RemotePrivateEndpointConnection + + // Represents Private link service connection state. + RemotePrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState } // ProtectedItemDynamicMemoryConfig - Protected item dynamic memory config. @@ -1214,36 +1506,51 @@ type ProtectedItemDynamicMemoryConfig struct { TargetMemoryBufferPercentage *int32 } -// ProtectedItemModel - Protected item model. -type ProtectedItemModel struct { - // REQUIRED; Protected item model properties. - Properties *ProtectedItemModelProperties +// ProtectedItemJobProperties - Protected item job properties. +type ProtectedItemJobProperties struct { + // READ-ONLY; Gets or sets the job friendly display name. + DisplayName *string - // READ-ONLY; Gets or sets the Id of the resource. + // READ-ONLY; Gets or sets end time of the job. + EndTime *time.Time + + // READ-ONLY; Gets or sets job Id. ID *string - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; Gets or sets job name. Name *string - // READ-ONLY - SystemData *ProtectedItemModelSystemData + // READ-ONLY; Gets or sets protection scenario name. + ScenarioName *string - // READ-ONLY; Gets or sets the type of the resource. - Type *string + // READ-ONLY; Gets or sets start time of the job. + StartTime *time.Time + + // READ-ONLY; Gets or sets job state. + State *string } -// ProtectedItemModelCollection - Protected item model collection. -type ProtectedItemModelCollection struct { - // Gets or sets the value of next link. - NextLink *string +// ProtectedItemModel - Protected item model. +type ProtectedItemModel struct { + // The resource-specific properties for this resource. + Properties *ProtectedItemModelProperties - // Gets or sets the list of protected items. - Value []*ProtectedItemModel + // READ-ONLY; The protected item name. + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } // ProtectedItemModelCustomProperties - Protected item model custom properties. type ProtectedItemModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for ProtectedItemModelCustomProperties. InstanceType *string } @@ -1253,6 +1560,27 @@ func (p *ProtectedItemModelCustomProperties) GetProtectedItemModelCustomProperti return p } +// ProtectedItemModelCustomPropertiesUpdate - Protected item model custom properties. +type ProtectedItemModelCustomPropertiesUpdate struct { + // REQUIRED; Discriminator property for ProtectedItemModelCustomPropertiesUpdate. + InstanceType *string +} + +// GetProtectedItemModelCustomPropertiesUpdate implements the ProtectedItemModelCustomPropertiesUpdateClassification interface +// for type ProtectedItemModelCustomPropertiesUpdate. +func (p *ProtectedItemModelCustomPropertiesUpdate) GetProtectedItemModelCustomPropertiesUpdate() *ProtectedItemModelCustomPropertiesUpdate { + return p +} + +// ProtectedItemModelListResult - The response of a ProtectedItemModel list operation. +type ProtectedItemModelListResult struct { + // REQUIRED; The ProtectedItemModel items on this page + Value []*ProtectedItemModel + + // The link to the next page of items + NextLink *string +} + // ProtectedItemModelProperties - Protected item model properties. type ProtectedItemModelProperties struct { // REQUIRED; Protected item model custom properties. @@ -1270,11 +1598,11 @@ type ProtectedItemModelProperties struct { // READ-ONLY; Gets or sets the protected item correlation Id. CorrelationID *string - // READ-ONLY - CurrentJob *ProtectedItemModelPropertiesCurrentJob + // READ-ONLY; Gets or sets the current scenario. + CurrentJob *ProtectedItemJobProperties - // READ-ONLY; Gets or sets the DRA Id. - DraID *string + // READ-ONLY; Gets or sets the fabric agent Id. + FabricAgentID *string // READ-ONLY; Gets or sets the fabric Id. FabricID *string @@ -1288,11 +1616,11 @@ type ProtectedItemModelProperties struct { // READ-ONLY; Gets or sets the list of health errors. HealthErrors []*HealthErrorModel - // READ-ONLY - LastFailedEnableProtectionJob *ProtectedItemModelPropertiesLastFailedEnableProtectionJob + // READ-ONLY; Gets or sets the last failed enabled protection job. + LastFailedEnableProtectionJob *ProtectedItemJobProperties - // READ-ONLY - LastFailedPlannedFailoverJob *ProtectedItemModelPropertiesLastFailedPlannedFailoverJob + // READ-ONLY; Gets or sets the last failed planned failover job. + LastFailedPlannedFailoverJob *ProtectedItemJobProperties // READ-ONLY; Gets or sets the Last successful planned failover time. LastSuccessfulPlannedFailoverTime *time.Time @@ -1303,8 +1631,8 @@ type ProtectedItemModelProperties struct { // READ-ONLY; Gets or sets the Last successful unplanned failover time. LastSuccessfulUnplannedFailoverTime *time.Time - // READ-ONLY - LastTestFailoverJob *ProtectedItemModelPropertiesLastTestFailoverJob + // READ-ONLY; Gets or sets the last test failover job. + LastTestFailoverJob *ProtectedItemJobProperties // READ-ONLY; Gets or sets the protection state. ProtectionState *ProtectionState @@ -1312,7 +1640,7 @@ type ProtectedItemModelProperties struct { // READ-ONLY; Gets or sets the protection state description. ProtectionStateDescription *string - // READ-ONLY; Gets or sets the provisioning state of the Dra. + // READ-ONLY; Gets or sets the provisioning state of the fabric agent. ProvisioningState *ProvisioningState // READ-ONLY; Gets or sets protected item replication health. @@ -1327,8 +1655,8 @@ type ProtectedItemModelProperties struct { // READ-ONLY; Gets or sets the source fabric provider Id. SourceFabricProviderID *string - // READ-ONLY; Gets or sets the target DRA Id. - TargetDraID *string + // READ-ONLY; Gets or sets the target fabric agent Id. + TargetFabricAgentID *string // READ-ONLY; Gets or sets the target fabric Id. TargetFabricID *string @@ -1343,148 +1671,51 @@ type ProtectedItemModelProperties struct { TestFailoverStateDescription *string } -type ProtectedItemModelPropertiesCurrentJob struct { - // READ-ONLY; Gets or sets the workflow friendly display name. - DisplayName *string - - // READ-ONLY; Gets or sets end time of the workflow. - EndTime *time.Time - - // READ-ONLY; Gets or sets workflow Id. - ID *string - - // READ-ONLY; Gets or sets workflow name. - Name *string - - // READ-ONLY; Gets or sets protection scenario name. - ScenarioName *string - - // READ-ONLY; Gets or sets start time of the workflow. - StartTime *time.Time - - // READ-ONLY; Gets or sets workflow state. - State *string -} - -type ProtectedItemModelPropertiesLastFailedEnableProtectionJob struct { - // READ-ONLY; Gets or sets the workflow friendly display name. - DisplayName *string - - // READ-ONLY; Gets or sets end time of the workflow. - EndTime *time.Time - - // READ-ONLY; Gets or sets workflow Id. - ID *string - - // READ-ONLY; Gets or sets workflow name. - Name *string - - // READ-ONLY; Gets or sets protection scenario name. - ScenarioName *string - - // READ-ONLY; Gets or sets start time of the workflow. - StartTime *time.Time - - // READ-ONLY; Gets or sets workflow state. - State *string -} - -type ProtectedItemModelPropertiesLastFailedPlannedFailoverJob struct { - // READ-ONLY; Gets or sets the workflow friendly display name. - DisplayName *string - - // READ-ONLY; Gets or sets end time of the workflow. - EndTime *time.Time - - // READ-ONLY; Gets or sets workflow Id. - ID *string - - // READ-ONLY; Gets or sets workflow name. - Name *string - - // READ-ONLY; Gets or sets protection scenario name. - ScenarioName *string - - // READ-ONLY; Gets or sets start time of the workflow. - StartTime *time.Time - - // READ-ONLY; Gets or sets workflow state. - State *string +// ProtectedItemModelPropertiesUpdate - Protected item model properties update. +type ProtectedItemModelPropertiesUpdate struct { + // Protected item model custom properties update. + CustomProperties ProtectedItemModelCustomPropertiesUpdateClassification } -type ProtectedItemModelPropertiesLastTestFailoverJob struct { - // READ-ONLY; Gets or sets the workflow friendly display name. - DisplayName *string - - // READ-ONLY; Gets or sets end time of the workflow. - EndTime *time.Time +// ProtectedItemModelUpdate - Protected item model update. +type ProtectedItemModelUpdate struct { + // Protected item model properties. + Properties *ProtectedItemModelPropertiesUpdate - // READ-ONLY; Gets or sets workflow Id. + // READ-ONLY; Gets or sets the Id of the resource. ID *string - // READ-ONLY; Gets or sets workflow name. + // READ-ONLY; Gets or sets the name of the resource. Name *string - // READ-ONLY; Gets or sets protection scenario name. - ScenarioName *string - - // READ-ONLY; Gets or sets start time of the workflow. - StartTime *time.Time + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData - // READ-ONLY; Gets or sets workflow state. - State *string -} - -type ProtectedItemModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string - - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time - - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string - - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string + // READ-ONLY; Gets or sets the type of the resource. + Type *string } // RecoveryPointModel - Recovery point model. type RecoveryPointModel struct { - // REQUIRED; Recovery point model properties. + // The resource-specific properties for this resource. Properties *RecoveryPointModelProperties - // READ-ONLY; Gets or sets the Id of the resource. - ID *string - - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; The recovery point name. Name *string - // READ-ONLY - SystemData *RecoveryPointModelSystemData - - // READ-ONLY; Gets or sets the type of the resource. - Type *string -} + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string -// RecoveryPointModelCollection - Recovery point model collection. -type RecoveryPointModelCollection struct { - // Gets or sets the value of next link. - NextLink *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // Gets or sets the list of recovery points. - Value []*RecoveryPointModel + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } // RecoveryPointModelCustomProperties - Recovery point model custom properties. type RecoveryPointModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for RecoveryPointModelCustomProperties. InstanceType *string } @@ -1494,6 +1725,15 @@ func (r *RecoveryPointModelCustomProperties) GetRecoveryPointModelCustomProperti return r } +// RecoveryPointModelListResult - The response of a RecoveryPointModel list operation. +type RecoveryPointModelListResult struct { + // REQUIRED; The RecoveryPointModel items on this page + Value []*RecoveryPointModel + + // The link to the next page of items + NextLink *string +} + // RecoveryPointModelProperties - Recovery point model properties. type RecoveryPointModelProperties struct { // REQUIRED; Recovery point model custom properties. @@ -1504,58 +1744,56 @@ type RecoveryPointModelProperties struct { // REQUIRED; Gets or sets the recovery point type. RecoveryPointType *RecoveryPointType + + // READ-ONLY; Gets or sets the provisioning state of the recovery point item. + ProvisioningState *ProvisioningState } -type RecoveryPointModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time +// RemotePrivateEndpoint - Represent remote private endpoint information for the private endpoint connection proxy. +type RemotePrivateEndpoint struct { + // REQUIRED; Gets or sets private link service proxy id. + ID *string - // Gets or sets identity that created the resource. - CreatedBy *string + // Gets or sets the list of Connection Details. This is the connection details for private endpoint. + ConnectionDetails []*ConnectionDetails - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string + // Gets or sets the list of Manual Private Link Service Connections and gets populated for Manual approval flow. + ManualPrivateLinkServiceConnections []*PrivateLinkServiceConnection - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time + // Gets or sets the list of Private Link Service Connections and gets populated for Auto approval flow. + PrivateLinkServiceConnections []*PrivateLinkServiceConnection - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string + // Gets or sets the list of private link service proxies. + PrivateLinkServiceProxies []*PrivateLinkServiceProxy +} - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string +// RemotePrivateEndpointConnection - Represent remote private endpoint connection. +type RemotePrivateEndpointConnection struct { + // Gets or sets the remote private endpoint connection id. + ID *string } // ReplicationExtensionModel - Replication extension model. type ReplicationExtensionModel struct { - // REQUIRED; Replication extension model properties. + // The resource-specific properties for this resource. Properties *ReplicationExtensionModelProperties - // READ-ONLY; Gets or sets the Id of the resource. - ID *string - - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; The replication extension name. Name *string - // READ-ONLY - SystemData *ReplicationExtensionModelSystemData - - // READ-ONLY; Gets or sets the type of the resource. - Type *string -} + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string -// ReplicationExtensionModelCollection - Replication extension model collection. -type ReplicationExtensionModelCollection struct { - // Gets or sets the value of next link. - NextLink *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // Gets or sets the list of replication extensions. - Value []*ReplicationExtensionModel + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } // ReplicationExtensionModelCustomProperties - Replication extension model custom properties. type ReplicationExtensionModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for ReplicationExtensionModelCustomProperties. InstanceType *string } @@ -1565,6 +1803,15 @@ func (r *ReplicationExtensionModelCustomProperties) GetReplicationExtensionModel return r } +// ReplicationExtensionModelListResult - The response of a ReplicationExtensionModel list operation. +type ReplicationExtensionModelListResult struct { + // REQUIRED; The ReplicationExtensionModel items on this page + Value []*ReplicationExtensionModel + + // The link to the next page of items + NextLink *string +} + // ReplicationExtensionModelProperties - Replication extension model properties. type ReplicationExtensionModelProperties struct { // REQUIRED; Replication extension model custom properties. @@ -1574,39 +1821,40 @@ type ReplicationExtensionModelProperties struct { ProvisioningState *ProvisioningState } -type ReplicationExtensionModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). +// StorageContainerProperties - Storage container properties. +type StorageContainerProperties struct { + // REQUIRED; Gets or sets the ClusterSharedVolumePath. + ClusterSharedVolumePath *string + + // REQUIRED; Gets or sets the Name. + Name *string +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). CreatedAt *time.Time - // Gets or sets identity that created the resource. + // The identity that created the resource. CreatedBy *string - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string + // The type of identity that created the resource. + CreatedByType *CreatedByType - // Gets or sets the timestamp of resource last modification (UTC). + // The timestamp of resource last modification (UTC) LastModifiedAt *time.Time - // Gets or sets the identity that last modified the resource. + // The identity that last modified the resource. LastModifiedBy *string - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string -} - -// StorageContainerProperties - Storage container properties. -type StorageContainerProperties struct { - // REQUIRED; Gets or sets the ClusterSharedVolumePath. - ClusterSharedVolumePath *string - - // REQUIRED; Gets or sets the Name. - Name *string + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType } // TaskModel - Task model. type TaskModel struct { - // Gets or sets the list of children workflow models. - ChildrenWorkflows []*WorkflowModel + // Gets or sets the list of children job models. + ChildrenJobs []*JobModel // Task model custom properties. CustomProperties *TaskModelCustomProperties @@ -1630,68 +1878,79 @@ type TaskModelCustomProperties struct { InstanceType *string } -// TestFailoverCleanupWorkflowModelCustomProperties - Test failover cleanup workflow model custom properties. -type TestFailoverCleanupWorkflowModelCustomProperties struct { +// TestFailoverCleanupJobModelCustomProperties - Test failover cleanup job model custom properties. +type TestFailoverCleanupJobModelCustomProperties struct { // REQUIRED; Gets or sets the instance type. InstanceType *string // READ-ONLY; Gets or sets any custom properties of the affected object. - AffectedObjectDetails map[string]*string + AffectedObjectDetails *JobModelCustomPropertiesAffectedObjectDetails // READ-ONLY; Gets or sets the test failover cleanup comments. Comments *string } -// GetWorkflowModelCustomProperties implements the WorkflowModelCustomPropertiesClassification interface for type TestFailoverCleanupWorkflowModelCustomProperties. -func (t *TestFailoverCleanupWorkflowModelCustomProperties) GetWorkflowModelCustomProperties() *WorkflowModelCustomProperties { - return &WorkflowModelCustomProperties{ +// GetJobModelCustomProperties implements the JobModelCustomPropertiesClassification interface for type TestFailoverCleanupJobModelCustomProperties. +func (t *TestFailoverCleanupJobModelCustomProperties) GetJobModelCustomProperties() *JobModelCustomProperties { + return &JobModelCustomProperties{ AffectedObjectDetails: t.AffectedObjectDetails, InstanceType: t.InstanceType, } } -// TestFailoverWorkflowModelCustomProperties - Test failover workflow model custom properties. -type TestFailoverWorkflowModelCustomProperties struct { +// TestFailoverJobModelCustomProperties - Test failover job model custom properties. +type TestFailoverJobModelCustomProperties struct { // REQUIRED; Gets or sets the instance type. InstanceType *string // READ-ONLY; Gets or sets any custom properties of the affected object. - AffectedObjectDetails map[string]*string + AffectedObjectDetails *JobModelCustomPropertiesAffectedObjectDetails // READ-ONLY; Gets or sets the test VM details. ProtectedItemDetails []*FailoverProtectedItemProperties } -// GetWorkflowModelCustomProperties implements the WorkflowModelCustomPropertiesClassification interface for type TestFailoverWorkflowModelCustomProperties. -func (t *TestFailoverWorkflowModelCustomProperties) GetWorkflowModelCustomProperties() *WorkflowModelCustomProperties { - return &WorkflowModelCustomProperties{ +// GetJobModelCustomProperties implements the JobModelCustomPropertiesClassification interface for type TestFailoverJobModelCustomProperties. +func (t *TestFailoverJobModelCustomProperties) GetJobModelCustomProperties() *JobModelCustomProperties { + return &JobModelCustomProperties{ AffectedObjectDetails: t.AffectedObjectDetails, InstanceType: t.InstanceType, } } -// VMwareDraModelCustomProperties - VMware DRA model custom properties. -type VMwareDraModelCustomProperties struct { - // REQUIRED; Gets or sets the BIOS Id of the DRA machine. +// UserAssignedIdentity - User assigned identity properties +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the assigned identity. + ClientID *string + + // READ-ONLY; The principal ID of the assigned identity. + PrincipalID *string +} + +// VMwareFabricAgentModelCustomProperties - VMware fabric agent model custom properties. +type VMwareFabricAgentModelCustomProperties struct { + // REQUIRED; Gets or sets the BIOS Id of the fabric agent machine. BiosID *string - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "VMware", any specified value is ignored. InstanceType *string // REQUIRED; Identity model. MarsAuthenticationIdentity *IdentityModel } -// GetDraModelCustomProperties implements the DraModelCustomPropertiesClassification interface for type VMwareDraModelCustomProperties. -func (v *VMwareDraModelCustomProperties) GetDraModelCustomProperties() *DraModelCustomProperties { - return &DraModelCustomProperties{ +// GetFabricAgentModelCustomProperties implements the FabricAgentModelCustomPropertiesClassification interface for type VMwareFabricAgentModelCustomProperties. +func (v *VMwareFabricAgentModelCustomProperties) GetFabricAgentModelCustomProperties() *FabricAgentModelCustomProperties { + return &FabricAgentModelCustomProperties{ InstanceType: v.InstanceType, } } // VMwareMigrateFabricModelCustomProperties - VMware migrate fabric model custom properties. type VMwareMigrateFabricModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "VMwareMigrate", any specified value is ignored. InstanceType *string // REQUIRED; Gets or sets the ARM Id of the migration solution. @@ -1722,6 +1981,21 @@ type VMwareToAzStackHCIDiskInput struct { // REQUIRED; Gets or sets a value indicating whether disk is os disk. IsOsDisk *bool + // Gets or sets a value of disk block size. + DiskBlockSize *int64 + + // Disk controller. + DiskController *DiskControllerInputs + + // Gets or sets a value of disk identifier. + DiskIdentifier *string + + // Gets or sets a value of disk logical sector size. + DiskLogicalSectorSize *int64 + + // Gets or sets a value of disk physical sector size. + DiskPhysicalSectorSize *int64 + // Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard disk. IsDynamic *bool @@ -1729,6 +2003,35 @@ type VMwareToAzStackHCIDiskInput struct { StorageContainerID *string } +// VMwareToAzStackHCIEventModelCustomProperties - VMware to AzStackHCI event model custom properties. This class provides +// provider specific details for events of type DataContract.HealthEvents.HealthEventType.ProtectedItemHealth and DataContract.HealthEvents.HealthEventType.AgentHealth. +type VMwareToAzStackHCIEventModelCustomProperties struct { + // REQUIRED; Gets or sets the instance type. + InstanceType *string + + // READ-ONLY; Gets or sets the friendly name of the source which has raised this health event. + EventSourceFriendlyName *string + + // READ-ONLY; Gets or sets the protected item friendly name. + ProtectedItemFriendlyName *string + + // READ-ONLY; Gets or sets the server type. + ServerType *string + + // READ-ONLY; Gets or sets the source appliance name. + SourceApplianceName *string + + // READ-ONLY; Gets or sets the source target name. + TargetApplianceName *string +} + +// GetEventModelCustomProperties implements the EventModelCustomPropertiesClassification interface for type VMwareToAzStackHCIEventModelCustomProperties. +func (v *VMwareToAzStackHCIEventModelCustomProperties) GetEventModelCustomProperties() *EventModelCustomProperties { + return &EventModelCustomProperties{ + InstanceType: v.InstanceType, + } +} + // VMwareToAzStackHCINicInput - VMwareToAzStackHCI NIC properties. type VMwareToAzStackHCINicInput struct { // REQUIRED; Gets or sets the NIC label. @@ -1740,10 +2043,16 @@ type VMwareToAzStackHCINicInput struct { // REQUIRED; Gets or sets the selection type of the NIC. SelectionTypeForFailover *VMNicSelection - // REQUIRED; Gets or sets the target network Id within AzStackHCI Cluster. + // Gets or sets a value indicating whether mac address migration is enabled. + IsMacMigrationEnabled *bool + + // Gets or sets a value indicating whether static ip migration is enabled. + IsStaticIPMigrationEnabled *bool + + // Gets or sets the target network Id within AzStackHCI Cluster. TargetNetworkID *string - // REQUIRED; Gets or sets the target test network Id within AzStackHCI Cluster. + // Gets or sets the target test network Id within AzStackHCI Cluster. TestNetworkID *string // READ-ONLY; Gets or sets the network name. @@ -1752,7 +2061,8 @@ type VMwareToAzStackHCINicInput struct { // VMwareToAzStackHCIPlannedFailoverModelCustomProperties - VMware to AzStackHCI planned failover model custom properties. type VMwareToAzStackHCIPlannedFailoverModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "VMwareToAzStackHCI", any specified value is ignored. InstanceType *string // REQUIRED; Gets or sets a value indicating whether VM needs to be shut down. @@ -1775,7 +2085,8 @@ type VMwareToAzStackHCIPolicyModelCustomProperties struct { // REQUIRED; Gets or sets the crash consistent snapshot frequency (in minutes). CrashConsistentFrequencyInMinutes *int32 - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "VMwareToAzStackHCI", any specified value is ignored. InstanceType *string // REQUIRED; Gets or sets the duration in minutes until which the recovery points need to be stored. @@ -1794,6 +2105,15 @@ type VMwareToAzStackHCIProtectedDiskProperties struct { // READ-ONLY; Gets or sets the disk capacity in bytes. CapacityInBytes *int64 + // READ-ONLY; Gets or sets a value of disk block size. + DiskBlockSize *int64 + + // READ-ONLY; Gets or sets a value of disk logical sector size. + DiskLogicalSectorSize *int64 + + // READ-ONLY; Gets or sets a value of disk physical sector size. + DiskPhysicalSectorSize *int64 + // READ-ONLY; Gets or sets the disk type. DiskType *string @@ -1839,7 +2159,8 @@ type VMwareToAzStackHCIProtectedItemModelCustomProperties struct { // REQUIRED; Gets or sets the hypervisor generation of the virtual machine possible values are 1,2. HyperVGeneration *string - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "VMwareToAzStackHCI", any specified value is ignored. InstanceType *string // REQUIRED; Gets or sets the list of VM NIC to replicate. @@ -1848,8 +2169,8 @@ type VMwareToAzStackHCIProtectedItemModelCustomProperties struct { // REQUIRED; Gets or sets the run as account Id. RunAsAccountID *string - // REQUIRED; Gets or sets the source DRA name. - SourceDraName *string + // REQUIRED; Gets or sets the source fabric agent name. + SourceFabricAgentName *string // REQUIRED; Gets or sets the target storage container ARM Id. StorageContainerID *string @@ -1857,8 +2178,8 @@ type VMwareToAzStackHCIProtectedItemModelCustomProperties struct { // REQUIRED; Gets or sets the Target Arc Cluster Custom Location ARM Id. TargetArcClusterCustomLocationID *string - // REQUIRED; Gets or sets the target DRA name. - TargetDraName *string + // REQUIRED; Gets or sets the target fabric agent name. + TargetFabricAgentName *string // REQUIRED; Gets or sets the Target HCI Cluster ARM Id. TargetHciClusterID *string @@ -1979,6 +2300,39 @@ func (v *VMwareToAzStackHCIProtectedItemModelCustomProperties) GetProtectedItemM } } +// VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate - VMware to AzStackHCI Protected item model custom properties. +type VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate struct { + // CONSTANT; Gets or sets the instance type. + // Field has constant value "VMwareToAzStackHCI", any specified value is ignored. + InstanceType *string + + // Protected item dynamic memory config. + DynamicMemoryConfig *ProtectedItemDynamicMemoryConfig + + // Gets or sets a value indicating whether memory is dynamical. + IsDynamicRAM *bool + + // Gets or sets the list of VM NIC to replicate. + NicsToInclude []*VMwareToAzStackHCINicInput + + // Gets or sets the type of the OS. + OSType *string + + // Gets or sets the target CPU cores. + TargetCPUCores *int32 + + // Gets or sets the target memory in mega-bytes. + TargetMemoryInMegaBytes *int32 +} + +// GetProtectedItemModelCustomPropertiesUpdate implements the ProtectedItemModelCustomPropertiesUpdateClassification interface +// for type VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate. +func (v *VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate) GetProtectedItemModelCustomPropertiesUpdate() *ProtectedItemModelCustomPropertiesUpdate { + return &ProtectedItemModelCustomPropertiesUpdate{ + InstanceType: v.InstanceType, + } +} + // VMwareToAzStackHCIProtectedNicProperties - VMwareToAzStackHCI NIC properties. type VMwareToAzStackHCIProtectedNicProperties struct { // Gets or sets a value indicating whether this is the primary NIC. @@ -2006,12 +2360,30 @@ type VMwareToAzStackHCIProtectedNicProperties struct { TestNetworkID *string } +// VMwareToAzStackHCIRecoveryPointModelCustomProperties - VMware to AzStackHCI recovery point model custom properties. +type VMwareToAzStackHCIRecoveryPointModelCustomProperties struct { + // REQUIRED; Gets or sets the instance type. + InstanceType *string + + // READ-ONLY; Gets or sets the list of the disk Ids. + DiskIDs []*string +} + +// GetRecoveryPointModelCustomProperties implements the RecoveryPointModelCustomPropertiesClassification interface for type +// VMwareToAzStackHCIRecoveryPointModelCustomProperties. +func (v *VMwareToAzStackHCIRecoveryPointModelCustomProperties) GetRecoveryPointModelCustomProperties() *RecoveryPointModelCustomProperties { + return &RecoveryPointModelCustomProperties{ + InstanceType: v.InstanceType, + } +} + // VMwareToAzStackHCIReplicationExtensionModelCustomProperties - VMware to AzStackHCI Replication extension model custom properties. type VMwareToAzStackHCIReplicationExtensionModelCustomProperties struct { // REQUIRED; Gets or sets the ARM Id of the target AzStackHCI fabric. AzStackHciFabricArmID *string - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "VMwareToAzStackHCI", any specified value is ignored. InstanceType *string // REQUIRED; Gets or sets the ARM Id of the source VMware fabric. @@ -2068,37 +2440,54 @@ func (v *VMwareToAzStackHCIReplicationExtensionModelCustomProperties) GetReplica } } +// VaultIdentityModel - Vault model. +type VaultIdentityModel struct { + // REQUIRED; Gets or sets the identityType which can be either SystemAssigned or None. + Type *VaultIdentityType + + // READ-ONLY; Gets or sets the object ID of the service principal object for the managed identity that is used to grant role-based + // access to an Azure resource. + PrincipalID *string + + // READ-ONLY; Gets or sets a Globally Unique Identifier (GUID) that represents the Azure AD tenant where the resource is now + // a member. + TenantID *string +} + // VaultModel - Vault model. type VaultModel struct { - // REQUIRED; Gets or sets the location of the vault. + // REQUIRED; The geo-location where the resource lives Location *string - // Vault properties. + // READ-ONLY; The vault name. + Name *string + + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentity + + // The resource-specific properties for this resource. Properties *VaultModelProperties - // Gets or sets the resource tags. + // Resource tags. Tags map[string]*string - // READ-ONLY; Gets or sets the Id of the resource. + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Gets or sets the name of the resource. - Name *string - - // READ-ONLY - SystemData *VaultModelSystemData + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; Gets or sets the type of the resource. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// VaultModelCollection - Vault model collection. -type VaultModelCollection struct { - // Gets or sets the value of next link. - NextLink *string - - // Gets or sets the list of vaults. +// VaultModelListResult - The response of a VaultModel list operation. +type VaultModelListResult struct { + // REQUIRED; The VaultModel items on this page Value []*VaultModel + + // The link to the next page of items + NextLink *string } // VaultModelProperties - Vault properties. @@ -2113,28 +2502,11 @@ type VaultModelProperties struct { ServiceResourceID *string } -type VaultModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string - - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time - - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string - - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string -} - -// VaultModelUpdate - Vault model for update. +// VaultModelUpdate - Vault model update. type VaultModelUpdate struct { + // Vault identity. + Identity *VaultIdentityModel + // Vault properties. Properties *VaultModelProperties @@ -2147,144 +2519,9 @@ type VaultModelUpdate struct { // READ-ONLY; Gets or sets the name of the resource. Name *string - // READ-ONLY - SystemData *VaultModelUpdateSystemData - - // READ-ONLY; Gets or sets the type of the resource. - Type *string -} - -type VaultModelUpdateSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string - - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time - - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string - - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string -} - -// WorkflowModel - Workflow model. -type WorkflowModel struct { - // REQUIRED; Workflow model properties. - Properties *WorkflowModelProperties - - // READ-ONLY; Gets or sets the Id of the resource. - ID *string - - // READ-ONLY; Gets or sets the name of the resource. - Name *string - - // READ-ONLY - SystemData *WorkflowModelSystemData + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData // READ-ONLY; Gets or sets the type of the resource. Type *string } - -// WorkflowModelCollection - Workflow model collection. -type WorkflowModelCollection struct { - // Gets or sets the value of next link. - NextLink *string - - // Gets or sets the list of workflows. - Value []*WorkflowModel -} - -// WorkflowModelCustomProperties - Workflow model custom properties. -type WorkflowModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. - InstanceType *string - - // READ-ONLY; Gets or sets any custom properties of the affected object. - AffectedObjectDetails map[string]*string -} - -// GetWorkflowModelCustomProperties implements the WorkflowModelCustomPropertiesClassification interface for type WorkflowModelCustomProperties. -func (w *WorkflowModelCustomProperties) GetWorkflowModelCustomProperties() *WorkflowModelCustomProperties { - return w -} - -// WorkflowModelProperties - Workflow model properties. -type WorkflowModelProperties struct { - // REQUIRED; Workflow model custom properties. - CustomProperties WorkflowModelCustomPropertiesClassification - - // READ-ONLY; Gets or sets the workflow activity id. - ActivityID *string - - // READ-ONLY; Gets or sets the list of allowed actions on the workflow. - AllowedActions []*string - - // READ-ONLY; Gets or sets the friendly display name. - DisplayName *string - - // READ-ONLY; Gets or sets the end time. - EndTime *time.Time - - // READ-ONLY; Gets or sets the list of errors. - Errors []*ErrorModel - - // READ-ONLY; Gets or sets the affected object Id. - ObjectID *string - - // READ-ONLY; Gets or sets the affected object internal Id. - ObjectInternalID *string - - // READ-ONLY; Gets or sets the affected object internal name. - ObjectInternalName *string - - // READ-ONLY; Gets or sets the affected object name. - ObjectName *string - - // READ-ONLY; Gets or sets the object type. - ObjectType *WorkflowObjectType - - // READ-ONLY; Gets or sets the replication provider. - ReplicationProviderID *string - - // READ-ONLY; Gets or sets the source fabric provider. - SourceFabricProviderID *string - - // READ-ONLY; Gets or sets the start time. - StartTime *time.Time - - // READ-ONLY; Gets or sets the workflow state. - State *WorkflowState - - // READ-ONLY; Gets or sets the target fabric provider. - TargetFabricProviderID *string - - // READ-ONLY; Gets or sets the list of tasks. - Tasks []*TaskModel -} - -type WorkflowModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string - - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time - - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string - - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/models_serde.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/models_serde.go index e3fabf49a712..f6dc83d4ade9 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/models_serde.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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 armrecoveryservicesdatareplication @@ -175,45 +171,58 @@ func (c *CheckNameAvailabilityResponseModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DeploymentPreflightModel. -func (d DeploymentPreflightModel) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConnectionDetails. +func (c ConnectionDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "resources", d.Resources) + populate(objectMap, "groupId", c.GroupID) + populate(objectMap, "id", c.ID) + populate(objectMap, "linkIdentifier", c.LinkIdentifier) + populate(objectMap, "memberName", c.MemberName) + populate(objectMap, "privateIpAddress", c.PrivateIPAddress) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentPreflightModel. -func (d *DeploymentPreflightModel) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionDetails. +func (c *ConnectionDetails) 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", c, err) } for key, val := range rawMsg { var err error switch key { - case "resources": - err = unpopulate(val, "Resources", &d.Resources) + case "groupId": + err = unpopulate(val, "GroupID", &c.GroupID) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "linkIdentifier": + err = unpopulate(val, "LinkIdentifier", &c.LinkIdentifier) + delete(rawMsg, key) + case "memberName": + err = unpopulate(val, "MemberName", &c.MemberName) + delete(rawMsg, key) + case "privateIpAddress": + err = unpopulate(val, "PrivateIPAddress", &c.PrivateIPAddress) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DeploymentPreflightResource. -func (d DeploymentPreflightResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentPreflightModel. +func (d DeploymentPreflightModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "apiVersion", d.APIVersion) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "type", d.Type) + populate(objectMap, "resources", d.Resources) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentPreflightResource. -func (d *DeploymentPreflightResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentPreflightModel. +func (d *DeploymentPreflightModel) 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) @@ -221,17 +230,8 @@ func (d *DeploymentPreflightResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "apiVersion": - err = unpopulate(val, "APIVersion", &d.APIVersion) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &d.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + case "resources": + err = unpopulate(val, "Resources", &d.Resources) delete(rawMsg, key) } if err != nil { @@ -241,19 +241,19 @@ func (d *DeploymentPreflightResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DraModel. -func (d DraModel) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentPreflightResource. +func (d DeploymentPreflightResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) + populate(objectMap, "apiVersion", d.APIVersion) + populate(objectMap, "location", d.Location) populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) + populateAny(objectMap, "properties", d.Properties) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DraModel. -func (d *DraModel) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentPreflightResource. +func (d *DeploymentPreflightResource) 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) @@ -261,8 +261,11 @@ func (d *DraModel) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) + case "apiVersion": + err = unpopulate(val, "APIVersion", &d.APIVersion) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &d.Name) @@ -270,9 +273,6 @@ func (d *DraModel) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) - delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) @@ -284,145 +284,17 @@ func (d *DraModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DraModelCollection. -func (d DraModelCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DraModelCollection. -func (d *DraModelCollection) 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 "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DraModelCustomProperties. -func (d DraModelCustomProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["instanceType"] = d.InstanceType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DraModelCustomProperties. -func (d *DraModelCustomProperties) 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 "instanceType": - err = unpopulate(val, "InstanceType", &d.InstanceType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DraModelProperties. -func (d DraModelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "authenticationIdentity", d.AuthenticationIdentity) - populate(objectMap, "correlationId", d.CorrelationID) - populate(objectMap, "customProperties", d.CustomProperties) - populate(objectMap, "healthErrors", d.HealthErrors) - populate(objectMap, "isResponsive", d.IsResponsive) - populateDateTimeRFC3339(objectMap, "lastHeartbeat", d.LastHeartbeat) - populate(objectMap, "machineId", d.MachineID) - populate(objectMap, "machineName", d.MachineName) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "resourceAccessIdentity", d.ResourceAccessIdentity) - populate(objectMap, "versionNumber", d.VersionNumber) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DraModelProperties. -func (d *DraModelProperties) 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 "authenticationIdentity": - err = unpopulate(val, "AuthenticationIdentity", &d.AuthenticationIdentity) - delete(rawMsg, key) - case "correlationId": - err = unpopulate(val, "CorrelationID", &d.CorrelationID) - delete(rawMsg, key) - case "customProperties": - d.CustomProperties, err = unmarshalDraModelCustomPropertiesClassification(val) - delete(rawMsg, key) - case "healthErrors": - err = unpopulate(val, "HealthErrors", &d.HealthErrors) - delete(rawMsg, key) - case "isResponsive": - err = unpopulate(val, "IsResponsive", &d.IsResponsive) - delete(rawMsg, key) - case "lastHeartbeat": - err = unpopulateDateTimeRFC3339(val, "LastHeartbeat", &d.LastHeartbeat) - delete(rawMsg, key) - case "machineId": - err = unpopulate(val, "MachineID", &d.MachineID) - delete(rawMsg, key) - case "machineName": - err = unpopulate(val, "MachineName", &d.MachineName) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) - delete(rawMsg, key) - case "resourceAccessIdentity": - err = unpopulate(val, "ResourceAccessIdentity", &d.ResourceAccessIdentity) - delete(rawMsg, key) - case "versionNumber": - err = unpopulate(val, "VersionNumber", &d.VersionNumber) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DraModelSystemData. -func (d DraModelSystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DiskControllerInputs. +func (d DiskControllerInputs) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", d.CreatedAt) - populate(objectMap, "createdBy", d.CreatedBy) - populate(objectMap, "createdByType", d.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", d.LastModifiedAt) - populate(objectMap, "lastModifiedBy", d.LastModifiedBy) - populate(objectMap, "lastModifiedByType", d.LastModifiedByType) + populate(objectMap, "controllerId", d.ControllerID) + populate(objectMap, "controllerLocation", d.ControllerLocation) + populate(objectMap, "controllerName", d.ControllerName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DraModelSystemData. -func (d *DraModelSystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskControllerInputs. +func (d *DiskControllerInputs) 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) @@ -430,23 +302,14 @@ func (d *DraModelSystemData) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &d.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &d.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &d.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &d.LastModifiedAt) + case "controllerId": + err = unpopulate(val, "ControllerID", &d.ControllerID) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &d.LastModifiedBy) + case "controllerLocation": + err = unpopulate(val, "ControllerLocation", &d.ControllerLocation) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &d.LastModifiedByType) + case "controllerName": + err = unpopulate(val, "ControllerName", &d.ControllerName) delete(rawMsg, key) } if err != nil { @@ -499,16 +362,16 @@ func (e *EmailConfigurationModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type EmailConfigurationModelCollection. -func (e EmailConfigurationModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EmailConfigurationModelListResult. +func (e EmailConfigurationModelListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", e.NextLink) populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EmailConfigurationModelCollection. -func (e *EmailConfigurationModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EmailConfigurationModelListResult. +func (e *EmailConfigurationModelListResult) 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) @@ -535,6 +398,7 @@ func (e EmailConfigurationModelProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "customEmailAddresses", e.CustomEmailAddresses) populate(objectMap, "locale", e.Locale) + populate(objectMap, "provisioningState", e.ProvisioningState) populate(objectMap, "sendToOwners", e.SendToOwners) return json.Marshal(objectMap) } @@ -554,6 +418,9 @@ func (e *EmailConfigurationModelProperties) UnmarshalJSON(data []byte) error { case "locale": err = unpopulate(val, "Locale", &e.Locale) delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) case "sendToOwners": err = unpopulate(val, "SendToOwners", &e.SendToOwners) delete(rawMsg, key) @@ -565,53 +432,6 @@ func (e *EmailConfigurationModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type EmailConfigurationModelSystemData. -func (e EmailConfigurationModelSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", e.CreatedAt) - populate(objectMap, "createdBy", e.CreatedBy) - populate(objectMap, "createdByType", e.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", e.LastModifiedAt) - populate(objectMap, "lastModifiedBy", e.LastModifiedBy) - populate(objectMap, "lastModifiedByType", e.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EmailConfigurationModelSystemData. -func (e *EmailConfigurationModelSystemData) 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 "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &e.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &e.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &e.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &e.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &e.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &e.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type ErrorModel. func (e ErrorModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -706,16 +526,15 @@ func (e *EventModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type EventModelCollection. -func (e EventModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventModelCustomProperties. +func (e EventModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) + populate(objectMap, "instanceType", e.InstanceType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventModelCollection. -func (e *EventModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventModelCustomProperties. +func (e *EventModelCustomProperties) 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) @@ -723,11 +542,8 @@ func (e *EventModelCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &e.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &e.Value) + case "instanceType": + err = unpopulate(val, "InstanceType", &e.InstanceType) delete(rawMsg, key) } if err != nil { @@ -737,15 +553,16 @@ func (e *EventModelCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type EventModelCustomProperties. -func (e EventModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventModelListResult. +func (e EventModelListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["instanceType"] = e.InstanceType + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventModelCustomProperties. -func (e *EventModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventModelListResult. +func (e *EventModelListResult) 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) @@ -753,8 +570,11 @@ func (e *EventModelCustomProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "instanceType": - err = unpopulate(val, "InstanceType", &e.InstanceType) + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) delete(rawMsg, key) } if err != nil { @@ -773,6 +593,7 @@ func (e EventModelProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "eventName", e.EventName) populate(objectMap, "eventType", e.EventType) populate(objectMap, "healthErrors", e.HealthErrors) + populate(objectMap, "provisioningState", e.ProvisioningState) populate(objectMap, "resourceName", e.ResourceName) populate(objectMap, "resourceType", e.ResourceType) populate(objectMap, "severity", e.Severity) @@ -807,6 +628,9 @@ func (e *EventModelProperties) UnmarshalJSON(data []byte) error { case "healthErrors": err = unpopulate(val, "HealthErrors", &e.HealthErrors) delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) case "resourceName": err = unpopulate(val, "ResourceName", &e.ResourceName) delete(rawMsg, key) @@ -827,68 +651,19 @@ func (e *EventModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type EventModelSystemData. -func (e EventModelSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", e.CreatedAt) - populate(objectMap, "createdBy", e.CreatedBy) - populate(objectMap, "createdByType", e.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", e.LastModifiedAt) - populate(objectMap, "lastModifiedBy", e.LastModifiedBy) - populate(objectMap, "lastModifiedByType", e.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventModelSystemData. -func (e *EventModelSystemData) 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 "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &e.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &e.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &e.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &e.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &e.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &e.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FabricModel. -func (f FabricModel) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FabricAgentModel. +func (f FabricAgentModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", f.ID) - populate(objectMap, "location", f.Location) populate(objectMap, "name", f.Name) populate(objectMap, "properties", f.Properties) populate(objectMap, "systemData", f.SystemData) - populate(objectMap, "tags", f.Tags) populate(objectMap, "type", f.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FabricModel. -func (f *FabricModel) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FabricAgentModel. +func (f *FabricAgentModel) 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", f, err) @@ -899,9 +674,6 @@ func (f *FabricModel) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &f.ID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &f.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &f.Name) delete(rawMsg, key) @@ -911,9 +683,6 @@ func (f *FabricModel) UnmarshalJSON(data []byte) error { case "systemData": err = unpopulate(val, "SystemData", &f.SystemData) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &f.Tags) - delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &f.Type) delete(rawMsg, key) @@ -925,16 +694,43 @@ func (f *FabricModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type FabricModelCollection. -func (f FabricModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FabricAgentModelCustomProperties. +func (f FabricAgentModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "instanceType", f.InstanceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FabricAgentModelCustomProperties. +func (f *FabricAgentModelCustomProperties) 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", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "instanceType": + err = unpopulate(val, "InstanceType", &f.InstanceType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FabricAgentModelListResult. +func (f FabricAgentModelListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) populate(objectMap, "value", f.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FabricModelCollection. -func (f *FabricModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FabricAgentModelListResult. +func (f *FabricAgentModelListResult) 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", f, err) @@ -956,10 +752,128 @@ func (f *FabricModelCollection) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type FabricAgentModelProperties. +func (f FabricAgentModelProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authenticationIdentity", f.AuthenticationIdentity) + populate(objectMap, "correlationId", f.CorrelationID) + populate(objectMap, "customProperties", f.CustomProperties) + populate(objectMap, "healthErrors", f.HealthErrors) + populate(objectMap, "isResponsive", f.IsResponsive) + populateDateTimeRFC3339(objectMap, "lastHeartbeat", f.LastHeartbeat) + populate(objectMap, "machineId", f.MachineID) + populate(objectMap, "machineName", f.MachineName) + populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "resourceAccessIdentity", f.ResourceAccessIdentity) + populate(objectMap, "versionNumber", f.VersionNumber) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FabricAgentModelProperties. +func (f *FabricAgentModelProperties) 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", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authenticationIdentity": + err = unpopulate(val, "AuthenticationIdentity", &f.AuthenticationIdentity) + delete(rawMsg, key) + case "correlationId": + err = unpopulate(val, "CorrelationID", &f.CorrelationID) + delete(rawMsg, key) + case "customProperties": + f.CustomProperties, err = unmarshalFabricAgentModelCustomPropertiesClassification(val) + delete(rawMsg, key) + case "healthErrors": + err = unpopulate(val, "HealthErrors", &f.HealthErrors) + delete(rawMsg, key) + case "isResponsive": + err = unpopulate(val, "IsResponsive", &f.IsResponsive) + delete(rawMsg, key) + case "lastHeartbeat": + err = unpopulateDateTimeRFC3339(val, "LastHeartbeat", &f.LastHeartbeat) + delete(rawMsg, key) + case "machineId": + err = unpopulate(val, "MachineID", &f.MachineID) + delete(rawMsg, key) + case "machineName": + err = unpopulate(val, "MachineName", &f.MachineName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + case "resourceAccessIdentity": + err = unpopulate(val, "ResourceAccessIdentity", &f.ResourceAccessIdentity) + delete(rawMsg, key) + case "versionNumber": + err = unpopulate(val, "VersionNumber", &f.VersionNumber) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FabricModel. +func (f FabricModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "location", f.Location) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "tags", f.Tags) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FabricModel. +func (f *FabricModel) 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", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &f.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &f.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type FabricModelCustomProperties. func (f FabricModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["instanceType"] = f.InstanceType + populate(objectMap, "instanceType", f.InstanceType) return json.Marshal(objectMap) } @@ -983,6 +897,37 @@ func (f *FabricModelCustomProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type FabricModelListResult. +func (f FabricModelListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FabricModelListResult. +func (f *FabricModelListResult) 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", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type FabricModelProperties. func (f FabricModelProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1030,53 +975,6 @@ func (f *FabricModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type FabricModelSystemData. -func (f FabricModelSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", f.CreatedAt) - populate(objectMap, "createdBy", f.CreatedBy) - populate(objectMap, "createdByType", f.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", f.LastModifiedAt) - populate(objectMap, "lastModifiedBy", f.LastModifiedBy) - populate(objectMap, "lastModifiedByType", f.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FabricModelSystemData. -func (f *FabricModelSystemData) 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", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &f.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &f.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &f.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &f.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &f.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &f.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type FabricModelUpdate. func (f FabricModelUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1124,20 +1022,17 @@ func (f *FabricModelUpdate) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type FabricModelUpdateSystemData. -func (f FabricModelUpdateSystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FailoverJobModelCustomProperties. +func (f FailoverJobModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", f.CreatedAt) - populate(objectMap, "createdBy", f.CreatedBy) - populate(objectMap, "createdByType", f.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", f.LastModifiedAt) - populate(objectMap, "lastModifiedBy", f.LastModifiedBy) - populate(objectMap, "lastModifiedByType", f.LastModifiedByType) + populate(objectMap, "affectedObjectDetails", f.AffectedObjectDetails) + objectMap["instanceType"] = "FailoverJobDetails" + populate(objectMap, "protectedItemDetails", f.ProtectedItemDetails) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FabricModelUpdateSystemData. -func (f *FabricModelUpdateSystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverJobModelCustomProperties. +func (f *FailoverJobModelCustomProperties) 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", f, err) @@ -1145,23 +1040,14 @@ func (f *FabricModelUpdateSystemData) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &f.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &f.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &f.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &f.LastModifiedAt) + case "affectedObjectDetails": + err = unpopulate(val, "AffectedObjectDetails", &f.AffectedObjectDetails) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &f.LastModifiedBy) + case "instanceType": + err = unpopulate(val, "InstanceType", &f.InstanceType) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &f.LastModifiedByType) + case "protectedItemDetails": + err = unpopulate(val, "ProtectedItemDetails", &f.ProtectedItemDetails) delete(rawMsg, key) } if err != nil { @@ -1222,36 +1108,48 @@ func (f *FailoverProtectedItemProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type FailoverWorkflowModelCustomProperties. -func (f FailoverWorkflowModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GroupConnectivityInformation. +func (g GroupConnectivityInformation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "affectedObjectDetails", f.AffectedObjectDetails) - objectMap["instanceType"] = "FailoverWorkflowDetails" - populate(objectMap, "protectedItemDetails", f.ProtectedItemDetails) + populate(objectMap, "customerVisibleFqdns", g.CustomerVisibleFqdns) + populate(objectMap, "groupId", g.GroupID) + populate(objectMap, "internalFqdn", g.InternalFqdn) + populate(objectMap, "memberName", g.MemberName) + populate(objectMap, "privateLinkServiceArmRegion", g.PrivateLinkServiceArmRegion) + populate(objectMap, "redirectMapId", g.RedirectMapID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverWorkflowModelCustomProperties. -func (f *FailoverWorkflowModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupConnectivityInformation. +func (g *GroupConnectivityInformation) 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", f, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "affectedObjectDetails": - err = unpopulate(val, "AffectedObjectDetails", &f.AffectedObjectDetails) + case "customerVisibleFqdns": + err = unpopulate(val, "CustomerVisibleFqdns", &g.CustomerVisibleFqdns) delete(rawMsg, key) - case "instanceType": - err = unpopulate(val, "InstanceType", &f.InstanceType) + case "groupId": + err = unpopulate(val, "GroupID", &g.GroupID) delete(rawMsg, key) - case "protectedItemDetails": - err = unpopulate(val, "ProtectedItemDetails", &f.ProtectedItemDetails) + case "internalFqdn": + err = unpopulate(val, "InternalFqdn", &g.InternalFqdn) + delete(rawMsg, key) + case "memberName": + err = unpopulate(val, "MemberName", &g.MemberName) + delete(rawMsg, key) + case "privateLinkServiceArmRegion": + err = unpopulate(val, "PrivateLinkServiceArmRegion", &g.PrivateLinkServiceArmRegion) + delete(rawMsg, key) + case "redirectMapId": + err = unpopulate(val, "RedirectMapID", &g.RedirectMapID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil @@ -1386,8 +1284,13 @@ func (h *HyperVMigrateFabricModelCustomProperties) UnmarshalJSON(data []byte) er // MarshalJSON implements the json.Marshaller interface for type HyperVToAzStackHCIDiskInput. func (h HyperVToAzStackHCIDiskInput) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "diskBlockSize", h.DiskBlockSize) + populate(objectMap, "diskController", h.DiskController) populate(objectMap, "diskFileFormat", h.DiskFileFormat) populate(objectMap, "diskId", h.DiskID) + populate(objectMap, "diskIdentifier", h.DiskIdentifier) + populate(objectMap, "diskLogicalSectorSize", h.DiskLogicalSectorSize) + populate(objectMap, "diskPhysicalSectorSize", h.DiskPhysicalSectorSize) populate(objectMap, "diskSizeGB", h.DiskSizeGB) populate(objectMap, "isDynamic", h.IsDynamic) populate(objectMap, "isOsDisk", h.IsOsDisk) @@ -1404,12 +1307,27 @@ func (h *HyperVToAzStackHCIDiskInput) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "diskBlockSize": + err = unpopulate(val, "DiskBlockSize", &h.DiskBlockSize) + delete(rawMsg, key) + case "diskController": + err = unpopulate(val, "DiskController", &h.DiskController) + delete(rawMsg, key) case "diskFileFormat": err = unpopulate(val, "DiskFileFormat", &h.DiskFileFormat) delete(rawMsg, key) case "diskId": err = unpopulate(val, "DiskID", &h.DiskID) delete(rawMsg, key) + case "diskIdentifier": + err = unpopulate(val, "DiskIdentifier", &h.DiskIdentifier) + delete(rawMsg, key) + case "diskLogicalSectorSize": + err = unpopulate(val, "DiskLogicalSectorSize", &h.DiskLogicalSectorSize) + delete(rawMsg, key) + case "diskPhysicalSectorSize": + err = unpopulate(val, "DiskPhysicalSectorSize", &h.DiskPhysicalSectorSize) + delete(rawMsg, key) case "diskSizeGB": err = unpopulate(val, "DiskSizeGB", &h.DiskSizeGB) delete(rawMsg, key) @@ -1480,6 +1398,8 @@ func (h *HyperVToAzStackHCIEventModelCustomProperties) UnmarshalJSON(data []byte // MarshalJSON implements the json.Marshaller interface for type HyperVToAzStackHCINicInput. func (h HyperVToAzStackHCINicInput) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "isMacMigrationEnabled", h.IsMacMigrationEnabled) + populate(objectMap, "isStaticIpMigrationEnabled", h.IsStaticIPMigrationEnabled) populate(objectMap, "networkName", h.NetworkName) populate(objectMap, "nicId", h.NicID) populate(objectMap, "selectionTypeForFailover", h.SelectionTypeForFailover) @@ -1497,6 +1417,12 @@ func (h *HyperVToAzStackHCINicInput) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "isMacMigrationEnabled": + err = unpopulate(val, "IsMacMigrationEnabled", &h.IsMacMigrationEnabled) + delete(rawMsg, key) + case "isStaticIpMigrationEnabled": + err = unpopulate(val, "IsStaticIPMigrationEnabled", &h.IsStaticIPMigrationEnabled) + delete(rawMsg, key) case "networkName": err = unpopulate(val, "NetworkName", &h.NetworkName) delete(rawMsg, key) @@ -1594,6 +1520,9 @@ func (h *HyperVToAzStackHCIPolicyModelCustomProperties) UnmarshalJSON(data []byt func (h HyperVToAzStackHCIProtectedDiskProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "capacityInBytes", h.CapacityInBytes) + populate(objectMap, "diskBlockSize", h.DiskBlockSize) + populate(objectMap, "diskLogicalSectorSize", h.DiskLogicalSectorSize) + populate(objectMap, "diskPhysicalSectorSize", h.DiskPhysicalSectorSize) populate(objectMap, "diskType", h.DiskType) populate(objectMap, "isDynamic", h.IsDynamic) populate(objectMap, "isOsDisk", h.IsOsDisk) @@ -1619,6 +1548,15 @@ func (h *HyperVToAzStackHCIProtectedDiskProperties) UnmarshalJSON(data []byte) e case "capacityInBytes": err = unpopulate(val, "CapacityInBytes", &h.CapacityInBytes) delete(rawMsg, key) + case "diskBlockSize": + err = unpopulate(val, "DiskBlockSize", &h.DiskBlockSize) + delete(rawMsg, key) + case "diskLogicalSectorSize": + err = unpopulate(val, "DiskLogicalSectorSize", &h.DiskLogicalSectorSize) + delete(rawMsg, key) + case "diskPhysicalSectorSize": + err = unpopulate(val, "DiskPhysicalSectorSize", &h.DiskPhysicalSectorSize) + delete(rawMsg, key) case "diskType": err = unpopulate(val, "DiskType", &h.DiskType) delete(rawMsg, key) @@ -1683,7 +1621,7 @@ func (h HyperVToAzStackHCIProtectedItemModelCustomProperties) MarshalJSON() ([]b populate(objectMap, "runAsAccountId", h.RunAsAccountID) populate(objectMap, "sourceApplianceName", h.SourceApplianceName) populate(objectMap, "sourceCpuCores", h.SourceCPUCores) - populate(objectMap, "sourceDraName", h.SourceDraName) + populate(objectMap, "sourceFabricAgentName", h.SourceFabricAgentName) populate(objectMap, "sourceMemoryInMegaBytes", h.SourceMemoryInMegaBytes) populate(objectMap, "sourceVmName", h.SourceVMName) populate(objectMap, "storageContainerId", h.StorageContainerID) @@ -1691,7 +1629,7 @@ func (h HyperVToAzStackHCIProtectedItemModelCustomProperties) MarshalJSON() ([]b populate(objectMap, "targetArcClusterCustomLocationId", h.TargetArcClusterCustomLocationID) populate(objectMap, "targetAzStackHciClusterName", h.TargetAzStackHciClusterName) populate(objectMap, "targetCpuCores", h.TargetCPUCores) - populate(objectMap, "targetDraName", h.TargetDraName) + populate(objectMap, "targetFabricAgentName", h.TargetFabricAgentName) populate(objectMap, "targetHciClusterId", h.TargetHciClusterID) populate(objectMap, "targetLocation", h.TargetLocation) populate(objectMap, "targetMemoryInMegaBytes", h.TargetMemoryInMegaBytes) @@ -1781,8 +1719,8 @@ func (h *HyperVToAzStackHCIProtectedItemModelCustomProperties) UnmarshalJSON(dat case "sourceCpuCores": err = unpopulate(val, "SourceCPUCores", &h.SourceCPUCores) delete(rawMsg, key) - case "sourceDraName": - err = unpopulate(val, "SourceDraName", &h.SourceDraName) + case "sourceFabricAgentName": + err = unpopulate(val, "SourceFabricAgentName", &h.SourceFabricAgentName) delete(rawMsg, key) case "sourceMemoryInMegaBytes": err = unpopulate(val, "SourceMemoryInMegaBytes", &h.SourceMemoryInMegaBytes) @@ -1805,8 +1743,8 @@ func (h *HyperVToAzStackHCIProtectedItemModelCustomProperties) UnmarshalJSON(dat case "targetCpuCores": err = unpopulate(val, "TargetCPUCores", &h.TargetCPUCores) delete(rawMsg, key) - case "targetDraName": - err = unpopulate(val, "TargetDraName", &h.TargetDraName) + case "targetFabricAgentName": + err = unpopulate(val, "TargetFabricAgentName", &h.TargetFabricAgentName) delete(rawMsg, key) case "targetHciClusterId": err = unpopulate(val, "TargetHciClusterID", &h.TargetHciClusterID) @@ -1840,20 +1778,21 @@ func (h *HyperVToAzStackHCIProtectedItemModelCustomProperties) UnmarshalJSON(dat return nil } -// MarshalJSON implements the json.Marshaller interface for type HyperVToAzStackHCIProtectedNicProperties. -func (h HyperVToAzStackHCIProtectedNicProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate. +func (h HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "macAddress", h.MacAddress) - populate(objectMap, "networkName", h.NetworkName) - populate(objectMap, "nicId", h.NicID) - populate(objectMap, "selectionTypeForFailover", h.SelectionTypeForFailover) - populate(objectMap, "targetNetworkId", h.TargetNetworkID) - populate(objectMap, "testNetworkId", h.TestNetworkID) + populate(objectMap, "dynamicMemoryConfig", h.DynamicMemoryConfig) + objectMap["instanceType"] = "HyperVToAzStackHCI" + populate(objectMap, "isDynamicRam", h.IsDynamicRAM) + populate(objectMap, "nicsToInclude", h.NicsToInclude) + populate(objectMap, "osType", h.OSType) + populate(objectMap, "targetCpuCores", h.TargetCPUCores) + populate(objectMap, "targetMemoryInMegaBytes", h.TargetMemoryInMegaBytes) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HyperVToAzStackHCIProtectedNicProperties. -func (h *HyperVToAzStackHCIProtectedNicProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate. +func (h *HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate) 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) @@ -1861,22 +1800,72 @@ func (h *HyperVToAzStackHCIProtectedNicProperties) UnmarshalJSON(data []byte) er for key, val := range rawMsg { var err error switch key { - case "macAddress": - err = unpopulate(val, "MacAddress", &h.MacAddress) + case "dynamicMemoryConfig": + err = unpopulate(val, "DynamicMemoryConfig", &h.DynamicMemoryConfig) delete(rawMsg, key) - case "networkName": - err = unpopulate(val, "NetworkName", &h.NetworkName) + case "instanceType": + err = unpopulate(val, "InstanceType", &h.InstanceType) delete(rawMsg, key) - case "nicId": - err = unpopulate(val, "NicID", &h.NicID) + case "isDynamicRam": + err = unpopulate(val, "IsDynamicRAM", &h.IsDynamicRAM) delete(rawMsg, key) - case "selectionTypeForFailover": - err = unpopulate(val, "SelectionTypeForFailover", &h.SelectionTypeForFailover) + case "nicsToInclude": + err = unpopulate(val, "NicsToInclude", &h.NicsToInclude) delete(rawMsg, key) - case "targetNetworkId": - err = unpopulate(val, "TargetNetworkID", &h.TargetNetworkID) + case "osType": + err = unpopulate(val, "OSType", &h.OSType) delete(rawMsg, key) - case "testNetworkId": + case "targetCpuCores": + err = unpopulate(val, "TargetCPUCores", &h.TargetCPUCores) + delete(rawMsg, key) + case "targetMemoryInMegaBytes": + err = unpopulate(val, "TargetMemoryInMegaBytes", &h.TargetMemoryInMegaBytes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HyperVToAzStackHCIProtectedNicProperties. +func (h HyperVToAzStackHCIProtectedNicProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "macAddress", h.MacAddress) + populate(objectMap, "networkName", h.NetworkName) + populate(objectMap, "nicId", h.NicID) + populate(objectMap, "selectionTypeForFailover", h.SelectionTypeForFailover) + populate(objectMap, "targetNetworkId", h.TargetNetworkID) + populate(objectMap, "testNetworkId", h.TestNetworkID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HyperVToAzStackHCIProtectedNicProperties. +func (h *HyperVToAzStackHCIProtectedNicProperties) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "macAddress": + err = unpopulate(val, "MacAddress", &h.MacAddress) + delete(rawMsg, key) + case "networkName": + err = unpopulate(val, "NetworkName", &h.NetworkName) + delete(rawMsg, key) + case "nicId": + err = unpopulate(val, "NicID", &h.NicID) + delete(rawMsg, key) + case "selectionTypeForFailover": + err = unpopulate(val, "SelectionTypeForFailover", &h.SelectionTypeForFailover) + delete(rawMsg, key) + case "targetNetworkId": + err = unpopulate(val, "TargetNetworkID", &h.TargetNetworkID) + delete(rawMsg, key) + case "testNetworkId": err = unpopulate(val, "TestNetworkID", &h.TestNetworkID) delete(rawMsg, key) } @@ -2119,6 +2108,278 @@ func (i *InnerHealthErrorModel) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type JobModel. +func (j JobModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", j.ID) + populate(objectMap, "name", j.Name) + populate(objectMap, "properties", j.Properties) + populate(objectMap, "systemData", j.SystemData) + populate(objectMap, "type", j.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobModel. +func (j *JobModel) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &j.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &j.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &j.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &j.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &j.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobModelCustomProperties. +func (j JobModelCustomProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "affectedObjectDetails", j.AffectedObjectDetails) + populate(objectMap, "instanceType", j.InstanceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobModelCustomProperties. +func (j *JobModelCustomProperties) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "affectedObjectDetails": + err = unpopulate(val, "AffectedObjectDetails", &j.AffectedObjectDetails) + delete(rawMsg, key) + case "instanceType": + err = unpopulate(val, "InstanceType", &j.InstanceType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobModelCustomPropertiesAffectedObjectDetails. +func (j JobModelCustomPropertiesAffectedObjectDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", j.Description) + if j.Type != nil { + objectMap["type"] = "object" + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobModelCustomPropertiesAffectedObjectDetails. +func (j *JobModelCustomPropertiesAffectedObjectDetails) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &j.Description) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &j.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobModelListResult. +func (j JobModelListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", j.NextLink) + populate(objectMap, "value", j.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobModelListResult. +func (j *JobModelListResult) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &j.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &j.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobModelProperties. +func (j JobModelProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "activityId", j.ActivityID) + populate(objectMap, "allowedActions", j.AllowedActions) + populate(objectMap, "customProperties", j.CustomProperties) + populate(objectMap, "displayName", j.DisplayName) + populateDateTimeRFC3339(objectMap, "endTime", j.EndTime) + populate(objectMap, "errors", j.Errors) + populate(objectMap, "objectId", j.ObjectID) + populate(objectMap, "objectInternalId", j.ObjectInternalID) + populate(objectMap, "objectInternalName", j.ObjectInternalName) + populate(objectMap, "objectName", j.ObjectName) + populate(objectMap, "objectType", j.ObjectType) + populate(objectMap, "provisioningState", j.ProvisioningState) + populate(objectMap, "replicationProviderId", j.ReplicationProviderID) + populate(objectMap, "sourceFabricProviderId", j.SourceFabricProviderID) + populateDateTimeRFC3339(objectMap, "startTime", j.StartTime) + populate(objectMap, "state", j.State) + populate(objectMap, "targetFabricProviderId", j.TargetFabricProviderID) + populate(objectMap, "tasks", j.Tasks) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobModelProperties. +func (j *JobModelProperties) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "activityId": + err = unpopulate(val, "ActivityID", &j.ActivityID) + delete(rawMsg, key) + case "allowedActions": + err = unpopulate(val, "AllowedActions", &j.AllowedActions) + delete(rawMsg, key) + case "customProperties": + j.CustomProperties, err = unmarshalJobModelCustomPropertiesClassification(val) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &j.DisplayName) + delete(rawMsg, key) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &j.EndTime) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &j.Errors) + delete(rawMsg, key) + case "objectId": + err = unpopulate(val, "ObjectID", &j.ObjectID) + delete(rawMsg, key) + case "objectInternalId": + err = unpopulate(val, "ObjectInternalID", &j.ObjectInternalID) + delete(rawMsg, key) + case "objectInternalName": + err = unpopulate(val, "ObjectInternalName", &j.ObjectInternalName) + delete(rawMsg, key) + case "objectName": + err = unpopulate(val, "ObjectName", &j.ObjectName) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &j.ObjectType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &j.ProvisioningState) + delete(rawMsg, key) + case "replicationProviderId": + err = unpopulate(val, "ReplicationProviderID", &j.ReplicationProviderID) + delete(rawMsg, key) + case "sourceFabricProviderId": + err = unpopulate(val, "SourceFabricProviderID", &j.SourceFabricProviderID) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &j.StartTime) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &j.State) + delete(rawMsg, key) + case "targetFabricProviderId": + err = unpopulate(val, "TargetFabricProviderID", &j.TargetFabricProviderID) + delete(rawMsg, key) + case "tasks": + err = unpopulate(val, "Tasks", &j.Tasks) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. +func (m *ManagedServiceIdentity) 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 "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + 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 Operation. func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2305,7 +2566,7 @@ func (p *PlannedFailoverModel) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PlannedFailoverModelCustomProperties. func (p PlannedFailoverModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["instanceType"] = p.InstanceType + populate(objectMap, "instanceType", p.InstanceType) return json.Marshal(objectMap) } @@ -2399,16 +2660,15 @@ func (p *PolicyModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PolicyModelCollection. -func (p PolicyModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PolicyModelCustomProperties. +func (p PolicyModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "instanceType", p.InstanceType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyModelCollection. -func (p *PolicyModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyModelCustomProperties. +func (p *PolicyModelCustomProperties) 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) @@ -2416,11 +2676,8 @@ func (p *PolicyModelCollection) UnmarshalJSON(data []byte) error { 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 "instanceType": + err = unpopulate(val, "InstanceType", &p.InstanceType) delete(rawMsg, key) } if err != nil { @@ -2430,15 +2687,16 @@ func (p *PolicyModelCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PolicyModelCustomProperties. -func (p PolicyModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PolicyModelListResult. +func (p PolicyModelListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["instanceType"] = p.InstanceType + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyModelCustomProperties. -func (p *PolicyModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyModelListResult. +func (p *PolicyModelListResult) 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) @@ -2446,8 +2704,11 @@ func (p *PolicyModelCustomProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "instanceType": - err = unpopulate(val, "InstanceType", &p.InstanceType) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { @@ -2488,20 +2749,15 @@ func (p *PolicyModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PolicyModelSystemData. -func (p PolicyModelSystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. +func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", p.CreatedAt) - populate(objectMap, "createdBy", p.CreatedBy) - populate(objectMap, "createdByType", p.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", p.LastModifiedAt) - populate(objectMap, "lastModifiedBy", p.LastModifiedBy) - populate(objectMap, "lastModifiedByType", p.LastModifiedByType) + populate(objectMap, "id", p.ID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyModelSystemData. -func (p *PolicyModelSystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. +func (p *PrivateEndpoint) 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) @@ -2509,23 +2765,448 @@ func (p *PolicyModelSystemData) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &p.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &p.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &p.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &p.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &p.LastModifiedBy) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &p.LastModifiedByType) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) 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, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) 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) + } + 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 "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) 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) + } + 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) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProxy. +func (p PrivateEndpointConnectionProxy) 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, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProxy. +func (p *PrivateEndpointConnectionProxy) 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) + } + 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 "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProxyListResult. +func (p PrivateEndpointConnectionProxyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProxyListResult. +func (p *PrivateEndpointConnectionProxyListResult) 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) + } + 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) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProxyProperties. +func (p PrivateEndpointConnectionProxyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "remotePrivateEndpoint", p.RemotePrivateEndpoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProxyProperties. +func (p *PrivateEndpointConnectionProxyProperties) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "remotePrivateEndpoint": + err = unpopulate(val, "RemotePrivateEndpoint", &p.RemotePrivateEndpoint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionResponseProperties. +func (p PrivateEndpointConnectionResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionResponseProperties. +func (p *PrivateEndpointConnectionResponseProperties) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) 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, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) 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) + } + 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 "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. +func (p *PrivateLinkResourceListResult) 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) + } + 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) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnection. +func (p PrivateLinkServiceConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "name", p.Name) + populate(objectMap, "requestMessage", p.RequestMessage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnection. +func (p *PrivateLinkServiceConnection) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "requestMessage": + err = unpopulate(val, "RequestMessage", &p.RequestMessage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. +func (p *PrivateLinkServiceConnectionState) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceProxy. +func (p PrivateLinkServiceProxy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupConnectivityInformation", p.GroupConnectivityInformation) + populate(objectMap, "id", p.ID) + populate(objectMap, "remotePrivateEndpointConnection", p.RemotePrivateEndpointConnection) + populate(objectMap, "remotePrivateLinkServiceConnectionState", p.RemotePrivateLinkServiceConnectionState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceProxy. +func (p *PrivateLinkServiceProxy) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupConnectivityInformation": + err = unpopulate(val, "GroupConnectivityInformation", &p.GroupConnectivityInformation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "remotePrivateEndpointConnection": + err = unpopulate(val, "RemotePrivateEndpointConnection", &p.RemotePrivateEndpointConnection) + delete(rawMsg, key) + case "remotePrivateLinkServiceConnectionState": + err = unpopulate(val, "RemotePrivateLinkServiceConnectionState", &p.RemotePrivateLinkServiceConnectionState) delete(rawMsg, key) } if err != nil { @@ -2544,8 +3225,47 @@ func (p ProtectedItemDynamicMemoryConfig) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemDynamicMemoryConfig. -func (p *ProtectedItemDynamicMemoryConfig) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemDynamicMemoryConfig. +func (p *ProtectedItemDynamicMemoryConfig) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "maximumMemoryInMegaBytes": + err = unpopulate(val, "MaximumMemoryInMegaBytes", &p.MaximumMemoryInMegaBytes) + delete(rawMsg, key) + case "minimumMemoryInMegaBytes": + err = unpopulate(val, "MinimumMemoryInMegaBytes", &p.MinimumMemoryInMegaBytes) + delete(rawMsg, key) + case "targetMemoryBufferPercentage": + err = unpopulate(val, "TargetMemoryBufferPercentage", &p.TargetMemoryBufferPercentage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemJobProperties. +func (p ProtectedItemJobProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", p.DisplayName) + populateDateTimeRFC3339(objectMap, "endTime", p.EndTime) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "scenarioName", p.ScenarioName) + populateDateTimeRFC3339(objectMap, "startTime", p.StartTime) + populate(objectMap, "state", p.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemJobProperties. +func (p *ProtectedItemJobProperties) 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) @@ -2553,14 +3273,26 @@ func (p *ProtectedItemDynamicMemoryConfig) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "maximumMemoryInMegaBytes": - err = unpopulate(val, "MaximumMemoryInMegaBytes", &p.MaximumMemoryInMegaBytes) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) delete(rawMsg, key) - case "minimumMemoryInMegaBytes": - err = unpopulate(val, "MinimumMemoryInMegaBytes", &p.MinimumMemoryInMegaBytes) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &p.EndTime) delete(rawMsg, key) - case "targetMemoryBufferPercentage": - err = unpopulate(val, "TargetMemoryBufferPercentage", &p.TargetMemoryBufferPercentage) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "scenarioName": + err = unpopulate(val, "ScenarioName", &p.ScenarioName) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &p.StartTime) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &p.State) delete(rawMsg, key) } if err != nil { @@ -2613,16 +3345,15 @@ func (p *ProtectedItemModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelCollection. -func (p ProtectedItemModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelCustomProperties. +func (p ProtectedItemModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "instanceType", p.InstanceType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelCollection. -func (p *ProtectedItemModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelCustomProperties. +func (p *ProtectedItemModelCustomProperties) 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) @@ -2630,11 +3361,8 @@ func (p *ProtectedItemModelCollection) UnmarshalJSON(data []byte) error { 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 "instanceType": + err = unpopulate(val, "InstanceType", &p.InstanceType) delete(rawMsg, key) } if err != nil { @@ -2644,15 +3372,15 @@ func (p *ProtectedItemModelCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelCustomProperties. -func (p ProtectedItemModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelCustomPropertiesUpdate. +func (p ProtectedItemModelCustomPropertiesUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["instanceType"] = p.InstanceType + populate(objectMap, "instanceType", p.InstanceType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelCustomProperties. -func (p *ProtectedItemModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelCustomPropertiesUpdate. +func (p *ProtectedItemModelCustomPropertiesUpdate) 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) @@ -2671,6 +3399,37 @@ func (p *ProtectedItemModelCustomProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelListResult. +func (p ProtectedItemModelListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelListResult. +func (p *ProtectedItemModelListResult) 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) + } + 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) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelProperties. func (p ProtectedItemModelProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2678,7 +3437,7 @@ func (p ProtectedItemModelProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "correlationId", p.CorrelationID) populate(objectMap, "currentJob", p.CurrentJob) populate(objectMap, "customProperties", p.CustomProperties) - populate(objectMap, "draId", p.DraID) + populate(objectMap, "fabricAgentId", p.FabricAgentID) populate(objectMap, "fabricId", p.FabricID) populate(objectMap, "fabricObjectId", p.FabricObjectID) populate(objectMap, "fabricObjectName", p.FabricObjectName) @@ -2698,7 +3457,7 @@ func (p ProtectedItemModelProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "resyncRequired", p.ResyncRequired) populate(objectMap, "resynchronizationState", p.ResynchronizationState) populate(objectMap, "sourceFabricProviderId", p.SourceFabricProviderID) - populate(objectMap, "targetDraId", p.TargetDraID) + populate(objectMap, "targetFabricAgentId", p.TargetFabricAgentID) populate(objectMap, "targetFabricId", p.TargetFabricID) populate(objectMap, "targetFabricProviderId", p.TargetFabricProviderID) populate(objectMap, "testFailoverState", p.TestFailoverState) @@ -2727,8 +3486,8 @@ func (p *ProtectedItemModelProperties) UnmarshalJSON(data []byte) error { case "customProperties": p.CustomProperties, err = unmarshalProtectedItemModelCustomPropertiesClassification(val) delete(rawMsg, key) - case "draId": - err = unpopulate(val, "DraID", &p.DraID) + case "fabricAgentId": + err = unpopulate(val, "FabricAgentID", &p.FabricAgentID) delete(rawMsg, key) case "fabricId": err = unpopulate(val, "FabricID", &p.FabricID) @@ -2787,8 +3546,8 @@ func (p *ProtectedItemModelProperties) UnmarshalJSON(data []byte) error { case "sourceFabricProviderId": err = unpopulate(val, "SourceFabricProviderID", &p.SourceFabricProviderID) delete(rawMsg, key) - case "targetDraId": - err = unpopulate(val, "TargetDraID", &p.TargetDraID) + case "targetFabricAgentId": + err = unpopulate(val, "TargetFabricAgentID", &p.TargetFabricAgentID) delete(rawMsg, key) case "targetFabricId": err = unpopulate(val, "TargetFabricID", &p.TargetFabricID) @@ -2810,123 +3569,15 @@ func (p *ProtectedItemModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelPropertiesCurrentJob. -func (p ProtectedItemModelPropertiesCurrentJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "displayName", p.DisplayName) - populateDateTimeRFC3339(objectMap, "endTime", p.EndTime) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "scenarioName", p.ScenarioName) - populateDateTimeRFC3339(objectMap, "startTime", p.StartTime) - populate(objectMap, "state", p.State) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelPropertiesCurrentJob. -func (p *ProtectedItemModelPropertiesCurrentJob) 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) - } - for key, val := range rawMsg { - var err error - switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &p.EndTime) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "scenarioName": - err = unpopulate(val, "ScenarioName", &p.ScenarioName) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &p.StartTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &p.State) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelPropertiesLastFailedEnableProtectionJob. -func (p ProtectedItemModelPropertiesLastFailedEnableProtectionJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "displayName", p.DisplayName) - populateDateTimeRFC3339(objectMap, "endTime", p.EndTime) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "scenarioName", p.ScenarioName) - populateDateTimeRFC3339(objectMap, "startTime", p.StartTime) - populate(objectMap, "state", p.State) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelPropertiesLastFailedEnableProtectionJob. -func (p *ProtectedItemModelPropertiesLastFailedEnableProtectionJob) 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) - } - for key, val := range rawMsg { - var err error - switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &p.EndTime) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "scenarioName": - err = unpopulate(val, "ScenarioName", &p.ScenarioName) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &p.StartTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &p.State) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelPropertiesLastFailedPlannedFailoverJob. -func (p ProtectedItemModelPropertiesLastFailedPlannedFailoverJob) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelPropertiesUpdate. +func (p ProtectedItemModelPropertiesUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", p.DisplayName) - populateDateTimeRFC3339(objectMap, "endTime", p.EndTime) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "scenarioName", p.ScenarioName) - populateDateTimeRFC3339(objectMap, "startTime", p.StartTime) - populate(objectMap, "state", p.State) + populate(objectMap, "customProperties", p.CustomProperties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelPropertiesLastFailedPlannedFailoverJob. -func (p *ProtectedItemModelPropertiesLastFailedPlannedFailoverJob) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelPropertiesUpdate. +func (p *ProtectedItemModelPropertiesUpdate) 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) @@ -2934,26 +3585,8 @@ func (p *ProtectedItemModelPropertiesLastFailedPlannedFailoverJob) UnmarshalJSON for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &p.EndTime) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "scenarioName": - err = unpopulate(val, "ScenarioName", &p.ScenarioName) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &p.StartTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &p.State) + case "customProperties": + p.CustomProperties, err = unmarshalProtectedItemModelCustomPropertiesUpdateClassification(val) delete(rawMsg, key) } if err != nil { @@ -2963,21 +3596,19 @@ func (p *ProtectedItemModelPropertiesLastFailedPlannedFailoverJob) UnmarshalJSON return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelPropertiesLastTestFailoverJob. -func (p ProtectedItemModelPropertiesLastTestFailoverJob) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelUpdate. +func (p ProtectedItemModelUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", p.DisplayName) - populateDateTimeRFC3339(objectMap, "endTime", p.EndTime) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) - populate(objectMap, "scenarioName", p.ScenarioName) - populateDateTimeRFC3339(objectMap, "startTime", p.StartTime) - populate(objectMap, "state", p.State) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelPropertiesLastTestFailoverJob. -func (p *ProtectedItemModelPropertiesLastTestFailoverJob) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelUpdate. +func (p *ProtectedItemModelUpdate) 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) @@ -2985,73 +3616,20 @@ func (p *ProtectedItemModelPropertiesLastTestFailoverJob) UnmarshalJSON(data []b for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &p.EndTime) - delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "scenarioName": - err = unpopulate(val, "ScenarioName", &p.ScenarioName) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &p.StartTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &p.State) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelSystemData. -func (p ProtectedItemModelSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", p.CreatedAt) - populate(objectMap, "createdBy", p.CreatedBy) - populate(objectMap, "createdByType", p.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", p.LastModifiedAt) - populate(objectMap, "lastModifiedBy", p.LastModifiedBy) - populate(objectMap, "lastModifiedByType", p.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelSystemData. -func (p *ProtectedItemModelSystemData) 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) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &p.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &p.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &p.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &p.LastModifiedAt) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &p.LastModifiedBy) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &p.LastModifiedByType) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { @@ -3104,16 +3682,15 @@ func (r *RecoveryPointModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoveryPointModelCollection. -func (r RecoveryPointModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecoveryPointModelCustomProperties. +func (r RecoveryPointModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + populate(objectMap, "instanceType", r.InstanceType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointModelCollection. -func (r *RecoveryPointModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointModelCustomProperties. +func (r *RecoveryPointModelCustomProperties) 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) @@ -3121,11 +3698,8 @@ func (r *RecoveryPointModelCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "instanceType": + err = unpopulate(val, "InstanceType", &r.InstanceType) delete(rawMsg, key) } if err != nil { @@ -3135,15 +3709,16 @@ func (r *RecoveryPointModelCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoveryPointModelCustomProperties. -func (r RecoveryPointModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecoveryPointModelListResult. +func (r RecoveryPointModelListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["instanceType"] = r.InstanceType + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointModelCustomProperties. -func (r *RecoveryPointModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointModelListResult. +func (r *RecoveryPointModelListResult) 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) @@ -3151,8 +3726,11 @@ func (r *RecoveryPointModelCustomProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "instanceType": - err = unpopulate(val, "InstanceType", &r.InstanceType) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { @@ -3166,6 +3744,7 @@ func (r *RecoveryPointModelCustomProperties) UnmarshalJSON(data []byte) error { func (r RecoveryPointModelProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "customProperties", r.CustomProperties) + populate(objectMap, "provisioningState", r.ProvisioningState) populateDateTimeRFC3339(objectMap, "recoveryPointTime", r.RecoveryPointTime) populate(objectMap, "recoveryPointType", r.RecoveryPointType) return json.Marshal(objectMap) @@ -3183,6 +3762,9 @@ func (r *RecoveryPointModelProperties) UnmarshalJSON(data []byte) error { case "customProperties": r.CustomProperties, err = unmarshalRecoveryPointModelCustomPropertiesClassification(val) delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) case "recoveryPointTime": err = unpopulateDateTimeRFC3339(val, "RecoveryPointTime", &r.RecoveryPointTime) delete(rawMsg, key) @@ -3197,20 +3779,19 @@ func (r *RecoveryPointModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoveryPointModelSystemData. -func (r RecoveryPointModelSystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RemotePrivateEndpoint. +func (r RemotePrivateEndpoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", r.CreatedAt) - populate(objectMap, "createdBy", r.CreatedBy) - populate(objectMap, "createdByType", r.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", r.LastModifiedAt) - populate(objectMap, "lastModifiedBy", r.LastModifiedBy) - populate(objectMap, "lastModifiedByType", r.LastModifiedByType) + populate(objectMap, "connectionDetails", r.ConnectionDetails) + populate(objectMap, "id", r.ID) + populate(objectMap, "manualPrivateLinkServiceConnections", r.ManualPrivateLinkServiceConnections) + populate(objectMap, "privateLinkServiceConnections", r.PrivateLinkServiceConnections) + populate(objectMap, "privateLinkServiceProxies", r.PrivateLinkServiceProxies) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointModelSystemData. -func (r *RecoveryPointModelSystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RemotePrivateEndpoint. +func (r *RemotePrivateEndpoint) 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) @@ -3218,23 +3799,47 @@ func (r *RecoveryPointModelSystemData) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &r.CreatedAt) + case "connectionDetails": + err = unpopulate(val, "ConnectionDetails", &r.ConnectionDetails) delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &r.CreatedBy) + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &r.CreatedByType) + case "manualPrivateLinkServiceConnections": + err = unpopulate(val, "ManualPrivateLinkServiceConnections", &r.ManualPrivateLinkServiceConnections) delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &r.LastModifiedAt) + case "privateLinkServiceConnections": + err = unpopulate(val, "PrivateLinkServiceConnections", &r.PrivateLinkServiceConnections) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &r.LastModifiedBy) + case "privateLinkServiceProxies": + err = unpopulate(val, "PrivateLinkServiceProxies", &r.PrivateLinkServiceProxies) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &r.LastModifiedByType) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RemotePrivateEndpointConnection. +func (r RemotePrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RemotePrivateEndpointConnection. +func (r *RemotePrivateEndpointConnection) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) } if err != nil { @@ -3287,16 +3892,15 @@ func (r *ReplicationExtensionModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ReplicationExtensionModelCollection. -func (r ReplicationExtensionModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReplicationExtensionModelCustomProperties. +func (r ReplicationExtensionModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + populate(objectMap, "instanceType", r.InstanceType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationExtensionModelCollection. -func (r *ReplicationExtensionModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationExtensionModelCustomProperties. +func (r *ReplicationExtensionModelCustomProperties) 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) @@ -3304,11 +3908,8 @@ func (r *ReplicationExtensionModelCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "instanceType": + err = unpopulate(val, "InstanceType", &r.InstanceType) delete(rawMsg, key) } if err != nil { @@ -3318,15 +3919,16 @@ func (r *ReplicationExtensionModelCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ReplicationExtensionModelCustomProperties. -func (r ReplicationExtensionModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReplicationExtensionModelListResult. +func (r ReplicationExtensionModelListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["instanceType"] = r.InstanceType + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationExtensionModelCustomProperties. -func (r *ReplicationExtensionModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationExtensionModelListResult. +func (r *ReplicationExtensionModelListResult) 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) @@ -3334,8 +3936,11 @@ func (r *ReplicationExtensionModelCustomProperties) UnmarshalJSON(data []byte) e for key, val := range rawMsg { var err error switch key { - case "instanceType": - err = unpopulate(val, "InstanceType", &r.InstanceType) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { @@ -3376,63 +3981,51 @@ func (r *ReplicationExtensionModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ReplicationExtensionModelSystemData. -func (r ReplicationExtensionModelSystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageContainerProperties. +func (s StorageContainerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", r.CreatedAt) - populate(objectMap, "createdBy", r.CreatedBy) - populate(objectMap, "createdByType", r.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", r.LastModifiedAt) - populate(objectMap, "lastModifiedBy", r.LastModifiedBy) - populate(objectMap, "lastModifiedByType", r.LastModifiedByType) + populate(objectMap, "clusterSharedVolumePath", s.ClusterSharedVolumePath) + populate(objectMap, "name", s.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationExtensionModelSystemData. -func (r *ReplicationExtensionModelSystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainerProperties. +func (s *StorageContainerProperties) 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 "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &r.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &r.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &r.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &r.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &r.LastModifiedBy) + case "clusterSharedVolumePath": + err = unpopulate(val, "ClusterSharedVolumePath", &s.ClusterSharedVolumePath) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &r.LastModifiedByType) + case "name": + err = unpopulate(val, "Name", &s.Name) 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 StorageContainerProperties. -func (s StorageContainerProperties) 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, "clusterSharedVolumePath", s.ClusterSharedVolumePath) - populate(objectMap, "name", s.Name) + 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 StorageContainerProperties. -func (s *StorageContainerProperties) 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", s, err) @@ -3440,11 +4033,23 @@ func (s *StorageContainerProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "clusterSharedVolumePath": - err = unpopulate(val, "ClusterSharedVolumePath", &s.ClusterSharedVolumePath) + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) + 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 { @@ -3457,7 +4062,7 @@ func (s *StorageContainerProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TaskModel. func (t TaskModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "childrenWorkflows", t.ChildrenWorkflows) + populate(objectMap, "childrenJobs", t.ChildrenJobs) populate(objectMap, "customProperties", t.CustomProperties) populateDateTimeRFC3339(objectMap, "endTime", t.EndTime) populateDateTimeRFC3339(objectMap, "startTime", t.StartTime) @@ -3475,8 +4080,8 @@ func (t *TaskModel) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "childrenWorkflows": - err = unpopulate(val, "ChildrenWorkflows", &t.ChildrenWorkflows) + case "childrenJobs": + err = unpopulate(val, "ChildrenJobs", &t.ChildrenJobs) delete(rawMsg, key) case "customProperties": err = unpopulate(val, "CustomProperties", &t.CustomProperties) @@ -3528,17 +4133,17 @@ func (t *TaskModelCustomProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TestFailoverCleanupWorkflowModelCustomProperties. -func (t TestFailoverCleanupWorkflowModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TestFailoverCleanupJobModelCustomProperties. +func (t TestFailoverCleanupJobModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "affectedObjectDetails", t.AffectedObjectDetails) populate(objectMap, "comments", t.Comments) - objectMap["instanceType"] = "TestFailoverCleanupWorkflowDetails" + objectMap["instanceType"] = "TestFailoverCleanupJobDetails" return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TestFailoverCleanupWorkflowModelCustomProperties. -func (t *TestFailoverCleanupWorkflowModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TestFailoverCleanupJobModelCustomProperties. +func (t *TestFailoverCleanupJobModelCustomProperties) 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", t, err) @@ -3563,17 +4168,17 @@ func (t *TestFailoverCleanupWorkflowModelCustomProperties) UnmarshalJSON(data [] return nil } -// MarshalJSON implements the json.Marshaller interface for type TestFailoverWorkflowModelCustomProperties. -func (t TestFailoverWorkflowModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TestFailoverJobModelCustomProperties. +func (t TestFailoverJobModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "affectedObjectDetails", t.AffectedObjectDetails) - objectMap["instanceType"] = "TestFailoverWorkflowDetails" + objectMap["instanceType"] = "TestFailoverJobDetails" populate(objectMap, "protectedItemDetails", t.ProtectedItemDetails) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TestFailoverWorkflowModelCustomProperties. -func (t *TestFailoverWorkflowModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TestFailoverJobModelCustomProperties. +func (t *TestFailoverJobModelCustomProperties) 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", t, err) @@ -3598,8 +4203,39 @@ func (t *TestFailoverWorkflowModelCustomProperties) UnmarshalJSON(data []byte) e return nil } -// MarshalJSON implements the json.Marshaller interface for type VMwareDraModelCustomProperties. -func (v VMwareDraModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMwareFabricAgentModelCustomProperties. +func (v VMwareFabricAgentModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "biosId", v.BiosID) objectMap["instanceType"] = "VMware" @@ -3607,8 +4243,8 @@ func (v VMwareDraModelCustomProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VMwareDraModelCustomProperties. -func (v *VMwareDraModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VMwareFabricAgentModelCustomProperties. +func (v *VMwareFabricAgentModelCustomProperties) 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) @@ -3671,8 +4307,13 @@ func (v *VMwareMigrateFabricModelCustomProperties) UnmarshalJSON(data []byte) er // MarshalJSON implements the json.Marshaller interface for type VMwareToAzStackHCIDiskInput. func (v VMwareToAzStackHCIDiskInput) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "diskBlockSize", v.DiskBlockSize) + populate(objectMap, "diskController", v.DiskController) populate(objectMap, "diskFileFormat", v.DiskFileFormat) populate(objectMap, "diskId", v.DiskID) + populate(objectMap, "diskIdentifier", v.DiskIdentifier) + populate(objectMap, "diskLogicalSectorSize", v.DiskLogicalSectorSize) + populate(objectMap, "diskPhysicalSectorSize", v.DiskPhysicalSectorSize) populate(objectMap, "diskSizeGB", v.DiskSizeGB) populate(objectMap, "isDynamic", v.IsDynamic) populate(objectMap, "isOsDisk", v.IsOsDisk) @@ -3689,12 +4330,27 @@ func (v *VMwareToAzStackHCIDiskInput) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "diskBlockSize": + err = unpopulate(val, "DiskBlockSize", &v.DiskBlockSize) + delete(rawMsg, key) + case "diskController": + err = unpopulate(val, "DiskController", &v.DiskController) + delete(rawMsg, key) case "diskFileFormat": err = unpopulate(val, "DiskFileFormat", &v.DiskFileFormat) delete(rawMsg, key) case "diskId": err = unpopulate(val, "DiskID", &v.DiskID) delete(rawMsg, key) + case "diskIdentifier": + err = unpopulate(val, "DiskIdentifier", &v.DiskIdentifier) + delete(rawMsg, key) + case "diskLogicalSectorSize": + err = unpopulate(val, "DiskLogicalSectorSize", &v.DiskLogicalSectorSize) + delete(rawMsg, key) + case "diskPhysicalSectorSize": + err = unpopulate(val, "DiskPhysicalSectorSize", &v.DiskPhysicalSectorSize) + delete(rawMsg, key) case "diskSizeGB": err = unpopulate(val, "DiskSizeGB", &v.DiskSizeGB) delete(rawMsg, key) @@ -3715,9 +4371,58 @@ func (v *VMwareToAzStackHCIDiskInput) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type VMwareToAzStackHCIEventModelCustomProperties. +func (v VMwareToAzStackHCIEventModelCustomProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "eventSourceFriendlyName", v.EventSourceFriendlyName) + objectMap["instanceType"] = "VMwareToAzStackHCI" + populate(objectMap, "protectedItemFriendlyName", v.ProtectedItemFriendlyName) + populate(objectMap, "serverType", v.ServerType) + populate(objectMap, "sourceApplianceName", v.SourceApplianceName) + populate(objectMap, "targetApplianceName", v.TargetApplianceName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMwareToAzStackHCIEventModelCustomProperties. +func (v *VMwareToAzStackHCIEventModelCustomProperties) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "eventSourceFriendlyName": + err = unpopulate(val, "EventSourceFriendlyName", &v.EventSourceFriendlyName) + delete(rawMsg, key) + case "instanceType": + err = unpopulate(val, "InstanceType", &v.InstanceType) + delete(rawMsg, key) + case "protectedItemFriendlyName": + err = unpopulate(val, "ProtectedItemFriendlyName", &v.ProtectedItemFriendlyName) + delete(rawMsg, key) + case "serverType": + err = unpopulate(val, "ServerType", &v.ServerType) + delete(rawMsg, key) + case "sourceApplianceName": + err = unpopulate(val, "SourceApplianceName", &v.SourceApplianceName) + delete(rawMsg, key) + case "targetApplianceName": + err = unpopulate(val, "TargetApplianceName", &v.TargetApplianceName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type VMwareToAzStackHCINicInput. func (v VMwareToAzStackHCINicInput) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "isMacMigrationEnabled", v.IsMacMigrationEnabled) + populate(objectMap, "isStaticIpMigrationEnabled", v.IsStaticIPMigrationEnabled) populate(objectMap, "label", v.Label) populate(objectMap, "networkName", v.NetworkName) populate(objectMap, "nicId", v.NicID) @@ -3736,6 +4441,12 @@ func (v *VMwareToAzStackHCINicInput) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "isMacMigrationEnabled": + err = unpopulate(val, "IsMacMigrationEnabled", &v.IsMacMigrationEnabled) + delete(rawMsg, key) + case "isStaticIpMigrationEnabled": + err = unpopulate(val, "IsStaticIPMigrationEnabled", &v.IsStaticIPMigrationEnabled) + delete(rawMsg, key) case "label": err = unpopulate(val, "Label", &v.Label) delete(rawMsg, key) @@ -3836,6 +4547,9 @@ func (v *VMwareToAzStackHCIPolicyModelCustomProperties) UnmarshalJSON(data []byt func (v VMwareToAzStackHCIProtectedDiskProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "capacityInBytes", v.CapacityInBytes) + populate(objectMap, "diskBlockSize", v.DiskBlockSize) + populate(objectMap, "diskLogicalSectorSize", v.DiskLogicalSectorSize) + populate(objectMap, "diskPhysicalSectorSize", v.DiskPhysicalSectorSize) populate(objectMap, "diskType", v.DiskType) populate(objectMap, "isDynamic", v.IsDynamic) populate(objectMap, "isOsDisk", v.IsOsDisk) @@ -3861,6 +4575,15 @@ func (v *VMwareToAzStackHCIProtectedDiskProperties) UnmarshalJSON(data []byte) e case "capacityInBytes": err = unpopulate(val, "CapacityInBytes", &v.CapacityInBytes) delete(rawMsg, key) + case "diskBlockSize": + err = unpopulate(val, "DiskBlockSize", &v.DiskBlockSize) + delete(rawMsg, key) + case "diskLogicalSectorSize": + err = unpopulate(val, "DiskLogicalSectorSize", &v.DiskLogicalSectorSize) + delete(rawMsg, key) + case "diskPhysicalSectorSize": + err = unpopulate(val, "DiskPhysicalSectorSize", &v.DiskPhysicalSectorSize) + delete(rawMsg, key) case "diskType": err = unpopulate(val, "DiskType", &v.DiskType) delete(rawMsg, key) @@ -3932,7 +4655,7 @@ func (v VMwareToAzStackHCIProtectedItemModelCustomProperties) MarshalJSON() ([]b populate(objectMap, "runAsAccountId", v.RunAsAccountID) populate(objectMap, "sourceApplianceName", v.SourceApplianceName) populate(objectMap, "sourceCpuCores", v.SourceCPUCores) - populate(objectMap, "sourceDraName", v.SourceDraName) + populate(objectMap, "sourceFabricAgentName", v.SourceFabricAgentName) populate(objectMap, "sourceMemoryInMegaBytes", v.SourceMemoryInMegaBytes) populate(objectMap, "sourceVmName", v.SourceVMName) populate(objectMap, "storageContainerId", v.StorageContainerID) @@ -3940,7 +4663,7 @@ func (v VMwareToAzStackHCIProtectedItemModelCustomProperties) MarshalJSON() ([]b populate(objectMap, "targetArcClusterCustomLocationId", v.TargetArcClusterCustomLocationID) populate(objectMap, "targetAzStackHciClusterName", v.TargetAzStackHciClusterName) populate(objectMap, "targetCpuCores", v.TargetCPUCores) - populate(objectMap, "targetDraName", v.TargetDraName) + populate(objectMap, "targetFabricAgentName", v.TargetFabricAgentName) populate(objectMap, "targetHciClusterId", v.TargetHciClusterID) populate(objectMap, "targetLocation", v.TargetLocation) populate(objectMap, "targetMemoryInMegaBytes", v.TargetMemoryInMegaBytes) @@ -4051,8 +4774,8 @@ func (v *VMwareToAzStackHCIProtectedItemModelCustomProperties) UnmarshalJSON(dat case "sourceCpuCores": err = unpopulate(val, "SourceCPUCores", &v.SourceCPUCores) delete(rawMsg, key) - case "sourceDraName": - err = unpopulate(val, "SourceDraName", &v.SourceDraName) + case "sourceFabricAgentName": + err = unpopulate(val, "SourceFabricAgentName", &v.SourceFabricAgentName) delete(rawMsg, key) case "sourceMemoryInMegaBytes": err = unpopulate(val, "SourceMemoryInMegaBytes", &v.SourceMemoryInMegaBytes) @@ -4075,8 +4798,8 @@ func (v *VMwareToAzStackHCIProtectedItemModelCustomProperties) UnmarshalJSON(dat case "targetCpuCores": err = unpopulate(val, "TargetCPUCores", &v.TargetCPUCores) delete(rawMsg, key) - case "targetDraName": - err = unpopulate(val, "TargetDraName", &v.TargetDraName) + case "targetFabricAgentName": + err = unpopulate(val, "TargetFabricAgentName", &v.TargetFabricAgentName) delete(rawMsg, key) case "targetHciClusterId": err = unpopulate(val, "TargetHciClusterID", &v.TargetHciClusterID) @@ -4110,6 +4833,57 @@ func (v *VMwareToAzStackHCIProtectedItemModelCustomProperties) UnmarshalJSON(dat return nil } +// MarshalJSON implements the json.Marshaller interface for type VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate. +func (v VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dynamicMemoryConfig", v.DynamicMemoryConfig) + objectMap["instanceType"] = "VMwareToAzStackHCI" + populate(objectMap, "isDynamicRam", v.IsDynamicRAM) + populate(objectMap, "nicsToInclude", v.NicsToInclude) + populate(objectMap, "osType", v.OSType) + populate(objectMap, "targetCpuCores", v.TargetCPUCores) + populate(objectMap, "targetMemoryInMegaBytes", v.TargetMemoryInMegaBytes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate. +func (v *VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "dynamicMemoryConfig": + err = unpopulate(val, "DynamicMemoryConfig", &v.DynamicMemoryConfig) + delete(rawMsg, key) + case "instanceType": + err = unpopulate(val, "InstanceType", &v.InstanceType) + delete(rawMsg, key) + case "isDynamicRam": + err = unpopulate(val, "IsDynamicRAM", &v.IsDynamicRAM) + delete(rawMsg, key) + case "nicsToInclude": + err = unpopulate(val, "NicsToInclude", &v.NicsToInclude) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &v.OSType) + delete(rawMsg, key) + case "targetCpuCores": + err = unpopulate(val, "TargetCPUCores", &v.TargetCPUCores) + delete(rawMsg, key) + case "targetMemoryInMegaBytes": + err = unpopulate(val, "TargetMemoryInMegaBytes", &v.TargetMemoryInMegaBytes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type VMwareToAzStackHCIProtectedNicProperties. func (v VMwareToAzStackHCIProtectedNicProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -4154,8 +4928,39 @@ func (v *VMwareToAzStackHCIProtectedNicProperties) UnmarshalJSON(data []byte) er case "targetNetworkId": err = unpopulate(val, "TargetNetworkID", &v.TargetNetworkID) delete(rawMsg, key) - case "testNetworkId": - err = unpopulate(val, "TestNetworkID", &v.TestNetworkID) + case "testNetworkId": + err = unpopulate(val, "TestNetworkID", &v.TestNetworkID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMwareToAzStackHCIRecoveryPointModelCustomProperties. +func (v VMwareToAzStackHCIRecoveryPointModelCustomProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "diskIds", v.DiskIDs) + objectMap["instanceType"] = "VMwareToAzStackHCIRecoveryPointModelCustomProperties" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMwareToAzStackHCIRecoveryPointModelCustomProperties. +func (v *VMwareToAzStackHCIRecoveryPointModelCustomProperties) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskIds": + err = unpopulate(val, "DiskIDs", &v.DiskIDs) + delete(rawMsg, key) + case "instanceType": + err = unpopulate(val, "InstanceType", &v.InstanceType) delete(rawMsg, key) } if err != nil { @@ -4256,10 +5061,46 @@ func (v *VMwareToAzStackHCIReplicationExtensionModelCustomProperties) UnmarshalJ return nil } +// MarshalJSON implements the json.Marshaller interface for type VaultIdentityModel. +func (v VaultIdentityModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", v.PrincipalID) + populate(objectMap, "tenantId", v.TenantID) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VaultIdentityModel. +func (v *VaultIdentityModel) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &v.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &v.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type VaultModel. func (v VaultModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", v.ID) + populate(objectMap, "identity", v.Identity) populate(objectMap, "location", v.Location) populate(objectMap, "name", v.Name) populate(objectMap, "properties", v.Properties) @@ -4281,6 +5122,9 @@ func (v *VaultModel) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &v.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &v.Location) delete(rawMsg, key) @@ -4307,16 +5151,16 @@ func (v *VaultModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VaultModelCollection. -func (v VaultModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VaultModelListResult. +func (v VaultModelListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", v.NextLink) populate(objectMap, "value", v.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VaultModelCollection. -func (v *VaultModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VaultModelListResult. +func (v *VaultModelListResult) 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) @@ -4373,57 +5217,11 @@ func (v *VaultModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VaultModelSystemData. -func (v VaultModelSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", v.CreatedAt) - populate(objectMap, "createdBy", v.CreatedBy) - populate(objectMap, "createdByType", v.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", v.LastModifiedAt) - populate(objectMap, "lastModifiedBy", v.LastModifiedBy) - populate(objectMap, "lastModifiedByType", v.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VaultModelSystemData. -func (v *VaultModelSystemData) 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) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &v.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &v.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &v.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &v.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &v.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &v.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type VaultModelUpdate. func (v VaultModelUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", v.ID) + populate(objectMap, "identity", v.Identity) populate(objectMap, "name", v.Name) populate(objectMap, "properties", v.Properties) populate(objectMap, "systemData", v.SystemData) @@ -4444,6 +5242,9 @@ func (v *VaultModelUpdate) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &v.Identity) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) @@ -4467,308 +5268,28 @@ func (v *VaultModelUpdate) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VaultModelUpdateSystemData. -func (v VaultModelUpdateSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", v.CreatedAt) - populate(objectMap, "createdBy", v.CreatedBy) - populate(objectMap, "createdByType", v.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", v.LastModifiedAt) - populate(objectMap, "lastModifiedBy", v.LastModifiedBy) - populate(objectMap, "lastModifiedByType", v.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VaultModelUpdateSystemData. -func (v *VaultModelUpdateSystemData) 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) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &v.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &v.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &v.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &v.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &v.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &v.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkflowModel. -func (w WorkflowModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", w.ID) - populate(objectMap, "name", w.Name) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "systemData", w.SystemData) - populate(objectMap, "type", w.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkflowModel. -func (w *WorkflowModel) 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", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &w.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &w.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &w.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &w.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &w.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkflowModelCollection. -func (w WorkflowModelCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", w.NextLink) - populate(objectMap, "value", w.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkflowModelCollection. -func (w *WorkflowModelCollection) 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", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &w.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &w.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkflowModelCustomProperties. -func (w WorkflowModelCustomProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "affectedObjectDetails", w.AffectedObjectDetails) - objectMap["instanceType"] = w.InstanceType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkflowModelCustomProperties. -func (w *WorkflowModelCustomProperties) 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", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "affectedObjectDetails": - err = unpopulate(val, "AffectedObjectDetails", &w.AffectedObjectDetails) - delete(rawMsg, key) - case "instanceType": - err = unpopulate(val, "InstanceType", &w.InstanceType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkflowModelProperties. -func (w WorkflowModelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "activityId", w.ActivityID) - populate(objectMap, "allowedActions", w.AllowedActions) - populate(objectMap, "customProperties", w.CustomProperties) - populate(objectMap, "displayName", w.DisplayName) - populateDateTimeRFC3339(objectMap, "endTime", w.EndTime) - populate(objectMap, "errors", w.Errors) - populate(objectMap, "objectId", w.ObjectID) - populate(objectMap, "objectInternalId", w.ObjectInternalID) - populate(objectMap, "objectInternalName", w.ObjectInternalName) - populate(objectMap, "objectName", w.ObjectName) - populate(objectMap, "objectType", w.ObjectType) - populate(objectMap, "replicationProviderId", w.ReplicationProviderID) - populate(objectMap, "sourceFabricProviderId", w.SourceFabricProviderID) - populateDateTimeRFC3339(objectMap, "startTime", w.StartTime) - populate(objectMap, "state", w.State) - populate(objectMap, "targetFabricProviderId", w.TargetFabricProviderID) - populate(objectMap, "tasks", w.Tasks) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkflowModelProperties. -func (w *WorkflowModelProperties) 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", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "activityId": - err = unpopulate(val, "ActivityID", &w.ActivityID) - delete(rawMsg, key) - case "allowedActions": - err = unpopulate(val, "AllowedActions", &w.AllowedActions) - delete(rawMsg, key) - case "customProperties": - w.CustomProperties, err = unmarshalWorkflowModelCustomPropertiesClassification(val) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &w.DisplayName) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &w.EndTime) - delete(rawMsg, key) - case "errors": - err = unpopulate(val, "Errors", &w.Errors) - delete(rawMsg, key) - case "objectId": - err = unpopulate(val, "ObjectID", &w.ObjectID) - delete(rawMsg, key) - case "objectInternalId": - err = unpopulate(val, "ObjectInternalID", &w.ObjectInternalID) - delete(rawMsg, key) - case "objectInternalName": - err = unpopulate(val, "ObjectInternalName", &w.ObjectInternalName) - delete(rawMsg, key) - case "objectName": - err = unpopulate(val, "ObjectName", &w.ObjectName) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &w.ObjectType) - delete(rawMsg, key) - case "replicationProviderId": - err = unpopulate(val, "ReplicationProviderID", &w.ReplicationProviderID) - delete(rawMsg, key) - case "sourceFabricProviderId": - err = unpopulate(val, "SourceFabricProviderID", &w.SourceFabricProviderID) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &w.StartTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &w.State) - delete(rawMsg, key) - case "targetFabricProviderId": - err = unpopulate(val, "TargetFabricProviderID", &w.TargetFabricProviderID) - delete(rawMsg, key) - case "tasks": - err = unpopulate(val, "Tasks", &w.Tasks) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkflowModelSystemData. -func (w WorkflowModelSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", w.CreatedAt) - populate(objectMap, "createdBy", w.CreatedBy) - populate(objectMap, "createdByType", w.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", w.LastModifiedAt) - populate(objectMap, "lastModifiedBy", w.LastModifiedBy) - populate(objectMap, "lastModifiedByType", w.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkflowModelSystemData. -func (w *WorkflowModelSystemData) 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", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &w.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &w.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &w.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &w.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &w.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &w.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v } - return nil } -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 if !reflect.ValueOf(v).IsNil() { + } 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vaultoperationstatus_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operationresults_client.go similarity index 54% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vaultoperationstatus_client.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operationresults_client.go index 19b7c31d5347..65f72c177c08 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vaultoperationstatus_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operationresults_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 armrecoveryservicesdatareplication @@ -20,63 +16,63 @@ import ( "strings" ) -// VaultOperationStatusClient contains the methods for the VaultOperationStatus group. -// Don't use this type directly, use NewVaultOperationStatusClient() instead. -type VaultOperationStatusClient struct { +// OperationResultsClient contains the methods for the OperationResults group. +// Don't use this type directly, use NewOperationResultsClient() instead. +type OperationResultsClient struct { internal *arm.Client subscriptionID string } -// NewVaultOperationStatusClient creates a new instance of VaultOperationStatusClient with the specified values. +// NewOperationResultsClient creates a new instance of OperationResultsClient 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 NewVaultOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VaultOperationStatusClient, error) { +func NewOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationResultsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &VaultOperationStatusClient{ + client := &OperationResultsClient{ subscriptionID: subscriptionID, internal: cl, } return client, nil } -// Get - Tracks the results of an asynchronous operation on the vault. +// Get - Gets the operation result status. +// +// Gets the operations. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - vaultName - The vault name. // - operationID - The ID of an ongoing async operation. -// - options - VaultOperationStatusClientGetOptions contains the optional parameters for the VaultOperationStatusClient.Get -// method. -func (client *VaultOperationStatusClient) Get(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *VaultOperationStatusClientGetOptions) (VaultOperationStatusClientGetResponse, error) { +// - options - OperationResultsClientGetOptions contains the optional parameters for the OperationResultsClient.Get method. +func (client *OperationResultsClient) Get(ctx context.Context, resourceGroupName string, operationID string, options *OperationResultsClientGetOptions) (OperationResultsClientGetResponse, error) { var err error - const operationName = "VaultOperationStatusClient.Get" + const operationName = "OperationResultsClient.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, vaultName, operationID, options) + req, err := client.getCreateRequest(ctx, resourceGroupName, operationID, options) if err != nil { - return VaultOperationStatusClientGetResponse{}, err + return OperationResultsClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return VaultOperationStatusClientGetResponse{}, err + return OperationResultsClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return VaultOperationStatusClientGetResponse{}, err + return OperationResultsClientGetResponse{}, err } resp, err := client.getHandleResponse(httpResp) return resp, err } // getCreateRequest creates the Get request. -func (client *VaultOperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *VaultOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/operations/{operationId}" +func (client *OperationResultsClient) getCreateRequest(ctx context.Context, resourceGroupName string, operationID string, _ *OperationResultsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/operationResults/{operationId}/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/{operationId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -85,10 +81,6 @@ func (client *VaultOperationStatusClient) getCreateRequest(ctx context.Context, return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) if operationID == "" { return nil, errors.New("parameter operationID cannot be empty") } @@ -98,17 +90,17 @@ func (client *VaultOperationStatusClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getHandleResponse handles the Get response. -func (client *VaultOperationStatusClient) getHandleResponse(resp *http.Response) (VaultOperationStatusClientGetResponse, error) { - result := VaultOperationStatusClientGetResponse{} +func (client *OperationResultsClient) getHandleResponse(resp *http.Response) (OperationResultsClientGetResponse, error) { + result := OperationResultsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return VaultOperationStatusClientGetResponse{}, err + return OperationResultsClientGetResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricoperationsstatus_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operationresults_client_example_test.go similarity index 52% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricoperationsstatus_client_example_test.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operationresults_client_example_test.go index aa16c991ae06..95f0310bdf56 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricoperationsstatus_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operationresults_client_example_test.go @@ -1,45 +1,41 @@ -//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 armrecoveryservicesdatareplication_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/FabricOperationsStatus_Get.json -func ExampleFabricOperationsStatusClient_Get() { +// Generated from example definition: 2024-09-01/OperationResults_Get.json +func ExampleOperationResultsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewFabricOperationsStatusClient().Get(ctx, "rgrecoveryservicesdatareplication", "wPR", "dvfwerv", nil) + res, err := clientFactory.NewOperationResultsClient().Get(ctx, "rgswagger_2024-09-01", "lghle", 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.OperationStatus = armrecoveryservicesdatareplication.OperationStatus{ - // Name: to.Ptr("wzdasptnwlxgobklayoqapjcgcf"), - // EndTime: to.Ptr("nauyrfh"), - // ID: to.Ptr("sf"), - // StartTime: to.Ptr("xuzwmfrhluafmwwsmzqxsytyehsh"), - // Status: to.Ptr("plbnngzfppdram"), + // res = armrecoveryservicesdatareplication.OperationResultsClientGetResponse{ + // OperationStatus: &armrecoveryservicesdatareplication.OperationStatus{ + // ID: to.Ptr("inhnjrxtqtyumflbzdne"), + // Name: to.Ptr("eawsgzqm"), + // Status: to.Ptr("jjijbsrjfqvqzriekxfvynb"), + // StartTime: to.Ptr("slmhzgrfzkkrxdalacmidyxijq"), + // EndTime: to.Ptr("ixkalnbiajfpjtur"), + // }, // } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operations_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operations_client.go index a918a38ab518..4e0b61d1cbb0 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operations_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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 armrecoveryservicesdatareplication @@ -37,9 +33,9 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - Gets the operations. +// NewListPager - List the operations for the provider // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - 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]{ @@ -65,14 +61,14 @@ 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.DataReplication/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", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operations_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operations_client_example_test.go index d455e99cc3d3..35a105402796 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operations_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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 armrecoveryservicesdatareplication_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Operations_List.json +// Generated from example definition: 2024-09-01/Operations_List.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 := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -39,20 +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.OperationListResult = armrecoveryservicesdatareplication.OperationListResult{ - // Value: []*armrecoveryservicesdatareplication.Operation{ - // { - // Name: to.Ptr("chktcqashuxscvbp"), - // ActionType: to.Ptr(armrecoveryservicesdatareplication.ActionTypeInternal), - // Display: &armrecoveryservicesdatareplication.OperationDisplay{ - // Description: to.Ptr("bjdvnagzxjandxcbcrf"), - // Operation: to.Ptr("dfal"), - // Provider: to.Ptr("yembewkfmaq"), - // Resource: to.Ptr("epyscqvmqhxbwgyqhzeaumpor"), + // page = armrecoveryservicesdatareplication.OperationsClientListResponse{ + // OperationListResult: armrecoveryservicesdatareplication.OperationListResult{ + // Value: []*armrecoveryservicesdatareplication.Operation{ + // { + // Name: to.Ptr("chktcqashuxscvbp"), + // IsDataAction: to.Ptr(true), + // Display: &armrecoveryservicesdatareplication.OperationDisplay{ + // Provider: to.Ptr("yembewkfmaq"), + // Resource: to.Ptr("epyscqvmqhxbwgyqhzeaumpor"), + // Operation: to.Ptr("dfal"), + // Description: to.Ptr("bjdvnagzxjandxcbcrf"), + // }, + // Origin: to.Ptr(armrecoveryservicesdatareplication.OriginUser), + // ActionType: to.Ptr(armrecoveryservicesdatareplication.ActionTypeInternal), // }, - // IsDataAction: to.Ptr(true), - // Origin: to.Ptr(armrecoveryservicesdatareplication.OriginUser), - // }}, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, // } } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/options.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/options.go index a802a5622ecd..ca43e7a5ae92 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/options.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/options.go @@ -1,54 +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 armrecoveryservicesdatareplication -// AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions contains the optional parameters for the AzureSiteRecoveryManagementServiceAPIClient.CheckNameAvailability -// method. -type AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions struct { +// CheckNameAvailabilityClientPostOptions contains the optional parameters for the CheckNameAvailabilityClient.Post method. +type CheckNameAvailabilityClientPostOptions struct { // Resource details. Body *CheckNameAvailabilityModel } -// AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions contains the optional parameters for the AzureSiteRecoveryManagementServiceAPIClient.DeploymentPreflight -// method. -type AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions struct { +// DeploymentPreflightClientPostOptions contains the optional parameters for the DeploymentPreflightClient.Post method. +type DeploymentPreflightClientPostOptions struct { // Deployment preflight model. Body *DeploymentPreflightModel } -// DraClientBeginCreateOptions contains the optional parameters for the DraClient.BeginCreate method. -type DraClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DraClientBeginDeleteOptions contains the optional parameters for the DraClient.BeginDelete method. -type DraClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DraClientGetOptions contains the optional parameters for the DraClient.Get method. -type DraClientGetOptions struct { - // placeholder for future optional parameters -} - -// DraClientListOptions contains the optional parameters for the DraClient.NewListPager method. -type DraClientListOptions struct { - // placeholder for future optional parameters -} - -// DraOperationStatusClientGetOptions contains the optional parameters for the DraOperationStatusClient.Get method. -type DraOperationStatusClientGetOptions struct { - // placeholder for future optional parameters -} - // EmailConfigurationClientCreateOptions contains the optional parameters for the EmailConfigurationClient.Create method. type EmailConfigurationClientCreateOptions struct { // placeholder for future optional parameters @@ -74,25 +41,50 @@ type EventClientListOptions struct { // Continuation token. ContinuationToken *string - // Filter string. - Filter *string + // OData options. + OdataOptions *string + + // Page size. + PageSize *int32 +} + +// FabricAgentClientBeginCreateOptions contains the optional parameters for the FabricAgentClient.BeginCreate method. +type FabricAgentClientBeginCreateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FabricAgentClientBeginDeleteOptions contains the optional parameters for the FabricAgentClient.BeginDelete method. +type FabricAgentClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FabricAgentClientGetOptions contains the optional parameters for the FabricAgentClient.Get method. +type FabricAgentClientGetOptions struct { + // placeholder for future optional parameters +} + +// FabricAgentClientListOptions contains the optional parameters for the FabricAgentClient.NewListPager method. +type FabricAgentClientListOptions struct { + // placeholder for future optional parameters } // FabricClientBeginCreateOptions contains the optional parameters for the FabricClient.BeginCreate method. type FabricClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // FabricClientBeginDeleteOptions contains the optional parameters for the FabricClient.BeginDelete method. type FabricClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // FabricClientBeginUpdateOptions contains the optional parameters for the FabricClient.BeginUpdate method. type FabricClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -104,8 +96,7 @@ type FabricClientGetOptions struct { // FabricClientListBySubscriptionOptions contains the optional parameters for the FabricClient.NewListBySubscriptionPager // method. type FabricClientListBySubscriptionOptions struct { - // Continuation token from the previous call. - ContinuationToken *string + // placeholder for future optional parameters } // FabricClientListOptions contains the optional parameters for the FabricClient.NewListPager method. @@ -114,8 +105,31 @@ type FabricClientListOptions struct { ContinuationToken *string } -// FabricOperationsStatusClientGetOptions contains the optional parameters for the FabricOperationsStatusClient.Get method. -type FabricOperationsStatusClientGetOptions struct { +// JobClientGetOptions contains the optional parameters for the JobClient.Get method. +type JobClientGetOptions struct { + // placeholder for future optional parameters +} + +// JobClientListOptions contains the optional parameters for the JobClient.NewListPager method. +type JobClientListOptions struct { + // Continuation token. + ContinuationToken *string + + // OData options. + OdataOptions *string + + // Page size. + PageSize *int32 +} + +// LocationBasedOperationResultsClientGetOptions contains the optional parameters for the LocationBasedOperationResultsClient.Get +// method. +type LocationBasedOperationResultsClientGetOptions struct { + // placeholder for future optional parameters +} + +// OperationResultsClientGetOptions contains the optional parameters for the OperationResultsClient.Get method. +type OperationResultsClientGetOptions struct { // placeholder for future optional parameters } @@ -126,13 +140,13 @@ type OperationsClientListOptions struct { // PolicyClientBeginCreateOptions contains the optional parameters for the PolicyClient.BeginCreate method. type PolicyClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // PolicyClientBeginDeleteOptions contains the optional parameters for the PolicyClient.BeginDelete method. type PolicyClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -146,33 +160,98 @@ type PolicyClientListOptions struct { // placeholder for future optional parameters } -// PolicyOperationStatusClientGetOptions contains the optional parameters for the PolicyOperationStatusClient.Get method. -type PolicyOperationStatusClientGetOptions struct { +// PrivateEndpointConnectionProxiesClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.BeginDelete +// method. +type PrivateEndpointConnectionProxiesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionProxiesClientCreateOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.Create +// method. +type PrivateEndpointConnectionProxiesClientCreateOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionProxiesClientGetOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.Get +// method. +type PrivateEndpointConnectionProxiesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionProxiesClientListOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.NewListPager +// method. +type PrivateEndpointConnectionProxiesClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionProxiesClientValidateOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.Validate +// method. +type PrivateEndpointConnectionProxiesClientValidateOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +type PrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager +// method. +type PrivateEndpointConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Update +// method. +type PrivateEndpointConnectionsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. +type PrivateLinkResourcesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListPager +// method. +type PrivateLinkResourcesClientListOptions struct { // placeholder for future optional parameters } // ProtectedItemClientBeginCreateOptions contains the optional parameters for the ProtectedItemClient.BeginCreate method. type ProtectedItemClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ProtectedItemClientBeginDeleteOptions contains the optional parameters for the ProtectedItemClient.BeginDelete method. type ProtectedItemClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // A flag indicating whether to do force delete or not. ForceDelete *bool - - // Resumes the LRO from the provided token. - ResumeToken string } // ProtectedItemClientBeginPlannedFailoverOptions contains the optional parameters for the ProtectedItemClient.BeginPlannedFailover // method. type ProtectedItemClientBeginPlannedFailoverOptions struct { - // Planned failover model. - Body *PlannedFailoverModel + // Resumes the long-running operation from the provided token. + ResumeToken string +} - // Resumes the LRO from the provided token. +// ProtectedItemClientBeginUpdateOptions contains the optional parameters for the ProtectedItemClient.BeginUpdate method. +type ProtectedItemClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -183,36 +262,37 @@ type ProtectedItemClientGetOptions struct { // ProtectedItemClientListOptions contains the optional parameters for the ProtectedItemClient.NewListPager method. type ProtectedItemClientListOptions struct { - // placeholder for future optional parameters -} + // Continuation token. + ContinuationToken *string -// ProtectedItemOperationStatusClientGetOptions contains the optional parameters for the ProtectedItemOperationStatusClient.Get -// method. -type ProtectedItemOperationStatusClientGetOptions struct { - // placeholder for future optional parameters + // OData options. + OdataOptions *string + + // Page size. + PageSize *int32 } -// RecoveryPointsClientGetOptions contains the optional parameters for the RecoveryPointsClient.Get method. -type RecoveryPointsClientGetOptions struct { +// RecoveryPointClientGetOptions contains the optional parameters for the RecoveryPointClient.Get method. +type RecoveryPointClientGetOptions struct { // placeholder for future optional parameters } -// RecoveryPointsClientListOptions contains the optional parameters for the RecoveryPointsClient.NewListPager method. -type RecoveryPointsClientListOptions struct { +// RecoveryPointClientListOptions contains the optional parameters for the RecoveryPointClient.NewListPager method. +type RecoveryPointClientListOptions struct { // placeholder for future optional parameters } // ReplicationExtensionClientBeginCreateOptions contains the optional parameters for the ReplicationExtensionClient.BeginCreate // method. type ReplicationExtensionClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ReplicationExtensionClientBeginDeleteOptions contains the optional parameters for the ReplicationExtensionClient.BeginDelete // method. type ReplicationExtensionClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -227,27 +307,21 @@ type ReplicationExtensionClientListOptions struct { // placeholder for future optional parameters } -// ReplicationExtensionOperationStatusClientGetOptions contains the optional parameters for the ReplicationExtensionOperationStatusClient.Get -// method. -type ReplicationExtensionOperationStatusClientGetOptions struct { - // placeholder for future optional parameters -} - // VaultClientBeginCreateOptions contains the optional parameters for the VaultClient.BeginCreate method. type VaultClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // VaultClientBeginDeleteOptions contains the optional parameters for the VaultClient.BeginDelete method. type VaultClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // VaultClientBeginUpdateOptions contains the optional parameters for the VaultClient.BeginUpdate method. type VaultClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -258,8 +332,7 @@ type VaultClientGetOptions struct { // VaultClientListBySubscriptionOptions contains the optional parameters for the VaultClient.NewListBySubscriptionPager method. type VaultClientListBySubscriptionOptions struct { - // Continuation token from the previous call. - ContinuationToken *string + // placeholder for future optional parameters } // VaultClientListOptions contains the optional parameters for the VaultClient.NewListPager method. @@ -267,27 +340,3 @@ type VaultClientListOptions struct { // Continuation token from the previous call. ContinuationToken *string } - -// VaultOperationStatusClientGetOptions contains the optional parameters for the VaultOperationStatusClient.Get method. -type VaultOperationStatusClientGetOptions struct { - // placeholder for future optional parameters -} - -// WorkflowClientGetOptions contains the optional parameters for the WorkflowClient.Get method. -type WorkflowClientGetOptions struct { - // placeholder for future optional parameters -} - -// WorkflowClientListOptions contains the optional parameters for the WorkflowClient.NewListPager method. -type WorkflowClientListOptions struct { - // Continuation token. - ContinuationToken *string - - // Filter string. - Filter *string -} - -// WorkflowOperationStatusClientGetOptions contains the optional parameters for the WorkflowOperationStatusClient.Get method. -type WorkflowOperationStatusClientGetOptions struct { - // placeholder for future optional parameters -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_client.go index 9917eb0a2277..3386b1a0e840 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_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 armrecoveryservicesdatareplication @@ -46,21 +42,20 @@ func NewPolicyClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreate - Creates the policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - policyName - The policy name. -// - body - Policy model. +// - resource - Policy model. // - options - PolicyClientBeginCreateOptions contains the optional parameters for the PolicyClient.BeginCreate method. -func (client *PolicyClient) BeginCreate(ctx context.Context, resourceGroupName string, vaultName string, policyName string, body PolicyModel, options *PolicyClientBeginCreateOptions) (*runtime.Poller[PolicyClientCreateResponse], error) { +func (client *PolicyClient) BeginCreate(ctx context.Context, resourceGroupName string, vaultName string, policyName string, resource PolicyModel, options *PolicyClientBeginCreateOptions) (*runtime.Poller[PolicyClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, vaultName, policyName, body, options) + resp, err := client.create(ctx, resourceGroupName, vaultName, policyName, resource, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PolicyClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -73,14 +68,14 @@ func (client *PolicyClient) BeginCreate(ctx context.Context, resourceGroupName s // Create - Creates the policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *PolicyClient) create(ctx context.Context, resourceGroupName string, vaultName string, policyName string, body PolicyModel, options *PolicyClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *PolicyClient) create(ctx context.Context, resourceGroupName string, vaultName string, policyName string, resource PolicyModel, options *PolicyClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "PolicyClient.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, vaultName, policyName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, vaultName, policyName, resource, options) if err != nil { return nil, err } @@ -96,7 +91,7 @@ func (client *PolicyClient) create(ctx context.Context, resourceGroupName string } // createCreateRequest creates the Create request. -func (client *PolicyClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, policyName string, body PolicyModel, options *PolicyClientBeginCreateOptions) (*policy.Request, error) { +func (client *PolicyClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, policyName string, resource PolicyModel, _ *PolicyClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -119,10 +114,11 @@ func (client *PolicyClient) createCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil @@ -131,7 +127,7 @@ func (client *PolicyClient) createCreateRequest(ctx context.Context, resourceGro // BeginDelete - Removes the policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - policyName - The policy name. @@ -143,8 +139,7 @@ func (client *PolicyClient) BeginDelete(ctx context.Context, resourceGroupName s return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PolicyClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -157,7 +152,7 @@ func (client *PolicyClient) BeginDelete(ctx context.Context, resourceGroupName s // Delete - Removes the policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *PolicyClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, policyName string, options *PolicyClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PolicyClient.BeginDelete" @@ -180,7 +175,7 @@ func (client *PolicyClient) deleteOperation(ctx context.Context, resourceGroupNa } // deleteCreateRequest creates the Delete request. -func (client *PolicyClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, policyName string, options *PolicyClientBeginDeleteOptions) (*policy.Request, error) { +func (client *PolicyClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, policyName string, _ *PolicyClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -203,7 +198,7 @@ func (client *PolicyClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -212,7 +207,7 @@ func (client *PolicyClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Gets the details of the policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - policyName - The policy name. @@ -240,7 +235,7 @@ func (client *PolicyClient) Get(ctx context.Context, resourceGroupName string, v } // getCreateRequest creates the Get request. -func (client *PolicyClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, policyName string, options *PolicyClientGetOptions) (*policy.Request, error) { +func (client *PolicyClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, policyName string, _ *PolicyClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -263,7 +258,7 @@ func (client *PolicyClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -280,7 +275,7 @@ func (client *PolicyClient) getHandleResponse(resp *http.Response) (PolicyClient // NewListPager - Gets the list of policies in the given vault. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - options - PolicyClientListOptions contains the optional parameters for the PolicyClient.NewListPager method. @@ -308,7 +303,7 @@ func (client *PolicyClient) NewListPager(resourceGroupName string, vaultName str } // listCreateRequest creates the List request. -func (client *PolicyClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *PolicyClientListOptions) (*policy.Request, error) { +func (client *PolicyClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *PolicyClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -327,7 +322,7 @@ func (client *PolicyClient) listCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -336,7 +331,7 @@ func (client *PolicyClient) listCreateRequest(ctx context.Context, resourceGroup // listHandleResponse handles the List response. func (client *PolicyClient) listHandleResponse(resp *http.Response) (PolicyClientListResponse, error) { result := PolicyClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PolicyModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyModelListResult); err != nil { return PolicyClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_client_example_test.go index b1c2cb3b8c9e..8eccd931c86c 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_client_example_test.go @@ -1,140 +1,127 @@ -//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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_Get.json -func ExamplePolicyClient_Get() { +// Generated from example definition: 2024-09-01/Policy_Create.json +func ExamplePolicyClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewPolicyClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "wdqsacasc", nil) + poller, err := clientFactory.NewPolicyClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "4", "fafqwc", armrecoveryservicesdatareplication.PolicyModel{ + Properties: &armrecoveryservicesdatareplication.PolicyModelProperties{}, + }, 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.PolicyModel = armrecoveryservicesdatareplication.PolicyModel{ - // Name: to.Ptr("ocmty"), - // Type: to.Ptr("pvltqld"), - // ID: to.Ptr("ffivjzdtqgguqlenedikvdilazliwm"), - // Properties: &armrecoveryservicesdatareplication.PolicyModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.PolicyModelCustomProperties{ - // InstanceType: to.Ptr("PolicyModelCustomProperties"), + // res = armrecoveryservicesdatareplication.PolicyClientCreateResponse{ + // PolicyModel: &armrecoveryservicesdatareplication.PolicyModel{ + // Properties: &armrecoveryservicesdatareplication.PolicyModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/replicationPolicies/policy1"), + // Name: to.Ptr("ocmty"), + // Type: to.Ptr("pvltqld"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("yiaelkrpuzsfumovsxeb"), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("qwzrkjsfloruegijrfnfpn")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), + // LastModifiedBy: to.Ptr("xy"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("rnc")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), // }, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // }, - // SystemData: &armrecoveryservicesdatareplication.PolicyModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), - // CreatedBy: to.Ptr("yiaelkrpuzsfumovsxeb"), - // CreatedByType: to.Ptr("qwzrkjsfloruegijrfnfpn"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), - // LastModifiedBy: to.Ptr("xy"), - // LastModifiedByType: to.Ptr("rnc"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_Create.json -func ExamplePolicyClient_BeginCreate() { +// Generated from example definition: 2024-09-01/Policy_Delete.json +func ExamplePolicyClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewPolicyClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "4", "fafqwc", armrecoveryservicesdatareplication.PolicyModel{ - Properties: &armrecoveryservicesdatareplication.PolicyModelProperties{ - CustomProperties: &armrecoveryservicesdatareplication.PolicyModelCustomProperties{ - InstanceType: to.Ptr("PolicyModelCustomProperties"), - }, - }, - }, nil) + poller, err := clientFactory.NewPolicyClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "4", "wqfscsdv", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) + _, 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.PolicyModel = armrecoveryservicesdatareplication.PolicyModel{ - // Name: to.Ptr("ocmty"), - // Type: to.Ptr("pvltqld"), - // ID: to.Ptr("ffivjzdtqgguqlenedikvdilazliwm"), - // Properties: &armrecoveryservicesdatareplication.PolicyModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.PolicyModelCustomProperties{ - // InstanceType: to.Ptr("PolicyModelCustomProperties"), - // }, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // }, - // SystemData: &armrecoveryservicesdatareplication.PolicyModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), - // CreatedBy: to.Ptr("yiaelkrpuzsfumovsxeb"), - // CreatedByType: to.Ptr("qwzrkjsfloruegijrfnfpn"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), - // LastModifiedBy: to.Ptr("xy"), - // LastModifiedByType: to.Ptr("rnc"), - // }, - // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_Delete.json -func ExamplePolicyClient_BeginDelete() { +// Generated from example definition: 2024-09-01/Policy_Get.json +func ExamplePolicyClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewPolicyClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "4", "wqfscsdv", nil) + res, err := clientFactory.NewPolicyClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "wdqsacasc", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, 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 = armrecoveryservicesdatareplication.PolicyClientGetResponse{ + // PolicyModel: &armrecoveryservicesdatareplication.PolicyModel{ + // Properties: &armrecoveryservicesdatareplication.PolicyModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/replicationPolicies/policy1"), + // Name: to.Ptr("ocmty"), + // Type: to.Ptr("pvltqld"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("yiaelkrpuzsfumovsxeb"), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("qwzrkjsfloruegijrfnfpn")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), + // LastModifiedBy: to.Ptr("xy"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("rnc")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_List.json +// Generated from example definition: 2024-09-01/Policy_List.json func ExamplePolicyClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -149,27 +136,27 @@ func ExamplePolicyClient_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.PolicyModelCollection = armrecoveryservicesdatareplication.PolicyModelCollection{ - // Value: []*armrecoveryservicesdatareplication.PolicyModel{ - // { - // Name: to.Ptr("ocmty"), - // Type: to.Ptr("pvltqld"), - // ID: to.Ptr("ffivjzdtqgguqlenedikvdilazliwm"), - // Properties: &armrecoveryservicesdatareplication.PolicyModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.PolicyModelCustomProperties{ - // InstanceType: to.Ptr("PolicyModelCustomProperties"), + // page = armrecoveryservicesdatareplication.PolicyClientListResponse{ + // PolicyModelListResult: armrecoveryservicesdatareplication.PolicyModelListResult{ + // Value: []*armrecoveryservicesdatareplication.PolicyModel{ + // { + // Properties: &armrecoveryservicesdatareplication.PolicyModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/replicationPolicies/policy1"), + // Name: to.Ptr("ocmty"), + // Type: to.Ptr("pvltqld"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("yiaelkrpuzsfumovsxeb"), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("qwzrkjsfloruegijrfnfpn")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), + // LastModifiedBy: to.Ptr("xy"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("rnc")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), // }, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // }, - // SystemData: &armrecoveryservicesdatareplication.PolicyModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), - // CreatedBy: to.Ptr("yiaelkrpuzsfumovsxeb"), - // CreatedByType: to.Ptr("qwzrkjsfloruegijrfnfpn"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), - // LastModifiedBy: to.Ptr("xy"), - // LastModifiedByType: to.Ptr("rnc"), // }, - // }}, + // }, + // }, // } } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policyoperationstatus_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policyoperationstatus_client.go deleted file mode 100644 index 14244c942f19..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policyoperationstatus_client.go +++ /dev/null @@ -1,119 +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 armrecoveryservicesdatareplication - -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" -) - -// PolicyOperationStatusClient contains the methods for the PolicyOperationStatus group. -// Don't use this type directly, use NewPolicyOperationStatusClient() instead. -type PolicyOperationStatusClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPolicyOperationStatusClient creates a new instance of PolicyOperationStatusClient 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 NewPolicyOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PolicyOperationStatusClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PolicyOperationStatusClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Tracks the results of an asynchronous operation on the policy. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-02-16-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - vaultName - The vault name. -// - policyName - The policy name. -// - operationID - The ID of an ongoing async operation. -// - options - PolicyOperationStatusClientGetOptions contains the optional parameters for the PolicyOperationStatusClient.Get -// method. -func (client *PolicyOperationStatusClient) Get(ctx context.Context, resourceGroupName string, vaultName string, policyName string, operationID string, options *PolicyOperationStatusClientGetOptions) (PolicyOperationStatusClientGetResponse, error) { - var err error - const operationName = "PolicyOperationStatusClient.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, vaultName, policyName, operationID, options) - if err != nil { - return PolicyOperationStatusClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PolicyOperationStatusClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PolicyOperationStatusClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PolicyOperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, policyName string, operationID string, options *PolicyOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}/operations/{operationId}" - 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 vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - if policyName == "" { - return nil, errors.New("parameter policyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{policyName}", url.PathEscape(policyName)) - if operationID == "" { - return nil, errors.New("parameter operationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - 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", "2021-02-16-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PolicyOperationStatusClient) getHandleResponse(resp *http.Response) (PolicyOperationStatusClientGetResponse, error) { - result := PolicyOperationStatusClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return PolicyOperationStatusClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policyoperationstatus_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policyoperationstatus_client_example_test.go deleted file mode 100644 index a1f17fb1c935..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policyoperationstatus_client_example_test.go +++ /dev/null @@ -1,45 +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 armrecoveryservicesdatareplication_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/PolicyOperationStatus_Get.json -func ExamplePolicyOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPolicyOperationStatusClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "xczxcwec", "wdqfsdxv", 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.OperationStatus = armrecoveryservicesdatareplication.OperationStatus{ - // Name: to.Ptr("wzdasptnwlxgobklayoqapjcgcf"), - // EndTime: to.Ptr("nauyrfh"), - // ID: to.Ptr("sf"), - // StartTime: to.Ptr("xuzwmfrhluafmwwsmzqxsytyehsh"), - // Status: to.Ptr("plbnngzfppdram"), - // } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/polymorphic_helpers.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/polymorphic_helpers.go index 286a31af02aa..4aef56029ca0 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/polymorphic_helpers.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/polymorphic_helpers.go @@ -1,29 +1,27 @@ -//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 armrecoveryservicesdatareplication import "encoding/json" -func unmarshalDraModelCustomPropertiesClassification(rawMsg json.RawMessage) (DraModelCustomPropertiesClassification, error) { - if rawMsg == nil { +func unmarshalEventModelCustomPropertiesClassification(rawMsg json.RawMessage) (EventModelCustomPropertiesClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - var b DraModelCustomPropertiesClassification + var b EventModelCustomPropertiesClassification switch m["instanceType"] { - case "VMware": - b = &VMwareDraModelCustomProperties{} + case "HyperVToAzStackHCI": + b = &HyperVToAzStackHCIEventModelCustomProperties{} + case "VMwareToAzStackHCI": + b = &VMwareToAzStackHCIEventModelCustomProperties{} default: - b = &DraModelCustomProperties{} + b = &EventModelCustomProperties{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err @@ -31,20 +29,20 @@ func unmarshalDraModelCustomPropertiesClassification(rawMsg json.RawMessage) (Dr return b, nil } -func unmarshalEventModelCustomPropertiesClassification(rawMsg json.RawMessage) (EventModelCustomPropertiesClassification, error) { - if rawMsg == nil { +func unmarshalFabricAgentModelCustomPropertiesClassification(rawMsg json.RawMessage) (FabricAgentModelCustomPropertiesClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - var b EventModelCustomPropertiesClassification + var b FabricAgentModelCustomPropertiesClassification switch m["instanceType"] { - case "HyperVToAzStackHCI": - b = &HyperVToAzStackHCIEventModelCustomProperties{} + case "VMware": + b = &VMwareFabricAgentModelCustomProperties{} default: - b = &EventModelCustomProperties{} + b = &FabricAgentModelCustomProperties{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err @@ -53,7 +51,7 @@ func unmarshalEventModelCustomPropertiesClassification(rawMsg json.RawMessage) ( } func unmarshalFabricModelCustomPropertiesClassification(rawMsg json.RawMessage) (FabricModelCustomPropertiesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -77,8 +75,33 @@ func unmarshalFabricModelCustomPropertiesClassification(rawMsg json.RawMessage) return b, nil } +func unmarshalJobModelCustomPropertiesClassification(rawMsg json.RawMessage) (JobModelCustomPropertiesClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b JobModelCustomPropertiesClassification + switch m["instanceType"] { + case "FailoverJobDetails": + b = &FailoverJobModelCustomProperties{} + case "TestFailoverCleanupJobDetails": + b = &TestFailoverCleanupJobModelCustomProperties{} + case "TestFailoverJobDetails": + b = &TestFailoverJobModelCustomProperties{} + default: + b = &JobModelCustomProperties{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + func unmarshalPlannedFailoverModelCustomPropertiesClassification(rawMsg json.RawMessage) (PlannedFailoverModelCustomPropertiesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -101,7 +124,7 @@ func unmarshalPlannedFailoverModelCustomPropertiesClassification(rawMsg json.Raw } func unmarshalPolicyModelCustomPropertiesClassification(rawMsg json.RawMessage) (PolicyModelCustomPropertiesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -124,7 +147,7 @@ func unmarshalPolicyModelCustomPropertiesClassification(rawMsg json.RawMessage) } func unmarshalProtectedItemModelCustomPropertiesClassification(rawMsg json.RawMessage) (ProtectedItemModelCustomPropertiesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -146,20 +169,22 @@ func unmarshalProtectedItemModelCustomPropertiesClassification(rawMsg json.RawMe return b, nil } -func unmarshalRecoveryPointModelCustomPropertiesClassification(rawMsg json.RawMessage) (RecoveryPointModelCustomPropertiesClassification, error) { - if rawMsg == nil { +func unmarshalProtectedItemModelCustomPropertiesUpdateClassification(rawMsg json.RawMessage) (ProtectedItemModelCustomPropertiesUpdateClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - var b RecoveryPointModelCustomPropertiesClassification + var b ProtectedItemModelCustomPropertiesUpdateClassification switch m["instanceType"] { case "HyperVToAzStackHCI": - b = &HyperVToAzStackHCIRecoveryPointModelCustomProperties{} + b = &HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate{} + case "VMwareToAzStackHCI": + b = &VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate{} default: - b = &RecoveryPointModelCustomProperties{} + b = &ProtectedItemModelCustomPropertiesUpdate{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err @@ -167,22 +192,22 @@ func unmarshalRecoveryPointModelCustomPropertiesClassification(rawMsg json.RawMe return b, nil } -func unmarshalReplicationExtensionModelCustomPropertiesClassification(rawMsg json.RawMessage) (ReplicationExtensionModelCustomPropertiesClassification, error) { - if rawMsg == nil { +func unmarshalRecoveryPointModelCustomPropertiesClassification(rawMsg json.RawMessage) (RecoveryPointModelCustomPropertiesClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - var b ReplicationExtensionModelCustomPropertiesClassification + var b RecoveryPointModelCustomPropertiesClassification switch m["instanceType"] { case "HyperVToAzStackHCI": - b = &HyperVToAzStackHCIReplicationExtensionModelCustomProperties{} - case "VMwareToAzStackHCI": - b = &VMwareToAzStackHCIReplicationExtensionModelCustomProperties{} + b = &HyperVToAzStackHCIRecoveryPointModelCustomProperties{} + case "VMwareToAzStackHCIRecoveryPointModelCustomProperties": + b = &VMwareToAzStackHCIRecoveryPointModelCustomProperties{} default: - b = &ReplicationExtensionModelCustomProperties{} + b = &RecoveryPointModelCustomProperties{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err @@ -190,24 +215,22 @@ func unmarshalReplicationExtensionModelCustomPropertiesClassification(rawMsg jso return b, nil } -func unmarshalWorkflowModelCustomPropertiesClassification(rawMsg json.RawMessage) (WorkflowModelCustomPropertiesClassification, error) { - if rawMsg == nil { +func unmarshalReplicationExtensionModelCustomPropertiesClassification(rawMsg json.RawMessage) (ReplicationExtensionModelCustomPropertiesClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - var b WorkflowModelCustomPropertiesClassification + var b ReplicationExtensionModelCustomPropertiesClassification switch m["instanceType"] { - case "FailoverWorkflowDetails": - b = &FailoverWorkflowModelCustomProperties{} - case "TestFailoverCleanupWorkflowDetails": - b = &TestFailoverCleanupWorkflowModelCustomProperties{} - case "TestFailoverWorkflowDetails": - b = &TestFailoverWorkflowModelCustomProperties{} + case "HyperVToAzStackHCI": + b = &HyperVToAzStackHCIReplicationExtensionModelCustomProperties{} + case "VMwareToAzStackHCI": + b = &VMwareToAzStackHCIReplicationExtensionModelCustomProperties{} default: - b = &WorkflowModelCustomProperties{} + b = &ReplicationExtensionModelCustomProperties{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnectionproxies_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnectionproxies_client.go new file mode 100644 index 000000000000..fedf5a4caa8c --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnectionproxies_client.go @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armrecoveryservicesdatareplication + +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" +) + +// PrivateEndpointConnectionProxiesClient contains the methods for the PrivateEndpointConnectionProxies group. +// Don't use this type directly, use NewPrivateEndpointConnectionProxiesClient() instead. +type PrivateEndpointConnectionProxiesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateEndpointConnectionProxiesClient creates a new instance of PrivateEndpointConnectionProxiesClient 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 NewPrivateEndpointConnectionProxiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionProxiesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateEndpointConnectionProxiesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Create a new private endpoint connection proxy which includes both auto and manual approval types. Creating the +// proxy resource will also create a private endpoint connection resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - privateEndpointConnectionProxyName - The private endpoint connection proxy name. +// - resource - Private endpoint connection creation input. +// - options - PrivateEndpointConnectionProxiesClientCreateOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.Create +// method. +func (client *PrivateEndpointConnectionProxiesClient) Create(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, resource PrivateEndpointConnectionProxy, options *PrivateEndpointConnectionProxiesClientCreateOptions) (PrivateEndpointConnectionProxiesClientCreateResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionProxiesClient.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, vaultName, privateEndpointConnectionProxyName, resource, options) + if err != nil { + return PrivateEndpointConnectionProxiesClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionProxiesClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionProxiesClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *PrivateEndpointConnectionProxiesClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, resource PrivateEndpointConnectionProxy, _ *PrivateEndpointConnectionProxiesClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyName}" + 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 vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if privateEndpointConnectionProxyName == "" { + return nil, errors.New("parameter privateEndpointConnectionProxyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionProxyName}", url.PathEscape(privateEndpointConnectionProxyName)) + 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-09-01") + 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 +} + +// createHandleResponse handles the Create response. +func (client *PrivateEndpointConnectionProxiesClient) createHandleResponse(resp *http.Response) (PrivateEndpointConnectionProxiesClientCreateResponse, error) { + result := PrivateEndpointConnectionProxiesClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionProxy); err != nil { + return PrivateEndpointConnectionProxiesClientCreateResponse{}, err + } + return result, nil +} + +// BeginDelete - Returns the operation to track the deletion of private endpoint connection proxy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - privateEndpointConnectionProxyName - The private endpoint connection proxy name. +// - options - PrivateEndpointConnectionProxiesClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.BeginDelete +// method. +func (client *PrivateEndpointConnectionProxiesClient) BeginDelete(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, options *PrivateEndpointConnectionProxiesClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionProxiesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, vaultName, privateEndpointConnectionProxyName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionProxiesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionProxiesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Returns the operation to track the deletion of private endpoint connection proxy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +func (client *PrivateEndpointConnectionProxiesClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, options *PrivateEndpointConnectionProxiesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PrivateEndpointConnectionProxiesClient.BeginDelete" + 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, vaultName, privateEndpointConnectionProxyName, 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.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateEndpointConnectionProxiesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, _ *PrivateEndpointConnectionProxiesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyName}" + 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 vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if privateEndpointConnectionProxyName == "" { + return nil, errors.New("parameter privateEndpointConnectionProxyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionProxyName}", url.PathEscape(privateEndpointConnectionProxyName)) + 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-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the private endpoint connection proxy details. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - privateEndpointConnectionProxyName - The private endpoint connection proxy name. +// - options - PrivateEndpointConnectionProxiesClientGetOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.Get +// method. +func (client *PrivateEndpointConnectionProxiesClient) Get(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, options *PrivateEndpointConnectionProxiesClientGetOptions) (PrivateEndpointConnectionProxiesClientGetResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionProxiesClient.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, vaultName, privateEndpointConnectionProxyName, options) + if err != nil { + return PrivateEndpointConnectionProxiesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionProxiesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionProxiesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionProxiesClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, _ *PrivateEndpointConnectionProxiesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyName}" + 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 vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if privateEndpointConnectionProxyName == "" { + return nil, errors.New("parameter privateEndpointConnectionProxyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionProxyName}", url.PathEscape(privateEndpointConnectionProxyName)) + 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-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointConnectionProxiesClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionProxiesClientGetResponse, error) { + result := PrivateEndpointConnectionProxiesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionProxy); err != nil { + return PrivateEndpointConnectionProxiesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets the all private endpoint connections proxies. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - options - PrivateEndpointConnectionProxiesClientListOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.NewListPager +// method. +func (client *PrivateEndpointConnectionProxiesClient) NewListPager(resourceGroupName string, vaultName string, options *PrivateEndpointConnectionProxiesClientListOptions) *runtime.Pager[PrivateEndpointConnectionProxiesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionProxiesClientListResponse]{ + More: func(page PrivateEndpointConnectionProxiesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionProxiesClientListResponse) (PrivateEndpointConnectionProxiesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateEndpointConnectionProxiesClient.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, vaultName, options) + }, nil) + if err != nil { + return PrivateEndpointConnectionProxiesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *PrivateEndpointConnectionProxiesClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *PrivateEndpointConnectionProxiesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnectionProxies" + 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 vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + 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-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateEndpointConnectionProxiesClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionProxiesClientListResponse, error) { + result := PrivateEndpointConnectionProxiesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionProxyListResult); err != nil { + return PrivateEndpointConnectionProxiesClientListResponse{}, err + } + return result, nil +} + +// Validate - Returns remote private endpoint connection information after validation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - privateEndpointConnectionProxyName - The private endpoint connection proxy name. +// - body - The private endpoint connection proxy input. +// - options - PrivateEndpointConnectionProxiesClientValidateOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.Validate +// method. +func (client *PrivateEndpointConnectionProxiesClient) Validate(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, body PrivateEndpointConnectionProxy, options *PrivateEndpointConnectionProxiesClientValidateOptions) (PrivateEndpointConnectionProxiesClientValidateResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionProxiesClient.Validate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.validateCreateRequest(ctx, resourceGroupName, vaultName, privateEndpointConnectionProxyName, body, options) + if err != nil { + return PrivateEndpointConnectionProxiesClientValidateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionProxiesClientValidateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionProxiesClientValidateResponse{}, err + } + resp, err := client.validateHandleResponse(httpResp) + return resp, err +} + +// validateCreateRequest creates the Validate request. +func (client *PrivateEndpointConnectionProxiesClient) validateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, body PrivateEndpointConnectionProxy, _ *PrivateEndpointConnectionProxiesClientValidateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyName}/validate" + 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 vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if privateEndpointConnectionProxyName == "" { + return nil, errors.New("parameter privateEndpointConnectionProxyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionProxyName}", url.PathEscape(privateEndpointConnectionProxyName)) + 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-09-01") + 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 +} + +// validateHandleResponse handles the Validate response. +func (client *PrivateEndpointConnectionProxiesClient) validateHandleResponse(resp *http.Response) (PrivateEndpointConnectionProxiesClientValidateResponse, error) { + result := PrivateEndpointConnectionProxiesClientValidateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionProxy); err != nil { + return PrivateEndpointConnectionProxiesClientValidateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnectionproxies_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnectionproxies_client_example_test.go new file mode 100644 index 000000000000..8976bed4bfff --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnectionproxies_client_example_test.go @@ -0,0 +1,501 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" +) + +// Generated from example definition: 2024-09-01/PrivateEndpointConnectionProxy_Create.json +func ExamplePrivateEndpointConnectionProxiesClient_Create() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateEndpointConnectionProxiesClient().Create(ctx, "rgswagger_2024-09-01", "4", "d", armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy{ + Etag: to.Ptr("hruibxrezstxroxrxweh"), + Properties: &armrecoveryservicesdatareplication.PrivateEndpointConnectionProxyProperties{ + RemotePrivateEndpoint: &armrecoveryservicesdatareplication.RemotePrivateEndpoint{ + ID: to.Ptr("yipalno"), + PrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + { + Name: to.Ptr("jqwntlzfsksl"), + GroupIDs: []*string{ + to.Ptr("hvejynjktikteipnioyeja"), + }, + RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + }, + }, + ManualPrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + { + Name: to.Ptr("jqwntlzfsksl"), + GroupIDs: []*string{ + to.Ptr("hvejynjktikteipnioyeja"), + }, + RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + }, + }, + PrivateLinkServiceProxies: []*armrecoveryservicesdatareplication.PrivateLinkServiceProxy{ + { + ID: to.Ptr("nzqxevuyqeedrqnkbnlcyrrrbzxvl"), + RemotePrivateLinkServiceConnectionState: &armrecoveryservicesdatareplication.PrivateLinkServiceConnectionState{ + Status: to.Ptr(armrecoveryservicesdatareplication.PrivateEndpointConnectionStatusApproved), + Description: to.Ptr("y"), + ActionsRequired: to.Ptr("afwbq"), + }, + RemotePrivateEndpointConnection: &armrecoveryservicesdatareplication.RemotePrivateEndpointConnection{ + ID: to.Ptr("ocunsgawjsqohkrcyxiv"), + }, + GroupConnectivityInformation: []*armrecoveryservicesdatareplication.GroupConnectivityInformation{ + { + GroupID: to.Ptr("per"), + MemberName: to.Ptr("ybptuypgdqoxkuwqx"), + CustomerVisibleFqdns: []*string{ + to.Ptr("vedcg"), + }, + InternalFqdn: to.Ptr("maqavwhxwzzhbzjbryyquvitmup"), + RedirectMapID: to.Ptr("pezncxcq"), + PrivateLinkServiceArmRegion: to.Ptr("rerkqqxinteevmlbrdkktaqhcch"), + }, + }, + }, + }, + ConnectionDetails: []*armrecoveryservicesdatareplication.ConnectionDetails{ + { + ID: to.Ptr("lenqkogzkes"), + PrivateIPAddress: to.Ptr("cyiacdzzyqmxjpijjbwgasegehtqe"), + LinkIdentifier: to.Ptr("ravfufhkdowufd"), + GroupID: to.Ptr("pjrlygpadir"), + MemberName: to.Ptr("ybuysjrlfupewxe"), + }, + }, + }, + }, + }, 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 = armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientCreateResponse{ + // PrivateEndpointConnectionProxy: &armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/privateEndpointConnectionProxies/proxy1"), + // Name: to.Ptr("wrbeymbilwm"), + // Type: to.Ptr("xpfgxxykisvjcifsnlvtgjakwifak"), + // Etag: to.Ptr("hruibxrezstxroxrxweh"), + // Properties: &armrecoveryservicesdatareplication.PrivateEndpointConnectionProxyProperties{ + // RemotePrivateEndpoint: &armrecoveryservicesdatareplication.RemotePrivateEndpoint{ + // ID: to.Ptr("yipalno"), + // PrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + // { + // Name: to.Ptr("jqwntlzfsksl"), + // GroupIDs: []*string{ + // to.Ptr("hvejynjktikteipnioyeja"), + // }, + // RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + // }, + // }, + // ManualPrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + // { + // Name: to.Ptr("jqwntlzfsksl"), + // GroupIDs: []*string{ + // to.Ptr("hvejynjktikteipnioyeja"), + // }, + // RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + // }, + // }, + // PrivateLinkServiceProxies: []*armrecoveryservicesdatareplication.PrivateLinkServiceProxy{ + // { + // ID: to.Ptr("nzqxevuyqeedrqnkbnlcyrrrbzxvl"), + // RemotePrivateLinkServiceConnectionState: &armrecoveryservicesdatareplication.PrivateLinkServiceConnectionState{ + // Status: to.Ptr(armrecoveryservicesdatareplication.PrivateEndpointConnectionStatusApproved), + // Description: to.Ptr("y"), + // ActionsRequired: to.Ptr("afwbq"), + // }, + // RemotePrivateEndpointConnection: &armrecoveryservicesdatareplication.RemotePrivateEndpointConnection{ + // ID: to.Ptr("ocunsgawjsqohkrcyxiv"), + // }, + // GroupConnectivityInformation: []*armrecoveryservicesdatareplication.GroupConnectivityInformation{ + // { + // GroupID: to.Ptr("per"), + // MemberName: to.Ptr("ybptuypgdqoxkuwqx"), + // CustomerVisibleFqdns: []*string{ + // to.Ptr("vedcg"), + // }, + // InternalFqdn: to.Ptr("maqavwhxwzzhbzjbryyquvitmup"), + // RedirectMapID: to.Ptr("pezncxcq"), + // PrivateLinkServiceArmRegion: to.Ptr("rerkqqxinteevmlbrdkktaqhcch"), + // }, + // }, + // }, + // }, + // ConnectionDetails: []*armrecoveryservicesdatareplication.ConnectionDetails{ + // { + // ID: to.Ptr("lenqkogzkes"), + // PrivateIPAddress: to.Ptr("cyiacdzzyqmxjpijjbwgasegehtqe"), + // LinkIdentifier: to.Ptr("ravfufhkdowufd"), + // GroupID: to.Ptr("pjrlygpadir"), + // MemberName: to.Ptr("ybuysjrlfupewxe"), + // }, + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/PrivateEndpointConnectionProxy_Delete.json +func ExamplePrivateEndpointConnectionProxiesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPrivateEndpointConnectionProxiesClient().BeginDelete(ctx, "rgswagger_2024-09-01", "4", "d", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: 2024-09-01/PrivateEndpointConnectionProxy_Get.json +func ExamplePrivateEndpointConnectionProxiesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateEndpointConnectionProxiesClient().Get(ctx, "rgswagger_2024-09-01", "4", "d", 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 = armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientGetResponse{ + // PrivateEndpointConnectionProxy: &armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/privateEndpointConnectionProxies/proxy1"), + // Name: to.Ptr("wrbeymbilwm"), + // Type: to.Ptr("xpfgxxykisvjcifsnlvtgjakwifak"), + // Etag: to.Ptr("hruibxrezstxroxrxweh"), + // Properties: &armrecoveryservicesdatareplication.PrivateEndpointConnectionProxyProperties{ + // RemotePrivateEndpoint: &armrecoveryservicesdatareplication.RemotePrivateEndpoint{ + // ID: to.Ptr("yipalno"), + // PrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + // { + // Name: to.Ptr("jqwntlzfsksl"), + // GroupIDs: []*string{ + // to.Ptr("hvejynjktikteipnioyeja"), + // }, + // RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + // }, + // }, + // ManualPrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + // { + // Name: to.Ptr("jqwntlzfsksl"), + // GroupIDs: []*string{ + // to.Ptr("hvejynjktikteipnioyeja"), + // }, + // RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + // }, + // }, + // PrivateLinkServiceProxies: []*armrecoveryservicesdatareplication.PrivateLinkServiceProxy{ + // { + // ID: to.Ptr("nzqxevuyqeedrqnkbnlcyrrrbzxvl"), + // RemotePrivateLinkServiceConnectionState: &armrecoveryservicesdatareplication.PrivateLinkServiceConnectionState{ + // Status: to.Ptr(armrecoveryservicesdatareplication.PrivateEndpointConnectionStatusApproved), + // Description: to.Ptr("y"), + // ActionsRequired: to.Ptr("afwbq"), + // }, + // RemotePrivateEndpointConnection: &armrecoveryservicesdatareplication.RemotePrivateEndpointConnection{ + // ID: to.Ptr("ocunsgawjsqohkrcyxiv"), + // }, + // GroupConnectivityInformation: []*armrecoveryservicesdatareplication.GroupConnectivityInformation{ + // { + // GroupID: to.Ptr("per"), + // MemberName: to.Ptr("ybptuypgdqoxkuwqx"), + // CustomerVisibleFqdns: []*string{ + // to.Ptr("vedcg"), + // }, + // InternalFqdn: to.Ptr("maqavwhxwzzhbzjbryyquvitmup"), + // RedirectMapID: to.Ptr("pezncxcq"), + // PrivateLinkServiceArmRegion: to.Ptr("rerkqqxinteevmlbrdkktaqhcch"), + // }, + // }, + // }, + // }, + // ConnectionDetails: []*armrecoveryservicesdatareplication.ConnectionDetails{ + // { + // ID: to.Ptr("lenqkogzkes"), + // PrivateIPAddress: to.Ptr("cyiacdzzyqmxjpijjbwgasegehtqe"), + // LinkIdentifier: to.Ptr("ravfufhkdowufd"), + // GroupID: to.Ptr("pjrlygpadir"), + // MemberName: to.Ptr("ybuysjrlfupewxe"), + // }, + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/PrivateEndpointConnectionProxy_List.json +func ExamplePrivateEndpointConnectionProxiesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPrivateEndpointConnectionProxiesClient().NewListPager("rgswagger_2024-09-01", "4", 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 = armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientListResponse{ + // PrivateEndpointConnectionProxyListResult: armrecoveryservicesdatareplication.PrivateEndpointConnectionProxyListResult{ + // Value: []*armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/privateEndpointConnectionProxies/proxy1"), + // Name: to.Ptr("wrbeymbilwm"), + // Type: to.Ptr("xpfgxxykisvjcifsnlvtgjakwifak"), + // Etag: to.Ptr("hruibxrezstxroxrxweh"), + // Properties: &armrecoveryservicesdatareplication.PrivateEndpointConnectionProxyProperties{ + // RemotePrivateEndpoint: &armrecoveryservicesdatareplication.RemotePrivateEndpoint{ + // ID: to.Ptr("yipalno"), + // PrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + // { + // Name: to.Ptr("jqwntlzfsksl"), + // GroupIDs: []*string{ + // to.Ptr("hvejynjktikteipnioyeja"), + // }, + // RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + // }, + // }, + // ManualPrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + // { + // Name: to.Ptr("jqwntlzfsksl"), + // GroupIDs: []*string{ + // to.Ptr("hvejynjktikteipnioyeja"), + // }, + // RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + // }, + // }, + // PrivateLinkServiceProxies: []*armrecoveryservicesdatareplication.PrivateLinkServiceProxy{ + // { + // ID: to.Ptr("nzqxevuyqeedrqnkbnlcyrrrbzxvl"), + // RemotePrivateLinkServiceConnectionState: &armrecoveryservicesdatareplication.PrivateLinkServiceConnectionState{ + // Status: to.Ptr(armrecoveryservicesdatareplication.PrivateEndpointConnectionStatusApproved), + // Description: to.Ptr("y"), + // ActionsRequired: to.Ptr("afwbq"), + // }, + // RemotePrivateEndpointConnection: &armrecoveryservicesdatareplication.RemotePrivateEndpointConnection{ + // ID: to.Ptr("ocunsgawjsqohkrcyxiv"), + // }, + // GroupConnectivityInformation: []*armrecoveryservicesdatareplication.GroupConnectivityInformation{ + // { + // GroupID: to.Ptr("per"), + // MemberName: to.Ptr("ybptuypgdqoxkuwqx"), + // CustomerVisibleFqdns: []*string{ + // to.Ptr("vedcg"), + // }, + // InternalFqdn: to.Ptr("maqavwhxwzzhbzjbryyquvitmup"), + // RedirectMapID: to.Ptr("pezncxcq"), + // PrivateLinkServiceArmRegion: to.Ptr("rerkqqxinteevmlbrdkktaqhcch"), + // }, + // }, + // }, + // }, + // ConnectionDetails: []*armrecoveryservicesdatareplication.ConnectionDetails{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/privateEndpointConnections/connection1"), + // PrivateIPAddress: to.Ptr("cyiacdzzyqmxjpijjbwgasegehtqe"), + // LinkIdentifier: to.Ptr("ravfufhkdowufd"), + // GroupID: to.Ptr("pjrlygpadir"), + // MemberName: to.Ptr("ybuysjrlfupewxe"), + // }, + // }, + // }, + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-09-01/PrivateEndpointConnectionProxy_Validate.json +func ExamplePrivateEndpointConnectionProxiesClient_Validate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateEndpointConnectionProxiesClient().Validate(ctx, "rgswagger_2024-09-01", "4", "d", armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy{ + Etag: to.Ptr("hruibxrezstxroxrxweh"), + Properties: &armrecoveryservicesdatareplication.PrivateEndpointConnectionProxyProperties{ + RemotePrivateEndpoint: &armrecoveryservicesdatareplication.RemotePrivateEndpoint{ + ID: to.Ptr("yipalno"), + PrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + { + Name: to.Ptr("jqwntlzfsksl"), + GroupIDs: []*string{ + to.Ptr("hvejynjktikteipnioyeja"), + }, + RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + }, + }, + ManualPrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + { + Name: to.Ptr("jqwntlzfsksl"), + GroupIDs: []*string{ + to.Ptr("hvejynjktikteipnioyeja"), + }, + RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + }, + }, + PrivateLinkServiceProxies: []*armrecoveryservicesdatareplication.PrivateLinkServiceProxy{ + { + ID: to.Ptr("nzqxevuyqeedrqnkbnlcyrrrbzxvl"), + RemotePrivateLinkServiceConnectionState: &armrecoveryservicesdatareplication.PrivateLinkServiceConnectionState{ + Status: to.Ptr(armrecoveryservicesdatareplication.PrivateEndpointConnectionStatusApproved), + Description: to.Ptr("y"), + ActionsRequired: to.Ptr("afwbq"), + }, + RemotePrivateEndpointConnection: &armrecoveryservicesdatareplication.RemotePrivateEndpointConnection{ + ID: to.Ptr("ocunsgawjsqohkrcyxiv"), + }, + GroupConnectivityInformation: []*armrecoveryservicesdatareplication.GroupConnectivityInformation{ + { + GroupID: to.Ptr("per"), + MemberName: to.Ptr("ybptuypgdqoxkuwqx"), + CustomerVisibleFqdns: []*string{ + to.Ptr("vedcg"), + }, + InternalFqdn: to.Ptr("maqavwhxwzzhbzjbryyquvitmup"), + RedirectMapID: to.Ptr("pezncxcq"), + PrivateLinkServiceArmRegion: to.Ptr("rerkqqxinteevmlbrdkktaqhcch"), + }, + }, + }, + }, + ConnectionDetails: []*armrecoveryservicesdatareplication.ConnectionDetails{ + { + ID: to.Ptr("lenqkogzkes"), + PrivateIPAddress: to.Ptr("cyiacdzzyqmxjpijjbwgasegehtqe"), + LinkIdentifier: to.Ptr("ravfufhkdowufd"), + GroupID: to.Ptr("pjrlygpadir"), + MemberName: to.Ptr("ybuysjrlfupewxe"), + }, + }, + }, + }, + }, 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 = armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientValidateResponse{ + // PrivateEndpointConnectionProxy: &armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/privateEndpointConnectionProxies/proxy1"), + // Name: to.Ptr("wrbeymbilwm"), + // Type: to.Ptr("xpfgxxykisvjcifsnlvtgjakwifak"), + // Etag: to.Ptr("hruibxrezstxroxrxweh"), + // Properties: &armrecoveryservicesdatareplication.PrivateEndpointConnectionProxyProperties{ + // RemotePrivateEndpoint: &armrecoveryservicesdatareplication.RemotePrivateEndpoint{ + // ID: to.Ptr("yipalno"), + // PrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + // { + // Name: to.Ptr("jqwntlzfsksl"), + // GroupIDs: []*string{ + // to.Ptr("hvejynjktikteipnioyeja"), + // }, + // RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + // }, + // }, + // ManualPrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + // { + // Name: to.Ptr("jqwntlzfsksl"), + // GroupIDs: []*string{ + // to.Ptr("hvejynjktikteipnioyeja"), + // }, + // RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + // }, + // }, + // PrivateLinkServiceProxies: []*armrecoveryservicesdatareplication.PrivateLinkServiceProxy{ + // { + // ID: to.Ptr("nzqxevuyqeedrqnkbnlcyrrrbzxvl"), + // RemotePrivateLinkServiceConnectionState: &armrecoveryservicesdatareplication.PrivateLinkServiceConnectionState{ + // Status: to.Ptr(armrecoveryservicesdatareplication.PrivateEndpointConnectionStatusApproved), + // Description: to.Ptr("y"), + // ActionsRequired: to.Ptr("afwbq"), + // }, + // RemotePrivateEndpointConnection: &armrecoveryservicesdatareplication.RemotePrivateEndpointConnection{ + // ID: to.Ptr("ocunsgawjsqohkrcyxiv"), + // }, + // GroupConnectivityInformation: []*armrecoveryservicesdatareplication.GroupConnectivityInformation{ + // { + // GroupID: to.Ptr("per"), + // MemberName: to.Ptr("ybptuypgdqoxkuwqx"), + // CustomerVisibleFqdns: []*string{ + // to.Ptr("vedcg"), + // }, + // InternalFqdn: to.Ptr("maqavwhxwzzhbzjbryyquvitmup"), + // RedirectMapID: to.Ptr("pezncxcq"), + // PrivateLinkServiceArmRegion: to.Ptr("rerkqqxinteevmlbrdkktaqhcch"), + // }, + // }, + // }, + // }, + // ConnectionDetails: []*armrecoveryservicesdatareplication.ConnectionDetails{ + // { + // ID: to.Ptr("lenqkogzkes"), + // PrivateIPAddress: to.Ptr("cyiacdzzyqmxjpijjbwgasegehtqe"), + // LinkIdentifier: to.Ptr("ravfufhkdowufd"), + // GroupID: to.Ptr("pjrlygpadir"), + // MemberName: to.Ptr("ybuysjrlfupewxe"), + // }, + // }, + // }, + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnections_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnections_client.go new file mode 100644 index 000000000000..b44c69c51bc8 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnections_client.go @@ -0,0 +1,331 @@ +// Copyright (c) Microsoft 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 armrecoveryservicesdatareplication + +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" +) + +// PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. +// Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. +type PrivateEndpointConnectionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateEndpointConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginDelete - Deletes the private endpoint connection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - privateEndpointConnectionName - The private endpoint connection name. +// - options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, vaultName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes the private endpoint connection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.BeginDelete" + 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, vaultName, privateEndpointConnectionName, 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.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, _ *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/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 vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + 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", "2024-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the private endpoint connection details. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - privateEndpointConnectionName - The private endpoint connection name. +// - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.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, vaultName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, _ *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/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 vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + 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", "2024-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetResponse, error) { + result := PrivateEndpointConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets the all private endpoint connections configured on the vault. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager +// method. +func (client *PrivateEndpointConnectionsClient) NewListPager(resourceGroupName string, vaultName string, options *PrivateEndpointConnectionsClientListOptions) *runtime.Pager[PrivateEndpointConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListResponse]{ + More: func(page PrivateEndpointConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListResponse) (PrivateEndpointConnectionsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateEndpointConnectionsClient.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, vaultName, options) + }, nil) + if err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *PrivateEndpointConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/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 vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + 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-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListResponse, error) { + result := PrivateEndpointConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + return result, nil +} + +// Update - Updated the private endpoint connection status (Approval/Rejected). This gets invoked by resource admin. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - privateEndpointConnectionName - The private endpoint connection name. +// - resource - Private endpoint connection update input. +// - options - PrivateEndpointConnectionsClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Update +// method. +func (client *PrivateEndpointConnectionsClient) Update(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, resource PrivateEndpointConnection, options *PrivateEndpointConnectionsClientUpdateOptions) (PrivateEndpointConnectionsClientUpdateResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.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, vaultName, privateEndpointConnectionName, resource, options) + if err != nil { + return PrivateEndpointConnectionsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, resource PrivateEndpointConnection, _ *PrivateEndpointConnectionsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/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 vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + 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", "2024-09-01") + 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 +} + +// updateHandleResponse handles the Update response. +func (client *PrivateEndpointConnectionsClient) updateHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientUpdateResponse, error) { + result := PrivateEndpointConnectionsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnections_client_example_test.go new file mode 100644 index 000000000000..6476142b1022 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnections_client_example_test.go @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" +) + +// Generated from example definition: 2024-09-01/PrivateEndpointConnection_Delete.json +func ExamplePrivateEndpointConnectionsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "rgswagger_2024-09-01", "4", "sdwqtfhigjirrzhpbmqtzgs", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: 2024-09-01/PrivateEndpointConnection_Get.json +func ExamplePrivateEndpointConnectionsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "rgswagger_2024-09-01", "4", "vbkm", 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 = armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientGetResponse{ + // PrivateEndpointConnection: &armrecoveryservicesdatareplication.PrivateEndpointConnection{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/privateEndpointConnections/connection1"), + // Name: to.Ptr("kadsmyhrosefybpbwvwxs"), + // Type: to.Ptr("ztysngp"), + // Properties: &armrecoveryservicesdatareplication.PrivateEndpointConnectionResponseProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // PrivateEndpoint: &armrecoveryservicesdatareplication.PrivateEndpoint{ + // ID: to.Ptr("cwcdqoynostmqwdwy"), + // }, + // PrivateLinkServiceConnectionState: &armrecoveryservicesdatareplication.PrivateLinkServiceConnectionState{ + // Status: to.Ptr(armrecoveryservicesdatareplication.PrivateEndpointConnectionStatusApproved), + // Description: to.Ptr("y"), + // ActionsRequired: to.Ptr("afwbq"), + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/PrivateEndpointConnection_List.json +func ExamplePrivateEndpointConnectionsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListPager("rgswagger_2024-09-01", "4", 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 = armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientListResponse{ + // PrivateEndpointConnectionListResult: armrecoveryservicesdatareplication.PrivateEndpointConnectionListResult{ + // Value: []*armrecoveryservicesdatareplication.PrivateEndpointConnection{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/privateEndpointConnections/connection1"), + // Name: to.Ptr("kadsmyhrosefybpbwvwxs"), + // Type: to.Ptr("ztysngp"), + // Properties: &armrecoveryservicesdatareplication.PrivateEndpointConnectionResponseProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // PrivateEndpoint: &armrecoveryservicesdatareplication.PrivateEndpoint{ + // ID: to.Ptr("cwcdqoynostmqwdwy"), + // }, + // PrivateLinkServiceConnectionState: &armrecoveryservicesdatareplication.PrivateLinkServiceConnectionState{ + // Status: to.Ptr(armrecoveryservicesdatareplication.PrivateEndpointConnectionStatusApproved), + // Description: to.Ptr("y"), + // ActionsRequired: to.Ptr("afwbq"), + // }, + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-09-01/PrivateEndpointConnection_Update.json +func ExamplePrivateEndpointConnectionsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateEndpointConnectionsClient().Update(ctx, "rgswagger_2024-09-01", "4", "jitf", armrecoveryservicesdatareplication.PrivateEndpointConnection{ + Properties: &armrecoveryservicesdatareplication.PrivateEndpointConnectionResponseProperties{ + PrivateEndpoint: &armrecoveryservicesdatareplication.PrivateEndpoint{ + ID: to.Ptr("cwcdqoynostmqwdwy"), + }, + PrivateLinkServiceConnectionState: &armrecoveryservicesdatareplication.PrivateLinkServiceConnectionState{ + Status: to.Ptr(armrecoveryservicesdatareplication.PrivateEndpointConnectionStatusApproved), + Description: to.Ptr("y"), + ActionsRequired: to.Ptr("afwbq"), + }, + }, + }, 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 = armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientUpdateResponse{ + // PrivateEndpointConnection: &armrecoveryservicesdatareplication.PrivateEndpointConnection{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/privateEndpointConnections/connection1"), + // Name: to.Ptr("kadsmyhrosefybpbwvwxs"), + // Type: to.Ptr("ztysngp"), + // Properties: &armrecoveryservicesdatareplication.PrivateEndpointConnectionResponseProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // PrivateEndpoint: &armrecoveryservicesdatareplication.PrivateEndpoint{ + // ID: to.Ptr("cwcdqoynostmqwdwy"), + // }, + // PrivateLinkServiceConnectionState: &armrecoveryservicesdatareplication.PrivateLinkServiceConnectionState{ + // Status: to.Ptr(armrecoveryservicesdatareplication.PrivateEndpointConnectionStatusApproved), + // Description: to.Ptr("y"), + // ActionsRequired: to.Ptr("afwbq"), + // }, + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privatelinkresources_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privatelinkresources_client.go new file mode 100644 index 000000000000..6e52774d0e69 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privatelinkresources_client.go @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft 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 armrecoveryservicesdatareplication + +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" +) + +// PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. +// Don't use this type directly, use NewPrivateLinkResourcesClient() instead. +type PrivateLinkResourcesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient 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 NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateLinkResourcesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets the details of site recovery private link resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - privateLinkResourceName - The private link name. +// - options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get +// method. +func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, vaultName string, privateLinkResourceName string, options *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error) { + var err error + const operationName = "PrivateLinkResourcesClient.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, vaultName, privateLinkResourceName, options) + if err != nil { + return PrivateLinkResourcesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateLinkResourcesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkResourcesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateLinkResourceName string, _ *PrivateLinkResourcesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/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 vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + 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", "2024-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesClientGetResponse, error) { + result := PrivateLinkResourcesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { + return PrivateLinkResourcesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets the list of private link resources. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListPager +// method. +func (client *PrivateLinkResourcesClient) NewListPager(resourceGroupName string, vaultName string, options *PrivateLinkResourcesClientListOptions) *runtime.Pager[PrivateLinkResourcesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateLinkResourcesClientListResponse]{ + More: func(page PrivateLinkResourcesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateLinkResourcesClientListResponse) (PrivateLinkResourcesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateLinkResourcesClient.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, vaultName, options) + }, nil) + if err != nil { + return PrivateLinkResourcesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *PrivateLinkResourcesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/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 vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + 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-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (PrivateLinkResourcesClientListResponse, error) { + result := PrivateLinkResourcesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { + return PrivateLinkResourcesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privatelinkresources_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privatelinkresources_client_example_test.go new file mode 100644 index 000000000000..b57b6e03d439 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privatelinkresources_client_example_test.go @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armrecoveryservicesdatareplication_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" +) + +// Generated from example definition: 2024-09-01/PrivateLinkResource_Get.json +func ExamplePrivateLinkResourcesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateLinkResourcesClient().Get(ctx, "rgswagger_2024-09-01", "4", "d", 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 = armrecoveryservicesdatareplication.PrivateLinkResourcesClientGetResponse{ + // PrivateLinkResource: &armrecoveryservicesdatareplication.PrivateLinkResource{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/privateLinkResources/link1"), + // Name: to.Ptr("u"), + // Type: to.Ptr("ydabrhxuyafq"), + // Properties: &armrecoveryservicesdatareplication.PrivateLinkResourceProperties{ + // GroupID: to.Ptr("dzkqscbkzs"), + // RequiredMembers: []*string{ + // to.Ptr("irjjsneakjewcsigcocfdjvfad"), + // }, + // RequiredZoneNames: []*string{ + // to.Ptr("yp"), + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/PrivateLinkResource_List.json +func ExamplePrivateLinkResourcesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPrivateLinkResourcesClient().NewListPager("rgswagger_2024-09-01", "4", 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 = armrecoveryservicesdatareplication.PrivateLinkResourcesClientListResponse{ + // PrivateLinkResourceListResult: armrecoveryservicesdatareplication.PrivateLinkResourceListResult{ + // Value: []*armrecoveryservicesdatareplication.PrivateLinkResource{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/privateLinkResources/link1"), + // Name: to.Ptr("u"), + // Type: to.Ptr("ydabrhxuyafq"), + // Properties: &armrecoveryservicesdatareplication.PrivateLinkResourceProperties{ + // GroupID: to.Ptr("dzkqscbkzs"), + // RequiredMembers: []*string{ + // to.Ptr("irjjsneakjewcsigcocfdjvfad"), + // }, + // RequiredZoneNames: []*string{ + // to.Ptr("yp"), + // }, + // }, + // }, + // }, + // }, + // } + } +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_client.go index 0d7def263234..05b4c256a77a 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_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 armrecoveryservicesdatareplication @@ -47,22 +43,21 @@ func NewProtectedItemClient(subscriptionID string, credential azcore.TokenCreden // BeginCreate - Creates the protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - protectedItemName - The protected item name. -// - body - Protected item model. +// - resource - Protected item model. // - options - ProtectedItemClientBeginCreateOptions contains the optional parameters for the ProtectedItemClient.BeginCreate // method. -func (client *ProtectedItemClient) BeginCreate(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body ProtectedItemModel, options *ProtectedItemClientBeginCreateOptions) (*runtime.Poller[ProtectedItemClientCreateResponse], error) { +func (client *ProtectedItemClient) BeginCreate(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, resource ProtectedItemModel, options *ProtectedItemClientBeginCreateOptions) (*runtime.Poller[ProtectedItemClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, vaultName, protectedItemName, body, options) + resp, err := client.create(ctx, resourceGroupName, vaultName, protectedItemName, resource, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProtectedItemClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -75,14 +70,14 @@ func (client *ProtectedItemClient) BeginCreate(ctx context.Context, resourceGrou // Create - Creates the protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *ProtectedItemClient) create(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body ProtectedItemModel, options *ProtectedItemClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *ProtectedItemClient) create(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, resource ProtectedItemModel, options *ProtectedItemClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ProtectedItemClient.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, vaultName, protectedItemName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, vaultName, protectedItemName, resource, options) if err != nil { return nil, err } @@ -98,7 +93,7 @@ func (client *ProtectedItemClient) create(ctx context.Context, resourceGroupName } // createCreateRequest creates the Create request. -func (client *ProtectedItemClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body ProtectedItemModel, options *ProtectedItemClientBeginCreateOptions) (*policy.Request, error) { +func (client *ProtectedItemClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, resource ProtectedItemModel, _ *ProtectedItemClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -121,10 +116,11 @@ func (client *ProtectedItemClient) createCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil @@ -133,7 +129,7 @@ func (client *ProtectedItemClient) createCreateRequest(ctx context.Context, reso // BeginDelete - Removes the protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - protectedItemName - The protected item name. @@ -146,8 +142,7 @@ func (client *ProtectedItemClient) BeginDelete(ctx context.Context, resourceGrou return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProtectedItemClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -160,7 +155,7 @@ func (client *ProtectedItemClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Removes the protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *ProtectedItemClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *ProtectedItemClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ProtectedItemClient.BeginDelete" @@ -206,10 +201,10 @@ func (client *ProtectedItemClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01") if options != nil && options.ForceDelete != nil { reqQP.Set("forceDelete", strconv.FormatBool(*options.ForceDelete)) } - reqQP.Set("api-version", "2021-02-16-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -218,7 +213,7 @@ func (client *ProtectedItemClient) deleteCreateRequest(ctx context.Context, reso // Get - Gets the details of the protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - protectedItemName - The protected item name. @@ -246,7 +241,7 @@ func (client *ProtectedItemClient) Get(ctx context.Context, resourceGroupName st } // getCreateRequest creates the Get request. -func (client *ProtectedItemClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *ProtectedItemClientGetOptions) (*policy.Request, error) { +func (client *ProtectedItemClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, _ *ProtectedItemClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -269,7 +264,7 @@ func (client *ProtectedItemClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -286,7 +281,7 @@ func (client *ProtectedItemClient) getHandleResponse(resp *http.Response) (Prote // NewListPager - Gets the list of protected items in the given vault. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - options - ProtectedItemClientListOptions contains the optional parameters for the ProtectedItemClient.NewListPager method. @@ -333,7 +328,16 @@ func (client *ProtectedItemClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") + if options != nil && options.ContinuationToken != nil { + reqQP.Set("continuationToken", *options.ContinuationToken) + } + if options != nil && options.OdataOptions != nil { + reqQP.Set("odataOptions", *options.OdataOptions) + } + if options != nil && options.PageSize != nil { + reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -342,7 +346,7 @@ func (client *ProtectedItemClient) listCreateRequest(ctx context.Context, resour // listHandleResponse handles the List response. func (client *ProtectedItemClient) listHandleResponse(resp *http.Response) (ProtectedItemClientListResponse, error) { result := ProtectedItemClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProtectedItemModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ProtectedItemModelListResult); err != nil { return ProtectedItemClientListResponse{}, err } return result, nil @@ -351,21 +355,21 @@ func (client *ProtectedItemClient) listHandleResponse(resp *http.Response) (Prot // BeginPlannedFailover - Performs the planned failover on the protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - protectedItemName - The protected item name. +// - body - Planned failover model. // - options - ProtectedItemClientBeginPlannedFailoverOptions contains the optional parameters for the ProtectedItemClient.BeginPlannedFailover // method. -func (client *ProtectedItemClient) BeginPlannedFailover(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *ProtectedItemClientBeginPlannedFailoverOptions) (*runtime.Poller[ProtectedItemClientPlannedFailoverResponse], error) { +func (client *ProtectedItemClient) BeginPlannedFailover(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body PlannedFailoverModel, options *ProtectedItemClientBeginPlannedFailoverOptions) (*runtime.Poller[ProtectedItemClientPlannedFailoverResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.plannedFailover(ctx, resourceGroupName, vaultName, protectedItemName, options) + resp, err := client.plannedFailover(ctx, resourceGroupName, vaultName, protectedItemName, body, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProtectedItemClientPlannedFailoverResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -378,14 +382,14 @@ func (client *ProtectedItemClient) BeginPlannedFailover(ctx context.Context, res // PlannedFailover - Performs the planned failover on the protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *ProtectedItemClient) plannedFailover(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *ProtectedItemClientBeginPlannedFailoverOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *ProtectedItemClient) plannedFailover(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body PlannedFailoverModel, options *ProtectedItemClientBeginPlannedFailoverOptions) (*http.Response, error) { var err error const operationName = "ProtectedItemClient.BeginPlannedFailover" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.plannedFailoverCreateRequest(ctx, resourceGroupName, vaultName, protectedItemName, options) + req, err := client.plannedFailoverCreateRequest(ctx, resourceGroupName, vaultName, protectedItemName, body, options) if err != nil { return nil, err } @@ -401,7 +405,7 @@ func (client *ProtectedItemClient) plannedFailover(ctx context.Context, resource } // plannedFailoverCreateRequest creates the PlannedFailover request. -func (client *ProtectedItemClient) plannedFailoverCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *ProtectedItemClientBeginPlannedFailoverOptions) (*policy.Request, error) { +func (client *ProtectedItemClient) plannedFailoverCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body PlannedFailoverModel, _ *ProtectedItemClientBeginPlannedFailoverOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/plannedFailover" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -424,14 +428,98 @@ func (client *ProtectedItemClient) plannedFailoverCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginUpdate - Performs update on the protected item. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - protectedItemName - The protected item name. +// - properties - Protected item model. +// - options - ProtectedItemClientBeginUpdateOptions contains the optional parameters for the ProtectedItemClient.BeginUpdate +// method. +func (client *ProtectedItemClient) BeginUpdate(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, properties ProtectedItemModelUpdate, options *ProtectedItemClientBeginUpdateOptions) (*runtime.Poller[ProtectedItemClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, vaultName, protectedItemName, properties, options) + if err != nil { return nil, err } - return req, nil + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProtectedItemClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProtectedItemClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Performs update on the protected item. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +func (client *ProtectedItemClient) update(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, properties ProtectedItemModelUpdate, options *ProtectedItemClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ProtectedItemClient.BeginUpdate" + 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, vaultName, protectedItemName, properties, 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 +} + +// updateCreateRequest creates the Update request. +func (client *ProtectedItemClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, properties ProtectedItemModelUpdate, _ *ProtectedItemClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" + 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 vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if protectedItemName == "" { + return nil, errors.New("parameter protectedItemName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{protectedItemName}", url.PathEscape(protectedItemName)) + 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", "2024-09-01") + 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, properties); err != nil { + return nil, err } return req, nil } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_client_example_test.go index defd9c3f155f..b3562356f372 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_client_example_test.go @@ -1,322 +1,320 @@ -//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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_Get.json -func ExampleProtectedItemClient_Get() { +// Generated from example definition: 2024-09-01/ProtectedItem_Create.json +func ExampleProtectedItemClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewProtectedItemClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "d", nil) + poller, err := clientFactory.NewProtectedItemClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "4", "d", armrecoveryservicesdatareplication.ProtectedItemModel{ + Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ + PolicyName: to.Ptr("tjoeiynplt"), + ReplicationExtensionName: to.Ptr("jwxdo"), + }, + }, 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.ProtectedItemModel = armrecoveryservicesdatareplication.ProtectedItemModel{ - // Name: to.Ptr("t"), - // Type: to.Ptr("xlyjashandpfwivuipoplgkgsnwoh"), - // ID: to.Ptr("egmhsfbgkarlobrgybkz"), - // Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ - // AllowedJobs: []*string{ - // to.Ptr("guryeoocjbvqvalfkrxecpxwynpxs")}, + // res = armrecoveryservicesdatareplication.ProtectedItemClientCreateResponse{ + // ProtectedItemModel: &armrecoveryservicesdatareplication.ProtectedItemModel{ + // Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ + // PolicyName: to.Ptr("tjoeiynplt"), + // ReplicationExtensionName: to.Ptr("jwxdo"), // CorrelationID: to.Ptr("mvxvtcqwgp"), - // CurrentJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesCurrentJob{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ProtectionState: to.Ptr(armrecoveryservicesdatareplication.ProtectionStateUnprotectedStatesBegin), + // ProtectionStateDescription: to.Ptr("lp"), + // TestFailoverState: to.Ptr(armrecoveryservicesdatareplication.TestFailoverStateNone), + // TestFailoverStateDescription: to.Ptr("msjz"), + // ResynchronizationState: to.Ptr(armrecoveryservicesdatareplication.ResynchronizationStateNone), + // FabricObjectID: to.Ptr("kjcizdpahzqsrwyiywbhyzdxsufj"), + // FabricObjectName: to.Ptr("glrjwtvmejxuagjepcwaxhih"), + // SourceFabricProviderID: to.Ptr("srggkxaruzlegtpdalscio"), + // TargetFabricProviderID: to.Ptr("sutiqezfbeiewwjezflvcitqj"), + // FabricID: to.Ptr("ebsxoblmhlhqjzzjzdwo"), + // TargetFabricID: to.Ptr("fb"), + // FabricAgentID: to.Ptr("vxrmsufvxothxauhvqdowascmy"), + // TargetFabricAgentID: to.Ptr("oscnhreunbyibimlpvsesu"), + // ResyncRequired: to.Ptr(true), + // LastSuccessfulPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastSuccessfulUnplannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // CurrentJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("ljbnhbdmreowdqnlcqycvaramwuii"), + // ID: to.Ptr("bnmbzxzyfgwh"), // Name: to.Ptr("kqtvbrfmqaxdgpttkbmzpwafjp"), // DisplayName: to.Ptr("awutlqrisstqb"), + // State: to.Ptr("ztlpngveoqcdejpwaiudhrioskauqv"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("bnmbzxzyfgwh"), - // ScenarioName: to.Ptr("ljbnhbdmreowdqnlcqycvaramwuii"), + // }, + // AllowedJobs: []*string{ + // to.Ptr("guryeoocjbvqvalfkrxecpxwynpxs"), + // }, + // LastFailedEnableProtectionJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("fhz"), + // ID: to.Ptr("hjzgyxgdy"), + // Name: to.Ptr("hvvolptulpcxwbnjdzky"), + // DisplayName: to.Ptr("zrqjbcozwiuypjjnvy"), + // State: to.Ptr("ljsixxmmcaq"), // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("ztlpngveoqcdejpwaiudhrioskauqv"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), // }, - // CustomProperties: &armrecoveryservicesdatareplication.ProtectedItemModelCustomProperties{ - // InstanceType: to.Ptr("ProtectedItemModelCustomProperties"), + // LastFailedPlannedFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("ceksuyfiplxj"), + // ID: to.Ptr("ndjurplurnkguwfxx"), + // Name: to.Ptr("ofblltxwhwzhyr"), + // DisplayName: to.Ptr("whxsvbrzdhqsepbocfzsfx"), + // State: to.Ptr("wpur"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), // }, - // DraID: to.Ptr("vxrmsufvxothxauhvqdowascmy"), - // FabricID: to.Ptr("ebsxoblmhlhqjzzjzdwo"), - // FabricObjectID: to.Ptr("kjcizdpahzqsrwyiywbhyzdxsufj"), - // FabricObjectName: to.Ptr("glrjwtvmejxuagjepcwaxhih"), + // LastTestFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("dfuovvz"), + // ID: to.Ptr("cta"), + // Name: to.Ptr("cedjijdtnznsnigghrxnsaz"), + // DisplayName: to.Ptr("lhkjfbonwdtxckwzfebfwdyu"), + // State: to.Ptr("nhbzw"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // }, + // ReplicationHealth: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ // { + // AffectedResourceType: to.Ptr("scfniv"), // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, - // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), - // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ - // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), - // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), - // Severity: to.Ptr("wqxxiuaqjyagq"), - // Source: to.Ptr("wevvftugwydzzw"), - // Summary: to.Ptr("djsmgrltruljo"), - // }}, - // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), - // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), - // Source: to.Ptr("iy"), - // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // LastFailedEnableProtectionJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastFailedEnableProtectionJob{ - // Name: to.Ptr("hvvolptulpcxwbnjdzky"), - // DisplayName: to.Ptr("zrqjbcozwiuypjjnvy"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("hjzgyxgdy"), - // ScenarioName: to.Ptr("fhz"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("ljsixxmmcaq"), - // }, - // LastFailedPlannedFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastFailedPlannedFailoverJob{ - // Name: to.Ptr("ofblltxwhwzhyr"), - // DisplayName: to.Ptr("whxsvbrzdhqsepbocfzsfx"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("ndjurplurnkguwfxx"), - // ScenarioName: to.Ptr("ceksuyfiplxj"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("wpur"), - // }, - // LastSuccessfulPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastSuccessfulUnplannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastTestFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastTestFailoverJob{ - // Name: to.Ptr("cedjijdtnznsnigghrxnsaz"), - // DisplayName: to.Ptr("lhkjfbonwdtxckwzfebfwdyu"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("cta"), - // ScenarioName: to.Ptr("dfuovvz"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("nhbzw"), + // to.Ptr("fope"), + // }, + // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ + // { + // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), + // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), + // Category: to.Ptr("lcsdxrqxquke"), + // Severity: to.Ptr("wqxxiuaqjyagq"), + // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), + // Summary: to.Ptr("djsmgrltruljo"), + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, + // Code: to.Ptr("dgxkefzmeukd"), + // HealthCategory: to.Ptr("itc"), + // Category: to.Ptr("leigw"), + // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), + // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), + // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), // }, - // PolicyName: to.Ptr("tjoeiynplt"), - // ProtectionState: to.Ptr(armrecoveryservicesdatareplication.ProtectionStateUnprotectedStatesBegin), - // ProtectionStateDescription: to.Ptr("lp"), - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ReplicationExtensionName: to.Ptr("jwxdo"), - // ReplicationHealth: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // ResyncRequired: to.Ptr(true), - // ResynchronizationState: to.Ptr(armrecoveryservicesdatareplication.ResynchronizationStateNone), - // SourceFabricProviderID: to.Ptr("srggkxaruzlegtpdalscio"), - // TargetDraID: to.Ptr("oscnhreunbyibimlpvsesu"), - // TargetFabricID: to.Ptr("fb"), - // TargetFabricProviderID: to.Ptr("sutiqezfbeiewwjezflvcitqj"), - // TestFailoverState: to.Ptr(armrecoveryservicesdatareplication.TestFailoverStateNone), - // TestFailoverStateDescription: to.Ptr("msjz"), // }, - // SystemData: &armrecoveryservicesdatareplication.ProtectedItemModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // CreatedBy: to.Ptr("ghut"), - // CreatedByType: to.Ptr("tzczp"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastModifiedBy: to.Ptr("epo"), - // LastModifiedByType: to.Ptr("ekzmwexhjttb"), - // }, - // } + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/protectedItems/item1"), + // Name: to.Ptr("t"), + // Type: to.Ptr("xlyjashandpfwivuipoplgkgsnwoh"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("ghut"), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("tzczp")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastModifiedBy: to.Ptr("epo"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("ekzmwexhjttb")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_Create.json -func ExampleProtectedItemClient_BeginCreate() { +// Generated from example definition: 2024-09-01/ProtectedItem_Delete.json +func ExampleProtectedItemClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewProtectedItemClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "4", "d", armrecoveryservicesdatareplication.ProtectedItemModel{ - Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ - CustomProperties: &armrecoveryservicesdatareplication.ProtectedItemModelCustomProperties{ - InstanceType: to.Ptr("ProtectedItemModelCustomProperties"), - }, - PolicyName: to.Ptr("tjoeiynplt"), - ReplicationExtensionName: to.Ptr("jwxdo"), - }, - }, nil) + poller, err := clientFactory.NewProtectedItemClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "4", "d", &ProtectedItemClientBeginDeleteOptions{ + forceDelete: to.Ptr(true)}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) + _, err = poller.PollUntilDone(ctx, nil) if err != nil { log.Fatalf("failed to pull the result: %v", err) } +} + +// Generated from example definition: 2024-09-01/ProtectedItem_Get.json +func ExampleProtectedItemClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewProtectedItemClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "d", 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.ProtectedItemModel = armrecoveryservicesdatareplication.ProtectedItemModel{ - // Name: to.Ptr("t"), - // Type: to.Ptr("xlyjashandpfwivuipoplgkgsnwoh"), - // ID: to.Ptr("egmhsfbgkarlobrgybkz"), - // Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ - // AllowedJobs: []*string{ - // to.Ptr("guryeoocjbvqvalfkrxecpxwynpxs")}, + // res = armrecoveryservicesdatareplication.ProtectedItemClientGetResponse{ + // ProtectedItemModel: &armrecoveryservicesdatareplication.ProtectedItemModel{ + // Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ + // PolicyName: to.Ptr("tjoeiynplt"), + // ReplicationExtensionName: to.Ptr("jwxdo"), // CorrelationID: to.Ptr("mvxvtcqwgp"), - // CurrentJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesCurrentJob{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ProtectionState: to.Ptr(armrecoveryservicesdatareplication.ProtectionStateUnprotectedStatesBegin), + // ProtectionStateDescription: to.Ptr("lp"), + // TestFailoverState: to.Ptr(armrecoveryservicesdatareplication.TestFailoverStateNone), + // TestFailoverStateDescription: to.Ptr("msjz"), + // ResynchronizationState: to.Ptr(armrecoveryservicesdatareplication.ResynchronizationStateNone), + // FabricObjectID: to.Ptr("kjcizdpahzqsrwyiywbhyzdxsufj"), + // FabricObjectName: to.Ptr("glrjwtvmejxuagjepcwaxhih"), + // SourceFabricProviderID: to.Ptr("srggkxaruzlegtpdalscio"), + // TargetFabricProviderID: to.Ptr("sutiqezfbeiewwjezflvcitqj"), + // FabricID: to.Ptr("ebsxoblmhlhqjzzjzdwo"), + // TargetFabricID: to.Ptr("fb"), + // FabricAgentID: to.Ptr("vxrmsufvxothxauhvqdowascmy"), + // TargetFabricAgentID: to.Ptr("oscnhreunbyibimlpvsesu"), + // ResyncRequired: to.Ptr(true), + // LastSuccessfulPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastSuccessfulUnplannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // CurrentJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("ljbnhbdmreowdqnlcqycvaramwuii"), + // ID: to.Ptr("bnmbzxzyfgwh"), // Name: to.Ptr("kqtvbrfmqaxdgpttkbmzpwafjp"), // DisplayName: to.Ptr("awutlqrisstqb"), + // State: to.Ptr("ztlpngveoqcdejpwaiudhrioskauqv"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("bnmbzxzyfgwh"), - // ScenarioName: to.Ptr("ljbnhbdmreowdqnlcqycvaramwuii"), + // }, + // AllowedJobs: []*string{ + // to.Ptr("guryeoocjbvqvalfkrxecpxwynpxs"), + // }, + // LastFailedEnableProtectionJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("fhz"), + // ID: to.Ptr("hjzgyxgdy"), + // Name: to.Ptr("hvvolptulpcxwbnjdzky"), + // DisplayName: to.Ptr("zrqjbcozwiuypjjnvy"), + // State: to.Ptr("ljsixxmmcaq"), // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("ztlpngveoqcdejpwaiudhrioskauqv"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // }, + // LastFailedPlannedFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("ceksuyfiplxj"), + // ID: to.Ptr("ndjurplurnkguwfxx"), + // Name: to.Ptr("ofblltxwhwzhyr"), + // DisplayName: to.Ptr("whxsvbrzdhqsepbocfzsfx"), + // State: to.Ptr("wpur"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), // }, - // CustomProperties: &armrecoveryservicesdatareplication.ProtectedItemModelCustomProperties{ - // InstanceType: to.Ptr("ProtectedItemModelCustomProperties"), + // LastTestFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("dfuovvz"), + // ID: to.Ptr("cta"), + // Name: to.Ptr("cedjijdtnznsnigghrxnsaz"), + // DisplayName: to.Ptr("lhkjfbonwdtxckwzfebfwdyu"), + // State: to.Ptr("nhbzw"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), // }, - // DraID: to.Ptr("vxrmsufvxothxauhvqdowascmy"), - // FabricID: to.Ptr("ebsxoblmhlhqjzzjzdwo"), - // FabricObjectID: to.Ptr("kjcizdpahzqsrwyiywbhyzdxsufj"), - // FabricObjectName: to.Ptr("glrjwtvmejxuagjepcwaxhih"), + // ReplicationHealth: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ // { + // AffectedResourceType: to.Ptr("scfniv"), // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, - // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), - // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ - // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), - // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), - // Severity: to.Ptr("wqxxiuaqjyagq"), - // Source: to.Ptr("wevvftugwydzzw"), - // Summary: to.Ptr("djsmgrltruljo"), - // }}, - // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), - // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), - // Source: to.Ptr("iy"), - // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // LastFailedEnableProtectionJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastFailedEnableProtectionJob{ - // Name: to.Ptr("hvvolptulpcxwbnjdzky"), - // DisplayName: to.Ptr("zrqjbcozwiuypjjnvy"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("hjzgyxgdy"), - // ScenarioName: to.Ptr("fhz"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("ljsixxmmcaq"), + // to.Ptr("fope"), + // }, + // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ + // { + // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), + // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), + // Category: to.Ptr("lcsdxrqxquke"), + // Severity: to.Ptr("wqxxiuaqjyagq"), + // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), + // Summary: to.Ptr("djsmgrltruljo"), + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, + // Code: to.Ptr("dgxkefzmeukd"), + // HealthCategory: to.Ptr("itc"), + // Category: to.Ptr("leigw"), + // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), + // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), + // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), // }, - // LastFailedPlannedFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastFailedPlannedFailoverJob{ - // Name: to.Ptr("ofblltxwhwzhyr"), - // DisplayName: to.Ptr("whxsvbrzdhqsepbocfzsfx"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("ndjurplurnkguwfxx"), - // ScenarioName: to.Ptr("ceksuyfiplxj"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("wpur"), - // }, - // LastSuccessfulPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastSuccessfulUnplannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastTestFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastTestFailoverJob{ - // Name: to.Ptr("cedjijdtnznsnigghrxnsaz"), - // DisplayName: to.Ptr("lhkjfbonwdtxckwzfebfwdyu"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("cta"), - // ScenarioName: to.Ptr("dfuovvz"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("nhbzw"), - // }, - // PolicyName: to.Ptr("tjoeiynplt"), - // ProtectionState: to.Ptr(armrecoveryservicesdatareplication.ProtectionStateUnprotectedStatesBegin), - // ProtectionStateDescription: to.Ptr("lp"), - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ReplicationExtensionName: to.Ptr("jwxdo"), - // ReplicationHealth: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // ResyncRequired: to.Ptr(true), - // ResynchronizationState: to.Ptr(armrecoveryservicesdatareplication.ResynchronizationStateNone), - // SourceFabricProviderID: to.Ptr("srggkxaruzlegtpdalscio"), - // TargetDraID: to.Ptr("oscnhreunbyibimlpvsesu"), - // TargetFabricID: to.Ptr("fb"), - // TargetFabricProviderID: to.Ptr("sutiqezfbeiewwjezflvcitqj"), - // TestFailoverState: to.Ptr(armrecoveryservicesdatareplication.TestFailoverStateNone), - // TestFailoverStateDescription: to.Ptr("msjz"), - // }, - // SystemData: &armrecoveryservicesdatareplication.ProtectedItemModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // CreatedBy: to.Ptr("ghut"), - // CreatedByType: to.Ptr("tzczp"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastModifiedBy: to.Ptr("epo"), - // LastModifiedByType: to.Ptr("ekzmwexhjttb"), // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_Delete.json -func ExampleProtectedItemClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProtectedItemClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "4", "d", &armrecoveryservicesdatareplication.ProtectedItemClientBeginDeleteOptions{ForceDelete: to.Ptr(true)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/protectedItems/item1"), + // Name: to.Ptr("t"), + // Type: to.Ptr("xlyjashandpfwivuipoplgkgsnwoh"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("ghut"), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("tzczp")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastModifiedBy: to.Ptr("epo"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("ekzmwexhjttb")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_List.json +// Generated from example definition: 2024-09-01/ProtectedItem_List.json func ExampleProtectedItemClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -331,140 +329,139 @@ func ExampleProtectedItemClient_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.ProtectedItemModelCollection = armrecoveryservicesdatareplication.ProtectedItemModelCollection{ - // Value: []*armrecoveryservicesdatareplication.ProtectedItemModel{ - // { - // Name: to.Ptr("t"), - // Type: to.Ptr("xlyjashandpfwivuipoplgkgsnwoh"), - // ID: to.Ptr("egmhsfbgkarlobrgybkz"), - // Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ - // AllowedJobs: []*string{ - // to.Ptr("guryeoocjbvqvalfkrxecpxwynpxs")}, + // page = armrecoveryservicesdatareplication.ProtectedItemClientListResponse{ + // ProtectedItemModelListResult: armrecoveryservicesdatareplication.ProtectedItemModelListResult{ + // Value: []*armrecoveryservicesdatareplication.ProtectedItemModel{ + // { + // Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ + // PolicyName: to.Ptr("tjoeiynplt"), + // ReplicationExtensionName: to.Ptr("jwxdo"), // CorrelationID: to.Ptr("mvxvtcqwgp"), - // CurrentJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesCurrentJob{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ProtectionState: to.Ptr(armrecoveryservicesdatareplication.ProtectionStateUnprotectedStatesBegin), + // ProtectionStateDescription: to.Ptr("lp"), + // TestFailoverState: to.Ptr(armrecoveryservicesdatareplication.TestFailoverStateNone), + // TestFailoverStateDescription: to.Ptr("msjz"), + // ResynchronizationState: to.Ptr(armrecoveryservicesdatareplication.ResynchronizationStateNone), + // FabricObjectID: to.Ptr("kjcizdpahzqsrwyiywbhyzdxsufj"), + // FabricObjectName: to.Ptr("glrjwtvmejxuagjepcwaxhih"), + // SourceFabricProviderID: to.Ptr("srggkxaruzlegtpdalscio"), + // TargetFabricProviderID: to.Ptr("sutiqezfbeiewwjezflvcitqj"), + // FabricID: to.Ptr("ebsxoblmhlhqjzzjzdwo"), + // TargetFabricID: to.Ptr("fb"), + // FabricAgentID: to.Ptr("vxrmsufvxothxauhvqdowascmy"), + // TargetFabricAgentID: to.Ptr("oscnhreunbyibimlpvsesu"), + // ResyncRequired: to.Ptr(true), + // LastSuccessfulPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastSuccessfulUnplannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // CurrentJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("ljbnhbdmreowdqnlcqycvaramwuii"), + // ID: to.Ptr("bnmbzxzyfgwh"), // Name: to.Ptr("kqtvbrfmqaxdgpttkbmzpwafjp"), // DisplayName: to.Ptr("awutlqrisstqb"), + // State: to.Ptr("ztlpngveoqcdejpwaiudhrioskauqv"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("bnmbzxzyfgwh"), - // ScenarioName: to.Ptr("ljbnhbdmreowdqnlcqycvaramwuii"), + // }, + // AllowedJobs: []*string{ + // to.Ptr("guryeoocjbvqvalfkrxecpxwynpxs"), + // }, + // LastFailedEnableProtectionJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("fhz"), + // ID: to.Ptr("hjzgyxgdy"), + // Name: to.Ptr("hvvolptulpcxwbnjdzky"), + // DisplayName: to.Ptr("zrqjbcozwiuypjjnvy"), + // State: to.Ptr("ljsixxmmcaq"), // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("ztlpngveoqcdejpwaiudhrioskauqv"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), // }, - // CustomProperties: &armrecoveryservicesdatareplication.ProtectedItemModelCustomProperties{ - // InstanceType: to.Ptr("ProtectedItemModelCustomProperties"), + // LastFailedPlannedFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("ceksuyfiplxj"), + // ID: to.Ptr("ndjurplurnkguwfxx"), + // Name: to.Ptr("ofblltxwhwzhyr"), + // DisplayName: to.Ptr("whxsvbrzdhqsepbocfzsfx"), + // State: to.Ptr("wpur"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), // }, - // DraID: to.Ptr("vxrmsufvxothxauhvqdowascmy"), - // FabricID: to.Ptr("ebsxoblmhlhqjzzjzdwo"), - // FabricObjectID: to.Ptr("kjcizdpahzqsrwyiywbhyzdxsufj"), - // FabricObjectName: to.Ptr("glrjwtvmejxuagjepcwaxhih"), + // LastTestFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("dfuovvz"), + // ID: to.Ptr("cta"), + // Name: to.Ptr("cedjijdtnznsnigghrxnsaz"), + // DisplayName: to.Ptr("lhkjfbonwdtxckwzfebfwdyu"), + // State: to.Ptr("nhbzw"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // }, + // ReplicationHealth: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ // { + // AffectedResourceType: to.Ptr("scfniv"), // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, - // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), - // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ - // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), - // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), - // Severity: to.Ptr("wqxxiuaqjyagq"), - // Source: to.Ptr("wevvftugwydzzw"), - // Summary: to.Ptr("djsmgrltruljo"), - // }}, - // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), - // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), - // Source: to.Ptr("iy"), - // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // LastFailedEnableProtectionJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastFailedEnableProtectionJob{ - // Name: to.Ptr("hvvolptulpcxwbnjdzky"), - // DisplayName: to.Ptr("zrqjbcozwiuypjjnvy"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("hjzgyxgdy"), - // ScenarioName: to.Ptr("fhz"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("ljsixxmmcaq"), + // to.Ptr("fope"), + // }, + // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ + // { + // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), + // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), + // Category: to.Ptr("lcsdxrqxquke"), + // Severity: to.Ptr("wqxxiuaqjyagq"), + // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), + // Summary: to.Ptr("djsmgrltruljo"), + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, + // Code: to.Ptr("dgxkefzmeukd"), + // HealthCategory: to.Ptr("itc"), + // Category: to.Ptr("leigw"), + // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), + // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), + // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), // }, - // LastFailedPlannedFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastFailedPlannedFailoverJob{ - // Name: to.Ptr("ofblltxwhwzhyr"), - // DisplayName: to.Ptr("whxsvbrzdhqsepbocfzsfx"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("ndjurplurnkguwfxx"), - // ScenarioName: to.Ptr("ceksuyfiplxj"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("wpur"), - // }, - // LastSuccessfulPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastSuccessfulUnplannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastTestFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastTestFailoverJob{ - // Name: to.Ptr("cedjijdtnznsnigghrxnsaz"), - // DisplayName: to.Ptr("lhkjfbonwdtxckwzfebfwdyu"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("cta"), - // ScenarioName: to.Ptr("dfuovvz"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("nhbzw"), - // }, - // PolicyName: to.Ptr("tjoeiynplt"), - // ProtectionState: to.Ptr(armrecoveryservicesdatareplication.ProtectionStateUnprotectedStatesBegin), - // ProtectionStateDescription: to.Ptr("lp"), - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ReplicationExtensionName: to.Ptr("jwxdo"), - // ReplicationHealth: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // ResyncRequired: to.Ptr(true), - // ResynchronizationState: to.Ptr(armrecoveryservicesdatareplication.ResynchronizationStateNone), - // SourceFabricProviderID: to.Ptr("srggkxaruzlegtpdalscio"), - // TargetDraID: to.Ptr("oscnhreunbyibimlpvsesu"), - // TargetFabricID: to.Ptr("fb"), - // TargetFabricProviderID: to.Ptr("sutiqezfbeiewwjezflvcitqj"), - // TestFailoverState: to.Ptr(armrecoveryservicesdatareplication.TestFailoverStateNone), - // TestFailoverStateDescription: to.Ptr("msjz"), - // }, - // SystemData: &armrecoveryservicesdatareplication.ProtectedItemModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // CreatedBy: to.Ptr("ghut"), - // CreatedByType: to.Ptr("tzczp"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastModifiedBy: to.Ptr("epo"), - // LastModifiedByType: to.Ptr("ekzmwexhjttb"), // }, - // }}, - // } + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/protectedItems/item1"), + // Name: to.Ptr("t"), + // Type: to.Ptr("xlyjashandpfwivuipoplgkgsnwoh"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("ghut"), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("tzczp")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastModifiedBy: to.Ptr("epo"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("ekzmwexhjttb")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // }, + // }, + // }, + // }, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_PlannedFailover.json +// Generated from example definition: 2024-09-01/ProtectedItem_PlannedFailover.json func ExampleProtectedItemClient_BeginPlannedFailover() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewProtectedItemClient().BeginPlannedFailover(ctx, "rgrecoveryservicesdatareplication", "4", "d", &armrecoveryservicesdatareplication.ProtectedItemClientBeginPlannedFailoverOptions{Body: &armrecoveryservicesdatareplication.PlannedFailoverModel{ - Properties: &armrecoveryservicesdatareplication.PlannedFailoverModelProperties{ - CustomProperties: &armrecoveryservicesdatareplication.PlannedFailoverModelCustomProperties{ - InstanceType: to.Ptr("PlannedFailoverModelCustomProperties"), - }, - }, - }, - }) + poller, err := clientFactory.NewProtectedItemClient().BeginPlannedFailover(ctx, "rgrecoveryservicesdatareplication", "4", "d", armrecoveryservicesdatareplication.PlannedFailoverModel{ + Properties: &armrecoveryservicesdatareplication.PlannedFailoverModelProperties{}, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -475,10 +472,147 @@ func ExampleProtectedItemClient_BeginPlannedFailover() { // 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.PlannedFailoverModel = armrecoveryservicesdatareplication.PlannedFailoverModel{ - // Properties: &armrecoveryservicesdatareplication.PlannedFailoverModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.PlannedFailoverModelCustomProperties{ - // InstanceType: to.Ptr("PlannedFailoverModelCustomProperties"), + // res = armrecoveryservicesdatareplication.ProtectedItemClientPlannedFailoverResponse{ + // PlannedFailoverModel: &armrecoveryservicesdatareplication.PlannedFailoverModel{ + // Properties: &armrecoveryservicesdatareplication.PlannedFailoverModelProperties{ + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/ProtectedItem_Update.json +func ExampleProtectedItemClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewProtectedItemClient().BeginUpdate(ctx, "rgswagger_2024-09-01", "4", "d", armrecoveryservicesdatareplication.ProtectedItemModelUpdate{ + Properties: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesUpdate{}, + }, 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 = armrecoveryservicesdatareplication.ProtectedItemClientUpdateResponse{ + // ProtectedItemModel: &armrecoveryservicesdatareplication.ProtectedItemModel{ + // Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ + // PolicyName: to.Ptr("tjoeiynplt"), + // ReplicationExtensionName: to.Ptr("jwxdo"), + // CorrelationID: to.Ptr("mvxvtcqwgp"), + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ProtectionState: to.Ptr(armrecoveryservicesdatareplication.ProtectionStateUnprotectedStatesBegin), + // ProtectionStateDescription: to.Ptr("lp"), + // TestFailoverState: to.Ptr(armrecoveryservicesdatareplication.TestFailoverStateNone), + // TestFailoverStateDescription: to.Ptr("msjz"), + // ResynchronizationState: to.Ptr(armrecoveryservicesdatareplication.ResynchronizationStateNone), + // FabricObjectID: to.Ptr("kjcizdpahzqsrwyiywbhyzdxsufj"), + // FabricObjectName: to.Ptr("glrjwtvmejxuagjepcwaxhih"), + // SourceFabricProviderID: to.Ptr("srggkxaruzlegtpdalscio"), + // TargetFabricProviderID: to.Ptr("sutiqezfbeiewwjezflvcitqj"), + // FabricID: to.Ptr("ebsxoblmhlhqjzzjzdwo"), + // TargetFabricID: to.Ptr("fb"), + // FabricAgentID: to.Ptr("c"), + // TargetFabricAgentID: to.Ptr("tsekhcwafyaoujmijzawvexruifs"), + // ResyncRequired: to.Ptr(true), + // LastSuccessfulPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastSuccessfulUnplannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // CurrentJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("ljbnhbdmreowdqnlcqycvaramwuii"), + // ID: to.Ptr("bnmbzxzyfgwh"), + // Name: to.Ptr("kqtvbrfmqaxdgpttkbmzpwafjp"), + // DisplayName: to.Ptr("awutlqrisstqb"), + // State: to.Ptr("ztlpngveoqcdejpwaiudhrioskauqv"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // }, + // AllowedJobs: []*string{ + // to.Ptr("guryeoocjbvqvalfkrxecpxwynpxs"), + // }, + // LastFailedEnableProtectionJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("fhz"), + // ID: to.Ptr("hjzgyxgdy"), + // Name: to.Ptr("hvvolptulpcxwbnjdzky"), + // DisplayName: to.Ptr("zrqjbcozwiuypjjnvy"), + // State: to.Ptr("ljsixxmmcaq"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // }, + // LastFailedPlannedFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("ceksuyfiplxj"), + // ID: to.Ptr("ndjurplurnkguwfxx"), + // Name: to.Ptr("ofblltxwhwzhyr"), + // DisplayName: to.Ptr("whxsvbrzdhqsepbocfzsfx"), + // State: to.Ptr("wpur"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // }, + // LastTestFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("dfuovvz"), + // ID: to.Ptr("cta"), + // Name: to.Ptr("cedjijdtnznsnigghrxnsaz"), + // DisplayName: to.Ptr("lhkjfbonwdtxckwzfebfwdyu"), + // State: to.Ptr("nhbzw"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // }, + // ReplicationHealth: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { + // AffectedResourceType: to.Ptr("scfniv"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, + // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ + // { + // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), + // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), + // Category: to.Ptr("lcsdxrqxquke"), + // Severity: to.Ptr("wqxxiuaqjyagq"), + // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), + // Summary: to.Ptr("djsmgrltruljo"), + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, + // Code: to.Ptr("dgxkefzmeukd"), + // HealthCategory: to.Ptr("itc"), + // Category: to.Ptr("leigw"), + // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), + // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), + // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/protectedItems/item1"), + // Name: to.Ptr("t"), + // Type: to.Ptr("xlyjashandpfwivuipoplgkgsnwoh"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("ewufpudzcjrljhmmzhfnxoqdqwnya"), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("zioqm")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // LastModifiedBy: to.Ptr("rx"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("tqbvuqoakaaqij")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), // }, // }, // } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditemoperationstatus_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditemoperationstatus_client.go deleted file mode 100644 index 438e76551bad..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditemoperationstatus_client.go +++ /dev/null @@ -1,119 +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 armrecoveryservicesdatareplication - -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" -) - -// ProtectedItemOperationStatusClient contains the methods for the ProtectedItemOperationStatus group. -// Don't use this type directly, use NewProtectedItemOperationStatusClient() instead. -type ProtectedItemOperationStatusClient struct { - internal *arm.Client - subscriptionID string -} - -// NewProtectedItemOperationStatusClient creates a new instance of ProtectedItemOperationStatusClient 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 NewProtectedItemOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProtectedItemOperationStatusClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ProtectedItemOperationStatusClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Tracks the results of an asynchronous operation on the protected item. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-02-16-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - vaultName - The vault name. -// - protectedItemName - The protected item name. -// - operationID - The ID of an ongoing async operation. -// - options - ProtectedItemOperationStatusClientGetOptions contains the optional parameters for the ProtectedItemOperationStatusClient.Get -// method. -func (client *ProtectedItemOperationStatusClient) Get(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, operationID string, options *ProtectedItemOperationStatusClientGetOptions) (ProtectedItemOperationStatusClientGetResponse, error) { - var err error - const operationName = "ProtectedItemOperationStatusClient.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, vaultName, protectedItemName, operationID, options) - if err != nil { - return ProtectedItemOperationStatusClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectedItemOperationStatusClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ProtectedItemOperationStatusClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ProtectedItemOperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, operationID string, options *ProtectedItemOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/operations/{operationId}" - 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 vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - if protectedItemName == "" { - return nil, errors.New("parameter protectedItemName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{protectedItemName}", url.PathEscape(protectedItemName)) - if operationID == "" { - return nil, errors.New("parameter operationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - 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", "2021-02-16-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ProtectedItemOperationStatusClient) getHandleResponse(resp *http.Response) (ProtectedItemOperationStatusClientGetResponse, error) { - result := ProtectedItemOperationStatusClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return ProtectedItemOperationStatusClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditemoperationstatus_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditemoperationstatus_client_example_test.go deleted file mode 100644 index e9bd790c78c7..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditemoperationstatus_client_example_test.go +++ /dev/null @@ -1,45 +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 armrecoveryservicesdatareplication_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItemOperationStatus_Get.json -func ExampleProtectedItemOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectedItemOperationStatusClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "d", "wdqacsc", 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.OperationStatus = armrecoveryservicesdatareplication.OperationStatus{ - // Name: to.Ptr("wzdasptnwlxgobklayoqapjcgcf"), - // EndTime: to.Ptr("nauyrfh"), - // ID: to.Ptr("sf"), - // StartTime: to.Ptr("xuzwmfrhluafmwwsmzqxsytyehsh"), - // Status: to.Ptr("plbnngzfppdram"), - // } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoints_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoint_client.go similarity index 66% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoints_client.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoint_client.go index 00a263937da7..7806167ec2f5 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoints_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoint_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 armrecoveryservicesdatareplication @@ -20,23 +16,23 @@ import ( "strings" ) -// RecoveryPointsClient contains the methods for the RecoveryPoints group. -// Don't use this type directly, use NewRecoveryPointsClient() instead. -type RecoveryPointsClient struct { +// RecoveryPointClient contains the methods for the RecoveryPoint group. +// Don't use this type directly, use NewRecoveryPointClient() instead. +type RecoveryPointClient struct { internal *arm.Client subscriptionID string } -// NewRecoveryPointsClient creates a new instance of RecoveryPointsClient with the specified values. +// NewRecoveryPointClient creates a new instance of RecoveryPointClient 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 NewRecoveryPointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RecoveryPointsClient, error) { +func NewRecoveryPointClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RecoveryPointClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &RecoveryPointsClient{ + client := &RecoveryPointClient{ subscriptionID: subscriptionID, internal: cl, } @@ -46,36 +42,36 @@ func NewRecoveryPointsClient(subscriptionID string, credential azcore.TokenCrede // Get - Gets the details of the recovery point of a protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - protectedItemName - The protected item name. // - recoveryPointName - The recovery point name. -// - options - RecoveryPointsClientGetOptions contains the optional parameters for the RecoveryPointsClient.Get method. -func (client *RecoveryPointsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, recoveryPointName string, options *RecoveryPointsClientGetOptions) (RecoveryPointsClientGetResponse, error) { +// - options - RecoveryPointClientGetOptions contains the optional parameters for the RecoveryPointClient.Get method. +func (client *RecoveryPointClient) Get(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, recoveryPointName string, options *RecoveryPointClientGetOptions) (RecoveryPointClientGetResponse, error) { var err error - const operationName = "RecoveryPointsClient.Get" + const operationName = "RecoveryPointClient.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, vaultName, protectedItemName, recoveryPointName, options) if err != nil { - return RecoveryPointsClientGetResponse{}, err + return RecoveryPointClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return RecoveryPointsClientGetResponse{}, err + return RecoveryPointClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return RecoveryPointsClientGetResponse{}, err + return RecoveryPointClientGetResponse{}, err } resp, err := client.getHandleResponse(httpResp) return resp, err } // getCreateRequest creates the Get request. -func (client *RecoveryPointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, recoveryPointName string, options *RecoveryPointsClientGetOptions) (*policy.Request, error) { +func (client *RecoveryPointClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, recoveryPointName string, _ *RecoveryPointClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -102,35 +98,35 @@ func (client *RecoveryPointsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getHandleResponse handles the Get response. -func (client *RecoveryPointsClient) getHandleResponse(resp *http.Response) (RecoveryPointsClientGetResponse, error) { - result := RecoveryPointsClientGetResponse{} +func (client *RecoveryPointClient) getHandleResponse(resp *http.Response) (RecoveryPointClientGetResponse, error) { + result := RecoveryPointClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.RecoveryPointModel); err != nil { - return RecoveryPointsClientGetResponse{}, err + return RecoveryPointClientGetResponse{}, err } return result, nil } // NewListPager - Gets the list of recovery points of the given protected item. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - protectedItemName - The protected item name. -// - options - RecoveryPointsClientListOptions contains the optional parameters for the RecoveryPointsClient.NewListPager method. -func (client *RecoveryPointsClient) NewListPager(resourceGroupName string, vaultName string, protectedItemName string, options *RecoveryPointsClientListOptions) *runtime.Pager[RecoveryPointsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[RecoveryPointsClientListResponse]{ - More: func(page RecoveryPointsClientListResponse) bool { +// - options - RecoveryPointClientListOptions contains the optional parameters for the RecoveryPointClient.NewListPager method. +func (client *RecoveryPointClient) NewListPager(resourceGroupName string, vaultName string, protectedItemName string, options *RecoveryPointClientListOptions) *runtime.Pager[RecoveryPointClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[RecoveryPointClientListResponse]{ + More: func(page RecoveryPointClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *RecoveryPointsClientListResponse) (RecoveryPointsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RecoveryPointsClient.NewListPager") + Fetcher: func(ctx context.Context, page *RecoveryPointClientListResponse) (RecoveryPointClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RecoveryPointClient.NewListPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -139,7 +135,7 @@ func (client *RecoveryPointsClient) NewListPager(resourceGroupName string, vault return client.listCreateRequest(ctx, resourceGroupName, vaultName, protectedItemName, options) }, nil) if err != nil { - return RecoveryPointsClientListResponse{}, err + return RecoveryPointClientListResponse{}, err } return client.listHandleResponse(resp) }, @@ -148,7 +144,7 @@ func (client *RecoveryPointsClient) NewListPager(resourceGroupName string, vault } // listCreateRequest creates the List request. -func (client *RecoveryPointsClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *RecoveryPointsClientListOptions) (*policy.Request, error) { +func (client *RecoveryPointClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, _ *RecoveryPointClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -171,17 +167,17 @@ func (client *RecoveryPointsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // listHandleResponse handles the List response. -func (client *RecoveryPointsClient) listHandleResponse(resp *http.Response) (RecoveryPointsClientListResponse, error) { - result := RecoveryPointsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RecoveryPointModelCollection); err != nil { - return RecoveryPointsClientListResponse{}, err +func (client *RecoveryPointClient) listHandleResponse(resp *http.Response) (RecoveryPointClientListResponse, error) { + result := RecoveryPointClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RecoveryPointModelListResult); err != nil { + return RecoveryPointClientListResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoint_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoint_client_example_test.go new file mode 100644 index 000000000000..61ad5791d9be --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoint_client_example_test.go @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armrecoveryservicesdatareplication_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" +) + +// Generated from example definition: 2024-09-01/RecoveryPoints_Get.json +func ExampleRecoveryPointClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewRecoveryPointClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "d", "1X", 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 = armrecoveryservicesdatareplication.RecoveryPointClientGetResponse{ + // RecoveryPointModel: &armrecoveryservicesdatareplication.RecoveryPointModel{ + // Properties: &armrecoveryservicesdatareplication.RecoveryPointModelProperties{ + // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.403Z"); return t}()), + // RecoveryPointType: to.Ptr(armrecoveryservicesdatareplication.RecoveryPointTypeApplicationConsistent), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/recoveryPoints/point1"), + // Name: to.Ptr("mfnjlwvvfnrsllcyyeslxxcchhvld"), + // Type: to.Ptr("zoeadplqxtonvqgwfqmeblh"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("nykpygxolffv"), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("agdgovroryjiwioytnnps")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.403Z"); return t}()), + // LastModifiedBy: to.Ptr("tipxxgz"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("v")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.404Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/RecoveryPoints_List.json +func ExampleRecoveryPointClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewRecoveryPointClient().NewListPager("rgrecoveryservicesdatareplication", "4", "d", 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 = armrecoveryservicesdatareplication.RecoveryPointClientListResponse{ + // RecoveryPointModelListResult: armrecoveryservicesdatareplication.RecoveryPointModelListResult{ + // Value: []*armrecoveryservicesdatareplication.RecoveryPointModel{ + // { + // Properties: &armrecoveryservicesdatareplication.RecoveryPointModelProperties{ + // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.403Z"); return t}()), + // RecoveryPointType: to.Ptr(armrecoveryservicesdatareplication.RecoveryPointTypeApplicationConsistent), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/recoveryPoints/point1"), + // Name: to.Ptr("mfnjlwvvfnrsllcyyeslxxcchhvld"), + // Type: to.Ptr("zoeadplqxtonvqgwfqmeblh"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("nykpygxolffv"), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("agdgovroryjiwioytnnps")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.403Z"); return t}()), + // LastModifiedBy: to.Ptr("tipxxgz"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("v")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.404Z"); return t}()), + // }, + // }, + // }, + // }, + // } + } +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoints_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoints_client_example_test.go deleted file mode 100644 index 45e9d3e92d8e..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoints_client_example_test.go +++ /dev/null @@ -1,106 +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 armrecoveryservicesdatareplication_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/RecoveryPoints_Get.json -func ExampleRecoveryPointsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecoveryPointsClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "d", "1X", 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.RecoveryPointModel = armrecoveryservicesdatareplication.RecoveryPointModel{ - // Name: to.Ptr("mfnjlwvvfnrsllcyyeslxxcchhvld"), - // Type: to.Ptr("zoeadplqxtonvqgwfqmeblh"), - // ID: to.Ptr("yrnzjckvljjffam"), - // Properties: &armrecoveryservicesdatareplication.RecoveryPointModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.RecoveryPointModelCustomProperties{ - // InstanceType: to.Ptr("RecoveryPointModelCustomProperties"), - // }, - // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.403Z"); return t}()), - // RecoveryPointType: to.Ptr(armrecoveryservicesdatareplication.RecoveryPointTypeApplicationConsistent), - // }, - // SystemData: &armrecoveryservicesdatareplication.RecoveryPointModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.403Z"); return t}()), - // CreatedBy: to.Ptr("nykpygxolffv"), - // CreatedByType: to.Ptr("agdgovroryjiwioytnnps"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.404Z"); return t}()), - // LastModifiedBy: to.Ptr("tipxxgz"), - // LastModifiedByType: to.Ptr("v"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/RecoveryPoints_List.json -func ExampleRecoveryPointsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRecoveryPointsClient().NewListPager("rgrecoveryservicesdatareplication", "4", "d", 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.RecoveryPointModelCollection = armrecoveryservicesdatareplication.RecoveryPointModelCollection{ - // Value: []*armrecoveryservicesdatareplication.RecoveryPointModel{ - // { - // Name: to.Ptr("mfnjlwvvfnrsllcyyeslxxcchhvld"), - // Type: to.Ptr("zoeadplqxtonvqgwfqmeblh"), - // ID: to.Ptr("yrnzjckvljjffam"), - // Properties: &armrecoveryservicesdatareplication.RecoveryPointModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.RecoveryPointModelCustomProperties{ - // InstanceType: to.Ptr("RecoveryPointModelCustomProperties"), - // }, - // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.403Z"); return t}()), - // RecoveryPointType: to.Ptr(armrecoveryservicesdatareplication.RecoveryPointTypeApplicationConsistent), - // }, - // SystemData: &armrecoveryservicesdatareplication.RecoveryPointModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.403Z"); return t}()), - // CreatedBy: to.Ptr("nykpygxolffv"), - // CreatedByType: to.Ptr("agdgovroryjiwioytnnps"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.404Z"); return t}()), - // LastModifiedBy: to.Ptr("tipxxgz"), - // LastModifiedByType: to.Ptr("v"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_client.go index 054f989c1c2b..a8bdbbf8ab57 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_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 armrecoveryservicesdatareplication @@ -46,22 +42,21 @@ func NewReplicationExtensionClient(subscriptionID string, credential azcore.Toke // BeginCreate - Creates the replication extension in the given vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - replicationExtensionName - The replication extension name. -// - body - Replication extension model. +// - resource - Replication extension model. // - options - ReplicationExtensionClientBeginCreateOptions contains the optional parameters for the ReplicationExtensionClient.BeginCreate // method. -func (client *ReplicationExtensionClient) BeginCreate(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, body ReplicationExtensionModel, options *ReplicationExtensionClientBeginCreateOptions) (*runtime.Poller[ReplicationExtensionClientCreateResponse], error) { +func (client *ReplicationExtensionClient) BeginCreate(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, resource ReplicationExtensionModel, options *ReplicationExtensionClientBeginCreateOptions) (*runtime.Poller[ReplicationExtensionClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, vaultName, replicationExtensionName, body, options) + resp, err := client.create(ctx, resourceGroupName, vaultName, replicationExtensionName, resource, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicationExtensionClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -74,14 +69,14 @@ func (client *ReplicationExtensionClient) BeginCreate(ctx context.Context, resou // Create - Creates the replication extension in the given vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *ReplicationExtensionClient) create(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, body ReplicationExtensionModel, options *ReplicationExtensionClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *ReplicationExtensionClient) create(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, resource ReplicationExtensionModel, options *ReplicationExtensionClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ReplicationExtensionClient.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, vaultName, replicationExtensionName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, vaultName, replicationExtensionName, resource, options) if err != nil { return nil, err } @@ -97,7 +92,7 @@ func (client *ReplicationExtensionClient) create(ctx context.Context, resourceGr } // createCreateRequest creates the Create request. -func (client *ReplicationExtensionClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, body ReplicationExtensionModel, options *ReplicationExtensionClientBeginCreateOptions) (*policy.Request, error) { +func (client *ReplicationExtensionClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, resource ReplicationExtensionModel, _ *ReplicationExtensionClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -120,10 +115,11 @@ func (client *ReplicationExtensionClient) createCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil @@ -132,7 +128,7 @@ func (client *ReplicationExtensionClient) createCreateRequest(ctx context.Contex // BeginDelete - Deletes the replication extension in the given vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - replicationExtensionName - The replication extension name. @@ -145,8 +141,7 @@ func (client *ReplicationExtensionClient) BeginDelete(ctx context.Context, resou return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicationExtensionClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -159,7 +154,7 @@ func (client *ReplicationExtensionClient) BeginDelete(ctx context.Context, resou // Delete - Deletes the replication extension in the given vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *ReplicationExtensionClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, options *ReplicationExtensionClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ReplicationExtensionClient.BeginDelete" @@ -182,7 +177,7 @@ func (client *ReplicationExtensionClient) deleteOperation(ctx context.Context, r } // deleteCreateRequest creates the Delete request. -func (client *ReplicationExtensionClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, options *ReplicationExtensionClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ReplicationExtensionClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, _ *ReplicationExtensionClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -205,7 +200,7 @@ func (client *ReplicationExtensionClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -214,7 +209,7 @@ func (client *ReplicationExtensionClient) deleteCreateRequest(ctx context.Contex // Get - Gets the details of the replication extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - replicationExtensionName - The replication extension name. @@ -243,7 +238,7 @@ func (client *ReplicationExtensionClient) Get(ctx context.Context, resourceGroup } // getCreateRequest creates the Get request. -func (client *ReplicationExtensionClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, options *ReplicationExtensionClientGetOptions) (*policy.Request, error) { +func (client *ReplicationExtensionClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, _ *ReplicationExtensionClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -266,7 +261,7 @@ func (client *ReplicationExtensionClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -283,7 +278,7 @@ func (client *ReplicationExtensionClient) getHandleResponse(resp *http.Response) // NewListPager - Gets the list of replication extensions in the given vault. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - options - ReplicationExtensionClientListOptions contains the optional parameters for the ReplicationExtensionClient.NewListPager @@ -312,7 +307,7 @@ func (client *ReplicationExtensionClient) NewListPager(resourceGroupName string, } // listCreateRequest creates the List request. -func (client *ReplicationExtensionClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *ReplicationExtensionClientListOptions) (*policy.Request, error) { +func (client *ReplicationExtensionClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *ReplicationExtensionClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -331,7 +326,7 @@ func (client *ReplicationExtensionClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -340,7 +335,7 @@ func (client *ReplicationExtensionClient) listCreateRequest(ctx context.Context, // listHandleResponse handles the List response. func (client *ReplicationExtensionClient) listHandleResponse(resp *http.Response) (ReplicationExtensionClientListResponse, error) { result := ReplicationExtensionClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ReplicationExtensionModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ReplicationExtensionModelListResult); err != nil { return ReplicationExtensionClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_client_example_test.go index cdaae3f83073..9aef0b98f112 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_client_example_test.go @@ -1,140 +1,127 @@ -//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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_Get.json -func ExampleReplicationExtensionClient_Get() { +// Generated from example definition: 2024-09-01/ReplicationExtension_Create.json +func ExampleReplicationExtensionClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewReplicationExtensionClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "g16yjJ", nil) + poller, err := clientFactory.NewReplicationExtensionClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "4", "g16yjJ", armrecoveryservicesdatareplication.ReplicationExtensionModel{ + Properties: &armrecoveryservicesdatareplication.ReplicationExtensionModelProperties{}, + }, 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.ReplicationExtensionModel = armrecoveryservicesdatareplication.ReplicationExtensionModel{ - // Name: to.Ptr("xvjffbiecsd"), - // Type: to.Ptr("miadbgilpheilzfoonveznybthgdwh"), - // ID: to.Ptr("awu"), - // Properties: &armrecoveryservicesdatareplication.ReplicationExtensionModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.ReplicationExtensionModelCustomProperties{ - // InstanceType: to.Ptr("ReplicationExtensionModelCustomProperties"), + // res = armrecoveryservicesdatareplication.ReplicationExtensionClientCreateResponse{ + // ReplicationExtensionModel: &armrecoveryservicesdatareplication.ReplicationExtensionModel{ + // Properties: &armrecoveryservicesdatareplication.ReplicationExtensionModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/replicationExtensions/extension1"), + // Name: to.Ptr("xvjffbiecsd"), + // Type: to.Ptr("miadbgilpheilzfoonveznybthgdwh"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("lagtinqhksctfdxmfbpf"), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("dsqllpglanwztdmisrknjtqz")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), + // LastModifiedBy: to.Ptr("suwjpejlaya"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("nrfjuyghtbivwihr")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), // }, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // }, - // SystemData: &armrecoveryservicesdatareplication.ReplicationExtensionModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), - // CreatedBy: to.Ptr("lagtinqhksctfdxmfbpf"), - // CreatedByType: to.Ptr("dsqllpglanwztdmisrknjtqz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), - // LastModifiedBy: to.Ptr("suwjpejlaya"), - // LastModifiedByType: to.Ptr("nrfjuyghtbivwihr"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_Create.json -func ExampleReplicationExtensionClient_BeginCreate() { +// Generated from example definition: 2024-09-01/ReplicationExtension_Delete.json +func ExampleReplicationExtensionClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewReplicationExtensionClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "4", "g16yjJ", armrecoveryservicesdatareplication.ReplicationExtensionModel{ - Properties: &armrecoveryservicesdatareplication.ReplicationExtensionModelProperties{ - CustomProperties: &armrecoveryservicesdatareplication.ReplicationExtensionModelCustomProperties{ - InstanceType: to.Ptr("ReplicationExtensionModelCustomProperties"), - }, - }, - }, nil) + poller, err := clientFactory.NewReplicationExtensionClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "4", "g16yjJ", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) + _, 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.ReplicationExtensionModel = armrecoveryservicesdatareplication.ReplicationExtensionModel{ - // Name: to.Ptr("xvjffbiecsd"), - // Type: to.Ptr("miadbgilpheilzfoonveznybthgdwh"), - // ID: to.Ptr("awu"), - // Properties: &armrecoveryservicesdatareplication.ReplicationExtensionModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.ReplicationExtensionModelCustomProperties{ - // InstanceType: to.Ptr("ReplicationExtensionModelCustomProperties"), - // }, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // }, - // SystemData: &armrecoveryservicesdatareplication.ReplicationExtensionModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), - // CreatedBy: to.Ptr("lagtinqhksctfdxmfbpf"), - // CreatedByType: to.Ptr("dsqllpglanwztdmisrknjtqz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), - // LastModifiedBy: to.Ptr("suwjpejlaya"), - // LastModifiedByType: to.Ptr("nrfjuyghtbivwihr"), - // }, - // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_Delete.json -func ExampleReplicationExtensionClient_BeginDelete() { +// Generated from example definition: 2024-09-01/ReplicationExtension_Get.json +func ExampleReplicationExtensionClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewReplicationExtensionClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "4", "g16yjJ", nil) + res, err := clientFactory.NewReplicationExtensionClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "g16yjJ", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, 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 = armrecoveryservicesdatareplication.ReplicationExtensionClientGetResponse{ + // ReplicationExtensionModel: &armrecoveryservicesdatareplication.ReplicationExtensionModel{ + // Properties: &armrecoveryservicesdatareplication.ReplicationExtensionModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/replicationExtensions/extension1"), + // Name: to.Ptr("xvjffbiecsd"), + // Type: to.Ptr("miadbgilpheilzfoonveznybthgdwh"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("lagtinqhksctfdxmfbpf"), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("dsqllpglanwztdmisrknjtqz")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), + // LastModifiedBy: to.Ptr("suwjpejlaya"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("nrfjuyghtbivwihr")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_List.json +// Generated from example definition: 2024-09-01/ReplicationExtension_List.json func ExampleReplicationExtensionClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -149,27 +136,27 @@ func ExampleReplicationExtensionClient_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.ReplicationExtensionModelCollection = armrecoveryservicesdatareplication.ReplicationExtensionModelCollection{ - // Value: []*armrecoveryservicesdatareplication.ReplicationExtensionModel{ - // { - // Name: to.Ptr("xvjffbiecsd"), - // Type: to.Ptr("miadbgilpheilzfoonveznybthgdwh"), - // ID: to.Ptr("awu"), - // Properties: &armrecoveryservicesdatareplication.ReplicationExtensionModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.ReplicationExtensionModelCustomProperties{ - // InstanceType: to.Ptr("ReplicationExtensionModelCustomProperties"), + // page = armrecoveryservicesdatareplication.ReplicationExtensionClientListResponse{ + // ReplicationExtensionModelListResult: armrecoveryservicesdatareplication.ReplicationExtensionModelListResult{ + // Value: []*armrecoveryservicesdatareplication.ReplicationExtensionModel{ + // { + // Properties: &armrecoveryservicesdatareplication.ReplicationExtensionModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/replicationExtensions/extension1"), + // Name: to.Ptr("xvjffbiecsd"), + // Type: to.Ptr("miadbgilpheilzfoonveznybthgdwh"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("lagtinqhksctfdxmfbpf"), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("dsqllpglanwztdmisrknjtqz")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), + // LastModifiedBy: to.Ptr("suwjpejlaya"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("nrfjuyghtbivwihr")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), // }, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // }, - // SystemData: &armrecoveryservicesdatareplication.ReplicationExtensionModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), - // CreatedBy: to.Ptr("lagtinqhksctfdxmfbpf"), - // CreatedByType: to.Ptr("dsqllpglanwztdmisrknjtqz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), - // LastModifiedBy: to.Ptr("suwjpejlaya"), - // LastModifiedByType: to.Ptr("nrfjuyghtbivwihr"), // }, - // }}, + // }, + // }, // } } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextensionoperationstatus_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextensionoperationstatus_client.go deleted file mode 100644 index 43840cb3a36b..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextensionoperationstatus_client.go +++ /dev/null @@ -1,119 +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 armrecoveryservicesdatareplication - -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" -) - -// ReplicationExtensionOperationStatusClient contains the methods for the ReplicationExtensionOperationStatus group. -// Don't use this type directly, use NewReplicationExtensionOperationStatusClient() instead. -type ReplicationExtensionOperationStatusClient struct { - internal *arm.Client - subscriptionID string -} - -// NewReplicationExtensionOperationStatusClient creates a new instance of ReplicationExtensionOperationStatusClient 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 NewReplicationExtensionOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationExtensionOperationStatusClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ReplicationExtensionOperationStatusClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Tracks the results of an asynchronous operation on the replication extension. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-02-16-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - vaultName - The vault name. -// - replicationExtensionName - The replication extension name. -// - operationID - The ID of an ongoing async operation. -// - options - ReplicationExtensionOperationStatusClientGetOptions contains the optional parameters for the ReplicationExtensionOperationStatusClient.Get -// method. -func (client *ReplicationExtensionOperationStatusClient) Get(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, operationID string, options *ReplicationExtensionOperationStatusClientGetOptions) (ReplicationExtensionOperationStatusClientGetResponse, error) { - var err error - const operationName = "ReplicationExtensionOperationStatusClient.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, vaultName, replicationExtensionName, operationID, options) - if err != nil { - return ReplicationExtensionOperationStatusClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ReplicationExtensionOperationStatusClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ReplicationExtensionOperationStatusClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ReplicationExtensionOperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, operationID string, options *ReplicationExtensionOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}/operations/{operationId}" - 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 vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - if replicationExtensionName == "" { - return nil, errors.New("parameter replicationExtensionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{replicationExtensionName}", url.PathEscape(replicationExtensionName)) - if operationID == "" { - return nil, errors.New("parameter operationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - 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", "2021-02-16-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ReplicationExtensionOperationStatusClient) getHandleResponse(resp *http.Response) (ReplicationExtensionOperationStatusClientGetResponse, error) { - result := ReplicationExtensionOperationStatusClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return ReplicationExtensionOperationStatusClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextensionoperationstatus_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextensionoperationstatus_client_example_test.go deleted file mode 100644 index 1dbd0fffc7f6..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextensionoperationstatus_client_example_test.go +++ /dev/null @@ -1,45 +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 armrecoveryservicesdatareplication_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtensionOperationStatus_Get.json -func ExampleReplicationExtensionOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReplicationExtensionOperationStatusClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "g16yjJ", "wqdqc", 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.OperationStatus = armrecoveryservicesdatareplication.OperationStatus{ - // Name: to.Ptr("wzdasptnwlxgobklayoqapjcgcf"), - // EndTime: to.Ptr("nauyrfh"), - // ID: to.Ptr("sf"), - // StartTime: to.Ptr("xuzwmfrhluafmwwsmzqxsytyehsh"), - // Status: to.Ptr("plbnngzfppdram"), - // } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/response_types.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/responses.go similarity index 50% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/response_types.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/responses.go index 8d3e756a0220..20775b92281b 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/response_types.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/responses.go @@ -1,54 +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 armrecoveryservicesdatareplication -// AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse contains the response from method AzureSiteRecoveryManagementServiceAPIClient.CheckNameAvailability. -type AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse struct { +// CheckNameAvailabilityClientPostResponse contains the response from method CheckNameAvailabilityClient.Post. +type CheckNameAvailabilityClientPostResponse struct { // Check name availability response model. CheckNameAvailabilityResponseModel } -// AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse contains the response from method AzureSiteRecoveryManagementServiceAPIClient.DeploymentPreflight. -type AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse struct { +// DeploymentPreflightClientPostResponse contains the response from method DeploymentPreflightClient.Post. +type DeploymentPreflightClientPostResponse struct { // Deployment preflight model. DeploymentPreflightModel } -// DraClientCreateResponse contains the response from method DraClient.BeginCreate. -type DraClientCreateResponse struct { - // Dra model. - DraModel -} - -// DraClientDeleteResponse contains the response from method DraClient.BeginDelete. -type DraClientDeleteResponse struct { - // placeholder for future response values -} - -// DraClientGetResponse contains the response from method DraClient.Get. -type DraClientGetResponse struct { - // Dra model. - DraModel -} - -// DraClientListResponse contains the response from method DraClient.NewListPager. -type DraClientListResponse struct { - // Dra model collection. - DraModelCollection -} - -// DraOperationStatusClientGetResponse contains the response from method DraOperationStatusClient.Get. -type DraOperationStatusClientGetResponse struct { - // Defines the operation status. - OperationStatus -} - // EmailConfigurationClientCreateResponse contains the response from method EmailConfigurationClient.Create. type EmailConfigurationClientCreateResponse struct { // Email configuration model. @@ -63,8 +30,8 @@ type EmailConfigurationClientGetResponse struct { // EmailConfigurationClientListResponse contains the response from method EmailConfigurationClient.NewListPager. type EmailConfigurationClientListResponse struct { - // Email configuration model collection. - EmailConfigurationModelCollection + // The response of a EmailConfigurationModel list operation. + EmailConfigurationModelListResult } // EventClientGetResponse contains the response from method EventClient.Get. @@ -75,8 +42,31 @@ type EventClientGetResponse struct { // EventClientListResponse contains the response from method EventClient.NewListPager. type EventClientListResponse struct { - // Event model collection. - EventModelCollection + // The response of a EventModel list operation. + EventModelListResult +} + +// FabricAgentClientCreateResponse contains the response from method FabricAgentClient.BeginCreate. +type FabricAgentClientCreateResponse struct { + // Fabric agent model. + FabricAgentModel +} + +// FabricAgentClientDeleteResponse contains the response from method FabricAgentClient.BeginDelete. +type FabricAgentClientDeleteResponse struct { + // placeholder for future response values +} + +// FabricAgentClientGetResponse contains the response from method FabricAgentClient.Get. +type FabricAgentClientGetResponse struct { + // Fabric agent model. + FabricAgentModel +} + +// FabricAgentClientListResponse contains the response from method FabricAgentClient.NewListPager. +type FabricAgentClientListResponse struct { + // The response of a FabricAgentModel list operation. + FabricAgentModelListResult } // FabricClientCreateResponse contains the response from method FabricClient.BeginCreate. @@ -98,14 +88,14 @@ type FabricClientGetResponse struct { // FabricClientListBySubscriptionResponse contains the response from method FabricClient.NewListBySubscriptionPager. type FabricClientListBySubscriptionResponse struct { - // Fabric model collection. - FabricModelCollection + // The response of a FabricModel list operation. + FabricModelListResult } // FabricClientListResponse contains the response from method FabricClient.NewListPager. type FabricClientListResponse struct { - // Fabric model collection. - FabricModelCollection + // The response of a FabricModel list operation. + FabricModelListResult } // FabricClientUpdateResponse contains the response from method FabricClient.BeginUpdate. @@ -114,8 +104,26 @@ type FabricClientUpdateResponse struct { FabricModel } -// FabricOperationsStatusClientGetResponse contains the response from method FabricOperationsStatusClient.Get. -type FabricOperationsStatusClientGetResponse struct { +// JobClientGetResponse contains the response from method JobClient.Get. +type JobClientGetResponse struct { + // Job model. + JobModel +} + +// JobClientListResponse contains the response from method JobClient.NewListPager. +type JobClientListResponse struct { + // The response of a JobModel list operation. + JobModelListResult +} + +// LocationBasedOperationResultsClientGetResponse contains the response from method LocationBasedOperationResultsClient.Get. +type LocationBasedOperationResultsClientGetResponse struct { + // Defines the operation status. + OperationStatus +} + +// OperationResultsClientGetResponse contains the response from method OperationResultsClient.Get. +type OperationResultsClientGetResponse struct { // Defines the operation status. OperationStatus } @@ -145,14 +153,72 @@ type PolicyClientGetResponse struct { // PolicyClientListResponse contains the response from method PolicyClient.NewListPager. type PolicyClientListResponse struct { - // Policy model collection. - PolicyModelCollection + // The response of a PolicyModel list operation. + PolicyModelListResult } -// PolicyOperationStatusClientGetResponse contains the response from method PolicyOperationStatusClient.Get. -type PolicyOperationStatusClientGetResponse struct { - // Defines the operation status. - OperationStatus +// PrivateEndpointConnectionProxiesClientCreateResponse contains the response from method PrivateEndpointConnectionProxiesClient.Create. +type PrivateEndpointConnectionProxiesClientCreateResponse struct { + // Represents private endpoint connection proxy request. + PrivateEndpointConnectionProxy +} + +// PrivateEndpointConnectionProxiesClientDeleteResponse contains the response from method PrivateEndpointConnectionProxiesClient.BeginDelete. +type PrivateEndpointConnectionProxiesClientDeleteResponse struct { + // placeholder for future response values +} + +// PrivateEndpointConnectionProxiesClientGetResponse contains the response from method PrivateEndpointConnectionProxiesClient.Get. +type PrivateEndpointConnectionProxiesClientGetResponse struct { + // Represents private endpoint connection proxy request. + PrivateEndpointConnectionProxy +} + +// PrivateEndpointConnectionProxiesClientListResponse contains the response from method PrivateEndpointConnectionProxiesClient.NewListPager. +type PrivateEndpointConnectionProxiesClientListResponse struct { + // The response of a PrivateEndpointConnectionProxy list operation. + PrivateEndpointConnectionProxyListResult +} + +// PrivateEndpointConnectionProxiesClientValidateResponse contains the response from method PrivateEndpointConnectionProxiesClient.Validate. +type PrivateEndpointConnectionProxiesClientValidateResponse struct { + // Represents private endpoint connection proxy request. + PrivateEndpointConnectionProxy +} + +// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. +type PrivateEndpointConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. +type PrivateEndpointConnectionsClientGetResponse struct { + // Represents private endpoint connection. + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.NewListPager. +type PrivateEndpointConnectionsClientListResponse struct { + // The response of a PrivateEndpointConnection list operation. + PrivateEndpointConnectionListResult +} + +// PrivateEndpointConnectionsClientUpdateResponse contains the response from method PrivateEndpointConnectionsClient.Update. +type PrivateEndpointConnectionsClientUpdateResponse struct { + // Represents private endpoint connection. + PrivateEndpointConnection +} + +// PrivateLinkResourcesClientGetResponse contains the response from method PrivateLinkResourcesClient.Get. +type PrivateLinkResourcesClientGetResponse struct { + // Represents private link resource. + PrivateLinkResource +} + +// PrivateLinkResourcesClientListResponse contains the response from method PrivateLinkResourcesClient.NewListPager. +type PrivateLinkResourcesClientListResponse struct { + // The response of a PrivateLinkResource list operation. + PrivateLinkResourceListResult } // ProtectedItemClientCreateResponse contains the response from method ProtectedItemClient.BeginCreate. @@ -174,8 +240,8 @@ type ProtectedItemClientGetResponse struct { // ProtectedItemClientListResponse contains the response from method ProtectedItemClient.NewListPager. type ProtectedItemClientListResponse struct { - // Protected item model collection. - ProtectedItemModelCollection + // The response of a ProtectedItemModel list operation. + ProtectedItemModelListResult } // ProtectedItemClientPlannedFailoverResponse contains the response from method ProtectedItemClient.BeginPlannedFailover. @@ -184,22 +250,22 @@ type ProtectedItemClientPlannedFailoverResponse struct { PlannedFailoverModel } -// ProtectedItemOperationStatusClientGetResponse contains the response from method ProtectedItemOperationStatusClient.Get. -type ProtectedItemOperationStatusClientGetResponse struct { - // Defines the operation status. - OperationStatus +// ProtectedItemClientUpdateResponse contains the response from method ProtectedItemClient.BeginUpdate. +type ProtectedItemClientUpdateResponse struct { + // Protected item model. + ProtectedItemModel } -// RecoveryPointsClientGetResponse contains the response from method RecoveryPointsClient.Get. -type RecoveryPointsClientGetResponse struct { +// RecoveryPointClientGetResponse contains the response from method RecoveryPointClient.Get. +type RecoveryPointClientGetResponse struct { // Recovery point model. RecoveryPointModel } -// RecoveryPointsClientListResponse contains the response from method RecoveryPointsClient.NewListPager. -type RecoveryPointsClientListResponse struct { - // Recovery point model collection. - RecoveryPointModelCollection +// RecoveryPointClientListResponse contains the response from method RecoveryPointClient.NewListPager. +type RecoveryPointClientListResponse struct { + // The response of a RecoveryPointModel list operation. + RecoveryPointModelListResult } // ReplicationExtensionClientCreateResponse contains the response from method ReplicationExtensionClient.BeginCreate. @@ -221,14 +287,8 @@ type ReplicationExtensionClientGetResponse struct { // ReplicationExtensionClientListResponse contains the response from method ReplicationExtensionClient.NewListPager. type ReplicationExtensionClientListResponse struct { - // Replication extension model collection. - ReplicationExtensionModelCollection -} - -// ReplicationExtensionOperationStatusClientGetResponse contains the response from method ReplicationExtensionOperationStatusClient.Get. -type ReplicationExtensionOperationStatusClientGetResponse struct { - // Defines the operation status. - OperationStatus + // The response of a ReplicationExtensionModel list operation. + ReplicationExtensionModelListResult } // VaultClientCreateResponse contains the response from method VaultClient.BeginCreate. @@ -250,14 +310,14 @@ type VaultClientGetResponse struct { // VaultClientListBySubscriptionResponse contains the response from method VaultClient.NewListBySubscriptionPager. type VaultClientListBySubscriptionResponse struct { - // Vault model collection. - VaultModelCollection + // The response of a VaultModel list operation. + VaultModelListResult } // VaultClientListResponse contains the response from method VaultClient.NewListPager. type VaultClientListResponse struct { - // Vault model collection. - VaultModelCollection + // The response of a VaultModel list operation. + VaultModelListResult } // VaultClientUpdateResponse contains the response from method VaultClient.BeginUpdate. @@ -265,27 +325,3 @@ type VaultClientUpdateResponse struct { // Vault model. VaultModel } - -// VaultOperationStatusClientGetResponse contains the response from method VaultOperationStatusClient.Get. -type VaultOperationStatusClientGetResponse struct { - // Defines the operation status. - OperationStatus -} - -// WorkflowClientGetResponse contains the response from method WorkflowClient.Get. -type WorkflowClientGetResponse struct { - // Workflow model. - WorkflowModel -} - -// WorkflowClientListResponse contains the response from method WorkflowClient.NewListPager. -type WorkflowClientListResponse struct { - // Workflow model collection. - WorkflowModelCollection -} - -// WorkflowOperationStatusClientGetResponse contains the response from method WorkflowOperationStatusClient.Get. -type WorkflowOperationStatusClientGetResponse struct { - // Defines the operation status. - OperationStatus -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/time_rfc3339.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/time_rfc3339.go index 228806e55873..a71a5208a431 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/time_rfc3339.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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 armrecoveryservicesdatareplication @@ -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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/tsp-location.yaml b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/tsp-location.yaml new file mode 100644 index 000000000000..bc30526b1673 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/recoveryservicesdatareplication/DataReplication.Management +commit: 8c66935c38087d89b19bff47152ee5d8d99a73ec +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_client.go index 260141445348..c8e592a9a84c 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_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 armrecoveryservicesdatareplication @@ -46,20 +42,19 @@ func NewVaultClient(subscriptionID string, credential azcore.TokenCredential, op // BeginCreate - Creates the vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. -// - body - Vault properties. +// - resource - Vault properties. // - options - VaultClientBeginCreateOptions contains the optional parameters for the VaultClient.BeginCreate method. -func (client *VaultClient) BeginCreate(ctx context.Context, resourceGroupName string, vaultName string, body VaultModel, options *VaultClientBeginCreateOptions) (*runtime.Poller[VaultClientCreateResponse], error) { +func (client *VaultClient) BeginCreate(ctx context.Context, resourceGroupName string, vaultName string, resource VaultModel, options *VaultClientBeginCreateOptions) (*runtime.Poller[VaultClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, vaultName, body, options) + resp, err := client.create(ctx, resourceGroupName, vaultName, resource, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VaultClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -72,14 +67,14 @@ func (client *VaultClient) BeginCreate(ctx context.Context, resourceGroupName st // Create - Creates the vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *VaultClient) create(ctx context.Context, resourceGroupName string, vaultName string, body VaultModel, options *VaultClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *VaultClient) create(ctx context.Context, resourceGroupName string, vaultName string, resource VaultModel, options *VaultClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "VaultClient.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, vaultName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, vaultName, resource, options) if err != nil { return nil, err } @@ -95,7 +90,7 @@ func (client *VaultClient) create(ctx context.Context, resourceGroupName string, } // createCreateRequest creates the Create request. -func (client *VaultClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, body VaultModel, options *VaultClientBeginCreateOptions) (*policy.Request, error) { +func (client *VaultClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, resource VaultModel, _ *VaultClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -114,10 +109,11 @@ func (client *VaultClient) createCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil @@ -126,7 +122,7 @@ func (client *VaultClient) createCreateRequest(ctx context.Context, resourceGrou // BeginDelete - Removes the vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - options - VaultClientBeginDeleteOptions contains the optional parameters for the VaultClient.BeginDelete method. @@ -137,8 +133,7 @@ func (client *VaultClient) BeginDelete(ctx context.Context, resourceGroupName st return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VaultClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -151,7 +146,7 @@ func (client *VaultClient) BeginDelete(ctx context.Context, resourceGroupName st // Delete - Removes the vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *VaultClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, options *VaultClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VaultClient.BeginDelete" @@ -174,7 +169,7 @@ func (client *VaultClient) deleteOperation(ctx context.Context, resourceGroupNam } // deleteCreateRequest creates the Delete request. -func (client *VaultClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *VaultClientBeginDeleteOptions) (*policy.Request, error) { +func (client *VaultClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *VaultClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -193,7 +188,7 @@ func (client *VaultClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +197,7 @@ func (client *VaultClient) deleteCreateRequest(ctx context.Context, resourceGrou // Get - Gets the details of the vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - options - VaultClientGetOptions contains the optional parameters for the VaultClient.Get method. @@ -229,7 +224,7 @@ func (client *VaultClient) Get(ctx context.Context, resourceGroupName string, va } // getCreateRequest creates the Get request. -func (client *VaultClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *VaultClientGetOptions) (*policy.Request, error) { +func (client *VaultClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *VaultClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -248,7 +243,7 @@ func (client *VaultClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +260,7 @@ func (client *VaultClient) getHandleResponse(resp *http.Response) (VaultClientGe // NewListPager - Gets the list of vaults in the given subscription and resource group. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - VaultClientListOptions contains the optional parameters for the VaultClient.NewListPager method. func (client *VaultClient) NewListPager(resourceGroupName string, options *VaultClientListOptions) *runtime.Pager[VaultClientListResponse] { @@ -307,10 +302,10 @@ func (client *VaultClient) listCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } - reqQP.Set("api-version", "2021-02-16-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -319,7 +314,7 @@ func (client *VaultClient) listCreateRequest(ctx context.Context, resourceGroupN // listHandleResponse handles the List response. func (client *VaultClient) listHandleResponse(resp *http.Response) (VaultClientListResponse, error) { result := VaultClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.VaultModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.VaultModelListResult); err != nil { return VaultClientListResponse{}, err } return result, nil @@ -327,7 +322,7 @@ func (client *VaultClient) listHandleResponse(resp *http.Response) (VaultClientL // NewListBySubscriptionPager - Gets the list of vaults in the given subscription. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - options - VaultClientListBySubscriptionOptions contains the optional parameters for the VaultClient.NewListBySubscriptionPager // method. func (client *VaultClient) NewListBySubscriptionPager(options *VaultClientListBySubscriptionOptions) *runtime.Pager[VaultClientListBySubscriptionResponse] { @@ -354,7 +349,7 @@ func (client *VaultClient) NewListBySubscriptionPager(options *VaultClientListBy } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *VaultClient) listBySubscriptionCreateRequest(ctx context.Context, options *VaultClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *VaultClient) listBySubscriptionCreateRequest(ctx context.Context, _ *VaultClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationVaults" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -365,10 +360,7 @@ func (client *VaultClient) listBySubscriptionCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - if options != nil && options.ContinuationToken != nil { - reqQP.Set("continuationToken", *options.ContinuationToken) - } - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -377,7 +369,7 @@ func (client *VaultClient) listBySubscriptionCreateRequest(ctx context.Context, // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *VaultClient) listBySubscriptionHandleResponse(resp *http.Response) (VaultClientListBySubscriptionResponse, error) { result := VaultClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.VaultModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.VaultModelListResult); err != nil { return VaultClientListBySubscriptionResponse{}, err } return result, nil @@ -386,20 +378,19 @@ func (client *VaultClient) listBySubscriptionHandleResponse(resp *http.Response) // BeginUpdate - Performs update on the vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. -// - body - Vault properties. +// - properties - Vault properties. // - options - VaultClientBeginUpdateOptions contains the optional parameters for the VaultClient.BeginUpdate method. -func (client *VaultClient) BeginUpdate(ctx context.Context, resourceGroupName string, vaultName string, body VaultModelUpdate, options *VaultClientBeginUpdateOptions) (*runtime.Poller[VaultClientUpdateResponse], error) { +func (client *VaultClient) BeginUpdate(ctx context.Context, resourceGroupName string, vaultName string, properties VaultModelUpdate, options *VaultClientBeginUpdateOptions) (*runtime.Poller[VaultClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, vaultName, body, options) + resp, err := client.update(ctx, resourceGroupName, vaultName, properties, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VaultClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -412,14 +403,14 @@ func (client *VaultClient) BeginUpdate(ctx context.Context, resourceGroupName st // Update - Performs update on the vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *VaultClient) update(ctx context.Context, resourceGroupName string, vaultName string, body VaultModelUpdate, options *VaultClientBeginUpdateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *VaultClient) update(ctx context.Context, resourceGroupName string, vaultName string, properties VaultModelUpdate, options *VaultClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VaultClient.BeginUpdate" 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, vaultName, body, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, vaultName, properties, options) if err != nil { return nil, err } @@ -435,7 +426,7 @@ func (client *VaultClient) update(ctx context.Context, resourceGroupName string, } // updateCreateRequest creates the Update request. -func (client *VaultClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, body VaultModelUpdate, options *VaultClientBeginUpdateOptions) (*policy.Request, error) { +func (client *VaultClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, properties VaultModelUpdate, _ *VaultClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -454,10 +445,11 @@ func (client *VaultClient) updateCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } return req, nil diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_client_example_test.go index f58f7c6cee70..0bf04f4c5ac3 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_client_example_test.go @@ -1,73 +1,25 @@ -//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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Get.json -func ExampleVaultClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVaultClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", 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.VaultModel = armrecoveryservicesdatareplication.VaultModel{ - // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), - // Type: to.Ptr("xtcicpcmjvocohaznrk"), - // ID: to.Ptr("hbccseewgiagaxsjozxgwydjgy"), - // Location: to.Ptr("eck"), - // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceResourceID: to.Ptr("mksumcmksgdsghojszxq"), - // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), - // }, - // SystemData: &armrecoveryservicesdatareplication.VaultModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // CreatedBy: to.Ptr("rm"), - // CreatedByType: to.Ptr("uojlfokjrhzgqoodsvgz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // LastModifiedBy: to.Ptr("gkojzu"), - // LastModifiedByType: to.Ptr("jua"), - // }, - // Tags: map[string]*string{ - // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Create.json +// Generated from example definition: 2024-09-01/Vault_Create.json func ExampleVaultClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -90,116 +42,110 @@ func ExampleVaultClient_BeginCreate() { // 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.VaultModel = armrecoveryservicesdatareplication.VaultModel{ - // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), - // Type: to.Ptr("xtcicpcmjvocohaznrk"), - // ID: to.Ptr("hbccseewgiagaxsjozxgwydjgy"), - // Location: to.Ptr("eck"), - // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceResourceID: to.Ptr("mksumcmksgdsghojszxq"), - // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), - // }, - // SystemData: &armrecoveryservicesdatareplication.VaultModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // CreatedBy: to.Ptr("rm"), - // CreatedByType: to.Ptr("uojlfokjrhzgqoodsvgz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // LastModifiedBy: to.Ptr("gkojzu"), - // LastModifiedByType: to.Ptr("jua"), - // }, - // Tags: map[string]*string{ - // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), + // res = armrecoveryservicesdatareplication.VaultClientCreateResponse{ + // VaultModel: &armrecoveryservicesdatareplication.VaultModel{ + // Location: to.Ptr("eck"), + // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ServiceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1"), + // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1"), + // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), + // Type: to.Ptr("xtcicpcmjvocohaznrk"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("rm"), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("uojlfokjrhzgqoodsvgz")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), + // LastModifiedBy: to.Ptr("gkojzu"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("jua")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), + // }, + // Tags: map[string]*string{ + // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Update.json -func ExampleVaultClient_BeginUpdate() { +// Generated from example definition: 2024-09-01/Vault_Delete.json +func ExampleVaultClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewVaultClient().BeginUpdate(ctx, "rgrecoveryservicesdatareplication", "4", armrecoveryservicesdatareplication.VaultModelUpdate{ - Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ - VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), - }, - Tags: map[string]*string{ - "key8872": to.Ptr("pvtc"), - }, - }, nil) + poller, err := clientFactory.NewVaultClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "4", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) + _, 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.VaultModel = armrecoveryservicesdatareplication.VaultModel{ - // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), - // Type: to.Ptr("xtcicpcmjvocohaznrk"), - // ID: to.Ptr("hbccseewgiagaxsjozxgwydjgy"), - // Location: to.Ptr("eck"), - // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceResourceID: to.Ptr("mksumcmksgdsghojszxq"), - // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), - // }, - // SystemData: &armrecoveryservicesdatareplication.VaultModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // CreatedBy: to.Ptr("rm"), - // CreatedByType: to.Ptr("uojlfokjrhzgqoodsvgz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // LastModifiedBy: to.Ptr("gkojzu"), - // LastModifiedByType: to.Ptr("jua"), - // }, - // Tags: map[string]*string{ - // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), - // }, - // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Delete.json -func ExampleVaultClient_BeginDelete() { +// Generated from example definition: 2024-09-01/Vault_Get.json +func ExampleVaultClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewVaultClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "4", nil) + res, err := clientFactory.NewVaultClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, 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 = armrecoveryservicesdatareplication.VaultClientGetResponse{ + // VaultModel: &armrecoveryservicesdatareplication.VaultModel{ + // Location: to.Ptr("eck"), + // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ServiceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1"), + // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1"), + // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), + // Type: to.Ptr("xtcicpcmjvocohaznrk"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("rm"), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("uojlfokjrhzgqoodsvgz")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), + // LastModifiedBy: to.Ptr("gkojzu"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("jua")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), + // }, + // Tags: map[string]*string{ + // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_ListBySubscription.json -func ExampleVaultClient_NewListBySubscriptionPager() { +// Generated from example definition: 2024-09-01/Vault_List.json +func ExampleVaultClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewVaultClient().NewListBySubscriptionPager(&armrecoveryservicesdatareplication.VaultClientListBySubscriptionOptions{ContinuationToken: to.Ptr("dqsjhseyugyexxrlrln")}) + pager := clientFactory.NewVaultClient().NewListPager("rgrecoveryservicesdatareplication", &VaultClientListOptions{ + continuationToken: to.Ptr("mwculdaqndp")}) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -210,46 +156,49 @@ func ExampleVaultClient_NewListBySubscriptionPager() { _ = 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.VaultModelCollection = armrecoveryservicesdatareplication.VaultModelCollection{ - // Value: []*armrecoveryservicesdatareplication.VaultModel{ - // { - // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), - // Type: to.Ptr("xtcicpcmjvocohaznrk"), - // ID: to.Ptr("hbccseewgiagaxsjozxgwydjgy"), - // Location: to.Ptr("eck"), - // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceResourceID: to.Ptr("mksumcmksgdsghojszxq"), - // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), + // page = armrecoveryservicesdatareplication.VaultClientListResponse{ + // VaultModelListResult: armrecoveryservicesdatareplication.VaultModelListResult{ + // Value: []*armrecoveryservicesdatareplication.VaultModel{ + // { + // Location: to.Ptr("eck"), + // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ServiceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1"), + // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1"), + // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), + // Type: to.Ptr("xtcicpcmjvocohaznrk"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("rm"), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("uojlfokjrhzgqoodsvgz")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), + // LastModifiedBy: to.Ptr("gkojzu"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("jua")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), + // }, + // Tags: map[string]*string{ + // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), + // }, // }, - // SystemData: &armrecoveryservicesdatareplication.VaultModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // CreatedBy: to.Ptr("rm"), - // CreatedByType: to.Ptr("uojlfokjrhzgqoodsvgz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // LastModifiedBy: to.Ptr("gkojzu"), - // LastModifiedByType: to.Ptr("jua"), - // }, - // Tags: map[string]*string{ - // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), - // }, - // }}, + // }, + // }, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_List.json -func ExampleVaultClient_NewListPager() { +// Generated from example definition: 2024-09-01/Vault_ListBySubscription.json +func ExampleVaultClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewVaultClient().NewListPager("rgrecoveryservicesdatareplication", &armrecoveryservicesdatareplication.VaultClientListOptions{ContinuationToken: to.Ptr("mwculdaqndp")}) + pager := clientFactory.NewVaultClient().NewListBySubscriptionPager(nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -260,30 +209,88 @@ func ExampleVaultClient_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.VaultModelCollection = armrecoveryservicesdatareplication.VaultModelCollection{ - // Value: []*armrecoveryservicesdatareplication.VaultModel{ - // { - // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), - // Type: to.Ptr("xtcicpcmjvocohaznrk"), - // ID: to.Ptr("hbccseewgiagaxsjozxgwydjgy"), - // Location: to.Ptr("eck"), - // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceResourceID: to.Ptr("mksumcmksgdsghojszxq"), - // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), - // }, - // SystemData: &armrecoveryservicesdatareplication.VaultModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // CreatedBy: to.Ptr("rm"), - // CreatedByType: to.Ptr("uojlfokjrhzgqoodsvgz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // LastModifiedBy: to.Ptr("gkojzu"), - // LastModifiedByType: to.Ptr("jua"), - // }, - // Tags: map[string]*string{ - // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), + // page = armrecoveryservicesdatareplication.VaultClientListBySubscriptionResponse{ + // VaultModelListResult: armrecoveryservicesdatareplication.VaultModelListResult{ + // Value: []*armrecoveryservicesdatareplication.VaultModel{ + // { + // Location: to.Ptr("eck"), + // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ServiceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1"), + // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DataReplication/replicationVaults/vault1"), + // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), + // Type: to.Ptr("xtcicpcmjvocohaznrk"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("rm"), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("uojlfokjrhzgqoodsvgz")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), + // LastModifiedBy: to.Ptr("gkojzu"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("jua")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), + // }, + // Tags: map[string]*string{ + // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), + // }, // }, - // }}, + // }, + // }, // } } } + +// Generated from example definition: 2024-09-01/Vault_Update.json +func ExampleVaultClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewVaultClient().BeginUpdate(ctx, "rgrecoveryservicesdatareplication", "4", armrecoveryservicesdatareplication.VaultModelUpdate{ + Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ + VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), + }, + Tags: map[string]*string{ + "key8872": to.Ptr("pvtc"), + }, + }, 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 = armrecoveryservicesdatareplication.VaultClientUpdateResponse{ + // VaultModel: &armrecoveryservicesdatareplication.VaultModel{ + // Location: to.Ptr("eck"), + // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ServiceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1"), + // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1"), + // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), + // Type: to.Ptr("xtcicpcmjvocohaznrk"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("rm"), + // CreatedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("uojlfokjrhzgqoodsvgz")), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), + // LastModifiedBy: to.Ptr("gkojzu"), + // LastModifiedByType: to.Ptr(armrecoveryservicesdatareplication.CreatedByType("jua")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), + // }, + // Tags: map[string]*string{ + // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflowoperationstatus_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflowoperationstatus_client.go deleted file mode 100644 index 169e213fbda4..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflowoperationstatus_client.go +++ /dev/null @@ -1,119 +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 armrecoveryservicesdatareplication - -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" -) - -// WorkflowOperationStatusClient contains the methods for the WorkflowOperationStatus group. -// Don't use this type directly, use NewWorkflowOperationStatusClient() instead. -type WorkflowOperationStatusClient struct { - internal *arm.Client - subscriptionID string -} - -// NewWorkflowOperationStatusClient creates a new instance of WorkflowOperationStatusClient 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 NewWorkflowOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkflowOperationStatusClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &WorkflowOperationStatusClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Tracks the results of an asynchronous operation on the job. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-02-16-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - vaultName - The vault name. -// - jobName - The job (workflow) name. -// - operationID - The ID of an ongoing async operation. -// - options - WorkflowOperationStatusClientGetOptions contains the optional parameters for the WorkflowOperationStatusClient.Get -// method. -func (client *WorkflowOperationStatusClient) Get(ctx context.Context, resourceGroupName string, vaultName string, jobName string, operationID string, options *WorkflowOperationStatusClientGetOptions) (WorkflowOperationStatusClientGetResponse, error) { - var err error - const operationName = "WorkflowOperationStatusClient.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, vaultName, jobName, operationID, options) - if err != nil { - return WorkflowOperationStatusClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return WorkflowOperationStatusClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return WorkflowOperationStatusClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *WorkflowOperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, jobName string, operationID string, options *WorkflowOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName}/operations/{operationId}" - 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 vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - if jobName == "" { - return nil, errors.New("parameter jobName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) - if operationID == "" { - return nil, errors.New("parameter operationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - 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", "2021-02-16-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *WorkflowOperationStatusClient) getHandleResponse(resp *http.Response) (WorkflowOperationStatusClientGetResponse, error) { - result := WorkflowOperationStatusClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return WorkflowOperationStatusClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflowoperationstatus_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflowoperationstatus_client_example_test.go deleted file mode 100644 index 1ce990863bc7..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflowoperationstatus_client_example_test.go +++ /dev/null @@ -1,45 +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 armrecoveryservicesdatareplication_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/WorkflowOperationStatus_Get.json -func ExampleWorkflowOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkflowOperationStatusClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "ZGH4y", "wdqcxc", 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.OperationStatus = armrecoveryservicesdatareplication.OperationStatus{ - // Name: to.Ptr("wzdasptnwlxgobklayoqapjcgcf"), - // EndTime: to.Ptr("nauyrfh"), - // ID: to.Ptr("sf"), - // StartTime: to.Ptr("xuzwmfrhluafmwwsmzqxsytyehsh"), - // Status: to.Ptr("plbnngzfppdram"), - // } -}