From 84dd0e112f100723dcf7c0449ed764209e15a95d Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Thu, 19 Mar 2026 10:05:02 +0000 Subject: [PATCH] Configurations: 'specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/tspconfig.yaml', API Version: 9/1/2022, SDK Release Type: beta, and CommitSHA: 'aa822c9c01b9e83fbc8ad8ec4c308203a3c29287' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6034396 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- .../storagesync/armstoragesync/CHANGELOG.md | 96 + .../storagesync/armstoragesync/README.md | 4 +- .../storagesync/armstoragesync/autorest.md | 13 - .../storagesync/armstoragesync/build.go | 7 - .../armstoragesync/client_factory.go | 79 +- .../armstoragesync/cloudendpoints_client.go | 207 ++- .../cloudendpoints_client_example_test.go | 400 ++-- .../storagesync/armstoragesync/constants.go | 157 +- .../fake/cloudendpoints_server.go | 193 +- .../armstoragesync/fake/internal.go | 16 +- .../fake/microsoftstoragesync_server.go | 60 +- .../armstoragesync/fake/operations_server.go | 54 +- .../fake/operationstatus_server.go | 60 +- .../fake/privateendpointconnections_server.go | 78 +- .../fake/privatelinkresources_server.go | 56 +- .../fake/registeredservers_server.go | 154 +- .../armstoragesync/fake/server_factory.go | 74 +- .../fake/serverendpoints_server.go | 117 +- .../armstoragesync/fake/services_server.go | 116 +- .../armstoragesync/fake/syncgroups_server.go | 90 +- .../armstoragesync/fake/time_rfc3339.go | 83 - .../armstoragesync/fake/workflows_server.go | 80 +- .../storagesync/armstoragesync/go.mod | 12 +- .../storagesync/armstoragesync/go.sum | 20 +- .../microsoftstoragesync_client.go | 17 +- ...icrosoftstoragesync_client_example_test.go | 2 +- .../storagesync/armstoragesync/models.go | 306 +-- .../armstoragesync/models_serde.go | 678 ++++--- .../armstoragesync/operations_client.go | 17 +- .../operations_client_example_test.go | 1646 +++++++++-------- .../armstoragesync/operationstatus_client.go | 17 +- .../operationstatus_client_example_test.go | 27 +- .../storagesync/armstoragesync/options.go | 60 +- .../privateendpointconnections_client.go | 98 +- ...endpointconnections_client_example_test.go | 179 +- .../privatelinkresources_client.go | 23 +- ...rivatelinkresources_client_example_test.go | 48 +- .../registeredservers_client.go | 160 +- .../registeredservers_client_example_test.go | 367 ++-- .../{response_types.go => responses.go} | 208 ++- .../armstoragesync/serverendpoints_client.go | 105 +- .../serverendpoints_client_example_test.go | 929 ++++++---- .../armstoragesync/services_client.go | 138 +- .../services_client_example_test.go | 567 ++++-- .../armstoragesync/syncgroups_client.go | 64 +- .../syncgroups_client_example_test.go | 135 +- .../armstoragesync/testdata/_metadata.json | 6 + .../armstoragesync/time_rfc3339.go | 83 - .../armstoragesync/tsp-location.yaml | 4 + .../storagesync/armstoragesync/version.go | 10 + .../armstoragesync/workflows_client.go | 53 +- .../workflows_client_example_test.go | 125 +- 52 files changed, 4901 insertions(+), 3397 deletions(-) delete mode 100644 sdk/resourcemanager/storagesync/armstoragesync/autorest.md delete mode 100644 sdk/resourcemanager/storagesync/armstoragesync/build.go delete mode 100644 sdk/resourcemanager/storagesync/armstoragesync/fake/time_rfc3339.go rename sdk/resourcemanager/storagesync/armstoragesync/{response_types.go => responses.go} (60%) create mode 100644 sdk/resourcemanager/storagesync/armstoragesync/testdata/_metadata.json delete mode 100644 sdk/resourcemanager/storagesync/armstoragesync/time_rfc3339.go create mode 100644 sdk/resourcemanager/storagesync/armstoragesync/tsp-location.yaml create mode 100644 sdk/resourcemanager/storagesync/armstoragesync/version.go diff --git a/sdk/resourcemanager/storagesync/armstoragesync/CHANGELOG.md b/sdk/resourcemanager/storagesync/armstoragesync/CHANGELOG.md index 57416bb7b40a..d05d081f0ea3 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/CHANGELOG.md +++ b/sdk/resourcemanager/storagesync/armstoragesync/CHANGELOG.md @@ -1,5 +1,101 @@ # Release History +## 2.0.0-beta.1 (2026-03-19) +### Breaking Changes + +- Function `*ServerEndpointsClient.BeginUpdate` parameter(s) have been changed from `(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, options *ServerEndpointsClientBeginUpdateOptions)` to `(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, parameters ServerEndpointUpdateParameters, options *ServerEndpointsClientBeginUpdateOptions)` +- Function `*ServicesClient.BeginUpdate` parameter(s) have been changed from `(ctx context.Context, resourceGroupName string, storageSyncServiceName string, options *ServicesClientBeginUpdateOptions)` to `(ctx context.Context, resourceGroupName string, storageSyncServiceName string, parameters ServiceUpdateParameters, options *ServicesClientBeginUpdateOptions)` +- Enum `ProgressType` has been removed +- Enum `Reason` has been removed +- Struct `Error` has been removed +- Struct `OperationDisplayResource` has been removed +- Struct `ProxyResource` has been removed +- Struct `Resource` has been removed +- Struct `ResourcesMoveInfo` has been removed +- Struct `SubscriptionState` has been removed +- Struct `TrackedResource` has been removed +- Field `XMSCorrelationRequestID`, `XMSRequestID` of struct `CloudEndpointsClientGetResponse` has been removed +- Field `XMSCorrelationRequestID`, `XMSRequestID` of struct `CloudEndpointsClientListBySyncGroupResponse` has been removed +- Field `XMSCorrelationRequestID`, `XMSRequestID` of struct `CloudEndpointsClientRestoreheartbeatResponse` has been removed +- Field `XMSCorrelationRequestID`, `XMSRequestID` of struct `MicrosoftStorageSyncClientLocationOperationStatusResponse` has been removed +- Field `XMSCorrelationRequestID`, `XMSRequestID` of struct `OperationStatusClientGetResponse` has been removed +- Field `XMSCorrelationRequestID`, `XMSRequestID` of struct `OperationsClientListResponse` has been removed +- Field `XMSCorrelationRequestID`, `XMSRequestID` of struct `PrivateEndpointConnectionsClientListByStorageSyncServiceResponse` has been removed +- Field `XMSCorrelationRequestID`, `XMSRequestID` of struct `RegisteredServersClientGetResponse` has been removed +- Field `XMSCorrelationRequestID`, `XMSRequestID` of struct `RegisteredServersClientListByStorageSyncServiceResponse` has been removed +- Field `Parameters` of struct `ServerEndpointsClientBeginUpdateOptions` has been removed +- Field `XMSCorrelationRequestID`, `XMSRequestID` of struct `ServerEndpointsClientGetResponse` has been removed +- Field `XMSCorrelationRequestID`, `XMSRequestID` of struct `ServerEndpointsClientListBySyncGroupResponse` has been removed +- Field `Parameters` of struct `ServicesClientBeginUpdateOptions` has been removed +- Field `XMSCorrelationRequestID`, `XMSRequestID` of struct `ServicesClientGetResponse` has been removed +- Field `XMSCorrelationRequestID`, `XMSRequestID` of struct `ServicesClientListByResourceGroupResponse` has been removed +- Field `XMSCorrelationRequestID`, `XMSRequestID` of struct `ServicesClientListBySubscriptionResponse` has been removed +- Field `XMSCorrelationRequestID`, `XMSRequestID` of struct `SyncGroupsClientCreateResponse` has been removed +- Field `XMSCorrelationRequestID`, `XMSRequestID` of struct `SyncGroupsClientDeleteResponse` has been removed +- Field `XMSCorrelationRequestID`, `XMSRequestID` of struct `SyncGroupsClientGetResponse` has been removed +- Field `XMSCorrelationRequestID`, `XMSRequestID` of struct `SyncGroupsClientListByStorageSyncServiceResponse` has been removed +- Field `XMSCorrelationRequestID`, `XMSRequestID` of struct `WorkflowsClientAbortResponse` has been removed +- Field `XMSCorrelationRequestID`, `XMSRequestID` of struct `WorkflowsClientGetResponse` has been removed +- Field `XMSCorrelationRequestID`, `XMSRequestID` of struct `WorkflowsClientListByStorageSyncServiceResponse` has been removed + +### Features Added + +- New enum type `CloudTieringLowDiskModeState` with values `CloudTieringLowDiskModeStateDisabled`, `CloudTieringLowDiskModeStateEnabled` +- New enum type `ManagedServiceIdentityType` with values `ManagedServiceIdentityTypeNone`, `ManagedServiceIdentityTypeSystemAssigned`, `ManagedServiceIdentityTypeSystemAssignedUserAssigned`, `ManagedServiceIdentityTypeUserAssigned` +- New enum type `ServerAuthType` with values `ServerAuthTypeCertificate`, `ServerAuthTypeManagedIdentity` +- New enum type `ServerProvisioningStatus` with values `ServerProvisioningStatusError`, `ServerProvisioningStatusInProgress`, `ServerProvisioningStatusNotStarted`, `ServerProvisioningStatusReadySyncFunctional`, `ServerProvisioningStatusReadySyncNotFunctional` +- New function `*CloudEndpointsClient.AfsShareMetadataCertificatePublicKeys(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, options *CloudEndpointsClientAfsShareMetadataCertificatePublicKeysOptions) (CloudEndpointsClientAfsShareMetadataCertificatePublicKeysResponse, error)` +- New function `*RegisteredServersClient.BeginUpdate(ctx context.Context, resourceGroupName string, storageSyncServiceName string, serverID string, parameters RegisteredServerUpdateParameters, options *RegisteredServersClientBeginUpdateOptions) (*runtime.Poller[RegisteredServersClientUpdateResponse], error)` +- New struct `CloudEndpointAfsShareMetadataCertificatePublicKeys` +- New struct `CloudTieringLowDiskMode` +- New struct `ManagedServiceIdentity` +- New struct `RegisteredServerUpdateParameters` +- New struct `RegisteredServerUpdateProperties` +- New struct `ServerEndpointProvisioningStatus` +- New struct `ServerEndpointProvisioningStepStatus` +- New struct `UserAssignedIdentity` +- New field `NextLink` in struct `CloudEndpointArray` +- New field `CorrelationRequestID`, `RequestID` in struct `CloudEndpointsClientGetResponse` +- New field `CorrelationRequestID`, `RequestID` in struct `CloudEndpointsClientListBySyncGroupResponse` +- New field `CorrelationRequestID`, `RequestID` in struct `CloudEndpointsClientRestoreheartbeatResponse` +- New field `CorrelationRequestID`, `RequestID` in struct `MicrosoftStorageSyncClientLocationOperationStatusResponse` +- New field `LockAggregationType` in struct `OperationResourceMetricSpecification` +- New field `CorrelationRequestID`, `RequestID` in struct `OperationStatusClientGetResponse` +- New field `CorrelationRequestID`, `RequestID` in struct `OperationsClientListResponse` +- New field `NextLink` in struct `PrivateEndpointConnectionListResult` +- New field `GroupIDs` in struct `PrivateEndpointConnectionProperties` +- New field `CorrelationRequestID`, `RequestID` in struct `PrivateEndpointConnectionsClientListByStorageSyncServiceResponse` +- New field `NextLink` in struct `RegisteredServerArray` +- New field `ApplicationID`, `Identity` in struct `RegisteredServerCreateParametersProperties` +- New field `ActiveAuthType`, `ApplicationID`, `Identity`, `LatestApplicationID` in struct `RegisteredServerProperties` +- New field `CorrelationRequestID`, `RequestID` in struct `RegisteredServersClientGetResponse` +- New field `CorrelationRequestID`, `RequestID` in struct `RegisteredServersClientListByStorageSyncServiceResponse` +- New field `NextLink` in struct `ServerEndpointArray` +- New field `LowDiskMode` in struct `ServerEndpointCloudTieringStatus` +- New field `ServerEndpointProvisioningStatus` in struct `ServerEndpointProperties` +- New field `CorrelationRequestID`, `RequestID` in struct `ServerEndpointsClientGetResponse` +- New field `CorrelationRequestID`, `RequestID` in struct `ServerEndpointsClientListBySyncGroupResponse` +- New field `Identity` in struct `Service` +- New field `NextLink` in struct `ServiceArray` +- New field `ID`, `Identity`, `Name`, `SystemData`, `Type` in struct `ServiceCreateParameters` +- New field `UseIdentity` in struct `ServiceCreateParametersProperties` +- New field `UseIdentity` in struct `ServiceProperties` +- New field `Identity` in struct `ServiceUpdateParameters` +- New field `UseIdentity` in struct `ServiceUpdateProperties` +- New field `CorrelationRequestID`, `RequestID` in struct `ServicesClientGetResponse` +- New field `CorrelationRequestID`, `RequestID` in struct `ServicesClientListByResourceGroupResponse` +- New field `CorrelationRequestID`, `RequestID` in struct `ServicesClientListBySubscriptionResponse` +- New field `NextLink` in struct `SyncGroupArray` +- New field `CorrelationRequestID`, `RequestID` in struct `SyncGroupsClientCreateResponse` +- New field `CorrelationRequestID`, `RequestID` in struct `SyncGroupsClientDeleteResponse` +- New field `CorrelationRequestID`, `RequestID` in struct `SyncGroupsClientGetResponse` +- New field `CorrelationRequestID`, `RequestID` in struct `SyncGroupsClientListByStorageSyncServiceResponse` +- New field `NextLink` in struct `WorkflowArray` +- New field `CorrelationRequestID`, `RequestID` in struct `WorkflowsClientAbortResponse` +- New field `CorrelationRequestID`, `RequestID` in struct `WorkflowsClientGetResponse` +- New field `CorrelationRequestID`, `RequestID` in struct `WorkflowsClientListByStorageSyncServiceResponse` + + ## 1.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/storagesync/armstoragesync/README.md b/sdk/resourcemanager/storagesync/armstoragesync/README.md index 438eb1aad560..f1d1c9c6f3df 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/README.md +++ b/sdk/resourcemanager/storagesync/armstoragesync/README.md @@ -18,7 +18,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Storage Sync module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2 ``` ## Authorization @@ -55,7 +55,7 @@ clientFactory, err := armstoragesync.NewClientFactory(, cred, & A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. ```go -client := clientFactory.NewServicesClient() +client := clientFactory.NewCloudEndpointsClient() ``` ## Fakes diff --git a/sdk/resourcemanager/storagesync/armstoragesync/autorest.md b/sdk/resourcemanager/storagesync/armstoragesync/autorest.md deleted file mode 100644 index d4a0d291f917..000000000000 --- a/sdk/resourcemanager/storagesync/armstoragesync/autorest.md +++ /dev/null @@ -1,13 +0,0 @@ -### AutoRest Configuration - -> see https://aka.ms/autorest - -``` yaml -azure-arm: true -require: -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/readme.go.md -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.2.0 - -``` \ No newline at end of file diff --git a/sdk/resourcemanager/storagesync/armstoragesync/build.go b/sdk/resourcemanager/storagesync/armstoragesync/build.go deleted file mode 100644 index de05bb2cd572..000000000000 --- a/sdk/resourcemanager/storagesync/armstoragesync/build.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -// This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/storagesync/armstoragesync - -package armstoragesync diff --git a/sdk/resourcemanager/storagesync/armstoragesync/client_factory.go b/sdk/resourcemanager/storagesync/armstoragesync/client_factory.go index cb39ede20be2..496ca427cb22 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/client_factory.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/client_factory.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 armstoragesync @@ -14,88 +13,108 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - subscriptionID: subscriptionID, credential: credential, - options: options.Clone(), + subscriptionID: subscriptionID, + internal: internal, }, nil } // NewCloudEndpointsClient creates a new instance of CloudEndpointsClient. func (c *ClientFactory) NewCloudEndpointsClient() *CloudEndpointsClient { - subClient, _ := NewCloudEndpointsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &CloudEndpointsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewMicrosoftStorageSyncClient creates a new instance of MicrosoftStorageSyncClient. func (c *ClientFactory) NewMicrosoftStorageSyncClient() *MicrosoftStorageSyncClient { - subClient, _ := NewMicrosoftStorageSyncClient(c.subscriptionID, c.credential, c.options) - return subClient + return &MicrosoftStorageSyncClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewOperationStatusClient creates a new instance of OperationStatusClient. func (c *ClientFactory) NewOperationStatusClient() *OperationStatusClient { - subClient, _ := NewOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient + return &OperationStatusClient{ + 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, + } } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateEndpointConnectionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient. func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { - subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateLinkResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewRegisteredServersClient creates a new instance of RegisteredServersClient. func (c *ClientFactory) NewRegisteredServersClient() *RegisteredServersClient { - subClient, _ := NewRegisteredServersClient(c.subscriptionID, c.credential, c.options) - return subClient + return &RegisteredServersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewServerEndpointsClient creates a new instance of ServerEndpointsClient. func (c *ClientFactory) NewServerEndpointsClient() *ServerEndpointsClient { - subClient, _ := NewServerEndpointsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ServerEndpointsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewServicesClient creates a new instance of ServicesClient. func (c *ClientFactory) NewServicesClient() *ServicesClient { - subClient, _ := NewServicesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ServicesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewSyncGroupsClient creates a new instance of SyncGroupsClient. func (c *ClientFactory) NewSyncGroupsClient() *SyncGroupsClient { - subClient, _ := NewSyncGroupsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &SyncGroupsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewWorkflowsClient creates a new instance of WorkflowsClient. func (c *ClientFactory) NewWorkflowsClient() *WorkflowsClient { - subClient, _ := NewWorkflowsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &WorkflowsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } diff --git a/sdk/resourcemanager/storagesync/armstoragesync/cloudendpoints_client.go b/sdk/resourcemanager/storagesync/armstoragesync/cloudendpoints_client.go index 0403c8b38489..54b6834c260f 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/cloudendpoints_client.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/cloudendpoints_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 armstoragesync @@ -25,9 +24,9 @@ type CloudEndpointsClient struct { } // NewCloudEndpointsClient creates a new instance of CloudEndpointsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewCloudEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CloudEndpointsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -40,10 +39,91 @@ func NewCloudEndpointsClient(subscriptionID string, credential azcore.TokenCrede return client, nil } +// AfsShareMetadataCertificatePublicKeys - Get the AFS file share metadata signing certificate public keys. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - storageSyncServiceName - Name of Storage Sync Service resource. +// - syncGroupName - Name of Sync Group resource. +// - cloudEndpointName - Name of Cloud Endpoint object. +// - options - CloudEndpointsClientAfsShareMetadataCertificatePublicKeysOptions contains the optional parameters for the CloudEndpointsClient.AfsShareMetadataCertificatePublicKeys +// method. +func (client *CloudEndpointsClient) AfsShareMetadataCertificatePublicKeys(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, options *CloudEndpointsClientAfsShareMetadataCertificatePublicKeysOptions) (CloudEndpointsClientAfsShareMetadataCertificatePublicKeysResponse, error) { + var err error + const operationName = "CloudEndpointsClient.AfsShareMetadataCertificatePublicKeys" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.afsShareMetadataCertificatePublicKeysCreateRequest(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options) + if err != nil { + return CloudEndpointsClientAfsShareMetadataCertificatePublicKeysResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CloudEndpointsClientAfsShareMetadataCertificatePublicKeysResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CloudEndpointsClientAfsShareMetadataCertificatePublicKeysResponse{}, err + } + resp, err := client.afsShareMetadataCertificatePublicKeysHandleResponse(httpResp) + return resp, err +} + +// afsShareMetadataCertificatePublicKeysCreateRequest creates the AfsShareMetadataCertificatePublicKeys request. +func (client *CloudEndpointsClient) afsShareMetadataCertificatePublicKeysCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, _ *CloudEndpointsClientAfsShareMetadataCertificatePublicKeysOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/afsShareMetadataCertificatePublicKeys" + 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 storageSyncServiceName == "" { + return nil, errors.New("parameter storageSyncServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageSyncServiceName}", url.PathEscape(storageSyncServiceName)) + if syncGroupName == "" { + return nil, errors.New("parameter syncGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{syncGroupName}", url.PathEscape(syncGroupName)) + if cloudEndpointName == "" { + return nil, errors.New("parameter cloudEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudEndpointName}", url.PathEscape(cloudEndpointName)) + 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", "2022-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// afsShareMetadataCertificatePublicKeysHandleResponse handles the AfsShareMetadataCertificatePublicKeys response. +func (client *CloudEndpointsClient) afsShareMetadataCertificatePublicKeysHandleResponse(resp *http.Response) (CloudEndpointsClientAfsShareMetadataCertificatePublicKeysResponse, error) { + result := CloudEndpointsClientAfsShareMetadataCertificatePublicKeysResponse{} + if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { + result.CorrelationRequestID = &val + } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.CloudEndpointAfsShareMetadataCertificatePublicKeys); err != nil { + return CloudEndpointsClientAfsShareMetadataCertificatePublicKeysResponse{}, err + } + return result, nil +} + // BeginCreate - Create a new CloudEndpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - syncGroupName - Name of Sync Group resource. @@ -58,7 +138,8 @@ func (client *CloudEndpointsClient) BeginCreate(ctx context.Context, resourceGro return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudEndpointsClientCreateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -71,7 +152,7 @@ func (client *CloudEndpointsClient) BeginCreate(ctx context.Context, resourceGro // Create - Create a new CloudEndpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 func (client *CloudEndpointsClient) create(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters CloudEndpointCreateParameters, options *CloudEndpointsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "CloudEndpointsClient.BeginCreate" @@ -94,7 +175,7 @@ func (client *CloudEndpointsClient) create(ctx context.Context, resourceGroupNam } // createCreateRequest creates the Create request. -func (client *CloudEndpointsClient) createCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters CloudEndpointCreateParameters, options *CloudEndpointsClientBeginCreateOptions) (*policy.Request, error) { +func (client *CloudEndpointsClient) createCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters CloudEndpointCreateParameters, _ *CloudEndpointsClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -121,9 +202,10 @@ func (client *CloudEndpointsClient) createCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-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, parameters); err != nil { return nil, err } @@ -133,7 +215,7 @@ func (client *CloudEndpointsClient) createCreateRequest(ctx context.Context, res // BeginDelete - Delete a given CloudEndpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - syncGroupName - Name of Sync Group resource. @@ -147,7 +229,8 @@ func (client *CloudEndpointsClient) BeginDelete(ctx context.Context, resourceGro return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudEndpointsClientDeleteResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -160,7 +243,7 @@ func (client *CloudEndpointsClient) BeginDelete(ctx context.Context, resourceGro // Delete - Delete a given CloudEndpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 func (client *CloudEndpointsClient) deleteOperation(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, options *CloudEndpointsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CloudEndpointsClient.BeginDelete" @@ -183,7 +266,7 @@ func (client *CloudEndpointsClient) deleteOperation(ctx context.Context, resourc } // deleteCreateRequest creates the Delete request. -func (client *CloudEndpointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, options *CloudEndpointsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *CloudEndpointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, _ *CloudEndpointsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -210,16 +293,15 @@ func (client *CloudEndpointsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Get a given CloudEndpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - syncGroupName - Name of Sync Group resource. @@ -248,7 +330,7 @@ func (client *CloudEndpointsClient) Get(ctx context.Context, resourceGroupName s } // getCreateRequest creates the Get request. -func (client *CloudEndpointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, options *CloudEndpointsClientGetOptions) (*policy.Request, error) { +func (client *CloudEndpointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, _ *CloudEndpointsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -275,7 +357,7 @@ func (client *CloudEndpointsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -285,10 +367,10 @@ func (client *CloudEndpointsClient) getCreateRequest(ctx context.Context, resour func (client *CloudEndpointsClient) getHandleResponse(resp *http.Response) (CloudEndpointsClientGetResponse, error) { result := CloudEndpointsClientGetResponse{} if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { - result.XMSCorrelationRequestID = &val + result.CorrelationRequestID = &val } if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val + result.RequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.CloudEndpoint); err != nil { return CloudEndpointsClientGetResponse{}, err @@ -298,7 +380,7 @@ func (client *CloudEndpointsClient) getHandleResponse(resp *http.Response) (Clou // NewListBySyncGroupPager - Get a CloudEndpoint List. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - syncGroupName - Name of Sync Group resource. @@ -307,21 +389,20 @@ func (client *CloudEndpointsClient) getHandleResponse(resp *http.Response) (Clou func (client *CloudEndpointsClient) NewListBySyncGroupPager(resourceGroupName string, storageSyncServiceName string, syncGroupName string, options *CloudEndpointsClientListBySyncGroupOptions) *runtime.Pager[CloudEndpointsClientListBySyncGroupResponse] { return runtime.NewPager(runtime.PagingHandler[CloudEndpointsClientListBySyncGroupResponse]{ More: func(page CloudEndpointsClientListBySyncGroupResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *CloudEndpointsClientListBySyncGroupResponse) (CloudEndpointsClientListBySyncGroupResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CloudEndpointsClient.NewListBySyncGroupPager") - req, err := client.listBySyncGroupCreateRequest(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, options) - if err != nil { - return CloudEndpointsClientListBySyncGroupResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySyncGroupCreateRequest(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, options) + }, nil) if err != nil { return CloudEndpointsClientListBySyncGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CloudEndpointsClientListBySyncGroupResponse{}, runtime.NewResponseError(resp) - } return client.listBySyncGroupHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -329,7 +410,7 @@ func (client *CloudEndpointsClient) NewListBySyncGroupPager(resourceGroupName st } // listBySyncGroupCreateRequest creates the ListBySyncGroup request. -func (client *CloudEndpointsClient) listBySyncGroupCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, options *CloudEndpointsClientListBySyncGroupOptions) (*policy.Request, error) { +func (client *CloudEndpointsClient) listBySyncGroupCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, _ *CloudEndpointsClientListBySyncGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -352,7 +433,7 @@ func (client *CloudEndpointsClient) listBySyncGroupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -362,10 +443,10 @@ func (client *CloudEndpointsClient) listBySyncGroupCreateRequest(ctx context.Con func (client *CloudEndpointsClient) listBySyncGroupHandleResponse(resp *http.Response) (CloudEndpointsClientListBySyncGroupResponse, error) { result := CloudEndpointsClientListBySyncGroupResponse{} if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { - result.XMSCorrelationRequestID = &val + result.CorrelationRequestID = &val } if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val + result.RequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.CloudEndpointArray); err != nil { return CloudEndpointsClientListBySyncGroupResponse{}, err @@ -376,7 +457,7 @@ func (client *CloudEndpointsClient) listBySyncGroupHandleResponse(resp *http.Res // BeginPostBackup - Post Backup a given CloudEndpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - syncGroupName - Name of Sync Group resource. @@ -404,7 +485,7 @@ func (client *CloudEndpointsClient) BeginPostBackup(ctx context.Context, resourc // PostBackup - Post Backup a given CloudEndpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 func (client *CloudEndpointsClient) postBackup(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters BackupRequest, options *CloudEndpointsClientBeginPostBackupOptions) (*http.Response, error) { var err error const operationName = "CloudEndpointsClient.BeginPostBackup" @@ -427,7 +508,7 @@ func (client *CloudEndpointsClient) postBackup(ctx context.Context, resourceGrou } // postBackupCreateRequest creates the PostBackup request. -func (client *CloudEndpointsClient) postBackupCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters BackupRequest, options *CloudEndpointsClientBeginPostBackupOptions) (*policy.Request, error) { +func (client *CloudEndpointsClient) postBackupCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters BackupRequest, _ *CloudEndpointsClientBeginPostBackupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postbackup" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -454,9 +535,10 @@ func (client *CloudEndpointsClient) postBackupCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-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, parameters); err != nil { return nil, err } @@ -466,7 +548,7 @@ func (client *CloudEndpointsClient) postBackupCreateRequest(ctx context.Context, // BeginPostRestore - Post Restore a given CloudEndpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - syncGroupName - Name of Sync Group resource. @@ -494,7 +576,7 @@ func (client *CloudEndpointsClient) BeginPostRestore(ctx context.Context, resour // PostRestore - Post Restore a given CloudEndpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 func (client *CloudEndpointsClient) postRestore(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters PostRestoreRequest, options *CloudEndpointsClientBeginPostRestoreOptions) (*http.Response, error) { var err error const operationName = "CloudEndpointsClient.BeginPostRestore" @@ -517,7 +599,7 @@ func (client *CloudEndpointsClient) postRestore(ctx context.Context, resourceGro } // postRestoreCreateRequest creates the PostRestore request. -func (client *CloudEndpointsClient) postRestoreCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters PostRestoreRequest, options *CloudEndpointsClientBeginPostRestoreOptions) (*policy.Request, error) { +func (client *CloudEndpointsClient) postRestoreCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters PostRestoreRequest, _ *CloudEndpointsClientBeginPostRestoreOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postrestore" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -544,9 +626,9 @@ func (client *CloudEndpointsClient) postRestoreCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-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, parameters); err != nil { return nil, err } @@ -556,7 +638,7 @@ func (client *CloudEndpointsClient) postRestoreCreateRequest(ctx context.Context // BeginPreBackup - Pre Backup a given CloudEndpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - syncGroupName - Name of Sync Group resource. @@ -584,7 +666,7 @@ func (client *CloudEndpointsClient) BeginPreBackup(ctx context.Context, resource // PreBackup - Pre Backup a given CloudEndpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 func (client *CloudEndpointsClient) preBackup(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters BackupRequest, options *CloudEndpointsClientBeginPreBackupOptions) (*http.Response, error) { var err error const operationName = "CloudEndpointsClient.BeginPreBackup" @@ -607,7 +689,7 @@ func (client *CloudEndpointsClient) preBackup(ctx context.Context, resourceGroup } // preBackupCreateRequest creates the PreBackup request. -func (client *CloudEndpointsClient) preBackupCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters BackupRequest, options *CloudEndpointsClientBeginPreBackupOptions) (*policy.Request, error) { +func (client *CloudEndpointsClient) preBackupCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters BackupRequest, _ *CloudEndpointsClientBeginPreBackupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prebackup" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -634,9 +716,9 @@ func (client *CloudEndpointsClient) preBackupCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-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, parameters); err != nil { return nil, err } @@ -646,7 +728,7 @@ func (client *CloudEndpointsClient) preBackupCreateRequest(ctx context.Context, // BeginPreRestore - Pre Restore a given CloudEndpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - syncGroupName - Name of Sync Group resource. @@ -674,7 +756,7 @@ func (client *CloudEndpointsClient) BeginPreRestore(ctx context.Context, resourc // PreRestore - Pre Restore a given CloudEndpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 func (client *CloudEndpointsClient) preRestore(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters PreRestoreRequest, options *CloudEndpointsClientBeginPreRestoreOptions) (*http.Response, error) { var err error const operationName = "CloudEndpointsClient.BeginPreRestore" @@ -697,7 +779,7 @@ func (client *CloudEndpointsClient) preRestore(ctx context.Context, resourceGrou } // preRestoreCreateRequest creates the PreRestore request. -func (client *CloudEndpointsClient) preRestoreCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters PreRestoreRequest, options *CloudEndpointsClientBeginPreRestoreOptions) (*policy.Request, error) { +func (client *CloudEndpointsClient) preRestoreCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters PreRestoreRequest, _ *CloudEndpointsClientBeginPreRestoreOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prerestore" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -724,9 +806,9 @@ func (client *CloudEndpointsClient) preRestoreCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-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, parameters); err != nil { return nil, err } @@ -736,7 +818,7 @@ func (client *CloudEndpointsClient) preRestoreCreateRequest(ctx context.Context, // Restoreheartbeat - Restore Heartbeat a given CloudEndpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - syncGroupName - Name of Sync Group resource. @@ -766,7 +848,7 @@ func (client *CloudEndpointsClient) Restoreheartbeat(ctx context.Context, resour } // restoreheartbeatCreateRequest creates the Restoreheartbeat request. -func (client *CloudEndpointsClient) restoreheartbeatCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, options *CloudEndpointsClientRestoreheartbeatOptions) (*policy.Request, error) { +func (client *CloudEndpointsClient) restoreheartbeatCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, _ *CloudEndpointsClientRestoreheartbeatOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/restoreheartbeat" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -793,9 +875,8 @@ func (client *CloudEndpointsClient) restoreheartbeatCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -803,10 +884,10 @@ func (client *CloudEndpointsClient) restoreheartbeatCreateRequest(ctx context.Co func (client *CloudEndpointsClient) restoreheartbeatHandleResponse(resp *http.Response) (CloudEndpointsClientRestoreheartbeatResponse, error) { result := CloudEndpointsClientRestoreheartbeatResponse{} if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { - result.XMSCorrelationRequestID = &val + result.CorrelationRequestID = &val } if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val + result.RequestID = &val } return result, nil } @@ -815,7 +896,7 @@ func (client *CloudEndpointsClient) restoreheartbeatHandleResponse(resp *http.Re // File Sync Cloud Endpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - syncGroupName - Name of Sync Group resource. @@ -844,7 +925,7 @@ func (client *CloudEndpointsClient) BeginTriggerChangeDetection(ctx context.Cont // Sync Cloud Endpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 func (client *CloudEndpointsClient) triggerChangeDetection(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters TriggerChangeDetectionParameters, options *CloudEndpointsClientBeginTriggerChangeDetectionOptions) (*http.Response, error) { var err error const operationName = "CloudEndpointsClient.BeginTriggerChangeDetection" @@ -867,7 +948,7 @@ func (client *CloudEndpointsClient) triggerChangeDetection(ctx context.Context, } // triggerChangeDetectionCreateRequest creates the TriggerChangeDetection request. -func (client *CloudEndpointsClient) triggerChangeDetectionCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters TriggerChangeDetectionParameters, options *CloudEndpointsClientBeginTriggerChangeDetectionOptions) (*policy.Request, error) { +func (client *CloudEndpointsClient) triggerChangeDetectionCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters TriggerChangeDetectionParameters, _ *CloudEndpointsClientBeginTriggerChangeDetectionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/triggerChangeDetection" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -894,9 +975,9 @@ func (client *CloudEndpointsClient) triggerChangeDetectionCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-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, parameters); err != nil { return nil, err } diff --git a/sdk/resourcemanager/storagesync/armstoragesync/cloudendpoints_client_example_test.go b/sdk/resourcemanager/storagesync/armstoragesync/cloudendpoints_client_example_test.go index da042889f897..9ec9f8fb2db9 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/cloudendpoints_client_example_test.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/cloudendpoints_client_example_test.go @@ -1,28 +1,53 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armstoragesync_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/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_Create.json +// Generated from example definition: 2022-09-01/CloudEndpoints_AfsShareMetadataCertificatePublicKeys.json +func ExampleCloudEndpointsClient_AfsShareMetadataCertificatePublicKeys() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCloudEndpointsClient().AfsShareMetadataCertificatePublicKeys(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "SampleSyncGroup_1", "SampleCloudEndpoint_1", 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 = armstoragesync.CloudEndpointsClientAfsShareMetadataCertificatePublicKeysResponse{ + // CorrelationRequestID: "d166ca76-dad2-49df-b409-d2acfd42d730" + // RequestID: "74e55a4d-1c6f-46de-9a8d-278e53a47403" + // CloudEndpointAfsShareMetadataCertificatePublicKeys: &armstoragesync.CloudEndpointAfsShareMetadataCertificatePublicKeys{ + // FirstKey: to.Ptr("key1"), + // SecondKey: to.Ptr("key2"), + // }, + // } +} + +// Generated from example definition: 2022-09-01/CloudEndpoints_Create.json func ExampleCloudEndpointsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -44,114 +69,125 @@ func ExampleCloudEndpointsClient_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.CloudEndpoint = armstoragesync.CloudEndpoint{ - // Name: to.Ptr("SampleCloudEndpoint_1"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups/cloudEndpoints"), - // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/syncGroups/SampleSyncGroup_1/cloudEndpoints/SampleCloudEndpoint_1"), - // Properties: &armstoragesync.CloudEndpointProperties{ - // AzureFileShareName: to.Ptr("cvcloud-afscv-0719-058-a94a1354-a1fd-4e9a-9a50-919fad8c4ba4"), - // BackupEnabled: to.Ptr("false"), - // FriendlyName: to.Ptr("ankushbsubscriptionmgmtmab"), - // LastOperationName: to.Ptr("ICreateCloudEndpointWorkflow"), - // LastWorkflowID: to.Ptr("storageSyncServices/GATest/workflows/24ba0c4a-348e-419b-8f7a-091d0d9f07a4"), - // PartnershipID: to.Ptr("1|U0VSVkVSQVNTWU5DQ0xJRU5USEZTVjJ8RjhDODcwQTItMkFGNi00NDUyLTgzMDgtRjJCQTZEQjI3RkEwfEdFTkVSSUN8NTJCOERBMkYtNjFFMC00QTFGLThEREUtMzM2OTExRjM2N0ZC"), - // ProvisioningState: to.Ptr("Succeeded"), - // StorageAccountResourceID: to.Ptr("/subscriptions/744f4d70-6d17-4921-8970-a765d14f763f/resourceGroups/tminienv59svc/providers/Microsoft.Storage/storageAccounts/tminienv59storage"), - // StorageAccountTenantID: to.Ptr("\"72f988bf-86f1-41af-91ab-2d7cd011db47\""), + // res = armstoragesync.CloudEndpointsClientCreateResponse{ + // CloudEndpoint: &armstoragesync.CloudEndpoint{ + // Name: to.Ptr("SampleCloudEndpoint_1"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups/cloudEndpoints"), + // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/syncGroups/SampleSyncGroup_1/cloudEndpoints/SampleCloudEndpoint_1"), + // Properties: &armstoragesync.CloudEndpointProperties{ + // AzureFileShareName: to.Ptr("cvcloud-afscv-0719-058-a94a1354-a1fd-4e9a-9a50-919fad8c4ba4"), + // BackupEnabled: to.Ptr("false"), + // FriendlyName: to.Ptr("ankushbsubscriptionmgmtmab"), + // LastOperationName: to.Ptr("ICreateCloudEndpointWorkflow"), + // LastWorkflowID: to.Ptr("storageSyncServices/GATest/workflows/24ba0c4a-348e-419b-8f7a-091d0d9f07a4"), + // PartnershipID: to.Ptr("1|U0VSVkVSQVNTWU5DQ0xJRU5USEZTVjJ8RjhDODcwQTItMkFGNi00NDUyLTgzMDgtRjJCQTZEQjI3RkEwfEdFTkVSSUN8NTJCOERBMkYtNjFFMC00QTFGLThEREUtMzM2OTExRjM2N0ZC"), + // ProvisioningState: to.Ptr("Succeeded"), + // StorageAccountResourceID: to.Ptr("/subscriptions/744f4d70-6d17-4921-8970-a765d14f763f/resourceGroups/tminienv59svc/providers/Microsoft.Storage/storageAccounts/tminienv59storage"), + // StorageAccountTenantID: to.Ptr("\"72f988bf-86f1-41af-91ab-2d7cd011db47\""), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_Get.json -func ExampleCloudEndpointsClient_Get() { +// Generated from example definition: 2022-09-01/CloudEndpoints_Delete.json +func ExampleCloudEndpointsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCloudEndpointsClient().Get(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "SampleSyncGroup_1", "SampleCloudEndpoint_1", nil) + poller, err := clientFactory.NewCloudEndpointsClient().BeginDelete(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "SampleSyncGroup_1", "SampleCloudEndpoint_1", 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.CloudEndpoint = armstoragesync.CloudEndpoint{ - // Name: to.Ptr("SampleCloudEndpoint_1"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups/cloudEndpoints"), - // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/syncGroups/SyncGroup_Restore_08-08_Test112/cloudEndpoints/CEP_Restore_08-08_Test112"), - // Properties: &armstoragesync.CloudEndpointProperties{ - // AzureFileShareName: to.Ptr(""), - // ChangeEnumerationStatus: &armstoragesync.CloudEndpointChangeEnumerationStatus{ - // Activity: &armstoragesync.CloudEndpointChangeEnumerationActivity{ - // DeletesProgressPercent: to.Ptr[int32](12), - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.096Z"); return t}()), - // MinutesRemaining: to.Ptr[int32](589), - // OperationState: to.Ptr(armstoragesync.CloudEndpointChangeEnumerationActivityStateEnumerationInProgress), - // ProcessedDirectoriesCount: to.Ptr[int64](364), - // ProcessedFilesCount: to.Ptr[int64](6948), - // ProgressPercent: to.Ptr[int32](67), - // StartedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.096Z"); return t}()), - // StatusCode: to.Ptr[int32](0), - // TotalCountsState: to.Ptr(armstoragesync.CloudEndpointChangeEnumerationTotalCountsStateFinal), - // TotalDirectoriesCount: to.Ptr[int64](694), - // TotalFilesCount: to.Ptr[int64](12834), - // TotalSizeBytes: to.Ptr[int64](5782301239408), - // }, - // LastEnumerationStatus: &armstoragesync.CloudEndpointLastChangeEnumerationStatus{ - // CompletedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.096Z"); return t}()), - // NamespaceDirectoriesCount: to.Ptr[int64](28), - // NamespaceFilesCount: to.Ptr[int64](3489), - // NamespaceSizeBytes: to.Ptr[int64](3248804), - // NextRunTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.096Z"); return t}()), - // StartedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.096Z"); return t}()), - // }, - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.096Z"); return t}()), - // }, - // FriendlyName: to.Ptr("SampleAzureFileShareName_1"), - // LastOperationName: to.Ptr("ICreateCloudEndpointWorkflow"), - // LastWorkflowID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/workflows/a377fdd5-949a-40ab-9629-06cd0e9852f9"), - // PartnershipID: to.Ptr("1|U0VSVkVSQVNTWU5DQ0xJRU5USEZTVjJ8MTkxNjYwQ0QtNkExQS00RjhDLTk3ODctQTZCRUQyMDZBMUREfEdFTkVSSUN8M0EwNDgyODMtMzM4Ri00MDAyLUE5REQtQTUwRkRBRENCMzky"), - // ProvisioningState: to.Ptr("Succeeded"), - // StorageAccountResourceID: to.Ptr(""), - // StorageAccountTenantID: to.Ptr("\"a4d1b191-c1af-4cef-a14b-f670e0beea52\""), - // }, + // res = armstoragesync.CloudEndpointsClientDeleteResponse{ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_Delete.json -func ExampleCloudEndpointsClient_BeginDelete() { +// Generated from example definition: 2022-09-01/CloudEndpoints_Get.json +func ExampleCloudEndpointsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewCloudEndpointsClient().BeginDelete(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "SampleSyncGroup_1", "SampleCloudEndpoint_1", nil) + res, err := clientFactory.NewCloudEndpointsClient().Get(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "SampleSyncGroup_1", "SampleCloudEndpoint_1", 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 = armstoragesync.CloudEndpointsClientGetResponse{ + // CorrelationRequestID: "d166ca76-dad2-49df-b409-d2acfd42d730" + // RequestID: "74e55a4d-1c6f-46de-9a8d-278e53a47403" + // CloudEndpoint: &armstoragesync.CloudEndpoint{ + // Name: to.Ptr("SampleCloudEndpoint_1"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups/cloudEndpoints"), + // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/syncGroups/SyncGroup_Restore_08-08_Test112/cloudEndpoints/CEP_Restore_08-08_Test112"), + // Properties: &armstoragesync.CloudEndpointProperties{ + // AzureFileShareName: to.Ptr(""), + // ChangeEnumerationStatus: &armstoragesync.CloudEndpointChangeEnumerationStatus{ + // Activity: &armstoragesync.CloudEndpointChangeEnumerationActivity{ + // DeletesProgressPercent: to.Ptr[int32](12), + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.0961891Z"); return t}()), + // MinutesRemaining: to.Ptr[int32](589), + // OperationState: to.Ptr(armstoragesync.CloudEndpointChangeEnumerationActivityStateEnumerationInProgress), + // ProcessedDirectoriesCount: to.Ptr[int64](364), + // ProcessedFilesCount: to.Ptr[int64](6948), + // ProgressPercent: to.Ptr[int32](67), + // StartedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.0961891Z"); return t}()), + // StatusCode: to.Ptr[int32](0), + // TotalCountsState: to.Ptr(armstoragesync.CloudEndpointChangeEnumerationTotalCountsStateFinal), + // TotalDirectoriesCount: to.Ptr[int64](694), + // TotalFilesCount: to.Ptr[int64](12834), + // TotalSizeBytes: to.Ptr[int64](5782301239408), + // }, + // LastEnumerationStatus: &armstoragesync.CloudEndpointLastChangeEnumerationStatus{ + // CompletedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.0961891Z"); return t}()), + // NamespaceDirectoriesCount: to.Ptr[int64](28), + // NamespaceFilesCount: to.Ptr[int64](3489), + // NamespaceSizeBytes: to.Ptr[int64](3248804), + // NextRunTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.0961891Z"); return t}()), + // StartedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.0961891Z"); return t}()), + // }, + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.0961891Z"); return t}()), + // }, + // FriendlyName: to.Ptr("SampleAzureFileShareName_1"), + // LastOperationName: to.Ptr("ICreateCloudEndpointWorkflow"), + // LastWorkflowID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/workflows/a377fdd5-949a-40ab-9629-06cd0e9852f9"), + // PartnershipID: to.Ptr("1|U0VSVkVSQVNTWU5DQ0xJRU5USEZTVjJ8MTkxNjYwQ0QtNkExQS00RjhDLTk3ODctQTZCRUQyMDZBMUREfEdFTkVSSUN8M0EwNDgyODMtMzM4Ri00MDAyLUE5REQtQTUwRkRBRENCMzky"), + // ProvisioningState: to.Ptr("Succeeded"), + // StorageAccountResourceID: to.Ptr(""), + // StorageAccountTenantID: to.Ptr("\"a4d1b191-c1af-4cef-a14b-f670e0beea52\""), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_ListBySyncGroup.json +// Generated from example definition: 2022-09-01/CloudEndpoints_ListBySyncGroup.json func ExampleCloudEndpointsClient_NewListBySyncGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -166,83 +202,65 @@ func ExampleCloudEndpointsClient_NewListBySyncGroupPager() { _ = 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.CloudEndpointArray = armstoragesync.CloudEndpointArray{ - // Value: []*armstoragesync.CloudEndpoint{ - // { - // Name: to.Ptr("CEP_Restore_08-08_Test112"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups/cloudEndpoints"), - // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/syncGroups/SyncGroup_Restore_08-08_Test112/cloudEndpoints/CEP_Restore_08-08_Test112"), - // Properties: &armstoragesync.CloudEndpointProperties{ - // AzureFileShareName: to.Ptr(""), - // ChangeEnumerationStatus: &armstoragesync.CloudEndpointChangeEnumerationStatus{ - // Activity: &armstoragesync.CloudEndpointChangeEnumerationActivity{ - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.096Z"); return t}()), - // MinutesRemaining: to.Ptr[int32](589), - // OperationState: to.Ptr(armstoragesync.CloudEndpointChangeEnumerationActivityState("Delayed")), - // ProcessedDirectoriesCount: to.Ptr[int64](364), - // ProcessedFilesCount: to.Ptr[int64](6948), - // ProgressPercent: to.Ptr[int32](67), - // StartedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.096Z"); return t}()), - // StatusCode: to.Ptr[int32](-1), - // TotalCountsState: to.Ptr(armstoragesync.CloudEndpointChangeEnumerationTotalCountsStateCalculating), - // TotalDirectoriesCount: to.Ptr[int64](694), - // TotalFilesCount: to.Ptr[int64](12834), - // TotalSizeBytes: to.Ptr[int64](5782301239408), + // page = armstoragesync.CloudEndpointsClientListBySyncGroupResponse{ + // CorrelationRequestID: "d166ca76-dad2-49df-b409-d2acfd42d730" + // RequestID: "74e55a4d-1c6f-46de-9a8d-278e53a47403" + // CloudEndpointArray: armstoragesync.CloudEndpointArray{ + // Value: []*armstoragesync.CloudEndpoint{ + // { + // Name: to.Ptr("CEP_Restore_08-08_Test112"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups/cloudEndpoints"), + // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/syncGroups/SyncGroup_Restore_08-08_Test112/cloudEndpoints/CEP_Restore_08-08_Test112"), + // Properties: &armstoragesync.CloudEndpointProperties{ + // AzureFileShareName: to.Ptr(""), + // ChangeEnumerationStatus: &armstoragesync.CloudEndpointChangeEnumerationStatus{ + // Activity: &armstoragesync.CloudEndpointChangeEnumerationActivity{ + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.0961891Z"); return t}()), + // MinutesRemaining: to.Ptr[int32](589), + // OperationState: to.Ptr(armstoragesync.CloudEndpointChangeEnumerationActivityState("Delayed")), + // ProcessedDirectoriesCount: to.Ptr[int64](364), + // ProcessedFilesCount: to.Ptr[int64](6948), + // ProgressPercent: to.Ptr[int32](67), + // StartedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.0961891Z"); return t}()), + // StatusCode: to.Ptr[int32](-1), + // TotalCountsState: to.Ptr(armstoragesync.CloudEndpointChangeEnumerationTotalCountsStateCalculating), + // TotalDirectoriesCount: to.Ptr[int64](694), + // TotalFilesCount: to.Ptr[int64](12834), + // TotalSizeBytes: to.Ptr[int64](5782301239408), + // }, + // LastEnumerationStatus: &armstoragesync.CloudEndpointLastChangeEnumerationStatus{ + // CompletedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.0961891Z"); return t}()), + // NamespaceDirectoriesCount: to.Ptr[int64](28), + // NamespaceFilesCount: to.Ptr[int64](3489), + // NamespaceSizeBytes: to.Ptr[int64](3248804), + // NextRunTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.0961891Z"); return t}()), + // StartedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.0961891Z"); return t}()), + // }, + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.0961891Z"); return t}()), // }, - // LastEnumerationStatus: &armstoragesync.CloudEndpointLastChangeEnumerationStatus{ - // CompletedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.096Z"); return t}()), - // NamespaceDirectoriesCount: to.Ptr[int64](28), - // NamespaceFilesCount: to.Ptr[int64](3489), - // NamespaceSizeBytes: to.Ptr[int64](3248804), - // NextRunTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.096Z"); return t}()), - // StartedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.096Z"); return t}()), - // }, - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:14:59.096Z"); return t}()), + // FriendlyName: to.Ptr("SampleAzureFileShareName_1"), + // LastOperationName: to.Ptr("ICreateCloudEndpointWorkflow"), + // LastWorkflowID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/workflows/a377fdd5-949a-40ab-9629-06cd0e9852f9"), + // PartnershipID: to.Ptr("1|U0VSVkVSQVNTWU5DQ0xJRU5Udfsdfdsfs8MTkxNjYwQ0QtNkExQS00RjhDLTk3ODctQTZCRUQyMDZBMUREfEdFTkVSSUN8M0EwNDgyODMtMzM4Ri00MDAyLUE5REQtQTUwRkRBRENCMzky"), + // ProvisioningState: to.Ptr("Succeeded"), + // StorageAccountResourceID: to.Ptr(""), + // StorageAccountTenantID: to.Ptr("\"a4d1b191-c1af-4cef-a14b-f670e0beea52\""), // }, - // FriendlyName: to.Ptr("SampleAzureFileShareName_1"), - // LastOperationName: to.Ptr("ICreateCloudEndpointWorkflow"), - // LastWorkflowID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/workflows/a377fdd5-949a-40ab-9629-06cd0e9852f9"), - // PartnershipID: to.Ptr("1|U0VSVkVSQVNTWU5DQ0xJRU5Udfsdfdsfs8MTkxNjYwQ0QtNkExQS00RjhDLTk3ODctQTZCRUQyMDZBMUREfEdFTkVSSUN8M0EwNDgyODMtMzM4Ri00MDAyLUE5REQtQTUwRkRBRENCMzky"), - // ProvisioningState: to.Ptr("Succeeded"), - // StorageAccountResourceID: to.Ptr(""), - // StorageAccountTenantID: to.Ptr("\"a4d1b191-c1af-4cef-a14b-f670e0beea52\""), // }, - // }}, + // }, + // }, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PreBackup.json -func ExampleCloudEndpointsClient_BeginPreBackup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudEndpointsClient().BeginPreBackup(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "SampleSyncGroup_1", "SampleCloudEndpoint_1", armstoragesync.BackupRequest{ - AzureFileShare: to.Ptr("https://sampleserver.file.core.test-cint.azure-test.net/sampleFileShare"), - }, 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/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PostBackup.json +// Generated from example definition: 2022-09-01/CloudEndpoints_PostBackup.json func ExampleCloudEndpointsClient_BeginPostBackup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -259,25 +277,27 @@ func ExampleCloudEndpointsClient_BeginPostBackup() { // 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.PostBackupResponse = armstoragesync.PostBackupResponse{ - // BackupMetadata: &armstoragesync.PostBackupResponseProperties{ - // CloudEndpointName: to.Ptr("subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/syncGroups/SampleSyncGroup_1/cloudEndpoints/SampleCloudEndpoint_1"), + // res = armstoragesync.CloudEndpointsClientPostBackupResponse{ + // PostBackupResponse: &armstoragesync.PostBackupResponse{ + // BackupMetadata: &armstoragesync.PostBackupResponseProperties{ + // CloudEndpointName: to.Ptr("subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/syncGroups/SampleSyncGroup_1/cloudEndpoints/SampleCloudEndpoint_1"), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PreRestore.json -func ExampleCloudEndpointsClient_BeginPreRestore() { +// Generated from example definition: 2022-09-01/CloudEndpoints_PostRestore.json +func ExampleCloudEndpointsClient_BeginPostRestore() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewCloudEndpointsClient().BeginPreRestore(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "SampleSyncGroup_1", "SampleCloudEndpoint_1", armstoragesync.PreRestoreRequest{ + poller, err := clientFactory.NewCloudEndpointsClient().BeginPostRestore(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "SampleSyncGroup_1", "SampleCloudEndpoint_1", armstoragesync.PostRestoreRequest{ AzureFileShareURI: to.Ptr("https://hfsazbackupdevintncus2.file.core.test-cint.azure-test.net/sampleFileShare"), RestoreFileSpec: []*armstoragesync.RestoreFileSpec{ { @@ -295,46 +315,65 @@ func ExampleCloudEndpointsClient_BeginPreRestore() { { Path: to.Ptr("MyDir/SubDir/File1.pdf"), Isdir: to.Ptr(false), - }}, + }, + }, + SourceAzureFileShareURI: to.Ptr("https://hfsazbackupdevintncus2.file.core.test-cint.azure-test.net/sampleFileShare"), + Status: to.Ptr("Succeeded"), }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + 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 = armstoragesync.CloudEndpointsClientPostRestoreResponse{ + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_RestoreHeatbeat.json -func ExampleCloudEndpointsClient_Restoreheartbeat() { +// Generated from example definition: 2022-09-01/CloudEndpoints_PreBackup.json +func ExampleCloudEndpointsClient_BeginPreBackup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = clientFactory.NewCloudEndpointsClient().Restoreheartbeat(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "SampleSyncGroup_1", "SampleCloudEndpoint_1", nil) + poller, err := clientFactory.NewCloudEndpointsClient().BeginPreBackup(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "SampleSyncGroup_1", "SampleCloudEndpoint_1", armstoragesync.BackupRequest{ + AzureFileShare: to.Ptr("https://sampleserver.file.core.test-cint.azure-test.net/sampleFileShare"), + }, 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 = armstoragesync.CloudEndpointsClientPreBackupResponse{ + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PostRestore.json -func ExampleCloudEndpointsClient_BeginPostRestore() { +// Generated from example definition: 2022-09-01/CloudEndpoints_PreRestore.json +func ExampleCloudEndpointsClient_BeginPreRestore() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewCloudEndpointsClient().BeginPostRestore(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "SampleSyncGroup_1", "SampleCloudEndpoint_1", armstoragesync.PostRestoreRequest{ + poller, err := clientFactory.NewCloudEndpointsClient().BeginPreRestore(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "SampleSyncGroup_1", "SampleCloudEndpoint_1", armstoragesync.PreRestoreRequest{ AzureFileShareURI: to.Ptr("https://hfsazbackupdevintncus2.file.core.test-cint.azure-test.net/sampleFileShare"), RestoreFileSpec: []*armstoragesync.RestoreFileSpec{ { @@ -352,27 +391,55 @@ func ExampleCloudEndpointsClient_BeginPostRestore() { { Path: to.Ptr("MyDir/SubDir/File1.pdf"), Isdir: to.Ptr(false), - }}, - SourceAzureFileShareURI: to.Ptr("https://hfsazbackupdevintncus2.file.core.test-cint.azure-test.net/sampleFileShare"), - Status: to.Ptr("Succeeded"), + }, + }, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + 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 = armstoragesync.CloudEndpointsClientPreRestoreResponse{ + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_TriggerChangeDetection.json +// Generated from example definition: 2022-09-01/CloudEndpoints_RestoreHeatbeat.json +func ExampleCloudEndpointsClient_Restoreheartbeat() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCloudEndpointsClient().Restoreheartbeat(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "SampleSyncGroup_1", "SampleCloudEndpoint_1", 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 = armstoragesync.CloudEndpointsClientRestoreheartbeatResponse{ + // CorrelationRequestID: "d166ca76-dad2-49df-b409-d2acfd42d730" + // RequestID: "74e55a4d-1c6f-46de-9a8d-278e53a47403" + // } +} + +// Generated from example definition: 2022-09-01/CloudEndpoints_TriggerChangeDetection.json func ExampleCloudEndpointsClient_BeginTriggerChangeDetection() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -383,8 +450,13 @@ func ExampleCloudEndpointsClient_BeginTriggerChangeDetection() { if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + 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 = armstoragesync.CloudEndpointsClientTriggerChangeDetectionResponse{ + // } } diff --git a/sdk/resourcemanager/storagesync/armstoragesync/constants.go b/sdk/resourcemanager/storagesync/armstoragesync/constants.go index 00329cdb0c86..ce570e49bec2 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/constants.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/constants.go @@ -1,15 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 armstoragesync -const ( - moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync" - moduleVersion = "v1.2.0" -) - // ChangeDetectionMode - Change Detection Mode. Applies to a directory specified in directoryPath parameter. type ChangeDetectionMode string @@ -58,14 +52,34 @@ func PossibleCloudEndpointChangeEnumerationTotalCountsStateValues() []CloudEndpo } } -// CreatedByType - The type of identity that created the resource. +// CloudTieringLowDiskModeState - Type of the cloud tiering low disk mode state +type CloudTieringLowDiskModeState string + +const ( + CloudTieringLowDiskModeStateDisabled CloudTieringLowDiskModeState = "Disabled" + CloudTieringLowDiskModeStateEnabled CloudTieringLowDiskModeState = "Enabled" +) + +// PossibleCloudTieringLowDiskModeStateValues returns the possible values for the CloudTieringLowDiskModeState const type. +func PossibleCloudTieringLowDiskModeStateValues() []CloudTieringLowDiskModeState { + return []CloudTieringLowDiskModeState{ + CloudTieringLowDiskModeStateDisabled, + CloudTieringLowDiskModeStateEnabled, + } +} + +// CreatedByType - The kind of entity that created the resource. type CreatedByType string const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" + // 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 CreatedByType = "User" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" ) // PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. @@ -161,6 +175,30 @@ func PossibleLocalCacheModeValues() []LocalCacheMode { } } +// 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, + } +} + // NameAvailabilityReason - Gets the reason that a Storage Sync Service name could not be used. The Reason element is only // returned if NameAvailable is false. type NameAvailabilityReason string @@ -200,9 +238,13 @@ func PossibleOperationDirectionValues() []OperationDirection { type PrivateEndpointConnectionProvisioningState string const ( - PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" - PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" - PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + // PrivateEndpointConnectionProvisioningStateCreating - Connection is being created + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + // PrivateEndpointConnectionProvisioningStateDeleting - Connection is being deleted + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + // PrivateEndpointConnectionProvisioningStateFailed - Connection provisioning has failed + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + // PrivateEndpointConnectionProvisioningStateSucceeded - Connection has been provisioned PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" ) @@ -220,8 +262,11 @@ func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpoin type PrivateEndpointServiceConnectionStatus string const ( + // PrivateEndpointServiceConnectionStatusApproved - Connection approved PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" - PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + // PrivateEndpointServiceConnectionStatusPending - Connection waiting for approval or rejection + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + // PrivateEndpointServiceConnectionStatusRejected - Connection Rejected PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" ) @@ -234,50 +279,6 @@ func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointSer } } -// ProgressType - Type of the ProgressType -type ProgressType string - -const ( - ProgressTypeDownload ProgressType = "download" - ProgressTypeInitialize ProgressType = "initialize" - ProgressTypeNone ProgressType = "none" - ProgressTypeRecall ProgressType = "recall" - ProgressTypeUpload ProgressType = "upload" -) - -// PossibleProgressTypeValues returns the possible values for the ProgressType const type. -func PossibleProgressTypeValues() []ProgressType { - return []ProgressType{ - ProgressTypeDownload, - ProgressTypeInitialize, - ProgressTypeNone, - ProgressTypeRecall, - ProgressTypeUpload, - } -} - -// Reason - State of Azure Subscription -type Reason string - -const ( - ReasonDeleted Reason = "Deleted" - ReasonRegistered Reason = "Registered" - ReasonSuspended Reason = "Suspended" - ReasonUnregistered Reason = "Unregistered" - ReasonWarned Reason = "Warned" -) - -// PossibleReasonValues returns the possible values for the Reason const type. -func PossibleReasonValues() []Reason { - return []Reason{ - ReasonDeleted, - ReasonRegistered, - ReasonSuspended, - ReasonUnregistered, - ReasonWarned, - } -} - // RegisteredServerAgentVersionStatus - Type of the registered server agent version status type RegisteredServerAgentVersionStatus string @@ -298,6 +299,22 @@ func PossibleRegisteredServerAgentVersionStatusValues() []RegisteredServerAgentV } } +// ServerAuthType - Type of the Server Auth type +type ServerAuthType string + +const ( + ServerAuthTypeCertificate ServerAuthType = "Certificate" + ServerAuthTypeManagedIdentity ServerAuthType = "ManagedIdentity" +) + +// PossibleServerAuthTypeValues returns the possible values for the ServerAuthType const type. +func PossibleServerAuthTypeValues() []ServerAuthType { + return []ServerAuthType{ + ServerAuthTypeCertificate, + ServerAuthTypeManagedIdentity, + } +} + // ServerEndpointHealthState - Type of the server endpoint health state type ServerEndpointHealthState string @@ -376,6 +393,28 @@ func PossibleServerEndpointSyncModeValues() []ServerEndpointSyncMode { } } +// ServerProvisioningStatus - Server provisioning status +type ServerProvisioningStatus string + +const ( + ServerProvisioningStatusError ServerProvisioningStatus = "Error" + ServerProvisioningStatusInProgress ServerProvisioningStatus = "InProgress" + ServerProvisioningStatusNotStarted ServerProvisioningStatus = "NotStarted" + ServerProvisioningStatusReadySyncFunctional ServerProvisioningStatus = "Ready_SyncFunctional" + ServerProvisioningStatusReadySyncNotFunctional ServerProvisioningStatus = "Ready_SyncNotFunctional" +) + +// PossibleServerProvisioningStatusValues returns the possible values for the ServerProvisioningStatus const type. +func PossibleServerProvisioningStatusValues() []ServerProvisioningStatus { + return []ServerProvisioningStatus{ + ServerProvisioningStatusError, + ServerProvisioningStatusInProgress, + ServerProvisioningStatusNotStarted, + ServerProvisioningStatusReadySyncFunctional, + ServerProvisioningStatusReadySyncNotFunctional, + } +} + // WorkflowStatus - Type of the Workflow Status type WorkflowStatus string diff --git a/sdk/resourcemanager/storagesync/armstoragesync/fake/cloudendpoints_server.go b/sdk/resourcemanager/storagesync/armstoragesync/fake/cloudendpoints_server.go index 801b8aa3c863..be58ce983f62 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/fake/cloudendpoints_server.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/fake/cloudendpoints_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 @@ -12,7 +11,8 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" "net/http" "net/url" "regexp" @@ -20,6 +20,10 @@ import ( // CloudEndpointsServer is a fake server for instances of the armstoragesync.CloudEndpointsClient type. type CloudEndpointsServer struct { + // AfsShareMetadataCertificatePublicKeys is the fake for method CloudEndpointsClient.AfsShareMetadataCertificatePublicKeys + // HTTP status codes to indicate success: http.StatusOK + AfsShareMetadataCertificatePublicKeys func(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, options *armstoragesync.CloudEndpointsClientAfsShareMetadataCertificatePublicKeysOptions) (resp azfake.Responder[armstoragesync.CloudEndpointsClientAfsShareMetadataCertificatePublicKeysResponse], errResp azfake.ErrorResponder) + // BeginCreate is the fake for method CloudEndpointsClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginCreate func(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters armstoragesync.CloudEndpointCreateParameters, options *armstoragesync.CloudEndpointsClientBeginCreateOptions) (resp azfake.PollerResponder[armstoragesync.CloudEndpointsClientCreateResponse], errResp azfake.ErrorResponder) @@ -41,15 +45,15 @@ type CloudEndpointsServer struct { BeginPostBackup func(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters armstoragesync.BackupRequest, options *armstoragesync.CloudEndpointsClientBeginPostBackupOptions) (resp azfake.PollerResponder[armstoragesync.CloudEndpointsClientPostBackupResponse], errResp azfake.ErrorResponder) // BeginPostRestore is the fake for method CloudEndpointsClient.BeginPostRestore - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginPostRestore func(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters armstoragesync.PostRestoreRequest, options *armstoragesync.CloudEndpointsClientBeginPostRestoreOptions) (resp azfake.PollerResponder[armstoragesync.CloudEndpointsClientPostRestoreResponse], errResp azfake.ErrorResponder) // BeginPreBackup is the fake for method CloudEndpointsClient.BeginPreBackup - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginPreBackup func(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters armstoragesync.BackupRequest, options *armstoragesync.CloudEndpointsClientBeginPreBackupOptions) (resp azfake.PollerResponder[armstoragesync.CloudEndpointsClientPreBackupResponse], errResp azfake.ErrorResponder) // BeginPreRestore is the fake for method CloudEndpointsClient.BeginPreRestore - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginPreRestore func(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters armstoragesync.PreRestoreRequest, options *armstoragesync.CloudEndpointsClientBeginPreRestoreOptions) (resp azfake.PollerResponder[armstoragesync.CloudEndpointsClientPreRestoreResponse], errResp azfake.ErrorResponder) // Restoreheartbeat is the fake for method CloudEndpointsClient.Restoreheartbeat @@ -57,7 +61,7 @@ type CloudEndpointsServer struct { Restoreheartbeat func(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, options *armstoragesync.CloudEndpointsClientRestoreheartbeatOptions) (resp azfake.Responder[armstoragesync.CloudEndpointsClientRestoreheartbeatResponse], errResp azfake.ErrorResponder) // BeginTriggerChangeDetection is the fake for method CloudEndpointsClient.BeginTriggerChangeDetection - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginTriggerChangeDetection func(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters armstoragesync.TriggerChangeDetectionParameters, options *armstoragesync.CloudEndpointsClientBeginTriggerChangeDetectionOptions) (resp azfake.PollerResponder[armstoragesync.CloudEndpointsClientTriggerChangeDetectionResponse], errResp azfake.ErrorResponder) } @@ -100,38 +104,106 @@ func (c *CloudEndpointsServerTransport) Do(req *http.Request) (*http.Response, e return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "CloudEndpointsClient.BeginCreate": - resp, err = c.dispatchBeginCreate(req) - case "CloudEndpointsClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "CloudEndpointsClient.Get": - resp, err = c.dispatchGet(req) - case "CloudEndpointsClient.NewListBySyncGroupPager": - resp, err = c.dispatchNewListBySyncGroupPager(req) - case "CloudEndpointsClient.BeginPostBackup": - resp, err = c.dispatchBeginPostBackup(req) - case "CloudEndpointsClient.BeginPostRestore": - resp, err = c.dispatchBeginPostRestore(req) - case "CloudEndpointsClient.BeginPreBackup": - resp, err = c.dispatchBeginPreBackup(req) - case "CloudEndpointsClient.BeginPreRestore": - resp, err = c.dispatchBeginPreRestore(req) - case "CloudEndpointsClient.Restoreheartbeat": - resp, err = c.dispatchRestoreheartbeat(req) - case "CloudEndpointsClient.BeginTriggerChangeDetection": - resp, err = c.dispatchBeginTriggerChangeDetection(req) - default: - err = fmt.Errorf("unhandled API %s", method) + return c.dispatchToMethodFake(req, method) +} + +func (c *CloudEndpointsServerTransport) 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 cloudEndpointsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = cloudEndpointsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CloudEndpointsClient.AfsShareMetadataCertificatePublicKeys": + res.resp, res.err = c.dispatchAfsShareMetadataCertificatePublicKeys(req) + case "CloudEndpointsClient.BeginCreate": + res.resp, res.err = c.dispatchBeginCreate(req) + case "CloudEndpointsClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "CloudEndpointsClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CloudEndpointsClient.NewListBySyncGroupPager": + res.resp, res.err = c.dispatchNewListBySyncGroupPager(req) + case "CloudEndpointsClient.BeginPostBackup": + res.resp, res.err = c.dispatchBeginPostBackup(req) + case "CloudEndpointsClient.BeginPostRestore": + res.resp, res.err = c.dispatchBeginPostRestore(req) + case "CloudEndpointsClient.BeginPreBackup": + res.resp, res.err = c.dispatchBeginPreBackup(req) + case "CloudEndpointsClient.BeginPreRestore": + res.resp, res.err = c.dispatchBeginPreRestore(req) + case "CloudEndpointsClient.Restoreheartbeat": + res.resp, res.err = c.dispatchRestoreheartbeat(req) + case "CloudEndpointsClient.BeginTriggerChangeDetection": + res.resp, res.err = c.dispatchBeginTriggerChangeDetection(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 *CloudEndpointsServerTransport) dispatchAfsShareMetadataCertificatePublicKeys(req *http.Request) (*http.Response, error) { + if c.srv.AfsShareMetadataCertificatePublicKeys == nil { + return nil, &nonRetriableError{errors.New("fake for method AfsShareMetadataCertificatePublicKeys not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cloudEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/afsShareMetadataCertificatePublicKeys` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 6 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) if err != nil { return nil, err } - + storageSyncServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("storageSyncServiceName")]) + if err != nil { + return nil, err + } + syncGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("syncGroupName")]) + if err != nil { + return nil, err + } + cloudEndpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudEndpointName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.AfsShareMetadataCertificatePublicKeys(req.Context(), resourceGroupNameParam, storageSyncServiceNameParam, syncGroupNameParam, cloudEndpointNameParam, 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).CloudEndpointAfsShareMetadataCertificatePublicKeys, req) + if err != nil { + return nil, err + } + if val := server.GetResponse(respr).CorrelationRequestID; val != nil { + resp.Header.Set("x-ms-correlation-request-id", *val) + } + if val := server.GetResponse(respr).RequestID; val != nil { + resp.Header.Set("x-ms-request-id", *val) + } return resp, nil } @@ -144,7 +216,7 @@ func (c *CloudEndpointsServerTransport) dispatchBeginCreate(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cloudEndpoints/(?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) } body, err := server.UnmarshalRequestAsJSON[armstoragesync.CloudEndpointCreateParameters](req) @@ -200,7 +272,7 @@ func (c *CloudEndpointsServerTransport) dispatchBeginDelete(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cloudEndpoints/(?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")]) @@ -250,7 +322,7 @@ func (c *CloudEndpointsServerTransport) dispatchGet(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cloudEndpoints/(?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")]) @@ -281,10 +353,10 @@ func (c *CloudEndpointsServerTransport) dispatchGet(req *http.Request) (*http.Re if err != nil { return nil, err } - if val := server.GetResponse(respr).XMSCorrelationRequestID; val != nil { + if val := server.GetResponse(respr).CorrelationRequestID; val != nil { resp.Header.Set("x-ms-correlation-request-id", *val) } - if val := server.GetResponse(respr).XMSRequestID; val != nil { + if val := server.GetResponse(respr).RequestID; val != nil { resp.Header.Set("x-ms-request-id", *val) } return resp, nil @@ -299,7 +371,7 @@ func (c *CloudEndpointsServerTransport) dispatchNewListBySyncGroupPager(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cloudEndpoints` 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")]) @@ -317,6 +389,9 @@ func (c *CloudEndpointsServerTransport) dispatchNewListBySyncGroupPager(req *htt resp := c.srv.NewListBySyncGroupPager(resourceGroupNameParam, storageSyncServiceNameParam, syncGroupNameParam, nil) newListBySyncGroupPager = &resp c.newListBySyncGroupPager.add(req, newListBySyncGroupPager) + server.PagerResponderInjectNextLinks(newListBySyncGroupPager, req, func(page *armstoragesync.CloudEndpointsClientListBySyncGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListBySyncGroupPager, req) if err != nil { @@ -341,7 +416,7 @@ func (c *CloudEndpointsServerTransport) dispatchBeginPostBackup(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cloudEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/postbackup` 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) } body, err := server.UnmarshalRequestAsJSON[armstoragesync.BackupRequest](req) @@ -397,7 +472,7 @@ func (c *CloudEndpointsServerTransport) dispatchBeginPostRestore(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cloudEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/postrestore` 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) } body, err := server.UnmarshalRequestAsJSON[armstoragesync.PostRestoreRequest](req) @@ -433,9 +508,9 @@ func (c *CloudEndpointsServerTransport) dispatchBeginPostRestore(req *http.Reque return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginPostRestore.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", 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(beginPostRestore) { c.beginPostRestore.remove(req) @@ -453,7 +528,7 @@ func (c *CloudEndpointsServerTransport) dispatchBeginPreBackup(req *http.Request const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cloudEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/prebackup` 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) } body, err := server.UnmarshalRequestAsJSON[armstoragesync.BackupRequest](req) @@ -489,9 +564,9 @@ func (c *CloudEndpointsServerTransport) dispatchBeginPreBackup(req *http.Request return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginPreBackup.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", 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(beginPreBackup) { c.beginPreBackup.remove(req) @@ -509,7 +584,7 @@ func (c *CloudEndpointsServerTransport) dispatchBeginPreRestore(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cloudEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/prerestore` 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) } body, err := server.UnmarshalRequestAsJSON[armstoragesync.PreRestoreRequest](req) @@ -545,9 +620,9 @@ func (c *CloudEndpointsServerTransport) dispatchBeginPreRestore(req *http.Reques return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginPreRestore.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", 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(beginPreRestore) { c.beginPreRestore.remove(req) @@ -563,7 +638,7 @@ func (c *CloudEndpointsServerTransport) dispatchRestoreheartbeat(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cloudEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/restoreheartbeat` 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")]) @@ -594,10 +669,10 @@ func (c *CloudEndpointsServerTransport) dispatchRestoreheartbeat(req *http.Reque if err != nil { return nil, err } - if val := server.GetResponse(respr).XMSCorrelationRequestID; val != nil { + if val := server.GetResponse(respr).CorrelationRequestID; val != nil { resp.Header.Set("x-ms-correlation-request-id", *val) } - if val := server.GetResponse(respr).XMSRequestID; val != nil { + if val := server.GetResponse(respr).RequestID; val != nil { resp.Header.Set("x-ms-request-id", *val) } return resp, nil @@ -612,7 +687,7 @@ func (c *CloudEndpointsServerTransport) dispatchBeginTriggerChangeDetection(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cloudEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/triggerChangeDetection` 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) } body, err := server.UnmarshalRequestAsJSON[armstoragesync.TriggerChangeDetectionParameters](req) @@ -648,9 +723,9 @@ func (c *CloudEndpointsServerTransport) dispatchBeginTriggerChangeDetection(req return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginTriggerChangeDetection.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", 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(beginTriggerChangeDetection) { c.beginTriggerChangeDetection.remove(req) @@ -658,3 +733,9 @@ func (c *CloudEndpointsServerTransport) dispatchBeginTriggerChangeDetection(req return resp, nil } + +// set this to conditionally intercept incoming requests to CloudEndpointsServerTransport +var cloudEndpointsServerTransportInterceptor 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/storagesync/armstoragesync/fake/internal.go b/sdk/resourcemanager/storagesync/armstoragesync/fake/internal.go index a56f57fc156d..d9ae2e5818f8 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/fake/internal.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/fake/internal.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 @@ -11,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } @@ -28,6 +32,14 @@ func contains[T comparable](s []T, v T) bool { return false } +func initServer[T any](mu *sync.Mutex, dst **T, src func() *T) { + mu.Lock() + if *dst == nil { + *dst = src() + } + mu.Unlock() +} + func newTracker[T any]() *tracker[T] { return &tracker[T]{ items: map[string]*T{}, diff --git a/sdk/resourcemanager/storagesync/armstoragesync/fake/microsoftstoragesync_server.go b/sdk/resourcemanager/storagesync/armstoragesync/fake/microsoftstoragesync_server.go index b6779a52fcac..c55855b41758 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/fake/microsoftstoragesync_server.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/fake/microsoftstoragesync_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 @@ -12,7 +11,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" "net/http" "net/url" "regexp" @@ -46,21 +45,40 @@ func (m *MicrosoftStorageSyncServerTransport) 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 m.dispatchToMethodFake(req, method) +} - switch method { - case "MicrosoftStorageSyncClient.LocationOperationStatus": - resp, err = m.dispatchLocationOperationStatus(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (m *MicrosoftStorageSyncServerTransport) 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 microsoftStorageSyncServerTransportInterceptor != nil { + res.resp, res.err, intercepted = microsoftStorageSyncServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "MicrosoftStorageSyncClient.LocationOperationStatus": + res.resp, res.err = m.dispatchLocationOperationStatus(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 (m *MicrosoftStorageSyncServerTransport) dispatchLocationOperationStatus(req *http.Request) (*http.Response, error) { @@ -70,7 +88,7 @@ func (m *MicrosoftStorageSyncServerTransport) dispatchLocationOperationStatus(re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/locations/(?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) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationName")]) @@ -93,11 +111,17 @@ func (m *MicrosoftStorageSyncServerTransport) dispatchLocationOperationStatus(re if err != nil { return nil, err } - if val := server.GetResponse(respr).XMSCorrelationRequestID; val != nil { + if val := server.GetResponse(respr).CorrelationRequestID; val != nil { resp.Header.Set("x-ms-correlation-request-id", *val) } - if val := server.GetResponse(respr).XMSRequestID; val != nil { + if val := server.GetResponse(respr).RequestID; val != nil { resp.Header.Set("x-ms-request-id", *val) } return resp, nil } + +// set this to conditionally intercept incoming requests to MicrosoftStorageSyncServerTransport +var microsoftStorageSyncServerTransportInterceptor 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/storagesync/armstoragesync/fake/operations_server.go b/sdk/resourcemanager/storagesync/armstoragesync/fake/operations_server.go index d8de2abf0e46..c57021fda759 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/fake/operations_server.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/fake/operations_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 @@ -12,7 +11,7 @@ import ( "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/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" "net/http" ) @@ -48,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) { @@ -91,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/storagesync/armstoragesync/fake/operationstatus_server.go b/sdk/resourcemanager/storagesync/armstoragesync/fake/operationstatus_server.go index f89b2a6efd7e..6ce5ac8ba2fb 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/fake/operationstatus_server.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/fake/operationstatus_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 @@ -12,7 +11,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" "net/http" "net/url" "regexp" @@ -46,21 +45,40 @@ func (o *OperationStatusServerTransport) Do(req *http.Request) (*http.Response, 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 "OperationStatusClient.Get": - resp, err = o.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationStatusServerTransport) 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 operationStatusServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationStatusServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationStatusClient.Get": + res.resp, res.err = o.dispatchGet(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 *OperationStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -70,7 +88,7 @@ func (o *OperationStatusServerTransport) dispatchGet(req *http.Request) (*http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/workflows/(?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 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -101,11 +119,17 @@ func (o *OperationStatusServerTransport) dispatchGet(req *http.Request) (*http.R if err != nil { return nil, err } - if val := server.GetResponse(respr).XMSCorrelationRequestID; val != nil { + if val := server.GetResponse(respr).CorrelationRequestID; val != nil { resp.Header.Set("x-ms-correlation-request-id", *val) } - if val := server.GetResponse(respr).XMSRequestID; val != nil { + if val := server.GetResponse(respr).RequestID; val != nil { resp.Header.Set("x-ms-request-id", *val) } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationStatusServerTransport +var operationStatusServerTransportInterceptor 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/storagesync/armstoragesync/fake/privateendpointconnections_server.go b/sdk/resourcemanager/storagesync/armstoragesync/fake/privateendpointconnections_server.go index 98cc2df4159b..8afa4a8d80ba 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/fake/privateendpointconnections_server.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/fake/privateendpointconnections_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 @@ -12,7 +11,8 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" "net/http" "net/url" "regexp" @@ -66,27 +66,46 @@ func (p *PrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http 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 "PrivateEndpointConnectionsClient.BeginCreate": - resp, err = p.dispatchBeginCreate(req) - case "PrivateEndpointConnectionsClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PrivateEndpointConnectionsClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateEndpointConnectionsClient.NewListByStorageSyncServicePager": - resp, err = p.dispatchNewListByStorageSyncServicePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PrivateEndpointConnectionsServerTransport) 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 privateEndpointConnectionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateEndpointConnectionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateEndpointConnectionsClient.BeginCreate": + res.resp, res.err = p.dispatchBeginCreate(req) + case "PrivateEndpointConnectionsClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PrivateEndpointConnectionsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateEndpointConnectionsClient.NewListByStorageSyncServicePager": + res.resp, res.err = p.dispatchNewListByStorageSyncServicePager(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 *PrivateEndpointConnectionsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -98,7 +117,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreate(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armstoragesync.PrivateEndpointConnection](req) @@ -150,7 +169,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -196,7 +215,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -235,7 +254,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListByStorageSync const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections` 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")]) @@ -249,6 +268,9 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListByStorageSync resp := p.srv.NewListByStorageSyncServicePager(resourceGroupNameParam, storageSyncServiceNameParam, nil) newListByStorageSyncServicePager = &resp p.newListByStorageSyncServicePager.add(req, newListByStorageSyncServicePager) + server.PagerResponderInjectNextLinks(newListByStorageSyncServicePager, req, func(page *armstoragesync.PrivateEndpointConnectionsClientListByStorageSyncServiceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListByStorageSyncServicePager, req) if err != nil { @@ -263,3 +285,9 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListByStorageSync } 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/storagesync/armstoragesync/fake/privatelinkresources_server.go b/sdk/resourcemanager/storagesync/armstoragesync/fake/privatelinkresources_server.go index 3124fb5790b9..784f51e7140d 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/fake/privatelinkresources_server.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/fake/privatelinkresources_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 @@ -12,7 +11,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" "net/http" "net/url" "regexp" @@ -46,21 +45,40 @@ func (p *PrivateLinkResourcesServerTransport) 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 p.dispatchToMethodFake(req, method) +} - switch method { - case "PrivateLinkResourcesClient.ListByStorageSyncService": - resp, err = p.dispatchListByStorageSyncService(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PrivateLinkResourcesServerTransport) 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 privateLinkResourcesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateLinkResourcesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateLinkResourcesClient.ListByStorageSyncService": + res.resp, res.err = p.dispatchListByStorageSyncService(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 *PrivateLinkResourcesServerTransport) dispatchListByStorageSyncService(req *http.Request) (*http.Response, error) { @@ -70,7 +88,7 @@ func (p *PrivateLinkResourcesServerTransport) dispatchListByStorageSyncService(r const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources` 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")]) @@ -95,3 +113,9 @@ func (p *PrivateLinkResourcesServerTransport) dispatchListByStorageSyncService(r } 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/storagesync/armstoragesync/fake/registeredservers_server.go b/sdk/resourcemanager/storagesync/armstoragesync/fake/registeredservers_server.go index b295c678c357..4e26360b6446 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/fake/registeredservers_server.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/fake/registeredservers_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 @@ -12,7 +11,8 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" "net/http" "net/url" "regexp" @@ -37,8 +37,12 @@ type RegisteredServersServer struct { NewListByStorageSyncServicePager func(resourceGroupName string, storageSyncServiceName string, options *armstoragesync.RegisteredServersClientListByStorageSyncServiceOptions) (resp azfake.PagerResponder[armstoragesync.RegisteredServersClientListByStorageSyncServiceResponse]) // BeginTriggerRollover is the fake for method RegisteredServersClient.BeginTriggerRollover - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginTriggerRollover func(ctx context.Context, resourceGroupName string, storageSyncServiceName string, serverID string, parameters armstoragesync.TriggerRolloverRequest, options *armstoragesync.RegisteredServersClientBeginTriggerRolloverOptions) (resp azfake.PollerResponder[armstoragesync.RegisteredServersClientTriggerRolloverResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method RegisteredServersClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, storageSyncServiceName string, serverID string, parameters armstoragesync.RegisteredServerUpdateParameters, options *armstoragesync.RegisteredServersClientBeginUpdateOptions) (resp azfake.PollerResponder[armstoragesync.RegisteredServersClientUpdateResponse], errResp azfake.ErrorResponder) } // NewRegisteredServersServerTransport creates a new instance of RegisteredServersServerTransport with the provided implementation. @@ -51,6 +55,7 @@ func NewRegisteredServersServerTransport(srv *RegisteredServersServer) *Register beginDelete: newTracker[azfake.PollerResponder[armstoragesync.RegisteredServersClientDeleteResponse]](), newListByStorageSyncServicePager: newTracker[azfake.PagerResponder[armstoragesync.RegisteredServersClientListByStorageSyncServiceResponse]](), beginTriggerRollover: newTracker[azfake.PollerResponder[armstoragesync.RegisteredServersClientTriggerRolloverResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armstoragesync.RegisteredServersClientUpdateResponse]](), } } @@ -62,6 +67,7 @@ type RegisteredServersServerTransport struct { beginDelete *tracker[azfake.PollerResponder[armstoragesync.RegisteredServersClientDeleteResponse]] newListByStorageSyncServicePager *tracker[azfake.PagerResponder[armstoragesync.RegisteredServersClientListByStorageSyncServiceResponse]] beginTriggerRollover *tracker[azfake.PollerResponder[armstoragesync.RegisteredServersClientTriggerRolloverResponse]] + beginUpdate *tracker[azfake.PollerResponder[armstoragesync.RegisteredServersClientUpdateResponse]] } // Do implements the policy.Transporter interface for RegisteredServersServerTransport. @@ -72,29 +78,50 @@ func (r *RegisteredServersServerTransport) Do(req *http.Request) (*http.Response 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 "RegisteredServersClient.BeginCreate": - resp, err = r.dispatchBeginCreate(req) - case "RegisteredServersClient.BeginDelete": - resp, err = r.dispatchBeginDelete(req) - case "RegisteredServersClient.Get": - resp, err = r.dispatchGet(req) - case "RegisteredServersClient.NewListByStorageSyncServicePager": - resp, err = r.dispatchNewListByStorageSyncServicePager(req) - case "RegisteredServersClient.BeginTriggerRollover": - resp, err = r.dispatchBeginTriggerRollover(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *RegisteredServersServerTransport) 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 registeredServersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = registeredServersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "RegisteredServersClient.BeginCreate": + res.resp, res.err = r.dispatchBeginCreate(req) + case "RegisteredServersClient.BeginDelete": + res.resp, res.err = r.dispatchBeginDelete(req) + case "RegisteredServersClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "RegisteredServersClient.NewListByStorageSyncServicePager": + res.resp, res.err = r.dispatchNewListByStorageSyncServicePager(req) + case "RegisteredServersClient.BeginTriggerRollover": + res.resp, res.err = r.dispatchBeginTriggerRollover(req) + case "RegisteredServersClient.BeginUpdate": + res.resp, res.err = r.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 (r *RegisteredServersServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -106,7 +133,7 @@ func (r *RegisteredServersServerTransport) dispatchBeginCreate(req *http.Request const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/registeredServers/(?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[armstoragesync.RegisteredServerCreateParameters](req) @@ -158,7 +185,7 @@ func (r *RegisteredServersServerTransport) dispatchBeginDelete(req *http.Request const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/registeredServers/(?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")]) @@ -204,7 +231,7 @@ func (r *RegisteredServersServerTransport) dispatchGet(req *http.Request) (*http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/registeredServers/(?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")]) @@ -231,10 +258,10 @@ func (r *RegisteredServersServerTransport) dispatchGet(req *http.Request) (*http if err != nil { return nil, err } - if val := server.GetResponse(respr).XMSCorrelationRequestID; val != nil { + if val := server.GetResponse(respr).CorrelationRequestID; val != nil { resp.Header.Set("x-ms-correlation-request-id", *val) } - if val := server.GetResponse(respr).XMSRequestID; val != nil { + if val := server.GetResponse(respr).RequestID; val != nil { resp.Header.Set("x-ms-request-id", *val) } return resp, nil @@ -249,7 +276,7 @@ func (r *RegisteredServersServerTransport) dispatchNewListByStorageSyncServicePa const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/registeredServers` 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")]) @@ -263,6 +290,9 @@ func (r *RegisteredServersServerTransport) dispatchNewListByStorageSyncServicePa resp := r.srv.NewListByStorageSyncServicePager(resourceGroupNameParam, storageSyncServiceNameParam, nil) newListByStorageSyncServicePager = &resp r.newListByStorageSyncServicePager.add(req, newListByStorageSyncServicePager) + server.PagerResponderInjectNextLinks(newListByStorageSyncServicePager, req, func(page *armstoragesync.RegisteredServersClientListByStorageSyncServiceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListByStorageSyncServicePager, req) if err != nil { @@ -287,7 +317,7 @@ func (r *RegisteredServersServerTransport) dispatchBeginTriggerRollover(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/registeredServers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/triggerRollover` 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[armstoragesync.TriggerRolloverRequest](req) @@ -319,9 +349,9 @@ func (r *RegisteredServersServerTransport) dispatchBeginTriggerRollover(req *htt return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { r.beginTriggerRollover.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", 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(beginTriggerRollover) { r.beginTriggerRollover.remove(req) @@ -329,3 +359,61 @@ func (r *RegisteredServersServerTransport) dispatchBeginTriggerRollover(req *htt return resp, nil } + +func (r *RegisteredServersServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if r.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := r.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/registeredServers/(?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[armstoragesync.RegisteredServerUpdateParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + storageSyncServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("storageSyncServiceName")]) + if err != nil { + return nil, err + } + serverIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("serverId")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginUpdate(req.Context(), resourceGroupNameParam, storageSyncServiceNameParam, serverIDParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + r.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) { + r.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) { + r.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to RegisteredServersServerTransport +var registeredServersServerTransportInterceptor 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/storagesync/armstoragesync/fake/server_factory.go b/sdk/resourcemanager/storagesync/armstoragesync/fake/server_factory.go index 038fd363364d..9d06609a6ef3 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/fake/server_factory.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/fake/server_factory.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 @@ -16,17 +15,38 @@ import ( // ServerFactory is a fake server for instances of the armstoragesync.ClientFactory type. type ServerFactory struct { - CloudEndpointsServer CloudEndpointsServer - MicrosoftStorageSyncServer MicrosoftStorageSyncServer - OperationStatusServer OperationStatusServer - OperationsServer OperationsServer + // CloudEndpointsServer contains the fakes for client CloudEndpointsClient + CloudEndpointsServer CloudEndpointsServer + + // MicrosoftStorageSyncServer contains the fakes for client MicrosoftStorageSyncClient + MicrosoftStorageSyncServer MicrosoftStorageSyncServer + + // OperationStatusServer contains the fakes for client OperationStatusClient + OperationStatusServer OperationStatusServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // PrivateEndpointConnectionsServer contains the fakes for client PrivateEndpointConnectionsClient PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer - PrivateLinkResourcesServer PrivateLinkResourcesServer - RegisteredServersServer RegisteredServersServer - ServerEndpointsServer ServerEndpointsServer - ServicesServer ServicesServer - SyncGroupsServer SyncGroupsServer - WorkflowsServer WorkflowsServer + + // PrivateLinkResourcesServer contains the fakes for client PrivateLinkResourcesClient + PrivateLinkResourcesServer PrivateLinkResourcesServer + + // RegisteredServersServer contains the fakes for client RegisteredServersClient + RegisteredServersServer RegisteredServersServer + + // ServerEndpointsServer contains the fakes for client ServerEndpointsClient + ServerEndpointsServer ServerEndpointsServer + + // ServicesServer contains the fakes for client ServicesClient + ServicesServer ServicesServer + + // SyncGroupsServer contains the fakes for client SyncGroupsClient + SyncGroupsServer SyncGroupsServer + + // WorkflowsServer contains the fakes for client WorkflowsClient + WorkflowsServer WorkflowsServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -70,51 +90,51 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { switch client { case "CloudEndpointsClient": - initServer(s, &s.trCloudEndpointsServer, func() *CloudEndpointsServerTransport { + initServer(&s.trMu, &s.trCloudEndpointsServer, func() *CloudEndpointsServerTransport { return NewCloudEndpointsServerTransport(&s.srv.CloudEndpointsServer) }) resp, err = s.trCloudEndpointsServer.Do(req) case "MicrosoftStorageSyncClient": - initServer(s, &s.trMicrosoftStorageSyncServer, func() *MicrosoftStorageSyncServerTransport { + initServer(&s.trMu, &s.trMicrosoftStorageSyncServer, func() *MicrosoftStorageSyncServerTransport { return NewMicrosoftStorageSyncServerTransport(&s.srv.MicrosoftStorageSyncServer) }) resp, err = s.trMicrosoftStorageSyncServer.Do(req) case "OperationStatusClient": - initServer(s, &s.trOperationStatusServer, func() *OperationStatusServerTransport { + initServer(&s.trMu, &s.trOperationStatusServer, func() *OperationStatusServerTransport { return NewOperationStatusServerTransport(&s.srv.OperationStatusServer) }) resp, err = s.trOperationStatusServer.Do(req) case "OperationsClient": - initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + initServer(&s.trMu, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) case "PrivateEndpointConnectionsClient": - initServer(s, &s.trPrivateEndpointConnectionsServer, func() *PrivateEndpointConnectionsServerTransport { + initServer(&s.trMu, &s.trPrivateEndpointConnectionsServer, func() *PrivateEndpointConnectionsServerTransport { return NewPrivateEndpointConnectionsServerTransport(&s.srv.PrivateEndpointConnectionsServer) }) resp, err = s.trPrivateEndpointConnectionsServer.Do(req) case "PrivateLinkResourcesClient": - initServer(s, &s.trPrivateLinkResourcesServer, func() *PrivateLinkResourcesServerTransport { + initServer(&s.trMu, &s.trPrivateLinkResourcesServer, func() *PrivateLinkResourcesServerTransport { return NewPrivateLinkResourcesServerTransport(&s.srv.PrivateLinkResourcesServer) }) resp, err = s.trPrivateLinkResourcesServer.Do(req) case "RegisteredServersClient": - initServer(s, &s.trRegisteredServersServer, func() *RegisteredServersServerTransport { + initServer(&s.trMu, &s.trRegisteredServersServer, func() *RegisteredServersServerTransport { return NewRegisteredServersServerTransport(&s.srv.RegisteredServersServer) }) resp, err = s.trRegisteredServersServer.Do(req) case "ServerEndpointsClient": - initServer(s, &s.trServerEndpointsServer, func() *ServerEndpointsServerTransport { + initServer(&s.trMu, &s.trServerEndpointsServer, func() *ServerEndpointsServerTransport { return NewServerEndpointsServerTransport(&s.srv.ServerEndpointsServer) }) resp, err = s.trServerEndpointsServer.Do(req) case "ServicesClient": - initServer(s, &s.trServicesServer, func() *ServicesServerTransport { return NewServicesServerTransport(&s.srv.ServicesServer) }) + initServer(&s.trMu, &s.trServicesServer, func() *ServicesServerTransport { return NewServicesServerTransport(&s.srv.ServicesServer) }) resp, err = s.trServicesServer.Do(req) case "SyncGroupsClient": - initServer(s, &s.trSyncGroupsServer, func() *SyncGroupsServerTransport { return NewSyncGroupsServerTransport(&s.srv.SyncGroupsServer) }) + initServer(&s.trMu, &s.trSyncGroupsServer, func() *SyncGroupsServerTransport { return NewSyncGroupsServerTransport(&s.srv.SyncGroupsServer) }) resp, err = s.trSyncGroupsServer.Do(req) case "WorkflowsClient": - initServer(s, &s.trWorkflowsServer, func() *WorkflowsServerTransport { return NewWorkflowsServerTransport(&s.srv.WorkflowsServer) }) + initServer(&s.trMu, &s.trWorkflowsServer, func() *WorkflowsServerTransport { return NewWorkflowsServerTransport(&s.srv.WorkflowsServer) }) resp, err = s.trWorkflowsServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) @@ -126,11 +146,3 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return resp, nil } - -func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { - s.trMu.Lock() - if *dst == nil { - *dst = src() - } - s.trMu.Unlock() -} diff --git a/sdk/resourcemanager/storagesync/armstoragesync/fake/serverendpoints_server.go b/sdk/resourcemanager/storagesync/armstoragesync/fake/serverendpoints_server.go index 1eb230f0ae69..76ce4c6e3978 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/fake/serverendpoints_server.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/fake/serverendpoints_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 @@ -12,10 +11,10 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" "net/http" "net/url" - "reflect" "regexp" ) @@ -26,7 +25,7 @@ type ServerEndpointsServer struct { BeginCreate func(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, parameters armstoragesync.ServerEndpointCreateParameters, options *armstoragesync.ServerEndpointsClientBeginCreateOptions) (resp azfake.PollerResponder[armstoragesync.ServerEndpointsClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method ServerEndpointsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, options *armstoragesync.ServerEndpointsClientBeginDeleteOptions) (resp azfake.PollerResponder[armstoragesync.ServerEndpointsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method ServerEndpointsClient.Get @@ -38,12 +37,12 @@ type ServerEndpointsServer struct { NewListBySyncGroupPager func(resourceGroupName string, storageSyncServiceName string, syncGroupName string, options *armstoragesync.ServerEndpointsClientListBySyncGroupOptions) (resp azfake.PagerResponder[armstoragesync.ServerEndpointsClientListBySyncGroupResponse]) // BeginRecallAction is the fake for method ServerEndpointsClient.BeginRecallAction - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginRecallAction func(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, parameters armstoragesync.RecallActionParameters, options *armstoragesync.ServerEndpointsClientBeginRecallActionOptions) (resp azfake.PollerResponder[armstoragesync.ServerEndpointsClientRecallActionResponse], errResp azfake.ErrorResponder) // BeginUpdate is the fake for method ServerEndpointsClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, options *armstoragesync.ServerEndpointsClientBeginUpdateOptions) (resp azfake.PollerResponder[armstoragesync.ServerEndpointsClientUpdateResponse], errResp azfake.ErrorResponder) + BeginUpdate func(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, parameters armstoragesync.ServerEndpointUpdateParameters, options *armstoragesync.ServerEndpointsClientBeginUpdateOptions) (resp azfake.PollerResponder[armstoragesync.ServerEndpointsClientUpdateResponse], errResp azfake.ErrorResponder) } // NewServerEndpointsServerTransport creates a new instance of ServerEndpointsServerTransport with the provided implementation. @@ -79,31 +78,50 @@ func (s *ServerEndpointsServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "ServerEndpointsClient.BeginCreate": - resp, err = s.dispatchBeginCreate(req) - case "ServerEndpointsClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "ServerEndpointsClient.Get": - resp, err = s.dispatchGet(req) - case "ServerEndpointsClient.NewListBySyncGroupPager": - resp, err = s.dispatchNewListBySyncGroupPager(req) - case "ServerEndpointsClient.BeginRecallAction": - resp, err = s.dispatchBeginRecallAction(req) - case "ServerEndpointsClient.BeginUpdate": - resp, err = s.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *ServerEndpointsServerTransport) 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 serverEndpointsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = serverEndpointsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ServerEndpointsClient.BeginCreate": + res.resp, res.err = s.dispatchBeginCreate(req) + case "ServerEndpointsClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "ServerEndpointsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "ServerEndpointsClient.NewListBySyncGroupPager": + res.resp, res.err = s.dispatchNewListBySyncGroupPager(req) + case "ServerEndpointsClient.BeginRecallAction": + res.resp, res.err = s.dispatchBeginRecallAction(req) + case "ServerEndpointsClient.BeginUpdate": + res.resp, res.err = s.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *ServerEndpointsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -115,7 +133,7 @@ func (s *ServerEndpointsServerTransport) dispatchBeginCreate(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serverEndpoints/(?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) } body, err := server.UnmarshalRequestAsJSON[armstoragesync.ServerEndpointCreateParameters](req) @@ -171,7 +189,7 @@ func (s *ServerEndpointsServerTransport) dispatchBeginDelete(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serverEndpoints/(?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")]) @@ -203,9 +221,9 @@ func (s *ServerEndpointsServerTransport) dispatchBeginDelete(req *http.Request) return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", 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) { s.beginDelete.remove(req) @@ -221,7 +239,7 @@ func (s *ServerEndpointsServerTransport) dispatchGet(req *http.Request) (*http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serverEndpoints/(?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")]) @@ -252,10 +270,10 @@ func (s *ServerEndpointsServerTransport) dispatchGet(req *http.Request) (*http.R if err != nil { return nil, err } - if val := server.GetResponse(respr).XMSCorrelationRequestID; val != nil { + if val := server.GetResponse(respr).CorrelationRequestID; val != nil { resp.Header.Set("x-ms-correlation-request-id", *val) } - if val := server.GetResponse(respr).XMSRequestID; val != nil { + if val := server.GetResponse(respr).RequestID; val != nil { resp.Header.Set("x-ms-request-id", *val) } return resp, nil @@ -270,7 +288,7 @@ func (s *ServerEndpointsServerTransport) dispatchNewListBySyncGroupPager(req *ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serverEndpoints` 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")]) @@ -288,6 +306,9 @@ func (s *ServerEndpointsServerTransport) dispatchNewListBySyncGroupPager(req *ht resp := s.srv.NewListBySyncGroupPager(resourceGroupNameParam, storageSyncServiceNameParam, syncGroupNameParam, nil) newListBySyncGroupPager = &resp s.newListBySyncGroupPager.add(req, newListBySyncGroupPager) + server.PagerResponderInjectNextLinks(newListBySyncGroupPager, req, func(page *armstoragesync.ServerEndpointsClientListBySyncGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListBySyncGroupPager, req) if err != nil { @@ -312,7 +333,7 @@ func (s *ServerEndpointsServerTransport) dispatchBeginRecallAction(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serverEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/recallAction` 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) } body, err := server.UnmarshalRequestAsJSON[armstoragesync.RecallActionParameters](req) @@ -348,9 +369,9 @@ func (s *ServerEndpointsServerTransport) dispatchBeginRecallAction(req *http.Req return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginRecallAction.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", 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(beginRecallAction) { s.beginRecallAction.remove(req) @@ -368,7 +389,7 @@ func (s *ServerEndpointsServerTransport) dispatchBeginUpdate(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serverEndpoints/(?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) } body, err := server.UnmarshalRequestAsJSON[armstoragesync.ServerEndpointUpdateParameters](req) @@ -391,13 +412,7 @@ func (s *ServerEndpointsServerTransport) dispatchBeginUpdate(req *http.Request) if err != nil { return nil, err } - var options *armstoragesync.ServerEndpointsClientBeginUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armstoragesync.ServerEndpointsClientBeginUpdateOptions{ - Parameters: &body, - } - } - respr, errRespr := s.srv.BeginUpdate(req.Context(), resourceGroupNameParam, storageSyncServiceNameParam, syncGroupNameParam, serverEndpointNameParam, options) + respr, errRespr := s.srv.BeginUpdate(req.Context(), resourceGroupNameParam, storageSyncServiceNameParam, syncGroupNameParam, serverEndpointNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -420,3 +435,9 @@ func (s *ServerEndpointsServerTransport) dispatchBeginUpdate(req *http.Request) return resp, nil } + +// set this to conditionally intercept incoming requests to ServerEndpointsServerTransport +var serverEndpointsServerTransportInterceptor 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/storagesync/armstoragesync/fake/services_server.go b/sdk/resourcemanager/storagesync/armstoragesync/fake/services_server.go index 9a23cc808e2c..3c4e0f5aed53 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/fake/services_server.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/fake/services_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 @@ -12,10 +11,10 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" "net/http" "net/url" - "reflect" "regexp" ) @@ -47,7 +46,7 @@ type ServicesServer struct { // BeginUpdate is the fake for method ServicesClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, storageSyncServiceName string, options *armstoragesync.ServicesClientBeginUpdateOptions) (resp azfake.PollerResponder[armstoragesync.ServicesClientUpdateResponse], errResp azfake.ErrorResponder) + BeginUpdate func(ctx context.Context, resourceGroupName string, storageSyncServiceName string, parameters armstoragesync.ServiceUpdateParameters, options *armstoragesync.ServicesClientBeginUpdateOptions) (resp azfake.PollerResponder[armstoragesync.ServicesClientUpdateResponse], errResp azfake.ErrorResponder) } // NewServicesServerTransport creates a new instance of ServicesServerTransport with the provided implementation. @@ -83,33 +82,52 @@ func (s *ServicesServerTransport) 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 - - switch method { - case "ServicesClient.CheckNameAvailability": - resp, err = s.dispatchCheckNameAvailability(req) - case "ServicesClient.BeginCreate": - resp, err = s.dispatchBeginCreate(req) - case "ServicesClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "ServicesClient.Get": - resp, err = s.dispatchGet(req) - case "ServicesClient.NewListByResourceGroupPager": - resp, err = s.dispatchNewListByResourceGroupPager(req) - case "ServicesClient.NewListBySubscriptionPager": - resp, err = s.dispatchNewListBySubscriptionPager(req) - case "ServicesClient.BeginUpdate": - resp, err = s.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return s.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (s *ServicesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - return resp, nil + go func() { + var intercepted bool + var res result + if servicesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = servicesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ServicesClient.CheckNameAvailability": + res.resp, res.err = s.dispatchCheckNameAvailability(req) + case "ServicesClient.BeginCreate": + res.resp, res.err = s.dispatchBeginCreate(req) + case "ServicesClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "ServicesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "ServicesClient.NewListByResourceGroupPager": + res.resp, res.err = s.dispatchNewListByResourceGroupPager(req) + case "ServicesClient.NewListBySubscriptionPager": + res.resp, res.err = s.dispatchNewListBySubscriptionPager(req) + case "ServicesClient.BeginUpdate": + res.resp, res.err = s.dispatchBeginUpdate(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 (s *ServicesServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { @@ -119,7 +137,7 @@ func (s *ServicesServerTransport) dispatchCheckNameAvailability(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/checkNameAvailability` 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) } body, err := server.UnmarshalRequestAsJSON[armstoragesync.CheckNameAvailabilityParameters](req) @@ -154,7 +172,7 @@ func (s *ServicesServerTransport) dispatchBeginCreate(req *http.Request) (*http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?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[armstoragesync.ServiceCreateParameters](req) @@ -202,7 +220,7 @@ func (s *ServicesServerTransport) dispatchBeginDelete(req *http.Request) (*http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?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")]) @@ -244,7 +262,7 @@ func (s *ServicesServerTransport) dispatchGet(req *http.Request) (*http.Response const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?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")]) @@ -267,10 +285,10 @@ func (s *ServicesServerTransport) dispatchGet(req *http.Request) (*http.Response if err != nil { return nil, err } - if val := server.GetResponse(respr).XMSCorrelationRequestID; val != nil { + if val := server.GetResponse(respr).CorrelationRequestID; val != nil { resp.Header.Set("x-ms-correlation-request-id", *val) } - if val := server.GetResponse(respr).XMSRequestID; val != nil { + if val := server.GetResponse(respr).RequestID; val != nil { resp.Header.Set("x-ms-request-id", *val) } return resp, nil @@ -285,7 +303,7 @@ func (s *ServicesServerTransport) dispatchNewListByResourceGroupPager(req *http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices` 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) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -295,6 +313,9 @@ func (s *ServicesServerTransport) dispatchNewListByResourceGroupPager(req *http. resp := s.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) newListByResourceGroupPager = &resp s.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armstoragesync.ServicesClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) if err != nil { @@ -319,12 +340,15 @@ func (s *ServicesServerTransport) dispatchNewListBySubscriptionPager(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices` 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) } resp := s.srv.NewListBySubscriptionPager(nil) newListBySubscriptionPager = &resp s.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armstoragesync.ServicesClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) if err != nil { @@ -349,7 +373,7 @@ func (s *ServicesServerTransport) dispatchBeginUpdate(req *http.Request) (*http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?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[armstoragesync.ServiceUpdateParameters](req) @@ -364,13 +388,7 @@ func (s *ServicesServerTransport) dispatchBeginUpdate(req *http.Request) (*http. if err != nil { return nil, err } - var options *armstoragesync.ServicesClientBeginUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armstoragesync.ServicesClientBeginUpdateOptions{ - Parameters: &body, - } - } - respr, errRespr := s.srv.BeginUpdate(req.Context(), resourceGroupNameParam, storageSyncServiceNameParam, options) + respr, errRespr := s.srv.BeginUpdate(req.Context(), resourceGroupNameParam, storageSyncServiceNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -393,3 +411,9 @@ func (s *ServicesServerTransport) dispatchBeginUpdate(req *http.Request) (*http. return resp, nil } + +// set this to conditionally intercept incoming requests to ServicesServerTransport +var servicesServerTransportInterceptor 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/storagesync/armstoragesync/fake/syncgroups_server.go b/sdk/resourcemanager/storagesync/armstoragesync/fake/syncgroups_server.go index f5da3bc07291..155842501c20 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/fake/syncgroups_server.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/fake/syncgroups_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 @@ -12,7 +11,8 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" "net/http" "net/url" "regexp" @@ -62,27 +62,46 @@ func (s *SyncGroupsServerTransport) 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 s.dispatchToMethodFake(req, method) +} - switch method { - case "SyncGroupsClient.Create": - resp, err = s.dispatchCreate(req) - case "SyncGroupsClient.Delete": - resp, err = s.dispatchDelete(req) - case "SyncGroupsClient.Get": - resp, err = s.dispatchGet(req) - case "SyncGroupsClient.NewListByStorageSyncServicePager": - resp, err = s.dispatchNewListByStorageSyncServicePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SyncGroupsServerTransport) 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 syncGroupsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = syncGroupsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SyncGroupsClient.Create": + res.resp, res.err = s.dispatchCreate(req) + case "SyncGroupsClient.Delete": + res.resp, res.err = s.dispatchDelete(req) + case "SyncGroupsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SyncGroupsClient.NewListByStorageSyncServicePager": + res.resp, res.err = s.dispatchNewListByStorageSyncServicePager(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 (s *SyncGroupsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { @@ -92,7 +111,7 @@ func (s *SyncGroupsServerTransport) dispatchCreate(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncGroups/(?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[armstoragesync.SyncGroupCreateParameters](req) @@ -123,10 +142,10 @@ func (s *SyncGroupsServerTransport) dispatchCreate(req *http.Request) (*http.Res if err != nil { return nil, err } - if val := server.GetResponse(respr).XMSCorrelationRequestID; val != nil { + if val := server.GetResponse(respr).CorrelationRequestID; val != nil { resp.Header.Set("x-ms-correlation-request-id", *val) } - if val := server.GetResponse(respr).XMSRequestID; val != nil { + if val := server.GetResponse(respr).RequestID; val != nil { resp.Header.Set("x-ms-request-id", *val) } return resp, nil @@ -139,7 +158,7 @@ func (s *SyncGroupsServerTransport) dispatchDelete(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncGroups/(?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")]) @@ -166,10 +185,10 @@ func (s *SyncGroupsServerTransport) dispatchDelete(req *http.Request) (*http.Res if err != nil { return nil, err } - if val := server.GetResponse(respr).XMSCorrelationRequestID; val != nil { + if val := server.GetResponse(respr).CorrelationRequestID; val != nil { resp.Header.Set("x-ms-correlation-request-id", *val) } - if val := server.GetResponse(respr).XMSRequestID; val != nil { + if val := server.GetResponse(respr).RequestID; val != nil { resp.Header.Set("x-ms-request-id", *val) } return resp, nil @@ -182,7 +201,7 @@ func (s *SyncGroupsServerTransport) dispatchGet(req *http.Request) (*http.Respon const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncGroups/(?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")]) @@ -209,10 +228,10 @@ func (s *SyncGroupsServerTransport) dispatchGet(req *http.Request) (*http.Respon if err != nil { return nil, err } - if val := server.GetResponse(respr).XMSCorrelationRequestID; val != nil { + if val := server.GetResponse(respr).CorrelationRequestID; val != nil { resp.Header.Set("x-ms-correlation-request-id", *val) } - if val := server.GetResponse(respr).XMSRequestID; val != nil { + if val := server.GetResponse(respr).RequestID; val != nil { resp.Header.Set("x-ms-request-id", *val) } return resp, nil @@ -227,7 +246,7 @@ func (s *SyncGroupsServerTransport) dispatchNewListByStorageSyncServicePager(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncGroups` 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")]) @@ -241,6 +260,9 @@ func (s *SyncGroupsServerTransport) dispatchNewListByStorageSyncServicePager(req resp := s.srv.NewListByStorageSyncServicePager(resourceGroupNameParam, storageSyncServiceNameParam, nil) newListByStorageSyncServicePager = &resp s.newListByStorageSyncServicePager.add(req, newListByStorageSyncServicePager) + server.PagerResponderInjectNextLinks(newListByStorageSyncServicePager, req, func(page *armstoragesync.SyncGroupsClientListByStorageSyncServiceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListByStorageSyncServicePager, req) if err != nil { @@ -255,3 +277,9 @@ func (s *SyncGroupsServerTransport) dispatchNewListByStorageSyncServicePager(req } return resp, nil } + +// set this to conditionally intercept incoming requests to SyncGroupsServerTransport +var syncGroupsServerTransportInterceptor 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/storagesync/armstoragesync/fake/time_rfc3339.go b/sdk/resourcemanager/storagesync/armstoragesync/fake/time_rfc3339.go deleted file mode 100644 index b98c0b0402be..000000000000 --- a/sdk/resourcemanager/storagesync/armstoragesync/fake/time_rfc3339.go +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights 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/storagesync/armstoragesync/fake/workflows_server.go b/sdk/resourcemanager/storagesync/armstoragesync/fake/workflows_server.go index 6954387ea6e3..dfbcaea84089 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/fake/workflows_server.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/fake/workflows_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 @@ -12,7 +11,8 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" "net/http" "net/url" "regexp" @@ -58,25 +58,44 @@ func (w *WorkflowsServerTransport) 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 w.dispatchToMethodFake(req, method) +} - switch method { - case "WorkflowsClient.Abort": - resp, err = w.dispatchAbort(req) - case "WorkflowsClient.Get": - resp, err = w.dispatchGet(req) - case "WorkflowsClient.NewListByStorageSyncServicePager": - resp, err = w.dispatchNewListByStorageSyncServicePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (w *WorkflowsServerTransport) 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 workflowsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = workflowsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "WorkflowsClient.Abort": + res.resp, res.err = w.dispatchAbort(req) + case "WorkflowsClient.Get": + res.resp, res.err = w.dispatchGet(req) + case "WorkflowsClient.NewListByStorageSyncServicePager": + res.resp, res.err = w.dispatchNewListByStorageSyncServicePager(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 *WorkflowsServerTransport) dispatchAbort(req *http.Request) (*http.Response, error) { @@ -86,7 +105,7 @@ func (w *WorkflowsServerTransport) dispatchAbort(req *http.Request) (*http.Respo const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/workflows/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/abort` 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")]) @@ -113,10 +132,10 @@ func (w *WorkflowsServerTransport) dispatchAbort(req *http.Request) (*http.Respo if err != nil { return nil, err } - if val := server.GetResponse(respr).XMSCorrelationRequestID; val != nil { + if val := server.GetResponse(respr).CorrelationRequestID; val != nil { resp.Header.Set("x-ms-correlation-request-id", *val) } - if val := server.GetResponse(respr).XMSRequestID; val != nil { + if val := server.GetResponse(respr).RequestID; val != nil { resp.Header.Set("x-ms-request-id", *val) } return resp, nil @@ -129,7 +148,7 @@ func (w *WorkflowsServerTransport) dispatchGet(req *http.Request) (*http.Respons const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/workflows/(?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")]) @@ -156,10 +175,10 @@ func (w *WorkflowsServerTransport) dispatchGet(req *http.Request) (*http.Respons if err != nil { return nil, err } - if val := server.GetResponse(respr).XMSCorrelationRequestID; val != nil { + if val := server.GetResponse(respr).CorrelationRequestID; val != nil { resp.Header.Set("x-ms-correlation-request-id", *val) } - if val := server.GetResponse(respr).XMSRequestID; val != nil { + if val := server.GetResponse(respr).RequestID; val != nil { resp.Header.Set("x-ms-request-id", *val) } return resp, nil @@ -174,7 +193,7 @@ func (w *WorkflowsServerTransport) dispatchNewListByStorageSyncServicePager(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StorageSync/storageSyncServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/workflows` 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")]) @@ -188,6 +207,9 @@ func (w *WorkflowsServerTransport) dispatchNewListByStorageSyncServicePager(req resp := w.srv.NewListByStorageSyncServicePager(resourceGroupNameParam, storageSyncServiceNameParam, nil) newListByStorageSyncServicePager = &resp w.newListByStorageSyncServicePager.add(req, newListByStorageSyncServicePager) + server.PagerResponderInjectNextLinks(newListByStorageSyncServicePager, req, func(page *armstoragesync.WorkflowsClientListByStorageSyncServiceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListByStorageSyncServicePager, req) if err != nil { @@ -202,3 +224,9 @@ func (w *WorkflowsServerTransport) dispatchNewListByStorageSyncServicePager(req } return resp, nil } + +// set this to conditionally intercept incoming requests to WorkflowsServerTransport +var workflowsServerTransportInterceptor 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/storagesync/armstoragesync/go.mod b/sdk/resourcemanager/storagesync/armstoragesync/go.mod index 9668a05feec7..a3bfcae464ec 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/go.mod +++ b/sdk/resourcemanager/storagesync/armstoragesync/go.mod @@ -1,9 +1,9 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2 go 1.24.0 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.20.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 ) @@ -14,8 +14,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.45.0 // indirect - golang.org/x/net v0.47.0 // indirect - golang.org/x/sys v0.38.0 // indirect - golang.org/x/text v0.31.0 // indirect + golang.org/x/crypto v0.47.0 // indirect + golang.org/x/net v0.49.0 // indirect + golang.org/x/sys v0.40.0 // indirect + golang.org/x/text v0.33.0 // indirect ) diff --git a/sdk/resourcemanager/storagesync/armstoragesync/go.sum b/sdk/resourcemanager/storagesync/armstoragesync/go.sum index 5d2c5e78eb37..668beb5b462e 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/go.sum +++ b/sdk/resourcemanager/storagesync/armstoragesync/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.20.0 h1:JXg2dwJUmPB9JmtVmdEB16APJ7jurfbY5jnfXpJoRMc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.20.0/go.mod h1:YD5h/ldMsG0XiIw7PdyNhLxaM317eFh5yNLccNfGdyw= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 h1:fou+2+WFTib47nS+nz/ozhEBnvU96bKHy6LjRsY4E28= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0/go.mod h1:t76Ruy8AHvUAC8GfMWJMa0ElSbuIcO03NLpynfbgsPA= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 h1:Hk5QBxZQC1jb2Fwj6mpzme37xbCDdNTxU7O9eb5+LB4= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1/go.mod h1:IYus9qsFobWIc2YVwe/WPjcnyCkPKtnHAqUYeebc8z0= github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= @@ -26,14 +26,14 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= -golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= -golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= -golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= +golang.org/x/crypto v0.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8= +golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A= +golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o= +golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= -golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM= -golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM= +golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ= +golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE= +golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/storagesync/armstoragesync/microsoftstoragesync_client.go b/sdk/resourcemanager/storagesync/armstoragesync/microsoftstoragesync_client.go index 3304d939818c..7ea178e6001b 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/microsoftstoragesync_client.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/microsoftstoragesync_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 armstoragesync @@ -25,9 +24,9 @@ type MicrosoftStorageSyncClient struct { } // NewMicrosoftStorageSyncClient creates a new instance of MicrosoftStorageSyncClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewMicrosoftStorageSyncClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MicrosoftStorageSyncClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -43,7 +42,7 @@ func NewMicrosoftStorageSyncClient(subscriptionID string, credential azcore.Toke // LocationOperationStatus - Get Operation status // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - locationName - The desired region to obtain information from. // - operationID - operation Id // - options - MicrosoftStorageSyncClientLocationOperationStatusOptions contains the optional parameters for the MicrosoftStorageSyncClient.LocationOperationStatus @@ -71,7 +70,7 @@ func (client *MicrosoftStorageSyncClient) LocationOperationStatus(ctx context.Co } // locationOperationStatusCreateRequest creates the LocationOperationStatus request. -func (client *MicrosoftStorageSyncClient) locationOperationStatusCreateRequest(ctx context.Context, locationName string, operationID string, options *MicrosoftStorageSyncClientLocationOperationStatusOptions) (*policy.Request, error) { +func (client *MicrosoftStorageSyncClient) locationOperationStatusCreateRequest(ctx context.Context, locationName string, operationID string, _ *MicrosoftStorageSyncClientLocationOperationStatusOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/operations/{operationId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -90,7 +89,7 @@ func (client *MicrosoftStorageSyncClient) locationOperationStatusCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -100,10 +99,10 @@ func (client *MicrosoftStorageSyncClient) locationOperationStatusCreateRequest(c func (client *MicrosoftStorageSyncClient) locationOperationStatusHandleResponse(resp *http.Response) (MicrosoftStorageSyncClientLocationOperationStatusResponse, error) { result := MicrosoftStorageSyncClientLocationOperationStatusResponse{} if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { - result.XMSCorrelationRequestID = &val + result.CorrelationRequestID = &val } if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val + result.RequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.LocationOperationStatus); err != nil { return MicrosoftStorageSyncClientLocationOperationStatusResponse{}, err diff --git a/sdk/resourcemanager/storagesync/armstoragesync/microsoftstoragesync_client_example_test.go b/sdk/resourcemanager/storagesync/armstoragesync/microsoftstoragesync_client_example_test.go index 98d97645dc02..2d5b9d662c9e 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/microsoftstoragesync_client_example_test.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/microsoftstoragesync_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/LocationOperationStatus_Get.json diff --git a/sdk/resourcemanager/storagesync/armstoragesync/models.go b/sdk/resourcemanager/storagesync/armstoragesync/models.go index 94f89b4b4c49..58c2cc000353 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/models.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/models.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 armstoragesync @@ -37,7 +36,7 @@ type CheckNameAvailabilityParameters struct { Name *string // CONSTANT; The resource type. Must be set to Microsoft.StorageSync/storageSyncServices - // Field has constant value "Microsoft.StorageSync/storageSyncServices", any specified value is ignored. + // Field has constant value "string", any specified value is ignored. Type *string } @@ -73,8 +72,21 @@ type CloudEndpoint struct { Type *string } +// CloudEndpointAfsShareMetadataCertificatePublicKeys - Cloud endpoint AFS file share metadata signing certificate public +// keys. +type CloudEndpointAfsShareMetadataCertificatePublicKeys struct { + // READ-ONLY; The first public key. + FirstKey *string + + // READ-ONLY; The second public key. + SecondKey *string +} + // CloudEndpointArray - Array of CloudEndpoint type CloudEndpointArray struct { + // The URL to get the next set of results. + NextLink *string + // Collection of CloudEndpoint. Value []*CloudEndpoint } @@ -256,6 +268,15 @@ type CloudTieringFilesNotTiering struct { TotalFileCount *int64 } +// CloudTieringLowDiskMode - Information regarding the low disk mode state +type CloudTieringLowDiskMode struct { + // READ-ONLY; Last updated timestamp + LastUpdatedTimestamp *time.Time + + // READ-ONLY; Low disk mode state + State *CloudTieringLowDiskModeState +} + // CloudTieringSpaceSavings - Server endpoint cloud tiering status object. type CloudTieringSpaceSavings struct { // READ-ONLY; Cached content size on the server @@ -289,15 +310,6 @@ type CloudTieringVolumeFreeSpacePolicyStatus struct { LastUpdatedTimestamp *time.Time } -// Error type -type Error struct { - // Error details of the given entry. - Error *APIError - - // Error details of the given entry. - Innererror *APIError -} - // ErrorDetails - Error Details object. type ErrorDetails struct { // Error code of the given entry. @@ -373,6 +385,22 @@ type LocationOperationStatus struct { Status *string } +// 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 +} + // OperationDisplayInfo - The operation supported by storage sync. type OperationDisplayInfo struct { // The description of the operation. @@ -388,21 +416,6 @@ type OperationDisplayInfo struct { Resource *string } -// OperationDisplayResource - Operation Display Resource object. -type OperationDisplayResource struct { - // Operation Display Resource Description. - Description *string - - // Operation Display Resource Operation. - Operation *string - - // Operation Display Resource Provider. - Provider *string - - // Operation Display Resource. - Resource *string -} - // OperationEntity - The operation supported by storage sync. type OperationEntity struct { // The operation supported by storage sync. @@ -418,13 +431,13 @@ type OperationEntity struct { Properties *OperationProperties } -// OperationEntityListResult - The list of storage sync operations. +// OperationEntityListResult - Paged collection of OperationEntity items type OperationEntityListResult struct { - // The link used to get the next page of operations. - NextLink *string - - // The list of operations. + // REQUIRED; The OperationEntity items on this page Value []*OperationEntity + + // The link to the next page of items + NextLink *string } // OperationProperties - Properties of the operations resource. @@ -450,6 +463,9 @@ type OperationResourceMetricSpecification struct { // Fill gaps in the metric with zero. FillGapWithZero *bool + // Lock Aggregation type for the metric. + LockAggregationType *string + // Name of the metric. Name *string @@ -565,13 +581,13 @@ type PreRestoreRequest struct { Status *string } -// PrivateEndpoint - The Private Endpoint resource. +// PrivateEndpoint - The private endpoint resource. type PrivateEndpoint struct { - // READ-ONLY; The ARM identifier for Private Endpoint + // READ-ONLY; The resource identifier of the private endpoint ID *string } -// PrivateEndpointConnection - The Private Endpoint Connection resource. +// PrivateEndpointConnection - The private endpoint connection resource. type PrivateEndpointConnection struct { // Resource properties. Properties *PrivateEndpointConnectionProperties @@ -589,25 +605,31 @@ type PrivateEndpointConnection struct { Type *string } -// PrivateEndpointConnectionListResult - List of private endpoint connection associated with the specified storage account +// PrivateEndpointConnectionListResult - List of private endpoint connections associated with the specified resource. type PrivateEndpointConnectionListResult struct { - // Array of private endpoint connections + // The URL to get the next set of results. + NextLink *string + + // List of private endpoint connections associated with the specified resource. Value []*PrivateEndpointConnection } -// PrivateEndpointConnectionProperties - Properties of the PrivateEndpointConnectProperties. +// PrivateEndpointConnectionProperties - Properties of the private endpoint connection. type PrivateEndpointConnectionProperties struct { // REQUIRED; A collection of information about the state of the connection between service consumer and provider. PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState - // The resource of private end point. + // The private endpoint resource. PrivateEndpoint *PrivateEndpoint + // READ-ONLY; The group ids for the private endpoint resource. + GroupIDs []*string + // READ-ONLY; The provisioning state of the private endpoint connection resource. ProvisioningState *PrivateEndpointConnectionProvisioningState } -// PrivateLinkResource - A private link resource +// PrivateLinkResource - A private link resource. type PrivateLinkResource struct { // Resource properties. Properties *PrivateLinkResourceProperties @@ -625,7 +647,12 @@ type PrivateLinkResource struct { Type *string } -// PrivateLinkResourceListResult - A list of private link resources +// PrivateLinkResourceListResult - A list of private link resources for versions before v6. +// This model represents the standard `PrivateLinkResourceListResult` envelope for versions v3, v4, and v5. It has been deprecated +// for v6 and beyond. +// Note: This is only intended for use with versions before v6. Do not use this if you are already on CommonTypes.Version.v6 +// or beyond. +// If you are migrating to v6 or above, use `PrivateLinkResourceListResult` directly. type PrivateLinkResourceListResult struct { // Array of private link resources Value []*PrivateLinkResource @@ -633,7 +660,7 @@ type PrivateLinkResourceListResult struct { // PrivateLinkResourceProperties - Properties of a private link resource. type PrivateLinkResourceProperties struct { - // The private link resource Private link DNS zone name. + // The private link resource private link DNS zone name. RequiredZoneNames []*string // READ-ONLY; The private link resource group id. @@ -656,22 +683,6 @@ type PrivateLinkServiceConnectionState struct { Status *PrivateEndpointServiceConnectionStatus } -// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a -// location -type ProxyResource struct { - // 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 resource - Name *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 -} - // RecallActionParameters - The parameters used when calling recall action on server endpoint. type RecallActionParameters struct { // Pattern of the files. @@ -701,6 +712,9 @@ type RegisteredServer struct { // RegisteredServerArray - Array of RegisteredServer type RegisteredServerArray struct { + // The URL to get the next set of results. + NextLink *string + // Collection of Registered Server. Value []*RegisteredServer } @@ -728,6 +742,9 @@ type RegisteredServerCreateParametersProperties struct { // Registered Server Agent Version AgentVersion *string + // Server ServicePrincipal Id + ApplicationID *string + // Registered Server clusterId ClusterID *string @@ -737,6 +754,9 @@ type RegisteredServerCreateParametersProperties struct { // Friendly Name FriendlyName *string + // Apply server with newly discovered ApplicationId if available. + Identity *bool + // Registered Server last heart beat LastHeartBeat *string @@ -758,6 +778,9 @@ type RegisteredServerProperties struct { // Registered Server Agent Version AgentVersion *string + // Server Application Id + ApplicationID *string + // Registered Server clusterId ClusterID *string @@ -779,6 +802,9 @@ type RegisteredServerProperties struct { // Registered Server lastWorkflowId LastWorkflowID *string + // Latest Server Application Id discovered from the server. It is not yet applied. + LatestApplicationID *string + // Management Endpoint Uri ManagementEndpointURI *string @@ -815,18 +841,27 @@ type RegisteredServerProperties struct { // Registered Server storageSyncServiceUid StorageSyncServiceUID *string + // READ-ONLY; Server auth type. + ActiveAuthType *ServerAuthType + // READ-ONLY; Registered Server Agent Version Expiration Date AgentVersionExpirationDate *time.Time // READ-ONLY; Registered Server Agent Version Status AgentVersionStatus *RegisteredServerAgentVersionStatus + // READ-ONLY; Apply server with newly discovered ApplicationId if available. + Identity *bool + // READ-ONLY; Server name ServerName *string } -// Resource - Common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { +// RegisteredServerUpdateParameters - The parameters used when updating a registered server. +type RegisteredServerUpdateParameters struct { + // The parameters used to update the registered server. + Properties *RegisteredServerUpdateProperties + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string @@ -840,13 +875,13 @@ type Resource struct { Type *string } -// ResourcesMoveInfo - Resource Move Info. -type ResourcesMoveInfo struct { - // Collection of Resources. - Resources []*string +// RegisteredServerUpdateProperties - RegisteredServer Update Properties object. +type RegisteredServerUpdateProperties struct { + // Apply server with new ServicePrincipal Id + ApplicationID *string - // Target resource group. - TargetResourceGroup *string + // Apply server with newly discovered ApplicationId if available. + Identity *bool } // RestoreFileSpec - Restore file spec. @@ -878,6 +913,9 @@ type ServerEndpoint struct { // ServerEndpointArray - Array of ServerEndpoint type ServerEndpointArray struct { + // The URL to get the next set of results. + NextLink *string + // Collection of ServerEndpoint. Value []*ServerEndpoint } @@ -923,6 +961,9 @@ type ServerEndpointCloudTieringStatus struct { // READ-ONLY; Last updated timestamp LastUpdatedTimestamp *time.Time + // READ-ONLY; Information regarding the low disk mode state + LowDiskMode *CloudTieringLowDiskMode + // READ-ONLY; Information regarding how much local space cloud tiering is saving. SpaceSavings *CloudTieringSpaceSavings @@ -1019,6 +1060,9 @@ type ServerEndpointProperties struct { // Offline data transfer share name OfflineDataTransferShareName *string + // Server Endpoint provisioning status + ServerEndpointProvisioningStatus *ServerEndpointProvisioningStatus + // Server Local path. ServerLocalPath *string @@ -1059,6 +1103,45 @@ type ServerEndpointProperties struct { SyncStatus *ServerEndpointSyncStatus } +// ServerEndpointProvisioningStatus - Server endpoint provisioning status information +type ServerEndpointProvisioningStatus struct { + // READ-ONLY; Server Endpoint provisioning status + ProvisioningStatus *ServerProvisioningStatus + + // READ-ONLY; Provisioning Step status information for each step in the provisioning process + ProvisioningStepStatuses []*ServerEndpointProvisioningStepStatus + + // READ-ONLY; Server Endpoint provisioning type + ProvisioningType *string +} + +// ServerEndpointProvisioningStepStatus - Server endpoint provisioning step status object. +type ServerEndpointProvisioningStepStatus struct { + // READ-ONLY; Additional information for the provisioning step + AdditionalInformation map[string]*string + + // READ-ONLY; End time of the provisioning step + EndTime *time.Time + + // READ-ONLY; Error code (HResult) for the provisioning step + ErrorCode *int32 + + // READ-ONLY; Estimated completion time of the provisioning step in minutes + MinutesLeft *int32 + + // READ-ONLY; Name of the provisioning step + Name *string + + // READ-ONLY; Estimated progress percentage + ProgressPercentage *int32 + + // READ-ONLY; Start time of the provisioning step + StartTime *time.Time + + // READ-ONLY; Status of the provisioning step + Status *string +} + // ServerEndpointRecallError - Server endpoint recall error object type ServerEndpointRecallError struct { // READ-ONLY; Count of occurences of the error @@ -1205,6 +1288,9 @@ type Service struct { // REQUIRED; The geo-location where the resource lives Location *string + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentity + // Storage Sync Service properties. Properties *ServiceProperties @@ -1226,31 +1312,48 @@ type Service struct { // ServiceArray - Array of StorageSyncServices type ServiceArray struct { + // The URL to get the next set of results. + NextLink *string + // Collection of StorageSyncServices. Value []*Service } // ServiceCreateParameters - The parameters used when creating a storage sync service. type ServiceCreateParameters struct { - // REQUIRED; Required. Gets or sets the location of the resource. This will be one of the supported and registered Azure Geo - // Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource - // cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. + // REQUIRED; The geo-location where the resource lives Location *string + // managed identities for the Storage Sync to interact with other Azure services without maintaining any secrets or credentials + // in code. + Identity *ManagedServiceIdentity + // The parameters used to create the storage sync service. Properties *ServiceCreateParametersProperties - // Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this - // resource (across resource groups). A maximum of 15 tags can be provided for a - // resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than - // 256 characters. + // Resource tags. Tags map[string]*string + + // 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 resource + Name *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 } // ServiceCreateParametersProperties - StorageSyncService Properties object. type ServiceCreateParametersProperties struct { // Incoming Traffic Policy IncomingTrafficPolicy *IncomingTrafficPolicy + + // Use Identity authorization when customer have finished setup RBAC permissions. + UseIdentity *bool } // ServiceProperties - Storage Sync Service Properties object. @@ -1275,10 +1378,17 @@ type ServiceProperties struct { // READ-ONLY; Storage Sync service Uid StorageSyncServiceUID *string + + // READ-ONLY; Use Identity authorization when customer have finished setup RBAC permissions. + UseIdentity *bool } // ServiceUpdateParameters - Parameters for updating an Storage sync service. type ServiceUpdateParameters struct { + // managed identities for the Container App to interact with other Azure services without maintaining any secrets or credentials + // in code. + Identity *ManagedServiceIdentity + // The properties of the server endpoint. Properties *ServiceUpdateProperties @@ -1290,18 +1400,9 @@ type ServiceUpdateParameters struct { type ServiceUpdateProperties struct { // Incoming Traffic Policy IncomingTrafficPolicy *IncomingTrafficPolicy -} -// SubscriptionState - Subscription State object. -type SubscriptionState struct { - // Subscription state properties. - Properties any - - // State of Azure Subscription - State *Reason - - // READ-ONLY; Is Transitioning - Istransitioning *bool + // Use Identity authorization when customer have finished setup RBAC permissions. + UseIdentity *bool } // SyncGroup - Sync Group object. @@ -1324,6 +1425,9 @@ type SyncGroup struct { // SyncGroupArray - Array of SyncGroup type SyncGroupArray struct { + // The URL to get the next set of results. + NextLink *string + // Collection of SyncGroup. Value []*SyncGroup } @@ -1376,28 +1480,6 @@ type SystemData struct { LastModifiedByType *CreatedByType } -// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' -// and a 'location' -type TrackedResource struct { - // REQUIRED; The geo-location where the resource lives - Location *string - - // Resource tags. - Tags map[string]*string - - // 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 resource - Name *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 -} - // TriggerChangeDetectionParameters - The parameters used when calling trigger change detection action on cloud endpoint. type TriggerChangeDetectionParameters struct { // Change Detection Mode. Applies to a directory specified in directoryPath parameter. @@ -1416,6 +1498,15 @@ type TriggerRolloverRequest struct { ServerCertificate *string } +// 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 +} + // Workflow resource. type Workflow struct { // Workflow properties. @@ -1436,6 +1527,9 @@ type Workflow struct { // WorkflowArray - Array of Workflow type WorkflowArray struct { + // The URL to get the next set of results. + NextLink *string + // Collection of workflow items. Value []*Workflow } diff --git a/sdk/resourcemanager/storagesync/armstoragesync/models_serde.go b/sdk/resourcemanager/storagesync/armstoragesync/models_serde.go index e5f8b276a933..81964653a375 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/models_serde.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/models_serde.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 armstoragesync @@ -9,7 +8,9 @@ import ( "encoding/json" "fmt" "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/datetime" "reflect" + "time" ) // MarshalJSON implements the json.Marshaller interface for type APIError. @@ -86,7 +87,7 @@ func (b *BackupRequest) UnmarshalJSON(data []byte) error { func (c CheckNameAvailabilityParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "name", c.Name) - objectMap["type"] = "Microsoft.StorageSync/storageSyncServices" + objectMap["type"] = "string" return json.Marshal(objectMap) } @@ -191,9 +192,41 @@ func (c *CloudEndpoint) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CloudEndpointAfsShareMetadataCertificatePublicKeys. +func (c CloudEndpointAfsShareMetadataCertificatePublicKeys) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "firstKey", c.FirstKey) + populate(objectMap, "secondKey", c.SecondKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudEndpointAfsShareMetadataCertificatePublicKeys. +func (c *CloudEndpointAfsShareMetadataCertificatePublicKeys) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "firstKey": + err = unpopulate(val, "FirstKey", &c.FirstKey) + delete(rawMsg, key) + case "secondKey": + err = unpopulate(val, "SecondKey", &c.SecondKey) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CloudEndpointArray. func (c CloudEndpointArray) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } @@ -207,6 +240,9 @@ func (c *CloudEndpointArray) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &c.Value) delete(rawMsg, key) @@ -222,13 +258,13 @@ func (c *CloudEndpointArray) UnmarshalJSON(data []byte) error { func (c CloudEndpointChangeEnumerationActivity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "deletesProgressPercent", c.DeletesProgressPercent) - populateDateTimeRFC3339(objectMap, "lastUpdatedTimestamp", c.LastUpdatedTimestamp) + populateTime[datetime.RFC3339](objectMap, "lastUpdatedTimestamp", c.LastUpdatedTimestamp) populate(objectMap, "minutesRemaining", c.MinutesRemaining) populate(objectMap, "operationState", c.OperationState) populate(objectMap, "processedDirectoriesCount", c.ProcessedDirectoriesCount) populate(objectMap, "processedFilesCount", c.ProcessedFilesCount) populate(objectMap, "progressPercent", c.ProgressPercent) - populateDateTimeRFC3339(objectMap, "startedTimestamp", c.StartedTimestamp) + populateTime[datetime.RFC3339](objectMap, "startedTimestamp", c.StartedTimestamp) populate(objectMap, "statusCode", c.StatusCode) populate(objectMap, "totalCountsState", c.TotalCountsState) populate(objectMap, "totalDirectoriesCount", c.TotalDirectoriesCount) @@ -250,7 +286,7 @@ func (c *CloudEndpointChangeEnumerationActivity) UnmarshalJSON(data []byte) erro err = unpopulate(val, "DeletesProgressPercent", &c.DeletesProgressPercent) delete(rawMsg, key) case "lastUpdatedTimestamp": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTimestamp", &c.LastUpdatedTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "LastUpdatedTimestamp", &c.LastUpdatedTimestamp) delete(rawMsg, key) case "minutesRemaining": err = unpopulate(val, "MinutesRemaining", &c.MinutesRemaining) @@ -268,7 +304,7 @@ func (c *CloudEndpointChangeEnumerationActivity) UnmarshalJSON(data []byte) erro err = unpopulate(val, "ProgressPercent", &c.ProgressPercent) delete(rawMsg, key) case "startedTimestamp": - err = unpopulateDateTimeRFC3339(val, "StartedTimestamp", &c.StartedTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "StartedTimestamp", &c.StartedTimestamp) delete(rawMsg, key) case "statusCode": err = unpopulate(val, "StatusCode", &c.StatusCode) @@ -298,7 +334,7 @@ func (c CloudEndpointChangeEnumerationStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "activity", c.Activity) populate(objectMap, "lastEnumerationStatus", c.LastEnumerationStatus) - populateDateTimeRFC3339(objectMap, "lastUpdatedTimestamp", c.LastUpdatedTimestamp) + populateTime[datetime.RFC3339](objectMap, "lastUpdatedTimestamp", c.LastUpdatedTimestamp) return json.Marshal(objectMap) } @@ -318,7 +354,7 @@ func (c *CloudEndpointChangeEnumerationStatus) UnmarshalJSON(data []byte) error err = unpopulate(val, "LastEnumerationStatus", &c.LastEnumerationStatus) delete(rawMsg, key) case "lastUpdatedTimestamp": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTimestamp", &c.LastUpdatedTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "LastUpdatedTimestamp", &c.LastUpdatedTimestamp) delete(rawMsg, key) } if err != nil { @@ -413,12 +449,12 @@ func (c *CloudEndpointCreateParametersProperties) UnmarshalJSON(data []byte) err // MarshalJSON implements the json.Marshaller interface for type CloudEndpointLastChangeEnumerationStatus. func (c CloudEndpointLastChangeEnumerationStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "completedTimestamp", c.CompletedTimestamp) + populateTime[datetime.RFC3339](objectMap, "completedTimestamp", c.CompletedTimestamp) populate(objectMap, "namespaceDirectoriesCount", c.NamespaceDirectoriesCount) populate(objectMap, "namespaceFilesCount", c.NamespaceFilesCount) populate(objectMap, "namespaceSizeBytes", c.NamespaceSizeBytes) - populateDateTimeRFC3339(objectMap, "nextRunTimestamp", c.NextRunTimestamp) - populateDateTimeRFC3339(objectMap, "startedTimestamp", c.StartedTimestamp) + populateTime[datetime.RFC3339](objectMap, "nextRunTimestamp", c.NextRunTimestamp) + populateTime[datetime.RFC3339](objectMap, "startedTimestamp", c.StartedTimestamp) return json.Marshal(objectMap) } @@ -432,7 +468,7 @@ func (c *CloudEndpointLastChangeEnumerationStatus) UnmarshalJSON(data []byte) er var err error switch key { case "completedTimestamp": - err = unpopulateDateTimeRFC3339(val, "CompletedTimestamp", &c.CompletedTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "CompletedTimestamp", &c.CompletedTimestamp) delete(rawMsg, key) case "namespaceDirectoriesCount": err = unpopulate(val, "NamespaceDirectoriesCount", &c.NamespaceDirectoriesCount) @@ -444,10 +480,10 @@ func (c *CloudEndpointLastChangeEnumerationStatus) UnmarshalJSON(data []byte) er err = unpopulate(val, "NamespaceSizeBytes", &c.NamespaceSizeBytes) delete(rawMsg, key) case "nextRunTimestamp": - err = unpopulateDateTimeRFC3339(val, "NextRunTimestamp", &c.NextRunTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "NextRunTimestamp", &c.NextRunTimestamp) delete(rawMsg, key) case "startedTimestamp": - err = unpopulateDateTimeRFC3339(val, "StartedTimestamp", &c.StartedTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "StartedTimestamp", &c.StartedTimestamp) delete(rawMsg, key) } if err != nil { @@ -526,7 +562,7 @@ func (c CloudTieringCachePerformance) MarshalJSON() ([]byte, error) { populate(objectMap, "cacheHitBytes", c.CacheHitBytes) populate(objectMap, "cacheHitBytesPercent", c.CacheHitBytesPercent) populate(objectMap, "cacheMissBytes", c.CacheMissBytes) - populateDateTimeRFC3339(objectMap, "lastUpdatedTimestamp", c.LastUpdatedTimestamp) + populateTime[datetime.RFC3339](objectMap, "lastUpdatedTimestamp", c.LastUpdatedTimestamp) return json.Marshal(objectMap) } @@ -549,7 +585,7 @@ func (c *CloudTieringCachePerformance) UnmarshalJSON(data []byte) error { err = unpopulate(val, "CacheMissBytes", &c.CacheMissBytes) delete(rawMsg, key) case "lastUpdatedTimestamp": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTimestamp", &c.LastUpdatedTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "LastUpdatedTimestamp", &c.LastUpdatedTimestamp) delete(rawMsg, key) } if err != nil { @@ -562,8 +598,8 @@ func (c *CloudTieringCachePerformance) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CloudTieringDatePolicyStatus. func (c CloudTieringDatePolicyStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "lastUpdatedTimestamp", c.LastUpdatedTimestamp) - populateDateTimeRFC3339(objectMap, "tieredFilesMostRecentAccessTimestamp", c.TieredFilesMostRecentAccessTimestamp) + populateTime[datetime.RFC3339](objectMap, "lastUpdatedTimestamp", c.LastUpdatedTimestamp) + populateTime[datetime.RFC3339](objectMap, "tieredFilesMostRecentAccessTimestamp", c.TieredFilesMostRecentAccessTimestamp) return json.Marshal(objectMap) } @@ -577,10 +613,10 @@ func (c *CloudTieringDatePolicyStatus) UnmarshalJSON(data []byte) error { var err error switch key { case "lastUpdatedTimestamp": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTimestamp", &c.LastUpdatedTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "LastUpdatedTimestamp", &c.LastUpdatedTimestamp) delete(rawMsg, key) case "tieredFilesMostRecentAccessTimestamp": - err = unpopulateDateTimeRFC3339(val, "TieredFilesMostRecentAccessTimestamp", &c.TieredFilesMostRecentAccessTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "TieredFilesMostRecentAccessTimestamp", &c.TieredFilesMostRecentAccessTimestamp) delete(rawMsg, key) } if err != nil { @@ -594,7 +630,7 @@ func (c *CloudTieringDatePolicyStatus) UnmarshalJSON(data []byte) error { func (c CloudTieringFilesNotTiering) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "errors", c.Errors) - populateDateTimeRFC3339(objectMap, "lastUpdatedTimestamp", c.LastUpdatedTimestamp) + populateTime[datetime.RFC3339](objectMap, "lastUpdatedTimestamp", c.LastUpdatedTimestamp) populate(objectMap, "totalFileCount", c.TotalFileCount) return json.Marshal(objectMap) } @@ -612,7 +648,7 @@ func (c *CloudTieringFilesNotTiering) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Errors", &c.Errors) delete(rawMsg, key) case "lastUpdatedTimestamp": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTimestamp", &c.LastUpdatedTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "LastUpdatedTimestamp", &c.LastUpdatedTimestamp) delete(rawMsg, key) case "totalFileCount": err = unpopulate(val, "TotalFileCount", &c.TotalFileCount) @@ -625,11 +661,42 @@ func (c *CloudTieringFilesNotTiering) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CloudTieringLowDiskMode. +func (c CloudTieringLowDiskMode) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTime[datetime.RFC3339](objectMap, "lastUpdatedTimestamp", c.LastUpdatedTimestamp) + populate(objectMap, "state", c.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudTieringLowDiskMode. +func (c *CloudTieringLowDiskMode) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "lastUpdatedTimestamp": + err = unpopulateTime[datetime.RFC3339](val, "LastUpdatedTimestamp", &c.LastUpdatedTimestamp) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &c.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CloudTieringSpaceSavings. func (c CloudTieringSpaceSavings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "cachedSizeBytes", c.CachedSizeBytes) - populateDateTimeRFC3339(objectMap, "lastUpdatedTimestamp", c.LastUpdatedTimestamp) + populateTime[datetime.RFC3339](objectMap, "lastUpdatedTimestamp", c.LastUpdatedTimestamp) populate(objectMap, "spaceSavingsBytes", c.SpaceSavingsBytes) populate(objectMap, "spaceSavingsPercent", c.SpaceSavingsPercent) populate(objectMap, "totalSizeCloudBytes", c.TotalSizeCloudBytes) @@ -650,7 +717,7 @@ func (c *CloudTieringSpaceSavings) UnmarshalJSON(data []byte) error { err = unpopulate(val, "CachedSizeBytes", &c.CachedSizeBytes) delete(rawMsg, key) case "lastUpdatedTimestamp": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTimestamp", &c.LastUpdatedTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "LastUpdatedTimestamp", &c.LastUpdatedTimestamp) delete(rawMsg, key) case "spaceSavingsBytes": err = unpopulate(val, "SpaceSavingsBytes", &c.SpaceSavingsBytes) @@ -677,7 +744,7 @@ func (c CloudTieringVolumeFreeSpacePolicyStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "currentVolumeFreeSpacePercent", c.CurrentVolumeFreeSpacePercent) populate(objectMap, "effectiveVolumeFreeSpacePolicy", c.EffectiveVolumeFreeSpacePolicy) - populateDateTimeRFC3339(objectMap, "lastUpdatedTimestamp", c.LastUpdatedTimestamp) + populateTime[datetime.RFC3339](objectMap, "lastUpdatedTimestamp", c.LastUpdatedTimestamp) return json.Marshal(objectMap) } @@ -697,7 +764,7 @@ func (c *CloudTieringVolumeFreeSpacePolicyStatus) UnmarshalJSON(data []byte) err err = unpopulate(val, "EffectiveVolumeFreeSpacePolicy", &c.EffectiveVolumeFreeSpacePolicy) delete(rawMsg, key) case "lastUpdatedTimestamp": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTimestamp", &c.LastUpdatedTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "LastUpdatedTimestamp", &c.LastUpdatedTimestamp) delete(rawMsg, key) } if err != nil { @@ -707,37 +774,6 @@ func (c *CloudTieringVolumeFreeSpacePolicyStatus) UnmarshalJSON(data []byte) err return nil } -// MarshalJSON implements the json.Marshaller interface for type Error. -func (e Error) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) - populate(objectMap, "innererror", e.Innererror) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Error. -func (e *Error) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) - delete(rawMsg, key) - case "innererror": - err = unpopulate(val, "Innererror", &e.Innererror) - 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 ErrorDetails. func (e ErrorDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -866,12 +902,12 @@ func (i *InnerErrorDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LocationOperationStatus. func (l LocationOperationStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "endTime", l.EndTime) + populateTime[datetime.RFC3339](objectMap, "endTime", l.EndTime) populate(objectMap, "error", l.Error) populate(objectMap, "id", l.ID) populate(objectMap, "name", l.Name) populate(objectMap, "percentComplete", l.PercentComplete) - populateDateTimeRFC3339(objectMap, "startTime", l.StartTime) + populateTime[datetime.RFC3339](objectMap, "startTime", l.StartTime) populate(objectMap, "status", l.Status) return json.Marshal(objectMap) } @@ -886,7 +922,7 @@ func (l *LocationOperationStatus) UnmarshalJSON(data []byte) error { var err error switch key { case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &l.EndTime) + err = unpopulateTime[datetime.RFC3339](val, "EndTime", &l.EndTime) delete(rawMsg, key) case "error": err = unpopulate(val, "Error", &l.Error) @@ -901,7 +937,7 @@ func (l *LocationOperationStatus) UnmarshalJSON(data []byte) error { err = unpopulate(val, "PercentComplete", &l.PercentComplete) delete(rawMsg, key) case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &l.StartTime) + err = unpopulateTime[datetime.RFC3339](val, "StartTime", &l.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &l.Status) @@ -914,47 +950,47 @@ func (l *LocationOperationStatus) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationDisplayInfo. -func (o OperationDisplayInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", o.Description) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "provider", o.Provider) - populate(objectMap, "resource", o.Resource) + 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 OperationDisplayInfo. -func (o *OperationDisplayInfo) UnmarshalJSON(data []byte) error { +// 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", o, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &o.Operation) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) + case "type": + err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationDisplayResource. -func (o OperationDisplayResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationDisplayInfo. +func (o OperationDisplayInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "description", o.Description) populate(objectMap, "operation", o.Operation) @@ -963,8 +999,8 @@ func (o OperationDisplayResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplayResource. -func (o *OperationDisplayResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplayInfo. +func (o *OperationDisplayInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) @@ -1097,6 +1133,7 @@ func (o OperationResourceMetricSpecification) MarshalJSON() ([]byte, error) { populate(objectMap, "displayDescription", o.DisplayDescription) populate(objectMap, "displayName", o.DisplayName) populate(objectMap, "fillGapWithZero", o.FillGapWithZero) + populate(objectMap, "lockAggregationType", o.LockAggregationType) populate(objectMap, "name", o.Name) populate(objectMap, "supportedAggregationTypes", o.SupportedAggregationTypes) populate(objectMap, "unit", o.Unit) @@ -1127,6 +1164,9 @@ func (o *OperationResourceMetricSpecification) UnmarshalJSON(data []byte) error case "fillGapWithZero": err = unpopulate(val, "FillGapWithZero", &o.FillGapWithZero) delete(rawMsg, key) + case "lockAggregationType": + err = unpopulate(val, "LockAggregationType", &o.LockAggregationType) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) @@ -1209,10 +1249,10 @@ func (o *OperationResourceServiceSpecification) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type OperationStatus. func (o OperationStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "endTime", o.EndTime) + populateTime[datetime.RFC3339](objectMap, "endTime", o.EndTime) populate(objectMap, "error", o.Error) populate(objectMap, "name", o.Name) - populateDateTimeRFC3339(objectMap, "startTime", o.StartTime) + populateTime[datetime.RFC3339](objectMap, "startTime", o.StartTime) populate(objectMap, "status", o.Status) return json.Marshal(objectMap) } @@ -1227,7 +1267,7 @@ func (o *OperationStatus) UnmarshalJSON(data []byte) error { var err error switch key { case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &o.EndTime) + err = unpopulateTime[datetime.RFC3339](val, "EndTime", &o.EndTime) delete(rawMsg, key) case "error": err = unpopulate(val, "Error", &o.Error) @@ -1236,7 +1276,7 @@ func (o *OperationStatus) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &o.StartTime) + err = unpopulateTime[datetime.RFC3339](val, "StartTime", &o.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &o.Status) @@ -1490,6 +1530,7 @@ func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { // 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) } @@ -1503,6 +1544,9 @@ func (p *PrivateEndpointConnectionListResult) 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) delete(rawMsg, key) @@ -1517,6 +1561,7 @@ func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "groupIds", p.GroupIDs) populate(objectMap, "privateEndpoint", p.PrivateEndpoint) populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) populate(objectMap, "provisioningState", p.ProvisioningState) @@ -1532,6 +1577,9 @@ func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) + delete(rawMsg, key) case "privateEndpoint": err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) delete(rawMsg, key) @@ -1689,45 +1737,6 @@ func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProxyResource. -func (p ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. -func (p *ProxyResource) 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 "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 RecallActionParameters. func (r RecallActionParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1805,6 +1814,7 @@ func (r *RegisteredServer) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RegisteredServerArray. func (r RegisteredServerArray) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } @@ -1818,6 +1828,9 @@ func (r *RegisteredServerArray) 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) delete(rawMsg, key) @@ -1876,9 +1889,11 @@ func (r *RegisteredServerCreateParameters) UnmarshalJSON(data []byte) error { func (r RegisteredServerCreateParametersProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "agentVersion", r.AgentVersion) + populate(objectMap, "applicationId", r.ApplicationID) populate(objectMap, "clusterId", r.ClusterID) populate(objectMap, "clusterName", r.ClusterName) populate(objectMap, "friendlyName", r.FriendlyName) + populate(objectMap, "identity", r.Identity) populate(objectMap, "lastHeartBeat", r.LastHeartBeat) populate(objectMap, "serverCertificate", r.ServerCertificate) populate(objectMap, "serverId", r.ServerID) @@ -1899,6 +1914,9 @@ func (r *RegisteredServerCreateParametersProperties) UnmarshalJSON(data []byte) case "agentVersion": err = unpopulate(val, "AgentVersion", &r.AgentVersion) delete(rawMsg, key) + case "applicationId": + err = unpopulate(val, "ApplicationID", &r.ApplicationID) + delete(rawMsg, key) case "clusterId": err = unpopulate(val, "ClusterID", &r.ClusterID) delete(rawMsg, key) @@ -1908,6 +1926,9 @@ func (r *RegisteredServerCreateParametersProperties) UnmarshalJSON(data []byte) case "friendlyName": err = unpopulate(val, "FriendlyName", &r.FriendlyName) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &r.Identity) + delete(rawMsg, key) case "lastHeartBeat": err = unpopulate(val, "LastHeartBeat", &r.LastHeartBeat) delete(rawMsg, key) @@ -1934,16 +1955,20 @@ func (r *RegisteredServerCreateParametersProperties) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type RegisteredServerProperties. func (r RegisteredServerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "activeAuthType", r.ActiveAuthType) populate(objectMap, "agentVersion", r.AgentVersion) - populateDateTimeRFC3339(objectMap, "agentVersionExpirationDate", r.AgentVersionExpirationDate) + populateTime[datetime.RFC3339](objectMap, "agentVersionExpirationDate", r.AgentVersionExpirationDate) populate(objectMap, "agentVersionStatus", r.AgentVersionStatus) + populate(objectMap, "applicationId", r.ApplicationID) populate(objectMap, "clusterId", r.ClusterID) populate(objectMap, "clusterName", r.ClusterName) populate(objectMap, "discoveryEndpointUri", r.DiscoveryEndpointURI) populate(objectMap, "friendlyName", r.FriendlyName) + populate(objectMap, "identity", r.Identity) populate(objectMap, "lastHeartBeat", r.LastHeartBeat) populate(objectMap, "lastOperationName", r.LastOperationName) populate(objectMap, "lastWorkflowId", r.LastWorkflowID) + populate(objectMap, "latestApplicationId", r.LatestApplicationID) populate(objectMap, "managementEndpointUri", r.ManagementEndpointURI) populate(objectMap, "monitoringConfiguration", r.MonitoringConfiguration) populate(objectMap, "monitoringEndpointUri", r.MonitoringEndpointURI) @@ -1969,15 +1994,21 @@ func (r *RegisteredServerProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "activeAuthType": + err = unpopulate(val, "ActiveAuthType", &r.ActiveAuthType) + delete(rawMsg, key) case "agentVersion": err = unpopulate(val, "AgentVersion", &r.AgentVersion) delete(rawMsg, key) case "agentVersionExpirationDate": - err = unpopulateDateTimeRFC3339(val, "AgentVersionExpirationDate", &r.AgentVersionExpirationDate) + err = unpopulateTime[datetime.RFC3339](val, "AgentVersionExpirationDate", &r.AgentVersionExpirationDate) delete(rawMsg, key) case "agentVersionStatus": err = unpopulate(val, "AgentVersionStatus", &r.AgentVersionStatus) delete(rawMsg, key) + case "applicationId": + err = unpopulate(val, "ApplicationID", &r.ApplicationID) + delete(rawMsg, key) case "clusterId": err = unpopulate(val, "ClusterID", &r.ClusterID) delete(rawMsg, key) @@ -1990,6 +2021,9 @@ func (r *RegisteredServerProperties) UnmarshalJSON(data []byte) error { case "friendlyName": err = unpopulate(val, "FriendlyName", &r.FriendlyName) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &r.Identity) + delete(rawMsg, key) case "lastHeartBeat": err = unpopulate(val, "LastHeartBeat", &r.LastHeartBeat) delete(rawMsg, key) @@ -1999,6 +2033,9 @@ func (r *RegisteredServerProperties) UnmarshalJSON(data []byte) error { case "lastWorkflowId": err = unpopulate(val, "LastWorkflowID", &r.LastWorkflowID) delete(rawMsg, key) + case "latestApplicationId": + err = unpopulate(val, "LatestApplicationID", &r.LatestApplicationID) + delete(rawMsg, key) case "managementEndpointUri": err = unpopulate(val, "ManagementEndpointURI", &r.ManagementEndpointURI) delete(rawMsg, key) @@ -2046,18 +2083,19 @@ func (r *RegisteredServerProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RegisteredServerUpdateParameters. +func (r RegisteredServerUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RegisteredServerUpdateParameters. +func (r *RegisteredServerUpdateParameters) 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) @@ -2071,6 +2109,9 @@ func (r *Resource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) case "systemData": err = unpopulate(val, "SystemData", &r.SystemData) delete(rawMsg, key) @@ -2085,16 +2126,16 @@ func (r *Resource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourcesMoveInfo. -func (r ResourcesMoveInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RegisteredServerUpdateProperties. +func (r RegisteredServerUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "resources", r.Resources) - populate(objectMap, "targetResourceGroup", r.TargetResourceGroup) + populate(objectMap, "applicationId", r.ApplicationID) + populate(objectMap, "identity", r.Identity) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourcesMoveInfo. -func (r *ResourcesMoveInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RegisteredServerUpdateProperties. +func (r *RegisteredServerUpdateProperties) 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) @@ -2102,11 +2143,11 @@ func (r *ResourcesMoveInfo) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "resources": - err = unpopulate(val, "Resources", &r.Resources) + case "applicationId": + err = unpopulate(val, "ApplicationID", &r.ApplicationID) delete(rawMsg, key) - case "targetResourceGroup": - err = unpopulate(val, "TargetResourceGroup", &r.TargetResourceGroup) + case "identity": + err = unpopulate(val, "Identity", &r.Identity) delete(rawMsg, key) } if err != nil { @@ -2193,6 +2234,7 @@ func (s *ServerEndpoint) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ServerEndpointArray. func (s ServerEndpointArray) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } @@ -2206,6 +2248,9 @@ func (s *ServerEndpointArray) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) @@ -2222,8 +2267,8 @@ func (s ServerEndpointBackgroundDataDownloadActivity) MarshalJSON() ([]byte, err objectMap := make(map[string]any) populate(objectMap, "downloadedBytes", s.DownloadedBytes) populate(objectMap, "percentProgress", s.PercentProgress) - populateDateTimeRFC3339(objectMap, "startedTimestamp", s.StartedTimestamp) - populateDateTimeRFC3339(objectMap, "timestamp", s.Timestamp) + populateTime[datetime.RFC3339](objectMap, "startedTimestamp", s.StartedTimestamp) + populateTime[datetime.RFC3339](objectMap, "timestamp", s.Timestamp) return json.Marshal(objectMap) } @@ -2243,10 +2288,10 @@ func (s *ServerEndpointBackgroundDataDownloadActivity) UnmarshalJSON(data []byte err = unpopulate(val, "PercentProgress", &s.PercentProgress) delete(rawMsg, key) case "startedTimestamp": - err = unpopulateDateTimeRFC3339(val, "StartedTimestamp", &s.StartedTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "StartedTimestamp", &s.StartedTimestamp) delete(rawMsg, key) case "timestamp": - err = unpopulateDateTimeRFC3339(val, "Timestamp", &s.Timestamp) + err = unpopulateTime[datetime.RFC3339](val, "Timestamp", &s.Timestamp) delete(rawMsg, key) } if err != nil { @@ -2263,10 +2308,11 @@ func (s ServerEndpointCloudTieringStatus) MarshalJSON() ([]byte, error) { populate(objectMap, "datePolicyStatus", s.DatePolicyStatus) populate(objectMap, "filesNotTiering", s.FilesNotTiering) populate(objectMap, "health", s.Health) - populateDateTimeRFC3339(objectMap, "healthLastUpdatedTimestamp", s.HealthLastUpdatedTimestamp) + populateTime[datetime.RFC3339](objectMap, "healthLastUpdatedTimestamp", s.HealthLastUpdatedTimestamp) populate(objectMap, "lastCloudTieringResult", s.LastCloudTieringResult) - populateDateTimeRFC3339(objectMap, "lastSuccessTimestamp", s.LastSuccessTimestamp) - populateDateTimeRFC3339(objectMap, "lastUpdatedTimestamp", s.LastUpdatedTimestamp) + populateTime[datetime.RFC3339](objectMap, "lastSuccessTimestamp", s.LastSuccessTimestamp) + populateTime[datetime.RFC3339](objectMap, "lastUpdatedTimestamp", s.LastUpdatedTimestamp) + populate(objectMap, "lowDiskMode", s.LowDiskMode) populate(objectMap, "spaceSavings", s.SpaceSavings) populate(objectMap, "volumeFreeSpacePolicyStatus", s.VolumeFreeSpacePolicyStatus) return json.Marshal(objectMap) @@ -2294,16 +2340,19 @@ func (s *ServerEndpointCloudTieringStatus) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Health", &s.Health) delete(rawMsg, key) case "healthLastUpdatedTimestamp": - err = unpopulateDateTimeRFC3339(val, "HealthLastUpdatedTimestamp", &s.HealthLastUpdatedTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "HealthLastUpdatedTimestamp", &s.HealthLastUpdatedTimestamp) delete(rawMsg, key) case "lastCloudTieringResult": err = unpopulate(val, "LastCloudTieringResult", &s.LastCloudTieringResult) delete(rawMsg, key) case "lastSuccessTimestamp": - err = unpopulateDateTimeRFC3339(val, "LastSuccessTimestamp", &s.LastSuccessTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "LastSuccessTimestamp", &s.LastSuccessTimestamp) delete(rawMsg, key) case "lastUpdatedTimestamp": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTimestamp", &s.LastUpdatedTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "LastUpdatedTimestamp", &s.LastUpdatedTimestamp) + delete(rawMsg, key) + case "lowDiskMode": + err = unpopulate(val, "LowDiskMode", &s.LowDiskMode) delete(rawMsg, key) case "spaceSavings": err = unpopulate(val, "SpaceSavings", &s.SpaceSavings) @@ -2481,6 +2530,7 @@ func (s ServerEndpointProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "offlineDataTransferStorageAccountTenantId", s.OfflineDataTransferStorageAccountTenantID) populate(objectMap, "provisioningState", s.ProvisioningState) populate(objectMap, "recallStatus", s.RecallStatus) + populate(objectMap, "serverEndpointProvisioningStatus", s.ServerEndpointProvisioningStatus) populate(objectMap, "serverLocalPath", s.ServerLocalPath) populate(objectMap, "serverName", s.ServerName) populate(objectMap, "serverResourceId", s.ServerResourceID) @@ -2541,6 +2591,9 @@ func (s *ServerEndpointProperties) UnmarshalJSON(data []byte) error { case "recallStatus": err = unpopulate(val, "RecallStatus", &s.RecallStatus) delete(rawMsg, key) + case "serverEndpointProvisioningStatus": + err = unpopulate(val, "ServerEndpointProvisioningStatus", &s.ServerEndpointProvisioningStatus) + delete(rawMsg, key) case "serverLocalPath": err = unpopulate(val, "ServerLocalPath", &s.ServerLocalPath) delete(rawMsg, key) @@ -2567,6 +2620,96 @@ func (s *ServerEndpointProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ServerEndpointProvisioningStatus. +func (s ServerEndpointProvisioningStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningStatus", s.ProvisioningStatus) + populate(objectMap, "provisioningStepStatuses", s.ProvisioningStepStatuses) + populate(objectMap, "provisioningType", s.ProvisioningType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerEndpointProvisioningStatus. +func (s *ServerEndpointProvisioningStatus) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningStatus": + err = unpopulate(val, "ProvisioningStatus", &s.ProvisioningStatus) + delete(rawMsg, key) + case "provisioningStepStatuses": + err = unpopulate(val, "ProvisioningStepStatuses", &s.ProvisioningStepStatuses) + delete(rawMsg, key) + case "provisioningType": + err = unpopulate(val, "ProvisioningType", &s.ProvisioningType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerEndpointProvisioningStepStatus. +func (s ServerEndpointProvisioningStepStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInformation", s.AdditionalInformation) + populateTime[datetime.RFC3339](objectMap, "endTime", s.EndTime) + populate(objectMap, "errorCode", s.ErrorCode) + populate(objectMap, "minutesLeft", s.MinutesLeft) + populate(objectMap, "name", s.Name) + populate(objectMap, "progressPercentage", s.ProgressPercentage) + populateTime[datetime.RFC3339](objectMap, "startTime", s.StartTime) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerEndpointProvisioningStepStatus. +func (s *ServerEndpointProvisioningStepStatus) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInformation": + err = unpopulate(val, "AdditionalInformation", &s.AdditionalInformation) + delete(rawMsg, key) + case "endTime": + err = unpopulateTime[datetime.RFC3339](val, "EndTime", &s.EndTime) + delete(rawMsg, key) + case "errorCode": + err = unpopulate(val, "ErrorCode", &s.ErrorCode) + delete(rawMsg, key) + case "minutesLeft": + err = unpopulate(val, "MinutesLeft", &s.MinutesLeft) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "progressPercentage": + err = unpopulate(val, "ProgressPercentage", &s.ProgressPercentage) + delete(rawMsg, key) + case "startTime": + err = unpopulateTime[datetime.RFC3339](val, "StartTime", &s.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ServerEndpointRecallError. func (s ServerEndpointRecallError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2601,7 +2744,7 @@ func (s *ServerEndpointRecallError) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ServerEndpointRecallStatus. func (s ServerEndpointRecallStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "lastUpdatedTimestamp", s.LastUpdatedTimestamp) + populateTime[datetime.RFC3339](objectMap, "lastUpdatedTimestamp", s.LastUpdatedTimestamp) populate(objectMap, "recallErrors", s.RecallErrors) populate(objectMap, "totalRecallErrorsCount", s.TotalRecallErrorsCount) return json.Marshal(objectMap) @@ -2617,7 +2760,7 @@ func (s *ServerEndpointRecallStatus) UnmarshalJSON(data []byte) error { var err error switch key { case "lastUpdatedTimestamp": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTimestamp", &s.LastUpdatedTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "LastUpdatedTimestamp", &s.LastUpdatedTimestamp) delete(rawMsg, key) case "recallErrors": err = unpopulate(val, "RecallErrors", &s.RecallErrors) @@ -2641,7 +2784,7 @@ func (s ServerEndpointSyncActivityStatus) MarshalJSON() ([]byte, error) { populate(objectMap, "perItemErrorCount", s.PerItemErrorCount) populate(objectMap, "sessionMinutesRemaining", s.SessionMinutesRemaining) populate(objectMap, "syncMode", s.SyncMode) - populateDateTimeRFC3339(objectMap, "timestamp", s.Timestamp) + populateTime[datetime.RFC3339](objectMap, "timestamp", s.Timestamp) populate(objectMap, "totalBytes", s.TotalBytes) populate(objectMap, "totalItemCount", s.TotalItemCount) return json.Marshal(objectMap) @@ -2672,7 +2815,7 @@ func (s *ServerEndpointSyncActivityStatus) UnmarshalJSON(data []byte) error { err = unpopulate(val, "SyncMode", &s.SyncMode) delete(rawMsg, key) case "timestamp": - err = unpopulateDateTimeRFC3339(val, "Timestamp", &s.Timestamp) + err = unpopulateTime[datetime.RFC3339](val, "Timestamp", &s.Timestamp) delete(rawMsg, key) case "totalBytes": err = unpopulate(val, "TotalBytes", &s.TotalBytes) @@ -2695,8 +2838,8 @@ func (s ServerEndpointSyncSessionStatus) MarshalJSON() ([]byte, error) { populate(objectMap, "lastSyncMode", s.LastSyncMode) populate(objectMap, "lastSyncPerItemErrorCount", s.LastSyncPerItemErrorCount) populate(objectMap, "lastSyncResult", s.LastSyncResult) - populateDateTimeRFC3339(objectMap, "lastSyncSuccessTimestamp", s.LastSyncSuccessTimestamp) - populateDateTimeRFC3339(objectMap, "lastSyncTimestamp", s.LastSyncTimestamp) + populateTime[datetime.RFC3339](objectMap, "lastSyncSuccessTimestamp", s.LastSyncSuccessTimestamp) + populateTime[datetime.RFC3339](objectMap, "lastSyncTimestamp", s.LastSyncTimestamp) populate(objectMap, "persistentFilesNotSyncingCount", s.PersistentFilesNotSyncingCount) populate(objectMap, "transientFilesNotSyncingCount", s.TransientFilesNotSyncingCount) return json.Marshal(objectMap) @@ -2724,10 +2867,10 @@ func (s *ServerEndpointSyncSessionStatus) UnmarshalJSON(data []byte) error { err = unpopulate(val, "LastSyncResult", &s.LastSyncResult) delete(rawMsg, key) case "lastSyncSuccessTimestamp": - err = unpopulateDateTimeRFC3339(val, "LastSyncSuccessTimestamp", &s.LastSyncSuccessTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "LastSyncSuccessTimestamp", &s.LastSyncSuccessTimestamp) delete(rawMsg, key) case "lastSyncTimestamp": - err = unpopulateDateTimeRFC3339(val, "LastSyncTimestamp", &s.LastSyncTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "LastSyncTimestamp", &s.LastSyncTimestamp) delete(rawMsg, key) case "persistentFilesNotSyncingCount": err = unpopulate(val, "PersistentFilesNotSyncingCount", &s.PersistentFilesNotSyncingCount) @@ -2751,7 +2894,7 @@ func (s ServerEndpointSyncStatus) MarshalJSON() ([]byte, error) { populate(objectMap, "downloadActivity", s.DownloadActivity) populate(objectMap, "downloadHealth", s.DownloadHealth) populate(objectMap, "downloadStatus", s.DownloadStatus) - populateDateTimeRFC3339(objectMap, "lastUpdatedTimestamp", s.LastUpdatedTimestamp) + populateTime[datetime.RFC3339](objectMap, "lastUpdatedTimestamp", s.LastUpdatedTimestamp) populate(objectMap, "offlineDataTransferStatus", s.OfflineDataTransferStatus) populate(objectMap, "syncActivity", s.SyncActivity) populate(objectMap, "totalPersistentFilesNotSyncingCount", s.TotalPersistentFilesNotSyncingCount) @@ -2786,7 +2929,7 @@ func (s *ServerEndpointSyncStatus) UnmarshalJSON(data []byte) error { err = unpopulate(val, "DownloadStatus", &s.DownloadStatus) delete(rawMsg, key) case "lastUpdatedTimestamp": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTimestamp", &s.LastUpdatedTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "LastUpdatedTimestamp", &s.LastUpdatedTimestamp) delete(rawMsg, key) case "offlineDataTransferStatus": err = unpopulate(val, "OfflineDataTransferStatus", &s.OfflineDataTransferStatus) @@ -2892,6 +3035,7 @@ func (s *ServerEndpointUpdateProperties) UnmarshalJSON(data []byte) error { func (s Service) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) @@ -2913,6 +3057,9 @@ func (s *Service) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) @@ -2942,6 +3089,7 @@ func (s *Service) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ServiceArray. func (s ServiceArray) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } @@ -2955,6 +3103,9 @@ func (s *ServiceArray) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) @@ -2969,9 +3120,14 @@ func (s *ServiceArray) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ServiceCreateParameters. func (s ServiceCreateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } @@ -2984,15 +3140,30 @@ func (s *ServiceCreateParameters) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &s.Tags) delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -3005,6 +3176,7 @@ func (s *ServiceCreateParameters) UnmarshalJSON(data []byte) error { func (s ServiceCreateParametersProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "incomingTrafficPolicy", s.IncomingTrafficPolicy) + populate(objectMap, "useIdentity", s.UseIdentity) return json.Marshal(objectMap) } @@ -3020,6 +3192,9 @@ func (s *ServiceCreateParametersProperties) UnmarshalJSON(data []byte) error { case "incomingTrafficPolicy": err = unpopulate(val, "IncomingTrafficPolicy", &s.IncomingTrafficPolicy) delete(rawMsg, key) + case "useIdentity": + err = unpopulate(val, "UseIdentity", &s.UseIdentity) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -3038,6 +3213,7 @@ func (s ServiceProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "provisioningState", s.ProvisioningState) populate(objectMap, "storageSyncServiceStatus", s.StorageSyncServiceStatus) populate(objectMap, "storageSyncServiceUid", s.StorageSyncServiceUID) + populate(objectMap, "useIdentity", s.UseIdentity) return json.Marshal(objectMap) } @@ -3071,6 +3247,9 @@ func (s *ServiceProperties) UnmarshalJSON(data []byte) error { case "storageSyncServiceUid": err = unpopulate(val, "StorageSyncServiceUID", &s.StorageSyncServiceUID) delete(rawMsg, key) + case "useIdentity": + err = unpopulate(val, "UseIdentity", &s.UseIdentity) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -3082,6 +3261,7 @@ func (s *ServiceProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ServiceUpdateParameters. func (s ServiceUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "identity", s.Identity) populate(objectMap, "properties", s.Properties) populate(objectMap, "tags", s.Tags) return json.Marshal(objectMap) @@ -3096,6 +3276,9 @@ func (s *ServiceUpdateParameters) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) @@ -3114,6 +3297,7 @@ func (s *ServiceUpdateParameters) UnmarshalJSON(data []byte) error { func (s ServiceUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "incomingTrafficPolicy", s.IncomingTrafficPolicy) + populate(objectMap, "useIdentity", s.UseIdentity) return json.Marshal(objectMap) } @@ -3129,40 +3313,8 @@ func (s *ServiceUpdateProperties) UnmarshalJSON(data []byte) error { case "incomingTrafficPolicy": err = unpopulate(val, "IncomingTrafficPolicy", &s.IncomingTrafficPolicy) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SubscriptionState. -func (s SubscriptionState) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "istransitioning", s.Istransitioning) - populateAny(objectMap, "properties", s.Properties) - populate(objectMap, "state", s.State) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionState. -func (s *SubscriptionState) 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) - } - for key, val := range rawMsg { - var err error - switch key { - case "istransitioning": - err = unpopulate(val, "Istransitioning", &s.Istransitioning) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &s.State) + case "useIdentity": + err = unpopulate(val, "UseIdentity", &s.UseIdentity) delete(rawMsg, key) } if err != nil { @@ -3218,6 +3370,7 @@ func (s *SyncGroup) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SyncGroupArray. func (s SyncGroupArray) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } @@ -3231,6 +3384,9 @@ func (s *SyncGroupArray) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) @@ -3319,10 +3475,10 @@ func (s *SyncGroupProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populateTime[datetime.RFC3339](objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populateTime[datetime.RFC3339](objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -3338,7 +3494,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + err = unpopulateTime[datetime.RFC3339](val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, "CreatedBy", &s.CreatedBy) @@ -3347,7 +3503,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + err = unpopulateTime[datetime.RFC3339](val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) @@ -3363,53 +3519,6 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "systemData", t.SystemData) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. -func (t *TrackedResource) 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) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &t.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &t.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type TriggerChangeDetectionParameters. func (t TriggerChangeDetectionParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3472,6 +3581,37 @@ func (t *TriggerRolloverRequest) UnmarshalJSON(data []byte) error { return nil } +// 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 Workflow. func (w Workflow) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3518,6 +3658,7 @@ func (w *Workflow) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type WorkflowArray. func (w WorkflowArray) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", w.NextLink) populate(objectMap, "value", w.Value) return json.Marshal(objectMap) } @@ -3531,6 +3672,9 @@ func (w *WorkflowArray) UnmarshalJSON(data []byte) error { 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) @@ -3546,9 +3690,9 @@ func (w *WorkflowArray) UnmarshalJSON(data []byte) error { func (w WorkflowProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "commandName", w.CommandName) - populateDateTimeRFC3339(objectMap, "createdTimestamp", w.CreatedTimestamp) + populateTime[datetime.RFC3339](objectMap, "createdTimestamp", w.CreatedTimestamp) populate(objectMap, "lastOperationId", w.LastOperationID) - populateDateTimeRFC3339(objectMap, "lastStatusTimestamp", w.LastStatusTimestamp) + populateTime[datetime.RFC3339](objectMap, "lastStatusTimestamp", w.LastStatusTimestamp) populate(objectMap, "lastStepName", w.LastStepName) populate(objectMap, "operation", w.Operation) populate(objectMap, "status", w.Status) @@ -3569,13 +3713,13 @@ func (w *WorkflowProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "CommandName", &w.CommandName) delete(rawMsg, key) case "createdTimestamp": - err = unpopulateDateTimeRFC3339(val, "CreatedTimestamp", &w.CreatedTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "CreatedTimestamp", &w.CreatedTimestamp) delete(rawMsg, key) case "lastOperationId": err = unpopulate(val, "LastOperationID", &w.LastOperationID) delete(rawMsg, key) case "lastStatusTimestamp": - err = unpopulateDateTimeRFC3339(val, "LastStatusTimestamp", &w.LastStatusTimestamp) + err = unpopulateTime[datetime.RFC3339](val, "LastStatusTimestamp", &w.LastStatusTimestamp) delete(rawMsg, key) case "lastStepName": err = unpopulate(val, "LastStepName", &w.LastStepName) @@ -3607,6 +3751,17 @@ func populate(m map[string]any, k string, v any) { } } +func populateTime[T dateTimeConstraints](m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + } else if !reflect.ValueOf(t).IsNil() { + newTime := T(*t) + m[k] = (*T)(&newTime) + } +} + func populateAny(m map[string]any, k string, v any) { if v == nil { return @@ -3618,7 +3773,7 @@ func populateAny(m map[string]any, k string, v any) { } 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 { @@ -3626,3 +3781,20 @@ func unpopulate(data json.RawMessage, fn string, v any) error { } return nil } + +func unpopulateTime[T dateTimeConstraints](data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux T + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + newTime := time.Time(aux) + *t = &newTime + return nil +} + +type dateTimeConstraints interface { + datetime.PlainDate | datetime.PlainTime | datetime.RFC1123 | datetime.RFC3339 | datetime.Unix +} diff --git a/sdk/resourcemanager/storagesync/armstoragesync/operations_client.go b/sdk/resourcemanager/storagesync/armstoragesync/operations_client.go index ce689a8525fe..bf7be20304dd 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/operations_client.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/operations_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 armstoragesync @@ -22,7 +21,7 @@ type OperationsClient struct { // NewOperationsClient creates a new instance of OperationsClient with the specified values. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -34,9 +33,9 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - Lists all of the available Storage Sync Rest API operations. +// NewListPager - List the operations for the provider // -// Generated from API version 2020-09-01 +// Generated from API version 2022-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]{ @@ -62,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.StorageSync/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", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -79,10 +78,10 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { result := OperationsClientListResponse{} if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { - result.XMSCorrelationRequestID = &val + result.CorrelationRequestID = &val } if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val + result.RequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.OperationEntityListResult); err != nil { return OperationsClientListResponse{}, err diff --git a/sdk/resourcemanager/storagesync/armstoragesync/operations_client_example_test.go b/sdk/resourcemanager/storagesync/armstoragesync/operations_client_example_test.go index cba22d3166cf..9838278a80cd 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/operations_client_example_test.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/operations_client_example_test.go @@ -1,27 +1,24 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for 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 armstoragesync_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/Operations_List.json +// Generated from example definition: 2022-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 := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -36,831 +33,872 @@ 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.OperationEntityListResult = armstoragesync.OperationEntityListResult{ - // Value: []*armstoragesync.OperationEntity{ - // { - // Name: to.Ptr("microsoft.storagesync/register/action"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Registers the subscription for the Storage Sync Provider"), - // Operation: to.Ptr("Registers the Storage Sync Provider"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Storage Sync Provider"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/unregister/action"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Unregisters the subscription for the Storage Sync Provider"), - // Operation: to.Ptr("Unregisters the Storage Sync Provider"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Storage Sync Provider"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/operations/read"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Gets a list of the Supported Operations"), - // Operation: to.Ptr("Gets the Supported Operations"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Supported Operations"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/read"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Read any Storage Sync Services"), - // Operation: to.Ptr("Read Storage Sync Services"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Storage Sync Services"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/write"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Create or Update any Storage Sync Services"), - // Operation: to.Ptr("Create or Update Storage Sync Services"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Storage Sync Services"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/delete"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Delete any Storage Sync Services"), - // Operation: to.Ptr("Delete Storage Sync Services"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Storage Sync Services"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/providers/Microsoft.Insights/metricDefinitions/read"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Gets the available metrics for Storage Sync Services"), - // Operation: to.Ptr("Read Storage Sync Services metric definitions"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Storage Sync Metrics"), - // }, - // Origin: to.Ptr("System"), - // Properties: &armstoragesync.OperationProperties{ - // ServiceSpecification: &armstoragesync.OperationResourceServiceSpecification{ - // MetricSpecifications: []*armstoragesync.OperationResourceMetricSpecification{ - // { - // Name: to.Ptr("ServerSyncSessionResult"), - // AggregationType: to.Ptr("Average"), - // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ - // { - // Name: to.Ptr("SyncGroupName"), - // DisplayName: to.Ptr("Sync Group Name"), - // ToBeExportedForShoebox: to.Ptr(true), + // page = armstoragesync.OperationsClientListResponse{ + // OperationEntityListResult: armstoragesync.OperationEntityListResult{ + // NextLink: to.Ptr("https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example-rg/providers/Microsoft.StorageActions/storageTasks/example-task/reports?api-version=2023-01-01&monitor=true&$skiptoken=fake-continuation-token-12345"), + // Value: []*armstoragesync.OperationEntity{ + // { + // Name: to.Ptr("microsoft.storagesync/register/action"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Registers the subscription for the Storage Sync Provider"), + // Operation: to.Ptr("Registers the Storage Sync Provider"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Storage Sync Provider"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/unregister/action"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Unregisters the subscription for the Storage Sync Provider"), + // Operation: to.Ptr("Unregisters the Storage Sync Provider"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Storage Sync Provider"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/operations/read"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Gets a list of the Supported Operations"), + // Operation: to.Ptr("Gets the Supported Operations"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Supported Operations"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/read"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Read any Storage Sync Services"), + // Operation: to.Ptr("Read Storage Sync Services"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Storage Sync Services"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/write"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Create or Update any Storage Sync Services"), + // Operation: to.Ptr("Create or Update Storage Sync Services"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Storage Sync Services"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/delete"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Delete any Storage Sync Services"), + // Operation: to.Ptr("Delete Storage Sync Services"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Storage Sync Services"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/providers/Microsoft.Insights/metricDefinitions/read"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Gets the available metrics for Storage Sync Services"), + // Operation: to.Ptr("Read Storage Sync Services metric definitions"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Storage Sync Metrics"), + // }, + // Origin: to.Ptr("System"), + // Properties: &armstoragesync.OperationProperties{ + // ServiceSpecification: &armstoragesync.OperationResourceServiceSpecification{ + // MetricSpecifications: []*armstoragesync.OperationResourceMetricSpecification{ + // { + // Name: to.Ptr("ServerSyncSessionResult"), + // AggregationType: to.Ptr("Average"), + // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ + // { + // Name: to.Ptr("SyncGroupName"), + // DisplayName: to.Ptr("Sync Group Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("ServerEndpointName"), + // DisplayName: to.Ptr("Server Endpoint Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("SyncDirection"), + // DisplayName: to.Ptr("Sync Direction"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, // }, - // { - // Name: to.Ptr("ServerEndpointName"), - // DisplayName: to.Ptr("Server Endpoint Name"), - // ToBeExportedForShoebox: to.Ptr(true), + // DisplayDescription: to.Ptr("Metric that logs a value of 1 each time the Server Endpoint successfully completes a Sync Session with the Cloud Endpoint"), + // DisplayName: to.Ptr("Sync Session Result"), + // FillGapWithZero: to.Ptr(false), + // LockAggregationType: to.Ptr("Average"), + // Unit: to.Ptr("Count"), + // }, + // { + // Name: to.Ptr("StorageSyncSyncSessionAppliedFilesCount"), + // AggregationType: to.Ptr("Total"), + // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ + // { + // Name: to.Ptr("SyncGroupName"), + // DisplayName: to.Ptr("Sync Group Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("ServerEndpointName"), + // DisplayName: to.Ptr("Server Endpoint Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("SyncDirection"), + // DisplayName: to.Ptr("Sync Direction"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, // }, - // { - // Name: to.Ptr("SyncDirection"), - // DisplayName: to.Ptr("Sync Direction"), - // ToBeExportedForShoebox: to.Ptr(true), - // }}, - // DisplayDescription: to.Ptr("Metric that logs a value of 1 each time the Server Endpoint successfully completes a Sync Session with the Cloud Endpoint"), - // DisplayName: to.Ptr("Sync Session Result"), - // FillGapWithZero: to.Ptr(false), - // Unit: to.Ptr("Count"), - // }, - // { - // Name: to.Ptr("StorageSyncSyncSessionAppliedFilesCount"), - // AggregationType: to.Ptr("Total"), - // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ - // { - // Name: to.Ptr("SyncGroupName"), - // DisplayName: to.Ptr("Sync Group Name"), - // ToBeExportedForShoebox: to.Ptr(true), + // DisplayDescription: to.Ptr("Count of Files synced"), + // DisplayName: to.Ptr("Files Synced"), + // FillGapWithZero: to.Ptr(false), + // LockAggregationType: to.Ptr("Average"), + // Unit: to.Ptr("Count"), + // }, + // { + // Name: to.Ptr("StorageSyncSyncSessionPerItemErrorsCount"), + // AggregationType: to.Ptr("Total"), + // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ + // { + // Name: to.Ptr("SyncGroupName"), + // DisplayName: to.Ptr("Sync Group Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("ServerEndpointName"), + // DisplayName: to.Ptr("Server Endpoint Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("SyncDirection"), + // DisplayName: to.Ptr("Sync Direction"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, // }, - // { - // Name: to.Ptr("ServerEndpointName"), - // DisplayName: to.Ptr("Server Endpoint Name"), - // ToBeExportedForShoebox: to.Ptr(true), + // DisplayDescription: to.Ptr("Count of files failed to sync"), + // DisplayName: to.Ptr("Files not syncing"), + // FillGapWithZero: to.Ptr(false), + // LockAggregationType: to.Ptr("Average"), + // Unit: to.Ptr("Count"), + // }, + // { + // Name: to.Ptr("StorageSyncBatchTransferredFileBytes"), + // AggregationType: to.Ptr("Total"), + // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ + // { + // Name: to.Ptr("SyncGroupName"), + // DisplayName: to.Ptr("Sync Group Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("ServerEndpointName"), + // DisplayName: to.Ptr("Server Endpoint Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("SyncDirection"), + // DisplayName: to.Ptr("Sync Direction"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, // }, - // { - // Name: to.Ptr("SyncDirection"), - // DisplayName: to.Ptr("Sync Direction"), - // ToBeExportedForShoebox: to.Ptr(true), - // }}, - // DisplayDescription: to.Ptr("Count of Files synced"), - // DisplayName: to.Ptr("Files Synced"), - // FillGapWithZero: to.Ptr(false), - // Unit: to.Ptr("Count"), - // }, - // { - // Name: to.Ptr("StorageSyncSyncSessionPerItemErrorsCount"), - // AggregationType: to.Ptr("Total"), - // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ - // { - // Name: to.Ptr("SyncGroupName"), - // DisplayName: to.Ptr("Sync Group Name"), - // ToBeExportedForShoebox: to.Ptr(true), + // DisplayDescription: to.Ptr("Total file size transferred for Sync Sessions"), + // DisplayName: to.Ptr("Bytes synced"), + // FillGapWithZero: to.Ptr(false), + // LockAggregationType: to.Ptr("Average"), + // Unit: to.Ptr("Bytes"), + // }, + // { + // Name: to.Ptr("StorageSyncServerHeartbeat"), + // AggregationType: to.Ptr("Maximum"), + // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ + // { + // Name: to.Ptr("ServerName"), + // DisplayName: to.Ptr("Server Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, // }, - // { - // Name: to.Ptr("ServerEndpointName"), - // DisplayName: to.Ptr("Server Endpoint Name"), - // ToBeExportedForShoebox: to.Ptr(true), + // DisplayDescription: to.Ptr("Metric that logs a value of 1 each time the resigtered server successfully records a heartbeat with the Cloud Endpoint"), + // DisplayName: to.Ptr("Server Online Status"), + // FillGapWithZero: to.Ptr(true), + // Unit: to.Ptr("Count"), + // }, + // { + // Name: to.Ptr("StorageSyncRecallIOTotalSizeBytes"), + // AggregationType: to.Ptr("Total"), + // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ + // { + // Name: to.Ptr("ServerName"), + // DisplayName: to.Ptr("Server Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, // }, - // { - // Name: to.Ptr("SyncDirection"), - // DisplayName: to.Ptr("Sync Direction"), - // ToBeExportedForShoebox: to.Ptr(true), - // }}, - // DisplayDescription: to.Ptr("Count of files failed to sync"), - // DisplayName: to.Ptr("Files not syncing"), - // FillGapWithZero: to.Ptr(false), - // Unit: to.Ptr("Count"), - // }, - // { - // Name: to.Ptr("StorageSyncBatchTransferredFileBytes"), - // AggregationType: to.Ptr("Total"), - // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ - // { - // Name: to.Ptr("SyncGroupName"), - // DisplayName: to.Ptr("Sync Group Name"), - // ToBeExportedForShoebox: to.Ptr(true), + // DisplayDescription: to.Ptr("Total size of data recalled by the server"), + // DisplayName: to.Ptr("Cloud tiering recall"), + // FillGapWithZero: to.Ptr(false), + // LockAggregationType: to.Ptr("Average"), + // Unit: to.Ptr("Bytes"), + // }, + // { + // Name: to.Ptr("StorageSyncRecalledTotalNetworkBytes"), + // AggregationType: to.Ptr("Total"), + // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ + // { + // Name: to.Ptr("SyncGroupName"), + // DisplayName: to.Ptr("Sync Group Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("ServerName"), + // DisplayName: to.Ptr("Server Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, // }, - // { - // Name: to.Ptr("ServerEndpointName"), - // DisplayName: to.Ptr("Server Endpoint Name"), - // ToBeExportedForShoebox: to.Ptr(true), + // DisplayDescription: to.Ptr("Size of data recalled"), + // DisplayName: to.Ptr("Cloud tiering recall size"), + // FillGapWithZero: to.Ptr(false), + // LockAggregationType: to.Ptr("Average"), + // Unit: to.Ptr("Bytes"), + // }, + // { + // Name: to.Ptr("StorageSyncRecallThroughputBytesPerSecond"), + // AggregationType: to.Ptr("Average"), + // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ + // { + // Name: to.Ptr("SyncGroupName"), + // DisplayName: to.Ptr("Sync Group Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("ServerName"), + // DisplayName: to.Ptr("Server Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, // }, - // { - // Name: to.Ptr("SyncDirection"), - // DisplayName: to.Ptr("Sync Direction"), - // ToBeExportedForShoebox: to.Ptr(true), - // }}, - // DisplayDescription: to.Ptr("Total file size transferred for Sync Sessions"), - // DisplayName: to.Ptr("Bytes synced"), - // FillGapWithZero: to.Ptr(false), - // Unit: to.Ptr("Bytes"), - // }, - // { - // Name: to.Ptr("StorageSyncServerHeartbeat"), - // AggregationType: to.Ptr("Maximum"), - // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ - // { - // Name: to.Ptr("ServerName"), - // DisplayName: to.Ptr("Server Name"), - // ToBeExportedForShoebox: to.Ptr(true), - // }}, - // DisplayDescription: to.Ptr("Metric that logs a value of 1 each time the resigtered server successfully records a heartbeat with the Cloud Endpoint"), - // DisplayName: to.Ptr("Server Online Status"), - // FillGapWithZero: to.Ptr(true), - // Unit: to.Ptr("Count"), - // }, - // { - // Name: to.Ptr("StorageSyncRecallIOTotalSizeBytes"), - // AggregationType: to.Ptr("Total"), - // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ - // { - // Name: to.Ptr("ServerName"), - // DisplayName: to.Ptr("Server Name"), - // ToBeExportedForShoebox: to.Ptr(true), - // }}, - // DisplayDescription: to.Ptr("Total size of data recalled by the server"), - // DisplayName: to.Ptr("Cloud tiering recall"), - // FillGapWithZero: to.Ptr(false), - // Unit: to.Ptr("Bytes"), - // }, - // { - // Name: to.Ptr("StorageSyncRecalledTotalNetworkBytes"), - // AggregationType: to.Ptr("Total"), - // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ - // { - // Name: to.Ptr("SyncGroupName"), - // DisplayName: to.Ptr("Sync Group Name"), - // ToBeExportedForShoebox: to.Ptr(true), + // DisplayDescription: to.Ptr("Size of data recall throughput"), + // DisplayName: to.Ptr("Cloud tiering recall throughput"), + // FillGapWithZero: to.Ptr(false), + // LockAggregationType: to.Ptr("Average"), + // Unit: to.Ptr("BytesPerSecond"), + // }, + // { + // Name: to.Ptr("StorageSyncRecalledNetworkBytesByApplication"), + // AggregationType: to.Ptr("Total"), + // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ + // { + // Name: to.Ptr("SyncGroupName"), + // DisplayName: to.Ptr("Sync Group Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("ServerName"), + // DisplayName: to.Ptr("Server Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("ApplicationName"), + // DisplayName: to.Ptr("Application Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, // }, - // { - // Name: to.Ptr("ServerName"), - // DisplayName: to.Ptr("Server Name"), - // ToBeExportedForShoebox: to.Ptr(true), - // }}, - // DisplayDescription: to.Ptr("Size of data recalled"), - // DisplayName: to.Ptr("Cloud tiering recall size"), - // FillGapWithZero: to.Ptr(false), - // Unit: to.Ptr("Bytes"), + // DisplayDescription: to.Ptr("Size of data recalled by application"), + // DisplayName: to.Ptr("Cloud tiering recall size by application"), + // FillGapWithZero: to.Ptr(false), + // LockAggregationType: to.Ptr("Average"), + // Unit: to.Ptr("Bytes"), + // }, // }, - // { - // Name: to.Ptr("StorageSyncRecallThroughputBytesPerSecond"), - // AggregationType: to.Ptr("Average"), - // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ - // { - // Name: to.Ptr("SyncGroupName"), - // DisplayName: to.Ptr("Sync Group Name"), - // ToBeExportedForShoebox: to.Ptr(true), + // }, + // }, + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/privateLinkResources/read"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Read any Private Link Resources"), + // Operation: to.Ptr("Read Private Link Resources"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Private Link Resources"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/privateEndpointConnections/read"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Read any Private Endpoint Connections"), + // Operation: to.Ptr("Read Private Endpoint Connections"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Private Endpoint Connections"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/privateEndpointConnections/write"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Create or Update any Private Endpoint Connections"), + // Operation: to.Ptr("Create or Update Private Endpoint Connections"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Private Endpoint Connections"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/privateEndpointConnections/delete"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Delete any Private Endpoint Connections"), + // Operation: to.Ptr("Delete Private Endpoint Connections"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Private Endpoint Connections"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/privateEndpointConnectionProxies/validate/action"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Validate any Private Endpoint ConnectionProxies"), + // Operation: to.Ptr("Validate Private Endpoint ConnectionProxies"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Private Endpoint ConnectionProxies"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/privateEndpointConnectionProxies/read"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Read any Private Endpoint ConnectionProxies"), + // Operation: to.Ptr("Read Private Endpoint ConnectionProxies"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Private Endpoint ConnectionProxies"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/privateEndpointConnectionProxies/write"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Create or Update any Private Endpoint ConnectionProxies"), + // Operation: to.Ptr("Create or Update Private Endpoint ConnectionProxies"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Private Endpoint ConnectionProxies"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/privateEndpointConnectionProxies/delete"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Delete any Private Endpoint ConnectionProxies"), + // Operation: to.Ptr("Delete Private Endpoint ConnectionProxies"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Private Endpoint ConnectionProxies"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/read"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Read any Sync Groups"), + // Operation: to.Ptr("Read Sync Groups"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Sync Groups"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/write"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Create or Update any Sync Groups"), + // Operation: to.Ptr("Create or Update Sync Groups"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Sync Groups"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/delete"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Delete any Sync Groups"), + // Operation: to.Ptr("Delete Sync Groups"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Sync Groups"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/providers/Microsoft.Insights/metricDefinitions/read"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Gets the available metrics for Sync Groups"), + // Operation: to.Ptr("Read Sync Groups metric definitions"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Sync Group Metrics"), + // }, + // Origin: to.Ptr("System"), + // Properties: &armstoragesync.OperationProperties{ + // ServiceSpecification: &armstoragesync.OperationResourceServiceSpecification{ + // MetricSpecifications: []*armstoragesync.OperationResourceMetricSpecification{ + // { + // Name: to.Ptr("SyncGroupSyncSessionAppliedFilesCount"), + // AggregationType: to.Ptr("Total"), + // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ + // { + // Name: to.Ptr("SyncGroupName"), + // DisplayName: to.Ptr("Sync Group Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("ServerEndpointName"), + // DisplayName: to.Ptr("Server Endpoint Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("SyncDirection"), + // DisplayName: to.Ptr("Sync Direction"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, // }, - // { - // Name: to.Ptr("ServerName"), - // DisplayName: to.Ptr("Server Name"), - // ToBeExportedForShoebox: to.Ptr(true), - // }}, - // DisplayDescription: to.Ptr("Size of data recall throughput"), - // DisplayName: to.Ptr("Cloud tiering recall throughput"), - // FillGapWithZero: to.Ptr(false), - // Unit: to.Ptr("BytesPerSecond"), - // }, - // { - // Name: to.Ptr("StorageSyncRecalledNetworkBytesByApplication"), - // AggregationType: to.Ptr("Total"), - // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ - // { - // Name: to.Ptr("SyncGroupName"), - // DisplayName: to.Ptr("Sync Group Name"), - // ToBeExportedForShoebox: to.Ptr(true), + // DisplayDescription: to.Ptr("Count of Files synced"), + // DisplayName: to.Ptr("Files Synced"), + // FillGapWithZero: to.Ptr(false), + // LockAggregationType: to.Ptr("Average"), + // Unit: to.Ptr("Count"), + // }, + // { + // Name: to.Ptr("SyncGroupSyncSessionPerItemErrorsCount"), + // AggregationType: to.Ptr("Total"), + // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ + // { + // Name: to.Ptr("SyncGroupName"), + // DisplayName: to.Ptr("Sync Group Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("ServerEndpointName"), + // DisplayName: to.Ptr("Server Endpoint Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("SyncDirection"), + // DisplayName: to.Ptr("Sync Direction"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, // }, - // { - // Name: to.Ptr("ServerName"), - // DisplayName: to.Ptr("Server Name"), - // ToBeExportedForShoebox: to.Ptr(true), + // DisplayDescription: to.Ptr("Count of files failed to sync"), + // DisplayName: to.Ptr("Files not syncing"), + // FillGapWithZero: to.Ptr(false), + // LockAggregationType: to.Ptr("Average"), + // Unit: to.Ptr("Count"), + // }, + // { + // Name: to.Ptr("SyncGroupBatchTransferredFileBytes"), + // AggregationType: to.Ptr("Total"), + // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ + // { + // Name: to.Ptr("SyncGroupName"), + // DisplayName: to.Ptr("Sync Group Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("ServerEndpointName"), + // DisplayName: to.Ptr("Server Endpoint Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("SyncDirection"), + // DisplayName: to.Ptr("Sync Direction"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, // }, - // { - // Name: to.Ptr("ApplicationName"), - // DisplayName: to.Ptr("Application Name"), - // ToBeExportedForShoebox: to.Ptr(true), - // }}, - // DisplayDescription: to.Ptr("Size of data recalled by application"), - // DisplayName: to.Ptr("Cloud tiering recall size by application"), - // FillGapWithZero: to.Ptr(false), - // Unit: to.Ptr("Bytes"), - // }}, + // DisplayDescription: to.Ptr("Total file size transferred for Sync Sessions"), + // DisplayName: to.Ptr("Bytes synced"), + // FillGapWithZero: to.Ptr(false), + // LockAggregationType: to.Ptr("Average"), + // Unit: to.Ptr("Bytes"), + // }, + // }, + // }, // }, // }, - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/privateLinkResources/read"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Read any Private Link Resources"), - // Operation: to.Ptr("Read Private Link Resources"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Private Link Resources"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/privateEndpointConnections/read"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Read any Private Endpoint Connections"), - // Operation: to.Ptr("Read Private Endpoint Connections"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Private Endpoint Connections"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/privateEndpointConnections/write"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Create or Update any Private Endpoint Connections"), - // Operation: to.Ptr("Create or Update Private Endpoint Connections"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Private Endpoint Connections"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/privateEndpointConnections/delete"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Delete any Private Endpoint Connections"), - // Operation: to.Ptr("Delete Private Endpoint Connections"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Private Endpoint Connections"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/privateEndpointConnectionProxies/validate/action"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Validate any Private Endpoint ConnectionProxies"), - // Operation: to.Ptr("Validate Private Endpoint ConnectionProxies"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Private Endpoint ConnectionProxies"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/privateEndpointConnectionProxies/read"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Read any Private Endpoint ConnectionProxies"), - // Operation: to.Ptr("Read Private Endpoint ConnectionProxies"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Private Endpoint ConnectionProxies"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/privateEndpointConnectionProxies/write"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Create or Update any Private Endpoint ConnectionProxies"), - // Operation: to.Ptr("Create or Update Private Endpoint ConnectionProxies"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Private Endpoint ConnectionProxies"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/privateEndpointConnectionProxies/delete"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Delete any Private Endpoint ConnectionProxies"), - // Operation: to.Ptr("Delete Private Endpoint ConnectionProxies"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Private Endpoint ConnectionProxies"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/read"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Read any Sync Groups"), - // Operation: to.Ptr("Read Sync Groups"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Sync Groups"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/write"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Create or Update any Sync Groups"), - // Operation: to.Ptr("Create or Update Sync Groups"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Sync Groups"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/delete"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Delete any Sync Groups"), - // Operation: to.Ptr("Delete Sync Groups"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Sync Groups"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/providers/Microsoft.Insights/metricDefinitions/read"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Gets the available metrics for Sync Groups"), - // Operation: to.Ptr("Read Sync Groups metric definitions"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Sync Group Metrics"), - // }, - // Origin: to.Ptr("System"), - // Properties: &armstoragesync.OperationProperties{ - // ServiceSpecification: &armstoragesync.OperationResourceServiceSpecification{ - // MetricSpecifications: []*armstoragesync.OperationResourceMetricSpecification{ - // { - // Name: to.Ptr("SyncGroupSyncSessionAppliedFilesCount"), - // AggregationType: to.Ptr("Total"), - // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ - // { - // Name: to.Ptr("SyncGroupName"), - // DisplayName: to.Ptr("Sync Group Name"), - // ToBeExportedForShoebox: to.Ptr(true), - // }, - // { - // Name: to.Ptr("ServerEndpointName"), - // DisplayName: to.Ptr("Server Endpoint Name"), - // ToBeExportedForShoebox: to.Ptr(true), + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/cloudEndpoints/read"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Read any Cloud Endpoints"), + // Operation: to.Ptr("Read Cloud Endpoints"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Cloud Endpoints"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/cloudEndpoints/write"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Create or Update any Cloud Endpoints"), + // Operation: to.Ptr("Create or Update Cloud Endpoints"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Cloud Endpoints"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/cloudEndpoints/delete"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Delete any Cloud Endpoints"), + // Operation: to.Ptr("Delete Cloud Endpoints"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Cloud Endpoints"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/cloudEndpoints/prebackup/action"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Call this action before backup"), + // Operation: to.Ptr("prebackup"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Cloud Endpoints"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/cloudEndpoints/postbackup/action"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Call this action after backup"), + // Operation: to.Ptr("postbackup"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Cloud Endpoints"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/cloudEndpoints/prerestore/action"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Call this action before restore"), + // Operation: to.Ptr("prerestore"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Cloud Endpoints"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/cloudEndpoints/postrestore/action"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Call this action after restore"), + // Operation: to.Ptr("postrestore"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Cloud Endpoints"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/cloudEndpoints/restoreheartbeat/action"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Restore heartbeat"), + // Operation: to.Ptr("restoreheartbeat"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Cloud Endpoints"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/cloudEndpoints/operationresults/read"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Gets the status of an asynchronous backup/restore operation"), + // Operation: to.Ptr("Read cloudEndpoints/operationresults"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Cloud Endpoints"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/cloudEndpoints/triggerChangeDetection/action"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Call this action to trigger detection of changes on a cloud endpoint's file share"), + // Operation: to.Ptr("triggerChangeDetection"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Cloud Endpoints"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/serverEndpoints/read"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Read any Server Endpoints"), + // Operation: to.Ptr("Read Server Endpoints"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Server Endpoints"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/serverEndpoints/write"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Create or Update any Server Endpoints"), + // Operation: to.Ptr("Create or Update Server Endpoints"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Server Endpoints"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/serverEndpoints/delete"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Delete any Server Endpoints"), + // Operation: to.Ptr("Delete Server Endpoints"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Server Endpoints"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/serverEndpoints/recallAction/action"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Call this action to recall files to a server"), + // Operation: to.Ptr("recallAction"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Server Endpoints"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/serverEndpoints/providers/Microsoft.Insights/metricDefinitions/read"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Gets the available metrics for Server Endpoints"), + // Operation: to.Ptr("Read Server Endpoints metric definitions"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Server Endpoint Metrics"), + // }, + // Origin: to.Ptr("System"), + // Properties: &armstoragesync.OperationProperties{ + // ServiceSpecification: &armstoragesync.OperationResourceServiceSpecification{ + // MetricSpecifications: []*armstoragesync.OperationResourceMetricSpecification{ + // { + // Name: to.Ptr("ServerEndpointSyncSessionAppliedFilesCount"), + // AggregationType: to.Ptr("Total"), + // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ + // { + // Name: to.Ptr("ServerEndpointName"), + // DisplayName: to.Ptr("Server Endpoint Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("SyncDirection"), + // DisplayName: to.Ptr("Sync Direction"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, // }, - // { - // Name: to.Ptr("SyncDirection"), - // DisplayName: to.Ptr("Sync Direction"), - // ToBeExportedForShoebox: to.Ptr(true), - // }}, - // DisplayDescription: to.Ptr("Count of Files synced"), - // DisplayName: to.Ptr("Files Synced"), - // FillGapWithZero: to.Ptr(false), - // Unit: to.Ptr("Count"), - // }, - // { - // Name: to.Ptr("SyncGroupSyncSessionPerItemErrorsCount"), - // AggregationType: to.Ptr("Total"), - // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ - // { - // Name: to.Ptr("SyncGroupName"), - // DisplayName: to.Ptr("Sync Group Name"), - // ToBeExportedForShoebox: to.Ptr(true), + // DisplayDescription: to.Ptr("Count of Files synced"), + // DisplayName: to.Ptr("Files Synced"), + // FillGapWithZero: to.Ptr(false), + // LockAggregationType: to.Ptr("Average"), + // Unit: to.Ptr("Count"), + // }, + // { + // Name: to.Ptr("ServerEndpointSyncSessionPerItemErrorsCount"), + // AggregationType: to.Ptr("Total"), + // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ + // { + // Name: to.Ptr("ServerEndpointName"), + // DisplayName: to.Ptr("Server Endpoint Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("SyncDirection"), + // DisplayName: to.Ptr("Sync Direction"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, // }, - // { - // Name: to.Ptr("ServerEndpointName"), - // DisplayName: to.Ptr("Server Endpoint Name"), - // ToBeExportedForShoebox: to.Ptr(true), + // DisplayDescription: to.Ptr("Count of files failed to sync"), + // DisplayName: to.Ptr("Files not syncing"), + // FillGapWithZero: to.Ptr(false), + // LockAggregationType: to.Ptr("Average"), + // Unit: to.Ptr("Count"), + // }, + // { + // Name: to.Ptr("ServerEndpointBatchTransferredFileBytes"), + // AggregationType: to.Ptr("Total"), + // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ + // { + // Name: to.Ptr("ServerEndpointName"), + // DisplayName: to.Ptr("Server Endpoint Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("SyncDirection"), + // DisplayName: to.Ptr("Sync Direction"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, // }, - // { - // Name: to.Ptr("SyncDirection"), - // DisplayName: to.Ptr("Sync Direction"), - // ToBeExportedForShoebox: to.Ptr(true), - // }}, - // DisplayDescription: to.Ptr("Count of files failed to sync"), - // DisplayName: to.Ptr("Files not syncing"), - // FillGapWithZero: to.Ptr(false), - // Unit: to.Ptr("Count"), + // DisplayDescription: to.Ptr("Total file size transferred for Sync Sessions"), + // DisplayName: to.Ptr("Bytes synced"), + // FillGapWithZero: to.Ptr(false), + // LockAggregationType: to.Ptr("Average"), + // Unit: to.Ptr("Bytes"), + // }, // }, - // { - // Name: to.Ptr("SyncGroupBatchTransferredFileBytes"), - // AggregationType: to.Ptr("Total"), - // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ - // { - // Name: to.Ptr("SyncGroupName"), - // DisplayName: to.Ptr("Sync Group Name"), - // ToBeExportedForShoebox: to.Ptr(true), - // }, - // { - // Name: to.Ptr("ServerEndpointName"), - // DisplayName: to.Ptr("Server Endpoint Name"), - // ToBeExportedForShoebox: to.Ptr(true), - // }, - // { - // Name: to.Ptr("SyncDirection"), - // DisplayName: to.Ptr("Sync Direction"), - // ToBeExportedForShoebox: to.Ptr(true), - // }}, - // DisplayDescription: to.Ptr("Total file size transferred for Sync Sessions"), - // DisplayName: to.Ptr("Bytes synced"), - // FillGapWithZero: to.Ptr(false), - // Unit: to.Ptr("Bytes"), - // }}, + // }, // }, // }, - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/cloudEndpoints/read"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Read any Cloud Endpoints"), - // Operation: to.Ptr("Read Cloud Endpoints"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Cloud Endpoints"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/cloudEndpoints/write"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Create or Update any Cloud Endpoints"), - // Operation: to.Ptr("Create or Update Cloud Endpoints"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Cloud Endpoints"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/cloudEndpoints/delete"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Delete any Cloud Endpoints"), - // Operation: to.Ptr("Delete Cloud Endpoints"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Cloud Endpoints"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/cloudEndpoints/prebackup/action"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Call this action before backup"), - // Operation: to.Ptr("prebackup"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Cloud Endpoints"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/cloudEndpoints/postbackup/action"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Call this action after backup"), - // Operation: to.Ptr("postbackup"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Cloud Endpoints"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/cloudEndpoints/prerestore/action"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Call this action before restore"), - // Operation: to.Ptr("prerestore"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Cloud Endpoints"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/cloudEndpoints/postrestore/action"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Call this action after restore"), - // Operation: to.Ptr("postrestore"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Cloud Endpoints"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/cloudEndpoints/restoreheartbeat/action"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Restore heartbeat"), - // Operation: to.Ptr("restoreheartbeat"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Cloud Endpoints"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/cloudEndpoints/operationresults/read"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Gets the status of an asynchronous backup/restore operation"), - // Operation: to.Ptr("Read cloudEndpoints/operationresults"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Cloud Endpoints"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/cloudEndpoints/triggerChangeDetection/action"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Call this action to trigger detection of changes on a cloud endpoint's file share"), - // Operation: to.Ptr("triggerChangeDetection"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Cloud Endpoints"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/serverEndpoints/read"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Read any Server Endpoints"), - // Operation: to.Ptr("Read Server Endpoints"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Server Endpoints"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/serverEndpoints/write"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Create or Update any Server Endpoints"), - // Operation: to.Ptr("Create or Update Server Endpoints"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Server Endpoints"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/serverEndpoints/delete"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Delete any Server Endpoints"), - // Operation: to.Ptr("Delete Server Endpoints"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Server Endpoints"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/serverEndpoints/recallAction/action"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Call this action to recall files to a server"), - // Operation: to.Ptr("recallAction"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Server Endpoints"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/syncGroups/serverEndpoints/providers/Microsoft.Insights/metricDefinitions/read"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Gets the available metrics for Server Endpoints"), - // Operation: to.Ptr("Read Server Endpoints metric definitions"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Server Endpoint Metrics"), - // }, - // Origin: to.Ptr("System"), - // Properties: &armstoragesync.OperationProperties{ - // ServiceSpecification: &armstoragesync.OperationResourceServiceSpecification{ - // MetricSpecifications: []*armstoragesync.OperationResourceMetricSpecification{ - // { - // Name: to.Ptr("ServerEndpointSyncSessionAppliedFilesCount"), - // AggregationType: to.Ptr("Total"), - // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ - // { - // Name: to.Ptr("ServerEndpointName"), - // DisplayName: to.Ptr("Server Endpoint Name"), - // ToBeExportedForShoebox: to.Ptr(true), + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/registeredServers/read"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Read any Registered Server"), + // Operation: to.Ptr("Read Registered Server"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Registered Server"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/registeredServers/write"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Create or Update any Registered Server"), + // Operation: to.Ptr("Create or Update Registered Server"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Registered Server"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/registeredServers/delete"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Delete any Registered Server"), + // Operation: to.Ptr("Delete Registered Server"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Registered Server"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/registeredServers/providers/Microsoft.Insights/metricDefinitions/read"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Gets the available metrics for Registered Server"), + // Operation: to.Ptr("Read Registered Server metric definitions"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Registered Server Metrics"), + // }, + // Origin: to.Ptr("System"), + // Properties: &armstoragesync.OperationProperties{ + // ServiceSpecification: &armstoragesync.OperationResourceServiceSpecification{ + // MetricSpecifications: []*armstoragesync.OperationResourceMetricSpecification{ + // { + // Name: to.Ptr("ServerHeartbeat"), + // AggregationType: to.Ptr("Maximum"), + // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ + // { + // Name: to.Ptr("ServerResourceId"), + // DisplayName: to.Ptr("Registered Server Id"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("ServerName"), + // DisplayName: to.Ptr("Server Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, // }, - // { - // Name: to.Ptr("SyncDirection"), - // DisplayName: to.Ptr("Sync Direction"), - // ToBeExportedForShoebox: to.Ptr(true), - // }}, - // DisplayDescription: to.Ptr("Count of Files synced"), - // DisplayName: to.Ptr("Files Synced"), - // FillGapWithZero: to.Ptr(false), - // Unit: to.Ptr("Count"), - // }, - // { - // Name: to.Ptr("ServerEndpointSyncSessionPerItemErrorsCount"), - // AggregationType: to.Ptr("Total"), - // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ - // { - // Name: to.Ptr("ServerEndpointName"), - // DisplayName: to.Ptr("Server Endpoint Name"), - // ToBeExportedForShoebox: to.Ptr(true), + // DisplayDescription: to.Ptr("Metric that logs a value of 1 each time the resigtered server successfully records a heartbeat with the Cloud Endpoint"), + // DisplayName: to.Ptr("Server Online Status"), + // FillGapWithZero: to.Ptr(false), + // LockAggregationType: to.Ptr("Average"), + // Unit: to.Ptr("Count"), + // }, + // { + // Name: to.Ptr("ServerRecallIOTotalSizeBytes"), + // AggregationType: to.Ptr("Total"), + // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ + // { + // Name: to.Ptr("ServerResourceId"), + // DisplayName: to.Ptr("Registered Server Id"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, + // { + // Name: to.Ptr("ServerName"), + // DisplayName: to.Ptr("Server Name"), + // ToBeExportedForShoebox: to.Ptr(true), + // }, // }, - // { - // Name: to.Ptr("SyncDirection"), - // DisplayName: to.Ptr("Sync Direction"), - // ToBeExportedForShoebox: to.Ptr(true), - // }}, - // DisplayDescription: to.Ptr("Count of files failed to sync"), - // DisplayName: to.Ptr("Files not syncing"), - // FillGapWithZero: to.Ptr(false), - // Unit: to.Ptr("Count"), + // DisplayDescription: to.Ptr("Total size of data recalled by the server"), + // DisplayName: to.Ptr("Cloud tiering recall"), + // FillGapWithZero: to.Ptr(false), + // LockAggregationType: to.Ptr("Average"), + // Unit: to.Ptr("Bytes"), + // }, // }, - // { - // Name: to.Ptr("ServerEndpointBatchTransferredFileBytes"), - // AggregationType: to.Ptr("Total"), - // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ - // { - // Name: to.Ptr("ServerEndpointName"), - // DisplayName: to.Ptr("Server Endpoint Name"), - // ToBeExportedForShoebox: to.Ptr(true), - // }, - // { - // Name: to.Ptr("SyncDirection"), - // DisplayName: to.Ptr("Sync Direction"), - // ToBeExportedForShoebox: to.Ptr(true), - // }}, - // DisplayDescription: to.Ptr("Total file size transferred for Sync Sessions"), - // DisplayName: to.Ptr("Bytes synced"), - // FillGapWithZero: to.Ptr(false), - // Unit: to.Ptr("Bytes"), - // }}, + // }, // }, // }, - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/registeredServers/read"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Read any Registered Server"), - // Operation: to.Ptr("Read Registered Server"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Registered Server"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/registeredServers/write"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Create or Update any Registered Server"), - // Operation: to.Ptr("Create or Update Registered Server"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Registered Server"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/registeredServers/delete"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Delete any Registered Server"), - // Operation: to.Ptr("Delete Registered Server"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Registered Server"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/registeredServers/providers/Microsoft.Insights/metricDefinitions/read"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Gets the available metrics for Registered Server"), - // Operation: to.Ptr("Read Registered Server metric definitions"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Registered Server Metrics"), - // }, - // Origin: to.Ptr("System"), - // Properties: &armstoragesync.OperationProperties{ - // ServiceSpecification: &armstoragesync.OperationResourceServiceSpecification{ - // MetricSpecifications: []*armstoragesync.OperationResourceMetricSpecification{ - // { - // Name: to.Ptr("ServerHeartbeat"), - // AggregationType: to.Ptr("Maximum"), - // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ - // { - // Name: to.Ptr("ServerResourceId"), - // DisplayName: to.Ptr("Registered Server Id"), - // ToBeExportedForShoebox: to.Ptr(true), - // }, - // { - // Name: to.Ptr("ServerName"), - // DisplayName: to.Ptr("Server Name"), - // ToBeExportedForShoebox: to.Ptr(true), - // }}, - // DisplayDescription: to.Ptr("Metric that logs a value of 1 each time the resigtered server successfully records a heartbeat with the Cloud Endpoint"), - // DisplayName: to.Ptr("Server Online Status"), - // FillGapWithZero: to.Ptr(false), - // Unit: to.Ptr("Count"), - // }, - // { - // Name: to.Ptr("ServerRecallIOTotalSizeBytes"), - // AggregationType: to.Ptr("Total"), - // Dimensions: []*armstoragesync.OperationResourceMetricSpecificationDimension{ - // { - // Name: to.Ptr("ServerResourceId"), - // DisplayName: to.Ptr("Registered Server Id"), - // ToBeExportedForShoebox: to.Ptr(true), - // }, - // { - // Name: to.Ptr("ServerName"), - // DisplayName: to.Ptr("Server Name"), - // ToBeExportedForShoebox: to.Ptr(true), - // }}, - // DisplayDescription: to.Ptr("Total size of data recalled by the server"), - // DisplayName: to.Ptr("Cloud tiering recall"), - // FillGapWithZero: to.Ptr(false), - // Unit: to.Ptr("Bytes"), - // }}, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/workflows/read"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Read Workflows"), + // Operation: to.Ptr("Read Workflows"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Workflow"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/workflows/operationresults/read"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Gets the status of an asynchronous operation"), + // Operation: to.Ptr("Read workflows/operationresults"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Workflow"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/storageSyncServices/workflows/operations/read"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Gets the status of an asynchronous operation"), + // Operation: to.Ptr("Read workflows/operations"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Workflow"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/locations/checkNameAvailability/action"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Checks that storage sync service name is valid and is not in use."), + // Operation: to.Ptr("Check Name Availability"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Name Availability"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/locations/workflows/operations/read"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Gets the status of an asynchronous operation"), + // Operation: to.Ptr("Read locations/workflows/operations"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("Workflow"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/locations/operationresults/read"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Gets the result for an asynchronous operation"), + // Operation: to.Ptr("Read locations/operationresults"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("operationresults"), + // }, + // Origin: to.Ptr("User"), + // }, + // { + // Name: to.Ptr("microsoft.storagesync/locations/operations/read"), + // Display: &armstoragesync.OperationDisplayInfo{ + // Description: to.Ptr("Gets the status for an azure asynchronous operation"), + // Operation: to.Ptr("Read locations/operations"), + // Provider: to.Ptr("microsoft.storagesync"), + // Resource: to.Ptr("operations"), // }, + // Origin: to.Ptr("User"), // }, // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/workflows/read"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Read Workflows"), - // Operation: to.Ptr("Read Workflows"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Workflow"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/workflows/operationresults/read"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Gets the status of an asynchronous operation"), - // Operation: to.Ptr("Read workflows/operationresults"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Workflow"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/storageSyncServices/workflows/operations/read"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Gets the status of an asynchronous operation"), - // Operation: to.Ptr("Read workflows/operations"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Workflow"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/locations/checkNameAvailability/action"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Checks that storage sync service name is valid and is not in use."), - // Operation: to.Ptr("Check Name Availability"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Name Availability"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/locations/workflows/operations/read"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Gets the status of an asynchronous operation"), - // Operation: to.Ptr("Read locations/workflows/operations"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("Workflow"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/locations/operationresults/read"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Gets the result for an asynchronous operation"), - // Operation: to.Ptr("Read locations/operationresults"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("operationresults"), - // }, - // Origin: to.Ptr("User"), - // }, - // { - // Name: to.Ptr("microsoft.storagesync/locations/operations/read"), - // Display: &armstoragesync.OperationDisplayInfo{ - // Description: to.Ptr("Gets the status for an azure asynchronous operation"), - // Operation: to.Ptr("Read locations/operations"), - // Provider: to.Ptr("microsoft.storagesync"), - // Resource: to.Ptr("operations"), - // }, - // Origin: to.Ptr("User"), - // }}, + // }, // } } } diff --git a/sdk/resourcemanager/storagesync/armstoragesync/operationstatus_client.go b/sdk/resourcemanager/storagesync/armstoragesync/operationstatus_client.go index 09587544896d..962b9c9dd36c 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/operationstatus_client.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/operationstatus_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 armstoragesync @@ -25,9 +24,9 @@ type OperationStatusClient struct { } // NewOperationStatusClient creates a new instance of OperationStatusClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationStatusClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -43,7 +42,7 @@ func NewOperationStatusClient(subscriptionID string, credential azcore.TokenCred // Get - Get Operation status // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - locationName - The desired region to obtain information from. // - workflowID - workflow Id @@ -72,7 +71,7 @@ func (client *OperationStatusClient) Get(ctx context.Context, resourceGroupName } // getCreateRequest creates the Get request. -func (client *OperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, locationName string, workflowID string, operationID string, options *OperationStatusClientGetOptions) (*policy.Request, error) { +func (client *OperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, locationName string, workflowID string, operationID string, _ *OperationStatusClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/locations/{locationName}/workflows/{workflowId}/operations/{operationId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -99,7 +98,7 @@ func (client *OperationStatusClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,10 +108,10 @@ func (client *OperationStatusClient) getCreateRequest(ctx context.Context, resou func (client *OperationStatusClient) getHandleResponse(resp *http.Response) (OperationStatusClientGetResponse, error) { result := OperationStatusClientGetResponse{} if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { - result.XMSCorrelationRequestID = &val + result.CorrelationRequestID = &val } if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val + result.RequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { return OperationStatusClientGetResponse{}, err diff --git a/sdk/resourcemanager/storagesync/armstoragesync/operationstatus_client_example_test.go b/sdk/resourcemanager/storagesync/armstoragesync/operationstatus_client_example_test.go index ce5dea722646..c694886f61d4 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/operationstatus_client_example_test.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/operationstatus_client_example_test.go @@ -1,27 +1,24 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for 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 armstoragesync_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/OperationStatus_Get.json +// Generated from example definition: 2022-09-01/OperationStatus_Get.json func ExampleOperationStatusClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -32,10 +29,14 @@ func ExampleOperationStatusClient_Get() { // 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 = armstoragesync.OperationStatus{ - // Name: to.Ptr("14b50e24-f68d-4b29-a882-38be9dfb8bd1"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T23:53:23.373Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T23:53:21.732Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armstoragesync.OperationStatusClientGetResponse{ + // CorrelationRequestID: "d166ca76-dad2-49df-b409-d2acfd42d730" + // RequestID: "74e55a4d-1c6f-46de-9a8d-278e53a47403" + // OperationStatus: &armstoragesync.OperationStatus{ + // Name: to.Ptr("14b50e24-f68d-4b29-a882-38be9dfb8bd1"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T23:53:23.3735483Z"); return t}()), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T23:53:21.7328715Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, // } } diff --git a/sdk/resourcemanager/storagesync/armstoragesync/options.go b/sdk/resourcemanager/storagesync/armstoragesync/options.go index a68634de6bf4..8a6616fe63fe 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/options.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/options.go @@ -1,54 +1,59 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 armstoragesync +// CloudEndpointsClientAfsShareMetadataCertificatePublicKeysOptions contains the optional parameters for the CloudEndpointsClient.AfsShareMetadataCertificatePublicKeys +// method. +type CloudEndpointsClientAfsShareMetadataCertificatePublicKeysOptions struct { + // placeholder for future optional parameters +} + // CloudEndpointsClientBeginCreateOptions contains the optional parameters for the CloudEndpointsClient.BeginCreate method. type CloudEndpointsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // CloudEndpointsClientBeginDeleteOptions contains the optional parameters for the CloudEndpointsClient.BeginDelete method. type CloudEndpointsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // CloudEndpointsClientBeginPostBackupOptions contains the optional parameters for the CloudEndpointsClient.BeginPostBackup // method. type CloudEndpointsClientBeginPostBackupOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // CloudEndpointsClientBeginPostRestoreOptions contains the optional parameters for the CloudEndpointsClient.BeginPostRestore // method. type CloudEndpointsClientBeginPostRestoreOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // CloudEndpointsClientBeginPreBackupOptions contains the optional parameters for the CloudEndpointsClient.BeginPreBackup // method. type CloudEndpointsClientBeginPreBackupOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // CloudEndpointsClientBeginPreRestoreOptions contains the optional parameters for the CloudEndpointsClient.BeginPreRestore // method. type CloudEndpointsClientBeginPreRestoreOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // CloudEndpointsClientBeginTriggerChangeDetectionOptions contains the optional parameters for the CloudEndpointsClient.BeginTriggerChangeDetection // method. type CloudEndpointsClientBeginTriggerChangeDetectionOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -88,14 +93,14 @@ type OperationsClientListOptions struct { // PrivateEndpointConnectionsClientBeginCreateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreate // method. type PrivateEndpointConnectionsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete // method. type PrivateEndpointConnectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -120,21 +125,28 @@ type PrivateLinkResourcesClientListByStorageSyncServiceOptions struct { // RegisteredServersClientBeginCreateOptions contains the optional parameters for the RegisteredServersClient.BeginCreate // method. type RegisteredServersClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // RegisteredServersClientBeginDeleteOptions contains the optional parameters for the RegisteredServersClient.BeginDelete // method. type RegisteredServersClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // RegisteredServersClientBeginTriggerRolloverOptions contains the optional parameters for the RegisteredServersClient.BeginTriggerRollover // method. type RegisteredServersClientBeginTriggerRolloverOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// RegisteredServersClientBeginUpdateOptions contains the optional parameters for the RegisteredServersClient.BeginUpdate +// method. +type RegisteredServersClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -151,29 +163,26 @@ type RegisteredServersClientListByStorageSyncServiceOptions struct { // ServerEndpointsClientBeginCreateOptions contains the optional parameters for the ServerEndpointsClient.BeginCreate method. type ServerEndpointsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ServerEndpointsClientBeginDeleteOptions contains the optional parameters for the ServerEndpointsClient.BeginDelete method. type ServerEndpointsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ServerEndpointsClientBeginRecallActionOptions contains the optional parameters for the ServerEndpointsClient.BeginRecallAction // method. type ServerEndpointsClientBeginRecallActionOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ServerEndpointsClientBeginUpdateOptions contains the optional parameters for the ServerEndpointsClient.BeginUpdate method. type ServerEndpointsClientBeginUpdateOptions struct { - // Any of the properties applicable in PUT request. - Parameters *ServerEndpointUpdateParameters - - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -190,22 +199,19 @@ type ServerEndpointsClientListBySyncGroupOptions struct { // ServicesClientBeginCreateOptions contains the optional parameters for the ServicesClient.BeginCreate method. type ServicesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ServicesClientBeginDeleteOptions contains the optional parameters for the ServicesClient.BeginDelete method. type ServicesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ServicesClientBeginUpdateOptions contains the optional parameters for the ServicesClient.BeginUpdate method. type ServicesClientBeginUpdateOptions struct { - // Storage Sync Service resource. - Parameters *ServiceUpdateParameters - - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/storagesync/armstoragesync/privateendpointconnections_client.go b/sdk/resourcemanager/storagesync/armstoragesync/privateendpointconnections_client.go index 606bc27ff3db..20627eeb07c0 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/privateendpointconnections_client.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/privateendpointconnections_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 armstoragesync @@ -25,9 +24,9 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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. +// - options - Contains optional client configuration. 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 { @@ -43,10 +42,10 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginCreate - Update the state of specified private endpoint connection associated with the storage sync service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - storageSyncServiceName - The name of the storage sync service name within the specified resource group. -// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource +// - storageSyncServiceName - Name of Storage Sync Service resource. +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. // - properties - The private endpoint connection properties. // - options - PrivateEndpointConnectionsClientBeginCreateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreate // method. @@ -57,7 +56,8 @@ func (client *PrivateEndpointConnectionsClient) BeginCreate(ctx context.Context, return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientCreateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -70,7 +70,7 @@ func (client *PrivateEndpointConnectionsClient) BeginCreate(ctx context.Context, // Create - Update the state of specified private endpoint connection associated with the storage sync service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 func (client *PrivateEndpointConnectionsClient) create(ctx context.Context, resourceGroupName string, storageSyncServiceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginCreate" @@ -93,8 +93,12 @@ func (client *PrivateEndpointConnectionsClient) create(ctx context.Context, reso } // createCreateRequest creates the Create request. -func (client *PrivateEndpointConnectionsClient) createCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) createCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, _ *PrivateEndpointConnectionsClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/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") } @@ -103,10 +107,6 @@ func (client *PrivateEndpointConnectionsClient) createCreateRequest(ctx context. return nil, errors.New("parameter storageSyncServiceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{storageSyncServiceName}", url.PathEscape(storageSyncServiceName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if privateEndpointConnectionName == "" { return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") } @@ -116,9 +116,10 @@ func (client *PrivateEndpointConnectionsClient) createCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-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 } @@ -128,10 +129,10 @@ func (client *PrivateEndpointConnectionsClient) createCreateRequest(ctx context. // BeginDelete - Deletes the specified private endpoint connection associated with the storage sync service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - storageSyncServiceName - The name of the storage sync service name within the specified resource group. -// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource +// - storageSyncServiceName - Name of Storage Sync Service resource. +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. // - options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete // method. func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, storageSyncServiceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { @@ -141,7 +142,8 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -154,7 +156,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes the specified private endpoint connection associated with the storage sync service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, storageSyncServiceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" @@ -177,8 +179,12 @@ func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Cont } // deleteCreateRequest creates the Delete request. -func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, privateEndpointConnectionName string, _ *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/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") } @@ -187,10 +193,6 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, errors.New("parameter storageSyncServiceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{storageSyncServiceName}", url.PathEscape(storageSyncServiceName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if privateEndpointConnectionName == "" { return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") } @@ -200,19 +202,18 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Gets the specified private endpoint connection associated with the storage sync service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - storageSyncServiceName - The name of the storage sync service name within the specified resource group. -// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource +// - storageSyncServiceName - Name of Storage Sync Service resource. +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. // - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get // method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, storageSyncServiceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { @@ -238,8 +239,12 @@ func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourc } // getCreateRequest creates the Get request. -func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, privateEndpointConnectionName string, _ *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/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") } @@ -248,10 +253,6 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, errors.New("parameter storageSyncServiceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{storageSyncServiceName}", url.PathEscape(storageSyncServiceName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if privateEndpointConnectionName == "" { return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") } @@ -261,7 +262,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -278,7 +279,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListByStorageSyncServicePager - Get a PrivateEndpointConnection List. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - options - PrivateEndpointConnectionsClientListByStorageSyncServiceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByStorageSyncServicePager @@ -286,21 +287,20 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res func (client *PrivateEndpointConnectionsClient) NewListByStorageSyncServicePager(resourceGroupName string, storageSyncServiceName string, options *PrivateEndpointConnectionsClientListByStorageSyncServiceOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByStorageSyncServiceResponse] { return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListByStorageSyncServiceResponse]{ More: func(page PrivateEndpointConnectionsClientListByStorageSyncServiceResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListByStorageSyncServiceResponse) (PrivateEndpointConnectionsClientListByStorageSyncServiceResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateEndpointConnectionsClient.NewListByStorageSyncServicePager") - req, err := client.listByStorageSyncServiceCreateRequest(ctx, resourceGroupName, storageSyncServiceName, options) - if err != nil { - return PrivateEndpointConnectionsClientListByStorageSyncServiceResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByStorageSyncServiceCreateRequest(ctx, resourceGroupName, storageSyncServiceName, options) + }, nil) if err != nil { return PrivateEndpointConnectionsClientListByStorageSyncServiceResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientListByStorageSyncServiceResponse{}, runtime.NewResponseError(resp) - } return client.listByStorageSyncServiceHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -308,7 +308,7 @@ func (client *PrivateEndpointConnectionsClient) NewListByStorageSyncServicePager } // listByStorageSyncServiceCreateRequest creates the ListByStorageSyncService request. -func (client *PrivateEndpointConnectionsClient) listByStorageSyncServiceCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, options *PrivateEndpointConnectionsClientListByStorageSyncServiceOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) listByStorageSyncServiceCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, _ *PrivateEndpointConnectionsClientListByStorageSyncServiceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -327,7 +327,7 @@ func (client *PrivateEndpointConnectionsClient) listByStorageSyncServiceCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -337,10 +337,10 @@ func (client *PrivateEndpointConnectionsClient) listByStorageSyncServiceCreateRe func (client *PrivateEndpointConnectionsClient) listByStorageSyncServiceHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListByStorageSyncServiceResponse, error) { result := PrivateEndpointConnectionsClientListByStorageSyncServiceResponse{} if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { - result.XMSCorrelationRequestID = &val + result.CorrelationRequestID = &val } if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val + result.RequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { return PrivateEndpointConnectionsClientListByStorageSyncServiceResponse{}, err diff --git a/sdk/resourcemanager/storagesync/armstoragesync/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/storagesync/armstoragesync/privateendpointconnections_client_example_test.go index 566c19c248bd..36582ad638e1 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/privateendpointconnections_client_example_test.go @@ -1,74 +1,77 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armstoragesync_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/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_Get.json -func ExamplePrivateEndpointConnectionsClient_Get() { +// Generated from example definition: 2022-09-01/PrivateEndpointConnections_Create.json +func ExamplePrivateEndpointConnectionsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "res6977", "sss2527", "{privateEndpointConnectionName}", nil) + poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginCreate(ctx, "res7687", "sss2527", "{privateEndpointConnectionName}", armstoragesync.PrivateEndpointConnection{ + Properties: &armstoragesync.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &armstoragesync.PrivateLinkServiceConnectionState{ + Description: to.Ptr("Auto-Approved"), + Status: to.Ptr(armstoragesync.PrivateEndpointServiceConnectionStatusApproved), + }, + }, + }, 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.PrivateEndpointConnection = armstoragesync.PrivateEndpointConnection{ - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.StorageSync/storageSyncServices/sss2527/privateEndpointConnections/{privateEndpointConnectionName}"), - // Properties: &armstoragesync.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armstoragesync.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest01"), - // }, - // PrivateLinkServiceConnectionState: &armstoragesync.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // Status: to.Ptr(armstoragesync.PrivateEndpointServiceConnectionStatusApproved), + // res = armstoragesync.PrivateEndpointConnectionsClientCreateResponse{ + // PrivateEndpointConnection: &armstoragesync.PrivateEndpointConnection{ + // Name: to.Ptr("{privateEndpointConnectionName}"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/res7231/providers/Microsoft.StorageSync/storageSyncServices/sss2527/privateEndpointConnections/{privateEndpointConnectionName}"), + // Properties: &armstoragesync.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armstoragesync.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest01"), + // }, + // PrivateLinkServiceConnectionState: &armstoragesync.PrivateLinkServiceConnectionState{ + // Description: to.Ptr("Auto-Approved"), + // Status: to.Ptr(armstoragesync.PrivateEndpointServiceConnectionStatusApproved), + // }, + // ProvisioningState: to.Ptr(armstoragesync.PrivateEndpointConnectionProvisioningStateSucceeded), // }, - // ProvisioningState: to.Ptr(armstoragesync.PrivateEndpointConnectionProvisioningStateSucceeded), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_Create.json -func ExamplePrivateEndpointConnectionsClient_BeginCreate() { +// Generated from example definition: 2022-09-01/PrivateEndpointConnections_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 := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginCreate(ctx, "res7687", "sss2527", "{privateEndpointConnectionName}", armstoragesync.PrivateEndpointConnection{ - Properties: &armstoragesync.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armstoragesync.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Auto-Approved"), - Status: to.Ptr(armstoragesync.PrivateEndpointServiceConnectionStatusApproved), - }, - }, - }, nil) + poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "res6977", "sss2527", "{privateEndpointConnectionName}", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -79,52 +82,55 @@ func ExamplePrivateEndpointConnectionsClient_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.PrivateEndpointConnection = armstoragesync.PrivateEndpointConnection{ - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.StorageSync/storageSyncServices/sss2527/privateEndpointConnections/{privateEndpointConnectionName}"), - // Properties: &armstoragesync.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armstoragesync.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest01"), - // }, - // PrivateLinkServiceConnectionState: &armstoragesync.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // Status: to.Ptr(armstoragesync.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armstoragesync.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, + // res = armstoragesync.PrivateEndpointConnectionsClientDeleteResponse{ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_Delete.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { +// Generated from example definition: 2022-09-01/PrivateEndpointConnections_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 := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "res6977", "sss2527", "{privateEndpointConnectionName}", nil) + res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "res6977", "sss2527", "{privateEndpointConnectionName}", 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 = armstoragesync.PrivateEndpointConnectionsClientGetResponse{ + // PrivateEndpointConnection: &armstoragesync.PrivateEndpointConnection{ + // Name: to.Ptr("{privateEndpointConnectionName}"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/res7231/providers/Microsoft.StorageSync/storageSyncServices/sss2527/privateEndpointConnections/{privateEndpointConnectionName}"), + // Properties: &armstoragesync.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armstoragesync.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest01"), + // }, + // PrivateLinkServiceConnectionState: &armstoragesync.PrivateLinkServiceConnectionState{ + // Description: to.Ptr("Auto-Approved"), + // Status: to.Ptr(armstoragesync.PrivateEndpointServiceConnectionStatusApproved), + // }, + // ProvisioningState: to.Ptr(armstoragesync.PrivateEndpointConnectionProvisioningStateSucceeded), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_ListByStorageSyncService.json +// Generated from example definition: 2022-09-01/PrivateEndpointConnections_ListByStorageSyncService.json func ExamplePrivateEndpointConnectionsClient_NewListByStorageSyncServicePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -139,38 +145,41 @@ func ExamplePrivateEndpointConnectionsClient_NewListByStorageSyncServicePager() _ = 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.PrivateEndpointConnectionListResult = armstoragesync.PrivateEndpointConnectionListResult{ - // Value: []*armstoragesync.PrivateEndpointConnection{ - // { - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.StorageSync/storageSyncServices/sss2527/privateEndpointConnections/{privateEndpointConnectionName}"), - // Properties: &armstoragesync.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armstoragesync.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest01"), - // }, - // PrivateLinkServiceConnectionState: &armstoragesync.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // Status: to.Ptr(armstoragesync.PrivateEndpointServiceConnectionStatusApproved), + // page = armstoragesync.PrivateEndpointConnectionsClientListByStorageSyncServiceResponse{ + // PrivateEndpointConnectionListResult: armstoragesync.PrivateEndpointConnectionListResult{ + // Value: []*armstoragesync.PrivateEndpointConnection{ + // { + // Name: to.Ptr("{privateEndpointConnectionName}"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/res7231/providers/Microsoft.StorageSync/storageSyncServices/sss2527/privateEndpointConnections/{privateEndpointConnectionName}"), + // Properties: &armstoragesync.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armstoragesync.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest01"), + // }, + // PrivateLinkServiceConnectionState: &armstoragesync.PrivateLinkServiceConnectionState{ + // Description: to.Ptr("Auto-Approved"), + // Status: to.Ptr(armstoragesync.PrivateEndpointServiceConnectionStatusApproved), + // }, + // ProvisioningState: to.Ptr(armstoragesync.PrivateEndpointConnectionProvisioningStateSucceeded), // }, - // ProvisioningState: to.Ptr(armstoragesync.PrivateEndpointConnectionProvisioningStateSucceeded), // }, - // }, - // { - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.StorageSync/storageSyncServices/sss2527/privateEndpointConnections/{privateEndpointConnectionName}"), - // Properties: &armstoragesync.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armstoragesync.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest02"), - // }, - // PrivateLinkServiceConnectionState: &armstoragesync.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // Status: to.Ptr(armstoragesync.PrivateEndpointServiceConnectionStatusApproved), + // { + // Name: to.Ptr("{privateEndpointConnectionName}"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/res7231/providers/Microsoft.StorageSync/storageSyncServices/sss2527/privateEndpointConnections/{privateEndpointConnectionName}"), + // Properties: &armstoragesync.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armstoragesync.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest02"), + // }, + // PrivateLinkServiceConnectionState: &armstoragesync.PrivateLinkServiceConnectionState{ + // Description: to.Ptr("Auto-Approved"), + // Status: to.Ptr(armstoragesync.PrivateEndpointServiceConnectionStatusApproved), + // }, + // ProvisioningState: to.Ptr(armstoragesync.PrivateEndpointConnectionProvisioningStateSucceeded), // }, - // ProvisioningState: to.Ptr(armstoragesync.PrivateEndpointConnectionProvisioningStateSucceeded), // }, - // }}, + // }, + // }, // } } } diff --git a/sdk/resourcemanager/storagesync/armstoragesync/privatelinkresources_client.go b/sdk/resourcemanager/storagesync/armstoragesync/privatelinkresources_client.go index 080a6ea633d7..e7c8615112b3 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/privatelinkresources_client.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/privatelinkresources_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 armstoragesync @@ -25,9 +24,9 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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. +// - options - Contains optional client configuration. 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 { @@ -43,9 +42,9 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // ListByStorageSyncService - Gets the private link resources that need to be created for a storage sync service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - storageSyncServiceName - The name of the storage sync service name within the specified resource group. +// - storageSyncServiceName - Name of Storage Sync Service resource. // - options - PrivateLinkResourcesClientListByStorageSyncServiceOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByStorageSyncService // method. func (client *PrivateLinkResourcesClient) ListByStorageSyncService(ctx context.Context, resourceGroupName string, storageSyncServiceName string, options *PrivateLinkResourcesClientListByStorageSyncServiceOptions) (PrivateLinkResourcesClientListByStorageSyncServiceResponse, error) { @@ -71,8 +70,12 @@ func (client *PrivateLinkResourcesClient) ListByStorageSyncService(ctx context.C } // listByStorageSyncServiceCreateRequest creates the ListByStorageSyncService request. -func (client *PrivateLinkResourcesClient) listByStorageSyncServiceCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, options *PrivateLinkResourcesClientListByStorageSyncServiceOptions) (*policy.Request, error) { +func (client *PrivateLinkResourcesClient) listByStorageSyncServiceCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, _ *PrivateLinkResourcesClientListByStorageSyncServiceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/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") } @@ -81,16 +84,12 @@ func (client *PrivateLinkResourcesClient) listByStorageSyncServiceCreateRequest( return nil, errors.New("parameter storageSyncServiceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{storageSyncServiceName}", url.PathEscape(storageSyncServiceName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/storagesync/armstoragesync/privatelinkresources_client_example_test.go b/sdk/resourcemanager/storagesync/armstoragesync/privatelinkresources_client_example_test.go index 6ce2aa7ddde8..c66571e035ed 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/privatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/privatelinkresources_client_example_test.go @@ -1,27 +1,24 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for 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 armstoragesync_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateLinkResources_List.json +// Generated from example definition: 2022-09-01/PrivateLinkResources_List.json func ExamplePrivateLinkResourcesClient_ListByStorageSyncService() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -32,21 +29,26 @@ func ExamplePrivateLinkResourcesClient_ListByStorageSyncService() { // 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.PrivateLinkResourceListResult = armstoragesync.PrivateLinkResourceListResult{ - // Value: []*armstoragesync.PrivateLinkResource{ - // { - // Name: to.Ptr("afs"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/privateLinkResources"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res6977/providers/Microsoft.StorageSync/storageSyncServices/sss2527/privateLinkResources/afs"), - // Properties: &armstoragesync.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("afs"), - // RequiredMembers: []*string{ - // to.Ptr("management"), - // to.Ptr("sync.primary"), - // to.Ptr("sync.secondary")}, + // res = armstoragesync.PrivateLinkResourcesClientListByStorageSyncServiceResponse{ + // PrivateLinkResourceListResult: &armstoragesync.PrivateLinkResourceListResult{ + // Value: []*armstoragesync.PrivateLinkResource{ + // { + // Name: to.Ptr("afs"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/privateLinkResources"), + // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/res6977/providers/Microsoft.StorageSync/storageSyncServices/sss2527/privateLinkResources/afs"), + // Properties: &armstoragesync.PrivateLinkResourceProperties{ + // GroupID: to.Ptr("afs"), + // RequiredMembers: []*string{ + // to.Ptr("management"), + // to.Ptr("sync.primary"), + // to.Ptr("sync.secondary"), + // }, // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.afs.azure.net")}, + // to.Ptr("privatelink.afs.azure.net"), // }, - // }}, - // } + // }, + // }, + // }, + // }, + // } } diff --git a/sdk/resourcemanager/storagesync/armstoragesync/registeredservers_client.go b/sdk/resourcemanager/storagesync/armstoragesync/registeredservers_client.go index 6fc3d0916b7f..e0916172fb0e 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/registeredservers_client.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/registeredservers_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 armstoragesync @@ -25,9 +24,9 @@ type RegisteredServersClient struct { } // NewRegisteredServersClient creates a new instance of RegisteredServersClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewRegisteredServersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RegisteredServersClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -43,7 +42,7 @@ func NewRegisteredServersClient(subscriptionID string, credential azcore.TokenCr // BeginCreate - Add a new registered server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - serverID - GUID identifying the on-premises server. @@ -57,7 +56,8 @@ func (client *RegisteredServersClient) BeginCreate(ctx context.Context, resource return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RegisteredServersClientCreateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -70,7 +70,7 @@ func (client *RegisteredServersClient) BeginCreate(ctx context.Context, resource // Create - Add a new registered server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 func (client *RegisteredServersClient) create(ctx context.Context, resourceGroupName string, storageSyncServiceName string, serverID string, parameters RegisteredServerCreateParameters, options *RegisteredServersClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "RegisteredServersClient.BeginCreate" @@ -93,7 +93,7 @@ func (client *RegisteredServersClient) create(ctx context.Context, resourceGroup } // createCreateRequest creates the Create request. -func (client *RegisteredServersClient) createCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, serverID string, parameters RegisteredServerCreateParameters, options *RegisteredServersClientBeginCreateOptions) (*policy.Request, error) { +func (client *RegisteredServersClient) createCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, serverID string, parameters RegisteredServerCreateParameters, _ *RegisteredServersClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -116,9 +116,10 @@ func (client *RegisteredServersClient) createCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-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, parameters); err != nil { return nil, err } @@ -128,7 +129,7 @@ func (client *RegisteredServersClient) createCreateRequest(ctx context.Context, // BeginDelete - Delete the given registered server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - serverID - GUID identifying the on-premises server. @@ -154,7 +155,7 @@ func (client *RegisteredServersClient) BeginDelete(ctx context.Context, resource // Delete - Delete the given registered server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 func (client *RegisteredServersClient) deleteOperation(ctx context.Context, resourceGroupName string, storageSyncServiceName string, serverID string, options *RegisteredServersClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "RegisteredServersClient.BeginDelete" @@ -177,7 +178,7 @@ func (client *RegisteredServersClient) deleteOperation(ctx context.Context, reso } // deleteCreateRequest creates the Delete request. -func (client *RegisteredServersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, serverID string, options *RegisteredServersClientBeginDeleteOptions) (*policy.Request, error) { +func (client *RegisteredServersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, serverID string, _ *RegisteredServersClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -200,16 +201,15 @@ func (client *RegisteredServersClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Get a given registered server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - serverID - GUID identifying the on-premises server. @@ -237,7 +237,7 @@ func (client *RegisteredServersClient) Get(ctx context.Context, resourceGroupNam } // getCreateRequest creates the Get request. -func (client *RegisteredServersClient) getCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, serverID string, options *RegisteredServersClientGetOptions) (*policy.Request, error) { +func (client *RegisteredServersClient) getCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, serverID string, _ *RegisteredServersClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -260,7 +260,7 @@ func (client *RegisteredServersClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -270,10 +270,10 @@ func (client *RegisteredServersClient) getCreateRequest(ctx context.Context, res func (client *RegisteredServersClient) getHandleResponse(resp *http.Response) (RegisteredServersClientGetResponse, error) { result := RegisteredServersClientGetResponse{} if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { - result.XMSCorrelationRequestID = &val + result.CorrelationRequestID = &val } if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val + result.RequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.RegisteredServer); err != nil { return RegisteredServersClientGetResponse{}, err @@ -283,7 +283,7 @@ func (client *RegisteredServersClient) getHandleResponse(resp *http.Response) (R // NewListByStorageSyncServicePager - Get a given registered server list. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - options - RegisteredServersClientListByStorageSyncServiceOptions contains the optional parameters for the RegisteredServersClient.NewListByStorageSyncServicePager @@ -291,21 +291,20 @@ func (client *RegisteredServersClient) getHandleResponse(resp *http.Response) (R func (client *RegisteredServersClient) NewListByStorageSyncServicePager(resourceGroupName string, storageSyncServiceName string, options *RegisteredServersClientListByStorageSyncServiceOptions) *runtime.Pager[RegisteredServersClientListByStorageSyncServiceResponse] { return runtime.NewPager(runtime.PagingHandler[RegisteredServersClientListByStorageSyncServiceResponse]{ More: func(page RegisteredServersClientListByStorageSyncServiceResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *RegisteredServersClientListByStorageSyncServiceResponse) (RegisteredServersClientListByStorageSyncServiceResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RegisteredServersClient.NewListByStorageSyncServicePager") - req, err := client.listByStorageSyncServiceCreateRequest(ctx, resourceGroupName, storageSyncServiceName, options) - if err != nil { - return RegisteredServersClientListByStorageSyncServiceResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByStorageSyncServiceCreateRequest(ctx, resourceGroupName, storageSyncServiceName, options) + }, nil) if err != nil { return RegisteredServersClientListByStorageSyncServiceResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RegisteredServersClientListByStorageSyncServiceResponse{}, runtime.NewResponseError(resp) - } return client.listByStorageSyncServiceHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -313,7 +312,7 @@ func (client *RegisteredServersClient) NewListByStorageSyncServicePager(resource } // listByStorageSyncServiceCreateRequest creates the ListByStorageSyncService request. -func (client *RegisteredServersClient) listByStorageSyncServiceCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, options *RegisteredServersClientListByStorageSyncServiceOptions) (*policy.Request, error) { +func (client *RegisteredServersClient) listByStorageSyncServiceCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, _ *RegisteredServersClientListByStorageSyncServiceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -332,7 +331,7 @@ func (client *RegisteredServersClient) listByStorageSyncServiceCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -342,10 +341,10 @@ func (client *RegisteredServersClient) listByStorageSyncServiceCreateRequest(ctx func (client *RegisteredServersClient) listByStorageSyncServiceHandleResponse(resp *http.Response) (RegisteredServersClientListByStorageSyncServiceResponse, error) { result := RegisteredServersClientListByStorageSyncServiceResponse{} if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { - result.XMSCorrelationRequestID = &val + result.CorrelationRequestID = &val } if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val + result.RequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.RegisteredServerArray); err != nil { return RegisteredServersClientListByStorageSyncServiceResponse{}, err @@ -356,10 +355,10 @@ func (client *RegisteredServersClient) listByStorageSyncServiceHandleResponse(re // BeginTriggerRollover - Triggers Server certificate rollover. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. -// - serverID - Server Id +// - serverID - GUID identifying the on-premises server. // - parameters - Body of Trigger Rollover request. // - options - RegisteredServersClientBeginTriggerRolloverOptions contains the optional parameters for the RegisteredServersClient.BeginTriggerRollover // method. @@ -383,7 +382,7 @@ func (client *RegisteredServersClient) BeginTriggerRollover(ctx context.Context, // TriggerRollover - Triggers Server certificate rollover. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 func (client *RegisteredServersClient) triggerRollover(ctx context.Context, resourceGroupName string, storageSyncServiceName string, serverID string, parameters TriggerRolloverRequest, options *RegisteredServersClientBeginTriggerRolloverOptions) (*http.Response, error) { var err error const operationName = "RegisteredServersClient.BeginTriggerRollover" @@ -406,7 +405,7 @@ func (client *RegisteredServersClient) triggerRollover(ctx context.Context, reso } // triggerRolloverCreateRequest creates the TriggerRollover request. -func (client *RegisteredServersClient) triggerRolloverCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, serverID string, parameters TriggerRolloverRequest, options *RegisteredServersClientBeginTriggerRolloverOptions) (*policy.Request, error) { +func (client *RegisteredServersClient) triggerRolloverCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, serverID string, parameters TriggerRolloverRequest, _ *RegisteredServersClientBeginTriggerRolloverOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}/triggerRollover" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -429,9 +428,96 @@ func (client *RegisteredServersClient) triggerRolloverCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginUpdate - Update registered server. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - storageSyncServiceName - Name of Storage Sync Service resource. +// - serverID - GUID identifying the on-premises server. +// - parameters - Body of Registered Server object. +// - options - RegisteredServersClientBeginUpdateOptions contains the optional parameters for the RegisteredServersClient.BeginUpdate +// method. +func (client *RegisteredServersClient) BeginUpdate(ctx context.Context, resourceGroupName string, storageSyncServiceName string, serverID string, parameters RegisteredServerUpdateParameters, options *RegisteredServersClientBeginUpdateOptions) (*runtime.Poller[RegisteredServersClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, storageSyncServiceName, serverID, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RegisteredServersClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RegisteredServersClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update registered server. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01 +func (client *RegisteredServersClient) update(ctx context.Context, resourceGroupName string, storageSyncServiceName string, serverID string, parameters RegisteredServerUpdateParameters, options *RegisteredServersClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "RegisteredServersClient.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, storageSyncServiceName, serverID, parameters, 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 *RegisteredServersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, serverID string, parameters RegisteredServerUpdateParameters, _ *RegisteredServersClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}" + 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 storageSyncServiceName == "" { + return nil, errors.New("parameter storageSyncServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageSyncServiceName}", url.PathEscape(storageSyncServiceName)) + if serverID == "" { + return nil, errors.New("parameter serverID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverId}", url.PathEscape(serverID)) + 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", "2022-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, parameters); err != nil { return nil, err } diff --git a/sdk/resourcemanager/storagesync/armstoragesync/registeredservers_client_example_test.go b/sdk/resourcemanager/storagesync/armstoragesync/registeredservers_client_example_test.go index 5f5843117703..85afa3b92859 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/registeredservers_client_example_test.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/registeredservers_client_example_test.go @@ -1,225 +1,320 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armstoragesync_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/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_ListByStorageSyncService.json -func ExampleRegisteredServersClient_NewListByStorageSyncServicePager() { +// Generated from example definition: 2022-09-01/RegisteredServers_Create.json +func ExampleRegisteredServersClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewRegisteredServersClient().NewListByStorageSyncServicePager("SampleResourceGroup_1", "SampleStorageSyncService_1", 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.RegisteredServerArray = armstoragesync.RegisteredServerArray{ - // Value: []*armstoragesync.RegisteredServer{ - // { - // Name: to.Ptr("SampleRegisteredServer_1.redmond.corp.microsoft.com"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/registeredServers"), - // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/registeredServers/080d4133-bdb5-40a0-96a0-71a6057bfe9a"), - // Properties: &armstoragesync.RegisteredServerProperties{ - // AgentVersion: to.Ptr("3.1.5.0"), - // AgentVersionExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T21:50:40.584Z"); return t}()), - // AgentVersionStatus: to.Ptr(armstoragesync.RegisteredServerAgentVersionStatusOk), - // ClusterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ClusterName: to.Ptr(""), - // DiscoveryEndpointURI: to.Ptr("https://kailanitest99.one.microsoft.com:443"), - // FriendlyName: to.Ptr("afscv-2304-139"), - // LastHeartBeat: to.Ptr("2018-06-11T21:50:40.5840543Z"), - // LastOperationName: to.Ptr("ICreateRegisteredServerWorkflow"), - // LastWorkflowID: to.Ptr("storageSyncServices/CV_FileStore_F1D485AA/workflows/4eecfbcf-9537-4b61-8fee-aaa3ace11c44"), - // ManagementEndpointURI: to.Ptr("https://kailanitest99.one.microsoft.com:443/"), - // MonitoringEndpointURI: to.Ptr("https://kailanitest99.one.microsoft.com:443/"), - // ProvisioningState: to.Ptr("Succeeded"), - // ResourceLocation: to.Ptr("westus"), - // ServerID: to.Ptr("3635ca8b-5cc8-4a5c-bd43-c2de5ad8dc64"), - // ServerManagementErrorCode: to.Ptr[int32](0), - // ServerName: to.Ptr("afscv-2304-139"), - // ServerOSVersion: to.Ptr("10.0.14393.0"), - // ServerRole: to.Ptr("Standalone"), - // ServiceLocation: to.Ptr("westus"), - // StorageSyncServiceUID: to.Ptr("4aa14534-1c61-483b-b6a6-9630a76f109a"), - // }, - // }}, - // } + poller, err := clientFactory.NewRegisteredServersClient().BeginCreate(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "080d4133-bdb5-40a0-96a0-71a6057bfe9a", armstoragesync.RegisteredServerCreateParameters{ + Properties: &armstoragesync.RegisteredServerCreateParametersProperties{ + AgentVersion: to.Ptr("1.0.277.0"), + ApplicationID: to.Ptr("00000000-0000-0000-0000-000000000001"), + FriendlyName: to.Ptr("afscv-2304-139"), + Identity: to.Ptr(true), + ServerCertificate: to.Ptr("MIIDFjCCAf6gAwIBAgIQQS+DS8uhc4VNzUkTw7wbRjANBgkqhkiG9w0BAQ0FADAzMTEwLwYDVQQDEyhhbmt1c2hiLXByb2QzLnJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29tMB4XDTE3MDgwMzE3MDQyNFoXDTE4MDgwNDE3MDQyNFowMzExMC8GA1UEAxMoYW5rdXNoYi1wcm9kMy5yZWRtb25kLmNvcnAubWljcm9zb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALDRvV4gmsIy6jGDPiHsXmvgVP749NNP7DopdlbHaNhjFmYINHl0uWylyaZmgJrROt2mnxN/zEyJtGnqYHlzUr4xvGq/qV5pqgdB9tag/sw9i22gfe9PRZ0FmSOZnXMbLYgLiDFqLtut5gHcOuWMj03YnkfoBEKlFBxWbagvW2yxz/Sxi9OVSJOKCaXra0RpcIHrO/KFl6ho2eE1/7Ykmfa8hZvSdoPd5gHdLiQcMB/pxq+mWp1fI6c8vFZoDu7Atn+NXTzYPKUxKzaisF12TsaKpohUsJpbB3Wocb0F5frn614D2pg14ERB5otjAMWw1m65csQWPI6dP8KIYe0+QPkCAwEAAaMmMCQwIgYDVR0lAQH/BBgwFgYIKwYBBQUHAwIGCisGAQQBgjcKAwwwDQYJKoZIhvcNAQENBQADggEBAA4RhVIBkw34M1RwakJgHvtjsOFxF1tVQA941NtLokx1l2Z8+GFQkcG4xpZSt+UN6wLerdCbnNhtkCErWUDeaT0jxk4g71Ofex7iM04crT4iHJr8mi96/XnhnkTUs+GDk12VgdeeNEczMZz+8Mxw9dJ5NCnYgTwO0SzGlclRsDvjzkLo8rh2ZG6n/jKrEyNXXo+hOqhupij0QbRP2Tvexdfw201kgN1jdZify8XzJ8Oi0bTS0KpJf2pNPOlooK2bjMUei9ANtEdXwwfVZGWvVh6tJjdv6k14wWWJ1L7zhA1IIVb1J+sQUzJji5iX0DrezjTz1Fg+gAzITaA/WsuujlM="), + ServerID: to.Ptr("080d4133-bdb5-40a0-96a0-71a6057bfe9a"), + ServerOSVersion: to.Ptr("10.0.14393.0"), + ServerRole: to.Ptr("Standalone"), + }, + }, 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 = armstoragesync.RegisteredServersClientCreateResponse{ + // RegisteredServer: &armstoragesync.RegisteredServer{ + // Name: to.Ptr("ankushb-prod3.redmond.corp.microsoft.com"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/registeredServers"), + // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/registeredServers/530a0384-50ac-456d-8240-9d6621404151"), + // Properties: &armstoragesync.RegisteredServerProperties{ + // ActiveAuthType: to.Ptr(armstoragesync.ServerAuthTypeCertificate), + // AgentVersion: to.Ptr("3.1.5.0"), + // AgentVersionExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T21:50:40.5840543Z"); return t}()), + // AgentVersionStatus: to.Ptr(armstoragesync.RegisteredServerAgentVersionStatusOk), + // ApplicationID: to.Ptr("00000000-0000-0000-0000-000000000001"), + // ClusterID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // ClusterName: to.Ptr(""), + // DiscoveryEndpointURI: to.Ptr("https://kailanitest99.one.microsoft.com:443"), + // FriendlyName: to.Ptr("afscv-2304-139"), + // Identity: to.Ptr(false), + // LastHeartBeat: to.Ptr("2018-06-11T21:50:40.5840543Z"), + // LastOperationName: to.Ptr("ICreateRegisteredServerWorkflow"), + // LastWorkflowID: to.Ptr("storageSyncServices/CV_FileStore_F1D485AA/workflows/4eecfbcf-9537-4b61-8fee-aaa3ace11c44"), + // LatestApplicationID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // ManagementEndpointURI: to.Ptr("https://kailanitest99.one.microsoft.com:443/"), + // MonitoringEndpointURI: to.Ptr("https://kailanitest99.one.microsoft.com:443/"), + // ProvisioningState: to.Ptr("Succeeded"), + // ResourceLocation: to.Ptr("westus"), + // ServerID: to.Ptr("3635ca8b-5cc8-4a5c-bd43-c2de5ad8dc64"), + // ServerManagementErrorCode: to.Ptr[int32](0), + // ServerName: to.Ptr("afscv-2304-139"), + // ServerOSVersion: to.Ptr("10.0.14393.0"), + // ServerRole: to.Ptr("Standalone"), + // ServiceLocation: to.Ptr("westus"), + // StorageSyncServiceUID: to.Ptr("4aa14534-1c61-483b-b6a6-9630a76f109a"), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_Get.json -func ExampleRegisteredServersClient_Get() { +// Generated from example definition: 2022-09-01/RegisteredServers_Delete.json +func ExampleRegisteredServersClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewRegisteredServersClient().Get(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "080d4133-bdb5-40a0-96a0-71a6057bfe9a", nil) + poller, err := clientFactory.NewRegisteredServersClient().BeginDelete(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "41166691-ab03-43e9-ab3e-0330eda162ac", 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.RegisteredServer = armstoragesync.RegisteredServer{ - // Name: to.Ptr("SampleRegisteredServer_1.redmond.corp.microsoft.com"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/registeredServers"), - // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/registeredServers/080d4133-bdb5-40a0-96a0-71a6057bfe9a"), - // Properties: &armstoragesync.RegisteredServerProperties{ - // AgentVersion: to.Ptr("3.1.5.0"), - // AgentVersionExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T21:50:40.584Z"); return t}()), - // AgentVersionStatus: to.Ptr(armstoragesync.RegisteredServerAgentVersionStatusOk), - // ClusterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ClusterName: to.Ptr(""), - // DiscoveryEndpointURI: to.Ptr("https://kailanitest99.one.microsoft.com:443"), - // FriendlyName: to.Ptr("afscv-2304-139"), - // LastHeartBeat: to.Ptr("2018-06-11T21:50:40.5840543Z"), - // LastOperationName: to.Ptr("ICreateRegisteredServerWorkflow"), - // LastWorkflowID: to.Ptr("storageSyncServices/CV_FileStore_F1D485AA/workflows/4eecfbcf-9537-4b61-8fee-aaa3ace11c44"), - // ManagementEndpointURI: to.Ptr("https://kailanitest99.one.microsoft.com:443/"), - // MonitoringEndpointURI: to.Ptr("https://kailanitest99.one.microsoft.com:443/"), - // ProvisioningState: to.Ptr("Succeeded"), - // ResourceLocation: to.Ptr("westus"), - // ServerID: to.Ptr("3635ca8b-5cc8-4a5c-bd43-c2de5ad8dc64"), - // ServerManagementErrorCode: to.Ptr[int32](0), - // ServerName: to.Ptr("afscv-2304-139"), - // ServerOSVersion: to.Ptr("10.0.14393.0"), - // ServerRole: to.Ptr("Standalone"), - // ServiceLocation: to.Ptr("westus"), - // StorageSyncServiceUID: to.Ptr("4aa14534-1c61-483b-b6a6-9630a76f109a"), - // }, + // res = armstoragesync.RegisteredServersClientDeleteResponse{ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_Create.json -func ExampleRegisteredServersClient_BeginCreate() { +// Generated from example definition: 2022-09-01/RegisteredServers_Get.json +func ExampleRegisteredServersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewRegisteredServersClient().BeginCreate(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "080d4133-bdb5-40a0-96a0-71a6057bfe9a", armstoragesync.RegisteredServerCreateParameters{ - Properties: &armstoragesync.RegisteredServerCreateParametersProperties{ - AgentVersion: to.Ptr("1.0.277.0"), - FriendlyName: to.Ptr("afscv-2304-139"), - ServerCertificate: to.Ptr("MIIDFjCCAf6gAwIBAgIQQS+DS8uhc4VNzUkTw7wbRjANBgkqhkiG9w0BAQ0FADAzMTEwLwYDVQQDEyhhbmt1c2hiLXByb2QzLnJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29tMB4XDTE3MDgwMzE3MDQyNFoXDTE4MDgwNDE3MDQyNFowMzExMC8GA1UEAxMoYW5rdXNoYi1wcm9kMy5yZWRtb25kLmNvcnAubWljcm9zb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALDRvV4gmsIy6jGDPiHsXmvgVP749NNP7DopdlbHaNhjFmYINHl0uWylyaZmgJrROt2mnxN/zEyJtGnqYHlzUr4xvGq/qV5pqgdB9tag/sw9i22gfe9PRZ0FmSOZnXMbLYgLiDFqLtut5gHcOuWMj03YnkfoBEKlFBxWbagvW2yxz/Sxi9OVSJOKCaXra0RpcIHrO/KFl6ho2eE1/7Ykmfa8hZvSdoPd5gHdLiQcMB/pxq+mWp1fI6c8vFZoDu7Atn+NXTzYPKUxKzaisF12TsaKpohUsJpbB3Wocb0F5frn614D2pg14ERB5otjAMWw1m65csQWPI6dP8KIYe0+QPkCAwEAAaMmMCQwIgYDVR0lAQH/BBgwFgYIKwYBBQUHAwIGCisGAQQBgjcKAwwwDQYJKoZIhvcNAQENBQADggEBAA4RhVIBkw34M1RwakJgHvtjsOFxF1tVQA941NtLokx1l2Z8+GFQkcG4xpZSt+UN6wLerdCbnNhtkCErWUDeaT0jxk4g71Ofex7iM04crT4iHJr8mi96/XnhnkTUs+GDk12VgdeeNEczMZz+8Mxw9dJ5NCnYgTwO0SzGlclRsDvjzkLo8rh2ZG6n/jKrEyNXXo+hOqhupij0QbRP2Tvexdfw201kgN1jdZify8XzJ8Oi0bTS0KpJf2pNPOlooK2bjMUei9ANtEdXwwfVZGWvVh6tJjdv6k14wWWJ1L7zhA1IIVb1J+sQUzJji5iX0DrezjTz1Fg+gAzITaA/WsuujlM="), - ServerID: to.Ptr("080d4133-bdb5-40a0-96a0-71a6057bfe9a"), - ServerOSVersion: to.Ptr("10.0.14393.0"), - ServerRole: to.Ptr("Standalone"), - }, - }, nil) + res, err := clientFactory.NewRegisteredServersClient().Get(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "080d4133-bdb5-40a0-96a0-71a6057bfe9a", 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.RegisteredServer = armstoragesync.RegisteredServer{ - // Name: to.Ptr("ankushb-prod3.redmond.corp.microsoft.com"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/registeredServers"), - // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/registeredServers/530a0384-50ac-456d-8240-9d6621404151"), - // Properties: &armstoragesync.RegisteredServerProperties{ - // AgentVersion: to.Ptr("3.1.5.0"), - // AgentVersionExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T21:50:40.584Z"); return t}()), - // AgentVersionStatus: to.Ptr(armstoragesync.RegisteredServerAgentVersionStatusOk), - // ClusterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ClusterName: to.Ptr(""), - // DiscoveryEndpointURI: to.Ptr("https://kailanitest99.one.microsoft.com:443"), - // FriendlyName: to.Ptr("afscv-2304-139"), - // LastHeartBeat: to.Ptr("2018-06-11T21:50:40.5840543Z"), - // LastOperationName: to.Ptr("ICreateRegisteredServerWorkflow"), - // LastWorkflowID: to.Ptr("storageSyncServices/CV_FileStore_F1D485AA/workflows/4eecfbcf-9537-4b61-8fee-aaa3ace11c44"), - // ManagementEndpointURI: to.Ptr("https://kailanitest99.one.microsoft.com:443/"), - // MonitoringEndpointURI: to.Ptr("https://kailanitest99.one.microsoft.com:443/"), - // ProvisioningState: to.Ptr("Succeeded"), - // ResourceLocation: to.Ptr("westus"), - // ServerID: to.Ptr("3635ca8b-5cc8-4a5c-bd43-c2de5ad8dc64"), - // ServerManagementErrorCode: to.Ptr[int32](0), - // ServerName: to.Ptr("afscv-2304-139"), - // ServerOSVersion: to.Ptr("10.0.14393.0"), - // ServerRole: to.Ptr("Standalone"), - // ServiceLocation: to.Ptr("westus"), - // StorageSyncServiceUID: to.Ptr("4aa14534-1c61-483b-b6a6-9630a76f109a"), + // res = armstoragesync.RegisteredServersClientGetResponse{ + // CorrelationRequestID: "d166ca76-dad2-49df-b409-d2acfd42d730" + // RequestID: "74e55a4d-1c6f-46de-9a8d-278e53a47403" + // RegisteredServer: &armstoragesync.RegisteredServer{ + // Name: to.Ptr("SampleRegisteredServer_1.redmond.corp.microsoft.com"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/registeredServers"), + // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/registeredServers/080d4133-bdb5-40a0-96a0-71a6057bfe9a"), + // Properties: &armstoragesync.RegisteredServerProperties{ + // ActiveAuthType: to.Ptr(armstoragesync.ServerAuthTypeCertificate), + // AgentVersion: to.Ptr("3.1.5.0"), + // AgentVersionExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T21:50:40.5840543Z"); return t}()), + // AgentVersionStatus: to.Ptr(armstoragesync.RegisteredServerAgentVersionStatusOk), + // ApplicationID: to.Ptr("00000000-0000-0000-0000-000000000001"), + // ClusterID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // ClusterName: to.Ptr(""), + // DiscoveryEndpointURI: to.Ptr("https://kailanitest99.one.microsoft.com:443"), + // FriendlyName: to.Ptr("afscv-2304-139"), + // Identity: to.Ptr(false), + // LastHeartBeat: to.Ptr("2018-06-11T21:50:40.5840543Z"), + // LastOperationName: to.Ptr("ICreateRegisteredServerWorkflow"), + // LastWorkflowID: to.Ptr("storageSyncServices/CV_FileStore_F1D485AA/workflows/4eecfbcf-9537-4b61-8fee-aaa3ace11c44"), + // LatestApplicationID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // ManagementEndpointURI: to.Ptr("https://kailanitest99.one.microsoft.com:443/"), + // MonitoringEndpointURI: to.Ptr("https://kailanitest99.one.microsoft.com:443/"), + // ProvisioningState: to.Ptr("Succeeded"), + // ResourceLocation: to.Ptr("westus"), + // ServerID: to.Ptr("3635ca8b-5cc8-4a5c-bd43-c2de5ad8dc64"), + // ServerManagementErrorCode: to.Ptr[int32](0), + // ServerName: to.Ptr("afscv-2304-139"), + // ServerOSVersion: to.Ptr("10.0.14393.0"), + // ServerRole: to.Ptr("Standalone"), + // ServiceLocation: to.Ptr("westus"), + // StorageSyncServiceUID: to.Ptr("4aa14534-1c61-483b-b6a6-9630a76f109a"), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_Delete.json -func ExampleRegisteredServersClient_BeginDelete() { +// Generated from example definition: 2022-09-01/RegisteredServers_ListByStorageSyncService.json +func ExampleRegisteredServersClient_NewListByStorageSyncServicePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewRegisteredServersClient().BeginDelete(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "41166691-ab03-43e9-ab3e-0330eda162ac", nil) + pager := clientFactory.NewRegisteredServersClient().NewListByStorageSyncServicePager("SampleResourceGroup_1", "SampleStorageSyncService_1", 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 = armstoragesync.RegisteredServersClientListByStorageSyncServiceResponse{ + // CorrelationRequestID: "d166ca76-dad2-49df-b409-d2acfd42d730" + // RequestID: "74e55a4d-1c6f-46de-9a8d-278e53a47403" + // RegisteredServerArray: armstoragesync.RegisteredServerArray{ + // Value: []*armstoragesync.RegisteredServer{ + // { + // Name: to.Ptr("SampleRegisteredServer_1.redmond.corp.microsoft.com"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/registeredServers"), + // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/registeredServers/080d4133-bdb5-40a0-96a0-71a6057bfe9a"), + // Properties: &armstoragesync.RegisteredServerProperties{ + // ActiveAuthType: to.Ptr(armstoragesync.ServerAuthTypeCertificate), + // AgentVersion: to.Ptr("3.1.5.0"), + // AgentVersionExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T21:50:40.5840543Z"); return t}()), + // AgentVersionStatus: to.Ptr(armstoragesync.RegisteredServerAgentVersionStatusOk), + // ApplicationID: to.Ptr("00000000-0000-0000-0000-000000000001"), + // ClusterID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // ClusterName: to.Ptr(""), + // DiscoveryEndpointURI: to.Ptr("https://kailanitest99.one.microsoft.com:443"), + // FriendlyName: to.Ptr("afscv-2304-139"), + // Identity: to.Ptr(false), + // LastHeartBeat: to.Ptr("2018-06-11T21:50:40.5840543Z"), + // LastOperationName: to.Ptr("ICreateRegisteredServerWorkflow"), + // LastWorkflowID: to.Ptr("storageSyncServices/CV_FileStore_F1D485AA/workflows/4eecfbcf-9537-4b61-8fee-aaa3ace11c44"), + // LatestApplicationID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // ManagementEndpointURI: to.Ptr("https://kailanitest99.one.microsoft.com:443/"), + // MonitoringEndpointURI: to.Ptr("https://kailanitest99.one.microsoft.com:443/"), + // ProvisioningState: to.Ptr("Succeeded"), + // ResourceLocation: to.Ptr("westus"), + // ServerID: to.Ptr("3635ca8b-5cc8-4a5c-bd43-c2de5ad8dc64"), + // ServerManagementErrorCode: to.Ptr[int32](0), + // ServerName: to.Ptr("afscv-2304-139"), + // ServerOSVersion: to.Ptr("10.0.14393.0"), + // ServerRole: to.Ptr("Standalone"), + // ServiceLocation: to.Ptr("westus"), + // StorageSyncServiceUID: to.Ptr("4aa14534-1c61-483b-b6a6-9630a76f109a"), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2022-09-01/RegisteredServers_TriggerRollover.json +func ExampleRegisteredServersClient_BeginTriggerRollover() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewRegisteredServersClient().BeginTriggerRollover(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "d166ca76-dad2-49df-b409-12345642d730", armstoragesync.TriggerRolloverRequest{ + ServerCertificate: to.Ptr("\"MIIDFjCCAf6gAwIBAgIQQS+DS8uhc4VNzUkTw7wbRjANBgkqhkiG9w0BAQ0FADAzMTEwLwYDVQQDEyhhbmt1c2hiLXByb2QzLnJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29tMB4XDTE3MDgwMzE3MDQyNFoXDTE4MDgwNDE3MDQyNFowMzExMC8GA1UEAxMoYW5rdXNoYi1wcm9kMy5yZWRtb25kLmNvcnAubWljcm9zb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALDRvV4gmsIy6jGDPiHsXmvgVP749NNP7DopdlbHaNhjFmYINHl0uWylyaZmgJrROt2mnxN/zEyJtGnqYHlzUr4xvGq/qV5pqgdB9tag/sw9i22gfe9PRZ0FmSOZnXMbLYgLiDFqLtut5gHcOuWMj03YnkfoBEKlFBxWbagvW2yxz/Sxi9OVSJOKCaXra0RpcIHrO/KFl6ho2eE1/7Ykmfa8hZvSdoPd5gHdLiQcMB/pxq+mWp1fI6c8vFZoDu7Atn+NXTzYPKUxKzaisF12TsaKpohUsJpbB3Wocb0F5frn614D2pg14ERB5otjAMWw1m65csQWPI6dP8KIYe0+QPkCAwEAAaMmMCQwIgYDVR0lAQH/BBgwFgYIKwYBBQUHAwIGCisGAQQBgjcKAwwwDQYJKoZIhvcNAQENBQADggEBAA4RhVIBkw34M1RwakJgHvtjsOFxF1tVQA941NtLokx1l2Z8+GFQkcG4xpZSt+UN6wLerdCbnNhtkCErWUDeaT0jxk4g71Ofex7iM04crT4iHJr8mi96/XnhnkTUs+GDk12VgdeeNEczMZz+8Mxw9dJ5NCnYgTwO0SzGlclRsDvjzkLo8rh2ZG6n/jKrEyNXXo+hOqhupij0QbRP2Tvexdfw201kgN1jdZify8XzJ8Oi0bTS0KpJf2pNPOlooK2bjMUei9ANtEdXwwfVZGWvVh6tJjdv6k14wWWJ1L7zhA1IIVb1J+sQUzJji5iX0DrezjTz1Fg+gAzITaA/WsuujlM=\""), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + 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 = armstoragesync.RegisteredServersClientTriggerRolloverResponse{ + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_TriggerRollover.json -func ExampleRegisteredServersClient_BeginTriggerRollover() { +// Generated from example definition: 2022-09-01/RegisteredServers_Update.json +func ExampleRegisteredServersClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewRegisteredServersClient().BeginTriggerRollover(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "d166ca76-dad2-49df-b409-12345642d730", armstoragesync.TriggerRolloverRequest{ - ServerCertificate: to.Ptr("\"MIIDFjCCAf6gAwIBAgIQQS+DS8uhc4VNzUkTw7wbRjANBgkqhkiG9w0BAQ0FADAzMTEwLwYDVQQDEyhhbmt1c2hiLXByb2QzLnJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29tMB4XDTE3MDgwMzE3MDQyNFoXDTE4MDgwNDE3MDQyNFowMzExMC8GA1UEAxMoYW5rdXNoYi1wcm9kMy5yZWRtb25kLmNvcnAubWljcm9zb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALDRvV4gmsIy6jGDPiHsXmvgVP749NNP7DopdlbHaNhjFmYINHl0uWylyaZmgJrROt2mnxN/zEyJtGnqYHlzUr4xvGq/qV5pqgdB9tag/sw9i22gfe9PRZ0FmSOZnXMbLYgLiDFqLtut5gHcOuWMj03YnkfoBEKlFBxWbagvW2yxz/Sxi9OVSJOKCaXra0RpcIHrO/KFl6ho2eE1/7Ykmfa8hZvSdoPd5gHdLiQcMB/pxq+mWp1fI6c8vFZoDu7Atn+NXTzYPKUxKzaisF12TsaKpohUsJpbB3Wocb0F5frn614D2pg14ERB5otjAMWw1m65csQWPI6dP8KIYe0+QPkCAwEAAaMmMCQwIgYDVR0lAQH/BBgwFgYIKwYBBQUHAwIGCisGAQQBgjcKAwwwDQYJKoZIhvcNAQENBQADggEBAA4RhVIBkw34M1RwakJgHvtjsOFxF1tVQA941NtLokx1l2Z8+GFQkcG4xpZSt+UN6wLerdCbnNhtkCErWUDeaT0jxk4g71Ofex7iM04crT4iHJr8mi96/XnhnkTUs+GDk12VgdeeNEczMZz+8Mxw9dJ5NCnYgTwO0SzGlclRsDvjzkLo8rh2ZG6n/jKrEyNXXo+hOqhupij0QbRP2Tvexdfw201kgN1jdZify8XzJ8Oi0bTS0KpJf2pNPOlooK2bjMUei9ANtEdXwwfVZGWvVh6tJjdv6k14wWWJ1L7zhA1IIVb1J+sQUzJji5iX0DrezjTz1Fg+gAzITaA/WsuujlM=\""), + poller, err := clientFactory.NewRegisteredServersClient().BeginUpdate(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "080d4133-bdb5-40a0-96a0-71a6057bfe9a", armstoragesync.RegisteredServerUpdateParameters{ + Properties: &armstoragesync.RegisteredServerUpdateProperties{ + ApplicationID: to.Ptr("120d4132-bcd5-40a0-96a0-71a6057ebf0c"), + Identity: to.Ptr(true), + }, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + 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 = armstoragesync.RegisteredServersClientUpdateResponse{ + // RegisteredServer: &armstoragesync.RegisteredServer{ + // Name: to.Ptr("ankushb-prod3.redmond.corp.microsoft.com"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/registeredServers"), + // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/registeredServers/530a0384-50ac-456d-8240-9d6621404151"), + // Properties: &armstoragesync.RegisteredServerProperties{ + // ActiveAuthType: to.Ptr(armstoragesync.ServerAuthTypeCertificate), + // AgentVersion: to.Ptr("3.1.5.0"), + // AgentVersionExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T21:50:40.5840543Z"); return t}()), + // AgentVersionStatus: to.Ptr(armstoragesync.RegisteredServerAgentVersionStatusOk), + // ApplicationID: to.Ptr("00000000-0000-0000-0000-000000000001"), + // ClusterID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // ClusterName: to.Ptr(""), + // DiscoveryEndpointURI: to.Ptr("https://kailanitest99.one.microsoft.com:443"), + // FriendlyName: to.Ptr("afscv-2304-139"), + // Identity: to.Ptr(false), + // LastHeartBeat: to.Ptr("2018-06-11T21:50:40.5840543Z"), + // LastOperationName: to.Ptr("ICreateRegisteredServerWorkflow"), + // LastWorkflowID: to.Ptr("storageSyncServices/CV_FileStore_F1D485AA/workflows/4eecfbcf-9537-4b61-8fee-aaa3ace11c44"), + // LatestApplicationID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // ManagementEndpointURI: to.Ptr("https://kailanitest99.one.microsoft.com:443/"), + // MonitoringEndpointURI: to.Ptr("https://kailanitest99.one.microsoft.com:443/"), + // ProvisioningState: to.Ptr("Succeeded"), + // ResourceLocation: to.Ptr("westus"), + // ServerID: to.Ptr("3635ca8b-5cc8-4a5c-bd43-c2de5ad8dc64"), + // ServerManagementErrorCode: to.Ptr[int32](0), + // ServerName: to.Ptr("afscv-2304-139"), + // ServerOSVersion: to.Ptr("10.0.14393.0"), + // ServerRole: to.Ptr("Standalone"), + // ServiceLocation: to.Ptr("westus"), + // StorageSyncServiceUID: to.Ptr("4aa14534-1c61-483b-b6a6-9630a76f109a"), + // }, + // }, + // } } diff --git a/sdk/resourcemanager/storagesync/armstoragesync/response_types.go b/sdk/resourcemanager/storagesync/armstoragesync/responses.go similarity index 60% rename from sdk/resourcemanager/storagesync/armstoragesync/response_types.go rename to sdk/resourcemanager/storagesync/armstoragesync/responses.go index 62bb055bc93e..a4c16f9c526b 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/response_types.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/responses.go @@ -1,10 +1,21 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 armstoragesync +// CloudEndpointsClientAfsShareMetadataCertificatePublicKeysResponse contains the response from method CloudEndpointsClient.AfsShareMetadataCertificatePublicKeys. +type CloudEndpointsClientAfsShareMetadataCertificatePublicKeysResponse struct { + // Cloud endpoint AFS file share metadata signing certificate public keys. + CloudEndpointAfsShareMetadataCertificatePublicKeys + + // correlation request id. + CorrelationRequestID *string + + // request id. + RequestID *string +} + // CloudEndpointsClientCreateResponse contains the response from method CloudEndpointsClient.BeginCreate. type CloudEndpointsClientCreateResponse struct { // Cloud Endpoint object. @@ -21,11 +32,11 @@ type CloudEndpointsClientGetResponse struct { // Cloud Endpoint object. CloudEndpoint - // XMSCorrelationRequestID contains the information returned from the x-ms-correlation-request-id header response. - XMSCorrelationRequestID *string + // correlation request id. + CorrelationRequestID *string - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // request id. + RequestID *string } // CloudEndpointsClientListBySyncGroupResponse contains the response from method CloudEndpointsClient.NewListBySyncGroupPager. @@ -33,11 +44,11 @@ type CloudEndpointsClientListBySyncGroupResponse struct { // Array of CloudEndpoint CloudEndpointArray - // XMSCorrelationRequestID contains the information returned from the x-ms-correlation-request-id header response. - XMSCorrelationRequestID *string + // correlation request id. + CorrelationRequestID *string - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // request id. + RequestID *string } // CloudEndpointsClientPostBackupResponse contains the response from method CloudEndpointsClient.BeginPostBackup. @@ -63,11 +74,11 @@ type CloudEndpointsClientPreRestoreResponse struct { // CloudEndpointsClientRestoreheartbeatResponse contains the response from method CloudEndpointsClient.Restoreheartbeat. type CloudEndpointsClientRestoreheartbeatResponse struct { - // XMSCorrelationRequestID contains the information returned from the x-ms-correlation-request-id header response. - XMSCorrelationRequestID *string + // correlation request id. + CorrelationRequestID *string - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // request id. + RequestID *string } // CloudEndpointsClientTriggerChangeDetectionResponse contains the response from method CloudEndpointsClient.BeginTriggerChangeDetection. @@ -80,11 +91,11 @@ type MicrosoftStorageSyncClientLocationOperationStatusResponse struct { // Operation status object LocationOperationStatus - // XMSCorrelationRequestID contains the information returned from the x-ms-correlation-request-id header response. - XMSCorrelationRequestID *string + // correlation request id. + CorrelationRequestID *string - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // request id. + RequestID *string } // OperationStatusClientGetResponse contains the response from method OperationStatusClient.Get. @@ -92,28 +103,28 @@ type OperationStatusClientGetResponse struct { // Operation status object OperationStatus - // XMSCorrelationRequestID contains the information returned from the x-ms-correlation-request-id header response. - XMSCorrelationRequestID *string + // correlation request id. + CorrelationRequestID *string - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // request id. + RequestID *string } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { - // The list of storage sync operations. + // Paged collection of OperationEntity items OperationEntityListResult - // XMSCorrelationRequestID contains the information returned from the x-ms-correlation-request-id header response. - XMSCorrelationRequestID *string + // correlation request id. + CorrelationRequestID *string - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // request id. + RequestID *string } // PrivateEndpointConnectionsClientCreateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreate. type PrivateEndpointConnectionsClientCreateResponse struct { - // The Private Endpoint Connection resource. + // The private endpoint connection resource. PrivateEndpointConnection } @@ -124,25 +135,30 @@ type PrivateEndpointConnectionsClientDeleteResponse struct { // PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. type PrivateEndpointConnectionsClientGetResponse struct { - // The Private Endpoint Connection resource. + // The private endpoint connection resource. PrivateEndpointConnection } // PrivateEndpointConnectionsClientListByStorageSyncServiceResponse contains the response from method PrivateEndpointConnectionsClient.NewListByStorageSyncServicePager. type PrivateEndpointConnectionsClientListByStorageSyncServiceResponse struct { - // List of private endpoint connection associated with the specified storage account + // List of private endpoint connections associated with the specified resource. PrivateEndpointConnectionListResult - // XMSCorrelationRequestID contains the information returned from the x-ms-correlation-request-id header response. - XMSCorrelationRequestID *string + // correlation request id. + CorrelationRequestID *string - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // request id. + RequestID *string } // PrivateLinkResourcesClientListByStorageSyncServiceResponse contains the response from method PrivateLinkResourcesClient.ListByStorageSyncService. type PrivateLinkResourcesClientListByStorageSyncServiceResponse struct { - // A list of private link resources + // A list of private link resources for versions before v6. + // This model represents the standard `PrivateLinkResourceListResult` envelope for versions v3, v4, and v5. It has been deprecated + // for v6 and beyond. + // Note: This is only intended for use with versions before v6. Do not use this if you are already on CommonTypes.Version.v6 + // or beyond. + // If you are migrating to v6 or above, use `PrivateLinkResourceListResult` directly. PrivateLinkResourceListResult } @@ -162,11 +178,11 @@ type RegisteredServersClientGetResponse struct { // Registered Server resource. RegisteredServer - // XMSCorrelationRequestID contains the information returned from the x-ms-correlation-request-id header response. - XMSCorrelationRequestID *string + // correlation request id. + CorrelationRequestID *string - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // request id. + RequestID *string } // RegisteredServersClientListByStorageSyncServiceResponse contains the response from method RegisteredServersClient.NewListByStorageSyncServicePager. @@ -174,11 +190,11 @@ type RegisteredServersClientListByStorageSyncServiceResponse struct { // Array of RegisteredServer RegisteredServerArray - // XMSCorrelationRequestID contains the information returned from the x-ms-correlation-request-id header response. - XMSCorrelationRequestID *string + // correlation request id. + CorrelationRequestID *string - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // request id. + RequestID *string } // RegisteredServersClientTriggerRolloverResponse contains the response from method RegisteredServersClient.BeginTriggerRollover. @@ -186,6 +202,12 @@ type RegisteredServersClientTriggerRolloverResponse struct { // placeholder for future response values } +// RegisteredServersClientUpdateResponse contains the response from method RegisteredServersClient.BeginUpdate. +type RegisteredServersClientUpdateResponse struct { + // Registered Server resource. + RegisteredServer +} + // ServerEndpointsClientCreateResponse contains the response from method ServerEndpointsClient.BeginCreate. type ServerEndpointsClientCreateResponse struct { // Server Endpoint object. @@ -202,11 +224,11 @@ type ServerEndpointsClientGetResponse struct { // Server Endpoint object. ServerEndpoint - // XMSCorrelationRequestID contains the information returned from the x-ms-correlation-request-id header response. - XMSCorrelationRequestID *string + // correlation request id. + CorrelationRequestID *string - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // request id. + RequestID *string } // ServerEndpointsClientListBySyncGroupResponse contains the response from method ServerEndpointsClient.NewListBySyncGroupPager. @@ -214,14 +236,14 @@ type ServerEndpointsClientListBySyncGroupResponse struct { // Array of ServerEndpoint ServerEndpointArray - // Location contains the information returned from the Location header response. - Location *string + // correlation request id. + CorrelationRequestID *string - // XMSCorrelationRequestID contains the information returned from the x-ms-correlation-request-id header response. - XMSCorrelationRequestID *string + // Operation Status Location URI + Location *string - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // request id. + RequestID *string } // ServerEndpointsClientRecallActionResponse contains the response from method ServerEndpointsClient.BeginRecallAction. @@ -257,11 +279,11 @@ type ServicesClientGetResponse struct { // Storage Sync Service object. Service - // XMSCorrelationRequestID contains the information returned from the x-ms-correlation-request-id header response. - XMSCorrelationRequestID *string + // correlation request id. + CorrelationRequestID *string - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // request id. + RequestID *string } // ServicesClientListByResourceGroupResponse contains the response from method ServicesClient.NewListByResourceGroupPager. @@ -269,11 +291,11 @@ type ServicesClientListByResourceGroupResponse struct { // Array of StorageSyncServices ServiceArray - // XMSCorrelationRequestID contains the information returned from the x-ms-correlation-request-id header response. - XMSCorrelationRequestID *string + // correlation request id. + CorrelationRequestID *string - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // request id. + RequestID *string } // ServicesClientListBySubscriptionResponse contains the response from method ServicesClient.NewListBySubscriptionPager. @@ -281,11 +303,11 @@ type ServicesClientListBySubscriptionResponse struct { // Array of StorageSyncServices ServiceArray - // XMSCorrelationRequestID contains the information returned from the x-ms-correlation-request-id header response. - XMSCorrelationRequestID *string + // correlation request id. + CorrelationRequestID *string - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // request id. + RequestID *string } // ServicesClientUpdateResponse contains the response from method ServicesClient.BeginUpdate. @@ -299,20 +321,20 @@ type SyncGroupsClientCreateResponse struct { // Sync Group object. SyncGroup - // XMSCorrelationRequestID contains the information returned from the x-ms-correlation-request-id header response. - XMSCorrelationRequestID *string + // correlation request id. + CorrelationRequestID *string - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // request id. + RequestID *string } // SyncGroupsClientDeleteResponse contains the response from method SyncGroupsClient.Delete. type SyncGroupsClientDeleteResponse struct { - // XMSCorrelationRequestID contains the information returned from the x-ms-correlation-request-id header response. - XMSCorrelationRequestID *string + // correlation request id + CorrelationRequestID *string - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // Request id + RequestID *string } // SyncGroupsClientGetResponse contains the response from method SyncGroupsClient.Get. @@ -320,11 +342,11 @@ type SyncGroupsClientGetResponse struct { // Sync Group object. SyncGroup - // XMSCorrelationRequestID contains the information returned from the x-ms-correlation-request-id header response. - XMSCorrelationRequestID *string + // correlation request id. + CorrelationRequestID *string - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // request id. + RequestID *string } // SyncGroupsClientListByStorageSyncServiceResponse contains the response from method SyncGroupsClient.NewListByStorageSyncServicePager. @@ -332,20 +354,20 @@ type SyncGroupsClientListByStorageSyncServiceResponse struct { // Array of SyncGroup SyncGroupArray - // XMSCorrelationRequestID contains the information returned from the x-ms-correlation-request-id header response. - XMSCorrelationRequestID *string + // correlation request id. + CorrelationRequestID *string - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // request id. + RequestID *string } // WorkflowsClientAbortResponse contains the response from method WorkflowsClient.Abort. type WorkflowsClientAbortResponse struct { - // XMSCorrelationRequestID contains the information returned from the x-ms-correlation-request-id header response. - XMSCorrelationRequestID *string + // correlation request id. + CorrelationRequestID *string - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // request id. + RequestID *string } // WorkflowsClientGetResponse contains the response from method WorkflowsClient.Get. @@ -353,11 +375,11 @@ type WorkflowsClientGetResponse struct { // Workflow resource. Workflow - // XMSCorrelationRequestID contains the information returned from the x-ms-correlation-request-id header response. - XMSCorrelationRequestID *string + // correlation request id. + CorrelationRequestID *string - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // request id. + RequestID *string } // WorkflowsClientListByStorageSyncServiceResponse contains the response from method WorkflowsClient.NewListByStorageSyncServicePager. @@ -365,9 +387,9 @@ type WorkflowsClientListByStorageSyncServiceResponse struct { // Array of Workflow WorkflowArray - // XMSCorrelationRequestID contains the information returned from the x-ms-correlation-request-id header response. - XMSCorrelationRequestID *string + // correlation request id. + CorrelationRequestID *string - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // request id. + RequestID *string } diff --git a/sdk/resourcemanager/storagesync/armstoragesync/serverendpoints_client.go b/sdk/resourcemanager/storagesync/armstoragesync/serverendpoints_client.go index 6bcbb60e4c99..b6e0caac31e9 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/serverendpoints_client.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/serverendpoints_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 armstoragesync @@ -25,9 +24,9 @@ type ServerEndpointsClient struct { } // NewServerEndpointsClient creates a new instance of ServerEndpointsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewServerEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServerEndpointsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -43,7 +42,7 @@ func NewServerEndpointsClient(subscriptionID string, credential azcore.TokenCred // BeginCreate - Create a new ServerEndpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - syncGroupName - Name of Sync Group resource. @@ -58,7 +57,8 @@ func (client *ServerEndpointsClient) BeginCreate(ctx context.Context, resourceGr return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServerEndpointsClientCreateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -71,7 +71,7 @@ func (client *ServerEndpointsClient) BeginCreate(ctx context.Context, resourceGr // Create - Create a new ServerEndpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 func (client *ServerEndpointsClient) create(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, parameters ServerEndpointCreateParameters, options *ServerEndpointsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ServerEndpointsClient.BeginCreate" @@ -94,7 +94,7 @@ func (client *ServerEndpointsClient) create(ctx context.Context, resourceGroupNa } // createCreateRequest creates the Create request. -func (client *ServerEndpointsClient) createCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, parameters ServerEndpointCreateParameters, options *ServerEndpointsClientBeginCreateOptions) (*policy.Request, error) { +func (client *ServerEndpointsClient) createCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, parameters ServerEndpointCreateParameters, _ *ServerEndpointsClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -121,9 +121,10 @@ func (client *ServerEndpointsClient) createCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-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, parameters); err != nil { return nil, err } @@ -133,7 +134,7 @@ func (client *ServerEndpointsClient) createCreateRequest(ctx context.Context, re // BeginDelete - Delete a given ServerEndpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - syncGroupName - Name of Sync Group resource. @@ -160,7 +161,7 @@ func (client *ServerEndpointsClient) BeginDelete(ctx context.Context, resourceGr // Delete - Delete a given ServerEndpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 func (client *ServerEndpointsClient) deleteOperation(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, options *ServerEndpointsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ServerEndpointsClient.BeginDelete" @@ -183,7 +184,7 @@ func (client *ServerEndpointsClient) deleteOperation(ctx context.Context, resour } // deleteCreateRequest creates the Delete request. -func (client *ServerEndpointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, options *ServerEndpointsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ServerEndpointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, _ *ServerEndpointsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -210,16 +211,15 @@ func (client *ServerEndpointsClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Get a ServerEndpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - syncGroupName - Name of Sync Group resource. @@ -248,7 +248,7 @@ func (client *ServerEndpointsClient) Get(ctx context.Context, resourceGroupName } // getCreateRequest creates the Get request. -func (client *ServerEndpointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, options *ServerEndpointsClientGetOptions) (*policy.Request, error) { +func (client *ServerEndpointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, _ *ServerEndpointsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -275,7 +275,7 @@ func (client *ServerEndpointsClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -285,10 +285,10 @@ func (client *ServerEndpointsClient) getCreateRequest(ctx context.Context, resou func (client *ServerEndpointsClient) getHandleResponse(resp *http.Response) (ServerEndpointsClientGetResponse, error) { result := ServerEndpointsClientGetResponse{} if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { - result.XMSCorrelationRequestID = &val + result.CorrelationRequestID = &val } if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val + result.RequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ServerEndpoint); err != nil { return ServerEndpointsClientGetResponse{}, err @@ -298,7 +298,7 @@ func (client *ServerEndpointsClient) getHandleResponse(resp *http.Response) (Ser // NewListBySyncGroupPager - Get a ServerEndpoint list. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - syncGroupName - Name of Sync Group resource. @@ -307,21 +307,20 @@ func (client *ServerEndpointsClient) getHandleResponse(resp *http.Response) (Ser func (client *ServerEndpointsClient) NewListBySyncGroupPager(resourceGroupName string, storageSyncServiceName string, syncGroupName string, options *ServerEndpointsClientListBySyncGroupOptions) *runtime.Pager[ServerEndpointsClientListBySyncGroupResponse] { return runtime.NewPager(runtime.PagingHandler[ServerEndpointsClientListBySyncGroupResponse]{ More: func(page ServerEndpointsClientListBySyncGroupResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ServerEndpointsClientListBySyncGroupResponse) (ServerEndpointsClientListBySyncGroupResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ServerEndpointsClient.NewListBySyncGroupPager") - req, err := client.listBySyncGroupCreateRequest(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, options) - if err != nil { - return ServerEndpointsClientListBySyncGroupResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySyncGroupCreateRequest(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, options) + }, nil) if err != nil { return ServerEndpointsClientListBySyncGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerEndpointsClientListBySyncGroupResponse{}, runtime.NewResponseError(resp) - } return client.listBySyncGroupHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -329,7 +328,7 @@ func (client *ServerEndpointsClient) NewListBySyncGroupPager(resourceGroupName s } // listBySyncGroupCreateRequest creates the ListBySyncGroup request. -func (client *ServerEndpointsClient) listBySyncGroupCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, options *ServerEndpointsClientListBySyncGroupOptions) (*policy.Request, error) { +func (client *ServerEndpointsClient) listBySyncGroupCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, _ *ServerEndpointsClientListBySyncGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -352,7 +351,7 @@ func (client *ServerEndpointsClient) listBySyncGroupCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -361,14 +360,14 @@ func (client *ServerEndpointsClient) listBySyncGroupCreateRequest(ctx context.Co // listBySyncGroupHandleResponse handles the ListBySyncGroup response. func (client *ServerEndpointsClient) listBySyncGroupHandleResponse(resp *http.Response) (ServerEndpointsClientListBySyncGroupResponse, error) { result := ServerEndpointsClientListBySyncGroupResponse{} + if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { + result.CorrelationRequestID = &val + } if val := resp.Header.Get("Location"); val != "" { result.Location = &val } - if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { - result.XMSCorrelationRequestID = &val - } if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val + result.RequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ServerEndpointArray); err != nil { return ServerEndpointsClientListBySyncGroupResponse{}, err @@ -379,7 +378,7 @@ func (client *ServerEndpointsClient) listBySyncGroupHandleResponse(resp *http.Re // BeginRecallAction - Recall a server endpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - syncGroupName - Name of Sync Group resource. @@ -407,7 +406,7 @@ func (client *ServerEndpointsClient) BeginRecallAction(ctx context.Context, reso // RecallAction - Recall a server endpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 func (client *ServerEndpointsClient) recallAction(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, parameters RecallActionParameters, options *ServerEndpointsClientBeginRecallActionOptions) (*http.Response, error) { var err error const operationName = "ServerEndpointsClient.BeginRecallAction" @@ -430,7 +429,7 @@ func (client *ServerEndpointsClient) recallAction(ctx context.Context, resourceG } // recallActionCreateRequest creates the RecallAction request. -func (client *ServerEndpointsClient) recallActionCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, parameters RecallActionParameters, options *ServerEndpointsClientBeginRecallActionOptions) (*policy.Request, error) { +func (client *ServerEndpointsClient) recallActionCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, parameters RecallActionParameters, _ *ServerEndpointsClientBeginRecallActionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}/recallAction" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -457,9 +456,9 @@ func (client *ServerEndpointsClient) recallActionCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-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, parameters); err != nil { return nil, err } @@ -469,21 +468,23 @@ func (client *ServerEndpointsClient) recallActionCreateRequest(ctx context.Conte // BeginUpdate - Patch a given ServerEndpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - syncGroupName - Name of Sync Group resource. // - serverEndpointName - Name of Server Endpoint object. +// - parameters - Any of the properties applicable in PUT request. // - options - ServerEndpointsClientBeginUpdateOptions contains the optional parameters for the ServerEndpointsClient.BeginUpdate // method. -func (client *ServerEndpointsClient) BeginUpdate(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, options *ServerEndpointsClientBeginUpdateOptions) (*runtime.Poller[ServerEndpointsClientUpdateResponse], error) { +func (client *ServerEndpointsClient) BeginUpdate(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, parameters ServerEndpointUpdateParameters, options *ServerEndpointsClientBeginUpdateOptions) (*runtime.Poller[ServerEndpointsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) + resp, err := client.update(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServerEndpointsClientUpdateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -496,14 +497,14 @@ func (client *ServerEndpointsClient) BeginUpdate(ctx context.Context, resourceGr // Update - Patch a given ServerEndpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 -func (client *ServerEndpointsClient) update(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, options *ServerEndpointsClientBeginUpdateOptions) (*http.Response, error) { +// Generated from API version 2022-09-01 +func (client *ServerEndpointsClient) update(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, parameters ServerEndpointUpdateParameters, options *ServerEndpointsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ServerEndpointsClient.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, storageSyncServiceName, syncGroupName, serverEndpointName, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters, options) if err != nil { return nil, err } @@ -519,7 +520,7 @@ func (client *ServerEndpointsClient) update(ctx context.Context, resourceGroupNa } // updateCreateRequest creates the Update request. -func (client *ServerEndpointsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, options *ServerEndpointsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ServerEndpointsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, parameters ServerEndpointUpdateParameters, _ *ServerEndpointsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -546,14 +547,12 @@ func (client *ServerEndpointsClient) updateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Parameters != nil { - if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { - return nil, err - } - return req, nil + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err } return req, nil } diff --git a/sdk/resourcemanager/storagesync/armstoragesync/serverendpoints_client_example_test.go b/sdk/resourcemanager/storagesync/armstoragesync/serverendpoints_client_example_test.go index 45ac39a1c4b9..f7b849c0f2ab 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/serverendpoints_client_example_test.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/serverendpoints_client_example_test.go @@ -1,28 +1,25 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for 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 armstoragesync_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/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Create.json +// Generated from example definition: 2022-09-01/ServerEndpoints_Create.json func ExampleServerEndpointsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -50,53 +47,46 @@ func ExampleServerEndpointsClient_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.ServerEndpoint = armstoragesync.ServerEndpoint{ - // Name: to.Ptr("SampleServerEndpoint_1"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups/serverEndpoints"), - // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/syncGroups/SampleSyncGroup_1/serverEndpoints/SampleServerEndpoint_1"), - // Properties: &armstoragesync.ServerEndpointProperties{ - // CloudTiering: to.Ptr(armstoragesync.FeatureStatusOff), - // FriendlyName: to.Ptr("somemachine.redmond.corp.microsoft.com"), - // InitialDownloadPolicy: to.Ptr(armstoragesync.InitialDownloadPolicyNamespaceThenModifiedFiles), - // InitialUploadPolicy: to.Ptr(armstoragesync.InitialUploadPolicyServerAuthoritative), - // LastOperationName: to.Ptr("ICreateServerEndpointWorkflow"), - // LastWorkflowID: to.Ptr("storageSyncServices/healthDemo1/workflows/569afb5c-7172-4cf8-a8ea-d987f727f11a"), - // LocalCacheMode: to.Ptr(armstoragesync.LocalCacheModeUpdateLocallyCachedFiles), - // OfflineDataTransfer: to.Ptr(armstoragesync.FeatureStatusOn), - // OfflineDataTransferShareName: to.Ptr("myfileshare"), - // OfflineDataTransferStorageAccountResourceID: to.Ptr("/subscriptions/744f4d70-6d17-4921-8970-a765d14f763f/resourceGroups/myRG/providers/Microsoft.Storage/storageAccounts/mysa"), - // OfflineDataTransferStorageAccountTenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ProvisioningState: to.Ptr("Succeeded"), - // ServerLocalPath: to.Ptr("D:\\SampleServerEndpoint_1"), - // ServerName: to.Ptr("somemachine.redmond.corp.microsoft.com"), - // ServerResourceID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/registeredServers/080d4133-bdb5-40a0-96a0-71a6057bfe9a"), - // TierFilesOlderThanDays: to.Ptr[int32](0), - // VolumeFreeSpacePercent: to.Ptr[int32](100), + // res = armstoragesync.ServerEndpointsClientCreateResponse{ + // ServerEndpoint: &armstoragesync.ServerEndpoint{ + // Name: to.Ptr("SampleServerEndpoint_1"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups/serverEndpoints"), + // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/syncGroups/SampleSyncGroup_1/serverEndpoints/SampleServerEndpoint_1"), + // Properties: &armstoragesync.ServerEndpointProperties{ + // CloudTiering: to.Ptr(armstoragesync.FeatureStatusOff), + // FriendlyName: to.Ptr("somemachine.redmond.corp.microsoft.com"), + // InitialDownloadPolicy: to.Ptr(armstoragesync.InitialDownloadPolicyNamespaceThenModifiedFiles), + // InitialUploadPolicy: to.Ptr(armstoragesync.InitialUploadPolicyServerAuthoritative), + // LastOperationName: to.Ptr("ICreateServerEndpointWorkflow"), + // LastWorkflowID: to.Ptr("storageSyncServices/healthDemo1/workflows/569afb5c-7172-4cf8-a8ea-d987f727f11a"), + // LocalCacheMode: to.Ptr(armstoragesync.LocalCacheModeUpdateLocallyCachedFiles), + // OfflineDataTransfer: to.Ptr(armstoragesync.FeatureStatusOn), + // OfflineDataTransferShareName: to.Ptr("myfileshare"), + // OfflineDataTransferStorageAccountResourceID: to.Ptr("/subscriptions/744f4d70-6d17-4921-8970-a765d14f763f/resourceGroups/myRG/providers/Microsoft.Storage/storageAccounts/mysa"), + // OfflineDataTransferStorageAccountTenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + // ProvisioningState: to.Ptr("Succeeded"), + // ServerLocalPath: to.Ptr("D:\\SampleServerEndpoint_1"), + // ServerName: to.Ptr("somemachine.redmond.corp.microsoft.com"), + // ServerResourceID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/registeredServers/080d4133-bdb5-40a0-96a0-71a6057bfe9a"), + // TierFilesOlderThanDays: to.Ptr[int32](0), + // VolumeFreeSpacePercent: to.Ptr[int32](100), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Update.json -func ExampleServerEndpointsClient_BeginUpdate() { +// Generated from example definition: 2022-09-01/ServerEndpoints_Delete.json +func ExampleServerEndpointsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewServerEndpointsClient().BeginUpdate(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "SampleSyncGroup_1", "SampleServerEndpoint_1", &armstoragesync.ServerEndpointsClientBeginUpdateOptions{Parameters: &armstoragesync.ServerEndpointUpdateParameters{ - Properties: &armstoragesync.ServerEndpointUpdateProperties{ - CloudTiering: to.Ptr(armstoragesync.FeatureStatusOff), - LocalCacheMode: to.Ptr(armstoragesync.LocalCacheModeUpdateLocallyCachedFiles), - OfflineDataTransfer: to.Ptr(armstoragesync.FeatureStatusOff), - TierFilesOlderThanDays: to.Ptr[int32](0), - VolumeFreeSpacePercent: to.Ptr[int32](100), - }, - }, - }) + poller, err := clientFactory.NewServerEndpointsClient().BeginDelete(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "SampleSyncGroup_1", "SampleServerEndpoint_1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -107,58 +97,18 @@ func ExampleServerEndpointsClient_BeginUpdate() { // 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.ServerEndpoint = armstoragesync.ServerEndpoint{ - // Name: to.Ptr("SampleServerEndpoint_1"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups/serverEndpoints"), - // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/syncGroups/SampleSyncGroup_1/serverEndpoints/SampleServerEndpoint_1"), - // Properties: &armstoragesync.ServerEndpointProperties{ - // CloudTiering: to.Ptr(armstoragesync.FeatureStatusOff), - // FriendlyName: to.Ptr("somemachine2.redmond.corp.microsoft.com"), - // InitialDownloadPolicy: to.Ptr(armstoragesync.InitialDownloadPolicyNamespaceThenModifiedFiles), - // InitialUploadPolicy: to.Ptr(armstoragesync.InitialUploadPolicyMerge), - // LastOperationName: to.Ptr("ICreateServerEndpointWorkflow"), - // LastWorkflowID: to.Ptr("storageSyncServices/healthDemo1/workflows/569afb5c-7172-4cf8-a8ea-d987f727f11b"), - // LocalCacheMode: to.Ptr(armstoragesync.LocalCacheModeUpdateLocallyCachedFiles), - // OfflineDataTransfer: to.Ptr(armstoragesync.FeatureStatusOff), - // OfflineDataTransferShareName: to.Ptr("myfileshare"), - // OfflineDataTransferStorageAccountResourceID: to.Ptr("/subscriptions/744f4d70-6d17-4921-8970-a765d14f763f/resourceGroups/myRG/providers/Microsoft.Storage/storageAccounts/mysa"), - // OfflineDataTransferStorageAccountTenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ProvisioningState: to.Ptr("Succeeded"), - // ServerLocalPath: to.Ptr("C:\\data_quota2"), - // ServerName: to.Ptr("somemachine2.redmond.corp.microsoft.com"), - // ServerResourceID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/anpintDemoRG/providers/kailanitest07.one.microsoft.com/storageSyncServices/healthdemo1/registeredServers/f94e2944-b48d-4e5b-bdc7-c48ab3712659"), - // SyncStatus: &armstoragesync.ServerEndpointSyncStatus{ - // CombinedHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateError), - // DownloadHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateHealthy), - // DownloadStatus: &armstoragesync.ServerEndpointSyncSessionStatus{ - // LastSyncPerItemErrorCount: to.Ptr[int64](0), - // LastSyncResult: to.Ptr[int32](0), - // LastSyncSuccessTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:28:33.921Z"); return t}()), - // LastSyncTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:28:33.921Z"); return t}()), - // }, - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.105Z"); return t}()), - // OfflineDataTransferStatus: to.Ptr(armstoragesync.ServerEndpointOfflineDataTransferStateStopping), - // UploadHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateError), - // UploadStatus: &armstoragesync.ServerEndpointSyncSessionStatus{ - // LastSyncPerItemErrorCount: to.Ptr[int64](0), - // LastSyncResult: to.Ptr[int32](-2134351810), - // LastSyncTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.105Z"); return t}()), - // }, - // }, - // TierFilesOlderThanDays: to.Ptr[int32](0), - // VolumeFreeSpacePercent: to.Ptr[int32](20), - // }, + // res = armstoragesync.ServerEndpointsClientDeleteResponse{ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Get.json +// Generated from example definition: 2022-09-01/ServerEndpoints_Get.json func ExampleServerEndpointsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -169,160 +119,207 @@ func ExampleServerEndpointsClient_Get() { // 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.ServerEndpoint = armstoragesync.ServerEndpoint{ - // Name: to.Ptr("SampleServerEndpoint_1"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups/serverEndpoints"), - // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/syncGroups/SampleSyncGroup_1/serverEndpoints/SampleServerEndpoint_1"), - // Properties: &armstoragesync.ServerEndpointProperties{ - // CloudTiering: to.Ptr(armstoragesync.FeatureStatusOn), - // CloudTieringStatus: &armstoragesync.ServerEndpointCloudTieringStatus{ - // CachePerformance: &armstoragesync.CloudTieringCachePerformance{ - // CacheHitBytes: to.Ptr[int64](922337203685477600), - // CacheHitBytesPercent: to.Ptr[int32](50), - // CacheMissBytes: to.Ptr[int64](922337203685477600), - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.195Z"); return t}()), - // }, - // DatePolicyStatus: &armstoragesync.CloudTieringDatePolicyStatus{ - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.195Z"); return t}()), - // TieredFilesMostRecentAccessTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.195Z"); return t}()), + // res = armstoragesync.ServerEndpointsClientGetResponse{ + // CorrelationRequestID: "d166ca76-dad2-49df-b409-d2acfd42d730" + // RequestID: "74e55a4d-1c6f-46de-9a8d-278e53a47403" + // ServerEndpoint: &armstoragesync.ServerEndpoint{ + // Name: to.Ptr("SampleServerEndpoint_1"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups/serverEndpoints"), + // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/syncGroups/SampleSyncGroup_1/serverEndpoints/SampleServerEndpoint_1"), + // Properties: &armstoragesync.ServerEndpointProperties{ + // CloudTiering: to.Ptr(armstoragesync.FeatureStatusOn), + // CloudTieringStatus: &armstoragesync.ServerEndpointCloudTieringStatus{ + // CachePerformance: &armstoragesync.CloudTieringCachePerformance{ + // CacheHitBytes: to.Ptr[int64](922337203685477600), + // CacheHitBytesPercent: to.Ptr[int32](50), + // CacheMissBytes: to.Ptr[int64](922337203685477600), + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // }, + // DatePolicyStatus: &armstoragesync.CloudTieringDatePolicyStatus{ + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // TieredFilesMostRecentAccessTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // }, + // FilesNotTiering: &armstoragesync.CloudTieringFilesNotTiering{ + // Errors: []*armstoragesync.FilesNotTieringError{ + // { + // ErrorCode: to.Ptr[int32](-2134347771), + // FileCount: to.Ptr[int64](10), + // }, + // { + // ErrorCode: to.Ptr[int32](-2134347770), + // FileCount: to.Ptr[int64](20), + // }, + // { + // ErrorCode: to.Ptr[int32](-2134347769), + // FileCount: to.Ptr[int64](30), + // }, + // }, + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // TotalFileCount: to.Ptr[int64](60), + // }, + // Health: to.Ptr(armstoragesync.ServerEndpointHealthStateError), + // HealthLastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.1057915Z"); return t}()), + // LastCloudTieringResult: to.Ptr[int32](-2134347771), + // LastSuccessTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.1057915Z"); return t}()), + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.1057915Z"); return t}()), + // LowDiskMode: &armstoragesync.CloudTieringLowDiskMode{ + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // State: to.Ptr(armstoragesync.CloudTieringLowDiskModeStateDisabled), + // }, + // SpaceSavings: &armstoragesync.CloudTieringSpaceSavings{ + // CachedSizeBytes: to.Ptr[int64](50000000), + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // SpaceSavingsBytes: to.Ptr[int64](50000000), + // SpaceSavingsPercent: to.Ptr[int32](50), + // TotalSizeCloudBytes: to.Ptr[int64](100000000), + // VolumeSizeBytes: to.Ptr[int64](922337203685477600), + // }, + // VolumeFreeSpacePolicyStatus: &armstoragesync.CloudTieringVolumeFreeSpacePolicyStatus{ + // CurrentVolumeFreeSpacePercent: to.Ptr[int32](5), + // EffectiveVolumeFreeSpacePolicy: to.Ptr[int32](30), + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // }, // }, - // FilesNotTiering: &armstoragesync.CloudTieringFilesNotTiering{ - // Errors: []*armstoragesync.FilesNotTieringError{ + // FriendlyName: to.Ptr("somemachine.redmond.corp.microsoft.com"), + // InitialDownloadPolicy: to.Ptr(armstoragesync.InitialDownloadPolicyNamespaceThenModifiedFiles), + // InitialUploadPolicy: to.Ptr(armstoragesync.InitialUploadPolicyMerge), + // LastOperationName: to.Ptr("ICreateServerEndpointWorkflow"), + // LastWorkflowID: to.Ptr("storageSyncServices/healthDemo1/workflows/569afb5c-7172-4cf8-a8ea-d987f727f11a"), + // LocalCacheMode: to.Ptr(armstoragesync.LocalCacheModeUpdateLocallyCachedFiles), + // OfflineDataTransfer: to.Ptr(armstoragesync.FeatureStatusOn), + // OfflineDataTransferShareName: to.Ptr("myfileshare"), + // OfflineDataTransferStorageAccountResourceID: to.Ptr("/subscriptions/744f4d70-6d17-4921-8970-a765d14f763f/resourceGroups/myRG/providers/Microsoft.Storage/storageAccounts/mysa"), + // OfflineDataTransferStorageAccountTenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + // ProvisioningState: to.Ptr("Succeeded"), + // RecallStatus: &armstoragesync.ServerEndpointRecallStatus{ + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.1057915Z"); return t}()), + // RecallErrors: []*armstoragesync.ServerEndpointRecallError{ // { - // ErrorCode: to.Ptr[int32](-2134347771), - // FileCount: to.Ptr[int64](10), + // Count: to.Ptr[int64](5), + // ErrorCode: to.Ptr[int32](-2134347775), // }, // { - // ErrorCode: to.Ptr[int32](-2134347770), - // FileCount: to.Ptr[int64](20), + // Count: to.Ptr[int64](10), + // ErrorCode: to.Ptr[int32](-2134347774), // }, // { - // ErrorCode: to.Ptr[int32](-2134347769), - // FileCount: to.Ptr[int64](30), - // }}, - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.195Z"); return t}()), - // TotalFileCount: to.Ptr[int64](60), - // }, - // Health: to.Ptr(armstoragesync.ServerEndpointHealthStateError), - // HealthLastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.105Z"); return t}()), - // LastCloudTieringResult: to.Ptr[int32](-2134347771), - // LastSuccessTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.105Z"); return t}()), - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.105Z"); return t}()), - // SpaceSavings: &armstoragesync.CloudTieringSpaceSavings{ - // CachedSizeBytes: to.Ptr[int64](50000000), - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.195Z"); return t}()), - // SpaceSavingsBytes: to.Ptr[int64](50000000), - // SpaceSavingsPercent: to.Ptr[int32](50), - // TotalSizeCloudBytes: to.Ptr[int64](100000000), - // VolumeSizeBytes: to.Ptr[int64](922337203685477600), + // Count: to.Ptr[int64](15), + // ErrorCode: to.Ptr[int32](-2134347773), + // }, + // }, + // TotalRecallErrorsCount: to.Ptr[int64](30), // }, - // VolumeFreeSpacePolicyStatus: &armstoragesync.CloudTieringVolumeFreeSpacePolicyStatus{ - // CurrentVolumeFreeSpacePercent: to.Ptr[int32](5), - // EffectiveVolumeFreeSpacePolicy: to.Ptr[int32](30), - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.195Z"); return t}()), + // ServerEndpointProvisioningStatus: &armstoragesync.ServerEndpointProvisioningStatus{ + // ProvisioningStatus: to.Ptr(armstoragesync.ServerProvisioningStatusReadySyncFunctional), + // ProvisioningStepStatuses: []*armstoragesync.ServerEndpointProvisioningStepStatus{ + // { + // Name: to.Ptr("ManifestGeneration"), + // AdditionalInformation: map[string]*string{ + // "ItemsProcessed": to.Ptr("1001"), + // "ItemsRemaining": to.Ptr("0"), + // }, + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:06:59.1959227Z"); return t}()), + // ErrorCode: to.Ptr[int32](0), + // MinutesLeft: to.Ptr[int32](0), + // ProgressPercentage: to.Ptr[int32](100), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // Status: to.Ptr("Completed"), + // }, + // { + // Name: to.Ptr("ManifestConsumption"), + // AdditionalInformation: map[string]*string{ + // "ItemsProcessed": to.Ptr("1001"), + // "ItemsRemaining": to.Ptr("0"), + // }, + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:06:59.1959227Z"); return t}()), + // ErrorCode: to.Ptr[int32](0), + // MinutesLeft: to.Ptr[int32](0), + // ProgressPercentage: to.Ptr[int32](100), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // Status: to.Ptr("Completed"), + // }, + // { + // Name: to.Ptr("NamespaceApply"), + // AdditionalInformation: map[string]*string{ + // "ItemsProcessed": to.Ptr("1001"), + // "ItemsRemaining": to.Ptr("0"), + // }, + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:06:59.1959227Z"); return t}()), + // ErrorCode: to.Ptr[int32](0), + // MinutesLeft: to.Ptr[int32](0), + // ProgressPercentage: to.Ptr[int32](100), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // Status: to.Ptr("Completed"), + // }, + // { + // Name: to.Ptr("PrepareForSync"), + // AdditionalInformation: map[string]*string{ + // "ItemsProcessed": to.Ptr("1001"), + // "ItemsRemaining": to.Ptr("0"), + // }, + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-17T19:08:59.1959227Z"); return t}()), + // ErrorCode: to.Ptr[int32](0), + // MinutesLeft: to.Ptr[int32](0), + // ProgressPercentage: to.Ptr[int32](100), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-17T19:06:59.1959227Z"); return t}()), + // Status: to.Ptr("Completed"), + // }, + // }, + // ProvisioningType: to.Ptr("FastDRv2"), // }, - // }, - // FriendlyName: to.Ptr("somemachine.redmond.corp.microsoft.com"), - // InitialDownloadPolicy: to.Ptr(armstoragesync.InitialDownloadPolicyNamespaceThenModifiedFiles), - // InitialUploadPolicy: to.Ptr(armstoragesync.InitialUploadPolicyMerge), - // LastOperationName: to.Ptr("ICreateServerEndpointWorkflow"), - // LastWorkflowID: to.Ptr("storageSyncServices/healthDemo1/workflows/569afb5c-7172-4cf8-a8ea-d987f727f11a"), - // LocalCacheMode: to.Ptr(armstoragesync.LocalCacheModeUpdateLocallyCachedFiles), - // OfflineDataTransfer: to.Ptr(armstoragesync.FeatureStatusOn), - // OfflineDataTransferShareName: to.Ptr("myfileshare"), - // OfflineDataTransferStorageAccountResourceID: to.Ptr("/subscriptions/744f4d70-6d17-4921-8970-a765d14f763f/resourceGroups/myRG/providers/Microsoft.Storage/storageAccounts/mysa"), - // OfflineDataTransferStorageAccountTenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ProvisioningState: to.Ptr("Succeeded"), - // RecallStatus: &armstoragesync.ServerEndpointRecallStatus{ - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.105Z"); return t}()), - // RecallErrors: []*armstoragesync.ServerEndpointRecallError{ - // { - // Count: to.Ptr[int64](5), - // ErrorCode: to.Ptr[int32](-2134347775), + // ServerLocalPath: to.Ptr("D:\\SampleServerEndpoint_1"), + // ServerName: to.Ptr("somemachine.redmond.corp.microsoft.com"), + // ServerResourceID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/registeredServers/080d4133-bdb5-40a0-96a0-71a6057bfe9a"), + // SyncStatus: &armstoragesync.ServerEndpointSyncStatus{ + // CombinedHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateError), + // DownloadActivity: &armstoragesync.ServerEndpointSyncActivityStatus{ + // AppliedBytes: to.Ptr[int64](94805587), + // AppliedItemCount: to.Ptr[int64](100), + // PerItemErrorCount: to.Ptr[int64](0), + // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.1057915Z"); return t}()), + // TotalBytes: to.Ptr[int64](19583674), + // TotalItemCount: to.Ptr[int64](300), // }, - // { - // Count: to.Ptr[int64](10), - // ErrorCode: to.Ptr[int32](-2134347774), + // DownloadHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateHealthy), + // DownloadStatus: &armstoragesync.ServerEndpointSyncSessionStatus{ + // LastSyncPerItemErrorCount: to.Ptr[int64](0), + // LastSyncResult: to.Ptr[int32](0), + // LastSyncSuccessTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:28:33.9217334Z"); return t}()), + // LastSyncTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:28:33.9217334Z"); return t}()), + // }, + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.1057915Z"); return t}()), + // OfflineDataTransferStatus: to.Ptr(armstoragesync.ServerEndpointOfflineDataTransferStateInProgress), + // SyncActivity: to.Ptr(armstoragesync.ServerEndpointSyncActivityStateUploadAndDownload), + // UploadActivity: &armstoragesync.ServerEndpointSyncActivityStatus{ + // AppliedBytes: to.Ptr[int64](57348983), + // AppliedItemCount: to.Ptr[int64](1000), + // PerItemErrorCount: to.Ptr[int64](300), + // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.1057915Z"); return t}()), + // TotalBytes: to.Ptr[int64](1958367412), + // TotalItemCount: to.Ptr[int64](2300), + // }, + // UploadHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateError), + // UploadStatus: &armstoragesync.ServerEndpointSyncSessionStatus{ + // LastSyncPerItemErrorCount: to.Ptr[int64](1000), + // LastSyncResult: to.Ptr[int32](-2134351810), + // LastSyncTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.1057915Z"); return t}()), // }, - // { - // Count: to.Ptr[int64](15), - // ErrorCode: to.Ptr[int32](-2134347773), - // }}, - // TotalRecallErrorsCount: to.Ptr[int64](30), - // }, - // ServerLocalPath: to.Ptr("D:\\SampleServerEndpoint_1"), - // ServerName: to.Ptr("somemachine.redmond.corp.microsoft.com"), - // ServerResourceID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/registeredServers/080d4133-bdb5-40a0-96a0-71a6057bfe9a"), - // SyncStatus: &armstoragesync.ServerEndpointSyncStatus{ - // CombinedHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateError), - // DownloadActivity: &armstoragesync.ServerEndpointSyncActivityStatus{ - // AppliedBytes: to.Ptr[int64](94805587), - // AppliedItemCount: to.Ptr[int64](100), - // PerItemErrorCount: to.Ptr[int64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.105Z"); return t}()), - // TotalBytes: to.Ptr[int64](19583674), - // TotalItemCount: to.Ptr[int64](300), - // }, - // DownloadHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateHealthy), - // DownloadStatus: &armstoragesync.ServerEndpointSyncSessionStatus{ - // LastSyncPerItemErrorCount: to.Ptr[int64](0), - // LastSyncResult: to.Ptr[int32](0), - // LastSyncSuccessTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:28:33.921Z"); return t}()), - // LastSyncTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:28:33.921Z"); return t}()), - // }, - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.105Z"); return t}()), - // OfflineDataTransferStatus: to.Ptr(armstoragesync.ServerEndpointOfflineDataTransferStateInProgress), - // SyncActivity: to.Ptr(armstoragesync.ServerEndpointSyncActivityStateUploadAndDownload), - // UploadActivity: &armstoragesync.ServerEndpointSyncActivityStatus{ - // AppliedBytes: to.Ptr[int64](57348983), - // AppliedItemCount: to.Ptr[int64](1000), - // PerItemErrorCount: to.Ptr[int64](300), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.105Z"); return t}()), - // TotalBytes: to.Ptr[int64](1958367412), - // TotalItemCount: to.Ptr[int64](2300), - // }, - // UploadHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateError), - // UploadStatus: &armstoragesync.ServerEndpointSyncSessionStatus{ - // LastSyncPerItemErrorCount: to.Ptr[int64](1000), - // LastSyncResult: to.Ptr[int32](-2134351810), - // LastSyncTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.105Z"); return t}()), // }, + // TierFilesOlderThanDays: to.Ptr[int32](0), + // VolumeFreeSpacePercent: to.Ptr[int32](100), // }, - // TierFilesOlderThanDays: to.Ptr[int32](0), - // VolumeFreeSpacePercent: to.Ptr[int32](100), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Delete.json -func ExampleServerEndpointsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerEndpointsClient().BeginDelete(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "SampleSyncGroup_1", "SampleServerEndpoint_1", 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/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_ListBySyncGroup.json +// Generated from example definition: 2022-09-01/ServerEndpoints_ListBySyncGroup.json func ExampleServerEndpointsClient_NewListBySyncGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -337,176 +334,303 @@ func ExampleServerEndpointsClient_NewListBySyncGroupPager() { _ = 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.ServerEndpointArray = armstoragesync.ServerEndpointArray{ - // Value: []*armstoragesync.ServerEndpoint{ - // { - // Name: to.Ptr("SampleServerEndpoint_1"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups/serverEndpoints"), - // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/syncGroups/SampleSyncGroup_1/serverEndpoints/SampleServerEndpoint_1"), - // Properties: &armstoragesync.ServerEndpointProperties{ - // CloudTiering: to.Ptr(armstoragesync.FeatureStatusOff), - // FriendlyName: to.Ptr("somemachine.redmond.corp.microsoft.com"), - // InitialDownloadPolicy: to.Ptr(armstoragesync.InitialDownloadPolicyNamespaceThenModifiedFiles), - // InitialUploadPolicy: to.Ptr(armstoragesync.InitialUploadPolicyMerge), - // LastOperationName: to.Ptr("ICreateServerEndpointWorkflow"), - // LastWorkflowID: to.Ptr("storageSyncServices/healthDemo1/workflows/569afb5c-7172-4cf8-a8ea-d987f727f11a"), - // LocalCacheMode: to.Ptr(armstoragesync.LocalCacheModeUpdateLocallyCachedFiles), - // OfflineDataTransfer: to.Ptr(armstoragesync.FeatureStatusOn), - // OfflineDataTransferShareName: to.Ptr("myfileshare"), - // OfflineDataTransferStorageAccountResourceID: to.Ptr("/subscriptions/744f4d70-6d17-4921-8970-a765d14f763f/resourceGroups/myRG/providers/Microsoft.Storage/storageAccounts/mysa"), - // OfflineDataTransferStorageAccountTenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ProvisioningState: to.Ptr("Succeeded"), - // ServerLocalPath: to.Ptr("D:\\SampleServerEndpoint_1"), - // ServerName: to.Ptr("somemachine.redmond.corp.microsoft.com"), - // ServerResourceID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/registeredServers/080d4133-bdb5-40a0-96a0-71a6057bfe9a"), - // SyncStatus: &armstoragesync.ServerEndpointSyncStatus{ - // CombinedHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateError), - // DownloadHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateHealthy), - // DownloadStatus: &armstoragesync.ServerEndpointSyncSessionStatus{ - // LastSyncPerItemErrorCount: to.Ptr[int64](1000), - // LastSyncResult: to.Ptr[int32](0), - // LastSyncSuccessTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:28:33.921Z"); return t}()), - // LastSyncTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:28:33.921Z"); return t}()), + // page = armstoragesync.ServerEndpointsClientListBySyncGroupResponse{ + // CorrelationRequestID: "d166ca76-dad2-49df-b409-d2acfd42d730" + // RequestID: "74e55a4d-1c6f-46de-9a8d-278e53a47403" + // ServerEndpointArray: armstoragesync.ServerEndpointArray{ + // Value: []*armstoragesync.ServerEndpoint{ + // { + // Name: to.Ptr("SampleServerEndpoint_1"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups/serverEndpoints"), + // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/syncGroups/SampleSyncGroup_1/serverEndpoints/SampleServerEndpoint_1"), + // Properties: &armstoragesync.ServerEndpointProperties{ + // CloudTiering: to.Ptr(armstoragesync.FeatureStatusOff), + // FriendlyName: to.Ptr("somemachine.redmond.corp.microsoft.com"), + // InitialDownloadPolicy: to.Ptr(armstoragesync.InitialDownloadPolicyNamespaceThenModifiedFiles), + // InitialUploadPolicy: to.Ptr(armstoragesync.InitialUploadPolicyMerge), + // LastOperationName: to.Ptr("ICreateServerEndpointWorkflow"), + // LastWorkflowID: to.Ptr("storageSyncServices/healthDemo1/workflows/569afb5c-7172-4cf8-a8ea-d987f727f11a"), + // LocalCacheMode: to.Ptr(armstoragesync.LocalCacheModeUpdateLocallyCachedFiles), + // OfflineDataTransfer: to.Ptr(armstoragesync.FeatureStatusOn), + // OfflineDataTransferShareName: to.Ptr("myfileshare"), + // OfflineDataTransferStorageAccountResourceID: to.Ptr("/subscriptions/744f4d70-6d17-4921-8970-a765d14f763f/resourceGroups/myRG/providers/Microsoft.Storage/storageAccounts/mysa"), + // OfflineDataTransferStorageAccountTenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + // ProvisioningState: to.Ptr("Succeeded"), + // ServerEndpointProvisioningStatus: &armstoragesync.ServerEndpointProvisioningStatus{ + // ProvisioningStatus: to.Ptr(armstoragesync.ServerProvisioningStatusReadySyncFunctional), + // ProvisioningStepStatuses: []*armstoragesync.ServerEndpointProvisioningStepStatus{ + // { + // Name: to.Ptr("ManifestGeneration"), + // AdditionalInformation: map[string]*string{ + // "ItemsProcessed": to.Ptr("1001"), + // "ItemsRemaining": to.Ptr("0"), + // }, + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:06:59.1959227Z"); return t}()), + // ErrorCode: to.Ptr[int32](0), + // MinutesLeft: to.Ptr[int32](0), + // ProgressPercentage: to.Ptr[int32](100), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // Status: to.Ptr("Completed"), + // }, + // { + // Name: to.Ptr("ManifestConsumption"), + // AdditionalInformation: map[string]*string{ + // "ItemsProcessed": to.Ptr("1001"), + // "ItemsRemaining": to.Ptr("0"), + // }, + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:06:59.1959227Z"); return t}()), + // ErrorCode: to.Ptr[int32](0), + // MinutesLeft: to.Ptr[int32](0), + // ProgressPercentage: to.Ptr[int32](100), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // Status: to.Ptr("Completed"), + // }, + // { + // Name: to.Ptr("NamespaceApply"), + // AdditionalInformation: map[string]*string{ + // "ItemsProcessed": to.Ptr("1001"), + // "ItemsRemaining": to.Ptr("0"), + // }, + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:06:59.1959227Z"); return t}()), + // ErrorCode: to.Ptr[int32](0), + // MinutesLeft: to.Ptr[int32](0), + // ProgressPercentage: to.Ptr[int32](100), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // Status: to.Ptr("Completed"), + // }, + // { + // Name: to.Ptr("PrepareForSync"), + // AdditionalInformation: map[string]*string{ + // "ItemsProcessed": to.Ptr("1001"), + // "ItemsRemaining": to.Ptr("0"), + // }, + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:06:59.1959227Z"); return t}()), + // ErrorCode: to.Ptr[int32](0), + // MinutesLeft: to.Ptr[int32](0), + // ProgressPercentage: to.Ptr[int32](100), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-17T19:04:59.1959227Z"); return t}()), + // Status: to.Ptr("Completed"), + // }, + // }, + // ProvisioningType: to.Ptr("FastDRv2"), // }, - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.105Z"); return t}()), - // OfflineDataTransferStatus: to.Ptr(armstoragesync.ServerEndpointOfflineDataTransferStateComplete), - // UploadHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateError), - // UploadStatus: &armstoragesync.ServerEndpointSyncSessionStatus{ - // LastSyncPerItemErrorCount: to.Ptr[int64](0), - // LastSyncResult: to.Ptr[int32](0), - // LastSyncSuccessTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.105Z"); return t}()), - // LastSyncTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.105Z"); return t}()), + // ServerLocalPath: to.Ptr("D:\\SampleServerEndpoint_1"), + // ServerName: to.Ptr("somemachine.redmond.corp.microsoft.com"), + // ServerResourceID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/registeredServers/080d4133-bdb5-40a0-96a0-71a6057bfe9a"), + // SyncStatus: &armstoragesync.ServerEndpointSyncStatus{ + // CombinedHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateError), + // DownloadHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateHealthy), + // DownloadStatus: &armstoragesync.ServerEndpointSyncSessionStatus{ + // LastSyncPerItemErrorCount: to.Ptr[int64](1000), + // LastSyncResult: to.Ptr[int32](0), + // LastSyncSuccessTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:28:33.9217334Z"); return t}()), + // LastSyncTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:28:33.9217334Z"); return t}()), + // }, + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.1057915Z"); return t}()), + // OfflineDataTransferStatus: to.Ptr(armstoragesync.ServerEndpointOfflineDataTransferStateComplete), + // UploadHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateError), + // UploadStatus: &armstoragesync.ServerEndpointSyncSessionStatus{ + // LastSyncPerItemErrorCount: to.Ptr[int64](0), + // LastSyncResult: to.Ptr[int32](0), + // LastSyncSuccessTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.1057915Z"); return t}()), + // LastSyncTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.1057915Z"); return t}()), + // }, // }, + // TierFilesOlderThanDays: to.Ptr[int32](0), + // VolumeFreeSpacePercent: to.Ptr[int32](100), // }, - // TierFilesOlderThanDays: to.Ptr[int32](0), - // VolumeFreeSpacePercent: to.Ptr[int32](100), // }, - // }, - // { - // Name: to.Ptr("SampleServerEndpoint_2"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups/serverEndpoints"), - // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/syncGroups/SampleSyncGroup_1/serverEndpoints/SampleServerEndpoint_2"), - // Properties: &armstoragesync.ServerEndpointProperties{ - // CloudTiering: to.Ptr(armstoragesync.FeatureStatusOn), - // CloudTieringStatus: &armstoragesync.ServerEndpointCloudTieringStatus{ - // CachePerformance: &armstoragesync.CloudTieringCachePerformance{ - // CacheHitBytes: to.Ptr[int64](922337203685477600), - // CacheHitBytesPercent: to.Ptr[int32](50), - // CacheMissBytes: to.Ptr[int64](922337203685477600), - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.195Z"); return t}()), - // }, - // DatePolicyStatus: &armstoragesync.CloudTieringDatePolicyStatus{ - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.195Z"); return t}()), - // TieredFilesMostRecentAccessTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.195Z"); return t}()), + // { + // Name: to.Ptr("SampleServerEndpoint_2"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups/serverEndpoints"), + // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/syncGroups/SampleSyncGroup_1/serverEndpoints/SampleServerEndpoint_2"), + // Properties: &armstoragesync.ServerEndpointProperties{ + // CloudTiering: to.Ptr(armstoragesync.FeatureStatusOn), + // CloudTieringStatus: &armstoragesync.ServerEndpointCloudTieringStatus{ + // CachePerformance: &armstoragesync.CloudTieringCachePerformance{ + // CacheHitBytes: to.Ptr[int64](922337203685477600), + // CacheHitBytesPercent: to.Ptr[int32](50), + // CacheMissBytes: to.Ptr[int64](922337203685477600), + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // }, + // DatePolicyStatus: &armstoragesync.CloudTieringDatePolicyStatus{ + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // TieredFilesMostRecentAccessTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // }, + // FilesNotTiering: &armstoragesync.CloudTieringFilesNotTiering{ + // Errors: []*armstoragesync.FilesNotTieringError{ + // { + // ErrorCode: to.Ptr[int32](-2134347771), + // FileCount: to.Ptr[int64](10), + // }, + // { + // ErrorCode: to.Ptr[int32](-2134347770), + // FileCount: to.Ptr[int64](20), + // }, + // { + // ErrorCode: to.Ptr[int32](-2134347769), + // FileCount: to.Ptr[int64](30), + // }, + // }, + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // TotalFileCount: to.Ptr[int64](60), + // }, + // Health: to.Ptr(armstoragesync.ServerEndpointHealthStateError), + // HealthLastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.1057915Z"); return t}()), + // LastCloudTieringResult: to.Ptr[int32](-2134347771), + // LastSuccessTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.1057915Z"); return t}()), + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.1057915Z"); return t}()), + // LowDiskMode: &armstoragesync.CloudTieringLowDiskMode{ + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // State: to.Ptr(armstoragesync.CloudTieringLowDiskModeStateDisabled), + // }, + // SpaceSavings: &armstoragesync.CloudTieringSpaceSavings{ + // CachedSizeBytes: to.Ptr[int64](50000000), + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // SpaceSavingsBytes: to.Ptr[int64](50000000), + // SpaceSavingsPercent: to.Ptr[int32](50), + // TotalSizeCloudBytes: to.Ptr[int64](100000000), + // VolumeSizeBytes: to.Ptr[int64](922337203685477600), + // }, + // VolumeFreeSpacePolicyStatus: &armstoragesync.CloudTieringVolumeFreeSpacePolicyStatus{ + // CurrentVolumeFreeSpacePercent: to.Ptr[int32](5), + // EffectiveVolumeFreeSpacePolicy: to.Ptr[int32](30), + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // }, // }, - // FilesNotTiering: &armstoragesync.CloudTieringFilesNotTiering{ - // Errors: []*armstoragesync.FilesNotTieringError{ + // FriendlyName: to.Ptr("somemachine2.redmond.corp.microsoft.com"), + // InitialDownloadPolicy: to.Ptr(armstoragesync.InitialDownloadPolicyNamespaceThenModifiedFiles), + // InitialUploadPolicy: to.Ptr(armstoragesync.InitialUploadPolicyMerge), + // LastOperationName: to.Ptr("ICreateServerEndpointWorkflow"), + // LastWorkflowID: to.Ptr("storageSyncServices/healthDemo1/workflows/40b1dc00-d7d9-4721-a1e9-ab60139b830a"), + // LocalCacheMode: to.Ptr(armstoragesync.LocalCacheModeUpdateLocallyCachedFiles), + // OfflineDataTransfer: to.Ptr(armstoragesync.FeatureStatusOff), + // ProvisioningState: to.Ptr("Succeeded"), + // RecallStatus: &armstoragesync.ServerEndpointRecallStatus{ + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.1057915Z"); return t}()), + // RecallErrors: []*armstoragesync.ServerEndpointRecallError{ // { - // ErrorCode: to.Ptr[int32](-2134347771), - // FileCount: to.Ptr[int64](10), + // Count: to.Ptr[int64](5), + // ErrorCode: to.Ptr[int32](-2134347775), // }, // { - // ErrorCode: to.Ptr[int32](-2134347770), - // FileCount: to.Ptr[int64](20), + // Count: to.Ptr[int64](10), + // ErrorCode: to.Ptr[int32](-2134347774), // }, // { - // ErrorCode: to.Ptr[int32](-2134347769), - // FileCount: to.Ptr[int64](30), - // }}, - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.195Z"); return t}()), - // TotalFileCount: to.Ptr[int64](60), - // }, - // Health: to.Ptr(armstoragesync.ServerEndpointHealthStateError), - // HealthLastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.105Z"); return t}()), - // LastCloudTieringResult: to.Ptr[int32](-2134347771), - // LastSuccessTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.105Z"); return t}()), - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.105Z"); return t}()), - // SpaceSavings: &armstoragesync.CloudTieringSpaceSavings{ - // CachedSizeBytes: to.Ptr[int64](50000000), - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.195Z"); return t}()), - // SpaceSavingsBytes: to.Ptr[int64](50000000), - // SpaceSavingsPercent: to.Ptr[int32](50), - // TotalSizeCloudBytes: to.Ptr[int64](100000000), - // VolumeSizeBytes: to.Ptr[int64](922337203685477600), + // Count: to.Ptr[int64](15), + // ErrorCode: to.Ptr[int32](-2134347773), + // }, + // }, + // TotalRecallErrorsCount: to.Ptr[int64](30), // }, - // VolumeFreeSpacePolicyStatus: &armstoragesync.CloudTieringVolumeFreeSpacePolicyStatus{ - // CurrentVolumeFreeSpacePercent: to.Ptr[int32](5), - // EffectiveVolumeFreeSpacePolicy: to.Ptr[int32](30), - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.195Z"); return t}()), + // ServerEndpointProvisioningStatus: &armstoragesync.ServerEndpointProvisioningStatus{ + // ProvisioningStatus: to.Ptr(armstoragesync.ServerProvisioningStatusReadySyncFunctional), + // ProvisioningStepStatuses: []*armstoragesync.ServerEndpointProvisioningStepStatus{ + // { + // Name: to.Ptr("ManifestGeneration"), + // AdditionalInformation: map[string]*string{ + // "ItemsProcessed": to.Ptr("1001"), + // "ItemsRemaining": to.Ptr("0"), + // }, + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:06:59.1959227Z"); return t}()), + // ErrorCode: to.Ptr[int32](0), + // MinutesLeft: to.Ptr[int32](0), + // ProgressPercentage: to.Ptr[int32](100), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // Status: to.Ptr("Completed"), + // }, + // { + // Name: to.Ptr("ManifestConsumption"), + // AdditionalInformation: map[string]*string{ + // "ItemsProcessed": to.Ptr("1001"), + // "ItemsRemaining": to.Ptr("0"), + // }, + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:06:59.1959227Z"); return t}()), + // ErrorCode: to.Ptr[int32](0), + // MinutesLeft: to.Ptr[int32](0), + // ProgressPercentage: to.Ptr[int32](100), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // Status: to.Ptr("Completed"), + // }, + // { + // Name: to.Ptr("NamespaceApply"), + // AdditionalInformation: map[string]*string{ + // "ItemsProcessed": to.Ptr("1001"), + // "ItemsRemaining": to.Ptr("0"), + // }, + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:06:59.1959227Z"); return t}()), + // ErrorCode: to.Ptr[int32](0), + // MinutesLeft: to.Ptr[int32](0), + // ProgressPercentage: to.Ptr[int32](100), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // Status: to.Ptr("Completed"), + // }, + // { + // Name: to.Ptr("PrepareForSync"), + // AdditionalInformation: map[string]*string{ + // "ItemsProcessed": to.Ptr("1001"), + // "ItemsRemaining": to.Ptr("0"), + // }, + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:06:59.1959227Z"); return t}()), + // ErrorCode: to.Ptr[int32](0), + // MinutesLeft: to.Ptr[int32](0), + // ProgressPercentage: to.Ptr[int32](100), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-17T19:04:59.1959227Z"); return t}()), + // Status: to.Ptr("Completed"), + // }, + // }, + // ProvisioningType: to.Ptr("FastDRv2"), // }, - // }, - // FriendlyName: to.Ptr("somemachine2.redmond.corp.microsoft.com"), - // InitialDownloadPolicy: to.Ptr(armstoragesync.InitialDownloadPolicyNamespaceThenModifiedFiles), - // InitialUploadPolicy: to.Ptr(armstoragesync.InitialUploadPolicyMerge), - // LastOperationName: to.Ptr("ICreateServerEndpointWorkflow"), - // LastWorkflowID: to.Ptr("storageSyncServices/healthDemo1/workflows/40b1dc00-d7d9-4721-a1e9-ab60139b830a"), - // LocalCacheMode: to.Ptr(armstoragesync.LocalCacheModeUpdateLocallyCachedFiles), - // OfflineDataTransfer: to.Ptr(armstoragesync.FeatureStatusOff), - // ProvisioningState: to.Ptr("Succeeded"), - // RecallStatus: &armstoragesync.ServerEndpointRecallStatus{ - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.105Z"); return t}()), - // RecallErrors: []*armstoragesync.ServerEndpointRecallError{ - // { - // Count: to.Ptr[int64](5), - // ErrorCode: to.Ptr[int32](-2134347775), + // ServerLocalPath: to.Ptr("D:\\SampleServerEndpoint_2"), + // ServerName: to.Ptr("somemachine2.redmond.corp.microsoft.com"), + // ServerResourceID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/registeredServers/f94e2944-b48d-4e5b-bdc7-c48ab3712659"), + // SyncStatus: &armstoragesync.ServerEndpointSyncStatus{ + // CombinedHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateHealthy), + // DownloadHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateHealthy), + // DownloadStatus: &armstoragesync.ServerEndpointSyncSessionStatus{ + // LastSyncPerItemErrorCount: to.Ptr[int64](0), + // LastSyncResult: to.Ptr[int32](0), + // LastSyncSuccessTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:28:33.9217334Z"); return t}()), + // LastSyncTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:28:33.9217334Z"); return t}()), // }, - // { - // Count: to.Ptr[int64](10), - // ErrorCode: to.Ptr[int32](-2134347774), + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.1057915Z"); return t}()), + // OfflineDataTransferStatus: to.Ptr(armstoragesync.ServerEndpointOfflineDataTransferStateNotRunning), + // SyncActivity: to.Ptr(armstoragesync.ServerEndpointSyncActivityStateUpload), + // UploadActivity: &armstoragesync.ServerEndpointSyncActivityStatus{ + // AppliedBytes: to.Ptr[int64](57348983), + // AppliedItemCount: to.Ptr[int64](1000), + // PerItemErrorCount: to.Ptr[int64](300), + // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.1057915Z"); return t}()), + // TotalBytes: to.Ptr[int64](1958367412), + // TotalItemCount: to.Ptr[int64](2300), + // }, + // UploadHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateHealthy), + // UploadStatus: &armstoragesync.ServerEndpointSyncSessionStatus{ + // LastSyncPerItemErrorCount: to.Ptr[int64](0), + // LastSyncResult: to.Ptr[int32](0), + // LastSyncSuccessTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:28:33.9217334Z"); return t}()), + // LastSyncTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.1057915Z"); return t}()), // }, - // { - // Count: to.Ptr[int64](15), - // ErrorCode: to.Ptr[int32](-2134347773), - // }}, - // TotalRecallErrorsCount: to.Ptr[int64](30), - // }, - // ServerLocalPath: to.Ptr("D:\\SampleServerEndpoint_2"), - // ServerName: to.Ptr("somemachine2.redmond.corp.microsoft.com"), - // ServerResourceID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/registeredServers/f94e2944-b48d-4e5b-bdc7-c48ab3712659"), - // SyncStatus: &armstoragesync.ServerEndpointSyncStatus{ - // CombinedHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateHealthy), - // DownloadHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateHealthy), - // DownloadStatus: &armstoragesync.ServerEndpointSyncSessionStatus{ - // LastSyncPerItemErrorCount: to.Ptr[int64](0), - // LastSyncResult: to.Ptr[int32](0), - // LastSyncSuccessTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:28:33.921Z"); return t}()), - // LastSyncTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:28:33.921Z"); return t}()), - // }, - // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.105Z"); return t}()), - // OfflineDataTransferStatus: to.Ptr(armstoragesync.ServerEndpointOfflineDataTransferStateNotRunning), - // SyncActivity: to.Ptr(armstoragesync.ServerEndpointSyncActivityStateUpload), - // UploadActivity: &armstoragesync.ServerEndpointSyncActivityStatus{ - // AppliedBytes: to.Ptr[int64](57348983), - // AppliedItemCount: to.Ptr[int64](1000), - // PerItemErrorCount: to.Ptr[int64](300), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.105Z"); return t}()), - // TotalBytes: to.Ptr[int64](1958367412), - // TotalItemCount: to.Ptr[int64](2300), - // }, - // UploadHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateHealthy), - // UploadStatus: &armstoragesync.ServerEndpointSyncSessionStatus{ - // LastSyncPerItemErrorCount: to.Ptr[int64](0), - // LastSyncResult: to.Ptr[int32](0), - // LastSyncSuccessTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:28:33.921Z"); return t}()), - // LastSyncTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.105Z"); return t}()), // }, + // TierFilesOlderThanDays: to.Ptr[int32](5), + // VolumeFreeSpacePercent: to.Ptr[int32](80), // }, - // TierFilesOlderThanDays: to.Ptr[int32](5), - // VolumeFreeSpacePercent: to.Ptr[int32](80), // }, - // }}, + // }, + // }, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Recall.json +// Generated from example definition: 2022-09-01/ServerEndpoints_Recall.json func ExampleServerEndpointsClient_BeginRecallAction() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -517,8 +641,89 @@ func ExampleServerEndpointsClient_BeginRecallAction() { if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + 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 = armstoragesync.ServerEndpointsClientRecallActionResponse{ + // } +} + +// Generated from example definition: 2022-09-01/ServerEndpoints_Update.json +func ExampleServerEndpointsClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewServerEndpointsClient().BeginUpdate(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "SampleSyncGroup_1", "SampleServerEndpoint_1", armstoragesync.ServerEndpointUpdateParameters{ + Properties: &armstoragesync.ServerEndpointUpdateProperties{ + CloudTiering: to.Ptr(armstoragesync.FeatureStatusOff), + LocalCacheMode: to.Ptr(armstoragesync.LocalCacheModeUpdateLocallyCachedFiles), + OfflineDataTransfer: to.Ptr(armstoragesync.FeatureStatusOff), + TierFilesOlderThanDays: to.Ptr[int32](0), + VolumeFreeSpacePercent: to.Ptr[int32](100), + }, + }, 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 = armstoragesync.ServerEndpointsClientUpdateResponse{ + // ServerEndpoint: &armstoragesync.ServerEndpoint{ + // Name: to.Ptr("SampleServerEndpoint_1"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups/serverEndpoints"), + // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/syncGroups/SampleSyncGroup_1/serverEndpoints/SampleServerEndpoint_1"), + // Properties: &armstoragesync.ServerEndpointProperties{ + // CloudTiering: to.Ptr(armstoragesync.FeatureStatusOff), + // FriendlyName: to.Ptr("somemachine2.redmond.corp.microsoft.com"), + // InitialDownloadPolicy: to.Ptr(armstoragesync.InitialDownloadPolicyNamespaceThenModifiedFiles), + // InitialUploadPolicy: to.Ptr(armstoragesync.InitialUploadPolicyMerge), + // LastOperationName: to.Ptr("ICreateServerEndpointWorkflow"), + // LastWorkflowID: to.Ptr("storageSyncServices/healthDemo1/workflows/569afb5c-7172-4cf8-a8ea-d987f727f11b"), + // LocalCacheMode: to.Ptr(armstoragesync.LocalCacheModeUpdateLocallyCachedFiles), + // OfflineDataTransfer: to.Ptr(armstoragesync.FeatureStatusOff), + // OfflineDataTransferShareName: to.Ptr("myfileshare"), + // OfflineDataTransferStorageAccountResourceID: to.Ptr("/subscriptions/744f4d70-6d17-4921-8970-a765d14f763f/resourceGroups/myRG/providers/Microsoft.Storage/storageAccounts/mysa"), + // OfflineDataTransferStorageAccountTenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + // ProvisioningState: to.Ptr("Succeeded"), + // ServerLocalPath: to.Ptr("C:\\data_quota2"), + // ServerName: to.Ptr("somemachine2.redmond.corp.microsoft.com"), + // ServerResourceID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/anpintDemoRG/providers/kailanitest07.one.microsoft.com/storageSyncServices/healthdemo1/registeredServers/f94e2944-b48d-4e5b-bdc7-c48ab3712659"), + // SyncStatus: &armstoragesync.ServerEndpointSyncStatus{ + // CombinedHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateError), + // DownloadHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateHealthy), + // DownloadStatus: &armstoragesync.ServerEndpointSyncSessionStatus{ + // LastSyncPerItemErrorCount: to.Ptr[int64](0), + // LastSyncResult: to.Ptr[int32](0), + // LastSyncSuccessTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:28:33.9217334Z"); return t}()), + // LastSyncTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:28:33.9217334Z"); return t}()), + // }, + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.1057915Z"); return t}()), + // OfflineDataTransferStatus: to.Ptr(armstoragesync.ServerEndpointOfflineDataTransferStateStopping), + // UploadHealth: to.Ptr(armstoragesync.ServerEndpointHealthStateError), + // UploadStatus: &armstoragesync.ServerEndpointSyncSessionStatus{ + // LastSyncPerItemErrorCount: to.Ptr[int64](0), + // LastSyncResult: to.Ptr[int32](-2134351810), + // LastSyncTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:32:51.1057915Z"); return t}()), + // }, + // }, + // TierFilesOlderThanDays: to.Ptr[int32](0), + // VolumeFreeSpacePercent: to.Ptr[int32](20), + // }, + // }, + // } } diff --git a/sdk/resourcemanager/storagesync/armstoragesync/services_client.go b/sdk/resourcemanager/storagesync/armstoragesync/services_client.go index da41eeffc10e..9ba73029e444 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/services_client.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/services_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 armstoragesync @@ -17,7 +16,7 @@ import ( "strings" ) -// ServicesClient contains the methods for the StorageSyncServices group. +// ServicesClient contains the methods for the Services group. // Don't use this type directly, use NewServicesClient() instead. type ServicesClient struct { internal *arm.Client @@ -25,9 +24,9 @@ type ServicesClient struct { } // NewServicesClient creates a new instance of ServicesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServicesClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -43,9 +42,9 @@ func NewServicesClient(subscriptionID string, credential azcore.TokenCredential, // CheckNameAvailability - Check the give namespace name availability. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - locationName - The desired region for the name check. -// - parameters - Parameters to check availability of the given namespace name +// - parameters - The request body // - options - ServicesClientCheckNameAvailabilityOptions contains the optional parameters for the ServicesClient.CheckNameAvailability // method. func (client *ServicesClient) CheckNameAvailability(ctx context.Context, locationName string, parameters CheckNameAvailabilityParameters, options *ServicesClientCheckNameAvailabilityOptions) (ServicesClientCheckNameAvailabilityResponse, error) { @@ -71,24 +70,25 @@ func (client *ServicesClient) CheckNameAvailability(ctx context.Context, locatio } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. -func (client *ServicesClient) checkNameAvailabilityCreateRequest(ctx context.Context, locationName string, parameters CheckNameAvailabilityParameters, options *ServicesClientCheckNameAvailabilityOptions) (*policy.Request, error) { +func (client *ServicesClient) checkNameAvailabilityCreateRequest(ctx context.Context, locationName string, parameters CheckNameAvailabilityParameters, _ *ServicesClientCheckNameAvailabilityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/checkNameAvailability" - if locationName == "" { - return nil, errors.New("parameter locationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if locationName == "" { + return nil, errors.New("parameter locationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) 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", "2020-09-01") + reqQP.Set("api-version", "2022-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, parameters); err != nil { return nil, err } @@ -107,7 +107,7 @@ func (client *ServicesClient) checkNameAvailabilityHandleResponse(resp *http.Res // BeginCreate - Create a new StorageSyncService. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - parameters - Storage Sync Service resource name. @@ -119,7 +119,8 @@ func (client *ServicesClient) BeginCreate(ctx context.Context, resourceGroupName return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServicesClientCreateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -132,7 +133,7 @@ func (client *ServicesClient) BeginCreate(ctx context.Context, resourceGroupName // Create - Create a new StorageSyncService. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 func (client *ServicesClient) create(ctx context.Context, resourceGroupName string, storageSyncServiceName string, parameters ServiceCreateParameters, options *ServicesClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ServicesClient.BeginCreate" @@ -155,7 +156,7 @@ func (client *ServicesClient) create(ctx context.Context, resourceGroupName stri } // createCreateRequest creates the Create request. -func (client *ServicesClient) createCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, parameters ServiceCreateParameters, options *ServicesClientBeginCreateOptions) (*policy.Request, error) { +func (client *ServicesClient) createCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, parameters ServiceCreateParameters, _ *ServicesClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -174,9 +175,10 @@ func (client *ServicesClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-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, parameters); err != nil { return nil, err } @@ -186,7 +188,7 @@ func (client *ServicesClient) createCreateRequest(ctx context.Context, resourceG // BeginDelete - Delete a given StorageSyncService. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - options - ServicesClientBeginDeleteOptions contains the optional parameters for the ServicesClient.BeginDelete method. @@ -197,7 +199,8 @@ func (client *ServicesClient) BeginDelete(ctx context.Context, resourceGroupName return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServicesClientDeleteResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -210,7 +213,7 @@ func (client *ServicesClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Delete a given StorageSyncService. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 func (client *ServicesClient) deleteOperation(ctx context.Context, resourceGroupName string, storageSyncServiceName string, options *ServicesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ServicesClient.BeginDelete" @@ -233,7 +236,7 @@ func (client *ServicesClient) deleteOperation(ctx context.Context, resourceGroup } // deleteCreateRequest creates the Delete request. -func (client *ServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, options *ServicesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, _ *ServicesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -252,16 +255,15 @@ func (client *ServicesClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Get a given StorageSyncService. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - options - ServicesClientGetOptions contains the optional parameters for the ServicesClient.Get method. @@ -288,7 +290,7 @@ func (client *ServicesClient) Get(ctx context.Context, resourceGroupName string, } // getCreateRequest creates the Get request. -func (client *ServicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, options *ServicesClientGetOptions) (*policy.Request, error) { +func (client *ServicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, _ *ServicesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -307,7 +309,7 @@ func (client *ServicesClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -317,10 +319,10 @@ func (client *ServicesClient) getCreateRequest(ctx context.Context, resourceGrou func (client *ServicesClient) getHandleResponse(resp *http.Response) (ServicesClientGetResponse, error) { result := ServicesClientGetResponse{} if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { - result.XMSCorrelationRequestID = &val + result.CorrelationRequestID = &val } if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val + result.RequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.Service); err != nil { return ServicesClientGetResponse{}, err @@ -330,28 +332,27 @@ func (client *ServicesClient) getHandleResponse(resp *http.Response) (ServicesCl // NewListByResourceGroupPager - Get a StorageSyncService list by Resource group name. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ServicesClientListByResourceGroupOptions contains the optional parameters for the ServicesClient.NewListByResourceGroupPager // method. func (client *ServicesClient) NewListByResourceGroupPager(resourceGroupName string, options *ServicesClientListByResourceGroupOptions) *runtime.Pager[ServicesClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[ServicesClientListByResourceGroupResponse]{ More: func(page ServicesClientListByResourceGroupResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ServicesClientListByResourceGroupResponse) (ServicesClientListByResourceGroupResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ServicesClient.NewListByResourceGroupPager") - req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - if err != nil { - return ServicesClientListByResourceGroupResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) if err != nil { return ServicesClientListByResourceGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServicesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceGroupHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -359,7 +360,7 @@ func (client *ServicesClient) NewListByResourceGroupPager(resourceGroupName stri } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *ServicesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ServicesClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *ServicesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *ServicesClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -374,7 +375,7 @@ func (client *ServicesClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -384,10 +385,10 @@ func (client *ServicesClient) listByResourceGroupCreateRequest(ctx context.Conte func (client *ServicesClient) listByResourceGroupHandleResponse(resp *http.Response) (ServicesClientListByResourceGroupResponse, error) { result := ServicesClientListByResourceGroupResponse{} if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { - result.XMSCorrelationRequestID = &val + result.CorrelationRequestID = &val } if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val + result.RequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ServiceArray); err != nil { return ServicesClientListByResourceGroupResponse{}, err @@ -397,27 +398,26 @@ func (client *ServicesClient) listByResourceGroupHandleResponse(resp *http.Respo // NewListBySubscriptionPager - Get a StorageSyncService list by subscription. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - options - ServicesClientListBySubscriptionOptions contains the optional parameters for the ServicesClient.NewListBySubscriptionPager // method. func (client *ServicesClient) NewListBySubscriptionPager(options *ServicesClientListBySubscriptionOptions) *runtime.Pager[ServicesClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[ServicesClientListBySubscriptionResponse]{ More: func(page ServicesClientListBySubscriptionResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ServicesClientListBySubscriptionResponse) (ServicesClientListBySubscriptionResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ServicesClient.NewListBySubscriptionPager") - req, err := client.listBySubscriptionCreateRequest(ctx, options) - if err != nil { - return ServicesClientListBySubscriptionResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) if err != nil { return ServicesClientListBySubscriptionResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServicesClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } return client.listBySubscriptionHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -425,7 +425,7 @@ func (client *ServicesClient) NewListBySubscriptionPager(options *ServicesClient } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *ServicesClient) listBySubscriptionCreateRequest(ctx context.Context, options *ServicesClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *ServicesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *ServicesClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/storageSyncServices" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -436,7 +436,7 @@ func (client *ServicesClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -446,10 +446,10 @@ func (client *ServicesClient) listBySubscriptionCreateRequest(ctx context.Contex func (client *ServicesClient) listBySubscriptionHandleResponse(resp *http.Response) (ServicesClientListBySubscriptionResponse, error) { result := ServicesClientListBySubscriptionResponse{} if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { - result.XMSCorrelationRequestID = &val + result.CorrelationRequestID = &val } if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val + result.RequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ServiceArray); err != nil { return ServicesClientListBySubscriptionResponse{}, err @@ -460,18 +460,20 @@ func (client *ServicesClient) listBySubscriptionHandleResponse(resp *http.Respon // BeginUpdate - Patch a given StorageSyncService. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. +// - parameters - Storage Sync Service resource. // - options - ServicesClientBeginUpdateOptions contains the optional parameters for the ServicesClient.BeginUpdate method. -func (client *ServicesClient) BeginUpdate(ctx context.Context, resourceGroupName string, storageSyncServiceName string, options *ServicesClientBeginUpdateOptions) (*runtime.Poller[ServicesClientUpdateResponse], error) { +func (client *ServicesClient) BeginUpdate(ctx context.Context, resourceGroupName string, storageSyncServiceName string, parameters ServiceUpdateParameters, options *ServicesClientBeginUpdateOptions) (*runtime.Poller[ServicesClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, storageSyncServiceName, options) + resp, err := client.update(ctx, resourceGroupName, storageSyncServiceName, parameters, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServicesClientUpdateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -484,14 +486,14 @@ func (client *ServicesClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Patch a given StorageSyncService. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 -func (client *ServicesClient) update(ctx context.Context, resourceGroupName string, storageSyncServiceName string, options *ServicesClientBeginUpdateOptions) (*http.Response, error) { +// Generated from API version 2022-09-01 +func (client *ServicesClient) update(ctx context.Context, resourceGroupName string, storageSyncServiceName string, parameters ServiceUpdateParameters, options *ServicesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ServicesClient.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, storageSyncServiceName, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, storageSyncServiceName, parameters, options) if err != nil { return nil, err } @@ -507,7 +509,7 @@ func (client *ServicesClient) update(ctx context.Context, resourceGroupName stri } // updateCreateRequest creates the Update request. -func (client *ServicesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, options *ServicesClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ServicesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, parameters ServiceUpdateParameters, _ *ServicesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -526,14 +528,12 @@ func (client *ServicesClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Parameters != nil { - if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { - return nil, err - } - return req, nil + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err } return req, nil } diff --git a/sdk/resourcemanager/storagesync/armstoragesync/services_client_example_test.go b/sdk/resourcemanager/storagesync/armstoragesync/services_client_example_test.go index d2fad7e62f9c..283bd967d692 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/services_client_example_test.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/services_client_example_test.go @@ -1,34 +1,30 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for 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 armstoragesync_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/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServiceCheckNameAvailability_AlreadyExists.json +// Generated from example definition: 2022-09-01/StorageSyncServiceCheckNameAvailability_AlreadyExists.json func ExampleServicesClient_CheckNameAvailability_storageSyncServiceCheckNameAvailabilityAlreadyExists() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("5c6bc8e1-1eaf-4192-94d8-58ce463ac86c", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewServicesClient().CheckNameAvailability(ctx, "westus", armstoragesync.CheckNameAvailabilityParameters{ Name: to.Ptr("newstoragesyncservicename"), - Type: to.Ptr("Microsoft.StorageSync/storageSyncServices"), }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -36,27 +32,28 @@ func ExampleServicesClient_CheckNameAvailability_storageSyncServiceCheckNameAvai // 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.CheckNameAvailabilityResult = armstoragesync.CheckNameAvailabilityResult{ - // Message: to.Ptr("An account named 'newstoragesyncservicename' is already in use."), - // NameAvailable: to.Ptr(false), - // Reason: to.Ptr(armstoragesync.NameAvailabilityReasonAlreadyExists), + // res = armstoragesync.ServicesClientCheckNameAvailabilityResponse{ + // CheckNameAvailabilityResult: &armstoragesync.CheckNameAvailabilityResult{ + // Message: to.Ptr("An account named 'newstoragesyncservicename' is already in use."), + // NameAvailable: to.Ptr(false), + // Reason: to.Ptr(armstoragesync.NameAvailabilityReasonAlreadyExists), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServiceCheckNameAvailability_Available.json +// Generated from example definition: 2022-09-01/StorageSyncServiceCheckNameAvailability_Available.json func ExampleServicesClient_CheckNameAvailability_storageSyncServiceCheckNameAvailabilityAvailable() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("5c6bc8e1-1eaf-4192-94d8-58ce463ac86c", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewServicesClient().CheckNameAvailability(ctx, "westus", armstoragesync.CheckNameAvailabilityParameters{ Name: to.Ptr("newstoragesyncservicename"), - Type: to.Ptr("Microsoft.StorageSync/storageSyncServices"), }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -64,23 +61,28 @@ func ExampleServicesClient_CheckNameAvailability_storageSyncServiceCheckNameAvai // 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.CheckNameAvailabilityResult = armstoragesync.CheckNameAvailabilityResult{ - // NameAvailable: to.Ptr(true), + // res = armstoragesync.ServicesClientCheckNameAvailabilityResponse{ + // CheckNameAvailabilityResult: &armstoragesync.CheckNameAvailabilityResult{ + // NameAvailable: to.Ptr(true), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Create.json +// Generated from example definition: 2022-09-01/StorageSyncServices_Create.json func ExampleServicesClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewServicesClient().BeginCreate(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", armstoragesync.ServiceCreateParameters{ + Identity: &armstoragesync.ManagedServiceIdentity{ + Type: to.Ptr(armstoragesync.ManagedServiceIdentityType("SystemAssigned, UserAssigned")), + }, Location: to.Ptr("WestUS"), Properties: &armstoragesync.ServiceCreateParametersProperties{ IncomingTrafficPolicy: to.Ptr(armstoragesync.IncomingTrafficPolicyAllowAllTraffic), @@ -97,86 +99,52 @@ func ExampleServicesClient_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.Service = armstoragesync.Service{ - // Name: to.Ptr("SampleStorageSyncService_1"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices"), - // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1"), - // Location: to.Ptr("WestUS"), - // Tags: map[string]*string{ - // }, - // Properties: &armstoragesync.ServiceProperties{ - // IncomingTrafficPolicy: to.Ptr(armstoragesync.IncomingTrafficPolicyAllowAllTraffic), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Get.json -func ExampleServicesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServicesClient().Get(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", 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.Service = armstoragesync.Service{ - // Name: to.Ptr("SampleStorageSyncService_1"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices"), - // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1"), - // Location: to.Ptr("WestUS"), - // Tags: map[string]*string{ - // }, - // Properties: &armstoragesync.ServiceProperties{ - // IncomingTrafficPolicy: to.Ptr(armstoragesync.IncomingTrafficPolicyAllowAllTraffic), - // PrivateEndpointConnections: []*armstoragesync.PrivateEndpointConnection{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/{resource}/{resourceName}/privateEndpointConnections/SampleStorageSyncService_1.cd99f12ba6f3483f9292229e4f822258"), - // Properties: &armstoragesync.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armstoragesync.PrivateEndpoint{ - // ID: to.Ptr("subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_2/providers/Microsoft.Network/privateEndpoints/testpe01"), - // }, - // PrivateLinkServiceConnectionState: &armstoragesync.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Please approve my request, thanks."), - // Status: to.Ptr(armstoragesync.PrivateEndpointServiceConnectionStatusPending), - // }, + // res = armstoragesync.ServicesClientCreateResponse{ + // Service: &armstoragesync.Service{ + // Name: to.Ptr("SampleStorageSyncService_1"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices"), + // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1"), + // Identity: &armstoragesync.ManagedServiceIdentity{ + // Type: to.Ptr(armstoragesync.ManagedServiceIdentityType("SystemAssigned, UserAssigned")), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // UserAssignedIdentities: map[string]*armstoragesync.UserAssignedIdentity{ + // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": &armstoragesync.UserAssignedIdentity{ + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), // }, - // }}, - // StorageSyncServiceStatus: to.Ptr[int32](0), - // StorageSyncServiceUID: to.Ptr("\"2de01144-72da-4d7f-9d0c-e858855114a8\""), + // }, + // }, + // Location: to.Ptr("WestUS"), + // Properties: &armstoragesync.ServiceProperties{ + // IncomingTrafficPolicy: to.Ptr(armstoragesync.IncomingTrafficPolicyAllowAllTraffic), + // }, + // SystemData: &armstoragesync.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-11T03:16:03.944Z"); return t}()), + // CreatedBy: to.Ptr("sample-user"), + // CreatedByType: to.Ptr(armstoragesync.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-11T03:17:03.944Z"); return t}()), + // LastModifiedBy: to.Ptr("sample-user"), + // LastModifiedByType: to.Ptr(armstoragesync.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Update.json -func ExampleServicesClient_BeginUpdate() { +// Generated from example definition: 2022-09-01/StorageSyncServices_Delete.json +func ExampleServicesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewServicesClient().BeginUpdate(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", &armstoragesync.ServicesClientBeginUpdateOptions{Parameters: &armstoragesync.ServiceUpdateParameters{ - Properties: &armstoragesync.ServiceUpdateProperties{ - IncomingTrafficPolicy: to.Ptr(armstoragesync.IncomingTrafficPolicyAllowAllTraffic), - }, - Tags: map[string]*string{ - "Dept": to.Ptr("IT"), - "Environment": to.Ptr("Test"), - }, - }, - }) + poller, err := clientFactory.NewServicesClient().BeginDelete(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -187,50 +155,88 @@ func ExampleServicesClient_BeginUpdate() { // 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.Service = armstoragesync.Service{ - // Name: to.Ptr("SampleStorageSyncService_1"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices"), - // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1"), - // Location: to.Ptr("WestUS"), - // Tags: map[string]*string{ - // "Dept": to.Ptr("IT"), - // "Environment": to.Ptr("Test"), - // }, - // Properties: &armstoragesync.ServiceProperties{ - // IncomingTrafficPolicy: to.Ptr(armstoragesync.IncomingTrafficPolicyAllowAllTraffic), - // }, + // res = armstoragesync.ServicesClientDeleteResponse{ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Delete.json -func ExampleServicesClient_BeginDelete() { +// Generated from example definition: 2022-09-01/StorageSyncServices_Get.json +func ExampleServicesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewServicesClient().BeginDelete(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", nil) + res, err := clientFactory.NewServicesClient().Get(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", 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 = armstoragesync.ServicesClientGetResponse{ + // CorrelationRequestID: "d166ca76-dad2-49df-b409-d2acfd42d730" + // RequestID: "74e55a4d-1c6f-46de-9a8d-278e53a47403" + // Service: &armstoragesync.Service{ + // Name: to.Ptr("SampleStorageSyncService_1"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices"), + // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1"), + // Identity: &armstoragesync.ManagedServiceIdentity{ + // Type: to.Ptr(armstoragesync.ManagedServiceIdentityType("SystemAssigned, UserAssigned")), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // UserAssignedIdentities: map[string]*armstoragesync.UserAssignedIdentity{ + // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": &armstoragesync.UserAssignedIdentity{ + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, + // Location: to.Ptr("WestUS"), + // Properties: &armstoragesync.ServiceProperties{ + // IncomingTrafficPolicy: to.Ptr(armstoragesync.IncomingTrafficPolicyAllowAllTraffic), + // PrivateEndpointConnections: []*armstoragesync.PrivateEndpointConnection{ + // { + // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_2/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/privateEndpointConnections/SampleStorageSyncService_1.cd99f12ba6f3483f9292229e4f822258"), + // Properties: &armstoragesync.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armstoragesync.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_2/providers/Microsoft.Network/privateEndpoints/testpe01"), + // }, + // PrivateLinkServiceConnectionState: &armstoragesync.PrivateLinkServiceConnectionState{ + // Description: to.Ptr("Please approve my request, thanks."), + // Status: to.Ptr(armstoragesync.PrivateEndpointServiceConnectionStatusPending), + // }, + // }, + // }, + // }, + // StorageSyncServiceStatus: to.Ptr[int32](0), + // StorageSyncServiceUID: to.Ptr("\"2de01144-72da-4d7f-9d0c-e858855114a8\""), + // }, + // SystemData: &armstoragesync.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-11T03:16:03.944Z"); return t}()), + // CreatedBy: to.Ptr("sample-user"), + // CreatedByType: to.Ptr(armstoragesync.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-11T03:17:03.944Z"); return t}()), + // LastModifiedBy: to.Ptr("sample-user"), + // LastModifiedByType: to.Ptr(armstoragesync.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_ListByResourceGroup.json +// Generated from example definition: 2022-09-01/StorageSyncServices_ListByResourceGroup.json func ExampleServicesClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -245,59 +251,121 @@ func ExampleServicesClient_NewListByResourceGroupPager() { _ = 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.ServiceArray = armstoragesync.ServiceArray{ - // Value: []*armstoragesync.Service{ - // { - // Name: to.Ptr("SampleStorageSyncService_1"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices"), - // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1"), - // Location: to.Ptr("WestUS"), - // Tags: map[string]*string{ - // }, - // Properties: &armstoragesync.ServiceProperties{ - // IncomingTrafficPolicy: to.Ptr(armstoragesync.IncomingTrafficPolicyAllowAllTraffic), - // StorageSyncServiceStatus: to.Ptr[int32](0), - // StorageSyncServiceUID: to.Ptr("\"3d1bf292-0f2a-4cc1-a3e1-60f35800e40c\""), + // page = armstoragesync.ServicesClientListByResourceGroupResponse{ + // CorrelationRequestID: "d166ca76-dad2-49df-b409-d2acfd42d730" + // RequestID: "74e55a4d-1c6f-46de-9a8d-278e53a47403" + // ServiceArray: armstoragesync.ServiceArray{ + // Value: []*armstoragesync.Service{ + // { + // Name: to.Ptr("SampleStorageSyncService_1"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices"), + // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1"), + // Identity: &armstoragesync.ManagedServiceIdentity{ + // Type: to.Ptr(armstoragesync.ManagedServiceIdentityType("SystemAssigned, UserAssigned")), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // UserAssignedIdentities: map[string]*armstoragesync.UserAssignedIdentity{ + // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": &armstoragesync.UserAssignedIdentity{ + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, + // Location: to.Ptr("WestUS"), + // Properties: &armstoragesync.ServiceProperties{ + // IncomingTrafficPolicy: to.Ptr(armstoragesync.IncomingTrafficPolicyAllowAllTraffic), + // StorageSyncServiceStatus: to.Ptr[int32](0), + // StorageSyncServiceUID: to.Ptr("\"3d1bf292-0f2a-4cc1-a3e1-60f35800e40c\""), + // }, + // SystemData: &armstoragesync.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-11T03:16:03.944Z"); return t}()), + // CreatedBy: to.Ptr("sample-user"), + // CreatedByType: to.Ptr(armstoragesync.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-11T03:17:03.944Z"); return t}()), + // LastModifiedBy: to.Ptr("sample-user"), + // LastModifiedByType: to.Ptr(armstoragesync.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, // }, - // }, - // { - // Name: to.Ptr("SampleStorageSyncService_2"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices"), - // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_2"), - // Location: to.Ptr("WestUS"), - // Tags: map[string]*string{ + // { + // Name: to.Ptr("SampleStorageSyncService_2"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices"), + // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_2"), + // Identity: &armstoragesync.ManagedServiceIdentity{ + // Type: to.Ptr(armstoragesync.ManagedServiceIdentityType("SystemAssigned, UserAssigned")), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // UserAssignedIdentities: map[string]*armstoragesync.UserAssignedIdentity{ + // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": &armstoragesync.UserAssignedIdentity{ + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, + // Location: to.Ptr("WestUS"), + // Properties: &armstoragesync.ServiceProperties{ + // IncomingTrafficPolicy: to.Ptr(armstoragesync.IncomingTrafficPolicyAllowAllTraffic), + // StorageSyncServiceStatus: to.Ptr[int32](0), + // StorageSyncServiceUID: to.Ptr("\"2de01144-72da-4d7f-9d0c-e858855114a8\""), + // }, + // SystemData: &armstoragesync.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-11T03:16:03.944Z"); return t}()), + // CreatedBy: to.Ptr("sample-user"), + // CreatedByType: to.Ptr(armstoragesync.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-11T03:17:03.944Z"); return t}()), + // LastModifiedBy: to.Ptr("sample-user"), + // LastModifiedByType: to.Ptr(armstoragesync.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, // }, - // Properties: &armstoragesync.ServiceProperties{ - // IncomingTrafficPolicy: to.Ptr(armstoragesync.IncomingTrafficPolicyAllowAllTraffic), - // StorageSyncServiceStatus: to.Ptr[int32](0), - // StorageSyncServiceUID: to.Ptr("\"2de01144-72da-4d7f-9d0c-e858855114a8\""), + // { + // Name: to.Ptr("SampleStorageSyncService_3"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices"), + // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_3"), + // Identity: &armstoragesync.ManagedServiceIdentity{ + // Type: to.Ptr(armstoragesync.ManagedServiceIdentityType("SystemAssigned, UserAssigned")), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // UserAssignedIdentities: map[string]*armstoragesync.UserAssignedIdentity{ + // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": &armstoragesync.UserAssignedIdentity{ + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, + // Location: to.Ptr("WestUS"), + // Properties: &armstoragesync.ServiceProperties{ + // IncomingTrafficPolicy: to.Ptr(armstoragesync.IncomingTrafficPolicyAllowAllTraffic), + // StorageSyncServiceStatus: to.Ptr[int32](0), + // StorageSyncServiceUID: to.Ptr("\"b2c58ee5-933e-462c-8a9e-b30f2bdd8fa3\""), + // }, + // SystemData: &armstoragesync.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-11T03:16:03.944Z"); return t}()), + // CreatedBy: to.Ptr("sample-user"), + // CreatedByType: to.Ptr(armstoragesync.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-11T03:17:03.944Z"); return t}()), + // LastModifiedBy: to.Ptr("sample-user"), + // LastModifiedByType: to.Ptr(armstoragesync.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, // }, // }, - // { - // Name: to.Ptr("SampleStorageSyncService_3"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices"), - // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_3"), - // Location: to.Ptr("WestUS"), - // Tags: map[string]*string{ - // }, - // Properties: &armstoragesync.ServiceProperties{ - // IncomingTrafficPolicy: to.Ptr(armstoragesync.IncomingTrafficPolicyAllowAllTraffic), - // StorageSyncServiceStatus: to.Ptr[int32](0), - // StorageSyncServiceUID: to.Ptr("\"b2c58ee5-933e-462c-8a9e-b30f2bdd8fa3\""), - // }, - // }}, + // }, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_ListBySubscription.json +// Generated from example definition: 2022-09-01/StorageSyncServices_ListBySubscription.json func ExampleServicesClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -312,47 +380,176 @@ func ExampleServicesClient_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.ServiceArray = armstoragesync.ServiceArray{ - // Value: []*armstoragesync.Service{ - // { - // Name: to.Ptr("SampleStorageSyncService_1"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices"), - // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1"), - // Location: to.Ptr("WestUS"), - // Tags: map[string]*string{ + // page = armstoragesync.ServicesClientListBySubscriptionResponse{ + // CorrelationRequestID: "d166ca76-dad2-49df-b409-d2acfd42d730" + // RequestID: "74e55a4d-1c6f-46de-9a8d-278e53a47403" + // ServiceArray: armstoragesync.ServiceArray{ + // Value: []*armstoragesync.Service{ + // { + // Name: to.Ptr("SampleStorageSyncService_1"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices"), + // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1"), + // Identity: &armstoragesync.ManagedServiceIdentity{ + // Type: to.Ptr(armstoragesync.ManagedServiceIdentityType("SystemAssigned, UserAssigned")), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // UserAssignedIdentities: map[string]*armstoragesync.UserAssignedIdentity{ + // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": &armstoragesync.UserAssignedIdentity{ + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, + // Location: to.Ptr("WestUS"), + // Properties: &armstoragesync.ServiceProperties{ + // IncomingTrafficPolicy: to.Ptr(armstoragesync.IncomingTrafficPolicyAllowAllTraffic), + // StorageSyncServiceStatus: to.Ptr[int32](0), + // StorageSyncServiceUID: to.Ptr("\"3d1bf292-0f2a-4cc1-a3e1-60f35800e40c\""), + // }, + // SystemData: &armstoragesync.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-11T03:16:03.944Z"); return t}()), + // CreatedBy: to.Ptr("sample-user"), + // CreatedByType: to.Ptr(armstoragesync.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-11T03:17:03.944Z"); return t}()), + // LastModifiedBy: to.Ptr("sample-user"), + // LastModifiedByType: to.Ptr(armstoragesync.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, // }, - // Properties: &armstoragesync.ServiceProperties{ - // IncomingTrafficPolicy: to.Ptr(armstoragesync.IncomingTrafficPolicyAllowAllTraffic), - // StorageSyncServiceStatus: to.Ptr[int32](0), - // StorageSyncServiceUID: to.Ptr("\"3d1bf292-0f2a-4cc1-a3e1-60f35800e40c\""), + // { + // Name: to.Ptr("SampleStorageSyncService_2"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices"), + // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_2"), + // Identity: &armstoragesync.ManagedServiceIdentity{ + // Type: to.Ptr(armstoragesync.ManagedServiceIdentityType("SystemAssigned, UserAssigned")), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // UserAssignedIdentities: map[string]*armstoragesync.UserAssignedIdentity{ + // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": &armstoragesync.UserAssignedIdentity{ + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, + // Location: to.Ptr("WestUS"), + // Properties: &armstoragesync.ServiceProperties{ + // IncomingTrafficPolicy: to.Ptr(armstoragesync.IncomingTrafficPolicyAllowAllTraffic), + // StorageSyncServiceStatus: to.Ptr[int32](0), + // StorageSyncServiceUID: to.Ptr("\"2de01144-72da-4d7f-9d0c-e858855114a8\""), + // }, + // SystemData: &armstoragesync.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-11T03:16:03.944Z"); return t}()), + // CreatedBy: to.Ptr("sample-user"), + // CreatedByType: to.Ptr(armstoragesync.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-11T03:17:03.944Z"); return t}()), + // LastModifiedBy: to.Ptr("sample-user"), + // LastModifiedByType: to.Ptr(armstoragesync.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, // }, - // }, - // { - // Name: to.Ptr("SampleStorageSyncService_2"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices"), - // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_2"), - // Location: to.Ptr("WestUS"), - // Tags: map[string]*string{ - // }, - // Properties: &armstoragesync.ServiceProperties{ - // IncomingTrafficPolicy: to.Ptr(armstoragesync.IncomingTrafficPolicyAllowAllTraffic), - // StorageSyncServiceStatus: to.Ptr[int32](0), - // StorageSyncServiceUID: to.Ptr("\"2de01144-72da-4d7f-9d0c-e858855114a8\""), + // { + // Name: to.Ptr("SampleStorageSyncService_3"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices"), + // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_3"), + // Identity: &armstoragesync.ManagedServiceIdentity{ + // Type: to.Ptr(armstoragesync.ManagedServiceIdentityType("SystemAssigned, UserAssigned")), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // UserAssignedIdentities: map[string]*armstoragesync.UserAssignedIdentity{ + // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": &armstoragesync.UserAssignedIdentity{ + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, + // Location: to.Ptr("WestUS"), + // Properties: &armstoragesync.ServiceProperties{ + // IncomingTrafficPolicy: to.Ptr(armstoragesync.IncomingTrafficPolicyAllowAllTraffic), + // StorageSyncServiceStatus: to.Ptr[int32](0), + // StorageSyncServiceUID: to.Ptr("\"b2c58ee5-933e-462c-8a9e-b30f2bdd8fa3\""), + // }, + // SystemData: &armstoragesync.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-11T03:16:03.944Z"); return t}()), + // CreatedBy: to.Ptr("sample-user"), + // CreatedByType: to.Ptr(armstoragesync.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-11T03:17:03.944Z"); return t}()), + // LastModifiedBy: to.Ptr("sample-user"), + // LastModifiedByType: to.Ptr(armstoragesync.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, // }, // }, - // { - // Name: to.Ptr("SampleStorageSyncService_3"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices"), - // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_3"), - // Location: to.Ptr("WestUS"), - // Tags: map[string]*string{ - // }, - // Properties: &armstoragesync.ServiceProperties{ - // IncomingTrafficPolicy: to.Ptr(armstoragesync.IncomingTrafficPolicyAllowAllTraffic), - // StorageSyncServiceStatus: to.Ptr[int32](0), - // StorageSyncServiceUID: to.Ptr("\"b2c58ee5-933e-462c-8a9e-b30f2bdd8fa3\""), - // }, - // }}, + // }, // } } } + +// Generated from example definition: 2022-09-01/StorageSyncServices_Update.json +func ExampleServicesClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewServicesClient().BeginUpdate(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", armstoragesync.ServiceUpdateParameters{ + Properties: &armstoragesync.ServiceUpdateProperties{ + IncomingTrafficPolicy: to.Ptr(armstoragesync.IncomingTrafficPolicyAllowAllTraffic), + UseIdentity: to.Ptr(true), + }, + Tags: map[string]*string{ + "Dept": to.Ptr("IT"), + "Environment": to.Ptr("Test"), + }, + }, 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 = armstoragesync.ServicesClientUpdateResponse{ + // Service: &armstoragesync.Service{ + // Name: to.Ptr("SampleStorageSyncService_1"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices"), + // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1"), + // Identity: &armstoragesync.ManagedServiceIdentity{ + // Type: to.Ptr(armstoragesync.ManagedServiceIdentityType("SystemAssigned, UserAssigned")), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // UserAssignedIdentities: map[string]*armstoragesync.UserAssignedIdentity{ + // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": &armstoragesync.UserAssignedIdentity{ + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, + // Location: to.Ptr("WestUS"), + // Properties: &armstoragesync.ServiceProperties{ + // IncomingTrafficPolicy: to.Ptr(armstoragesync.IncomingTrafficPolicyAllowAllTraffic), + // }, + // SystemData: &armstoragesync.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-11T03:16:03.944Z"); return t}()), + // CreatedBy: to.Ptr("sample-user"), + // CreatedByType: to.Ptr(armstoragesync.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-11T03:17:03.944Z"); return t}()), + // LastModifiedBy: to.Ptr("sample-user"), + // LastModifiedByType: to.Ptr(armstoragesync.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // "Dept": to.Ptr("IT"), + // "Environment": to.Ptr("Test"), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/storagesync/armstoragesync/syncgroups_client.go b/sdk/resourcemanager/storagesync/armstoragesync/syncgroups_client.go index 3cca509ab249..a9ee429e7240 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/syncgroups_client.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/syncgroups_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 armstoragesync @@ -25,9 +24,9 @@ type SyncGroupsClient struct { } // NewSyncGroupsClient creates a new instance of SyncGroupsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewSyncGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SyncGroupsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -43,7 +42,7 @@ func NewSyncGroupsClient(subscriptionID string, credential azcore.TokenCredentia // Create - Create a new SyncGroup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - syncGroupName - Name of Sync Group resource. @@ -72,7 +71,7 @@ func (client *SyncGroupsClient) Create(ctx context.Context, resourceGroupName st } // createCreateRequest creates the Create request. -func (client *SyncGroupsClient) createCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, parameters SyncGroupCreateParameters, options *SyncGroupsClientCreateOptions) (*policy.Request, error) { +func (client *SyncGroupsClient) createCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, parameters SyncGroupCreateParameters, _ *SyncGroupsClientCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -95,9 +94,10 @@ func (client *SyncGroupsClient) createCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-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, parameters); err != nil { return nil, err } @@ -108,10 +108,10 @@ func (client *SyncGroupsClient) createCreateRequest(ctx context.Context, resourc func (client *SyncGroupsClient) createHandleResponse(resp *http.Response) (SyncGroupsClientCreateResponse, error) { result := SyncGroupsClientCreateResponse{} if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { - result.XMSCorrelationRequestID = &val + result.CorrelationRequestID = &val } if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val + result.RequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.SyncGroup); err != nil { return SyncGroupsClientCreateResponse{}, err @@ -122,7 +122,7 @@ func (client *SyncGroupsClient) createHandleResponse(resp *http.Response) (SyncG // Delete - Delete a given SyncGroup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - syncGroupName - Name of Sync Group resource. @@ -150,7 +150,7 @@ func (client *SyncGroupsClient) Delete(ctx context.Context, resourceGroupName st } // deleteCreateRequest creates the Delete request. -func (client *SyncGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, options *SyncGroupsClientDeleteOptions) (*policy.Request, error) { +func (client *SyncGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, _ *SyncGroupsClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -173,9 +173,8 @@ func (client *SyncGroupsClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -183,10 +182,10 @@ func (client *SyncGroupsClient) deleteCreateRequest(ctx context.Context, resourc func (client *SyncGroupsClient) deleteHandleResponse(resp *http.Response) (SyncGroupsClientDeleteResponse, error) { result := SyncGroupsClientDeleteResponse{} if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { - result.XMSCorrelationRequestID = &val + result.CorrelationRequestID = &val } if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val + result.RequestID = &val } return result, nil } @@ -194,7 +193,7 @@ func (client *SyncGroupsClient) deleteHandleResponse(resp *http.Response) (SyncG // Get - Get a given SyncGroup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - syncGroupName - Name of Sync Group resource. @@ -222,7 +221,7 @@ func (client *SyncGroupsClient) Get(ctx context.Context, resourceGroupName strin } // getCreateRequest creates the Get request. -func (client *SyncGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, options *SyncGroupsClientGetOptions) (*policy.Request, error) { +func (client *SyncGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, _ *SyncGroupsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -245,7 +244,7 @@ func (client *SyncGroupsClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -255,10 +254,10 @@ func (client *SyncGroupsClient) getCreateRequest(ctx context.Context, resourceGr func (client *SyncGroupsClient) getHandleResponse(resp *http.Response) (SyncGroupsClientGetResponse, error) { result := SyncGroupsClientGetResponse{} if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { - result.XMSCorrelationRequestID = &val + result.CorrelationRequestID = &val } if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val + result.RequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.SyncGroup); err != nil { return SyncGroupsClientGetResponse{}, err @@ -268,7 +267,7 @@ func (client *SyncGroupsClient) getHandleResponse(resp *http.Response) (SyncGrou // NewListByStorageSyncServicePager - Get a SyncGroup List. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - options - SyncGroupsClientListByStorageSyncServiceOptions contains the optional parameters for the SyncGroupsClient.NewListByStorageSyncServicePager @@ -276,21 +275,20 @@ func (client *SyncGroupsClient) getHandleResponse(resp *http.Response) (SyncGrou func (client *SyncGroupsClient) NewListByStorageSyncServicePager(resourceGroupName string, storageSyncServiceName string, options *SyncGroupsClientListByStorageSyncServiceOptions) *runtime.Pager[SyncGroupsClientListByStorageSyncServiceResponse] { return runtime.NewPager(runtime.PagingHandler[SyncGroupsClientListByStorageSyncServiceResponse]{ More: func(page SyncGroupsClientListByStorageSyncServiceResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *SyncGroupsClientListByStorageSyncServiceResponse) (SyncGroupsClientListByStorageSyncServiceResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SyncGroupsClient.NewListByStorageSyncServicePager") - req, err := client.listByStorageSyncServiceCreateRequest(ctx, resourceGroupName, storageSyncServiceName, options) - if err != nil { - return SyncGroupsClientListByStorageSyncServiceResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByStorageSyncServiceCreateRequest(ctx, resourceGroupName, storageSyncServiceName, options) + }, nil) if err != nil { return SyncGroupsClientListByStorageSyncServiceResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SyncGroupsClientListByStorageSyncServiceResponse{}, runtime.NewResponseError(resp) - } return client.listByStorageSyncServiceHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -298,7 +296,7 @@ func (client *SyncGroupsClient) NewListByStorageSyncServicePager(resourceGroupNa } // listByStorageSyncServiceCreateRequest creates the ListByStorageSyncService request. -func (client *SyncGroupsClient) listByStorageSyncServiceCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, options *SyncGroupsClientListByStorageSyncServiceOptions) (*policy.Request, error) { +func (client *SyncGroupsClient) listByStorageSyncServiceCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, _ *SyncGroupsClientListByStorageSyncServiceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -317,7 +315,7 @@ func (client *SyncGroupsClient) listByStorageSyncServiceCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -327,10 +325,10 @@ func (client *SyncGroupsClient) listByStorageSyncServiceCreateRequest(ctx contex func (client *SyncGroupsClient) listByStorageSyncServiceHandleResponse(resp *http.Response) (SyncGroupsClientListByStorageSyncServiceResponse, error) { result := SyncGroupsClientListByStorageSyncServiceResponse{} if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { - result.XMSCorrelationRequestID = &val + result.CorrelationRequestID = &val } if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val + result.RequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.SyncGroupArray); err != nil { return SyncGroupsClientListByStorageSyncServiceResponse{}, err diff --git a/sdk/resourcemanager/storagesync/armstoragesync/syncgroups_client_example_test.go b/sdk/resourcemanager/storagesync/armstoragesync/syncgroups_client_example_test.go index ecd023b3454f..fc7d6024b528 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/syncgroups_client_example_test.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/syncgroups_client_example_test.go @@ -1,94 +1,80 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armstoragesync_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_ListByStorageSyncService.json -func ExampleSyncGroupsClient_NewListByStorageSyncServicePager() { +// Generated from example definition: 2022-09-01/SyncGroups_Create.json +func ExampleSyncGroupsClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewSyncGroupsClient().NewListByStorageSyncServicePager("SampleResourceGroup_1", "SampleStorageSyncService_1", 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.SyncGroupArray = armstoragesync.SyncGroupArray{ - // Value: []*armstoragesync.SyncGroup{ - // { - // Name: to.Ptr("SampleSyncGroup_1"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups"), - // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SSS_Restore_08-08_Test112/syncGroups/SampleSyncGroup_1"), - // Properties: &armstoragesync.SyncGroupProperties{ - // SyncGroupStatus: to.Ptr("0"), - // UniqueID: to.Ptr("191660cd-6a1a-4f8c-9787-a6bed206a1dd"), - // }, - // }}, - // } + res, err := clientFactory.NewSyncGroupsClient().Create(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "SampleSyncGroup_1", armstoragesync.SyncGroupCreateParameters{ + Properties: map[string]any{}, + }, 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 = armstoragesync.SyncGroupsClientCreateResponse{ + // SyncGroup: &armstoragesync.SyncGroup{ + // Name: to.Ptr("SampleSyncGroup_1"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups"), + // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/syncGroups/SampleSyncGroup_1"), + // Properties: &armstoragesync.SyncGroupProperties{ + // UniqueID: to.Ptr("7868e4ee-8ddd-4a2d-941b-0041f6052a8a"), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_Create.json -func ExampleSyncGroupsClient_Create() { +// Generated from example definition: 2022-09-01/SyncGroups_Delete.json +func ExampleSyncGroupsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewSyncGroupsClient().Create(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "SampleSyncGroup_1", armstoragesync.SyncGroupCreateParameters{ - Properties: map[string]any{}, - }, nil) + res, err := clientFactory.NewSyncGroupsClient().Delete(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "SampleSyncGroup_1", 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.SyncGroup = armstoragesync.SyncGroup{ - // Name: to.Ptr("SampleSyncGroup_1"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups"), - // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/syncGroups/SampleSyncGroup_1"), - // Properties: &armstoragesync.SyncGroupProperties{ - // UniqueID: to.Ptr("7868e4ee-8ddd-4a2d-941b-0041f6052a8a"), - // }, + // res = armstoragesync.SyncGroupsClientDeleteResponse{ + // CorrelationRequestID: "d166ca76-dad2-49df-b409-d2acfd42d730" + // RequestID: "74e55a4d-1c6f-46de-9a8d-278e53a47403" // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_Get.json +// Generated from example definition: 2022-09-01/SyncGroups_Get.json func ExampleSyncGroupsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -99,30 +85,59 @@ func ExampleSyncGroupsClient_Get() { // 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.SyncGroup = armstoragesync.SyncGroup{ - // Name: to.Ptr("SampleSyncGroup_1"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups"), - // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SSS_Restore_08-08_Test112/syncGroups/SampleSyncGroup_1"), - // Properties: &armstoragesync.SyncGroupProperties{ - // SyncGroupStatus: to.Ptr("0"), - // UniqueID: to.Ptr("191660cd-6a1a-4f8c-9787-a6bed206a1dd"), + // res = armstoragesync.SyncGroupsClientGetResponse{ + // CorrelationRequestID: "d166ca76-dad2-49df-b409-d2acfd42d730" + // RequestID: "74e55a4d-1c6f-46de-9a8d-278e53a47403" + // SyncGroup: &armstoragesync.SyncGroup{ + // Name: to.Ptr("SampleSyncGroup_1"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups"), + // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SSS_Restore_08-08_Test112/syncGroups/SampleSyncGroup_1"), + // Properties: &armstoragesync.SyncGroupProperties{ + // SyncGroupStatus: to.Ptr("0"), + // UniqueID: to.Ptr("191660cd-6a1a-4f8c-9787-a6bed206a1dd"), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_Delete.json -func ExampleSyncGroupsClient_Delete() { +// Generated from example definition: 2022-09-01/SyncGroups_ListByStorageSyncService.json +func ExampleSyncGroupsClient_NewListByStorageSyncServicePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = clientFactory.NewSyncGroupsClient().Delete(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "SampleSyncGroup_1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) + pager := clientFactory.NewSyncGroupsClient().NewListByStorageSyncServicePager("SampleResourceGroup_1", "SampleStorageSyncService_1", 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 = armstoragesync.SyncGroupsClientListByStorageSyncServiceResponse{ + // CorrelationRequestID: "d166ca76-dad2-49df-b409-d2acfd42d730" + // RequestID: "74e55a4d-1c6f-46de-9a8d-278e53a47403" + // SyncGroupArray: armstoragesync.SyncGroupArray{ + // Value: []*armstoragesync.SyncGroup{ + // { + // Name: to.Ptr("SampleSyncGroup_1"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/syncGroups"), + // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SSS_Restore_08-08_Test112/syncGroups/SampleSyncGroup_1"), + // Properties: &armstoragesync.SyncGroupProperties{ + // SyncGroupStatus: to.Ptr("0"), + // UniqueID: to.Ptr("191660cd-6a1a-4f8c-9787-a6bed206a1dd"), + // }, + // }, + // }, + // }, + // } } } diff --git a/sdk/resourcemanager/storagesync/armstoragesync/testdata/_metadata.json b/sdk/resourcemanager/storagesync/armstoragesync/testdata/_metadata.json new file mode 100644 index 000000000000..196d863cf9d6 --- /dev/null +++ b/sdk/resourcemanager/storagesync/armstoragesync/testdata/_metadata.json @@ -0,0 +1,6 @@ +{ + "apiVersions": { + "Microsoft.StorageSync": "2022-09-01" + }, + "emitterVersion": "0.10.2" +} diff --git a/sdk/resourcemanager/storagesync/armstoragesync/time_rfc3339.go b/sdk/resourcemanager/storagesync/armstoragesync/time_rfc3339.go deleted file mode 100644 index 597b119531fc..000000000000 --- a/sdk/resourcemanager/storagesync/armstoragesync/time_rfc3339.go +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights 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 armstoragesync - -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/storagesync/armstoragesync/tsp-location.yaml b/sdk/resourcemanager/storagesync/armstoragesync/tsp-location.yaml new file mode 100644 index 000000000000..e398a749deae --- /dev/null +++ b/sdk/resourcemanager/storagesync/armstoragesync/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync +commit: aa822c9c01b9e83fbc8ad8ec4c308203a3c29287 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/resourcemanager/storagesync/armstoragesync/version.go b/sdk/resourcemanager/storagesync/armstoragesync/version.go new file mode 100644 index 000000000000..a8a46cb8ad53 --- /dev/null +++ b/sdk/resourcemanager/storagesync/armstoragesync/version.go @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft 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. + +package armstoragesync + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync" + moduleVersion = "v2.0.0-beta.1" +) diff --git a/sdk/resourcemanager/storagesync/armstoragesync/workflows_client.go b/sdk/resourcemanager/storagesync/armstoragesync/workflows_client.go index 741b1b479ad8..7f22fd6da07a 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/workflows_client.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/workflows_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) 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 armstoragesync @@ -25,9 +24,9 @@ type WorkflowsClient struct { } // NewWorkflowsClient creates a new instance of WorkflowsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewWorkflowsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkflowsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -43,7 +42,7 @@ func NewWorkflowsClient(subscriptionID string, credential azcore.TokenCredential // Abort - Abort the given workflow. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - workflowID - workflow Id @@ -71,7 +70,7 @@ func (client *WorkflowsClient) Abort(ctx context.Context, resourceGroupName stri } // abortCreateRequest creates the Abort request. -func (client *WorkflowsClient) abortCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, workflowID string, options *WorkflowsClientAbortOptions) (*policy.Request, error) { +func (client *WorkflowsClient) abortCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, workflowID string, _ *WorkflowsClientAbortOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}/abort" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -94,9 +93,8 @@ func (client *WorkflowsClient) abortCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -104,10 +102,10 @@ func (client *WorkflowsClient) abortCreateRequest(ctx context.Context, resourceG func (client *WorkflowsClient) abortHandleResponse(resp *http.Response) (WorkflowsClientAbortResponse, error) { result := WorkflowsClientAbortResponse{} if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { - result.XMSCorrelationRequestID = &val + result.CorrelationRequestID = &val } if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val + result.RequestID = &val } return result, nil } @@ -115,7 +113,7 @@ func (client *WorkflowsClient) abortHandleResponse(resp *http.Response) (Workflo // Get - Get Workflows resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - workflowID - workflow Id @@ -143,7 +141,7 @@ func (client *WorkflowsClient) Get(ctx context.Context, resourceGroupName string } // getCreateRequest creates the Get request. -func (client *WorkflowsClient) getCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, workflowID string, options *WorkflowsClientGetOptions) (*policy.Request, error) { +func (client *WorkflowsClient) getCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, workflowID string, _ *WorkflowsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -166,7 +164,7 @@ func (client *WorkflowsClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -176,10 +174,10 @@ func (client *WorkflowsClient) getCreateRequest(ctx context.Context, resourceGro func (client *WorkflowsClient) getHandleResponse(resp *http.Response) (WorkflowsClientGetResponse, error) { result := WorkflowsClientGetResponse{} if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { - result.XMSCorrelationRequestID = &val + result.CorrelationRequestID = &val } if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val + result.RequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.Workflow); err != nil { return WorkflowsClientGetResponse{}, err @@ -189,7 +187,7 @@ func (client *WorkflowsClient) getHandleResponse(resp *http.Response) (Workflows // NewListByStorageSyncServicePager - Get a Workflow List // -// Generated from API version 2020-09-01 +// Generated from API version 2022-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageSyncServiceName - Name of Storage Sync Service resource. // - options - WorkflowsClientListByStorageSyncServiceOptions contains the optional parameters for the WorkflowsClient.NewListByStorageSyncServicePager @@ -197,21 +195,20 @@ func (client *WorkflowsClient) getHandleResponse(resp *http.Response) (Workflows func (client *WorkflowsClient) NewListByStorageSyncServicePager(resourceGroupName string, storageSyncServiceName string, options *WorkflowsClientListByStorageSyncServiceOptions) *runtime.Pager[WorkflowsClientListByStorageSyncServiceResponse] { return runtime.NewPager(runtime.PagingHandler[WorkflowsClientListByStorageSyncServiceResponse]{ More: func(page WorkflowsClientListByStorageSyncServiceResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *WorkflowsClientListByStorageSyncServiceResponse) (WorkflowsClientListByStorageSyncServiceResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WorkflowsClient.NewListByStorageSyncServicePager") - req, err := client.listByStorageSyncServiceCreateRequest(ctx, resourceGroupName, storageSyncServiceName, options) - if err != nil { - return WorkflowsClientListByStorageSyncServiceResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByStorageSyncServiceCreateRequest(ctx, resourceGroupName, storageSyncServiceName, options) + }, nil) if err != nil { return WorkflowsClientListByStorageSyncServiceResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return WorkflowsClientListByStorageSyncServiceResponse{}, runtime.NewResponseError(resp) - } return client.listByStorageSyncServiceHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -219,7 +216,7 @@ func (client *WorkflowsClient) NewListByStorageSyncServicePager(resourceGroupNam } // listByStorageSyncServiceCreateRequest creates the ListByStorageSyncService request. -func (client *WorkflowsClient) listByStorageSyncServiceCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, options *WorkflowsClientListByStorageSyncServiceOptions) (*policy.Request, error) { +func (client *WorkflowsClient) listByStorageSyncServiceCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, _ *WorkflowsClientListByStorageSyncServiceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -238,7 +235,7 @@ func (client *WorkflowsClient) listByStorageSyncServiceCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-09-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -248,10 +245,10 @@ func (client *WorkflowsClient) listByStorageSyncServiceCreateRequest(ctx context func (client *WorkflowsClient) listByStorageSyncServiceHandleResponse(resp *http.Response) (WorkflowsClientListByStorageSyncServiceResponse, error) { result := WorkflowsClientListByStorageSyncServiceResponse{} if val := resp.Header.Get("x-ms-correlation-request-id"); val != "" { - result.XMSCorrelationRequestID = &val + result.CorrelationRequestID = &val } if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val + result.RequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowArray); err != nil { return WorkflowsClientListByStorageSyncServiceResponse{}, err diff --git a/sdk/resourcemanager/storagesync/armstoragesync/workflows_client_example_test.go b/sdk/resourcemanager/storagesync/armstoragesync/workflows_client_example_test.go index 827a4e644b68..a300e758523c 100644 --- a/sdk/resourcemanager/storagesync/armstoragesync/workflows_client_example_test.go +++ b/sdk/resourcemanager/storagesync/armstoragesync/workflows_client_example_test.go @@ -1,67 +1,48 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for 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 armstoragesync_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagesync/armstoragesync/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/Workflows_ListByStorageSyncService.json -func ExampleWorkflowsClient_NewListByStorageSyncServicePager() { +// Generated from example definition: 2022-09-01/Workflows_Abort.json +func ExampleWorkflowsClient_Abort() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewWorkflowsClient().NewListByStorageSyncServicePager("SampleResourceGroup_1", "SampleStorageSyncService_1", 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.WorkflowArray = armstoragesync.WorkflowArray{ - // Value: []*armstoragesync.Workflow{ - // { - // Name: to.Ptr("828219ea-083e-48b5-89ea-8fd9991b2e75"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/workflows"), - // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/workflows/828219ea-083e-48b5-89ea-8fd9991b2e75"), - // Properties: &armstoragesync.WorkflowProperties{ - // LastOperationID: to.Ptr("\"fe680c98-5725-49c8-b0dc-5e29745f752b\""), - // LastStepName: to.Ptr("runServerJob"), - // Operation: to.Ptr(armstoragesync.OperationDirectionDo), - // Status: to.Ptr(armstoragesync.WorkflowStatusSucceeded), - // Steps: to.Ptr("[{\"name\":\"validateInput\",\"friendlyName\":\"validateInput\",\"status\":\"Succeeded\",\"error\":null},{\"name\":\"newServerEndpoint\",\"friendlyName\":\"newServerEndpoint\",\"status\":\"Succeeded\",\"error\":null},{\"name\":\"updateReplicaGroupCertificates\",\"friendlyName\":\"updateReplicaGroupCertificates\",\"status\":\"Succeeded\",\"error\":null},{\"name\":\"runServerJob\",\"friendlyName\":\"runServerJob\",\"status\":\"Succeeded\",\"error\":null}]"), - // }, - // }}, - // } + res, err := clientFactory.NewWorkflowsClient().Abort(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "7ffd50b3-5574-478d-9ff2-9371bc42ce68", 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 = armstoragesync.WorkflowsClientAbortResponse{ + // CorrelationRequestID: "d166ca76-dad2-49df-b409-d2acfd42d730" + // RequestID: "74e55a4d-1c6f-46de-9a8d-278e53a47403" + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/Workflows_Get.json +// Generated from example definition: 2022-09-01/Workflows_Get.json func ExampleWorkflowsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -72,36 +53,68 @@ func ExampleWorkflowsClient_Get() { // 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.Workflow = armstoragesync.Workflow{ - // Name: to.Ptr("828219ea-083e-48b5-89ea-8fd9991b2e75"), - // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/workflows"), - // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/workflows/828219ea-083e-48b5-89ea-8fd9991b2e75"), - // Properties: &armstoragesync.WorkflowProperties{ - // CommandName: to.Ptr("ICreateServerEndpointWorkflow"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.195Z"); return t}()), - // LastOperationID: to.Ptr("\"fe680c98-5725-49c8-b0dc-5e29745f752b\""), - // LastStatusTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.195Z"); return t}()), - // LastStepName: to.Ptr("runServerJob"), - // Operation: to.Ptr(armstoragesync.OperationDirectionDo), - // Status: to.Ptr(armstoragesync.WorkflowStatusSucceeded), - // Steps: to.Ptr("[{\"name\":\"validateInput\",\"friendlyName\":\"validateInput\",\"status\":\"Succeeded\",\"error\":null},{\"name\":\"newServerEndpoint\",\"friendlyName\":\"newServerEndpoint\",\"status\":\"Succeeded\",\"error\":null},{\"name\":\"updateReplicaGroupCertificates\",\"friendlyName\":\"updateReplicaGroupCertificates\",\"status\":\"Succeeded\",\"error\":null},{\"name\":\"runServerJob\",\"friendlyName\":\"runServerJob\",\"status\":\"Succeeded\",\"error\":null}]"), + // res = armstoragesync.WorkflowsClientGetResponse{ + // CorrelationRequestID: "d166ca76-dad2-49df-b409-d2acfd42d730" + // RequestID: "74e55a4d-1c6f-46de-9a8d-278e53a47403" + // Workflow: &armstoragesync.Workflow{ + // Name: to.Ptr("828219ea-083e-48b5-89ea-8fd9991b2e75"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/workflows"), + // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/workflows/828219ea-083e-48b5-89ea-8fd9991b2e75"), + // Properties: &armstoragesync.WorkflowProperties{ + // CommandName: to.Ptr("ICreateServerEndpointWorkflow"), + // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // LastOperationID: to.Ptr("\"fe680c98-5725-49c8-b0dc-5e29745f752b\""), + // LastStatusTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-17T19:04:59.1959227Z"); return t}()), + // LastStepName: to.Ptr("runServerJob"), + // Operation: to.Ptr(armstoragesync.OperationDirectionDo), + // Status: to.Ptr(armstoragesync.WorkflowStatusSucceeded), + // Steps: to.Ptr("[{\"name\":\"validateInput\",\"friendlyName\":\"validateInput\",\"status\":\"Succeeded\",\"error\":null},{\"name\":\"newServerEndpoint\",\"friendlyName\":\"newServerEndpoint\",\"status\":\"Succeeded\",\"error\":null},{\"name\":\"updateReplicaGroupCertificates\",\"friendlyName\":\"updateReplicaGroupCertificates\",\"status\":\"Succeeded\",\"error\":null},{\"name\":\"runServerJob\",\"friendlyName\":\"runServerJob\",\"status\":\"Succeeded\",\"error\":null}]"), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/Workflows_Abort.json -func ExampleWorkflowsClient_Abort() { +// Generated from example definition: 2022-09-01/Workflows_ListByStorageSyncService.json +func ExampleWorkflowsClient_NewListByStorageSyncServicePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstoragesync.NewClientFactory("", cred, nil) + clientFactory, err := armstoragesync.NewClientFactory("52b8da2f-61e0-4a1f-8dde-336911f367fb", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = clientFactory.NewWorkflowsClient().Abort(ctx, "SampleResourceGroup_1", "SampleStorageSyncService_1", "7ffd50b3-5574-478d-9ff2-9371bc42ce68", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) + pager := clientFactory.NewWorkflowsClient().NewListByStorageSyncServicePager("SampleResourceGroup_1", "SampleStorageSyncService_1", 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 = armstoragesync.WorkflowsClientListByStorageSyncServiceResponse{ + // CorrelationRequestID: "d166ca76-dad2-49df-b409-d2acfd42d730" + // RequestID: "74e55a4d-1c6f-46de-9a8d-278e53a47403" + // WorkflowArray: armstoragesync.WorkflowArray{ + // Value: []*armstoragesync.Workflow{ + // { + // Name: to.Ptr("828219ea-083e-48b5-89ea-8fd9991b2e75"), + // Type: to.Ptr("Microsoft.StorageSync/storageSyncServices/workflows"), + // ID: to.Ptr("/subscriptions/3a048283-338f-4002-a9dd-a50fdadcb392/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/workflows/828219ea-083e-48b5-89ea-8fd9991b2e75"), + // Properties: &armstoragesync.WorkflowProperties{ + // LastOperationID: to.Ptr("\"fe680c98-5725-49c8-b0dc-5e29745f752b\""), + // LastStepName: to.Ptr("runServerJob"), + // Operation: to.Ptr(armstoragesync.OperationDirectionDo), + // Status: to.Ptr(armstoragesync.WorkflowStatusSucceeded), + // Steps: to.Ptr("[{\"name\":\"validateInput\",\"friendlyName\":\"validateInput\",\"status\":\"Succeeded\",\"error\":null},{\"name\":\"newServerEndpoint\",\"friendlyName\":\"newServerEndpoint\",\"status\":\"Succeeded\",\"error\":null},{\"name\":\"updateReplicaGroupCertificates\",\"friendlyName\":\"updateReplicaGroupCertificates\",\"status\":\"Succeeded\",\"error\":null},{\"name\":\"runServerJob\",\"friendlyName\":\"runServerJob\",\"status\":\"Succeeded\",\"error\":null}]"), + // }, + // }, + // }, + // }, + // } } }