diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/CHANGELOG.md b/sdk/resourcemanager/elasticsan/armelasticsan/CHANGELOG.md index 07c674d2632c..66a23bd52c17 100644 --- a/sdk/resourcemanager/elasticsan/armelasticsan/CHANGELOG.md +++ b/sdk/resourcemanager/elasticsan/armelasticsan/CHANGELOG.md @@ -1,5 +1,51 @@ # Release History +## 1.0.0 (2023-09-21) +### Breaking Changes + +- Type of `SourceCreationData.CreateSource` has been changed from `*string` to `*VolumeCreateOption` +- Type of `VirtualNetworkRule.Action` has been changed from `*string` to `*Action` +- Enum `State` has been removed +- Field `SourceURI` of struct `SourceCreationData` has been removed +- Field `State` of struct `VirtualNetworkRule` has been removed + +### Features Added + +- New value `EncryptionTypeEncryptionAtRestWithCustomerManagedKey` added to enum type `EncryptionType` +- New enum type `Action` with values `ActionAllow` +- New enum type `IdentityType` with values `IdentityTypeNone`, `IdentityTypeSystemAssigned`, `IdentityTypeUserAssigned` +- New enum type `PublicNetworkAccess` with values `PublicNetworkAccessDisabled`, `PublicNetworkAccessEnabled` +- New enum type `VolumeCreateOption` with values `VolumeCreateOptionDisk`, `VolumeCreateOptionDiskRestorePoint`, `VolumeCreateOptionDiskSnapshot`, `VolumeCreateOptionNone`, `VolumeCreateOptionVolumeSnapshot` +- New enum type `XMSDeleteSnapshots` with values `XMSDeleteSnapshotsFalse`, `XMSDeleteSnapshotsTrue` +- New enum type `XMSForceDelete` with values `XMSForceDeleteFalse`, `XMSForceDeleteTrue` +- New function `*ClientFactory.NewVolumeSnapshotsClient() *VolumeSnapshotsClient` +- New function `NewVolumeSnapshotsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VolumeSnapshotsClient, error)` +- New function `*VolumeSnapshotsClient.BeginCreate(context.Context, string, string, string, string, Snapshot, *VolumeSnapshotsClientBeginCreateOptions) (*runtime.Poller[VolumeSnapshotsClientCreateResponse], error)` +- New function `*VolumeSnapshotsClient.BeginDelete(context.Context, string, string, string, string, *VolumeSnapshotsClientBeginDeleteOptions) (*runtime.Poller[VolumeSnapshotsClientDeleteResponse], error)` +- New function `*VolumeSnapshotsClient.Get(context.Context, string, string, string, string, *VolumeSnapshotsClientGetOptions) (VolumeSnapshotsClientGetResponse, error)` +- New function `*VolumeSnapshotsClient.NewListByVolumeGroupPager(string, string, string, *VolumeSnapshotsClientListByVolumeGroupOptions) *runtime.Pager[VolumeSnapshotsClientListByVolumeGroupResponse]` +- New struct `EncryptionIdentity` +- New struct `EncryptionProperties` +- New struct `Identity` +- New struct `KeyVaultProperties` +- New struct `ManagedByInfo` +- New struct `Snapshot` +- New struct `SnapshotCreationData` +- New struct `SnapshotList` +- New struct `SnapshotProperties` +- New struct `UserAssignedIdentity` +- New field `PublicNetworkAccess` in struct `Properties` +- New field `SourceID` in struct `SourceCreationData` +- New field `PublicNetworkAccess` in struct `UpdateProperties` +- New field `Identity` in struct `VolumeGroup` +- New field `EncryptionProperties` in struct `VolumeGroupProperties` +- New field `Identity` in struct `VolumeGroupUpdate` +- New field `EncryptionProperties` in struct `VolumeGroupUpdateProperties` +- New field `ManagedBy`, `ProvisioningState` in struct `VolumeProperties` +- New field `ManagedBy` in struct `VolumeUpdateProperties` +- New field `XMSDeleteSnapshots`, `XMSForceDelete` in struct `VolumesClientBeginDeleteOptions` + + ## 0.3.0 (2023-07-28) ### Breaking Changes diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/autorest.md b/sdk/resourcemanager/elasticsan/armelasticsan/autorest.md index 8bcc8e1e975d..125560587558 100644 --- a/sdk/resourcemanager/elasticsan/armelasticsan/autorest.md +++ b/sdk/resourcemanager/elasticsan/armelasticsan/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/elasticsan/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/elasticsan/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.3.0 -tag: package-preview-2022-12 +module-version: 1.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/client_factory.go b/sdk/resourcemanager/elasticsan/armelasticsan/client_factory.go index ec928cfdf736..f23d7283f8d4 100644 --- a/sdk/resourcemanager/elasticsan/armelasticsan/client_factory.go +++ b/sdk/resourcemanager/elasticsan/armelasticsan/client_factory.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// 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. -// DO NOT EDIT. package armelasticsan @@ -38,37 +37,42 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } +func (c *ClientFactory) NewElasticSansClient() *ElasticSansClient { + subClient, _ := NewElasticSansClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewOperationsClient() *OperationsClient { subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewSKUsClient() *SKUsClient { - subClient, _ := NewSKUsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewElasticSansClient() *ElasticSansClient { - subClient, _ := NewElasticSansClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { + subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewVolumeGroupsClient() *VolumeGroupsClient { - subClient, _ := NewVolumeGroupsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewSKUsClient() *SKUsClient { + subClient, _ := NewSKUsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewVolumesClient() *VolumesClient { - subClient, _ := NewVolumesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVolumeGroupsClient() *VolumeGroupsClient { + subClient, _ := NewVolumeGroupsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVolumeSnapshotsClient() *VolumeSnapshotsClient { + subClient, _ := NewVolumeSnapshotsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { - subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVolumesClient() *VolumesClient { + subClient, _ := NewVolumesClient(c.subscriptionID, c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/constants.go b/sdk/resourcemanager/elasticsan/armelasticsan/constants.go index e516751cbc96..a39d9f505091 100644 --- a/sdk/resourcemanager/elasticsan/armelasticsan/constants.go +++ b/sdk/resourcemanager/elasticsan/armelasticsan/constants.go @@ -3,17 +3,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. +// 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. -// DO NOT EDIT. package armelasticsan const ( moduleName = "armelasticsan" - moduleVersion = "v0.3.0" + moduleVersion = "v1.0.0" ) +// Action - The action of virtual network rule. +type Action string + +const ( + ActionAllow Action = "Allow" +) + +// PossibleActionValues returns the possible values for the Action const type. +func PossibleActionValues() []Action { + return []Action{ + ActionAllow, + } +} + // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. type ActionType string @@ -52,6 +65,9 @@ func PossibleCreatedByTypeValues() []CreatedByType { type EncryptionType string const ( + // EncryptionTypeEncryptionAtRestWithCustomerManagedKey - Volume is encrypted at rest with Customer managed key that can be + // changed and revoked by a customer. + EncryptionTypeEncryptionAtRestWithCustomerManagedKey EncryptionType = "EncryptionAtRestWithCustomerManagedKey" // EncryptionTypeEncryptionAtRestWithPlatformKey - Volume is encrypted at rest with Platform managed key. It is the default // encryption type. EncryptionTypeEncryptionAtRestWithPlatformKey EncryptionType = "EncryptionAtRestWithPlatformKey" @@ -60,10 +76,29 @@ const ( // PossibleEncryptionTypeValues returns the possible values for the EncryptionType const type. func PossibleEncryptionTypeValues() []EncryptionType { return []EncryptionType{ + EncryptionTypeEncryptionAtRestWithCustomerManagedKey, EncryptionTypeEncryptionAtRestWithPlatformKey, } } +// IdentityType - The identity type. +type IdentityType string + +const ( + IdentityTypeNone IdentityType = "None" + IdentityTypeSystemAssigned IdentityType = "SystemAssigned" + IdentityTypeUserAssigned IdentityType = "UserAssigned" +) + +// PossibleIdentityTypeValues returns the possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{ + IdentityTypeNone, + IdentityTypeSystemAssigned, + IdentityTypeUserAssigned, + } +} + // OperationalStatus - Operational status of the resource. type OperationalStatus string @@ -159,6 +194,23 @@ func PossibleProvisioningStatesValues() []ProvisioningStates { } } +// PublicNetworkAccess - Allow or disallow public network access to ElasticSan. Value is optional but if passed in, must be +// 'Enabled' or 'Disabled'. +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{ + PublicNetworkAccessDisabled, + PublicNetworkAccessEnabled, + } +} + // SKUName - The sku name. type SKUName string @@ -192,28 +244,6 @@ func PossibleSKUTierValues() []SKUTier { } } -// State - Gets the state of virtual network rule. -type State string - -const ( - StateProvisioning State = "provisioning" - StateDeprovisioning State = "deprovisioning" - StateSucceeded State = "succeeded" - StateFailed State = "failed" - StateNetworkSourceDeleted State = "networkSourceDeleted" -) - -// PossibleStateValues returns the possible values for the State const type. -func PossibleStateValues() []State { - return []State{ - StateProvisioning, - StateDeprovisioning, - StateSucceeded, - StateFailed, - StateNetworkSourceDeleted, - } -} - // StorageTargetType - Storage Target type. type StorageTargetType string @@ -229,3 +259,55 @@ func PossibleStorageTargetTypeValues() []StorageTargetType { StorageTargetTypeNone, } } + +// VolumeCreateOption - This enumerates the possible sources of a volume creation. +type VolumeCreateOption string + +const ( + VolumeCreateOptionDisk VolumeCreateOption = "Disk" + VolumeCreateOptionDiskRestorePoint VolumeCreateOption = "DiskRestorePoint" + VolumeCreateOptionDiskSnapshot VolumeCreateOption = "DiskSnapshot" + VolumeCreateOptionNone VolumeCreateOption = "None" + VolumeCreateOptionVolumeSnapshot VolumeCreateOption = "VolumeSnapshot" +) + +// PossibleVolumeCreateOptionValues returns the possible values for the VolumeCreateOption const type. +func PossibleVolumeCreateOptionValues() []VolumeCreateOption { + return []VolumeCreateOption{ + VolumeCreateOptionDisk, + VolumeCreateOptionDiskRestorePoint, + VolumeCreateOptionDiskSnapshot, + VolumeCreateOptionNone, + VolumeCreateOptionVolumeSnapshot, + } +} + +type XMSDeleteSnapshots string + +const ( + XMSDeleteSnapshotsFalse XMSDeleteSnapshots = "false" + XMSDeleteSnapshotsTrue XMSDeleteSnapshots = "true" +) + +// PossibleXMSDeleteSnapshotsValues returns the possible values for the XMSDeleteSnapshots const type. +func PossibleXMSDeleteSnapshotsValues() []XMSDeleteSnapshots { + return []XMSDeleteSnapshots{ + XMSDeleteSnapshotsFalse, + XMSDeleteSnapshotsTrue, + } +} + +type XMSForceDelete string + +const ( + XMSForceDeleteFalse XMSForceDelete = "false" + XMSForceDeleteTrue XMSForceDelete = "true" +) + +// PossibleXMSForceDeleteValues returns the possible values for the XMSForceDelete const type. +func PossibleXMSForceDeleteValues() []XMSForceDelete { + return []XMSForceDelete{ + XMSForceDeleteFalse, + XMSForceDeleteTrue, + } +} diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/elasticsans_client.go b/sdk/resourcemanager/elasticsan/armelasticsan/elasticsans_client.go index f6be9e8f1d05..681a7d98cf72 100644 --- a/sdk/resourcemanager/elasticsan/armelasticsan/elasticsans_client.go +++ b/sdk/resourcemanager/elasticsan/armelasticsan/elasticsans_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// 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. -// DO NOT EDIT. package armelasticsan @@ -47,7 +46,7 @@ func NewElasticSansClient(subscriptionID string, credential azcore.TokenCredenti // BeginCreate - Create ElasticSan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - elasticSanName - The name of the ElasticSan. // - parameters - Elastic San object. @@ -58,9 +57,10 @@ func (client *ElasticSansClient) BeginCreate(ctx context.Context, resourceGroupN if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ElasticSansClientCreateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ElasticSansClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ElasticSansClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,20 +69,22 @@ func (client *ElasticSansClient) BeginCreate(ctx context.Context, resourceGroupN // Create - Create ElasticSan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 func (client *ElasticSansClient) create(ctx context.Context, resourceGroupName string, elasticSanName string, parameters ElasticSan, options *ElasticSansClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, elasticSanName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -105,16 +107,19 @@ func (client *ElasticSansClient) createCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete a Elastic San. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - elasticSanName - The name of the ElasticSan. // - options - ElasticSansClientBeginDeleteOptions contains the optional parameters for the ElasticSansClient.BeginDelete method. @@ -124,9 +129,10 @@ func (client *ElasticSansClient) BeginDelete(ctx context.Context, resourceGroupN if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ElasticSansClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ElasticSansClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ElasticSansClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -135,20 +141,22 @@ func (client *ElasticSansClient) BeginDelete(ctx context.Context, resourceGroupN // Delete - Delete a Elastic San. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 func (client *ElasticSansClient) deleteOperation(ctx context.Context, resourceGroupName string, elasticSanName string, options *ElasticSansClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, elasticSanName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -171,7 +179,7 @@ func (client *ElasticSansClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,23 +188,26 @@ func (client *ElasticSansClient) deleteCreateRequest(ctx context.Context, resour // Get - Get a ElasticSan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - elasticSanName - The name of the ElasticSan. // - options - ElasticSansClientGetOptions contains the optional parameters for the ElasticSansClient.Get method. func (client *ElasticSansClient) Get(ctx context.Context, resourceGroupName string, elasticSanName string, options *ElasticSansClientGetOptions) (ElasticSansClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, elasticSanName, options) if err != nil { return ElasticSansClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ElasticSansClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ElasticSansClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ElasticSansClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -219,7 +230,7 @@ func (client *ElasticSansClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -236,7 +247,7 @@ func (client *ElasticSansClient) getHandleResponse(resp *http.Response) (Elastic // NewListByResourceGroupPager - Gets a list of ElasticSan in a resource group. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ElasticSansClientListByResourceGroupOptions contains the optional parameters for the ElasticSansClient.NewListByResourceGroupPager // method. @@ -284,7 +295,7 @@ func (client *ElasticSansClient) listByResourceGroupCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -301,7 +312,7 @@ func (client *ElasticSansClient) listByResourceGroupHandleResponse(resp *http.Re // NewListBySubscriptionPager - Gets a list of ElasticSans in a subscription // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - options - ElasticSansClientListBySubscriptionOptions contains the optional parameters for the ElasticSansClient.NewListBySubscriptionPager // method. func (client *ElasticSansClient) NewListBySubscriptionPager(options *ElasticSansClientListBySubscriptionOptions) *runtime.Pager[ElasticSansClientListBySubscriptionResponse] { @@ -344,7 +355,7 @@ func (client *ElasticSansClient) listBySubscriptionCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -362,7 +373,7 @@ func (client *ElasticSansClient) listBySubscriptionHandleResponse(resp *http.Res // BeginUpdate - Update a Elastic San. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - elasticSanName - The name of the ElasticSan. // - parameters - Elastic San object. @@ -373,9 +384,10 @@ func (client *ElasticSansClient) BeginUpdate(ctx context.Context, resourceGroupN if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ElasticSansClientUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ElasticSansClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ElasticSansClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -384,20 +396,22 @@ func (client *ElasticSansClient) BeginUpdate(ctx context.Context, resourceGroupN // Update - Update a Elastic San. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 func (client *ElasticSansClient) update(ctx context.Context, resourceGroupName string, elasticSanName string, parameters Update, options *ElasticSansClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, elasticSanName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -420,8 +434,11 @@ func (client *ElasticSansClient) updateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/elasticsans_client_example_test.go b/sdk/resourcemanager/elasticsan/armelasticsan/elasticsans_client_example_test.go deleted file mode 100644 index bb68674bac7c..000000000000 --- a/sdk/resourcemanager/elasticsan/armelasticsan/elasticsans_client_example_test.go +++ /dev/null @@ -1,887 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armelasticsan_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/elasticsan/armelasticsan" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_ListBySubscription_MaximumSet_Gen.json -func ExampleElasticSansClient_NewListBySubscriptionPager_elasticSansListBySubscriptionMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewElasticSansClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.List = armelasticsan.List{ - // Value: []*armelasticsan.ElasticSan{ - // { - // Name: to.Ptr("vfoatmakv"), - // Type: to.Ptr("Microsoft.ElasticSan/ElasticSans"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Location: to.Ptr("France Central"), - // Tags: map[string]*string{ - // "key5002": to.Ptr("lhag"), - // }, - // Properties: &armelasticsan.Properties{ - // AvailabilityZones: []*string{ - // to.Ptr("1")}, - // BaseSizeTiB: to.Ptr[int64](15), - // ExtendedCapacitySizeTiB: to.Ptr[int64](6), - // PrivateEndpointConnections: []*armelasticsan.PrivateEndpointConnection{ - // { - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}")}, - // PrivateEndpoint: &armelasticsan.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}"), - // }, - // PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // SKU: &armelasticsan.SKU{ - // Name: to.Ptr(armelasticsan.SKUNamePremiumLRS), - // Tier: to.Ptr(armelasticsan.SKUTierPremium), - // }, - // TotalIops: to.Ptr[int64](22), - // TotalMBps: to.Ptr[int64](4), - // TotalSizeTiB: to.Ptr[int64](27), - // TotalVolumeSizeGiB: to.Ptr[int64](15), - // VolumeGroupCount: to.Ptr[int64](24), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_ListBySubscription_MinimumSet_Gen.json -func ExampleElasticSansClient_NewListBySubscriptionPager_elasticSansListBySubscriptionMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewElasticSansClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.List = armelasticsan.List{ - // Value: []*armelasticsan.ElasticSan{ - // { - // Name: to.Ptr("vfoatmakv"), - // Type: to.Ptr("Microsoft.ElasticSan/ElasticSans"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Location: to.Ptr("France Central"), - // Tags: map[string]*string{ - // "key5002": to.Ptr("lhag"), - // }, - // Properties: &armelasticsan.Properties{ - // AvailabilityZones: []*string{ - // to.Ptr("1")}, - // BaseSizeTiB: to.Ptr[int64](15), - // ExtendedCapacitySizeTiB: to.Ptr[int64](6), - // PrivateEndpointConnections: []*armelasticsan.PrivateEndpointConnection{ - // { - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}")}, - // PrivateEndpoint: &armelasticsan.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}"), - // }, - // PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // SKU: &armelasticsan.SKU{ - // Name: to.Ptr(armelasticsan.SKUNamePremiumLRS), - // Tier: to.Ptr(armelasticsan.SKUTierPremium), - // }, - // TotalIops: to.Ptr[int64](22), - // TotalMBps: to.Ptr[int64](4), - // TotalSizeTiB: to.Ptr[int64](27), - // TotalVolumeSizeGiB: to.Ptr[int64](15), - // VolumeGroupCount: to.Ptr[int64](24), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_ListByResourceGroup_MaximumSet_Gen.json -func ExampleElasticSansClient_NewListByResourceGroupPager_elasticSansListByResourceGroupMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewElasticSansClient().NewListByResourceGroupPager("resourcegroupname", 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.List = armelasticsan.List{ - // Value: []*armelasticsan.ElasticSan{ - // { - // Name: to.Ptr("vfoatmakv"), - // Type: to.Ptr("Microsoft.ElasticSan/ElasticSans"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Location: to.Ptr("France Central"), - // Tags: map[string]*string{ - // "key5002": to.Ptr("lhag"), - // }, - // Properties: &armelasticsan.Properties{ - // AvailabilityZones: []*string{ - // to.Ptr("1")}, - // BaseSizeTiB: to.Ptr[int64](15), - // ExtendedCapacitySizeTiB: to.Ptr[int64](6), - // PrivateEndpointConnections: []*armelasticsan.PrivateEndpointConnection{ - // { - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}")}, - // PrivateEndpoint: &armelasticsan.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}"), - // }, - // PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // SKU: &armelasticsan.SKU{ - // Name: to.Ptr(armelasticsan.SKUNamePremiumLRS), - // Tier: to.Ptr(armelasticsan.SKUTierPremium), - // }, - // TotalIops: to.Ptr[int64](22), - // TotalMBps: to.Ptr[int64](4), - // TotalSizeTiB: to.Ptr[int64](27), - // TotalVolumeSizeGiB: to.Ptr[int64](15), - // VolumeGroupCount: to.Ptr[int64](24), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_ListByResourceGroup_MinimumSet_Gen.json -func ExampleElasticSansClient_NewListByResourceGroupPager_elasticSansListByResourceGroupMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewElasticSansClient().NewListByResourceGroupPager("resourcegroupname", 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.List = armelasticsan.List{ - // Value: []*armelasticsan.ElasticSan{ - // { - // Name: to.Ptr("vfoatmakv"), - // Type: to.Ptr("Microsoft.ElasticSan/ElasticSans"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Location: to.Ptr("France Central"), - // Tags: map[string]*string{ - // "key5002": to.Ptr("lhag"), - // }, - // Properties: &armelasticsan.Properties{ - // AvailabilityZones: []*string{ - // to.Ptr("1")}, - // BaseSizeTiB: to.Ptr[int64](15), - // ExtendedCapacitySizeTiB: to.Ptr[int64](6), - // PrivateEndpointConnections: []*armelasticsan.PrivateEndpointConnection{ - // { - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}")}, - // PrivateEndpoint: &armelasticsan.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}"), - // }, - // PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // SKU: &armelasticsan.SKU{ - // Name: to.Ptr(armelasticsan.SKUNamePremiumLRS), - // Tier: to.Ptr(armelasticsan.SKUTierPremium), - // }, - // TotalIops: to.Ptr[int64](22), - // TotalMBps: to.Ptr[int64](4), - // TotalSizeTiB: to.Ptr[int64](27), - // TotalVolumeSizeGiB: to.Ptr[int64](15), - // VolumeGroupCount: to.Ptr[int64](24), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Create_MaximumSet_Gen.json -func ExampleElasticSansClient_BeginCreate_elasticSansCreateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewElasticSansClient().BeginCreate(ctx, "resourcegroupname", "elasticsanname", armelasticsan.ElasticSan{ - Location: to.Ptr("South Central US"), - Tags: map[string]*string{ - "key9316": to.Ptr("ihndtieqibtob"), - }, - Properties: &armelasticsan.Properties{ - AvailabilityZones: []*string{ - to.Ptr("1")}, - BaseSizeTiB: to.Ptr[int64](5), - ExtendedCapacitySizeTiB: to.Ptr[int64](25), - SKU: &armelasticsan.SKU{ - Name: to.Ptr(armelasticsan.SKUNamePremiumLRS), - Tier: to.Ptr(armelasticsan.SKUTierPremium), - }, - }, - }, 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.ElasticSan = armelasticsan.ElasticSan{ - // Name: to.Ptr("vfoatmakv"), - // Type: to.Ptr("Microsoft.ElasticSan/ElasticSans"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Location: to.Ptr("France Central"), - // Tags: map[string]*string{ - // "key5002": to.Ptr("lhag"), - // }, - // Properties: &armelasticsan.Properties{ - // AvailabilityZones: []*string{ - // to.Ptr("1")}, - // BaseSizeTiB: to.Ptr[int64](15), - // ExtendedCapacitySizeTiB: to.Ptr[int64](6), - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // SKU: &armelasticsan.SKU{ - // Name: to.Ptr(armelasticsan.SKUNamePremiumLRS), - // Tier: to.Ptr(armelasticsan.SKUTierPremium), - // }, - // TotalIops: to.Ptr[int64](22), - // TotalMBps: to.Ptr[int64](4), - // TotalSizeTiB: to.Ptr[int64](27), - // TotalVolumeSizeGiB: to.Ptr[int64](15), - // VolumeGroupCount: to.Ptr[int64](24), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Create_MinimumSet_Gen.json -func ExampleElasticSansClient_BeginCreate_elasticSansCreateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewElasticSansClient().BeginCreate(ctx, "resourcegroupname", "elasticsanname", armelasticsan.ElasticSan{ - Location: to.Ptr("South Central US"), - Properties: &armelasticsan.Properties{ - BaseSizeTiB: to.Ptr[int64](5), - ExtendedCapacitySizeTiB: to.Ptr[int64](25), - SKU: &armelasticsan.SKU{ - Name: to.Ptr(armelasticsan.SKUNamePremiumLRS), - }, - }, - }, 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.ElasticSan = armelasticsan.ElasticSan{ - // Name: to.Ptr("vfoatmakv"), - // Type: to.Ptr("Microsoft.ElasticSan/ElasticSans"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Location: to.Ptr("France Central"), - // Tags: map[string]*string{ - // "key5002": to.Ptr("lhag"), - // }, - // Properties: &armelasticsan.Properties{ - // AvailabilityZones: []*string{ - // to.Ptr("1")}, - // BaseSizeTiB: to.Ptr[int64](15), - // ExtendedCapacitySizeTiB: to.Ptr[int64](6), - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // SKU: &armelasticsan.SKU{ - // Name: to.Ptr(armelasticsan.SKUNamePremiumLRS), - // Tier: to.Ptr(armelasticsan.SKUTierPremium), - // }, - // TotalIops: to.Ptr[int64](22), - // TotalMBps: to.Ptr[int64](4), - // TotalSizeTiB: to.Ptr[int64](27), - // TotalVolumeSizeGiB: to.Ptr[int64](15), - // VolumeGroupCount: to.Ptr[int64](24), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Update_MaximumSet_Gen.json -func ExampleElasticSansClient_BeginUpdate_elasticSansUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewElasticSansClient().BeginUpdate(ctx, "resourcegroupname", "elasticsanname", armelasticsan.Update{ - Properties: &armelasticsan.UpdateProperties{ - BaseSizeTiB: to.Ptr[int64](10), - ExtendedCapacitySizeTiB: to.Ptr[int64](22), - }, - Tags: map[string]*string{ - "key4212": to.Ptr("cqvcnwfefljntgeio"), - }, - }, 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.ElasticSan = armelasticsan.ElasticSan{ - // Name: to.Ptr("vfoatmakv"), - // Type: to.Ptr("Microsoft.ElasticSan/ElasticSans"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Location: to.Ptr("France Central"), - // Tags: map[string]*string{ - // "key5002": to.Ptr("lhag"), - // }, - // Properties: &armelasticsan.Properties{ - // AvailabilityZones: []*string{ - // to.Ptr("1")}, - // BaseSizeTiB: to.Ptr[int64](15), - // ExtendedCapacitySizeTiB: to.Ptr[int64](6), - // PrivateEndpointConnections: []*armelasticsan.PrivateEndpointConnection{ - // { - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}")}, - // PrivateEndpoint: &armelasticsan.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}"), - // }, - // PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // SKU: &armelasticsan.SKU{ - // Name: to.Ptr(armelasticsan.SKUNamePremiumLRS), - // Tier: to.Ptr(armelasticsan.SKUTierPremium), - // }, - // TotalIops: to.Ptr[int64](22), - // TotalMBps: to.Ptr[int64](4), - // TotalSizeTiB: to.Ptr[int64](27), - // TotalVolumeSizeGiB: to.Ptr[int64](15), - // VolumeGroupCount: to.Ptr[int64](24), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Update_MinimumSet_Gen.json -func ExampleElasticSansClient_BeginUpdate_elasticSansUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewElasticSansClient().BeginUpdate(ctx, "resourcegroupname", "elasticsanname", armelasticsan.Update{}, 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.ElasticSan = armelasticsan.ElasticSan{ - // Name: to.Ptr("vfoatmakv"), - // Type: to.Ptr("Microsoft.ElasticSan/ElasticSans"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Location: to.Ptr("France Central"), - // Tags: map[string]*string{ - // "key5002": to.Ptr("lhag"), - // }, - // Properties: &armelasticsan.Properties{ - // AvailabilityZones: []*string{ - // to.Ptr("1")}, - // BaseSizeTiB: to.Ptr[int64](15), - // ExtendedCapacitySizeTiB: to.Ptr[int64](6), - // PrivateEndpointConnections: []*armelasticsan.PrivateEndpointConnection{ - // { - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}")}, - // PrivateEndpoint: &armelasticsan.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}"), - // }, - // PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // SKU: &armelasticsan.SKU{ - // Name: to.Ptr(armelasticsan.SKUNamePremiumLRS), - // Tier: to.Ptr(armelasticsan.SKUTierPremium), - // }, - // TotalIops: to.Ptr[int64](22), - // TotalMBps: to.Ptr[int64](4), - // TotalSizeTiB: to.Ptr[int64](27), - // TotalVolumeSizeGiB: to.Ptr[int64](15), - // VolumeGroupCount: to.Ptr[int64](24), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Delete_MaximumSet_Gen.json -func ExampleElasticSansClient_BeginDelete_elasticSansDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewElasticSansClient().BeginDelete(ctx, "resourcegroupname", "elasticsanname", 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/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Delete_MinimumSet_Gen.json -func ExampleElasticSansClient_BeginDelete_elasticSansDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewElasticSansClient().BeginDelete(ctx, "resourcegroupname", "elasticsanname", 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/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Get_MaximumSet_Gen.json -func ExampleElasticSansClient_Get_elasticSansGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewElasticSansClient().Get(ctx, "resourcegroupname", "elasticsanname", 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.ElasticSan = armelasticsan.ElasticSan{ - // Name: to.Ptr("vfoatmakv"), - // Type: to.Ptr("Microsoft.ElasticSan/ElasticSans"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Location: to.Ptr("France Central"), - // Tags: map[string]*string{ - // "key5002": to.Ptr("lhag"), - // }, - // Properties: &armelasticsan.Properties{ - // AvailabilityZones: []*string{ - // to.Ptr("1")}, - // BaseSizeTiB: to.Ptr[int64](15), - // ExtendedCapacitySizeTiB: to.Ptr[int64](6), - // PrivateEndpointConnections: []*armelasticsan.PrivateEndpointConnection{ - // { - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}")}, - // PrivateEndpoint: &armelasticsan.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}"), - // }, - // PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // SKU: &armelasticsan.SKU{ - // Name: to.Ptr(armelasticsan.SKUNamePremiumLRS), - // Tier: to.Ptr(armelasticsan.SKUTierPremium), - // }, - // TotalIops: to.Ptr[int64](22), - // TotalMBps: to.Ptr[int64](4), - // TotalSizeTiB: to.Ptr[int64](27), - // TotalVolumeSizeGiB: to.Ptr[int64](15), - // VolumeGroupCount: to.Ptr[int64](24), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Get_MinimumSet_Gen.json -func ExampleElasticSansClient_Get_elasticSansGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewElasticSansClient().Get(ctx, "resourcegroupname", "elasticsanname", 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.ElasticSan = armelasticsan.ElasticSan{ - // Name: to.Ptr("vfoatmakv"), - // Type: to.Ptr("Microsoft.ElasticSan/ElasticSans"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Location: to.Ptr("France Central"), - // Tags: map[string]*string{ - // "key5002": to.Ptr("lhag"), - // }, - // Properties: &armelasticsan.Properties{ - // AvailabilityZones: []*string{ - // to.Ptr("1")}, - // BaseSizeTiB: to.Ptr[int64](15), - // ExtendedCapacitySizeTiB: to.Ptr[int64](6), - // PrivateEndpointConnections: []*armelasticsan.PrivateEndpointConnection{ - // { - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}")}, - // PrivateEndpoint: &armelasticsan.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}"), - // }, - // PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // SKU: &armelasticsan.SKU{ - // Name: to.Ptr(armelasticsan.SKUNamePremiumLRS), - // Tier: to.Ptr(armelasticsan.SKUTierPremium), - // }, - // TotalIops: to.Ptr[int64](22), - // TotalMBps: to.Ptr[int64](4), - // TotalSizeTiB: to.Ptr[int64](27), - // TotalVolumeSizeGiB: to.Ptr[int64](15), - // VolumeGroupCount: to.Ptr[int64](24), - // }, - // } -} diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/go.mod b/sdk/resourcemanager/elasticsan/armelasticsan/go.mod index c45ad2d0cd1f..9a2989de184e 100644 --- a/sdk/resourcemanager/elasticsan/armelasticsan/go.mod +++ b/sdk/resourcemanager/elasticsan/armelasticsan/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elasticsan/armelast go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.7.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/go.sum b/sdk/resourcemanager/elasticsan/armelasticsan/go.sum index 21718b486698..727ce838bdc8 100644 --- a/sdk/resourcemanager/elasticsan/armelasticsan/go.sum +++ b/sdk/resourcemanager/elasticsan/armelasticsan/go.sum @@ -1,31 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 h1:8kDqDngH+DmVBiCtIjCFTGa7MBnsIOkF9IccInFEbjk= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= -github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY= -github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 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/elasticsan/armelasticsan/models.go b/sdk/resourcemanager/elasticsan/armelasticsan/models.go index de12ad8c9035..def2908b74cc 100644 --- a/sdk/resourcemanager/elasticsan/armelasticsan/models.go +++ b/sdk/resourcemanager/elasticsan/armelasticsan/models.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// 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. -// DO NOT EDIT. package armelasticsan @@ -35,39 +34,35 @@ type ElasticSan struct { Type *string } -// ElasticSansClientBeginCreateOptions contains the optional parameters for the ElasticSansClient.BeginCreate method. -type ElasticSansClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +// EncryptionIdentity - Encryption identity for the volume group. +type EncryptionIdentity struct { + // Resource identifier of the UserAssigned identity to be associated with server-side encryption on the volume group. + EncryptionUserAssignedIdentity *string } -// ElasticSansClientBeginDeleteOptions contains the optional parameters for the ElasticSansClient.BeginDelete method. -type ElasticSansClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} +// EncryptionProperties - The encryption settings on the volume group. +type EncryptionProperties struct { + // The identity to be used with service-side encryption at rest. + EncryptionIdentity *EncryptionIdentity -// ElasticSansClientBeginUpdateOptions contains the optional parameters for the ElasticSansClient.BeginUpdate method. -type ElasticSansClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string + // Properties provided by key vault. + KeyVaultProperties *KeyVaultProperties } -// ElasticSansClientGetOptions contains the optional parameters for the ElasticSansClient.Get method. -type ElasticSansClientGetOptions struct { - // placeholder for future optional parameters -} +// Identity for the resource. +type Identity struct { + // REQUIRED; The identity type. + Type *IdentityType -// ElasticSansClientListByResourceGroupOptions contains the optional parameters for the ElasticSansClient.NewListByResourceGroupPager -// method. -type ElasticSansClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} + // Gets or sets a list of key value pairs that describe the set of User Assigned identities that will be used with this volume + // group. The key is the ARM resource identifier of the identity. + UserAssignedIdentities map[string]*UserAssignedIdentity -// ElasticSansClientListBySubscriptionOptions contains the optional parameters for the ElasticSansClient.NewListBySubscriptionPager -// method. -type ElasticSansClientListBySubscriptionOptions struct { - // placeholder for future optional parameters + // READ-ONLY; The principal ID of resource identity. + PrincipalID *string + + // READ-ONLY; The tenant ID of resource. + TenantID *string } // IscsiTargetInfo - Iscsi target information @@ -88,6 +83,28 @@ type IscsiTargetInfo struct { TargetPortalPort *int32 } +// KeyVaultProperties - Properties of key vault. +type KeyVaultProperties struct { + // The name of KeyVault key. + KeyName *string + + // The Uri of KeyVault. + KeyVaultURI *string + + // The version of KeyVault key. + KeyVersion *string + + // READ-ONLY; This is a read only property that represents the expiration time of the current version of the customer managed + // key used for encryption. + CurrentVersionedKeyExpirationTimestamp *time.Time + + // READ-ONLY; The object identifier of the current versioned Key Vault Key in use. + CurrentVersionedKeyIdentifier *string + + // READ-ONLY; Timestamp of last rotation of the Key Vault Key. + LastKeyRotationTimestamp *time.Time +} + // List of Elastic Sans type List struct { // An array of Elastic San objects. @@ -97,6 +114,12 @@ type List struct { NextLink *string } +// ManagedByInfo - Parent resource information. +type ManagedByInfo struct { + // Resource ID of the resource managing the volume, this is a restricted field and can only be set for internal use. + ResourceID *string +} + // NetworkRuleSet - A set of rules governing the network accessibility. type NetworkRuleSet struct { // The list of virtual network rules. @@ -152,11 +175,6 @@ type OperationListResult struct { Value []*Operation } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - // PrivateEndpoint - Response for PrivateEndpoint type PrivateEndpoint struct { // READ-ONLY; The ARM identifier for Private Endpoint @@ -205,32 +223,6 @@ type PrivateEndpointConnectionProperties struct { ProvisioningState *ProvisioningStates } -// PrivateEndpointConnectionsClientBeginCreateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreate -// method. -type PrivateEndpointConnectionsClientBeginCreateOptions struct { - // Resumes the LRO 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. - ResumeToken string -} - -// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. -type PrivateEndpointConnectionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager -// method. -type PrivateEndpointConnectionsClientListOptions struct { - // placeholder for future optional parameters -} - // PrivateLinkResource - A private link resource type PrivateLinkResource struct { // Resource properties. @@ -270,12 +262,6 @@ type PrivateLinkResourceProperties struct { RequiredMembers []*string } -// PrivateLinkResourcesClientListByElasticSanOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByElasticSan -// method. -type PrivateLinkResourcesClientListByElasticSanOptions struct { - // placeholder for future optional parameters -} - // PrivateLinkServiceConnectionState - Response for Private Link Service Connection state type PrivateLinkServiceConnectionState struct { // A message indicating if changes on the service provider require any updates on the consumer. @@ -302,6 +288,9 @@ type Properties struct { // Logical zone for Elastic San resource; example: ["1"]. AvailabilityZones []*string + // Allow or disallow public network access to ElasticSan. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + PublicNetworkAccess *PublicNetworkAccess + // READ-ONLY; The list of Private Endpoint Connections. PrivateEndpointConnections []*PrivateEndpointConnection @@ -382,20 +371,62 @@ type SKULocationInfo struct { Zones []*string } -// SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method. -type SKUsClientListOptions struct { - // Specify $filter='location eq ' to filter on location. - Filter *string +// Snapshot - Response for Volume Snapshot request. +type Snapshot struct { + // REQUIRED; Properties of Volume Snapshot. + Properties *SnapshotProperties + + // 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 +} + +// SnapshotCreationData - Data used when creating a volume snapshot. +type SnapshotCreationData struct { + // REQUIRED; Fully qualified resource ID of the volume. E.g. + // "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}" + SourceID *string +} + +// SnapshotList - List of Snapshots +type SnapshotList struct { + // An array of Snapshot objects. + Value []*Snapshot + + // READ-ONLY; URI to fetch the next section of the paginated response. + NextLink *string +} + +// SnapshotProperties - Properties for Snapshot. +type SnapshotProperties struct { + // REQUIRED; Data used when creating a volume snapshot. + CreationData *SnapshotCreationData + + // READ-ONLY; State of the operation on the resource. + ProvisioningState *ProvisioningStates + + // READ-ONLY; Size of Source Volume + SourceVolumeSizeGiB *int64 + + // READ-ONLY; Source Volume Name of a snapshot + VolumeName *string } // SourceCreationData - Data source used when creating the volume. type SourceCreationData struct { // This enumerates the possible sources of a volume creation. - CreateSource *string + CreateSource *VolumeCreateOption - // If createOption is Copy, this is the ARM id of the source snapshot or disk. If createOption is Restore, this is the ARM-like - // id of the source disk restore point. - SourceURI *string + // Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + SourceID *string } // SystemData - Metadata pertaining to creation and last modification of the resource. @@ -435,6 +466,19 @@ type UpdateProperties struct { // Extended size of the Elastic San appliance in TiB. ExtendedCapacitySizeTiB *int64 + + // Allow or disallow public network access to ElasticSan Account. Value is optional but if passed in, must be 'Enabled' or + // 'Disabled'. + PublicNetworkAccess *PublicNetworkAccess +} + +// UserAssignedIdentity for the resource. +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the identity. + ClientID *string + + // READ-ONLY; The principal ID of the identity. + PrincipalID *string } // VirtualNetworkRule - Virtual Network rule. @@ -443,10 +487,7 @@ type VirtualNetworkRule struct { VirtualNetworkResourceID *string // The action of virtual network rule. - Action *string - - // READ-ONLY; Gets the state of virtual network rule. - State *State + Action *Action } // Volume - Response for Volume request. @@ -469,6 +510,9 @@ type Volume struct { // VolumeGroup - Response for Volume Group request. type VolumeGroup struct { + // The identity of the resource. + Identity *Identity + // Properties of VolumeGroup. Properties *VolumeGroupProperties @@ -499,6 +543,9 @@ type VolumeGroupProperties struct { // Type of encryption Encryption *EncryptionType + // Encryption Properties describing Key Vault and Identity information + EncryptionProperties *EncryptionProperties + // A collection of rules governing the accessibility from specific network locations. NetworkACLs *NetworkRuleSet @@ -514,6 +561,9 @@ type VolumeGroupProperties struct { // VolumeGroupUpdate - Volume Group request. type VolumeGroupUpdate struct { + // The identity of the resource. + Identity *Identity + // Properties of VolumeGroup. Properties *VolumeGroupUpdateProperties } @@ -523,6 +573,9 @@ type VolumeGroupUpdateProperties struct { // Type of encryption Encryption *EncryptionType + // Encryption Properties describing Key Vault and Identity information + EncryptionProperties *EncryptionProperties + // A collection of rules governing the accessibility from specific network locations. NetworkACLs *NetworkRuleSet @@ -530,35 +583,6 @@ type VolumeGroupUpdateProperties struct { ProtocolType *StorageTargetType } -// VolumeGroupsClientBeginCreateOptions contains the optional parameters for the VolumeGroupsClient.BeginCreate method. -type VolumeGroupsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VolumeGroupsClientBeginDeleteOptions contains the optional parameters for the VolumeGroupsClient.BeginDelete method. -type VolumeGroupsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VolumeGroupsClientBeginUpdateOptions contains the optional parameters for the VolumeGroupsClient.BeginUpdate method. -type VolumeGroupsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VolumeGroupsClientGetOptions contains the optional parameters for the VolumeGroupsClient.Get method. -type VolumeGroupsClientGetOptions struct { - // placeholder for future optional parameters -} - -// VolumeGroupsClientListByElasticSanOptions contains the optional parameters for the VolumeGroupsClient.NewListByElasticSanPager -// method. -type VolumeGroupsClientListByElasticSanOptions struct { - // placeholder for future optional parameters -} - // VolumeList - List of Volumes type VolumeList struct { // An array of Volume objects. @@ -576,6 +600,12 @@ type VolumeProperties struct { // State of the operation on the resource. CreationData *SourceCreationData + // Parent resource information. + ManagedBy *ManagedByInfo + + // READ-ONLY; State of the operation on the resource. + ProvisioningState *ProvisioningStates + // READ-ONLY; Storage target information StorageTarget *IscsiTargetInfo @@ -591,35 +621,9 @@ type VolumeUpdate struct { // VolumeUpdateProperties - Volume response properties. type VolumeUpdateProperties struct { + // Parent resource information. + ManagedBy *ManagedByInfo + // Volume size. SizeGiB *int64 } - -// VolumesClientBeginCreateOptions contains the optional parameters for the VolumesClient.BeginCreate method. -type VolumesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VolumesClientBeginDeleteOptions contains the optional parameters for the VolumesClient.BeginDelete method. -type VolumesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VolumesClientBeginUpdateOptions contains the optional parameters for the VolumesClient.BeginUpdate method. -type VolumesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VolumesClientGetOptions contains the optional parameters for the VolumesClient.Get method. -type VolumesClientGetOptions struct { - // placeholder for future optional parameters -} - -// VolumesClientListByVolumeGroupOptions contains the optional parameters for the VolumesClient.NewListByVolumeGroupPager -// method. -type VolumesClientListByVolumeGroupOptions struct { - // placeholder for future optional parameters -} diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/models_serde.go b/sdk/resourcemanager/elasticsan/armelasticsan/models_serde.go index 419db5673cf3..36354139c37d 100644 --- a/sdk/resourcemanager/elasticsan/armelasticsan/models_serde.go +++ b/sdk/resourcemanager/elasticsan/armelasticsan/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// 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. -// DO NOT EDIT. package armelasticsan @@ -67,6 +66,103 @@ func (e *ElasticSan) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type EncryptionIdentity. +func (e EncryptionIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "userAssignedIdentity", e.EncryptionUserAssignedIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionIdentity. +func (e *EncryptionIdentity) 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 "userAssignedIdentity": + err = unpopulate(val, "EncryptionUserAssignedIdentity", &e.EncryptionUserAssignedIdentity) + 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 EncryptionProperties. +func (e EncryptionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", e.EncryptionIdentity) + populate(objectMap, "keyVaultProperties", e.KeyVaultProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionProperties. +func (e *EncryptionProperties) 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 "identity": + err = unpopulate(val, "EncryptionIdentity", &e.EncryptionIdentity) + delete(rawMsg, key) + case "keyVaultProperties": + err = unpopulate(val, "KeyVaultProperties", &e.KeyVaultProperties) + 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 Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. +func (i *Identity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type IscsiTargetInfo. func (i IscsiTargetInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -110,6 +206,53 @@ func (i *IscsiTargetInfo) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type KeyVaultProperties. +func (k KeyVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "currentVersionedKeyExpirationTimestamp", k.CurrentVersionedKeyExpirationTimestamp) + populate(objectMap, "currentVersionedKeyIdentifier", k.CurrentVersionedKeyIdentifier) + populate(objectMap, "keyName", k.KeyName) + populate(objectMap, "keyVaultUri", k.KeyVaultURI) + populate(objectMap, "keyVersion", k.KeyVersion) + populateTimeRFC3339(objectMap, "lastKeyRotationTimestamp", k.LastKeyRotationTimestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultProperties. +func (k *KeyVaultProperties) 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", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "currentVersionedKeyExpirationTimestamp": + err = unpopulateTimeRFC3339(val, "CurrentVersionedKeyExpirationTimestamp", &k.CurrentVersionedKeyExpirationTimestamp) + delete(rawMsg, key) + case "currentVersionedKeyIdentifier": + err = unpopulate(val, "CurrentVersionedKeyIdentifier", &k.CurrentVersionedKeyIdentifier) + delete(rawMsg, key) + case "keyName": + err = unpopulate(val, "KeyName", &k.KeyName) + delete(rawMsg, key) + case "keyVaultUri": + err = unpopulate(val, "KeyVaultURI", &k.KeyVaultURI) + delete(rawMsg, key) + case "keyVersion": + err = unpopulate(val, "KeyVersion", &k.KeyVersion) + delete(rawMsg, key) + case "lastKeyRotationTimestamp": + err = unpopulateTimeRFC3339(val, "LastKeyRotationTimestamp", &k.LastKeyRotationTimestamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type List. func (l List) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -141,6 +284,33 @@ func (l *List) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedByInfo. +func (m ManagedByInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resourceId", m.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedByInfo. +func (m *ManagedByInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "resourceId": + err = unpopulate(val, "ResourceID", &m.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type NetworkRuleSet. func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -573,6 +743,7 @@ func (p Properties) MarshalJSON() ([]byte, error) { populate(objectMap, "extendedCapacitySizeTiB", p.ExtendedCapacitySizeTiB) populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) populate(objectMap, "sku", p.SKU) populate(objectMap, "totalIops", p.TotalIops) populate(objectMap, "totalMBps", p.TotalMBps) @@ -606,6 +777,9 @@ func (p *Properties) UnmarshalJSON(data []byte) error { case "provisioningState": err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &p.PublicNetworkAccess) + delete(rawMsg, key) case "sku": err = unpopulate(val, "SKU", &p.SKU) delete(rawMsg, key) @@ -803,11 +977,151 @@ func (s *SKULocationInfo) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Snapshot. +func (s Snapshot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Snapshot. +func (s *Snapshot) 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 "id": + err = unpopulate(val, "ID", &s.ID) + 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 "type": + err = unpopulate(val, "Type", &s.Type) + 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 SnapshotCreationData. +func (s SnapshotCreationData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "sourceId", s.SourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SnapshotCreationData. +func (s *SnapshotCreationData) 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 "sourceId": + err = unpopulate(val, "SourceID", &s.SourceID) + 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 SnapshotList. +func (s SnapshotList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SnapshotList. +func (s *SnapshotList) 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 "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + 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 SnapshotProperties. +func (s SnapshotProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "creationData", s.CreationData) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "sourceVolumeSizeGiB", s.SourceVolumeSizeGiB) + populate(objectMap, "volumeName", s.VolumeName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SnapshotProperties. +func (s *SnapshotProperties) 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 "creationData": + err = unpopulate(val, "CreationData", &s.CreationData) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "sourceVolumeSizeGiB": + err = unpopulate(val, "SourceVolumeSizeGiB", &s.SourceVolumeSizeGiB) + delete(rawMsg, key) + case "volumeName": + err = unpopulate(val, "VolumeName", &s.VolumeName) + 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 SourceCreationData. func (s SourceCreationData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["createSource"] = "None" - populate(objectMap, "sourceUri", s.SourceURI) + populate(objectMap, "createSource", s.CreateSource) + populate(objectMap, "sourceId", s.SourceID) return json.Marshal(objectMap) } @@ -823,8 +1137,8 @@ func (s *SourceCreationData) UnmarshalJSON(data []byte) error { case "createSource": err = unpopulate(val, "CreateSource", &s.CreateSource) delete(rawMsg, key) - case "sourceUri": - err = unpopulate(val, "SourceURI", &s.SourceURI) + case "sourceId": + err = unpopulate(val, "SourceID", &s.SourceID) delete(rawMsg, key) } if err != nil { @@ -917,6 +1231,7 @@ func (u UpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "baseSizeTiB", u.BaseSizeTiB) populate(objectMap, "extendedCapacitySizeTiB", u.ExtendedCapacitySizeTiB) + populate(objectMap, "publicNetworkAccess", u.PublicNetworkAccess) return json.Marshal(objectMap) } @@ -935,6 +1250,40 @@ func (u *UpdateProperties) UnmarshalJSON(data []byte) error { case "extendedCapacitySizeTiB": err = unpopulate(val, "ExtendedCapacitySizeTiB", &u.ExtendedCapacitySizeTiB) delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &u.PublicNetworkAccess) + 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 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) @@ -946,8 +1295,7 @@ func (u *UpdateProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VirtualNetworkRule. func (v VirtualNetworkRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["action"] = "Allow" - populate(objectMap, "state", v.State) + populate(objectMap, "action", v.Action) populate(objectMap, "id", v.VirtualNetworkResourceID) return json.Marshal(objectMap) } @@ -964,9 +1312,6 @@ func (v *VirtualNetworkRule) UnmarshalJSON(data []byte) error { case "action": err = unpopulate(val, "Action", &v.Action) delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &v.State) - delete(rawMsg, key) case "id": err = unpopulate(val, "VirtualNetworkResourceID", &v.VirtualNetworkResourceID) delete(rawMsg, key) @@ -1025,6 +1370,7 @@ func (v *Volume) UnmarshalJSON(data []byte) error { func (v VolumeGroup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", v.ID) + populate(objectMap, "identity", v.Identity) populate(objectMap, "name", v.Name) populate(objectMap, "properties", v.Properties) populate(objectMap, "systemData", v.SystemData) @@ -1044,6 +1390,9 @@ func (v *VolumeGroup) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &v.Identity) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) @@ -1099,6 +1448,7 @@ func (v *VolumeGroupList) UnmarshalJSON(data []byte) error { func (v VolumeGroupProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "encryption", v.Encryption) + populate(objectMap, "encryptionProperties", v.EncryptionProperties) populate(objectMap, "networkAcls", v.NetworkACLs) populate(objectMap, "privateEndpointConnections", v.PrivateEndpointConnections) populate(objectMap, "protocolType", v.ProtocolType) @@ -1118,6 +1468,9 @@ func (v *VolumeGroupProperties) UnmarshalJSON(data []byte) error { case "encryption": err = unpopulate(val, "Encryption", &v.Encryption) delete(rawMsg, key) + case "encryptionProperties": + err = unpopulate(val, "EncryptionProperties", &v.EncryptionProperties) + delete(rawMsg, key) case "networkAcls": err = unpopulate(val, "NetworkACLs", &v.NetworkACLs) delete(rawMsg, key) @@ -1141,6 +1494,7 @@ func (v *VolumeGroupProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VolumeGroupUpdate. func (v VolumeGroupUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "identity", v.Identity) populate(objectMap, "properties", v.Properties) return json.Marshal(objectMap) } @@ -1154,6 +1508,9 @@ func (v *VolumeGroupUpdate) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "identity": + err = unpopulate(val, "Identity", &v.Identity) + delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &v.Properties) delete(rawMsg, key) @@ -1169,6 +1526,7 @@ func (v *VolumeGroupUpdate) UnmarshalJSON(data []byte) error { func (v VolumeGroupUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "encryption", v.Encryption) + populate(objectMap, "encryptionProperties", v.EncryptionProperties) populate(objectMap, "networkAcls", v.NetworkACLs) populate(objectMap, "protocolType", v.ProtocolType) return json.Marshal(objectMap) @@ -1186,6 +1544,9 @@ func (v *VolumeGroupUpdateProperties) UnmarshalJSON(data []byte) error { case "encryption": err = unpopulate(val, "Encryption", &v.Encryption) delete(rawMsg, key) + case "encryptionProperties": + err = unpopulate(val, "EncryptionProperties", &v.EncryptionProperties) + delete(rawMsg, key) case "networkAcls": err = unpopulate(val, "NetworkACLs", &v.NetworkACLs) delete(rawMsg, key) @@ -1235,6 +1596,8 @@ func (v *VolumeList) UnmarshalJSON(data []byte) error { func (v VolumeProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "creationData", v.CreationData) + populate(objectMap, "managedBy", v.ManagedBy) + populate(objectMap, "provisioningState", v.ProvisioningState) populate(objectMap, "sizeGiB", v.SizeGiB) populate(objectMap, "storageTarget", v.StorageTarget) populate(objectMap, "volumeId", v.VolumeID) @@ -1253,6 +1616,12 @@ func (v *VolumeProperties) UnmarshalJSON(data []byte) error { case "creationData": err = unpopulate(val, "CreationData", &v.CreationData) delete(rawMsg, key) + case "managedBy": + err = unpopulate(val, "ManagedBy", &v.ManagedBy) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) case "sizeGiB": err = unpopulate(val, "SizeGiB", &v.SizeGiB) delete(rawMsg, key) @@ -1300,6 +1669,7 @@ func (v *VolumeUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VolumeUpdateProperties. func (v VolumeUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "managedBy", v.ManagedBy) populate(objectMap, "sizeGiB", v.SizeGiB) return json.Marshal(objectMap) } @@ -1313,6 +1683,9 @@ func (v *VolumeUpdateProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "managedBy": + err = unpopulate(val, "ManagedBy", &v.ManagedBy) + delete(rawMsg, key) case "sizeGiB": err = unpopulate(val, "SizeGiB", &v.SizeGiB) delete(rawMsg, key) diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/operations_client.go b/sdk/resourcemanager/elasticsan/armelasticsan/operations_client.go index 72073b68e98f..7889068a6c89 100644 --- a/sdk/resourcemanager/elasticsan/armelasticsan/operations_client.go +++ b/sdk/resourcemanager/elasticsan/armelasticsan/operations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// 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. -// DO NOT EDIT. package armelasticsan @@ -40,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Gets a list of ElasticSan operations. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-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]{ @@ -72,7 +71,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/operations_client_example_test.go b/sdk/resourcemanager/elasticsan/armelasticsan/operations_client_example_test.go deleted file mode 100644 index f9f6da499452..000000000000 --- a/sdk/resourcemanager/elasticsan/armelasticsan/operations_client_example_test.go +++ /dev/null @@ -1,87 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armelasticsan_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elasticsan/armelasticsan" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Operations_List_MaximumSet_Gen.json -func ExampleOperationsClient_NewListPager_operationsListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(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.OperationListResult = armelasticsan.OperationListResult{ - // Value: []*armelasticsan.Operation{ - // { - // Name: to.Ptr("qgcosclgjmglgs"), - // Display: &armelasticsan.OperationDisplay{ - // Description: to.Ptr("fmbdwtvxjilmflxdlmbysmr"), - // Operation: to.Ptr("ofkypzumjbtezuqujudkqcf"), - // Provider: to.Ptr("dbdmmszikohrwlvl"), - // Resource: to.Ptr("adqzzhgl"), - // }, - // IsDataAction: to.Ptr(true), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Operations_List_MinimumSet_Gen.json -func ExampleOperationsClient_NewListPager_operationsListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(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.OperationListResult = armelasticsan.OperationListResult{ - // Value: []*armelasticsan.Operation{ - // { - // Name: to.Ptr("qgcosclgjmglgs"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/options.go b/sdk/resourcemanager/elasticsan/armelasticsan/options.go new file mode 100644 index 000000000000..a1fe4da91804 --- /dev/null +++ b/sdk/resourcemanager/elasticsan/armelasticsan/options.go @@ -0,0 +1,175 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armelasticsan + +// ElasticSansClientBeginCreateOptions contains the optional parameters for the ElasticSansClient.BeginCreate method. +type ElasticSansClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ElasticSansClientBeginDeleteOptions contains the optional parameters for the ElasticSansClient.BeginDelete method. +type ElasticSansClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ElasticSansClientBeginUpdateOptions contains the optional parameters for the ElasticSansClient.BeginUpdate method. +type ElasticSansClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ElasticSansClientGetOptions contains the optional parameters for the ElasticSansClient.Get method. +type ElasticSansClientGetOptions struct { + // placeholder for future optional parameters +} + +// ElasticSansClientListByResourceGroupOptions contains the optional parameters for the ElasticSansClient.NewListByResourceGroupPager +// method. +type ElasticSansClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ElasticSansClientListBySubscriptionOptions contains the optional parameters for the ElasticSansClient.NewListBySubscriptionPager +// method. +type ElasticSansClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientBeginCreateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreate +// method. +type PrivateEndpointConnectionsClientBeginCreateOptions struct { + // Resumes the LRO 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. + ResumeToken string +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager +// method. +type PrivateEndpointConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListByElasticSanOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByElasticSan +// method. +type PrivateLinkResourcesClientListByElasticSanOptions struct { + // placeholder for future optional parameters +} + +// SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method. +type SKUsClientListOptions struct { + // Specify $filter='location eq ' to filter on location. + Filter *string +} + +// VolumeGroupsClientBeginCreateOptions contains the optional parameters for the VolumeGroupsClient.BeginCreate method. +type VolumeGroupsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VolumeGroupsClientBeginDeleteOptions contains the optional parameters for the VolumeGroupsClient.BeginDelete method. +type VolumeGroupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VolumeGroupsClientBeginUpdateOptions contains the optional parameters for the VolumeGroupsClient.BeginUpdate method. +type VolumeGroupsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VolumeGroupsClientGetOptions contains the optional parameters for the VolumeGroupsClient.Get method. +type VolumeGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// VolumeGroupsClientListByElasticSanOptions contains the optional parameters for the VolumeGroupsClient.NewListByElasticSanPager +// method. +type VolumeGroupsClientListByElasticSanOptions struct { + // placeholder for future optional parameters +} + +// VolumeSnapshotsClientBeginCreateOptions contains the optional parameters for the VolumeSnapshotsClient.BeginCreate method. +type VolumeSnapshotsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VolumeSnapshotsClientBeginDeleteOptions contains the optional parameters for the VolumeSnapshotsClient.BeginDelete method. +type VolumeSnapshotsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VolumeSnapshotsClientGetOptions contains the optional parameters for the VolumeSnapshotsClient.Get method. +type VolumeSnapshotsClientGetOptions struct { + // placeholder for future optional parameters +} + +// VolumeSnapshotsClientListByVolumeGroupOptions contains the optional parameters for the VolumeSnapshotsClient.NewListByVolumeGroupPager +// method. +type VolumeSnapshotsClientListByVolumeGroupOptions struct { + // Specify $filter='volumeName eq ' to filter on volume. + Filter *string +} + +// VolumesClientBeginCreateOptions contains the optional parameters for the VolumesClient.BeginCreate method. +type VolumesClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VolumesClientBeginDeleteOptions contains the optional parameters for the VolumesClient.BeginDelete method. +type VolumesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string + + // Optional, used to delete snapshots under volume. Allowed value are only true or false. Default value is false. + XMSDeleteSnapshots *XMSDeleteSnapshots + + // Optional, used to delete volume if active sessions present. Allowed value are only true or false. Default value is false. + XMSForceDelete *XMSForceDelete +} + +// VolumesClientBeginUpdateOptions contains the optional parameters for the VolumesClient.BeginUpdate method. +type VolumesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VolumesClientGetOptions contains the optional parameters for the VolumesClient.Get method. +type VolumesClientGetOptions struct { + // placeholder for future optional parameters +} + +// VolumesClientListByVolumeGroupOptions contains the optional parameters for the VolumesClient.NewListByVolumeGroupPager +// method. +type VolumesClientListByVolumeGroupOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/privateendpointconnections_client.go b/sdk/resourcemanager/elasticsan/armelasticsan/privateendpointconnections_client.go index 473db3491f83..8956b3c5204f 100644 --- a/sdk/resourcemanager/elasticsan/armelasticsan/privateendpointconnections_client.go +++ b/sdk/resourcemanager/elasticsan/armelasticsan/privateendpointconnections_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// 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. -// DO NOT EDIT. package armelasticsan @@ -47,7 +46,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginCreate - Update the state of specified private endpoint connection associated with the Elastic San // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - elasticSanName - The name of the ElasticSan. // - privateEndpointConnectionName - The name of the Private Endpoint connection. @@ -60,9 +59,10 @@ func (client *PrivateEndpointConnectionsClient) BeginCreate(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientCreateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,20 +71,22 @@ func (client *PrivateEndpointConnectionsClient) BeginCreate(ctx context.Context, // Create - Update the state of specified private endpoint connection associated with the Elastic San // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 func (client *PrivateEndpointConnectionsClient) create(ctx context.Context, resourceGroupName string, elasticSanName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, elasticSanName, privateEndpointConnectionName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -111,16 +113,19 @@ func (client *PrivateEndpointConnectionsClient) createCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes the specified private endpoint connection associated with the Elastic San // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - elasticSanName - The name of the ElasticSan. // - privateEndpointConnectionName - The name of the Private Endpoint connection. @@ -132,9 +137,10 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -143,20 +149,22 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes the specified private endpoint connection associated with the Elastic San // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, elasticSanName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, elasticSanName, privateEndpointConnectionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -183,7 +191,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -192,25 +200,28 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Gets the specified private endpoint connection associated with the Elastic San // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - elasticSanName - The name of the ElasticSan. // - privateEndpointConnectionName - The name of the Private Endpoint connection. // - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get // method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, elasticSanName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, elasticSanName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -237,7 +248,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -254,7 +265,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListPager - List all Private Endpoint Connections associated with the Elastic San. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - elasticSanName - The name of the ElasticSan. // - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager @@ -301,7 +312,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/elasticsan/armelasticsan/privateendpointconnections_client_example_test.go deleted file mode 100644 index 71caa8a4e35b..000000000000 --- a/sdk/resourcemanager/elasticsan/armelasticsan/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,380 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armelasticsan_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/elasticsan/armelasticsan" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Create_MaximumSet_Gen.json -func ExamplePrivateEndpointConnectionsClient_BeginCreate_privateEndpointConnectionsCreateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginCreate(ctx, "resourcegroupname", "elasticsanname", "privateendpointconnectionname", armelasticsan.PrivateEndpointConnection{ - Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - GroupIDs: []*string{ - to.Ptr("sytxzqlcoapcaywthgwvwcw")}, - PrivateEndpoint: &armelasticsan.PrivateEndpoint{}, - PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Auto-Approved"), - ActionsRequired: to.Ptr("None"), - Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - }, - }, - }, 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 = armelasticsan.PrivateEndpointConnection{ - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}")}, - // PrivateEndpoint: &armelasticsan.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}"), - // }, - // PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Create_MinimumSet_Gen.json -func ExamplePrivateEndpointConnectionsClient_BeginCreate_privateEndpointConnectionsCreateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginCreate(ctx, "resourcegroupname", "elasticsanname", "privateendpointconnectionname", armelasticsan.PrivateEndpointConnection{ - Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Auto-Approved"), - ActionsRequired: to.Ptr("None"), - Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - }, - }, - }, 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 = armelasticsan.PrivateEndpointConnection{ - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}")}, - // PrivateEndpoint: &armelasticsan.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}"), - // }, - // PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Get_MaximumSet_Gen.json -func ExamplePrivateEndpointConnectionsClient_Get_privateEndpointConnectionsGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "resourcegroupname", "elasticsanname", "privateendpointconnectionname", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armelasticsan.PrivateEndpointConnection{ - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}")}, - // PrivateEndpoint: &armelasticsan.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}"), - // }, - // PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Get_MinimumSet_Gen.json -func ExamplePrivateEndpointConnectionsClient_Get_privateEndpointConnectionsGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "resourcegroupname", "elasticsanname", "privateendpointconnectionname", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armelasticsan.PrivateEndpointConnection{ - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}")}, - // PrivateEndpoint: &armelasticsan.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}"), - // }, - // PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Delete_MaximumSet_Gen.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete_privateEndpointConnectionsDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "resourcegroupname", "elasticsanname", "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) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Delete_MinimumSet_Gen.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete_privateEndpointConnectionsDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "resourcegroupname", "elasticsanname", "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) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_List_MaximumSet_Gen.json -func ExamplePrivateEndpointConnectionsClient_NewListPager_privateEndpointConnectionsListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListPager("resourcegroupname", "elasticsanname", 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.PrivateEndpointConnectionListResult = armelasticsan.PrivateEndpointConnectionListResult{ - // Value: []*armelasticsan.PrivateEndpointConnection{ - // { - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}")}, - // PrivateEndpoint: &armelasticsan.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}"), - // }, - // PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_List_MinimumSet_Gen.json -func ExamplePrivateEndpointConnectionsClient_NewListPager_privateEndpointConnectionsListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListPager("resourcegroupname", "elasticsanname", 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.PrivateEndpointConnectionListResult = armelasticsan.PrivateEndpointConnectionListResult{ - // Value: []*armelasticsan.PrivateEndpointConnection{ - // { - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}")}, - // PrivateEndpoint: &armelasticsan.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}"), - // }, - // PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/privatelinkresources_client.go b/sdk/resourcemanager/elasticsan/armelasticsan/privatelinkresources_client.go index 38acd4148465..eb9ba1f04127 100644 --- a/sdk/resourcemanager/elasticsan/armelasticsan/privatelinkresources_client.go +++ b/sdk/resourcemanager/elasticsan/armelasticsan/privatelinkresources_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// 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. -// DO NOT EDIT. package armelasticsan @@ -47,24 +46,27 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // ListByElasticSan - Gets the private link resources that need to be created for a elastic San. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - elasticSanName - The name of the ElasticSan. // - options - PrivateLinkResourcesClientListByElasticSanOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByElasticSan // method. func (client *PrivateLinkResourcesClient) ListByElasticSan(ctx context.Context, resourceGroupName string, elasticSanName string, options *PrivateLinkResourcesClientListByElasticSanOptions) (PrivateLinkResourcesClientListByElasticSanResponse, error) { + var err error req, err := client.listByElasticSanCreateRequest(ctx, resourceGroupName, elasticSanName, options) if err != nil { return PrivateLinkResourcesClientListByElasticSanResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkResourcesClientListByElasticSanResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateLinkResourcesClientListByElasticSanResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkResourcesClientListByElasticSanResponse{}, err } - return client.listByElasticSanHandleResponse(resp) + resp, err := client.listByElasticSanHandleResponse(httpResp) + return resp, err } // listByElasticSanCreateRequest creates the ListByElasticSan request. @@ -87,7 +89,7 @@ func (client *PrivateLinkResourcesClient) listByElasticSanCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/privatelinkresources_client_example_test.go b/sdk/resourcemanager/elasticsan/armelasticsan/privatelinkresources_client_example_test.go deleted file mode 100644 index 629087ae7d9b..000000000000 --- a/sdk/resourcemanager/elasticsan/armelasticsan/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,104 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armelasticsan_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elasticsan/armelasticsan" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateLinkResources_ListByElasticSan_MaximumSet_Gen.json -func ExamplePrivateLinkResourcesClient_ListByElasticSan_privateLinkResourcesListByElasticSanMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().ListByElasticSan(ctx, "resourcegroupname", "elasticsanname", 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.PrivateLinkResourceListResult = armelasticsan.PrivateLinkResourceListResult{ - // Value: []*armelasticsan.PrivateLinkResource{ - // { - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // CreatedBy: to.Ptr("zloujisrarsox"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // LastModifiedBy: to.Ptr("lmdztjjcmdfzam"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}"), - // RequiredMembers: []*string{ - // to.Ptr("{volumeGroupName}")}, - // RequiredZoneNames: []*string{ - // to.Ptr("lsknuvjjtgsrocmoq")}, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateLinkResources_ListByElasticSan_MinimumSet_Gen.json -func ExamplePrivateLinkResourcesClient_ListByElasticSan_privateLinkResourcesListByElasticSanMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().ListByElasticSan(ctx, "resourcegroupname", "elasticsanname", 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.PrivateLinkResourceListResult = armelasticsan.PrivateLinkResourceListResult{ - // Value: []*armelasticsan.PrivateLinkResource{ - // { - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // CreatedBy: to.Ptr("zloujisrarsox"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // LastModifiedBy: to.Ptr("lmdztjjcmdfzam"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}"), - // RequiredMembers: []*string{ - // to.Ptr("{volumeGroupName}")}, - // RequiredZoneNames: []*string{ - // to.Ptr("lsknuvjjtgsrocmoq")}, - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/response_types.go b/sdk/resourcemanager/elasticsan/armelasticsan/response_types.go index 5c0257dfed37..1d796b1e0e8c 100644 --- a/sdk/resourcemanager/elasticsan/armelasticsan/response_types.go +++ b/sdk/resourcemanager/elasticsan/armelasticsan/response_types.go @@ -3,14 +3,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// 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. -// DO NOT EDIT. package armelasticsan // ElasticSansClientCreateResponse contains the response from method ElasticSansClient.BeginCreate. type ElasticSansClientCreateResponse struct { + // Response for ElasticSan request. ElasticSan } @@ -21,31 +21,37 @@ type ElasticSansClientDeleteResponse struct { // ElasticSansClientGetResponse contains the response from method ElasticSansClient.Get. type ElasticSansClientGetResponse struct { + // Response for ElasticSan request. ElasticSan } // ElasticSansClientListByResourceGroupResponse contains the response from method ElasticSansClient.NewListByResourceGroupPager. type ElasticSansClientListByResourceGroupResponse struct { + // List of Elastic Sans List } // ElasticSansClientListBySubscriptionResponse contains the response from method ElasticSansClient.NewListBySubscriptionPager. type ElasticSansClientListBySubscriptionResponse struct { + // List of Elastic Sans List } // ElasticSansClientUpdateResponse contains the response from method ElasticSansClient.BeginUpdate. type ElasticSansClientUpdateResponse struct { + // Response for ElasticSan request. ElasticSan } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. OperationListResult } // PrivateEndpointConnectionsClientCreateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreate. type PrivateEndpointConnectionsClientCreateResponse struct { + // Response for PrivateEndpoint Connection object PrivateEndpointConnection } @@ -56,26 +62,31 @@ type PrivateEndpointConnectionsClientDeleteResponse struct { // PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. type PrivateEndpointConnectionsClientGetResponse struct { + // Response for PrivateEndpoint Connection object PrivateEndpointConnection } // PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.NewListPager. type PrivateEndpointConnectionsClientListResponse struct { + // List of private endpoint connections associated with SAN PrivateEndpointConnectionListResult } // PrivateLinkResourcesClientListByElasticSanResponse contains the response from method PrivateLinkResourcesClient.ListByElasticSan. type PrivateLinkResourcesClientListByElasticSanResponse struct { + // A list of private link resources PrivateLinkResourceListResult } // SKUsClientListResponse contains the response from method SKUsClient.NewListPager. type SKUsClientListResponse struct { + // List of SKU Information objects SKUInformationList } // VolumeGroupsClientCreateResponse contains the response from method VolumeGroupsClient.BeginCreate. type VolumeGroupsClientCreateResponse struct { + // Response for Volume Group request. VolumeGroup } @@ -86,21 +97,48 @@ type VolumeGroupsClientDeleteResponse struct { // VolumeGroupsClientGetResponse contains the response from method VolumeGroupsClient.Get. type VolumeGroupsClientGetResponse struct { + // Response for Volume Group request. VolumeGroup } // VolumeGroupsClientListByElasticSanResponse contains the response from method VolumeGroupsClient.NewListByElasticSanPager. type VolumeGroupsClientListByElasticSanResponse struct { + // List of Volume Groups VolumeGroupList } // VolumeGroupsClientUpdateResponse contains the response from method VolumeGroupsClient.BeginUpdate. type VolumeGroupsClientUpdateResponse struct { + // Response for Volume Group request. VolumeGroup } +// VolumeSnapshotsClientCreateResponse contains the response from method VolumeSnapshotsClient.BeginCreate. +type VolumeSnapshotsClientCreateResponse struct { + // Response for Volume Snapshot request. + Snapshot +} + +// VolumeSnapshotsClientDeleteResponse contains the response from method VolumeSnapshotsClient.BeginDelete. +type VolumeSnapshotsClientDeleteResponse struct { + // placeholder for future response values +} + +// VolumeSnapshotsClientGetResponse contains the response from method VolumeSnapshotsClient.Get. +type VolumeSnapshotsClientGetResponse struct { + // Response for Volume Snapshot request. + Snapshot +} + +// VolumeSnapshotsClientListByVolumeGroupResponse contains the response from method VolumeSnapshotsClient.NewListByVolumeGroupPager. +type VolumeSnapshotsClientListByVolumeGroupResponse struct { + // List of Snapshots + SnapshotList +} + // VolumesClientCreateResponse contains the response from method VolumesClient.BeginCreate. type VolumesClientCreateResponse struct { + // Response for Volume request. Volume } @@ -111,15 +149,18 @@ type VolumesClientDeleteResponse struct { // VolumesClientGetResponse contains the response from method VolumesClient.Get. type VolumesClientGetResponse struct { + // Response for Volume request. Volume } // VolumesClientListByVolumeGroupResponse contains the response from method VolumesClient.NewListByVolumeGroupPager. type VolumesClientListByVolumeGroupResponse struct { + // List of Volumes VolumeList } // VolumesClientUpdateResponse contains the response from method VolumesClient.BeginUpdate. type VolumesClientUpdateResponse struct { + // Response for Volume request. Volume } diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/skus_client.go b/sdk/resourcemanager/elasticsan/armelasticsan/skus_client.go index 596f4f883566..681cd05205b3 100644 --- a/sdk/resourcemanager/elasticsan/armelasticsan/skus_client.go +++ b/sdk/resourcemanager/elasticsan/armelasticsan/skus_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// 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. -// DO NOT EDIT. package armelasticsan @@ -46,7 +45,7 @@ func NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, opt // NewListPager - List all the available Skus in the region and information related to them // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - options - SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method. func (client *SKUsClient) NewListPager(options *SKUsClientListOptions) *runtime.Pager[SKUsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SKUsClientListResponse]{ @@ -82,7 +81,7 @@ func (client *SKUsClient) listCreateRequest(ctx context.Context, options *SKUsCl return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/skus_client_example_test.go b/sdk/resourcemanager/elasticsan/armelasticsan/skus_client_example_test.go deleted file mode 100644 index 292ec7636ee7..000000000000 --- a/sdk/resourcemanager/elasticsan/armelasticsan/skus_client_example_test.go +++ /dev/null @@ -1,92 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armelasticsan_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/elasticsan/armelasticsan" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Skus_List_MaximumSet_Gen.json -func ExampleSKUsClient_NewListPager_skusListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSKUsClient().NewListPager(&armelasticsan.SKUsClientListOptions{Filter: to.Ptr("dtycml")}) - 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.SKUInformationList = armelasticsan.SKUInformationList{ - // Value: []*armelasticsan.SKUInformation{ - // { - // Name: to.Ptr(armelasticsan.SKUNamePremiumLRS), - // Capabilities: []*armelasticsan.SKUCapability{ - // { - // Name: to.Ptr("fihkmeasrwpjyti"), - // Value: to.Ptr("jlojmjpjucekutlgtwhjgxwpqctdjy"), - // }}, - // LocationInfo: []*armelasticsan.SKULocationInfo{ - // { - // Location: to.Ptr("oxpkwgcdvlonfcwtttor"), - // Zones: []*string{ - // to.Ptr("1")}, - // }}, - // Locations: []*string{ - // to.Ptr("jqdpabrworxiinhlmfmtko")}, - // ResourceType: to.Ptr("rnumsqm"), - // Tier: to.Ptr(armelasticsan.SKUTierPremium), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Skus_List_MinimumSet_Gen.json -func ExampleSKUsClient_NewListPager_skusListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSKUsClient().NewListPager(&armelasticsan.SKUsClientListOptions{Filter: 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.SKUInformationList = armelasticsan.SKUInformationList{ - // } - } -} diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/time_rfc3339.go b/sdk/resourcemanager/elasticsan/armelasticsan/time_rfc3339.go index edaf81c316d5..6877150be5ef 100644 --- a/sdk/resourcemanager/elasticsan/armelasticsan/time_rfc3339.go +++ b/sdk/resourcemanager/elasticsan/armelasticsan/time_rfc3339.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// 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. -// DO NOT EDIT. package armelasticsan diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/volumegroups_client.go b/sdk/resourcemanager/elasticsan/armelasticsan/volumegroups_client.go index deb56e52fb80..e0b815d41155 100644 --- a/sdk/resourcemanager/elasticsan/armelasticsan/volumegroups_client.go +++ b/sdk/resourcemanager/elasticsan/armelasticsan/volumegroups_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// 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. -// DO NOT EDIT. package armelasticsan @@ -47,7 +46,7 @@ func NewVolumeGroupsClient(subscriptionID string, credential azcore.TokenCredent // BeginCreate - Create a Volume Group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - elasticSanName - The name of the ElasticSan. // - volumeGroupName - The name of the VolumeGroup. @@ -60,9 +59,10 @@ func (client *VolumeGroupsClient) BeginCreate(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VolumeGroupsClientCreateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VolumeGroupsClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[VolumeGroupsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,20 +71,22 @@ func (client *VolumeGroupsClient) BeginCreate(ctx context.Context, resourceGroup // Create - Create a Volume Group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 func (client *VolumeGroupsClient) create(ctx context.Context, resourceGroupName string, elasticSanName string, volumeGroupName string, parameters VolumeGroup, options *VolumeGroupsClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, elasticSanName, volumeGroupName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -111,16 +113,19 @@ func (client *VolumeGroupsClient) createCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete an VolumeGroup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - elasticSanName - The name of the ElasticSan. // - volumeGroupName - The name of the VolumeGroup. @@ -132,9 +137,10 @@ func (client *VolumeGroupsClient) BeginDelete(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VolumeGroupsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VolumeGroupsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[VolumeGroupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -143,20 +149,22 @@ func (client *VolumeGroupsClient) BeginDelete(ctx context.Context, resourceGroup // Delete - Delete an VolumeGroup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 func (client *VolumeGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, elasticSanName string, volumeGroupName string, options *VolumeGroupsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, elasticSanName, volumeGroupName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -183,7 +191,7 @@ func (client *VolumeGroupsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -192,24 +200,27 @@ func (client *VolumeGroupsClient) deleteCreateRequest(ctx context.Context, resou // Get - Get an VolumeGroups. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - elasticSanName - The name of the ElasticSan. // - volumeGroupName - The name of the VolumeGroup. // - options - VolumeGroupsClientGetOptions contains the optional parameters for the VolumeGroupsClient.Get method. func (client *VolumeGroupsClient) Get(ctx context.Context, resourceGroupName string, elasticSanName string, volumeGroupName string, options *VolumeGroupsClientGetOptions) (VolumeGroupsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, elasticSanName, volumeGroupName, options) if err != nil { return VolumeGroupsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VolumeGroupsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VolumeGroupsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VolumeGroupsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -236,7 +247,7 @@ func (client *VolumeGroupsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -253,7 +264,7 @@ func (client *VolumeGroupsClient) getHandleResponse(resp *http.Response) (Volume // NewListByElasticSanPager - List VolumeGroups. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - elasticSanName - The name of the ElasticSan. // - options - VolumeGroupsClientListByElasticSanOptions contains the optional parameters for the VolumeGroupsClient.NewListByElasticSanPager @@ -306,7 +317,7 @@ func (client *VolumeGroupsClient) listByElasticSanCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -324,7 +335,7 @@ func (client *VolumeGroupsClient) listByElasticSanHandleResponse(resp *http.Resp // BeginUpdate - Update an VolumeGroup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - elasticSanName - The name of the ElasticSan. // - volumeGroupName - The name of the VolumeGroup. @@ -337,9 +348,10 @@ func (client *VolumeGroupsClient) BeginUpdate(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VolumeGroupsClientUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VolumeGroupsClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[VolumeGroupsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -348,20 +360,22 @@ func (client *VolumeGroupsClient) BeginUpdate(ctx context.Context, resourceGroup // Update - Update an VolumeGroup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 func (client *VolumeGroupsClient) update(ctx context.Context, resourceGroupName string, elasticSanName string, volumeGroupName string, parameters VolumeGroupUpdate, options *VolumeGroupsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, elasticSanName, volumeGroupName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -388,8 +402,11 @@ func (client *VolumeGroupsClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/volumegroups_client_example_test.go b/sdk/resourcemanager/elasticsan/armelasticsan/volumegroups_client_example_test.go deleted file mode 100644 index b8d4f45b54e5..000000000000 --- a/sdk/resourcemanager/elasticsan/armelasticsan/volumegroups_client_example_test.go +++ /dev/null @@ -1,647 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armelasticsan_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/elasticsan/armelasticsan" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_ListByElasticSan_MaximumSet_Gen.json -func ExampleVolumeGroupsClient_NewListByElasticSanPager_volumeGroupsListByElasticSanMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVolumeGroupsClient().NewListByElasticSanPager("resourcegroupname", "elasticsanname", 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.VolumeGroupList = armelasticsan.VolumeGroupList{ - // Value: []*armelasticsan.VolumeGroup{ - // { - // Name: to.Ptr("cr"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/volumeGroups"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // CreatedBy: to.Ptr("zloujisrarsox"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // LastModifiedBy: to.Ptr("lmdztjjcmdfzam"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.VolumeGroupProperties{ - // Encryption: to.Ptr(armelasticsan.EncryptionTypeEncryptionAtRestWithPlatformKey), - // NetworkACLs: &armelasticsan.NetworkRuleSet{ - // VirtualNetworkRules: []*armelasticsan.VirtualNetworkRule{ - // { - // Action: to.Ptr("Allow"), - // VirtualNetworkResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}"), - // State: to.Ptr(armelasticsan.StateProvisioning), - // }}, - // }, - // PrivateEndpointConnections: []*armelasticsan.PrivateEndpointConnection{ - // { - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}")}, - // PrivateEndpoint: &armelasticsan.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}"), - // }, - // PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // }}, - // ProtocolType: to.Ptr(armelasticsan.StorageTargetTypeIscsi), - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_ListByElasticSan_MinimumSet_Gen.json -func ExampleVolumeGroupsClient_NewListByElasticSanPager_volumeGroupsListByElasticSanMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVolumeGroupsClient().NewListByElasticSanPager("resourcegroupname", "elasticsanname", 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.VolumeGroupList = armelasticsan.VolumeGroupList{ - // Value: []*armelasticsan.VolumeGroup{ - // { - // Name: to.Ptr("cr"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/volumeGroups"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // CreatedBy: to.Ptr("zloujisrarsox"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // LastModifiedBy: to.Ptr("lmdztjjcmdfzam"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.VolumeGroupProperties{ - // Encryption: to.Ptr(armelasticsan.EncryptionTypeEncryptionAtRestWithPlatformKey), - // NetworkACLs: &armelasticsan.NetworkRuleSet{ - // VirtualNetworkRules: []*armelasticsan.VirtualNetworkRule{ - // { - // Action: to.Ptr("Allow"), - // VirtualNetworkResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}"), - // State: to.Ptr(armelasticsan.StateProvisioning), - // }}, - // }, - // PrivateEndpointConnections: []*armelasticsan.PrivateEndpointConnection{ - // { - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}")}, - // PrivateEndpoint: &armelasticsan.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}"), - // }, - // PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // }}, - // ProtocolType: to.Ptr(armelasticsan.StorageTargetTypeIscsi), - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Create_MaximumSet_Gen.json -func ExampleVolumeGroupsClient_BeginCreate_volumeGroupsCreateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVolumeGroupsClient().BeginCreate(ctx, "resourcegroupname", "elasticsanname", "volumegroupname", armelasticsan.VolumeGroup{ - Properties: &armelasticsan.VolumeGroupProperties{ - Encryption: to.Ptr(armelasticsan.EncryptionTypeEncryptionAtRestWithPlatformKey), - NetworkACLs: &armelasticsan.NetworkRuleSet{ - VirtualNetworkRules: []*armelasticsan.VirtualNetworkRule{ - { - Action: to.Ptr("Allow"), - VirtualNetworkResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}"), - }}, - }, - ProtocolType: to.Ptr(armelasticsan.StorageTargetTypeIscsi), - }, - }, 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.VolumeGroup = armelasticsan.VolumeGroup{ - // Name: to.Ptr("cr"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/volumeGroups"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // CreatedBy: to.Ptr("zloujisrarsox"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // LastModifiedBy: to.Ptr("lmdztjjcmdfzam"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.VolumeGroupProperties{ - // Encryption: to.Ptr(armelasticsan.EncryptionTypeEncryptionAtRestWithPlatformKey), - // NetworkACLs: &armelasticsan.NetworkRuleSet{ - // VirtualNetworkRules: []*armelasticsan.VirtualNetworkRule{ - // { - // Action: to.Ptr("Allow"), - // VirtualNetworkResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}"), - // State: to.Ptr(armelasticsan.StateProvisioning), - // }}, - // }, - // ProtocolType: to.Ptr(armelasticsan.StorageTargetTypeIscsi), - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Create_MinimumSet_Gen.json -func ExampleVolumeGroupsClient_BeginCreate_volumeGroupsCreateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVolumeGroupsClient().BeginCreate(ctx, "resourcegroupname", "elasticsanname", "volumegroupname", armelasticsan.VolumeGroup{}, 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.VolumeGroup = armelasticsan.VolumeGroup{ - // Name: to.Ptr("cr"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/volumeGroups"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // CreatedBy: to.Ptr("zloujisrarsox"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // LastModifiedBy: to.Ptr("lmdztjjcmdfzam"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.VolumeGroupProperties{ - // Encryption: to.Ptr(armelasticsan.EncryptionTypeEncryptionAtRestWithPlatformKey), - // NetworkACLs: &armelasticsan.NetworkRuleSet{ - // VirtualNetworkRules: []*armelasticsan.VirtualNetworkRule{ - // { - // Action: to.Ptr("Allow"), - // VirtualNetworkResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}"), - // State: to.Ptr(armelasticsan.StateProvisioning), - // }}, - // }, - // ProtocolType: to.Ptr(armelasticsan.StorageTargetTypeIscsi), - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Update_MaximumSet_Gen.json -func ExampleVolumeGroupsClient_BeginUpdate_volumeGroupsUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVolumeGroupsClient().BeginUpdate(ctx, "resourcegroupname", "elasticsanname", "volumegroupname", armelasticsan.VolumeGroupUpdate{ - Properties: &armelasticsan.VolumeGroupUpdateProperties{ - Encryption: to.Ptr(armelasticsan.EncryptionTypeEncryptionAtRestWithPlatformKey), - NetworkACLs: &armelasticsan.NetworkRuleSet{ - VirtualNetworkRules: []*armelasticsan.VirtualNetworkRule{ - { - Action: to.Ptr("Allow"), - VirtualNetworkResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}"), - }}, - }, - ProtocolType: to.Ptr(armelasticsan.StorageTargetTypeIscsi), - }, - }, 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.VolumeGroup = armelasticsan.VolumeGroup{ - // Name: to.Ptr("cr"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/volumeGroups"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // CreatedBy: to.Ptr("zloujisrarsox"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // LastModifiedBy: to.Ptr("lmdztjjcmdfzam"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.VolumeGroupProperties{ - // Encryption: to.Ptr(armelasticsan.EncryptionTypeEncryptionAtRestWithPlatformKey), - // NetworkACLs: &armelasticsan.NetworkRuleSet{ - // VirtualNetworkRules: []*armelasticsan.VirtualNetworkRule{ - // { - // Action: to.Ptr("Allow"), - // VirtualNetworkResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}"), - // State: to.Ptr(armelasticsan.StateProvisioning), - // }}, - // }, - // PrivateEndpointConnections: []*armelasticsan.PrivateEndpointConnection{ - // { - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}")}, - // PrivateEndpoint: &armelasticsan.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}"), - // }, - // PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // }}, - // ProtocolType: to.Ptr(armelasticsan.StorageTargetTypeIscsi), - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Update_MinimumSet_Gen.json -func ExampleVolumeGroupsClient_BeginUpdate_volumeGroupsUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVolumeGroupsClient().BeginUpdate(ctx, "resourcegroupname", "elasticsanname", "volumegroupname", armelasticsan.VolumeGroupUpdate{}, 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.VolumeGroup = armelasticsan.VolumeGroup{ - // Name: to.Ptr("cr"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/volumeGroups"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // CreatedBy: to.Ptr("zloujisrarsox"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // LastModifiedBy: to.Ptr("lmdztjjcmdfzam"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.VolumeGroupProperties{ - // Encryption: to.Ptr(armelasticsan.EncryptionTypeEncryptionAtRestWithPlatformKey), - // NetworkACLs: &armelasticsan.NetworkRuleSet{ - // VirtualNetworkRules: []*armelasticsan.VirtualNetworkRule{ - // { - // Action: to.Ptr("Allow"), - // VirtualNetworkResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}"), - // State: to.Ptr(armelasticsan.StateProvisioning), - // }}, - // }, - // PrivateEndpointConnections: []*armelasticsan.PrivateEndpointConnection{ - // { - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}")}, - // PrivateEndpoint: &armelasticsan.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}"), - // }, - // PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // }}, - // ProtocolType: to.Ptr(armelasticsan.StorageTargetTypeIscsi), - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Delete_MaximumSet_Gen.json -func ExampleVolumeGroupsClient_BeginDelete_volumeGroupsDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVolumeGroupsClient().BeginDelete(ctx, "resourcegroupname", "elasticsanname", "volumegroupname", 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/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Delete_MinimumSet_Gen.json -func ExampleVolumeGroupsClient_BeginDelete_volumeGroupsDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVolumeGroupsClient().BeginDelete(ctx, "resourcegroupname", "elasticsanname", "volumegroupname", 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/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Get_MaximumSet_Gen.json -func ExampleVolumeGroupsClient_Get_volumeGroupsGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVolumeGroupsClient().Get(ctx, "resourcegroupname", "elasticsanname", "volumegroupname", 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.VolumeGroup = armelasticsan.VolumeGroup{ - // Name: to.Ptr("cr"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/volumeGroups"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // CreatedBy: to.Ptr("zloujisrarsox"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // LastModifiedBy: to.Ptr("lmdztjjcmdfzam"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.VolumeGroupProperties{ - // Encryption: to.Ptr(armelasticsan.EncryptionTypeEncryptionAtRestWithPlatformKey), - // NetworkACLs: &armelasticsan.NetworkRuleSet{ - // VirtualNetworkRules: []*armelasticsan.VirtualNetworkRule{ - // { - // Action: to.Ptr("Allow"), - // VirtualNetworkResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}"), - // State: to.Ptr(armelasticsan.StateProvisioning), - // }}, - // }, - // PrivateEndpointConnections: []*armelasticsan.PrivateEndpointConnection{ - // { - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}")}, - // PrivateEndpoint: &armelasticsan.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}"), - // }, - // PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // }}, - // ProtocolType: to.Ptr(armelasticsan.StorageTargetTypeIscsi), - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Get_MinimumSet_Gen.json -func ExampleVolumeGroupsClient_Get_volumeGroupsGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVolumeGroupsClient().Get(ctx, "resourcegroupname", "elasticsanname", "volumegroupname", 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.VolumeGroup = armelasticsan.VolumeGroup{ - // Name: to.Ptr("cr"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/volumeGroups"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // CreatedBy: to.Ptr("zloujisrarsox"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // LastModifiedBy: to.Ptr("lmdztjjcmdfzam"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.VolumeGroupProperties{ - // Encryption: to.Ptr(armelasticsan.EncryptionTypeEncryptionAtRestWithPlatformKey), - // NetworkACLs: &armelasticsan.NetworkRuleSet{ - // VirtualNetworkRules: []*armelasticsan.VirtualNetworkRule{ - // { - // Action: to.Ptr("Allow"), - // VirtualNetworkResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}"), - // State: to.Ptr(armelasticsan.StateProvisioning), - // }}, - // }, - // PrivateEndpointConnections: []*armelasticsan.PrivateEndpointConnection{ - // { - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // CreatedBy: to.Ptr("otfifnrahdshqombvtg"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T09:59:45.919Z"); return t}()), - // LastModifiedBy: to.Ptr("jnaxavnlhrboshtidtib"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}")}, - // PrivateEndpoint: &armelasticsan.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}"), - // }, - // PrivateLinkServiceConnectionState: &armelasticsan.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armelasticsan.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // }}, - // ProtocolType: to.Ptr(armelasticsan.StorageTargetTypeIscsi), - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // }, - // } -} diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/volumes_client.go b/sdk/resourcemanager/elasticsan/armelasticsan/volumes_client.go index 87105e3a9a61..d051c3023d65 100644 --- a/sdk/resourcemanager/elasticsan/armelasticsan/volumes_client.go +++ b/sdk/resourcemanager/elasticsan/armelasticsan/volumes_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// 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. -// DO NOT EDIT. package armelasticsan @@ -47,7 +46,7 @@ func NewVolumesClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreate - Create a Volume. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - elasticSanName - The name of the ElasticSan. // - volumeGroupName - The name of the VolumeGroup. @@ -60,9 +59,10 @@ func (client *VolumesClient) BeginCreate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VolumesClientCreateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VolumesClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[VolumesClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,20 +71,22 @@ func (client *VolumesClient) BeginCreate(ctx context.Context, resourceGroupName // Create - Create a Volume. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 func (client *VolumesClient) create(ctx context.Context, resourceGroupName string, elasticSanName string, volumeGroupName string, volumeName string, parameters Volume, options *VolumesClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, elasticSanName, volumeGroupName, volumeName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -115,16 +117,19 @@ func (client *VolumesClient) createCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete an Volume. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - elasticSanName - The name of the ElasticSan. // - volumeGroupName - The name of the VolumeGroup. @@ -136,9 +141,10 @@ func (client *VolumesClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VolumesClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VolumesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[VolumesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -147,20 +153,22 @@ func (client *VolumesClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Delete an Volume. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 func (client *VolumesClient) deleteOperation(ctx context.Context, resourceGroupName string, elasticSanName string, volumeGroupName string, volumeName string, options *VolumesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, elasticSanName, volumeGroupName, volumeName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -191,8 +199,14 @@ func (client *VolumesClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.XMSDeleteSnapshots != nil { + req.Raw().Header["x-ms-delete-snapshots"] = []string{string(*options.XMSDeleteSnapshots)} + } + if options != nil && options.XMSForceDelete != nil { + req.Raw().Header["x-ms-force-delete"] = []string{string(*options.XMSForceDelete)} + } req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -200,25 +214,28 @@ func (client *VolumesClient) deleteCreateRequest(ctx context.Context, resourceGr // Get - Get an Volume. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - elasticSanName - The name of the ElasticSan. // - volumeGroupName - The name of the VolumeGroup. // - volumeName - The name of the Volume. // - options - VolumesClientGetOptions contains the optional parameters for the VolumesClient.Get method. func (client *VolumesClient) Get(ctx context.Context, resourceGroupName string, elasticSanName string, volumeGroupName string, volumeName string, options *VolumesClientGetOptions) (VolumesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, elasticSanName, volumeGroupName, volumeName, options) if err != nil { return VolumesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VolumesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VolumesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VolumesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -249,7 +266,7 @@ func (client *VolumesClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -266,7 +283,7 @@ func (client *VolumesClient) getHandleResponse(resp *http.Response) (VolumesClie // NewListByVolumeGroupPager - List Volumes in a VolumeGroup. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - elasticSanName - The name of the ElasticSan. // - volumeGroupName - The name of the VolumeGroup. @@ -324,7 +341,7 @@ func (client *VolumesClient) listByVolumeGroupCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -342,7 +359,7 @@ func (client *VolumesClient) listByVolumeGroupHandleResponse(resp *http.Response // BeginUpdate - Update an Volume. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - elasticSanName - The name of the ElasticSan. // - volumeGroupName - The name of the VolumeGroup. @@ -355,9 +372,10 @@ func (client *VolumesClient) BeginUpdate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VolumesClientUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VolumesClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[VolumesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -366,20 +384,22 @@ func (client *VolumesClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Update an Volume. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview +// Generated from API version 2023-01-01 func (client *VolumesClient) update(ctx context.Context, resourceGroupName string, elasticSanName string, volumeGroupName string, volumeName string, parameters VolumeUpdate, options *VolumesClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, elasticSanName, volumeGroupName, volumeName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -410,8 +430,11 @@ func (client *VolumesClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/volumes_client_example_test.go b/sdk/resourcemanager/elasticsan/armelasticsan/volumes_client_example_test.go deleted file mode 100644 index c6df8d914e15..000000000000 --- a/sdk/resourcemanager/elasticsan/armelasticsan/volumes_client_example_test.go +++ /dev/null @@ -1,493 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armelasticsan_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/elasticsan/armelasticsan" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Create_MaximumSet_Gen.json -func ExampleVolumesClient_BeginCreate_volumesCreateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVolumesClient().BeginCreate(ctx, "resourcegroupname", "elasticsanname", "volumegroupname", "volumename", armelasticsan.Volume{ - Properties: &armelasticsan.VolumeProperties{ - CreationData: &armelasticsan.SourceCreationData{ - CreateSource: to.Ptr("None"), - SourceURI: to.Ptr(" ARM Id of resource"), - }, - SizeGiB: to.Ptr[int64](23), - }, - }, 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.Volume = armelasticsan.Volume{ - // Name: to.Ptr("ipmipjggodoxjua"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // CreatedBy: to.Ptr("zloujisrarsox"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // LastModifiedBy: to.Ptr("lmdztjjcmdfzam"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.VolumeProperties{ - // CreationData: &armelasticsan.SourceCreationData{ - // CreateSource: to.Ptr("None"), - // SourceURI: to.Ptr(" ARM Id of resource"), - // }, - // SizeGiB: to.Ptr[int64](23), - // StorageTarget: &armelasticsan.IscsiTargetInfo{ - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // Status: to.Ptr(armelasticsan.OperationalStatusInvalid), - // TargetIqn: to.Ptr("yuuex"), - // TargetPortalHostname: to.Ptr("yktnmynpdjpmztwuwcvipp"), - // TargetPortalPort: to.Ptr[int32](3), - // }, - // VolumeID: to.Ptr("hkbhievbyopwjqawbyvqi"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Create_MinimumSet_Gen.json -func ExampleVolumesClient_BeginCreate_volumesCreateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVolumesClient().BeginCreate(ctx, "resourcegroupname", "elasticsanname", "volumegroupname", "volumename", armelasticsan.Volume{ - Properties: &armelasticsan.VolumeProperties{ - SizeGiB: to.Ptr[int64](23), - }, - }, 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.Volume = armelasticsan.Volume{ - // Name: to.Ptr("ipmipjggodoxjua"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // CreatedBy: to.Ptr("zloujisrarsox"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // LastModifiedBy: to.Ptr("lmdztjjcmdfzam"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.VolumeProperties{ - // CreationData: &armelasticsan.SourceCreationData{ - // CreateSource: to.Ptr("None"), - // SourceURI: to.Ptr(" ARM Id of resource"), - // }, - // SizeGiB: to.Ptr[int64](23), - // StorageTarget: &armelasticsan.IscsiTargetInfo{ - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // Status: to.Ptr(armelasticsan.OperationalStatusInvalid), - // TargetIqn: to.Ptr("yuuex"), - // TargetPortalHostname: to.Ptr("yktnmynpdjpmztwuwcvipp"), - // TargetPortalPort: to.Ptr[int32](3), - // }, - // VolumeID: to.Ptr("hkbhievbyopwjqawbyvqi"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Update_MaximumSet_Gen.json -func ExampleVolumesClient_BeginUpdate_volumesUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVolumesClient().BeginUpdate(ctx, "resourcegroupname", "elasticsanname", "volumegroupname", "volumename", armelasticsan.VolumeUpdate{ - Properties: &armelasticsan.VolumeUpdateProperties{ - SizeGiB: to.Ptr[int64](11), - }, - }, 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.Volume = armelasticsan.Volume{ - // Name: to.Ptr("ipmipjggodoxjua"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // CreatedBy: to.Ptr("zloujisrarsox"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // LastModifiedBy: to.Ptr("lmdztjjcmdfzam"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.VolumeProperties{ - // CreationData: &armelasticsan.SourceCreationData{ - // CreateSource: to.Ptr("None"), - // SourceURI: to.Ptr(" ARM Id of resource"), - // }, - // SizeGiB: to.Ptr[int64](23), - // StorageTarget: &armelasticsan.IscsiTargetInfo{ - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // Status: to.Ptr(armelasticsan.OperationalStatusInvalid), - // TargetIqn: to.Ptr("yuuex"), - // TargetPortalHostname: to.Ptr("yktnmynpdjpmztwuwcvipp"), - // TargetPortalPort: to.Ptr[int32](3), - // }, - // VolumeID: to.Ptr("hkbhievbyopwjqawbyvqi"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Update_MinimumSet_Gen.json -func ExampleVolumesClient_BeginUpdate_volumesUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVolumesClient().BeginUpdate(ctx, "resourcegroupname", "elasticsanname", "volumegroupname", "volumename", armelasticsan.VolumeUpdate{}, 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.Volume = armelasticsan.Volume{ - // Name: to.Ptr("ipmipjggodoxjua"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // CreatedBy: to.Ptr("zloujisrarsox"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // LastModifiedBy: to.Ptr("lmdztjjcmdfzam"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.VolumeProperties{ - // CreationData: &armelasticsan.SourceCreationData{ - // CreateSource: to.Ptr("None"), - // SourceURI: to.Ptr(" ARM Id of resource"), - // }, - // SizeGiB: to.Ptr[int64](23), - // StorageTarget: &armelasticsan.IscsiTargetInfo{ - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // Status: to.Ptr(armelasticsan.OperationalStatusInvalid), - // TargetIqn: to.Ptr("yuuex"), - // TargetPortalHostname: to.Ptr("yktnmynpdjpmztwuwcvipp"), - // TargetPortalPort: to.Ptr[int32](3), - // }, - // VolumeID: to.Ptr("hkbhievbyopwjqawbyvqi"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Delete_MaximumSet_Gen.json -func ExampleVolumesClient_BeginDelete_volumesDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVolumesClient().BeginDelete(ctx, "resourcegroupname", "elasticsanname", "volumegroupname", "volumename", 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/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Delete_MinimumSet_Gen.json -func ExampleVolumesClient_BeginDelete_volumesDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVolumesClient().BeginDelete(ctx, "resourcegroupname", "elasticsanname", "volumegroupname", "volumename", 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/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Get_MaximumSet_Gen.json -func ExampleVolumesClient_Get_volumesGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVolumesClient().Get(ctx, "resourcegroupname", "elasticsanname", "volumegroupname", "volumename", 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.Volume = armelasticsan.Volume{ - // Name: to.Ptr("ipmipjggodoxjua"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // CreatedBy: to.Ptr("zloujisrarsox"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // LastModifiedBy: to.Ptr("lmdztjjcmdfzam"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.VolumeProperties{ - // CreationData: &armelasticsan.SourceCreationData{ - // CreateSource: to.Ptr("None"), - // SourceURI: to.Ptr(" ARM Id of resource"), - // }, - // SizeGiB: to.Ptr[int64](23), - // StorageTarget: &armelasticsan.IscsiTargetInfo{ - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // Status: to.Ptr(armelasticsan.OperationalStatusInvalid), - // TargetIqn: to.Ptr("yuuex"), - // TargetPortalHostname: to.Ptr("yktnmynpdjpmztwuwcvipp"), - // TargetPortalPort: to.Ptr[int32](3), - // }, - // VolumeID: to.Ptr("hkbhievbyopwjqawbyvqi"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Get_MinimumSet_Gen.json -func ExampleVolumesClient_Get_volumesGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVolumesClient().Get(ctx, "resourcegroupname", "elasticsanname", "volumegroupname", "volumename", 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.Volume = armelasticsan.Volume{ - // Name: to.Ptr("ipmipjggodoxjua"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // CreatedBy: to.Ptr("zloujisrarsox"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // LastModifiedBy: to.Ptr("lmdztjjcmdfzam"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.VolumeProperties{ - // CreationData: &armelasticsan.SourceCreationData{ - // CreateSource: to.Ptr("None"), - // SourceURI: to.Ptr(" ARM Id of resource"), - // }, - // SizeGiB: to.Ptr[int64](23), - // StorageTarget: &armelasticsan.IscsiTargetInfo{ - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // Status: to.Ptr(armelasticsan.OperationalStatusInvalid), - // TargetIqn: to.Ptr("yuuex"), - // TargetPortalHostname: to.Ptr("yktnmynpdjpmztwuwcvipp"), - // TargetPortalPort: to.Ptr[int32](3), - // }, - // VolumeID: to.Ptr("hkbhievbyopwjqawbyvqi"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_ListByVolumeGroup_MaximumSet_Gen.json -func ExampleVolumesClient_NewListByVolumeGroupPager_volumesListByVolumeGroupMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVolumesClient().NewListByVolumeGroupPager("resourcegroupname", "elasticsanname", "volumegroupname", 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.VolumeList = armelasticsan.VolumeList{ - // Value: []*armelasticsan.Volume{ - // { - // Name: to.Ptr("ipmipjggodoxjua"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // CreatedBy: to.Ptr("zloujisrarsox"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // LastModifiedBy: to.Ptr("lmdztjjcmdfzam"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.VolumeProperties{ - // CreationData: &armelasticsan.SourceCreationData{ - // CreateSource: to.Ptr("None"), - // SourceURI: to.Ptr(" ARM Id of resource"), - // }, - // SizeGiB: to.Ptr[int64](23), - // StorageTarget: &armelasticsan.IscsiTargetInfo{ - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // Status: to.Ptr(armelasticsan.OperationalStatusInvalid), - // TargetIqn: to.Ptr("yuuex"), - // TargetPortalHostname: to.Ptr("yktnmynpdjpmztwuwcvipp"), - // TargetPortalPort: to.Ptr[int32](3), - // }, - // VolumeID: to.Ptr("hkbhievbyopwjqawbyvqi"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_ListByVolumeGroup_MinimumSet_Gen.json -func ExampleVolumesClient_NewListByVolumeGroupPager_volumesListByVolumeGroupMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armelasticsan.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVolumesClient().NewListByVolumeGroupPager("resourcegroupname", "elasticsanname", "volumegroupname", 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.VolumeList = armelasticsan.VolumeList{ - // Value: []*armelasticsan.Volume{ - // { - // Name: to.Ptr("ipmipjggodoxjua"), - // Type: to.Ptr("Microsoft.ElasticSan/elasticSans"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}"), - // SystemData: &armelasticsan.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // CreatedBy: to.Ptr("zloujisrarsox"), - // CreatedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-04T05:52:15.371Z"); return t}()), - // LastModifiedBy: to.Ptr("lmdztjjcmdfzam"), - // LastModifiedByType: to.Ptr(armelasticsan.CreatedByTypeUser), - // }, - // Properties: &armelasticsan.VolumeProperties{ - // CreationData: &armelasticsan.SourceCreationData{ - // CreateSource: to.Ptr("None"), - // SourceURI: to.Ptr(" ARM Id of resource"), - // }, - // SizeGiB: to.Ptr[int64](23), - // StorageTarget: &armelasticsan.IscsiTargetInfo{ - // ProvisioningState: to.Ptr(armelasticsan.ProvisioningStatesSucceeded), - // Status: to.Ptr(armelasticsan.OperationalStatusInvalid), - // TargetIqn: to.Ptr("yuuex"), - // TargetPortalHostname: to.Ptr("yktnmynpdjpmztwuwcvipp"), - // TargetPortalPort: to.Ptr[int32](3), - // }, - // VolumeID: to.Ptr("hkbhievbyopwjqawbyvqi"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/elasticsan/armelasticsan/volumesnapshots_client.go b/sdk/resourcemanager/elasticsan/armelasticsan/volumesnapshots_client.go new file mode 100644 index 000000000000..21f7cb3d0a42 --- /dev/null +++ b/sdk/resourcemanager/elasticsan/armelasticsan/volumesnapshots_client.go @@ -0,0 +1,356 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armelasticsan + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VolumeSnapshotsClient contains the methods for the VolumeSnapshots group. +// Don't use this type directly, use NewVolumeSnapshotsClient() instead. +type VolumeSnapshotsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVolumeSnapshotsClient creates a new instance of VolumeSnapshotsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVolumeSnapshotsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VolumeSnapshotsClient, error) { + cl, err := arm.NewClient(moduleName+".VolumeSnapshotsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VolumeSnapshotsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Create a Volume Snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - elasticSanName - The name of the ElasticSan. +// - volumeGroupName - The name of the VolumeGroup. +// - snapshotName - The name of the volume snapshot within the given volume group. +// - parameters - Snapshot object. +// - options - VolumeSnapshotsClientBeginCreateOptions contains the optional parameters for the VolumeSnapshotsClient.BeginCreate +// method. +func (client *VolumeSnapshotsClient) BeginCreate(ctx context.Context, resourceGroupName string, elasticSanName string, volumeGroupName string, snapshotName string, parameters Snapshot, options *VolumeSnapshotsClientBeginCreateOptions) (*runtime.Poller[VolumeSnapshotsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, elasticSanName, volumeGroupName, snapshotName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VolumeSnapshotsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VolumeSnapshotsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Create - Create a Volume Snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +func (client *VolumeSnapshotsClient) create(ctx context.Context, resourceGroupName string, elasticSanName string, volumeGroupName string, snapshotName string, parameters Snapshot, options *VolumeSnapshotsClientBeginCreateOptions) (*http.Response, error) { + var err error + req, err := client.createCreateRequest(ctx, resourceGroupName, elasticSanName, volumeGroupName, snapshotName, 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.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *VolumeSnapshotsClient) createCreateRequest(ctx context.Context, resourceGroupName string, elasticSanName string, volumeGroupName string, snapshotName string, parameters Snapshot, options *VolumeSnapshotsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName}" + 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 elasticSanName == "" { + return nil, errors.New("parameter elasticSanName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{elasticSanName}", url.PathEscape(elasticSanName)) + if volumeGroupName == "" { + return nil, errors.New("parameter volumeGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeGroupName}", url.PathEscape(volumeGroupName)) + if snapshotName == "" { + return nil, errors.New("parameter snapshotName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a Volume Snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - elasticSanName - The name of the ElasticSan. +// - volumeGroupName - The name of the VolumeGroup. +// - snapshotName - The name of the volume snapshot within the given volume group. +// - options - VolumeSnapshotsClientBeginDeleteOptions contains the optional parameters for the VolumeSnapshotsClient.BeginDelete +// method. +func (client *VolumeSnapshotsClient) BeginDelete(ctx context.Context, resourceGroupName string, elasticSanName string, volumeGroupName string, snapshotName string, options *VolumeSnapshotsClientBeginDeleteOptions) (*runtime.Poller[VolumeSnapshotsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, elasticSanName, volumeGroupName, snapshotName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VolumeSnapshotsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VolumeSnapshotsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Delete a Volume Snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +func (client *VolumeSnapshotsClient) deleteOperation(ctx context.Context, resourceGroupName string, elasticSanName string, volumeGroupName string, snapshotName string, options *VolumeSnapshotsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, elasticSanName, volumeGroupName, snapshotName, 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, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VolumeSnapshotsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, elasticSanName string, volumeGroupName string, snapshotName string, options *VolumeSnapshotsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName}" + 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 elasticSanName == "" { + return nil, errors.New("parameter elasticSanName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{elasticSanName}", url.PathEscape(elasticSanName)) + if volumeGroupName == "" { + return nil, errors.New("parameter volumeGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeGroupName}", url.PathEscape(volumeGroupName)) + if snapshotName == "" { + return nil, errors.New("parameter snapshotName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Volume Snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - elasticSanName - The name of the ElasticSan. +// - volumeGroupName - The name of the VolumeGroup. +// - snapshotName - The name of the volume snapshot within the given volume group. +// - options - VolumeSnapshotsClientGetOptions contains the optional parameters for the VolumeSnapshotsClient.Get method. +func (client *VolumeSnapshotsClient) Get(ctx context.Context, resourceGroupName string, elasticSanName string, volumeGroupName string, snapshotName string, options *VolumeSnapshotsClientGetOptions) (VolumeSnapshotsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, elasticSanName, volumeGroupName, snapshotName, options) + if err != nil { + return VolumeSnapshotsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VolumeSnapshotsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VolumeSnapshotsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *VolumeSnapshotsClient) getCreateRequest(ctx context.Context, resourceGroupName string, elasticSanName string, volumeGroupName string, snapshotName string, options *VolumeSnapshotsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName}" + 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 elasticSanName == "" { + return nil, errors.New("parameter elasticSanName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{elasticSanName}", url.PathEscape(elasticSanName)) + if volumeGroupName == "" { + return nil, errors.New("parameter volumeGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeGroupName}", url.PathEscape(volumeGroupName)) + if snapshotName == "" { + return nil, errors.New("parameter snapshotName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) + 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", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VolumeSnapshotsClient) getHandleResponse(resp *http.Response) (VolumeSnapshotsClientGetResponse, error) { + result := VolumeSnapshotsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Snapshot); err != nil { + return VolumeSnapshotsClientGetResponse{}, err + } + return result, nil +} + +// NewListByVolumeGroupPager - List Snapshots in a VolumeGroup or List Snapshots by Volume (name) in a VolumeGroup using filter +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - elasticSanName - The name of the ElasticSan. +// - volumeGroupName - The name of the VolumeGroup. +// - options - VolumeSnapshotsClientListByVolumeGroupOptions contains the optional parameters for the VolumeSnapshotsClient.NewListByVolumeGroupPager +// method. +func (client *VolumeSnapshotsClient) NewListByVolumeGroupPager(resourceGroupName string, elasticSanName string, volumeGroupName string, options *VolumeSnapshotsClientListByVolumeGroupOptions) *runtime.Pager[VolumeSnapshotsClientListByVolumeGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[VolumeSnapshotsClientListByVolumeGroupResponse]{ + More: func(page VolumeSnapshotsClientListByVolumeGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VolumeSnapshotsClientListByVolumeGroupResponse) (VolumeSnapshotsClientListByVolumeGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByVolumeGroupCreateRequest(ctx, resourceGroupName, elasticSanName, volumeGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VolumeSnapshotsClientListByVolumeGroupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VolumeSnapshotsClientListByVolumeGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VolumeSnapshotsClientListByVolumeGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByVolumeGroupHandleResponse(resp) + }, + }) +} + +// listByVolumeGroupCreateRequest creates the ListByVolumeGroup request. +func (client *VolumeSnapshotsClient) listByVolumeGroupCreateRequest(ctx context.Context, resourceGroupName string, elasticSanName string, volumeGroupName string, options *VolumeSnapshotsClientListByVolumeGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots" + 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 elasticSanName == "" { + return nil, errors.New("parameter elasticSanName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{elasticSanName}", url.PathEscape(elasticSanName)) + if volumeGroupName == "" { + return nil, errors.New("parameter volumeGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeGroupName}", url.PathEscape(volumeGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByVolumeGroupHandleResponse handles the ListByVolumeGroup response. +func (client *VolumeSnapshotsClient) listByVolumeGroupHandleResponse(resp *http.Response) (VolumeSnapshotsClientListByVolumeGroupResponse, error) { + result := VolumeSnapshotsClientListByVolumeGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SnapshotList); err != nil { + return VolumeSnapshotsClientListByVolumeGroupResponse{}, err + } + return result, nil +}