From 6cce1c3b62be6f3b1d2328ae671f4d4101c85c9a Mon Sep 17 00:00:00 2001 From: ReleaseHelper Date: Mon, 1 Jan 2024 01:10:24 +0000 Subject: [PATCH 1/2] [Release] sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/2.0.0-beta.1 generation from spec commit: 41e4538ed7bb3ceac3c1322c9455a0812ed110ac --- .../armhardwaresecuritymodules/CHANGELOG.md | 69 + .../armhardwaresecuritymodules/README.md | 6 +- .../armhardwaresecuritymodules/autorest.md | 8 +- .../client_factory.go | 27 +- ...lusterprivateendpointconnections_client.go | 273 ++++ ...endpointconnections_client_example_test.go | 135 ++ ...udhsmclusterprivatelinkresources_client.go | 110 ++ ...rivatelinkresources_client_example_test.go | 55 + .../cloudhsmclusters_client.go | 473 ++++++ .../cloudhsmclusters_client_example_test.go | 526 ++++++ .../armhardwaresecuritymodules/constants.go | 138 +- .../dedicatedhsm_client.go | 3 +- .../dedicatedhsm_client_example_test.go | 46 +- ...lusterprivateendpointconnections_server.go | 209 +++ ...udhsmclusterprivatelinkresources_server.go | 100 ++ .../fake/cloudhsmclusters_server.go | 377 +++++ .../fake/dedicatedhsm_server.go | 2 +- .../fake/internal.go | 8 + .../fake/operations_server.go | 2 +- .../fake/privateendpointconnections_server.go | 112 ++ .../fake/server_factory.go | 40 +- .../armhardwaresecuritymodules/go.mod | 2 +- .../armhardwaresecuritymodules/models.go | 426 ++++- .../models_serde.go | 1453 ++++++++++++++--- .../operations_client_example_test.go | 12 +- .../armhardwaresecuritymodules/options.go | 69 + .../privateendpointconnections_client.go | 111 ++ ...endpointconnections_client_example_test.go | 94 ++ .../response_types.go | 64 + 29 files changed, 4672 insertions(+), 278 deletions(-) create mode 100644 sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivateendpointconnections_client.go create mode 100644 sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivateendpointconnections_client_example_test.go create mode 100644 sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivatelinkresources_client.go create mode 100644 sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivatelinkresources_client_example_test.go create mode 100644 sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusters_client.go create mode 100644 sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusters_client_example_test.go create mode 100644 sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterprivateendpointconnections_server.go create mode 100644 sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterprivatelinkresources_server.go create mode 100644 sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusters_server.go create mode 100644 sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/privateendpointconnections_server.go create mode 100644 sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/privateendpointconnections_client.go create mode 100644 sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/privateendpointconnections_client_example_test.go diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/CHANGELOG.md b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/CHANGELOG.md index 68a91986959d..bdf6821f418b 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/CHANGELOG.md +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/CHANGELOG.md @@ -1,5 +1,74 @@ # Release History +## 2.0.0-beta.1 (2024-01-26) +### Breaking Changes + +- Type of `DedicatedHsm.SystemData` has been changed from `*SystemData` to `*SystemDataAutoGenerated` +- Type of `DedicatedHsmOperation.IsDataAction` has been changed from `*string` to `*bool` +- Type of `ResourceListResult.Value` has been changed from `[]*Resource` to `[]*DedicatedHsmResource` +- Type of `SystemData.CreatedByType` has been changed from `*IdentityType` to `*CreatedByType` +- Type of `SystemData.LastModifiedByType` has been changed from `*IdentityType` to `*CreatedByType` +- Field `Location`, `SKU`, `Tags`, `Zones` of struct `Resource` has been removed + +### Features Added + +- New enum type `CloudHsmClusterSKUFamily` with values `CloudHsmClusterSKUFamilyB` +- New enum type `CloudHsmClusterSKUName` with values `CloudHsmClusterSKUNameStandardB1`, `CloudHsmClusterSKUNameStandardB10` +- New enum type `CreatedByType` with values `CreatedByTypeApplication`, `CreatedByTypeKey`, `CreatedByTypeManagedIdentity`, `CreatedByTypeUser` +- New enum type `ManagedServiceIdentityType` with values `ManagedServiceIdentityTypeNone`, `ManagedServiceIdentityTypeSystemAssigned`, `ManagedServiceIdentityTypeSystemAssignedUserAssigned`, `ManagedServiceIdentityTypeUserAssigned` +- New enum type `PrivateEndpointConnectionProvisioningState` with values `PrivateEndpointConnectionProvisioningStateCanceled`, `PrivateEndpointConnectionProvisioningStateCreating`, `PrivateEndpointConnectionProvisioningStateDeleting`, `PrivateEndpointConnectionProvisioningStateFailed`, `PrivateEndpointConnectionProvisioningStateInternalError`, `PrivateEndpointConnectionProvisioningStateSucceeded`, `PrivateEndpointConnectionProvisioningStateUpdating` +- New enum type `PrivateEndpointServiceConnectionStatus` with values `PrivateEndpointServiceConnectionStatusApproved`, `PrivateEndpointServiceConnectionStatusPending`, `PrivateEndpointServiceConnectionStatusRejected` +- New enum type `ProvisioningState` with values `ProvisioningStateCanceled`, `ProvisioningStateDeleting`, `ProvisioningStateFailed`, `ProvisioningStateProvisioning`, `ProvisioningStateSucceeded` +- New function `*ClientFactory.NewCloudHsmClusterPrivateEndpointConnectionsClient() *CloudHsmClusterPrivateEndpointConnectionsClient` +- New function `*ClientFactory.NewCloudHsmClusterPrivateLinkResourcesClient() *CloudHsmClusterPrivateLinkResourcesClient` +- New function `*ClientFactory.NewCloudHsmClustersClient() *CloudHsmClustersClient` +- New function `*ClientFactory.NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient` +- New function `NewCloudHsmClusterPrivateEndpointConnectionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CloudHsmClusterPrivateEndpointConnectionsClient, error)` +- New function `*CloudHsmClusterPrivateEndpointConnectionsClient.Create(context.Context, string, string, string, PrivateEndpointConnection, *CloudHsmClusterPrivateEndpointConnectionsClientCreateOptions) (CloudHsmClusterPrivateEndpointConnectionsClientCreateResponse, error)` +- New function `*CloudHsmClusterPrivateEndpointConnectionsClient.BeginDelete(context.Context, string, string, string, *CloudHsmClusterPrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[CloudHsmClusterPrivateEndpointConnectionsClientDeleteResponse], error)` +- New function `*CloudHsmClusterPrivateEndpointConnectionsClient.Get(context.Context, string, string, string, *CloudHsmClusterPrivateEndpointConnectionsClientGetOptions) (CloudHsmClusterPrivateEndpointConnectionsClientGetResponse, error)` +- New function `NewCloudHsmClusterPrivateLinkResourcesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CloudHsmClusterPrivateLinkResourcesClient, error)` +- New function `*CloudHsmClusterPrivateLinkResourcesClient.ListByCloudHsmCluster(context.Context, string, string, *CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterOptions) (CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse, error)` +- New function `NewCloudHsmClustersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CloudHsmClustersClient, error)` +- New function `*CloudHsmClustersClient.BeginCreateOrUpdate(context.Context, string, string, CloudHsmCluster, *CloudHsmClustersClientBeginCreateOrUpdateOptions) (*runtime.Poller[CloudHsmClustersClientCreateOrUpdateResponse], error)` +- New function `*CloudHsmClustersClient.BeginDelete(context.Context, string, string, *CloudHsmClustersClientBeginDeleteOptions) (*runtime.Poller[CloudHsmClustersClientDeleteResponse], error)` +- New function `*CloudHsmClustersClient.Get(context.Context, string, string, *CloudHsmClustersClientGetOptions) (CloudHsmClustersClientGetResponse, error)` +- New function `*CloudHsmClustersClient.NewListByResourceGroupPager(string, *CloudHsmClustersClientListByResourceGroupOptions) *runtime.Pager[CloudHsmClustersClientListByResourceGroupResponse]` +- New function `*CloudHsmClustersClient.NewListBySubscriptionPager(*CloudHsmClustersClientListBySubscriptionOptions) *runtime.Pager[CloudHsmClustersClientListBySubscriptionResponse]` +- New function `*CloudHsmClustersClient.BeginUpdate(context.Context, string, string, CloudHsmClusterPatchParameters, *CloudHsmClustersClientBeginUpdateOptions) (*runtime.Poller[CloudHsmClustersClientUpdateResponse], error)` +- New function `NewPrivateEndpointConnectionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error)` +- New function `*PrivateEndpointConnectionsClient.NewListByCloudHsmClusterPager(string, string, *PrivateEndpointConnectionsClientListByCloudHsmClusterOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByCloudHsmClusterResponse]` +- New struct `BackupProperties` +- New struct `CHsmError` +- New struct `CloudHsmCluster` +- New struct `CloudHsmClusterError` +- New struct `CloudHsmClusterListResult` +- New struct `CloudHsmClusterPatchParameters` +- New struct `CloudHsmClusterPatchParametersProperties` +- New struct `CloudHsmClusterProperties` +- New struct `CloudHsmClusterResource` +- New struct `CloudHsmClusterSKU` +- New struct `CloudHsmClusterSecurityDomainProperties` +- New struct `CloudHsmProperties` +- New struct `DedicatedHsmResource` +- New struct `ManagedServiceIdentity` +- New struct `PrivateEndpoint` +- New struct `PrivateEndpointConnection` +- New struct `PrivateEndpointConnectionListResult` +- New struct `PrivateEndpointConnectionProperties` +- New struct `PrivateLinkResource` +- New struct `PrivateLinkResourceListResult` +- New struct `PrivateLinkResourceProperties` +- New struct `PrivateLinkServiceConnectionState` +- New struct `ProxyResource` +- New struct `RestoreProperties` +- New struct `SystemDataAutoGenerated` +- New struct `TrackedResource` +- New struct `UserAssignedIdentity` +- New field `Origin` in struct `DedicatedHsmOperation` +- New field `SystemData` in struct `Resource` + + ## 1.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/README.md b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/README.md index 20482c169788..0b08035508bb 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/README.md +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/README.md @@ -1,6 +1,6 @@ # Azure Dedicated HSM Module for Go -[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules) +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/v2)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/v2) The `armhardwaresecuritymodules` module provides operations for working with Azure Dedicated HSM. @@ -20,7 +20,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Dedicated HSM module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/v2 ``` ## Authorization @@ -57,7 +57,7 @@ clientFactory, err := armhardwaresecuritymodules.NewClientFactory(", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCloudHsmClusterPrivateEndpointConnectionsClient().Create(ctx, "rgcloudhsm", "chsm1", "sample-pec", armhardwaresecuritymodules.PrivateEndpointConnection{ + Properties: &armhardwaresecuritymodules.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &armhardwaresecuritymodules.PrivateLinkServiceConnectionState{ + Description: to.Ptr("My name is Joe and I'm approving this."), + Status: to.Ptr(armhardwaresecuritymodules.PrivateEndpointServiceConnectionStatusApproved), + }, + }, + }, 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 = armhardwaresecuritymodules.PrivateEndpointConnection{ + // Name: to.Ptr("sample-pec"), + // Type: to.Ptr("Microsoft.HardwareSecurityModules/cloudHsmClusters/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcloudhsm/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/chsm1/privateEndpointConnections/sample-pec"), + // SystemData: &armhardwaresecuritymodules.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), + // CreatedBy: to.Ptr("User1"), + // CreatedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), + // LastModifiedBy: to.Ptr("User2"), + // LastModifiedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // }, + // Properties: &armhardwaresecuritymodules.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armhardwaresecuritymodules.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-1234-000000000000/resourceGroups/rgcloudhsm/providers/Microsoft.Network/privateEndpoints/sample-pec"), + // }, + // PrivateLinkServiceConnectionState: &armhardwaresecuritymodules.PrivateLinkServiceConnectionState{ + // Description: to.Ptr("My name is Joe and I'm approving this."), + // ActionsRequired: to.Ptr("None"), + // Status: to.Ptr(armhardwaresecuritymodules.PrivateEndpointServiceConnectionStatusApproved), + // }, + // ProvisioningState: to.Ptr(armhardwaresecuritymodules.PrivateEndpointConnectionProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmClusterPrivateEndpointConnection_Delete_MaximumSet_Gen.json +func ExampleCloudHsmClusterPrivateEndpointConnectionsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhardwaresecuritymodules.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewCloudHsmClusterPrivateEndpointConnectionsClient().BeginDelete(ctx, "rgcloudhsm", "chsm1", "sample-pec", 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/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmClusterPrivateEndpointConnection_Get_MaximumSet_Gen.json +func ExampleCloudHsmClusterPrivateEndpointConnectionsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhardwaresecuritymodules.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCloudHsmClusterPrivateEndpointConnectionsClient().Get(ctx, "rgcloudhsm", "chsm1", "sample-pec", 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 = armhardwaresecuritymodules.PrivateEndpointConnection{ + // Name: to.Ptr("sample-pec"), + // Type: to.Ptr("Microsoft.HardwareSecurityModules/cloudHsmClusters/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcloudhsm/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/chsm1/privateEndpointConnections/sample-pec"), + // SystemData: &armhardwaresecuritymodules.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), + // CreatedBy: to.Ptr("User1"), + // CreatedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), + // LastModifiedBy: to.Ptr("User2"), + // LastModifiedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // }, + // Properties: &armhardwaresecuritymodules.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armhardwaresecuritymodules.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.Network/privateEndpoints/sample-pec"), + // }, + // PrivateLinkServiceConnectionState: &armhardwaresecuritymodules.PrivateLinkServiceConnectionState{ + // Description: to.Ptr("This was automatically approved by user1234@contoso.com"), + // ActionsRequired: to.Ptr("None"), + // Status: to.Ptr(armhardwaresecuritymodules.PrivateEndpointServiceConnectionStatusApproved), + // }, + // ProvisioningState: to.Ptr(armhardwaresecuritymodules.PrivateEndpointConnectionProvisioningStateSucceeded), + // }, + // } +} diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivatelinkresources_client.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivatelinkresources_client.go new file mode 100644 index 000000000000..b2b653fc1684 --- /dev/null +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivatelinkresources_client.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhardwaresecuritymodules + +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" +) + +// CloudHsmClusterPrivateLinkResourcesClient contains the methods for the CloudHsmClusterPrivateLinkResources group. +// Don't use this type directly, use NewCloudHsmClusterPrivateLinkResourcesClient() instead. +type CloudHsmClusterPrivateLinkResourcesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCloudHsmClusterPrivateLinkResourcesClient creates a new instance of CloudHsmClusterPrivateLinkResourcesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewCloudHsmClusterPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CloudHsmClusterPrivateLinkResourcesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CloudHsmClusterPrivateLinkResourcesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// ListByCloudHsmCluster - Gets the private link resources supported for the Cloud Hsm Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-12-10-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudHsmClusterName - The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must +// be between 3 and 24 characters in length. +// - options - CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterOptions contains the optional parameters for the +// CloudHsmClusterPrivateLinkResourcesClient.ListByCloudHsmCluster method. +func (client *CloudHsmClusterPrivateLinkResourcesClient) ListByCloudHsmCluster(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterOptions) (CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse, error) { + var err error + const operationName = "CloudHsmClusterPrivateLinkResourcesClient.ListByCloudHsmCluster" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listByCloudHsmClusterCreateRequest(ctx, resourceGroupName, cloudHsmClusterName, options) + if err != nil { + return CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse{}, err + } + resp, err := client.listByCloudHsmClusterHandleResponse(httpResp) + return resp, err +} + +// listByCloudHsmClusterCreateRequest creates the ListByCloudHsmCluster request. +func (client *CloudHsmClusterPrivateLinkResourcesClient) listByCloudHsmClusterCreateRequest(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateLinkResources" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudHsmClusterName == "" { + return nil, errors.New("parameter cloudHsmClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudHsmClusterName}", url.PathEscape(cloudHsmClusterName)) + 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-12-10-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByCloudHsmClusterHandleResponse handles the ListByCloudHsmCluster response. +func (client *CloudHsmClusterPrivateLinkResourcesClient) listByCloudHsmClusterHandleResponse(resp *http.Response) (CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse, error) { + result := CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { + return CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivatelinkresources_client_example_test.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivatelinkresources_client_example_test.go new file mode 100644 index 000000000000..601a2eaabea8 --- /dev/null +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivatelinkresources_client_example_test.go @@ -0,0 +1,55 @@ +//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 armhardwaresecuritymodules_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmClusterPrivateLinkResource_ListByCloudHsmCluster_MaximumSet_Gen.json +func ExampleCloudHsmClusterPrivateLinkResourcesClient_ListByCloudHsmCluster() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhardwaresecuritymodules.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCloudHsmClusterPrivateLinkResourcesClient().ListByCloudHsmCluster(ctx, "rgcloudhsm", "chsm1", 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 = armhardwaresecuritymodules.PrivateLinkResourceListResult{ + // Value: []*armhardwaresecuritymodules.PrivateLinkResource{ + // { + // Name: to.Ptr("sample-pls"), + // Type: to.Ptr("Microsoft.HardwareSecurityModules/cloudHsmClusters/privateLinkResources"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcloudhsm/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/chsm1/privateLinkResources/sample-pls"), + // Properties: &armhardwaresecuritymodules.PrivateLinkResourceProperties{ + // GroupID: to.Ptr("cloudHsm"), + // RequiredMembers: []*string{ + // to.Ptr("hsm1"), + // to.Ptr("hsm2"), + // to.Ptr("hsm3")}, + // RequiredZoneNames: []*string{ + // to.Ptr("privatelink.cloudhsm.azure-int.net")}, + // }, + // }}, + // } +} diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusters_client.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusters_client.go new file mode 100644 index 000000000000..a3026679ad6d --- /dev/null +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusters_client.go @@ -0,0 +1,473 @@ +//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 armhardwaresecuritymodules + +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" +) + +// CloudHsmClustersClient contains the methods for the CloudHsmClusters group. +// Don't use this type directly, use NewCloudHsmClustersClient() instead. +type CloudHsmClustersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCloudHsmClustersClient creates a new instance of CloudHsmClustersClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewCloudHsmClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CloudHsmClustersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CloudHsmClustersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or Update a Cloud HSM Cluster in the specified subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-12-10-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudHsmClusterName - The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must +// be between 3 and 24 characters in length. +// - body - Parameters to create Cloud HSM Cluster +// - options - CloudHsmClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the CloudHsmClustersClient.BeginCreateOrUpdate +// method. +func (client *CloudHsmClustersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, body CloudHsmCluster, options *CloudHsmClustersClientBeginCreateOrUpdateOptions) (*runtime.Poller[CloudHsmClustersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, cloudHsmClusterName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudHsmClustersClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaOriginalURI, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudHsmClustersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create or Update a Cloud HSM Cluster in the specified subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-12-10-preview +func (client *CloudHsmClustersClient) createOrUpdate(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, body CloudHsmCluster, options *CloudHsmClustersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "CloudHsmClustersClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, cloudHsmClusterName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *CloudHsmClustersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, body CloudHsmCluster, options *CloudHsmClustersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}" + 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 cloudHsmClusterName == "" { + return nil, errors.New("parameter cloudHsmClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudHsmClusterName}", url.PathEscape(cloudHsmClusterName)) + 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-12-10-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified Cloud HSM Cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-12-10-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudHsmClusterName - The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must +// be between 3 and 24 characters in length. +// - options - CloudHsmClustersClientBeginDeleteOptions contains the optional parameters for the CloudHsmClustersClient.BeginDelete +// method. +func (client *CloudHsmClustersClient) BeginDelete(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *CloudHsmClustersClientBeginDeleteOptions) (*runtime.Poller[CloudHsmClustersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, cloudHsmClusterName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudHsmClustersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudHsmClustersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes the specified Cloud HSM Cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-12-10-preview +func (client *CloudHsmClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *CloudHsmClustersClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "CloudHsmClustersClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, cloudHsmClusterName, 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 *CloudHsmClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *CloudHsmClustersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}" + 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 cloudHsmClusterName == "" { + return nil, errors.New("parameter cloudHsmClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudHsmClusterName}", url.PathEscape(cloudHsmClusterName)) + 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-12-10-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified Cloud HSM Cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-12-10-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudHsmClusterName - The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must +// be between 3 and 24 characters in length. +// - options - CloudHsmClustersClientGetOptions contains the optional parameters for the CloudHsmClustersClient.Get method. +func (client *CloudHsmClustersClient) Get(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *CloudHsmClustersClientGetOptions) (CloudHsmClustersClientGetResponse, error) { + var err error + const operationName = "CloudHsmClustersClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, cloudHsmClusterName, options) + if err != nil { + return CloudHsmClustersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CloudHsmClustersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CloudHsmClustersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CloudHsmClustersClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *CloudHsmClustersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}" + 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 cloudHsmClusterName == "" { + return nil, errors.New("parameter cloudHsmClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudHsmClusterName}", url.PathEscape(cloudHsmClusterName)) + 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-12-10-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CloudHsmClustersClient) getHandleResponse(resp *http.Response) (CloudHsmClustersClientGetResponse, error) { + result := CloudHsmClustersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CloudHsmCluster); err != nil { + return CloudHsmClustersClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - The List operation gets information about the Cloud HSM Clusters associated with the subscription +// and within the specified resource group. +// +// Generated from API version 2023-12-10-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - CloudHsmClustersClientListByResourceGroupOptions contains the optional parameters for the CloudHsmClustersClient.NewListByResourceGroupPager +// method. +func (client *CloudHsmClustersClient) NewListByResourceGroupPager(resourceGroupName string, options *CloudHsmClustersClientListByResourceGroupOptions) *runtime.Pager[CloudHsmClustersClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[CloudHsmClustersClientListByResourceGroupResponse]{ + More: func(page CloudHsmClustersClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CloudHsmClustersClientListByResourceGroupResponse) (CloudHsmClustersClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CloudHsmClustersClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return CloudHsmClustersClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *CloudHsmClustersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CloudHsmClustersClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Skiptoken != nil { + reqQP.Set("$skiptoken", *options.Skiptoken) + } + reqQP.Set("api-version", "2023-12-10-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *CloudHsmClustersClient) listByResourceGroupHandleResponse(resp *http.Response) (CloudHsmClustersClientListByResourceGroupResponse, error) { + result := CloudHsmClustersClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CloudHsmClusterListResult); err != nil { + return CloudHsmClustersClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - The List operation gets information about the Cloud HSM Clusters associated with the subscription. +// +// Generated from API version 2023-12-10-preview +// - options - CloudHsmClustersClientListBySubscriptionOptions contains the optional parameters for the CloudHsmClustersClient.NewListBySubscriptionPager +// method. +func (client *CloudHsmClustersClient) NewListBySubscriptionPager(options *CloudHsmClustersClientListBySubscriptionOptions) *runtime.Pager[CloudHsmClustersClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[CloudHsmClustersClientListBySubscriptionResponse]{ + More: func(page CloudHsmClustersClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CloudHsmClustersClientListBySubscriptionResponse) (CloudHsmClustersClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CloudHsmClustersClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return CloudHsmClustersClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *CloudHsmClustersClient) listBySubscriptionCreateRequest(ctx context.Context, options *CloudHsmClustersClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Skiptoken != nil { + reqQP.Set("$skiptoken", *options.Skiptoken) + } + reqQP.Set("api-version", "2023-12-10-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *CloudHsmClustersClient) listBySubscriptionHandleResponse(resp *http.Response) (CloudHsmClustersClientListBySubscriptionResponse, error) { + result := CloudHsmClustersClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CloudHsmClusterListResult); err != nil { + return CloudHsmClustersClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a Cloud HSM Cluster in the specified subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-12-10-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudHsmClusterName - The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must +// be between 3 and 24 characters in length. +// - body - Parameters to create Cloud HSM Cluster +// - options - CloudHsmClustersClientBeginUpdateOptions contains the optional parameters for the CloudHsmClustersClient.BeginUpdate +// method. +func (client *CloudHsmClustersClient) BeginUpdate(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, body CloudHsmClusterPatchParameters, options *CloudHsmClustersClientBeginUpdateOptions) (*runtime.Poller[CloudHsmClustersClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, cloudHsmClusterName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudHsmClustersClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudHsmClustersClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a Cloud HSM Cluster in the specified subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-12-10-preview +func (client *CloudHsmClustersClient) update(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, body CloudHsmClusterPatchParameters, options *CloudHsmClustersClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "CloudHsmClustersClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, cloudHsmClusterName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *CloudHsmClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, body CloudHsmClusterPatchParameters, options *CloudHsmClustersClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}" + 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 cloudHsmClusterName == "" { + return nil, errors.New("parameter cloudHsmClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudHsmClusterName}", url.PathEscape(cloudHsmClusterName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-12-10-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusters_client_example_test.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusters_client_example_test.go new file mode 100644 index 000000000000..601c11224bc4 --- /dev/null +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusters_client_example_test.go @@ -0,0 +1,526 @@ +//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 armhardwaresecuritymodules_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/hardwaresecuritymodules/armhardwaresecuritymodules/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmCluster_CreateOrUpdate_MaximumSet_Gen.json +func ExampleCloudHsmClustersClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhardwaresecuritymodules.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewCloudHsmClustersClient().BeginCreateOrUpdate(ctx, "rgcloudhsm", "chsm1", armhardwaresecuritymodules.CloudHsmCluster{ + Location: to.Ptr("eastus2"), + Tags: map[string]*string{ + "Dept": to.Ptr("hsm"), + "Environment": to.Ptr("dogfood"), + }, + Identity: &armhardwaresecuritymodules.ManagedServiceIdentity{ + Type: to.Ptr(armhardwaresecuritymodules.ManagedServiceIdentityTypeUserAssigned), + UserAssignedIdentities: map[string]*armhardwaresecuritymodules.UserAssignedIdentity{ + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-1": {}, + }, + }, + SKU: &armhardwaresecuritymodules.CloudHsmClusterSKU{ + Name: to.Ptr(armhardwaresecuritymodules.CloudHsmClusterSKUNameStandardB1), + Family: to.Ptr(armhardwaresecuritymodules.CloudHsmClusterSKUFamilyB), + }, + Properties: &armhardwaresecuritymodules.CloudHsmClusterProperties{ + BackupProperties: &armhardwaresecuritymodules.BackupProperties{ + AzureStorageResourceURI: to.Ptr("testStorageResourceUri"), + }, + PublicNetworkAccess: to.Ptr("Disabled"), + SecurityDomain: &armhardwaresecuritymodules.CloudHsmClusterSecurityDomainProperties{ + FipsState: to.Ptr[int32](2), + }, + }, + }, 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.CloudHsmCluster = armhardwaresecuritymodules.CloudHsmCluster{ + // Name: to.Ptr("chsm1"), + // Type: to.Ptr("Microsoft.HardwareSecurityModules/cloudHsmClusters"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcloudhsm/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/chsm1"), + // SystemData: &armhardwaresecuritymodules.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // CreatedBy: to.Ptr("CHsmUser1"), + // CreatedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // LastModifiedBy: to.Ptr("CHsmUser2"), + // LastModifiedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus2"), + // Tags: map[string]*string{ + // "Dept": to.Ptr("hsm"), + // "Environment": to.Ptr("dogfood"), + // }, + // Identity: &armhardwaresecuritymodules.ManagedServiceIdentity{ + // Type: to.Ptr(armhardwaresecuritymodules.ManagedServiceIdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armhardwaresecuritymodules.UserAssignedIdentity{ + // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-1": &armhardwaresecuritymodules.UserAssignedIdentity{ + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, + // SKU: &armhardwaresecuritymodules.CloudHsmClusterSKU{ + // Name: to.Ptr(armhardwaresecuritymodules.CloudHsmClusterSKUNameStandardB1), + // Family: to.Ptr(armhardwaresecuritymodules.CloudHsmClusterSKUFamilyB), + // }, + // Properties: &armhardwaresecuritymodules.CloudHsmClusterProperties{ + // AutoGeneratedDomainNameLabelScope: to.Ptr("TenantReuse"), + // BackupProperties: &armhardwaresecuritymodules.BackupProperties{ + // AzureStorageResourceURI: to.Ptr("testStorageResourceUri"), + // LastBackupDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-11-09T12:00:00.000Z"); return t}()), + // LastBackupStatus: to.Ptr("Status Of last backup"), + // }, + // ProvisioningState: to.Ptr(armhardwaresecuritymodules.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr("Disabled"), + // SecurityDomain: &armhardwaresecuritymodules.CloudHsmClusterSecurityDomainProperties{ + // ActivationStatus: to.Ptr("null"), + // FipsState: to.Ptr[int32](2), + // }, + // StatusMessage: to.Ptr("This is a status message"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmCluster_Update_MaximumSet_Gen.json +func ExampleCloudHsmClustersClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhardwaresecuritymodules.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewCloudHsmClustersClient().BeginUpdate(ctx, "rgcloudhsm", "chsm1", armhardwaresecuritymodules.CloudHsmClusterPatchParameters{ + Identity: &armhardwaresecuritymodules.ManagedServiceIdentity{ + Type: to.Ptr(armhardwaresecuritymodules.ManagedServiceIdentityTypeUserAssigned), + UserAssignedIdentities: map[string]*armhardwaresecuritymodules.UserAssignedIdentity{ + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-1": {}, + }, + }, + Properties: &armhardwaresecuritymodules.CloudHsmClusterPatchParametersProperties{ + BackupProperties: &armhardwaresecuritymodules.BackupProperties{ + AzureStorageResourceURI: to.Ptr("testStorageResourceUri"), + }, + }, + Tags: map[string]*string{ + "Dept": to.Ptr("hsm"), + "Environment": to.Ptr("dogfood"), + "Slice": to.Ptr("A"), + }, + }, 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.CloudHsmCluster = armhardwaresecuritymodules.CloudHsmCluster{ + // Name: to.Ptr("chsm1"), + // Type: to.Ptr("Microsoft.HardwareSecurityModules/cloudHsmClusters"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcloudhsm/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/chsm1"), + // SystemData: &armhardwaresecuritymodules.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // CreatedBy: to.Ptr("CHsmUser1"), + // CreatedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // LastModifiedBy: to.Ptr("CHsmUser2"), + // LastModifiedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus2"), + // Tags: map[string]*string{ + // "Dept": to.Ptr("hsm"), + // "Environment": to.Ptr("dogfood"), + // "Slice": to.Ptr("A"), + // }, + // Identity: &armhardwaresecuritymodules.ManagedServiceIdentity{ + // Type: to.Ptr(armhardwaresecuritymodules.ManagedServiceIdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armhardwaresecuritymodules.UserAssignedIdentity{ + // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-1": &armhardwaresecuritymodules.UserAssignedIdentity{ + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, + // SKU: &armhardwaresecuritymodules.CloudHsmClusterSKU{ + // Name: to.Ptr(armhardwaresecuritymodules.CloudHsmClusterSKUNameStandardB1), + // Family: to.Ptr(armhardwaresecuritymodules.CloudHsmClusterSKUFamilyB), + // }, + // Properties: &armhardwaresecuritymodules.CloudHsmClusterProperties{ + // AutoGeneratedDomainNameLabelScope: to.Ptr("TenantReuse"), + // BackupProperties: &armhardwaresecuritymodules.BackupProperties{ + // AzureStorageResourceURI: to.Ptr("testStorageResourceUri"), + // LastBackupDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-11-09T12:00:00.000Z"); return t}()), + // LastBackupStatus: to.Ptr("Status Of last backup"), + // }, + // ProvisioningState: to.Ptr(armhardwaresecuritymodules.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr("Disabled"), + // SecurityDomain: &armhardwaresecuritymodules.CloudHsmClusterSecurityDomainProperties{ + // ActivationStatus: to.Ptr("null"), + // FipsState: to.Ptr[int32](2), + // }, + // StatusMessage: to.Ptr("This is a status message"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmCluster_Get_MaximumSet_Gen.json +func ExampleCloudHsmClustersClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhardwaresecuritymodules.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCloudHsmClustersClient().Get(ctx, "rgcloudhsm", "chsm1", 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.CloudHsmCluster = armhardwaresecuritymodules.CloudHsmCluster{ + // Name: to.Ptr("chsm1"), + // Type: to.Ptr("Microsoft.HardwareSecurityModules/cloudHsmClusters"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcloudhsm/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/chsm1"), + // SystemData: &armhardwaresecuritymodules.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // CreatedBy: to.Ptr("CHsmUser1"), + // CreatedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // LastModifiedBy: to.Ptr("CHsmUser2"), + // LastModifiedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus2"), + // Tags: map[string]*string{ + // "Dept": to.Ptr("hsm"), + // "Environment": to.Ptr("dogfood"), + // }, + // Identity: &armhardwaresecuritymodules.ManagedServiceIdentity{ + // Type: to.Ptr(armhardwaresecuritymodules.ManagedServiceIdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armhardwaresecuritymodules.UserAssignedIdentity{ + // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-1": &armhardwaresecuritymodules.UserAssignedIdentity{ + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, + // SKU: &armhardwaresecuritymodules.CloudHsmClusterSKU{ + // Name: to.Ptr(armhardwaresecuritymodules.CloudHsmClusterSKUNameStandardB1), + // Family: to.Ptr(armhardwaresecuritymodules.CloudHsmClusterSKUFamilyB), + // }, + // Properties: &armhardwaresecuritymodules.CloudHsmClusterProperties{ + // AutoGeneratedDomainNameLabelScope: to.Ptr("TenantReuse"), + // BackupProperties: &armhardwaresecuritymodules.BackupProperties{ + // AzureStorageResourceURI: to.Ptr("testStorageResourceUri"), + // LastBackupDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-11-09T12:00:00.000Z"); return t}()), + // LastBackupStatus: to.Ptr("Status Of last backup"), + // }, + // ProvisioningState: to.Ptr(armhardwaresecuritymodules.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr("Disabled"), + // SecurityDomain: &armhardwaresecuritymodules.CloudHsmClusterSecurityDomainProperties{ + // ActivationStatus: to.Ptr("null"), + // FipsState: to.Ptr[int32](2), + // }, + // StatusMessage: to.Ptr("This is a status message"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmCluster_Delete_MaximumSet_Gen.json +func ExampleCloudHsmClustersClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhardwaresecuritymodules.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewCloudHsmClustersClient().BeginDelete(ctx, "rgcloudhsm", "chsm1", 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/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmCluster_ListByResourceGroup_MaximumSet_Gen.json +func ExampleCloudHsmClustersClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhardwaresecuritymodules.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewCloudHsmClustersClient().NewListByResourceGroupPager("rgcloudhsm", &armhardwaresecuritymodules.CloudHsmClustersClientListByResourceGroupOptions{Skiptoken: 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.CloudHsmClusterListResult = armhardwaresecuritymodules.CloudHsmClusterListResult{ + // Value: []*armhardwaresecuritymodules.CloudHsmCluster{ + // { + // Name: to.Ptr("chsm1"), + // Type: to.Ptr("Microsoft.HardwareSecurityModules/cloudHsmClusters"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcloudhsm/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/chsm1"), + // SystemData: &armhardwaresecuritymodules.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // CreatedBy: to.Ptr("CHsmUser1"), + // CreatedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // LastModifiedBy: to.Ptr("CHsmUser2"), + // LastModifiedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus2"), + // Tags: map[string]*string{ + // "Dept": to.Ptr("hsm"), + // "Environment": to.Ptr("dogfood"), + // }, + // Identity: &armhardwaresecuritymodules.ManagedServiceIdentity{ + // Type: to.Ptr(armhardwaresecuritymodules.ManagedServiceIdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armhardwaresecuritymodules.UserAssignedIdentity{ + // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-1": &armhardwaresecuritymodules.UserAssignedIdentity{ + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, + // SKU: &armhardwaresecuritymodules.CloudHsmClusterSKU{ + // Name: to.Ptr(armhardwaresecuritymodules.CloudHsmClusterSKUNameStandardB1), + // Family: to.Ptr(armhardwaresecuritymodules.CloudHsmClusterSKUFamilyB), + // }, + // Properties: &armhardwaresecuritymodules.CloudHsmClusterProperties{ + // AutoGeneratedDomainNameLabelScope: to.Ptr("TenantReuse"), + // BackupProperties: &armhardwaresecuritymodules.BackupProperties{ + // AzureStorageResourceURI: to.Ptr("testStorageResourceUri"), + // LastBackupDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-11-09T12:00:00.000Z"); return t}()), + // LastBackupStatus: to.Ptr("Status Of last backup"), + // }, + // ProvisioningState: to.Ptr(armhardwaresecuritymodules.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr("Disabled"), + // SecurityDomain: &armhardwaresecuritymodules.CloudHsmClusterSecurityDomainProperties{ + // ActivationStatus: to.Ptr("null"), + // FipsState: to.Ptr[int32](2), + // }, + // StatusMessage: to.Ptr("This is a status message"), + // }, + // }, + // { + // Name: to.Ptr("chsm2"), + // Type: to.Ptr("Microsoft.HardwareSecurityModules/cloudHsmClusters"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcloudhsm/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/chsm2"), + // SystemData: &armhardwaresecuritymodules.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // CreatedBy: to.Ptr("CHsmUser1"), + // CreatedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // LastModifiedBy: to.Ptr("CHsmUser2"), + // LastModifiedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus2"), + // Tags: map[string]*string{ + // "Dept": to.Ptr("hsm"), + // "Environment": to.Ptr("dogfood"), + // }, + // Identity: &armhardwaresecuritymodules.ManagedServiceIdentity{ + // Type: to.Ptr(armhardwaresecuritymodules.ManagedServiceIdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armhardwaresecuritymodules.UserAssignedIdentity{ + // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-2": &armhardwaresecuritymodules.UserAssignedIdentity{ + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, + // SKU: &armhardwaresecuritymodules.CloudHsmClusterSKU{ + // Name: to.Ptr(armhardwaresecuritymodules.CloudHsmClusterSKUNameStandardB1), + // Family: to.Ptr(armhardwaresecuritymodules.CloudHsmClusterSKUFamilyB), + // }, + // Properties: &armhardwaresecuritymodules.CloudHsmClusterProperties{ + // AutoGeneratedDomainNameLabelScope: to.Ptr("TenantReuse"), + // BackupProperties: &armhardwaresecuritymodules.BackupProperties{ + // AzureStorageResourceURI: to.Ptr("testStorageResourceUri"), + // LastBackupDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-11-09T12:00:00.000Z"); return t}()), + // LastBackupStatus: to.Ptr("Status Of last backup"), + // }, + // ProvisioningState: to.Ptr(armhardwaresecuritymodules.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr("Disabled"), + // SecurityDomain: &armhardwaresecuritymodules.CloudHsmClusterSecurityDomainProperties{ + // ActivationStatus: to.Ptr("null"), + // FipsState: to.Ptr[int32](2), + // }, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmCluster_ListBySubscription_MaximumSet_Gen.json +func ExampleCloudHsmClustersClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhardwaresecuritymodules.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewCloudHsmClustersClient().NewListBySubscriptionPager(&armhardwaresecuritymodules.CloudHsmClustersClientListBySubscriptionOptions{Skiptoken: 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.CloudHsmClusterListResult = armhardwaresecuritymodules.CloudHsmClusterListResult{ + // Value: []*armhardwaresecuritymodules.CloudHsmCluster{ + // { + // Name: to.Ptr("chsm1"), + // Type: to.Ptr("Microsoft.HardwareSecurityModules/cloudHsmClusters"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcloudhsm/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/chsm1"), + // SystemData: &armhardwaresecuritymodules.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // CreatedBy: to.Ptr("CHsmUser1"), + // CreatedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // LastModifiedBy: to.Ptr("CHsmUser2"), + // LastModifiedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus2"), + // Tags: map[string]*string{ + // "Dept": to.Ptr("hsm"), + // "Environment": to.Ptr("dogfood"), + // }, + // Identity: &armhardwaresecuritymodules.ManagedServiceIdentity{ + // Type: to.Ptr(armhardwaresecuritymodules.ManagedServiceIdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armhardwaresecuritymodules.UserAssignedIdentity{ + // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-1": &armhardwaresecuritymodules.UserAssignedIdentity{ + // }, + // }, + // }, + // SKU: &armhardwaresecuritymodules.CloudHsmClusterSKU{ + // Name: to.Ptr(armhardwaresecuritymodules.CloudHsmClusterSKUNameStandardB1), + // Family: to.Ptr(armhardwaresecuritymodules.CloudHsmClusterSKUFamilyB), + // }, + // Properties: &armhardwaresecuritymodules.CloudHsmClusterProperties{ + // AutoGeneratedDomainNameLabelScope: to.Ptr("TenantReuse"), + // BackupProperties: &armhardwaresecuritymodules.BackupProperties{ + // AzureStorageResourceURI: to.Ptr("testStorageResourceUri"), + // LastBackupDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-11-09T12:00:00.000Z"); return t}()), + // LastBackupStatus: to.Ptr("Status Of last backup"), + // }, + // ProvisioningState: to.Ptr(armhardwaresecuritymodules.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr("Disabled"), + // SecurityDomain: &armhardwaresecuritymodules.CloudHsmClusterSecurityDomainProperties{ + // ActivationStatus: to.Ptr("null"), + // FipsState: to.Ptr[int32](2), + // }, + // StatusMessage: to.Ptr("This is a status message"), + // }, + // }, + // { + // Name: to.Ptr("chsm2"), + // Type: to.Ptr("Microsoft.HardwareSecurityModules/cloudHsmClusters"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcloudhsm/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/chsm2"), + // SystemData: &armhardwaresecuritymodules.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // CreatedBy: to.Ptr("CHsmUser1"), + // CreatedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // LastModifiedBy: to.Ptr("CHsmUser2"), + // LastModifiedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus2"), + // Tags: map[string]*string{ + // "Dept": to.Ptr("hsm"), + // "Environment": to.Ptr("dogfood"), + // }, + // Identity: &armhardwaresecuritymodules.ManagedServiceIdentity{ + // Type: to.Ptr(armhardwaresecuritymodules.ManagedServiceIdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armhardwaresecuritymodules.UserAssignedIdentity{ + // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-2": &armhardwaresecuritymodules.UserAssignedIdentity{ + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, + // SKU: &armhardwaresecuritymodules.CloudHsmClusterSKU{ + // Name: to.Ptr(armhardwaresecuritymodules.CloudHsmClusterSKUNameStandardB1), + // Family: to.Ptr(armhardwaresecuritymodules.CloudHsmClusterSKUFamilyB), + // }, + // Properties: &armhardwaresecuritymodules.CloudHsmClusterProperties{ + // AutoGeneratedDomainNameLabelScope: to.Ptr("TenantReuse"), + // BackupProperties: &armhardwaresecuritymodules.BackupProperties{ + // AzureStorageResourceURI: to.Ptr("testStorageResourceUri"), + // LastBackupDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-11-09T12:00:00.000Z"); return t}()), + // LastBackupStatus: to.Ptr("Status Of last backup"), + // }, + // ProvisioningState: to.Ptr(armhardwaresecuritymodules.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr("Disabled"), + // SecurityDomain: &armhardwaresecuritymodules.CloudHsmClusterSecurityDomainProperties{ + // ActivationStatus: to.Ptr("null"), + // FipsState: to.Ptr[int32](2), + // }, + // StatusMessage: to.Ptr("This is a status message"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/constants.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/constants.go index 54bbb1202e59..6e2057d98a21 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/constants.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/constants.go @@ -10,9 +10,59 @@ package armhardwaresecuritymodules const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules" - moduleVersion = "v1.2.0" + moduleVersion = "v2.0.0-beta.1" ) +// CloudHsmClusterSKUFamily - Sku family of the Cloud HSM Cluster +type CloudHsmClusterSKUFamily string + +const ( + CloudHsmClusterSKUFamilyB CloudHsmClusterSKUFamily = "B" +) + +// PossibleCloudHsmClusterSKUFamilyValues returns the possible values for the CloudHsmClusterSKUFamily const type. +func PossibleCloudHsmClusterSKUFamilyValues() []CloudHsmClusterSKUFamily { + return []CloudHsmClusterSKUFamily{ + CloudHsmClusterSKUFamilyB, + } +} + +// CloudHsmClusterSKUName - Sku name of the Cloud HSM Cluster +type CloudHsmClusterSKUName string + +const ( + CloudHsmClusterSKUNameStandardB1 CloudHsmClusterSKUName = "Standard_B1" + CloudHsmClusterSKUNameStandardB10 CloudHsmClusterSKUName = "Standard B10" +) + +// PossibleCloudHsmClusterSKUNameValues returns the possible values for the CloudHsmClusterSKUName const type. +func PossibleCloudHsmClusterSKUNameValues() []CloudHsmClusterSKUName { + return []CloudHsmClusterSKUName{ + CloudHsmClusterSKUNameStandardB1, + CloudHsmClusterSKUNameStandardB10, + } +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + // IdentityType - The type of identity. type IdentityType string @@ -66,6 +116,92 @@ func PossibleJSONWebKeyTypeValues() []JSONWebKeyType { } } +// ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). +type ManagedServiceIdentityType string + +const ( + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ + ManagedServiceIdentityTypeNone, + ManagedServiceIdentityTypeSystemAssigned, + ManagedServiceIdentityTypeSystemAssignedUserAssigned, + ManagedServiceIdentityTypeUserAssigned, + } +} + +// PrivateEndpointConnectionProvisioningState - The current provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCanceled PrivateEndpointConnectionProvisioningState = "Canceled" + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateInternalError PrivateEndpointConnectionProvisioningState = "InternalError" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" + PrivateEndpointConnectionProvisioningStateUpdating PrivateEndpointConnectionProvisioningState = "Updating" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns the possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{ + PrivateEndpointConnectionProvisioningStateCanceled, + PrivateEndpointConnectionProvisioningStateCreating, + PrivateEndpointConnectionProvisioningStateDeleting, + PrivateEndpointConnectionProvisioningStateFailed, + PrivateEndpointConnectionProvisioningStateInternalError, + PrivateEndpointConnectionProvisioningStateSucceeded, + PrivateEndpointConnectionProvisioningStateUpdating, + } +} + +// PrivateEndpointServiceConnectionStatus - The private endpoint connection status. +type PrivateEndpointServiceConnectionStatus string + +const ( + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateEndpointServiceConnectionStatusValues returns the possible values for the PrivateEndpointServiceConnectionStatus const type. +func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { + return []PrivateEndpointServiceConnectionStatus{ + PrivateEndpointServiceConnectionStatusApproved, + PrivateEndpointServiceConnectionStatusPending, + PrivateEndpointServiceConnectionStatusRejected, + } +} + +// ProvisioningState - The Cloud HSM Cluster's provisioningState +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateCanceled, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateProvisioning, + ProvisioningStateSucceeded, + } +} + // SKUName - SKU of the dedicated HSM type SKUName string diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/dedicatedhsm_client.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/dedicatedhsm_client.go index 1b7496b96cd2..ade7aa9a68b8 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/dedicatedhsm_client.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/dedicatedhsm_client.go @@ -29,8 +29,7 @@ type DedicatedHsmClient struct { } // NewDedicatedHsmClient creates a new instance of DedicatedHsmClient with the specified values. -// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewDedicatedHsmClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DedicatedHsmClient, error) { diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/dedicatedhsm_client_example_test.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/dedicatedhsm_client_example_test.go index 0f517d008cb6..ced12451d182 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/dedicatedhsm_client_example_test.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/dedicatedhsm_client_example_test.go @@ -15,10 +15,10 @@ import ( "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/hardwaresecuritymodules/armhardwaresecuritymodules" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_CreateOrUpdate.json func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingDedicatedHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -91,7 +91,7 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingD // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_CreateOrUpdate.json func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingPaymentHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -171,7 +171,7 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingP // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // SystemData: &armhardwaresecuritymodules.SystemData{ + // SystemData: &armhardwaresecuritymodules.SystemDataAutoGenerated{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), // CreatedBy: to.Ptr("user1"), // CreatedByType: to.Ptr(armhardwaresecuritymodules.IdentityTypeUser), @@ -182,7 +182,7 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingP // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_CreateOrUpdate_WithManagementProfile.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_CreateOrUpdate_WithManagementProfile.json func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingPaymentHsmWithManagementProfile() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -271,7 +271,7 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingP // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // SystemData: &armhardwaresecuritymodules.SystemData{ + // SystemData: &armhardwaresecuritymodules.SystemDataAutoGenerated{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), // CreatedBy: to.Ptr("user1"), // CreatedByType: to.Ptr(armhardwaresecuritymodules.IdentityTypeUser), @@ -282,7 +282,7 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingP // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_Update.json func ExampleDedicatedHsmClient_BeginUpdate_updateAnExistingDedicatedHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -341,7 +341,7 @@ func ExampleDedicatedHsmClient_BeginUpdate_updateAnExistingDedicatedHsm() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_Update.json func ExampleDedicatedHsmClient_BeginUpdate_updateAnExistingPaymentHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -407,7 +407,7 @@ func ExampleDedicatedHsmClient_BeginUpdate_updateAnExistingPaymentHsm() { // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // SystemData: &armhardwaresecuritymodules.SystemData{ + // SystemData: &armhardwaresecuritymodules.SystemDataAutoGenerated{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), // CreatedBy: to.Ptr("user1"), // CreatedByType: to.Ptr(armhardwaresecuritymodules.IdentityTypeUser), @@ -418,7 +418,7 @@ func ExampleDedicatedHsmClient_BeginUpdate_updateAnExistingPaymentHsm() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_Delete.json func ExampleDedicatedHsmClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -439,7 +439,7 @@ func ExampleDedicatedHsmClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_Get.json func ExampleDedicatedHsmClient_Get_getADedicatedHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -488,7 +488,7 @@ func ExampleDedicatedHsmClient_Get_getADedicatedHsm() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_Get.json func ExampleDedicatedHsmClient_Get_getAPaymentHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -544,7 +544,7 @@ func ExampleDedicatedHsmClient_Get_getAPaymentHsm() { // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // SystemData: &armhardwaresecuritymodules.SystemData{ + // SystemData: &armhardwaresecuritymodules.SystemDataAutoGenerated{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), // CreatedBy: to.Ptr("user1"), // CreatedByType: to.Ptr(armhardwaresecuritymodules.IdentityTypeUser), @@ -555,7 +555,7 @@ func ExampleDedicatedHsmClient_Get_getAPaymentHsm() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_Get_With_2018-10-31Preview_Version.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_Get_With_2018-10-31Preview_Version.json func ExampleDedicatedHsmClient_Get_getAPaymentHsmWith20181031PreviewApiVersion() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -604,7 +604,7 @@ func ExampleDedicatedHsmClient_Get_getAPaymentHsmWith20181031PreviewApiVersion() // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_ListByResourceGroup.json func ExampleDedicatedHsmClient_NewListByResourceGroupPager_listDedicatedHsmDevicesInAResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -690,7 +690,7 @@ func ExampleDedicatedHsmClient_NewListByResourceGroupPager_listDedicatedHsmDevic } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_ListByResourceGroup.json func ExampleDedicatedHsmClient_NewListByResourceGroupPager_listDedicatedHsmDevicesInAResourceGroupIncludingPaymentHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -752,7 +752,7 @@ func ExampleDedicatedHsmClient_NewListByResourceGroupPager_listDedicatedHsmDevic // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // SystemData: &armhardwaresecuritymodules.SystemData{ + // SystemData: &armhardwaresecuritymodules.SystemDataAutoGenerated{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), // CreatedBy: to.Ptr("user1"), // CreatedByType: to.Ptr(armhardwaresecuritymodules.IdentityTypeUser), @@ -799,7 +799,7 @@ func ExampleDedicatedHsmClient_NewListByResourceGroupPager_listDedicatedHsmDevic // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // SystemData: &armhardwaresecuritymodules.SystemData{ + // SystemData: &armhardwaresecuritymodules.SystemDataAutoGenerated{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), // CreatedBy: to.Ptr("user1"), // CreatedByType: to.Ptr(armhardwaresecuritymodules.IdentityTypeUser), @@ -812,7 +812,7 @@ func ExampleDedicatedHsmClient_NewListByResourceGroupPager_listDedicatedHsmDevic } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_ListBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_ListBySubscription.json func ExampleDedicatedHsmClient_NewListBySubscriptionPager_listDedicatedHsmDevicesInASubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -898,7 +898,7 @@ func ExampleDedicatedHsmClient_NewListBySubscriptionPager_listDedicatedHsmDevice } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_ListBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_ListBySubscription.json func ExampleDedicatedHsmClient_NewListBySubscriptionPager_listDedicatedHsmDevicesInASubscriptionIncludingPaymentHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -960,7 +960,7 @@ func ExampleDedicatedHsmClient_NewListBySubscriptionPager_listDedicatedHsmDevice // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // SystemData: &armhardwaresecuritymodules.SystemData{ + // SystemData: &armhardwaresecuritymodules.SystemDataAutoGenerated{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), // CreatedBy: to.Ptr("user1"), // CreatedByType: to.Ptr(armhardwaresecuritymodules.IdentityTypeUser), @@ -1007,7 +1007,7 @@ func ExampleDedicatedHsmClient_NewListBySubscriptionPager_listDedicatedHsmDevice // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // SystemData: &armhardwaresecuritymodules.SystemData{ + // SystemData: &armhardwaresecuritymodules.SystemDataAutoGenerated{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), // CreatedBy: to.Ptr("user1"), // CreatedByType: to.Ptr(armhardwaresecuritymodules.IdentityTypeUser), @@ -1020,7 +1020,7 @@ func ExampleDedicatedHsmClient_NewListBySubscriptionPager_listDedicatedHsmDevice } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/GetOutboundNetworkDependenciesEndpointsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/GetOutboundNetworkDependenciesEndpointsList.json func ExampleDedicatedHsmClient_NewListOutboundNetworkDependenciesEndpointsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterprivateendpointconnections_server.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterprivateendpointconnections_server.go new file mode 100644 index 000000000000..4702b791d70f --- /dev/null +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterprivateendpointconnections_server.go @@ -0,0 +1,209 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/v2" + "net/http" + "net/url" + "regexp" +) + +// CloudHsmClusterPrivateEndpointConnectionsServer is a fake server for instances of the armhardwaresecuritymodules.CloudHsmClusterPrivateEndpointConnectionsClient type. +type CloudHsmClusterPrivateEndpointConnectionsServer struct { + // Create is the fake for method CloudHsmClusterPrivateEndpointConnectionsClient.Create + // HTTP status codes to indicate success: http.StatusOK + Create func(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, peConnectionName string, properties armhardwaresecuritymodules.PrivateEndpointConnection, options *armhardwaresecuritymodules.CloudHsmClusterPrivateEndpointConnectionsClientCreateOptions) (resp azfake.Responder[armhardwaresecuritymodules.CloudHsmClusterPrivateEndpointConnectionsClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method CloudHsmClusterPrivateEndpointConnectionsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, peConnectionName string, options *armhardwaresecuritymodules.CloudHsmClusterPrivateEndpointConnectionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClusterPrivateEndpointConnectionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method CloudHsmClusterPrivateEndpointConnectionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, peConnectionName string, options *armhardwaresecuritymodules.CloudHsmClusterPrivateEndpointConnectionsClientGetOptions) (resp azfake.Responder[armhardwaresecuritymodules.CloudHsmClusterPrivateEndpointConnectionsClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewCloudHsmClusterPrivateEndpointConnectionsServerTransport creates a new instance of CloudHsmClusterPrivateEndpointConnectionsServerTransport with the provided implementation. +// The returned CloudHsmClusterPrivateEndpointConnectionsServerTransport instance is connected to an instance of armhardwaresecuritymodules.CloudHsmClusterPrivateEndpointConnectionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCloudHsmClusterPrivateEndpointConnectionsServerTransport(srv *CloudHsmClusterPrivateEndpointConnectionsServer) *CloudHsmClusterPrivateEndpointConnectionsServerTransport { + return &CloudHsmClusterPrivateEndpointConnectionsServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClusterPrivateEndpointConnectionsClientDeleteResponse]](), + } +} + +// CloudHsmClusterPrivateEndpointConnectionsServerTransport connects instances of armhardwaresecuritymodules.CloudHsmClusterPrivateEndpointConnectionsClient to instances of CloudHsmClusterPrivateEndpointConnectionsServer. +// Don't use this type directly, use NewCloudHsmClusterPrivateEndpointConnectionsServerTransport instead. +type CloudHsmClusterPrivateEndpointConnectionsServerTransport struct { + srv *CloudHsmClusterPrivateEndpointConnectionsServer + beginDelete *tracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClusterPrivateEndpointConnectionsClientDeleteResponse]] +} + +// Do implements the policy.Transporter interface for CloudHsmClusterPrivateEndpointConnectionsServerTransport. +func (c *CloudHsmClusterPrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "CloudHsmClusterPrivateEndpointConnectionsClient.Create": + resp, err = c.dispatchCreate(req) + case "CloudHsmClusterPrivateEndpointConnectionsClient.BeginDelete": + resp, err = c.dispatchBeginDelete(req) + case "CloudHsmClusterPrivateEndpointConnectionsClient.Get": + resp, err = c.dispatchGet(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *CloudHsmClusterPrivateEndpointConnectionsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if c.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HardwareSecurityModules/cloudHsmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armhardwaresecuritymodules.PrivateEndpointConnection](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudHsmClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudHsmClusterName")]) + if err != nil { + return nil, err + } + peConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("peConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Create(req.Context(), resourceGroupNameParam, cloudHsmClusterNameParam, peConnectionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CloudHsmClusterPrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if c.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := c.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HardwareSecurityModules/cloudHsmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudHsmClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudHsmClusterName")]) + if err != nil { + return nil, err + } + peConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("peConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, cloudHsmClusterNameParam, peConnectionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + c.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + c.beginDelete.remove(req) + } + + return resp, nil +} + +func (c *CloudHsmClusterPrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HardwareSecurityModules/cloudHsmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudHsmClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudHsmClusterName")]) + if err != nil { + return nil, err + } + peConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("peConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, cloudHsmClusterNameParam, peConnectionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterprivatelinkresources_server.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterprivatelinkresources_server.go new file mode 100644 index 000000000000..ee4e08dab4cc --- /dev/null +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterprivatelinkresources_server.go @@ -0,0 +1,100 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/v2" + "net/http" + "net/url" + "regexp" +) + +// CloudHsmClusterPrivateLinkResourcesServer is a fake server for instances of the armhardwaresecuritymodules.CloudHsmClusterPrivateLinkResourcesClient type. +type CloudHsmClusterPrivateLinkResourcesServer struct { + // ListByCloudHsmCluster is the fake for method CloudHsmClusterPrivateLinkResourcesClient.ListByCloudHsmCluster + // HTTP status codes to indicate success: http.StatusOK + ListByCloudHsmCluster func(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *armhardwaresecuritymodules.CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterOptions) (resp azfake.Responder[armhardwaresecuritymodules.CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse], errResp azfake.ErrorResponder) +} + +// NewCloudHsmClusterPrivateLinkResourcesServerTransport creates a new instance of CloudHsmClusterPrivateLinkResourcesServerTransport with the provided implementation. +// The returned CloudHsmClusterPrivateLinkResourcesServerTransport instance is connected to an instance of armhardwaresecuritymodules.CloudHsmClusterPrivateLinkResourcesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCloudHsmClusterPrivateLinkResourcesServerTransport(srv *CloudHsmClusterPrivateLinkResourcesServer) *CloudHsmClusterPrivateLinkResourcesServerTransport { + return &CloudHsmClusterPrivateLinkResourcesServerTransport{srv: srv} +} + +// CloudHsmClusterPrivateLinkResourcesServerTransport connects instances of armhardwaresecuritymodules.CloudHsmClusterPrivateLinkResourcesClient to instances of CloudHsmClusterPrivateLinkResourcesServer. +// Don't use this type directly, use NewCloudHsmClusterPrivateLinkResourcesServerTransport instead. +type CloudHsmClusterPrivateLinkResourcesServerTransport struct { + srv *CloudHsmClusterPrivateLinkResourcesServer +} + +// Do implements the policy.Transporter interface for CloudHsmClusterPrivateLinkResourcesServerTransport. +func (c *CloudHsmClusterPrivateLinkResourcesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "CloudHsmClusterPrivateLinkResourcesClient.ListByCloudHsmCluster": + resp, err = c.dispatchListByCloudHsmCluster(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *CloudHsmClusterPrivateLinkResourcesServerTransport) dispatchListByCloudHsmCluster(req *http.Request) (*http.Response, error) { + if c.srv.ListByCloudHsmCluster == nil { + return nil, &nonRetriableError{errors.New("fake for method ListByCloudHsmCluster not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HardwareSecurityModules/cloudHsmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudHsmClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudHsmClusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.ListByCloudHsmCluster(req.Context(), resourceGroupNameParam, cloudHsmClusterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateLinkResourceListResult, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusters_server.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusters_server.go new file mode 100644 index 000000000000..400840e0676a --- /dev/null +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusters_server.go @@ -0,0 +1,377 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/v2" + "net/http" + "net/url" + "regexp" +) + +// CloudHsmClustersServer is a fake server for instances of the armhardwaresecuritymodules.CloudHsmClustersClient type. +type CloudHsmClustersServer struct { + // BeginCreateOrUpdate is the fake for method CloudHsmClustersClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, body armhardwaresecuritymodules.CloudHsmCluster, options *armhardwaresecuritymodules.CloudHsmClustersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method CloudHsmClustersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *armhardwaresecuritymodules.CloudHsmClustersClientBeginDeleteOptions) (resp azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method CloudHsmClustersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *armhardwaresecuritymodules.CloudHsmClustersClientGetOptions) (resp azfake.Responder[armhardwaresecuritymodules.CloudHsmClustersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method CloudHsmClustersClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armhardwaresecuritymodules.CloudHsmClustersClientListByResourceGroupOptions) (resp azfake.PagerResponder[armhardwaresecuritymodules.CloudHsmClustersClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method CloudHsmClustersClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armhardwaresecuritymodules.CloudHsmClustersClientListBySubscriptionOptions) (resp azfake.PagerResponder[armhardwaresecuritymodules.CloudHsmClustersClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method CloudHsmClustersClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, body armhardwaresecuritymodules.CloudHsmClusterPatchParameters, options *armhardwaresecuritymodules.CloudHsmClustersClientBeginUpdateOptions) (resp azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewCloudHsmClustersServerTransport creates a new instance of CloudHsmClustersServerTransport with the provided implementation. +// The returned CloudHsmClustersServerTransport instance is connected to an instance of armhardwaresecuritymodules.CloudHsmClustersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCloudHsmClustersServerTransport(srv *CloudHsmClustersServer) *CloudHsmClustersServerTransport { + return &CloudHsmClustersServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armhardwaresecuritymodules.CloudHsmClustersClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armhardwaresecuritymodules.CloudHsmClustersClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientUpdateResponse]](), + } +} + +// CloudHsmClustersServerTransport connects instances of armhardwaresecuritymodules.CloudHsmClustersClient to instances of CloudHsmClustersServer. +// Don't use this type directly, use NewCloudHsmClustersServerTransport instead. +type CloudHsmClustersServerTransport struct { + srv *CloudHsmClustersServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armhardwaresecuritymodules.CloudHsmClustersClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armhardwaresecuritymodules.CloudHsmClustersClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for CloudHsmClustersServerTransport. +func (c *CloudHsmClustersServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "CloudHsmClustersClient.BeginCreateOrUpdate": + resp, err = c.dispatchBeginCreateOrUpdate(req) + case "CloudHsmClustersClient.BeginDelete": + resp, err = c.dispatchBeginDelete(req) + case "CloudHsmClustersClient.Get": + resp, err = c.dispatchGet(req) + case "CloudHsmClustersClient.NewListByResourceGroupPager": + resp, err = c.dispatchNewListByResourceGroupPager(req) + case "CloudHsmClustersClient.NewListBySubscriptionPager": + resp, err = c.dispatchNewListBySubscriptionPager(req) + case "CloudHsmClustersClient.BeginUpdate": + resp, err = c.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *CloudHsmClustersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := c.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HardwareSecurityModules/cloudHsmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armhardwaresecuritymodules.CloudHsmCluster](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudHsmClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudHsmClusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, cloudHsmClusterNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + c.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + c.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + c.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (c *CloudHsmClustersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if c.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := c.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HardwareSecurityModules/cloudHsmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudHsmClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudHsmClusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, cloudHsmClusterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + c.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + c.beginDelete.remove(req) + } + + return resp, nil +} + +func (c *CloudHsmClustersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HardwareSecurityModules/cloudHsmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudHsmClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudHsmClusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, cloudHsmClusterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CloudHsmCluster, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CloudHsmClustersServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := c.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HardwareSecurityModules/cloudHsmClusters` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + skiptokenUnescaped, err := url.QueryUnescape(qp.Get("$skiptoken")) + if err != nil { + return nil, err + } + skiptokenParam := getOptional(skiptokenUnescaped) + var options *armhardwaresecuritymodules.CloudHsmClustersClientListByResourceGroupOptions + if skiptokenParam != nil { + options = &armhardwaresecuritymodules.CloudHsmClustersClientListByResourceGroupOptions{ + Skiptoken: skiptokenParam, + } + } + resp := c.srv.NewListByResourceGroupPager(resourceGroupNameParam, options) + newListByResourceGroupPager = &resp + c.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armhardwaresecuritymodules.CloudHsmClustersClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + c.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (c *CloudHsmClustersServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := c.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HardwareSecurityModules/cloudHsmClusters` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + skiptokenUnescaped, err := url.QueryUnescape(qp.Get("$skiptoken")) + if err != nil { + return nil, err + } + skiptokenParam := getOptional(skiptokenUnescaped) + var options *armhardwaresecuritymodules.CloudHsmClustersClientListBySubscriptionOptions + if skiptokenParam != nil { + options = &armhardwaresecuritymodules.CloudHsmClustersClientListBySubscriptionOptions{ + Skiptoken: skiptokenParam, + } + } + resp := c.srv.NewListBySubscriptionPager(options) + newListBySubscriptionPager = &resp + c.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armhardwaresecuritymodules.CloudHsmClustersClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + c.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (c *CloudHsmClustersServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := c.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HardwareSecurityModules/cloudHsmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armhardwaresecuritymodules.CloudHsmClusterPatchParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudHsmClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudHsmClusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginUpdate(req.Context(), resourceGroupNameParam, cloudHsmClusterNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + c.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + c.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/dedicatedhsm_server.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/dedicatedhsm_server.go index 2c4fc67b390f..8d169d886ab7 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/dedicatedhsm_server.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/dedicatedhsm_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/internal.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/internal.go index 4d8bd36394ec..7d2f89ba4bb2 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/internal.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/internal.go @@ -11,6 +11,7 @@ package fake import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "net/http" + "reflect" "sync" ) @@ -31,6 +32,13 @@ func contains[T comparable](s []T, v T) bool { return false } +func getOptional[T any](v T) *T { + if reflect.ValueOf(v).IsZero() { + return nil + } + return &v +} + func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) { if v == "" { return nil, nil diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/operations_server.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/operations_server.go index a1255ab3eebc..0a97184aa825 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/operations_server.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/operations_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/v2" "net/http" ) diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/privateendpointconnections_server.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/privateendpointconnections_server.go new file mode 100644 index 000000000000..61c4af3fc710 --- /dev/null +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/privateendpointconnections_server.go @@ -0,0 +1,112 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/v2" + "net/http" + "net/url" + "regexp" +) + +// PrivateEndpointConnectionsServer is a fake server for instances of the armhardwaresecuritymodules.PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsServer struct { + // NewListByCloudHsmClusterPager is the fake for method PrivateEndpointConnectionsClient.NewListByCloudHsmClusterPager + // HTTP status codes to indicate success: http.StatusOK + NewListByCloudHsmClusterPager func(resourceGroupName string, cloudHsmClusterName string, options *armhardwaresecuritymodules.PrivateEndpointConnectionsClientListByCloudHsmClusterOptions) (resp azfake.PagerResponder[armhardwaresecuritymodules.PrivateEndpointConnectionsClientListByCloudHsmClusterResponse]) +} + +// NewPrivateEndpointConnectionsServerTransport creates a new instance of PrivateEndpointConnectionsServerTransport with the provided implementation. +// The returned PrivateEndpointConnectionsServerTransport instance is connected to an instance of armhardwaresecuritymodules.PrivateEndpointConnectionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateEndpointConnectionsServerTransport(srv *PrivateEndpointConnectionsServer) *PrivateEndpointConnectionsServerTransport { + return &PrivateEndpointConnectionsServerTransport{ + srv: srv, + newListByCloudHsmClusterPager: newTracker[azfake.PagerResponder[armhardwaresecuritymodules.PrivateEndpointConnectionsClientListByCloudHsmClusterResponse]](), + } +} + +// PrivateEndpointConnectionsServerTransport connects instances of armhardwaresecuritymodules.PrivateEndpointConnectionsClient to instances of PrivateEndpointConnectionsServer. +// Don't use this type directly, use NewPrivateEndpointConnectionsServerTransport instead. +type PrivateEndpointConnectionsServerTransport struct { + srv *PrivateEndpointConnectionsServer + newListByCloudHsmClusterPager *tracker[azfake.PagerResponder[armhardwaresecuritymodules.PrivateEndpointConnectionsClientListByCloudHsmClusterResponse]] +} + +// Do implements the policy.Transporter interface for PrivateEndpointConnectionsServerTransport. +func (p *PrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "PrivateEndpointConnectionsClient.NewListByCloudHsmClusterPager": + resp, err = p.dispatchNewListByCloudHsmClusterPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListByCloudHsmClusterPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByCloudHsmClusterPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByCloudHsmClusterPager not implemented")} + } + newListByCloudHsmClusterPager := p.newListByCloudHsmClusterPager.get(req) + if newListByCloudHsmClusterPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HardwareSecurityModules/cloudHsmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudHsmClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudHsmClusterName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListByCloudHsmClusterPager(resourceGroupNameParam, cloudHsmClusterNameParam, nil) + newListByCloudHsmClusterPager = &resp + p.newListByCloudHsmClusterPager.add(req, newListByCloudHsmClusterPager) + server.PagerResponderInjectNextLinks(newListByCloudHsmClusterPager, req, func(page *armhardwaresecuritymodules.PrivateEndpointConnectionsClientListByCloudHsmClusterResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByCloudHsmClusterPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByCloudHsmClusterPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByCloudHsmClusterPager) { + p.newListByCloudHsmClusterPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/server_factory.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/server_factory.go index cbaebe66442f..de8cd534bdee 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/server_factory.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/server_factory.go @@ -19,8 +19,12 @@ import ( // ServerFactory is a fake server for instances of the armhardwaresecuritymodules.ClientFactory type. type ServerFactory struct { - DedicatedHsmServer DedicatedHsmServer - OperationsServer OperationsServer + CloudHsmClusterPrivateEndpointConnectionsServer CloudHsmClusterPrivateEndpointConnectionsServer + CloudHsmClusterPrivateLinkResourcesServer CloudHsmClusterPrivateLinkResourcesServer + CloudHsmClustersServer CloudHsmClustersServer + DedicatedHsmServer DedicatedHsmServer + OperationsServer OperationsServer + PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -35,10 +39,14 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armhardwaresecuritymodules.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trDedicatedHsmServer *DedicatedHsmServerTransport - trOperationsServer *OperationsServerTransport + srv *ServerFactory + trMu sync.Mutex + trCloudHsmClusterPrivateEndpointConnectionsServer *CloudHsmClusterPrivateEndpointConnectionsServerTransport + trCloudHsmClusterPrivateLinkResourcesServer *CloudHsmClusterPrivateLinkResourcesServerTransport + trCloudHsmClustersServer *CloudHsmClustersServerTransport + trDedicatedHsmServer *DedicatedHsmServerTransport + trOperationsServer *OperationsServerTransport + trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -54,12 +62,32 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { + case "CloudHsmClusterPrivateEndpointConnectionsClient": + initServer(s, &s.trCloudHsmClusterPrivateEndpointConnectionsServer, func() *CloudHsmClusterPrivateEndpointConnectionsServerTransport { + return NewCloudHsmClusterPrivateEndpointConnectionsServerTransport(&s.srv.CloudHsmClusterPrivateEndpointConnectionsServer) + }) + resp, err = s.trCloudHsmClusterPrivateEndpointConnectionsServer.Do(req) + case "CloudHsmClusterPrivateLinkResourcesClient": + initServer(s, &s.trCloudHsmClusterPrivateLinkResourcesServer, func() *CloudHsmClusterPrivateLinkResourcesServerTransport { + return NewCloudHsmClusterPrivateLinkResourcesServerTransport(&s.srv.CloudHsmClusterPrivateLinkResourcesServer) + }) + resp, err = s.trCloudHsmClusterPrivateLinkResourcesServer.Do(req) + case "CloudHsmClustersClient": + initServer(s, &s.trCloudHsmClustersServer, func() *CloudHsmClustersServerTransport { + return NewCloudHsmClustersServerTransport(&s.srv.CloudHsmClustersServer) + }) + resp, err = s.trCloudHsmClustersServer.Do(req) case "DedicatedHsmClient": initServer(s, &s.trDedicatedHsmServer, func() *DedicatedHsmServerTransport { return NewDedicatedHsmServerTransport(&s.srv.DedicatedHsmServer) }) resp, err = s.trDedicatedHsmServer.Do(req) case "OperationsClient": initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) + case "PrivateEndpointConnectionsClient": + initServer(s, &s.trPrivateEndpointConnectionsServer, func() *PrivateEndpointConnectionsServerTransport { + return NewPrivateEndpointConnectionsServerTransport(&s.srv.PrivateEndpointConnectionsServer) + }) + resp, err = s.trPrivateEndpointConnectionsServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/go.mod b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/go.mod index 924d95eb9193..7676b0af0dfc 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/go.mod +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/v2 go 1.18 diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models.go index 29bda201e9df..439c2c5a0c1b 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models.go @@ -16,6 +16,183 @@ type APIEntityReference struct { ID *string } +// BackupProperties - Cloud Hsm Cluster backup information +type BackupProperties struct { + // Azure storage Resource Uri + AzureStorageResourceURI *string + + // READ-ONLY; Last Date Time that Customer Enabled Backup was taken + LastBackupDateTime *time.Time + + // READ-ONLY; Status of last backup + LastBackupStatus *string +} + +// CHsmError - Error details +type CHsmError struct { + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The error message. + Message *string +} + +// CloudHsmCluster - Resource information with extended details. +type CloudHsmCluster struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Managed service identity (system assigned and/or user assigned identities) + Identity *ManagedServiceIdentity + + // Properties of the Cloud HSM Cluster + Properties *CloudHsmClusterProperties + + // SKU details + SKU *CloudHsmClusterSKU + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/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 +} + +// CloudHsmClusterError - The Cloud HSM Cluster error details +type CloudHsmClusterError struct { + // Error details + Error *CHsmError +} + +// CloudHsmClusterListResult - List of Cloud HSM Clusters +type CloudHsmClusterListResult struct { + // The URL to get the next set of Cloud HSM Clusters. + NextLink *string + + // The list of Cloud HSM Clusters. + Value []*CloudHsmCluster +} + +// CloudHsmClusterPatchParameters - Patchable properties of the Cloud HSM Cluster +type CloudHsmClusterPatchParameters struct { + // Managed service identity (system assigned and/or user assigned identities) + Identity *ManagedServiceIdentity + + // Properties of the Cloud HSM Cluster + Properties *CloudHsmClusterPatchParametersProperties + + // SKU details + SKU *CloudHsmClusterSKU + + // The Cloud HSM Cluster's tags + Tags map[string]*string +} + +// CloudHsmClusterPatchParametersProperties - Properties of the Cloud HSM Cluster +type CloudHsmClusterPatchParametersProperties struct { + // Cloud Hsm Cluster backup information + BackupProperties *BackupProperties +} + +// CloudHsmClusterProperties - Properties of a Cloud HSM Cluster. +type CloudHsmClusterProperties struct { + // The Cloud HSM Cluster's auto-generated Domain Name Label Scope + AutoGeneratedDomainNameLabelScope *string + + // Cloud Hsm Cluster backup information + BackupProperties *BackupProperties + + // An array of Cloud HSM Cluster's HSMs + Hsms []*CloudHsmProperties + + // List of private endpoint connection resources + PrivateEndpointConnections []*PrivateEndpointConnection + + // The Cloud HSM Cluster's provisioningState + ProvisioningState *ProvisioningState + + // The Cloud HSM Cluster public network access + PublicNetworkAccess *string + + // Cloud Hsm Cluster restore information + RestoreProperties *RestoreProperties + + // Security domain properties information for Cloud HSM cluster + SecurityDomain *CloudHsmClusterSecurityDomainProperties + + // READ-ONLY; Cloud HSM Cluster status message + StatusMessage *string +} + +// CloudHsmClusterResource - Cloud HSM Cluster Resource +type CloudHsmClusterResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Managed service identity (system assigned and/or user assigned identities) + Identity *ManagedServiceIdentity + + // SKU details + SKU *CloudHsmClusterSKU + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/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 +} + +// CloudHsmClusterSKU - Cloud Hsm Cluster SKU information +type CloudHsmClusterSKU struct { + // REQUIRED; Sku family of the Cloud HSM Cluster + Family *CloudHsmClusterSKUFamily + + // REQUIRED; Sku name of the Cloud HSM Cluster + Name *CloudHsmClusterSKUName + + // Sku capacity + Capacity *int32 +} + +// CloudHsmClusterSecurityDomainProperties - Security domain properties information for Cloud HSM cluster +type CloudHsmClusterSecurityDomainProperties struct { + // status of security domain activation + ActivationStatus *string + + // FIPS state information for security domain + FipsState *int32 +} + +// CloudHsmProperties - The Cloud HSM Properties +type CloudHsmProperties struct { + // FQDN of the Cloud HSM + Fqdn *string + + // The Cloud HSM State + State *string + + // The Cloud HSM State message + StateMessage *string +} + // DedicatedHsm - Resource information with extended details. type DedicatedHsm struct { // REQUIRED; The supported Azure location where the dedicated HSM should be created. @@ -40,7 +217,7 @@ type DedicatedHsm struct { Name *string // READ-ONLY; Metadata pertaining to creation and last modification of the resource - SystemData *SystemData + SystemData *SystemDataAutoGenerated // READ-ONLY; The resource type of the dedicated HSM. Type *string @@ -69,8 +246,11 @@ type DedicatedHsmOperation struct { // The name of the Dedicated HSM Resource Provider Operation. Name *string + // The origin of the operation + Origin *string + // READ-ONLY; Gets or sets a value indicating whether it is a data plane action - IsDataAction *string + IsDataAction *bool } // DedicatedHsmOperationDisplay - The display string. @@ -119,6 +299,30 @@ type DedicatedHsmProperties struct { StatusMessage *string } +// DedicatedHsmResource - Dedicated HSM resource +type DedicatedHsmResource struct { + // REQUIRED; The supported Azure location where the dedicated HSM should be created. + Location *string + + // SKU details + SKU *SKU + + // Resource tags + Tags map[string]*string + + // The Dedicated Hsm zones. + Zones []*string + + // READ-ONLY; The Azure Resource Manager resource ID for the dedicated HSM. + ID *string + + // READ-ONLY; The name of the dedicated HSM. + Name *string + + // READ-ONLY; The resource type of the dedicated HSM. + Type *string +} + // EndpointDependency - A domain name that dedicated hsm services are reaching at. type EndpointDependency struct { // The domain name of the dependency. @@ -155,6 +359,26 @@ type Error struct { Message *string } +// ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) +type ManagedServiceIdentity struct { + // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + Type *ManagedServiceIdentityType + + // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM + // resource ids in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + // The dictionary values can be empty objects ({}) in + // requests. + UserAssignedIdentities map[string]*UserAssignedIdentity + + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string + + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string +} + // NetworkInterface - The network interface definition. type NetworkInterface struct { // Private Ip address of the interface @@ -191,27 +415,134 @@ type OutboundEnvironmentEndpointCollection struct { NextLink *string } -// Resource - Dedicated HSM resource -type Resource struct { - // REQUIRED; The supported Azure location where the dedicated HSM should be created. - Location *string +// PrivateEndpoint - The private endpoint resource. +type PrivateEndpoint struct { + // READ-ONLY; The ARM identifier for private endpoint. + ID *string +} - // SKU details - SKU *SKU +// PrivateEndpointConnection - The private endpoint connection resource. +type PrivateEndpointConnection struct { + // Modified whenever there is a change in the state of private endpoint connection. + Etag *string - // Resource tags - Tags map[string]*string + // Resource properties. + Properties *PrivateEndpointConnectionProperties - // The Dedicated Hsm zones. - Zones []*string + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string - // READ-ONLY; The Azure Resource Manager resource ID for the dedicated HSM. + // 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 +} + +// PrivateEndpointConnectionListResult - List of private endpoint connections associated with the specified resource. +type PrivateEndpointConnectionListResult struct { + // The URL to get the next set of private endpoint connections. + NextLink *string + + // Array of private endpoint connections. + Value []*PrivateEndpointConnection +} + +// PrivateEndpointConnectionProperties - Properties of the private endpoint connection. +type PrivateEndpointConnectionProperties struct { + // REQUIRED; A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState + + // The private endpoint resource. + PrivateEndpoint *PrivateEndpoint + + // READ-ONLY; The group ids for the private endpoint resource. + GroupIDs []*string + + // READ-ONLY; The provisioning state of the private endpoint connection resource. + ProvisioningState *PrivateEndpointConnectionProvisioningState +} + +// PrivateLinkResource - A private link resource. +type PrivateLinkResource struct { + // Resource properties. + Properties *PrivateLinkResourceProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; The name of the dedicated HSM. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The resource type of the dedicated HSM. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PrivateLinkResourceListResult - A list of private link resources. +type PrivateLinkResourceListResult struct { + // Array of private link resources + Value []*PrivateLinkResource +} + +// PrivateLinkResourceProperties - Properties of a private link resource. +type PrivateLinkResourceProperties struct { + // The private link resource private link DNS zone name. + RequiredZoneNames []*string + + // READ-ONLY; The private link resource group id. + GroupID *string + + // READ-ONLY; The private link resource required member names. + RequiredMembers []*string +} + +// PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer +// and provider. +type PrivateLinkServiceConnectionState struct { + // A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string + + // The reason for approval/rejection of the connection. + Description *string + + // Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + Status *PrivateEndpointServiceConnectionStatus +} + +// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a +// location +type ProxyResource struct { + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/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 +} + +// Resource - Common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/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 } @@ -221,7 +552,16 @@ type ResourceListResult struct { NextLink *string // The list of dedicated HSM resources. - Value []*Resource + Value []*DedicatedHsmResource +} + +// RestoreProperties - Cloud Hsm Cluster restore information +type RestoreProperties struct { + // Azure Blob storage container Uri + AzureStorageResourceURI *string + + // Directory name in Azure Storage Blob where the backup is stored + Foldername *string } // SKU of the dedicated HSM @@ -230,8 +570,29 @@ type SKU struct { Name *SKUName } -// SystemData - Metadata pertaining to creation and last modification of dedicated hsm resource. +// SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} + +// SystemDataAutoGenerated - Metadata pertaining to creation and last modification of dedicated hsm resource. +type SystemDataAutoGenerated struct { // The timestamp of dedicated hsm resource creation (UTC). CreatedAt *time.Time @@ -250,3 +611,34 @@ type SystemData struct { // The type of identity that last modified dedicated hsm resource. LastModifiedByType *IdentityType } + +// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' +// and a 'location' +type TrackedResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/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 +} + +// UserAssignedIdentity - User assigned identity properties +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the assigned identity. + ClientID *string + + // READ-ONLY; The principal ID of the assigned identity. + PrincipalID *string +} diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models_serde.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models_serde.go index 52b2a17dc627..c8f65d5d3d03 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models_serde.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models_serde.go @@ -12,6 +12,7 @@ import ( "encoding/json" "fmt" "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "reflect" ) @@ -42,23 +43,780 @@ func (a *APIEntityReference) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type BackupProperties. +func (b BackupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureStorageResourceUri", b.AzureStorageResourceURI) + populateDateTimeRFC3339(objectMap, "lastBackupDateTime", b.LastBackupDateTime) + populate(objectMap, "lastBackupStatus", b.LastBackupStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupProperties. +func (b *BackupProperties) 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureStorageResourceUri": + err = unpopulate(val, "AzureStorageResourceURI", &b.AzureStorageResourceURI) + delete(rawMsg, key) + case "lastBackupDateTime": + err = unpopulateDateTimeRFC3339(val, "LastBackupDateTime", &b.LastBackupDateTime) + delete(rawMsg, key) + case "lastBackupStatus": + err = unpopulate(val, "LastBackupStatus", &b.LastBackupStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CHsmError. +func (c CHsmError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", c.Code) + populate(objectMap, "message", c.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CHsmError. +func (c *CHsmError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &c.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudHsmCluster. +func (c CloudHsmCluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "sku", c.SKU) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudHsmCluster. +func (c *CloudHsmCluster) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &c.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudHsmClusterError. +func (c CloudHsmClusterError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", c.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudHsmClusterError. +func (c *CloudHsmClusterError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &c.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudHsmClusterListResult. +func (c CloudHsmClusterListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudHsmClusterListResult. +func (c *CloudHsmClusterListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudHsmClusterPatchParameters. +func (c CloudHsmClusterPatchParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "sku", c.SKU) + populate(objectMap, "tags", c.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudHsmClusterPatchParameters. +func (c *CloudHsmClusterPatchParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &c.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudHsmClusterPatchParametersProperties. +func (c CloudHsmClusterPatchParametersProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupProperties", c.BackupProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudHsmClusterPatchParametersProperties. +func (c *CloudHsmClusterPatchParametersProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupProperties": + err = unpopulate(val, "BackupProperties", &c.BackupProperties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudHsmClusterProperties. +func (c CloudHsmClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "autoGeneratedDomainNameLabelScope", c.AutoGeneratedDomainNameLabelScope) + populate(objectMap, "backupProperties", c.BackupProperties) + populate(objectMap, "hsms", c.Hsms) + populate(objectMap, "privateEndpointConnections", c.PrivateEndpointConnections) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "publicNetworkAccess", c.PublicNetworkAccess) + populate(objectMap, "restoreProperties", c.RestoreProperties) + populate(objectMap, "securityDomain", c.SecurityDomain) + populate(objectMap, "statusMessage", c.StatusMessage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudHsmClusterProperties. +func (c *CloudHsmClusterProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoGeneratedDomainNameLabelScope": + err = unpopulate(val, "AutoGeneratedDomainNameLabelScope", &c.AutoGeneratedDomainNameLabelScope) + delete(rawMsg, key) + case "backupProperties": + err = unpopulate(val, "BackupProperties", &c.BackupProperties) + delete(rawMsg, key) + case "hsms": + err = unpopulate(val, "Hsms", &c.Hsms) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &c.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &c.PublicNetworkAccess) + delete(rawMsg, key) + case "restoreProperties": + err = unpopulate(val, "RestoreProperties", &c.RestoreProperties) + delete(rawMsg, key) + case "securityDomain": + err = unpopulate(val, "SecurityDomain", &c.SecurityDomain) + delete(rawMsg, key) + case "statusMessage": + err = unpopulate(val, "StatusMessage", &c.StatusMessage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudHsmClusterResource. +func (c CloudHsmClusterResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "sku", c.SKU) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudHsmClusterResource. +func (c *CloudHsmClusterResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &c.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudHsmClusterSKU. +func (c CloudHsmClusterSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacity", c.Capacity) + if c.Family == nil { + c.Family = to.Ptr(CloudHsmClusterSKUFamilyB) + } + populate(objectMap, "family", c.Family) + populate(objectMap, "name", c.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudHsmClusterSKU. +func (c *CloudHsmClusterSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacity": + err = unpopulate(val, "Capacity", &c.Capacity) + delete(rawMsg, key) + case "family": + err = unpopulate(val, "Family", &c.Family) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudHsmClusterSecurityDomainProperties. +func (c CloudHsmClusterSecurityDomainProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "activationStatus", c.ActivationStatus) + populate(objectMap, "fipsState", c.FipsState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudHsmClusterSecurityDomainProperties. +func (c *CloudHsmClusterSecurityDomainProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "activationStatus": + err = unpopulate(val, "ActivationStatus", &c.ActivationStatus) + delete(rawMsg, key) + case "fipsState": + err = unpopulate(val, "FipsState", &c.FipsState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudHsmProperties. +func (c CloudHsmProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "fqdn", c.Fqdn) + populate(objectMap, "state", c.State) + populate(objectMap, "stateMessage", c.StateMessage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudHsmProperties. +func (c *CloudHsmProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "fqdn": + err = unpopulate(val, "Fqdn", &c.Fqdn) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &c.State) + delete(rawMsg, key) + case "stateMessage": + err = unpopulate(val, "StateMessage", &c.StateMessage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type DedicatedHsm. func (d DedicatedHsm) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", d.ID) populate(objectMap, "location", d.Location) populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "sku", d.SKU) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + populate(objectMap, "zones", d.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHsm. +func (d *DedicatedHsm) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &d.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &d.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHsmError. +func (d DedicatedHsmError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", d.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHsmError. +func (d *DedicatedHsmError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &d.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHsmListResult. +func (d DedicatedHsmListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHsmListResult. +func (d *DedicatedHsmListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHsmOperation. +func (d DedicatedHsmOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "display", d.Display) + populate(objectMap, "isDataAction", d.IsDataAction) + populate(objectMap, "name", d.Name) + populate(objectMap, "origin", d.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHsmOperation. +func (d *DedicatedHsmOperation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &d.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &d.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &d.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHsmOperationDisplay. +func (d DedicatedHsmOperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", d.Description) + populate(objectMap, "operation", d.Operation) + populate(objectMap, "provider", d.Provider) + populate(objectMap, "resource", d.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHsmOperationDisplay. +func (d *DedicatedHsmOperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &d.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &d.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &d.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHsmOperationListResult. +func (d DedicatedHsmOperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHsmOperationListResult. +func (d *DedicatedHsmOperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHsmPatchParameters. +func (d DedicatedHsmPatchParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", d.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHsmPatchParameters. +func (d *DedicatedHsmPatchParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHsmProperties. +func (d DedicatedHsmProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "managementNetworkProfile", d.ManagementNetworkProfile) + populate(objectMap, "networkProfile", d.NetworkProfile) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "stampId", d.StampID) + populate(objectMap, "statusMessage", d.StatusMessage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHsmProperties. +func (d *DedicatedHsmProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "managementNetworkProfile": + err = unpopulate(val, "ManagementNetworkProfile", &d.ManagementNetworkProfile) + delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &d.NetworkProfile) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "stampId": + err = unpopulate(val, "StampID", &d.StampID) + delete(rawMsg, key) + case "statusMessage": + err = unpopulate(val, "StatusMessage", &d.StatusMessage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHsmResource. +func (d DedicatedHsmResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) populate(objectMap, "sku", d.SKU) - populate(objectMap, "systemData", d.SystemData) populate(objectMap, "tags", d.Tags) populate(objectMap, "type", d.Type) populate(objectMap, "zones", d.Zones) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHsm. -func (d *DedicatedHsm) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHsmResource. +func (d *DedicatedHsmResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -75,15 +833,9 @@ func (d *DedicatedHsm) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) case "sku": err = unpopulate(val, "SKU", &d.SKU) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) - delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &d.Tags) delete(rawMsg, key) @@ -101,459 +853,592 @@ func (d *DedicatedHsm) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DedicatedHsmError. -func (d DedicatedHsmError) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EndpointDependency. +func (e EndpointDependency) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", d.Error) + populate(objectMap, "domainName", e.DomainName) + populate(objectMap, "endpointDetails", e.EndpointDetails) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHsmError. -func (d *DedicatedHsmError) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointDependency. +func (e *EndpointDependency) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &d.Error) + case "domainName": + err = unpopulate(val, "DomainName", &e.DomainName) + delete(rawMsg, key) + case "endpointDetails": + err = unpopulate(val, "EndpointDetails", &e.EndpointDetails) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DedicatedHsmListResult. -func (d DedicatedHsmListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EndpointDetail. +func (e EndpointDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) + populate(objectMap, "description", e.Description) + populate(objectMap, "ipAddress", e.IPAddress) + populate(objectMap, "port", e.Port) + populate(objectMap, "protocol", e.Protocol) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHsmListResult. -func (d *DedicatedHsmListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointDetail. +func (e *EndpointDetail) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) + case "description": + err = unpopulate(val, "Description", &e.Description) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) + case "ipAddress": + err = unpopulate(val, "IPAddress", &e.IPAddress) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &e.Port) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &e.Protocol) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DedicatedHsmOperation. -func (d DedicatedHsmOperation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Error. +func (e Error) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "display", d.Display) - populate(objectMap, "isDataAction", d.IsDataAction) - populate(objectMap, "name", d.Name) + populate(objectMap, "code", e.Code) + populate(objectMap, "innererror", e.InnerError) + populate(objectMap, "message", e.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHsmOperation. -func (d *DedicatedHsmOperation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Error. +func (e *Error) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "display": - err = unpopulate(val, "Display", &d.Display) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "isDataAction": - err = unpopulate(val, "IsDataAction", &d.IsDataAction) + case "innererror": + err = unpopulate(val, "InnerError", &e.InnerError) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) + case "message": + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DedicatedHsmOperationDisplay. -func (d DedicatedHsmOperationDisplay) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", d.Description) - populate(objectMap, "operation", d.Operation) - populate(objectMap, "provider", d.Provider) - populate(objectMap, "resource", d.Resource) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHsmOperationDisplay. -func (d *DedicatedHsmOperationDisplay) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. +func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &d.Description) + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &d.Operation) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &d.Provider) + case "type": + err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &d.Resource) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DedicatedHsmOperationListResult. -func (d DedicatedHsmOperationListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkInterface. +func (n NetworkInterface) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", d.Value) + populate(objectMap, "id", n.ID) + populate(objectMap, "privateIpAddress", n.PrivateIPAddress) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHsmOperationListResult. -func (d *DedicatedHsmOperationListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterface. +func (n *NetworkInterface) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &d.Value) + case "id": + err = unpopulate(val, "ID", &n.ID) + delete(rawMsg, key) + case "privateIpAddress": + err = unpopulate(val, "PrivateIPAddress", &n.PrivateIPAddress) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DedicatedHsmPatchParameters. -func (d DedicatedHsmPatchParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkProfile. +func (n NetworkProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "tags", d.Tags) + populate(objectMap, "networkInterfaces", n.NetworkInterfaces) + populate(objectMap, "subnet", n.Subnet) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHsmPatchParameters. -func (d *DedicatedHsmPatchParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfile. +func (n *NetworkProfile) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "tags": - err = unpopulate(val, "Tags", &d.Tags) + case "networkInterfaces": + err = unpopulate(val, "NetworkInterfaces", &n.NetworkInterfaces) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &n.Subnet) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DedicatedHsmProperties. -func (d DedicatedHsmProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OutboundEnvironmentEndpoint. +func (o OutboundEnvironmentEndpoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "managementNetworkProfile", d.ManagementNetworkProfile) - populate(objectMap, "networkProfile", d.NetworkProfile) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "stampId", d.StampID) - populate(objectMap, "statusMessage", d.StatusMessage) + populate(objectMap, "category", o.Category) + populate(objectMap, "endpoints", o.Endpoints) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundEnvironmentEndpoint. +func (o *OutboundEnvironmentEndpoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "category": + err = unpopulate(val, "Category", &o.Category) + delete(rawMsg, key) + case "endpoints": + err = unpopulate(val, "Endpoints", &o.Endpoints) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OutboundEnvironmentEndpointCollection. +func (o OutboundEnvironmentEndpointCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundEnvironmentEndpointCollection. +func (o *OutboundEnvironmentEndpointCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. +func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. +func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHsmProperties. -func (d *DedicatedHsmProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "managementNetworkProfile": - err = unpopulate(val, "ManagementNetworkProfile", &d.ManagementNetworkProfile) + case "etag": + err = unpopulate(val, "Etag", &p.Etag) delete(rawMsg, key) - case "networkProfile": - err = unpopulate(val, "NetworkProfile", &d.NetworkProfile) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + case "name": + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "stampId": - err = unpopulate(val, "StampID", &d.StampID) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) - case "statusMessage": - err = unpopulate(val, "StatusMessage", &d.StatusMessage) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EndpointDependency. -func (e EndpointDependency) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "domainName", e.DomainName) - populate(objectMap, "endpointDetails", e.EndpointDetails) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointDependency. -func (e *EndpointDependency) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "domainName": - err = unpopulate(val, "DomainName", &e.DomainName) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) - case "endpointDetails": - err = unpopulate(val, "EndpointDetails", &e.EndpointDetails) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EndpointDetail. -func (e EndpointDetail) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", e.Description) - populate(objectMap, "ipAddress", e.IPAddress) - populate(objectMap, "port", e.Port) - populate(objectMap, "protocol", e.Protocol) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointDetail. -func (e *EndpointDetail) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) 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) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &e.Description) + case "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) delete(rawMsg, key) - case "ipAddress": - err = unpopulate(val, "IPAddress", &e.IPAddress) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) delete(rawMsg, key) - case "port": - err = unpopulate(val, "Port", &e.Port) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) delete(rawMsg, key) - case "protocol": - err = unpopulate(val, "Protocol", &e.Protocol) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Error. -func (e Error) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "innererror", e.InnerError) - populate(objectMap, "message", e.Message) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Error. -func (e *Error) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "innererror": - err = unpopulate(val, "InnerError", &e.InnerError) + case "name": + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkInterface. -func (n NetworkInterface) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", n.ID) - populate(objectMap, "privateIpAddress", n.PrivateIPAddress) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterface. -func (n *NetworkInterface) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. +func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &n.ID) - delete(rawMsg, key) - case "privateIpAddress": - err = unpopulate(val, "PrivateIPAddress", &n.PrivateIPAddress) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkProfile. -func (n NetworkProfile) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "networkInterfaces", n.NetworkInterfaces) - populate(objectMap, "subnet", n.Subnet) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfile. -func (n *NetworkProfile) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "networkInterfaces": - err = unpopulate(val, "NetworkInterfaces", &n.NetworkInterfaces) + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) delete(rawMsg, key) - case "subnet": - err = unpopulate(val, "Subnet", &n.Subnet) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OutboundEnvironmentEndpoint. -func (o OutboundEnvironmentEndpoint) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "category", o.Category) - populate(objectMap, "endpoints", o.Endpoints) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundEnvironmentEndpoint. -func (o *OutboundEnvironmentEndpoint) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. +func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "category": - err = unpopulate(val, "Category", &o.Category) + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) delete(rawMsg, key) - case "endpoints": - err = unpopulate(val, "Endpoints", &o.Endpoints) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OutboundEnvironmentEndpointCollection. -func (o OutboundEnvironmentEndpointCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundEnvironmentEndpointCollection. -func (o *OutboundEnvironmentEndpointCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil @@ -563,12 +1448,9 @@ func (o *OutboundEnvironmentEndpointCollection) UnmarshalJSON(data []byte) error func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) - populate(objectMap, "sku", r.SKU) - populate(objectMap, "tags", r.Tags) + populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) - populate(objectMap, "zones", r.Zones) return json.Marshal(objectMap) } @@ -584,24 +1466,15 @@ func (r *Resource) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &r.SKU) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) - case "zones": - err = unpopulate(val, "Zones", &r.Zones) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -641,6 +1514,37 @@ func (r *ResourceListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type RestoreProperties. +func (r RestoreProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureStorageResourceUri", r.AzureStorageResourceURI) + populate(objectMap, "foldername", r.Foldername) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreProperties. +func (r *RestoreProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureStorageResourceUri": + err = unpopulate(val, "AzureStorageResourceURI", &r.AzureStorageResourceURI) + delete(rawMsg, key) + case "foldername": + err = unpopulate(val, "Foldername", &r.Foldername) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SKU. func (s SKU) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -715,6 +1619,131 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SystemDataAutoGenerated. +func (s SystemDataAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemDataAutoGenerated. +func (s *SystemDataAutoGenerated) 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 "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. +func (t *TrackedResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + func populate(m map[string]any, k string, v any) { if v == nil { return diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/operations_client_example_test.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/operations_client_example_test.go index eef6e5fd662b..4af42122fdef 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/operations_client_example_test.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/operations_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_OperationsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_OperationsList.json func ExampleOperationsClient_NewListPager_getAListOfDedicatedHsmOperations() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -49,13 +49,14 @@ func ExampleOperationsClient_NewListPager_getAListOfDedicatedHsmOperations() { // Provider: to.Ptr("Microsoft HardwareSecurityModules"), // Resource: to.Ptr("Dedicated HSM"), // }, - // IsDataAction: to.Ptr("false"), + // IsDataAction: to.Ptr(false), + // Origin: to.Ptr("system"), // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_OperationsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_OperationsList.json func ExampleOperationsClient_NewListPager_getAListOfPaymentHsmOperations() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -87,7 +88,8 @@ func ExampleOperationsClient_NewListPager_getAListOfPaymentHsmOperations() { // Provider: to.Ptr("Microsoft HardwareSecurityModules"), // Resource: to.Ptr("Dedicated HSM"), // }, - // IsDataAction: to.Ptr("false"), + // IsDataAction: to.Ptr(false), + // Origin: to.Ptr("system"), // }}, // } } diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/options.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/options.go index e54baa0d90cb..27e13fdd7529 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/options.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/options.go @@ -8,6 +8,69 @@ package armhardwaresecuritymodules +// CloudHsmClusterPrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the CloudHsmClusterPrivateEndpointConnectionsClient.BeginDelete +// method. +type CloudHsmClusterPrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudHsmClusterPrivateEndpointConnectionsClientCreateOptions contains the optional parameters for the CloudHsmClusterPrivateEndpointConnectionsClient.Create +// method. +type CloudHsmClusterPrivateEndpointConnectionsClientCreateOptions struct { + // placeholder for future optional parameters +} + +// CloudHsmClusterPrivateEndpointConnectionsClientGetOptions contains the optional parameters for the CloudHsmClusterPrivateEndpointConnectionsClient.Get +// method. +type CloudHsmClusterPrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterOptions contains the optional parameters for the CloudHsmClusterPrivateLinkResourcesClient.ListByCloudHsmCluster +// method. +type CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterOptions struct { + // placeholder for future optional parameters +} + +// CloudHsmClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the CloudHsmClustersClient.BeginCreateOrUpdate +// method. +type CloudHsmClustersClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudHsmClustersClientBeginDeleteOptions contains the optional parameters for the CloudHsmClustersClient.BeginDelete method. +type CloudHsmClustersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudHsmClustersClientBeginUpdateOptions contains the optional parameters for the CloudHsmClustersClient.BeginUpdate method. +type CloudHsmClustersClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudHsmClustersClientGetOptions contains the optional parameters for the CloudHsmClustersClient.Get method. +type CloudHsmClustersClientGetOptions struct { + // placeholder for future optional parameters +} + +// CloudHsmClustersClientListByResourceGroupOptions contains the optional parameters for the CloudHsmClustersClient.NewListByResourceGroupPager +// method. +type CloudHsmClustersClientListByResourceGroupOptions struct { + // The page-continuation token to use with a paged version of this API + Skiptoken *string +} + +// CloudHsmClustersClientListBySubscriptionOptions contains the optional parameters for the CloudHsmClustersClient.NewListBySubscriptionPager +// method. +type CloudHsmClustersClientListBySubscriptionOptions struct { + // The page-continuation token to use with a paged version of this API + Skiptoken *string +} + // DedicatedHsmClientBeginCreateOrUpdateOptions contains the optional parameters for the DedicatedHsmClient.BeginCreateOrUpdate // method. type DedicatedHsmClientBeginCreateOrUpdateOptions struct { @@ -56,3 +119,9 @@ type DedicatedHsmClientListOutboundNetworkDependenciesEndpointsOptions struct { type OperationsClientListOptions struct { // placeholder for future optional parameters } + +// PrivateEndpointConnectionsClientListByCloudHsmClusterOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByCloudHsmClusterPager +// method. +type PrivateEndpointConnectionsClientListByCloudHsmClusterOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/privateendpointconnections_client.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/privateendpointconnections_client.go new file mode 100644 index 000000000000..a91255249e78 --- /dev/null +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/privateendpointconnections_client.go @@ -0,0 +1,111 @@ +//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 armhardwaresecuritymodules + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. +// Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. +type PrivateEndpointConnectionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateEndpointConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListByCloudHsmClusterPager - The List operation gets information about the private endpoint connections associated with +// the Cloud HSM Cluster +// +// Generated from API version 2023-12-10-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudHsmClusterName - The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must +// be between 3 and 24 characters in length. +// - options - PrivateEndpointConnectionsClientListByCloudHsmClusterOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByCloudHsmClusterPager +// method. +func (client *PrivateEndpointConnectionsClient) NewListByCloudHsmClusterPager(resourceGroupName string, cloudHsmClusterName string, options *PrivateEndpointConnectionsClientListByCloudHsmClusterOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByCloudHsmClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListByCloudHsmClusterResponse]{ + More: func(page PrivateEndpointConnectionsClientListByCloudHsmClusterResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListByCloudHsmClusterResponse) (PrivateEndpointConnectionsClientListByCloudHsmClusterResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateEndpointConnectionsClient.NewListByCloudHsmClusterPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByCloudHsmClusterCreateRequest(ctx, resourceGroupName, cloudHsmClusterName, options) + }, nil) + if err != nil { + return PrivateEndpointConnectionsClientListByCloudHsmClusterResponse{}, err + } + return client.listByCloudHsmClusterHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByCloudHsmClusterCreateRequest creates the ListByCloudHsmCluster request. +func (client *PrivateEndpointConnectionsClient) listByCloudHsmClusterCreateRequest(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *PrivateEndpointConnectionsClientListByCloudHsmClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudHsmClusterName == "" { + return nil, errors.New("parameter cloudHsmClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudHsmClusterName}", url.PathEscape(cloudHsmClusterName)) + 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-12-10-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByCloudHsmClusterHandleResponse handles the ListByCloudHsmCluster response. +func (client *PrivateEndpointConnectionsClient) listByCloudHsmClusterHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListByCloudHsmClusterResponse, error) { + result := PrivateEndpointConnectionsClientListByCloudHsmClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { + return PrivateEndpointConnectionsClientListByCloudHsmClusterResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/privateendpointconnections_client_example_test.go new file mode 100644 index 000000000000..8d472e37608c --- /dev/null +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/privateendpointconnections_client_example_test.go @@ -0,0 +1,94 @@ +//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 armhardwaresecuritymodules_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmClusterPrivateEndpointConnection_ListByCloudHsmCluster_MaximumSet_Gen.json +func ExamplePrivateEndpointConnectionsClient_NewListByCloudHsmClusterPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhardwaresecuritymodules.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListByCloudHsmClusterPager("rgcloudhsm", "chsm1", 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 = armhardwaresecuritymodules.PrivateEndpointConnectionListResult{ + // Value: []*armhardwaresecuritymodules.PrivateEndpointConnection{ + // { + // Name: to.Ptr("chsm1"), + // Type: to.Ptr("Microsoft.HardwareSecurityModules/cloudHsmClusters/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcloudhsm/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/chsm1/privateEndpointConnections/sample-pec1"), + // SystemData: &armhardwaresecuritymodules.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), + // CreatedBy: to.Ptr("User1"), + // CreatedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), + // LastModifiedBy: to.Ptr("User2"), + // LastModifiedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // }, + // Properties: &armhardwaresecuritymodules.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armhardwaresecuritymodules.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcloudhsm/providers/Microsoft.Network/privateEndpoints/sample-pec1"), + // }, + // PrivateLinkServiceConnectionState: &armhardwaresecuritymodules.PrivateLinkServiceConnectionState{ + // Description: to.Ptr("This was automatically approved by user1234@contoso.com"), + // ActionsRequired: to.Ptr("None"), + // Status: to.Ptr(armhardwaresecuritymodules.PrivateEndpointServiceConnectionStatusApproved), + // }, + // ProvisioningState: to.Ptr(armhardwaresecuritymodules.PrivateEndpointConnectionProvisioningStateSucceeded), + // }, + // }, + // { + // Name: to.Ptr("chsm2"), + // Type: to.Ptr("Microsoft.HardwareSecurityModules/cloudHsmClusters/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcloudhsm/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/chsm2/privateEndpointConnections/sample-pec2"), + // SystemData: &armhardwaresecuritymodules.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), + // CreatedBy: to.Ptr("User1"), + // CreatedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), + // LastModifiedBy: to.Ptr("User2"), + // LastModifiedByType: to.Ptr(armhardwaresecuritymodules.CreatedByTypeUser), + // }, + // Properties: &armhardwaresecuritymodules.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armhardwaresecuritymodules.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcloudhsm/providers/Microsoft.Network/privateEndpoints/sample-pec2"), + // }, + // PrivateLinkServiceConnectionState: &armhardwaresecuritymodules.PrivateLinkServiceConnectionState{ + // Description: to.Ptr("This was automatically approved by user1234@contoso.com"), + // ActionsRequired: to.Ptr("None"), + // Status: to.Ptr(armhardwaresecuritymodules.PrivateEndpointServiceConnectionStatusApproved), + // }, + // ProvisioningState: to.Ptr(armhardwaresecuritymodules.PrivateEndpointConnectionProvisioningStateSucceeded), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/response_types.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/response_types.go index 0d28c86c9ce9..f467350a430e 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/response_types.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/response_types.go @@ -8,6 +8,64 @@ package armhardwaresecuritymodules +// CloudHsmClusterPrivateEndpointConnectionsClientCreateResponse contains the response from method CloudHsmClusterPrivateEndpointConnectionsClient.Create. +type CloudHsmClusterPrivateEndpointConnectionsClientCreateResponse struct { + // The private endpoint connection resource. + PrivateEndpointConnection +} + +// CloudHsmClusterPrivateEndpointConnectionsClientDeleteResponse contains the response from method CloudHsmClusterPrivateEndpointConnectionsClient.BeginDelete. +type CloudHsmClusterPrivateEndpointConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// CloudHsmClusterPrivateEndpointConnectionsClientGetResponse contains the response from method CloudHsmClusterPrivateEndpointConnectionsClient.Get. +type CloudHsmClusterPrivateEndpointConnectionsClientGetResponse struct { + // The private endpoint connection resource. + PrivateEndpointConnection +} + +// CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse contains the response from method CloudHsmClusterPrivateLinkResourcesClient.ListByCloudHsmCluster. +type CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse struct { + // A list of private link resources. + PrivateLinkResourceListResult +} + +// CloudHsmClustersClientCreateOrUpdateResponse contains the response from method CloudHsmClustersClient.BeginCreateOrUpdate. +type CloudHsmClustersClientCreateOrUpdateResponse struct { + // Resource information with extended details. + CloudHsmCluster +} + +// CloudHsmClustersClientDeleteResponse contains the response from method CloudHsmClustersClient.BeginDelete. +type CloudHsmClustersClientDeleteResponse struct { + // placeholder for future response values +} + +// CloudHsmClustersClientGetResponse contains the response from method CloudHsmClustersClient.Get. +type CloudHsmClustersClientGetResponse struct { + // Resource information with extended details. + CloudHsmCluster +} + +// CloudHsmClustersClientListByResourceGroupResponse contains the response from method CloudHsmClustersClient.NewListByResourceGroupPager. +type CloudHsmClustersClientListByResourceGroupResponse struct { + // List of Cloud HSM Clusters + CloudHsmClusterListResult +} + +// CloudHsmClustersClientListBySubscriptionResponse contains the response from method CloudHsmClustersClient.NewListBySubscriptionPager. +type CloudHsmClustersClientListBySubscriptionResponse struct { + // List of Cloud HSM Clusters + CloudHsmClusterListResult +} + +// CloudHsmClustersClientUpdateResponse contains the response from method CloudHsmClustersClient.BeginUpdate. +type CloudHsmClustersClientUpdateResponse struct { + // Resource information with extended details. + CloudHsmCluster +} + // DedicatedHsmClientCreateOrUpdateResponse contains the response from method DedicatedHsmClient.BeginCreateOrUpdate. type DedicatedHsmClientCreateOrUpdateResponse struct { // Resource information with extended details. @@ -54,3 +112,9 @@ type OperationsClientListResponse struct { // Result of the request to list Dedicated HSM Provider operations. It contains a list of operations. DedicatedHsmOperationListResult } + +// PrivateEndpointConnectionsClientListByCloudHsmClusterResponse contains the response from method PrivateEndpointConnectionsClient.NewListByCloudHsmClusterPager. +type PrivateEndpointConnectionsClientListByCloudHsmClusterResponse struct { + // List of private endpoint connections associated with the specified resource. + PrivateEndpointConnectionListResult +} From 6b439fb6258b3aafc9e80242712840be0cb1751a Mon Sep 17 00:00:00 2001 From: Alancere <804873052@qq.com> Date: Thu, 25 Jan 2024 17:04:28 +0800 Subject: [PATCH 2/2] update directive --- .../armhardwaresecuritymodules/CHANGELOG.md | 4 +- .../armhardwaresecuritymodules/autorest.md | 4 +- ...endpointconnections_client_example_test.go | 6 +- ...rivatelinkresources_client_example_test.go | 2 +- .../cloudhsmclusters_client_example_test.go | 12 +-- .../dedicatedhsm_client_example_test.go | 44 ++++----- .../armhardwaresecuritymodules/go.mod | 22 ++--- .../armhardwaresecuritymodules/go.sum | 46 ++++----- .../armhardwaresecuritymodules/models.go | 44 ++++----- .../models_serde.go | 94 +++++++++---------- .../operations_client_example_test.go | 4 +- ...endpointconnections_client_example_test.go | 2 +- 12 files changed, 142 insertions(+), 142 deletions(-) diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/CHANGELOG.md b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/CHANGELOG.md index bdf6821f418b..a214dc161260 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/CHANGELOG.md +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/CHANGELOG.md @@ -3,7 +3,7 @@ ## 2.0.0-beta.1 (2024-01-26) ### Breaking Changes -- Type of `DedicatedHsm.SystemData` has been changed from `*SystemData` to `*SystemDataAutoGenerated` +- Type of `DedicatedHsm.SystemData` has been changed from `*SystemData` to `*DedicatedHsmSystemData` - Type of `DedicatedHsmOperation.IsDataAction` has been changed from `*string` to `*bool` - Type of `ResourceListResult.Value` has been changed from `[]*Resource` to `[]*DedicatedHsmResource` - Type of `SystemData.CreatedByType` has been changed from `*IdentityType` to `*CreatedByType` @@ -51,6 +51,7 @@ - New struct `CloudHsmClusterSecurityDomainProperties` - New struct `CloudHsmProperties` - New struct `DedicatedHsmResource` +- New struct `DedicatedHsmSystemData` - New struct `ManagedServiceIdentity` - New struct `PrivateEndpoint` - New struct `PrivateEndpointConnection` @@ -62,7 +63,6 @@ - New struct `PrivateLinkServiceConnectionState` - New struct `ProxyResource` - New struct `RestoreProperties` -- New struct `SystemDataAutoGenerated` - New struct `TrackedResource` - New struct `UserAssignedIdentity` - New field `Origin` in struct `DedicatedHsmOperation` diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/autorest.md b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/autorest.md index ff9acb593923..fb2391a5c7b9 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/autorest.md +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION module-version: 2.0.0-beta.1 tag: package-2023-12-preview diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivateendpointconnections_client_example_test.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivateendpointconnections_client_example_test.go index 13d761088968..6d67b8980385 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivateendpointconnections_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmClusterPrivateEndpointConnection_Create_MaximumSet_Gen.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmClusterPrivateEndpointConnection_Create_MaximumSet_Gen.json func ExampleCloudHsmClusterPrivateEndpointConnectionsClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -69,7 +69,7 @@ func ExampleCloudHsmClusterPrivateEndpointConnectionsClient_Create() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmClusterPrivateEndpointConnection_Delete_MaximumSet_Gen.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmClusterPrivateEndpointConnection_Delete_MaximumSet_Gen.json func ExampleCloudHsmClusterPrivateEndpointConnectionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -90,7 +90,7 @@ func ExampleCloudHsmClusterPrivateEndpointConnectionsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmClusterPrivateEndpointConnection_Get_MaximumSet_Gen.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmClusterPrivateEndpointConnection_Get_MaximumSet_Gen.json func ExampleCloudHsmClusterPrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivatelinkresources_client_example_test.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivatelinkresources_client_example_test.go index 601a2eaabea8..6c9a8f58f755 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivatelinkresources_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmClusterPrivateLinkResource_ListByCloudHsmCluster_MaximumSet_Gen.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmClusterPrivateLinkResource_ListByCloudHsmCluster_MaximumSet_Gen.json func ExampleCloudHsmClusterPrivateLinkResourcesClient_ListByCloudHsmCluster() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusters_client_example_test.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusters_client_example_test.go index 601c11224bc4..ba6e6b2663a0 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusters_client_example_test.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusters_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmCluster_CreateOrUpdate_MaximumSet_Gen.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmCluster_CreateOrUpdate_MaximumSet_Gen.json func ExampleCloudHsmClustersClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -113,7 +113,7 @@ func ExampleCloudHsmClustersClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmCluster_Update_MaximumSet_Gen.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmCluster_Update_MaximumSet_Gen.json func ExampleCloudHsmClustersClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -201,7 +201,7 @@ func ExampleCloudHsmClustersClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmCluster_Get_MaximumSet_Gen.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmCluster_Get_MaximumSet_Gen.json func ExampleCloudHsmClustersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -267,7 +267,7 @@ func ExampleCloudHsmClustersClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmCluster_Delete_MaximumSet_Gen.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmCluster_Delete_MaximumSet_Gen.json func ExampleCloudHsmClustersClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -288,7 +288,7 @@ func ExampleCloudHsmClustersClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmCluster_ListByResourceGroup_MaximumSet_Gen.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmCluster_ListByResourceGroup_MaximumSet_Gen.json func ExampleCloudHsmClustersClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -407,7 +407,7 @@ func ExampleCloudHsmClustersClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmCluster_ListBySubscription_MaximumSet_Gen.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmCluster_ListBySubscription_MaximumSet_Gen.json func ExampleCloudHsmClustersClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/dedicatedhsm_client_example_test.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/dedicatedhsm_client_example_test.go index ced12451d182..cc0cf33d7686 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/dedicatedhsm_client_example_test.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/dedicatedhsm_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_CreateOrUpdate.json func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingDedicatedHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -91,7 +91,7 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingD // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_CreateOrUpdate.json func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingPaymentHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -171,7 +171,7 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingP // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // SystemData: &armhardwaresecuritymodules.SystemDataAutoGenerated{ + // SystemData: &armhardwaresecuritymodules.DedicatedHsmSystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), // CreatedBy: to.Ptr("user1"), // CreatedByType: to.Ptr(armhardwaresecuritymodules.IdentityTypeUser), @@ -182,7 +182,7 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingP // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_CreateOrUpdate_WithManagementProfile.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_CreateOrUpdate_WithManagementProfile.json func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingPaymentHsmWithManagementProfile() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -271,7 +271,7 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingP // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // SystemData: &armhardwaresecuritymodules.SystemDataAutoGenerated{ + // SystemData: &armhardwaresecuritymodules.DedicatedHsmSystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), // CreatedBy: to.Ptr("user1"), // CreatedByType: to.Ptr(armhardwaresecuritymodules.IdentityTypeUser), @@ -282,7 +282,7 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingP // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_Update.json func ExampleDedicatedHsmClient_BeginUpdate_updateAnExistingDedicatedHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -341,7 +341,7 @@ func ExampleDedicatedHsmClient_BeginUpdate_updateAnExistingDedicatedHsm() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_Update.json func ExampleDedicatedHsmClient_BeginUpdate_updateAnExistingPaymentHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -407,7 +407,7 @@ func ExampleDedicatedHsmClient_BeginUpdate_updateAnExistingPaymentHsm() { // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // SystemData: &armhardwaresecuritymodules.SystemDataAutoGenerated{ + // SystemData: &armhardwaresecuritymodules.DedicatedHsmSystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), // CreatedBy: to.Ptr("user1"), // CreatedByType: to.Ptr(armhardwaresecuritymodules.IdentityTypeUser), @@ -418,7 +418,7 @@ func ExampleDedicatedHsmClient_BeginUpdate_updateAnExistingPaymentHsm() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_Delete.json func ExampleDedicatedHsmClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -439,7 +439,7 @@ func ExampleDedicatedHsmClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_Get.json func ExampleDedicatedHsmClient_Get_getADedicatedHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -488,7 +488,7 @@ func ExampleDedicatedHsmClient_Get_getADedicatedHsm() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_Get.json func ExampleDedicatedHsmClient_Get_getAPaymentHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -544,7 +544,7 @@ func ExampleDedicatedHsmClient_Get_getAPaymentHsm() { // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // SystemData: &armhardwaresecuritymodules.SystemDataAutoGenerated{ + // SystemData: &armhardwaresecuritymodules.DedicatedHsmSystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), // CreatedBy: to.Ptr("user1"), // CreatedByType: to.Ptr(armhardwaresecuritymodules.IdentityTypeUser), @@ -555,7 +555,7 @@ func ExampleDedicatedHsmClient_Get_getAPaymentHsm() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_Get_With_2018-10-31Preview_Version.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_Get_With_2018-10-31Preview_Version.json func ExampleDedicatedHsmClient_Get_getAPaymentHsmWith20181031PreviewApiVersion() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -604,7 +604,7 @@ func ExampleDedicatedHsmClient_Get_getAPaymentHsmWith20181031PreviewApiVersion() // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_ListByResourceGroup.json func ExampleDedicatedHsmClient_NewListByResourceGroupPager_listDedicatedHsmDevicesInAResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -690,7 +690,7 @@ func ExampleDedicatedHsmClient_NewListByResourceGroupPager_listDedicatedHsmDevic } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_ListByResourceGroup.json func ExampleDedicatedHsmClient_NewListByResourceGroupPager_listDedicatedHsmDevicesInAResourceGroupIncludingPaymentHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -752,7 +752,7 @@ func ExampleDedicatedHsmClient_NewListByResourceGroupPager_listDedicatedHsmDevic // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // SystemData: &armhardwaresecuritymodules.SystemDataAutoGenerated{ + // SystemData: &armhardwaresecuritymodules.DedicatedHsmSystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), // CreatedBy: to.Ptr("user1"), // CreatedByType: to.Ptr(armhardwaresecuritymodules.IdentityTypeUser), @@ -799,7 +799,7 @@ func ExampleDedicatedHsmClient_NewListByResourceGroupPager_listDedicatedHsmDevic // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // SystemData: &armhardwaresecuritymodules.SystemDataAutoGenerated{ + // SystemData: &armhardwaresecuritymodules.DedicatedHsmSystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), // CreatedBy: to.Ptr("user1"), // CreatedByType: to.Ptr(armhardwaresecuritymodules.IdentityTypeUser), @@ -812,7 +812,7 @@ func ExampleDedicatedHsmClient_NewListByResourceGroupPager_listDedicatedHsmDevic } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_ListBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_ListBySubscription.json func ExampleDedicatedHsmClient_NewListBySubscriptionPager_listDedicatedHsmDevicesInASubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -898,7 +898,7 @@ func ExampleDedicatedHsmClient_NewListBySubscriptionPager_listDedicatedHsmDevice } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_ListBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_ListBySubscription.json func ExampleDedicatedHsmClient_NewListBySubscriptionPager_listDedicatedHsmDevicesInASubscriptionIncludingPaymentHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -960,7 +960,7 @@ func ExampleDedicatedHsmClient_NewListBySubscriptionPager_listDedicatedHsmDevice // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // SystemData: &armhardwaresecuritymodules.SystemDataAutoGenerated{ + // SystemData: &armhardwaresecuritymodules.DedicatedHsmSystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), // CreatedBy: to.Ptr("user1"), // CreatedByType: to.Ptr(armhardwaresecuritymodules.IdentityTypeUser), @@ -1007,7 +1007,7 @@ func ExampleDedicatedHsmClient_NewListBySubscriptionPager_listDedicatedHsmDevice // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // SystemData: &armhardwaresecuritymodules.SystemDataAutoGenerated{ + // SystemData: &armhardwaresecuritymodules.DedicatedHsmSystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.000Z"); return t}()), // CreatedBy: to.Ptr("user1"), // CreatedByType: to.Ptr(armhardwaresecuritymodules.IdentityTypeUser), @@ -1020,7 +1020,7 @@ func ExampleDedicatedHsmClient_NewListBySubscriptionPager_listDedicatedHsmDevice } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/GetOutboundNetworkDependenciesEndpointsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/GetOutboundNetworkDependenciesEndpointsList.json func ExampleDedicatedHsmClient_NewListOutboundNetworkDependenciesEndpointsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/go.mod b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/go.mod index 7676b0af0dfc..c600a3fef034 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/go.mod +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/go.mod @@ -3,19 +3,19 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymod go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 // indirect - github.com/golang-jwt/jwt/v5 v5.0.0 // indirect - github.com/google/uuid v1.3.1 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1 // indirect + github.com/golang-jwt/jwt/v5 v5.2.0 // indirect + github.com/google/uuid v1.5.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.14.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect + golang.org/x/crypto v0.17.0 // indirect + golang.org/x/net v0.19.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect ) diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/go.sum b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/go.sum index 7985f1da436f..eef8064879b6 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/go.sum +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/go.sum @@ -1,31 +1,31 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 h1:fb8kj/Dh4CSwgsOzHeZY4Xh68cFVbzXx+ONXGMY//4w= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0/go.mod h1:uReU2sSxZExRPBAg3qKzmAucSi51+SP1OhohieR821Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 h1:BMAjVKJM0U/CYF27gA0ZMmXGkOcvfFtD0oHVZ1TIPRI= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0/go.mod h1:1fXstnBMas5kzG+S3q8UoJcmyU6nUeunJcMDHcRYHhs= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 h1:d81/ng9rET2YqdVkVwkb6EXeRrLJIwyGnJcAlAWKwhs= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= -github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 h1:WpB/QDNLpMw72xHJc34BNNykqSOeEJDAWkhf0u12/Jk= -github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1 h1:lGlwhPtrX6EVml1hO0ivjkUxsSyl4dsiw9qcA1k/3IQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1/go.mod h1:RKUqNu35KJYcVG/fqTRqmuXJZYNhYkBrnC/hX7yGbTA= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1 h1:sO0/P7g68FrryJzljemN+6GTssUXdANk6aJ7T1ZxnsQ= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1/go.mod h1:h8hyGFDsU5HMivxiS2iYFZsgDbU9OnnJ163x5UGVKYo= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.1 h1:6oNBlSdi1QqM1PNW7FPA6xOGA5UNsXnkaYZz9vdPGhA= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.1/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1 h1:DzHpqpoJVaCgOUdVHxE8QB52S6NiVdDQvGlny1qvPqA= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= 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/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE= -github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw= +github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= +github.com/google/uuid v1.5.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/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models.go index 439c2c5a0c1b..aa8292a0dbca 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models.go @@ -217,7 +217,7 @@ type DedicatedHsm struct { Name *string // READ-ONLY; Metadata pertaining to creation and last modification of the resource - SystemData *SystemDataAutoGenerated + SystemData *DedicatedHsmSystemData // READ-ONLY; The resource type of the dedicated HSM. Type *string @@ -323,6 +323,27 @@ type DedicatedHsmResource struct { Type *string } +// DedicatedHsmSystemData - Metadata pertaining to creation and last modification of dedicated hsm resource. +type DedicatedHsmSystemData struct { + // The timestamp of dedicated hsm resource creation (UTC). + CreatedAt *time.Time + + // The identity that created dedicated hsm resource. + CreatedBy *string + + // The type of identity that created dedicated hsm resource. + CreatedByType *IdentityType + + // The timestamp of dedicated hsm resource last modification (UTC). + LastModifiedAt *time.Time + + // The identity that last modified dedicated hsm resource. + LastModifiedBy *string + + // The type of identity that last modified dedicated hsm resource. + LastModifiedByType *IdentityType +} + // EndpointDependency - A domain name that dedicated hsm services are reaching at. type EndpointDependency struct { // The domain name of the dependency. @@ -591,27 +612,6 @@ type SystemData struct { LastModifiedByType *CreatedByType } -// SystemDataAutoGenerated - Metadata pertaining to creation and last modification of dedicated hsm resource. -type SystemDataAutoGenerated struct { - // The timestamp of dedicated hsm resource creation (UTC). - CreatedAt *time.Time - - // The identity that created dedicated hsm resource. - CreatedBy *string - - // The type of identity that created dedicated hsm resource. - CreatedByType *IdentityType - - // The timestamp of dedicated hsm resource last modification (UTC). - LastModifiedAt *time.Time - - // The identity that last modified dedicated hsm resource. - LastModifiedBy *string - - // The type of identity that last modified dedicated hsm resource. - LastModifiedByType *IdentityType -} - // TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' // and a 'location' type TrackedResource struct { diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models_serde.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models_serde.go index c8f65d5d3d03..fd5c3a5e3c04 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models_serde.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models_serde.go @@ -853,6 +853,53 @@ func (d *DedicatedHsmResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DedicatedHsmSystemData. +func (d DedicatedHsmSystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", d.CreatedAt) + populate(objectMap, "createdBy", d.CreatedBy) + populate(objectMap, "createdByType", d.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", d.LastModifiedAt) + populate(objectMap, "lastModifiedBy", d.LastModifiedBy) + populate(objectMap, "lastModifiedByType", d.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHsmSystemData. +func (d *DedicatedHsmSystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &d.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &d.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &d.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &d.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &d.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &d.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type EndpointDependency. func (e EndpointDependency) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1619,53 +1666,6 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SystemDataAutoGenerated. -func (s SystemDataAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemDataAutoGenerated. -func (s *SystemDataAutoGenerated) 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 "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type TrackedResource. func (t TrackedResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/operations_client_example_test.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/operations_client_example_test.go index 4af42122fdef..8566f17fa1f1 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/operations_client_example_test.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/operations_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_OperationsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_OperationsList.json func ExampleOperationsClient_NewListPager_getAListOfDedicatedHsmOperations() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -56,7 +56,7 @@ func ExampleOperationsClient_NewListPager_getAListOfDedicatedHsmOperations() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_OperationsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_OperationsList.json func ExampleOperationsClient_NewListPager_getAListOfPaymentHsmOperations() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/privateendpointconnections_client_example_test.go index 8d472e37608c..802427393311 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/privateendpointconnections_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmClusterPrivateEndpointConnection_ListByCloudHsmCluster_MaximumSet_Gen.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmClusterPrivateEndpointConnection_ListByCloudHsmCluster_MaximumSet_Gen.json func ExamplePrivateEndpointConnectionsClient_NewListByCloudHsmClusterPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil {