diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/CHANGELOG.md b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/CHANGELOG.md index a214dc1612..c839f5c9af 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/CHANGELOG.md +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/CHANGELOG.md @@ -1,5 +1,68 @@ # Release History +## 2.0.0-beta.2 (2024-11-18) +### Breaking Changes + +- Type of `CloudHsmClusterProperties.AutoGeneratedDomainNameLabelScope` has been changed from `*string` to `*AutoGeneratedDomainNameLabelScope` +- Type of `CloudHsmClusterProperties.PublicNetworkAccess` has been changed from `*string` to `*PublicNetworkAccess` +- Type of `DedicatedHsm.SystemData` has been changed from `*DedicatedHsmSystemData` to `*SystemData` +- Operation `*CloudHsmClusterPrivateLinkResourcesClient.ListByCloudHsmCluster` has supported pagination, use `*CloudHsmClusterPrivateLinkResourcesClient.NewListByCloudHsmClusterPager` instead. +- Struct `BackupProperties` has been removed +- Struct `CHsmError` has been removed +- Struct `CloudHsmClusterError` has been removed +- Struct `CloudHsmClusterPatchParametersProperties` has been removed +- Struct `CloudHsmClusterSecurityDomainProperties` has been removed +- Struct `DedicatedHsmOperation` has been removed +- Struct `DedicatedHsmOperationDisplay` has been removed +- Struct `DedicatedHsmOperationListResult` has been removed +- Struct `DedicatedHsmResource` has been removed +- Struct `DedicatedHsmSystemData` has been removed +- Struct `ResourceListResult` has been removed +- Struct `RestoreProperties` has been removed +- Field `ID` of struct `APIEntityReference` has been removed +- Field `Properties`, `SKU` of struct `CloudHsmClusterPatchParameters` has been removed +- Field `BackupProperties`, `RestoreProperties`, `SecurityDomain` of struct `CloudHsmClusterProperties` has been removed +- Field `ID` of struct `NetworkInterface` has been removed +- Field `DedicatedHsmOperationListResult` of struct `OperationsClientListResponse` has been removed + +### Features Added + +- New enum type `ActionType` with values `ActionTypeInternal` +- New enum type `ActivationState` with values `ActivationStateActive`, `ActivationStateFailed`, `ActivationStateNotActivated`, `ActivationStateNotDefined`, `ActivationStateUnknown` +- New enum type `AutoGeneratedDomainNameLabelScope` with values `AutoGeneratedDomainNameLabelScopeNoReuse`, `AutoGeneratedDomainNameLabelScopeResourceGroupReuse`, `AutoGeneratedDomainNameLabelScopeSubscriptionReuse`, `AutoGeneratedDomainNameLabelScopeTenantReuse` +- New enum type `BackupRestoreOperationStatus` with values `BackupRestoreOperationStatusCancelled`, `BackupRestoreOperationStatusFailed`, `BackupRestoreOperationStatusInProgress`, `BackupRestoreOperationStatusSucceeded` +- New enum type `Origin` with values `OriginSystem`, `OriginUser`, `OriginUserSystem` +- New enum type `PublicNetworkAccess` with values `PublicNetworkAccessDisabled` +- New function `*ClientFactory.NewCloudHsmClusterBackupStatusClient() *CloudHsmClusterBackupStatusClient` +- New function `*ClientFactory.NewCloudHsmClusterRestoreStatusClient() *CloudHsmClusterRestoreStatusClient` +- New function `NewCloudHsmClusterBackupStatusClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CloudHsmClusterBackupStatusClient, error)` +- New function `*CloudHsmClusterBackupStatusClient.Get(context.Context, string, string, string, *CloudHsmClusterBackupStatusClientGetOptions) (CloudHsmClusterBackupStatusClientGetResponse, error)` +- New function `NewCloudHsmClusterRestoreStatusClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CloudHsmClusterRestoreStatusClient, error)` +- New function `*CloudHsmClusterRestoreStatusClient.Get(context.Context, string, string, string, *CloudHsmClusterRestoreStatusClientGetOptions) (CloudHsmClusterRestoreStatusClientGetResponse, error)` +- New function `*CloudHsmClustersClient.BeginRestore(context.Context, string, string, RestoreRequestProperties, *CloudHsmClustersClientBeginRestoreOptions) (*runtime.Poller[CloudHsmClustersClientRestoreResponse], error)` +- New function `*CloudHsmClustersClient.BeginValidateBackupProperties(context.Context, string, string, *CloudHsmClustersClientBeginValidateBackupPropertiesOptions) (*runtime.Poller[CloudHsmClustersClientValidateBackupPropertiesResponse], error)` +- New function `*CloudHsmClustersClient.BeginValidateRestoreProperties(context.Context, string, string, *CloudHsmClustersClientBeginValidateRestorePropertiesOptions) (*runtime.Poller[CloudHsmClustersClientValidateRestorePropertiesResponse], error)` +- New function `*CloudHsmClustersClient.BeginBackup(context.Context, string, string, *CloudHsmClustersClientBeginBackupOptions) (*runtime.Poller[CloudHsmClustersClientBackupResponse], error)` +- New struct `BackupRequestProperties` +- New struct `BackupRestoreBaseResultProperties` +- New struct `BackupRestoreRequestBaseProperties` +- New struct `BackupResult` +- New struct `BackupResultProperties` +- New struct `ErrorAdditionalInfo` +- New struct `ErrorDetail` +- New struct `ErrorResponse` +- New struct `Operation` +- New struct `OperationDisplay` +- New struct `OperationListResult` +- New struct `RestoreRequestProperties` +- New struct `RestoreResult` +- New field `ResourceID` in struct `APIEntityReference` +- New field `ActivationState` in struct `CloudHsmClusterProperties` +- New field `ResourceID` in struct `NetworkInterface` +- New anonymous field `OperationListResult` in struct `OperationsClientListResponse` +- New field `NextLink` in struct `PrivateLinkResourceListResult` + + ## 2.0.0-beta.1 (2024-01-26) ### Breaking Changes diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/README.md b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/README.md index 9c080b8ad3..7c13d2e1d9 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/README.md +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/README.md @@ -55,7 +55,7 @@ clientFactory, err := armhardwaresecuritymodules.NewClientFactory(", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCloudHsmClusterBackupStatusClient().Get(ctx, "rgcloudhsm", "chsm1", "572a45927fc240e1ac075de27371680b", 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.BackupResult = armhardwaresecuritymodules.BackupResult{ + // Properties: &armhardwaresecuritymodules.BackupResultProperties{ + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // JobID: to.Ptr("572a45927fc240e1ac075de27371680b"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // Status: to.Ptr(armhardwaresecuritymodules.BackupRestoreOperationStatusInProgress), + // StatusDetails: to.Ptr("Backup operation is in progress"), + // AzureStorageBlobContainerURI: to.Ptr("https://myaccount.blob.core.windows.net/sascontainer/sasContainer"), + // }, + // } +} diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivateendpointconnections_client.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivateendpointconnections_client.go index 00578218ec..808b58fc64 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivateendpointconnections_client.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivateendpointconnections_client.go @@ -46,10 +46,10 @@ func NewCloudHsmClusterPrivateEndpointConnectionsClient(subscriptionID string, c // Create - Creates or updates the private endpoint connection for the Cloud Hsm Cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-12-10-preview +// Generated from API version 2024-06-30-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. +// be between 3 and 23 characters in length. // - peConnectionName - Name of the private endpoint connection associated with the Cloud HSM Cluster. // - properties - Parameters of the PrivateEndpointConnection // - options - CloudHsmClusterPrivateEndpointConnectionsClientCreateOptions contains the optional parameters for the CloudHsmClusterPrivateEndpointConnectionsClient.Create @@ -100,7 +100,7 @@ func (client *CloudHsmClusterPrivateEndpointConnectionsClient) createCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-10-preview") + reqQP.Set("api-version", "2024-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { @@ -121,10 +121,10 @@ func (client *CloudHsmClusterPrivateEndpointConnectionsClient) createHandleRespo // BeginDelete - Deletes the private endpoint connection for the Cloud Hsm Cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-12-10-preview +// Generated from API version 2024-06-30-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. +// be between 3 and 23 characters in length. // - peConnectionName - Name of the private endpoint connection associated with the Cloud HSM Cluster. // - options - CloudHsmClusterPrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the CloudHsmClusterPrivateEndpointConnectionsClient.BeginDelete // method. @@ -149,7 +149,7 @@ func (client *CloudHsmClusterPrivateEndpointConnectionsClient) BeginDelete(ctx c // Delete - Deletes the private endpoint connection for the Cloud Hsm Cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-12-10-preview +// Generated from API version 2024-06-30-preview func (client *CloudHsmClusterPrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, peConnectionName string, options *CloudHsmClusterPrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CloudHsmClusterPrivateEndpointConnectionsClient.BeginDelete" @@ -164,7 +164,7 @@ func (client *CloudHsmClusterPrivateEndpointConnectionsClient) deleteOperation(c if err != nil { return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { err = runtime.NewResponseError(httpResp) return nil, err } @@ -195,7 +195,7 @@ func (client *CloudHsmClusterPrivateEndpointConnectionsClient) deleteCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-10-preview") + reqQP.Set("api-version", "2024-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -204,10 +204,10 @@ func (client *CloudHsmClusterPrivateEndpointConnectionsClient) deleteCreateReque // Get - Gets the private endpoint connection for the Cloud Hsm Cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-12-10-preview +// Generated from API version 2024-06-30-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. +// be between 3 and 23 characters in length. // - peConnectionName - Name of the private endpoint connection associated with the Cloud HSM Cluster. // - options - CloudHsmClusterPrivateEndpointConnectionsClientGetOptions contains the optional parameters for the CloudHsmClusterPrivateEndpointConnectionsClient.Get // method. @@ -257,7 +257,7 @@ func (client *CloudHsmClusterPrivateEndpointConnectionsClient) getCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-10-preview") + reqQP.Set("api-version", "2024-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivateendpointconnections_client_example_test.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivateendpointconnections_client_example_test.go index 6d67b89803..ca8670497f 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/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/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/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-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/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/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/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-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/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/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/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-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.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivatelinkresources_client.go index b2b653fc16..77fd2ec2d4 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivatelinkresources_client.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivatelinkresources_client.go @@ -43,35 +43,35 @@ func NewCloudHsmClusterPrivateLinkResourcesClient(subscriptionID string, credent 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. +// NewListByCloudHsmClusterPager - Gets the private link resources supported for the Cloud Hsm Cluster. // -// Generated from API version 2023-12-10-preview +// Generated from API version 2024-06-30-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. +// be between 3 and 23 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 +// CloudHsmClusterPrivateLinkResourcesClient.NewListByCloudHsmClusterPager method. +func (client *CloudHsmClusterPrivateLinkResourcesClient) NewListByCloudHsmClusterPager(resourceGroupName string, cloudHsmClusterName string, options *CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterOptions) *runtime.Pager[CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse]{ + More: func(page CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse) (CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CloudHsmClusterPrivateLinkResourcesClient.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 CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse{}, err + } + return client.listByCloudHsmClusterHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) } // listByCloudHsmClusterCreateRequest creates the ListByCloudHsmCluster request. @@ -94,7 +94,7 @@ func (client *CloudHsmClusterPrivateLinkResourcesClient) listByCloudHsmClusterCr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-10-preview") + reqQP.Set("api-version", "2024-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivatelinkresources_client_example_test.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivatelinkresources_client_example_test.go index 6c9a8f58f7..a4aea2197f 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterprivatelinkresources_client_example_test.go @@ -17,8 +17,8 @@ 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/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2023-12-10-preview/examples/CloudHsmClusterPrivateLinkResource_ListByCloudHsmCluster_MaximumSet_Gen.json -func ExampleCloudHsmClusterPrivateLinkResourcesClient_ListByCloudHsmCluster() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/CloudHsmClusterPrivateLinkResource_ListByCloudHsmCluster_MaximumSet_Gen.json +func ExampleCloudHsmClusterPrivateLinkResourcesClient_NewListByCloudHsmClusterPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -28,28 +28,33 @@ func ExampleCloudHsmClusterPrivateLinkResourcesClient_ListByCloudHsmCluster() { 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) + pager := clientFactory.NewCloudHsmClusterPrivateLinkResourcesClient().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.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")}, + // }, + // }}, + // } } - // 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/cloudhsmclusterrestorestatus_client.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterrestorestatus_client.go new file mode 100644 index 0000000000..37a07edaa3 --- /dev/null +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterrestorestatus_client.go @@ -0,0 +1,121 @@ +//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" +) + +// CloudHsmClusterRestoreStatusClient contains the methods for the CloudHsmClusterRestoreStatus group. +// Don't use this type directly, use NewCloudHsmClusterRestoreStatusClient() instead. +type CloudHsmClusterRestoreStatusClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCloudHsmClusterRestoreStatusClient creates a new instance of CloudHsmClusterRestoreStatusClient 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 NewCloudHsmClusterRestoreStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CloudHsmClusterRestoreStatusClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CloudHsmClusterRestoreStatusClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets the restore operation status of the specified Cloud HSM Cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-30-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 23 characters in length. +// - jobID - The id returned as part of the backup request +// - options - CloudHsmClusterRestoreStatusClientGetOptions contains the optional parameters for the CloudHsmClusterRestoreStatusClient.Get +// method. +func (client *CloudHsmClusterRestoreStatusClient) Get(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, jobID string, options *CloudHsmClusterRestoreStatusClientGetOptions) (CloudHsmClusterRestoreStatusClientGetResponse, error) { + var err error + const operationName = "CloudHsmClusterRestoreStatusClient.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, jobID, options) + if err != nil { + return CloudHsmClusterRestoreStatusClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CloudHsmClusterRestoreStatusClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return CloudHsmClusterRestoreStatusClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CloudHsmClusterRestoreStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, jobID string, options *CloudHsmClusterRestoreStatusClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/restoreOperationStatus/{jobId}" + 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)) + if jobID == "" { + return nil, errors.New("parameter jobID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobId}", url.PathEscape(jobID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-06-30-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CloudHsmClusterRestoreStatusClient) getHandleResponse(resp *http.Response) (CloudHsmClusterRestoreStatusClientGetResponse, error) { + result := CloudHsmClusterRestoreStatusClientGetResponse{} + if val := resp.Header.Get("Location"); val != "" { + result.Location = &val + } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.RestoreResult); err != nil { + return CloudHsmClusterRestoreStatusClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterrestorestatus_client_example_test.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterrestorestatus_client_example_test.go new file mode 100644 index 0000000000..34711f2906 --- /dev/null +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusterrestorestatus_client_example_test.go @@ -0,0 +1,47 @@ +//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/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/CloudHsmCluster_Restore_Pending_MaximumSet_Gen.json +func ExampleCloudHsmClusterRestoreStatusClient_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.NewCloudHsmClusterRestoreStatusClient().Get(ctx, "rgcloudhsm", "chsm1", "572a45927fc240e1ac075de27371680b", 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.RestoreResult = armhardwaresecuritymodules.RestoreResult{ + // Properties: &armhardwaresecuritymodules.BackupRestoreBaseResultProperties{ + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // JobID: to.Ptr("572a45927fc240e1ac075de27371680b"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // Status: to.Ptr(armhardwaresecuritymodules.BackupRestoreOperationStatusInProgress), + // StatusDetails: to.Ptr("Restore operation is in progress"), + // }, + // } +} diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusters_client.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusters_client.go index a3026679ad..4758cdc25b 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusters_client.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/cloudhsmclusters_client.go @@ -43,13 +43,97 @@ func NewCloudHsmClustersClient(subscriptionID string, credential azcore.TokenCre return client, nil } +// BeginBackup - Create a backup of the Cloud HSM Cluster in the specified subscription +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-30-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 23 characters in length. +// - options - CloudHsmClustersClientBeginBackupOptions contains the optional parameters for the CloudHsmClustersClient.BeginBackup +// method. +func (client *CloudHsmClustersClient) BeginBackup(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *CloudHsmClustersClientBeginBackupOptions) (*runtime.Poller[CloudHsmClustersClientBackupResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.backup(ctx, resourceGroupName, cloudHsmClusterName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudHsmClustersClientBackupResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudHsmClustersClientBackupResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Backup - Create a backup of the Cloud HSM Cluster in the specified subscription +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-30-preview +func (client *CloudHsmClustersClient) backup(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *CloudHsmClustersClientBeginBackupOptions) (*http.Response, error) { + var err error + const operationName = "CloudHsmClustersClient.BeginBackup" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.backupCreateRequest(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) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// backupCreateRequest creates the Backup request. +func (client *CloudHsmClustersClient) backupCreateRequest(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *CloudHsmClustersClientBeginBackupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/backup" + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-06-30-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.BackupRequestProperties != nil { + if err := runtime.MarshalAsJSON(req, *options.BackupRequestProperties); err != nil { + return nil, err + } + return req, nil + } + return req, 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 +// Generated from API version 2024-06-30-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. +// be between 3 and 23 characters in length. // - body - Parameters to create Cloud HSM Cluster // - options - CloudHsmClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the CloudHsmClustersClient.BeginCreateOrUpdate // method. @@ -74,7 +158,7 @@ func (client *CloudHsmClustersClient) BeginCreateOrUpdate(ctx context.Context, r // 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 +// Generated from API version 2024-06-30-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" @@ -116,7 +200,7 @@ func (client *CloudHsmClustersClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-10-preview") + reqQP.Set("api-version", "2024-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -128,10 +212,10 @@ func (client *CloudHsmClustersClient) createOrUpdateCreateRequest(ctx context.Co // 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 +// Generated from API version 2024-06-30-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. +// be between 3 and 23 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) { @@ -155,7 +239,7 @@ func (client *CloudHsmClustersClient) BeginDelete(ctx context.Context, resourceG // 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 +// Generated from API version 2024-06-30-preview func (client *CloudHsmClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *CloudHsmClustersClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CloudHsmClustersClient.BeginDelete" @@ -170,7 +254,7 @@ func (client *CloudHsmClustersClient) deleteOperation(ctx context.Context, resou if err != nil { return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { err = runtime.NewResponseError(httpResp) return nil, err } @@ -197,7 +281,7 @@ func (client *CloudHsmClustersClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-10-preview") + reqQP.Set("api-version", "2024-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -206,10 +290,10 @@ func (client *CloudHsmClustersClient) deleteCreateRequest(ctx context.Context, r // 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 +// Generated from API version 2024-06-30-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. +// be between 3 and 23 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 @@ -253,7 +337,7 @@ func (client *CloudHsmClustersClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-10-preview") + reqQP.Set("api-version", "2024-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -271,7 +355,7 @@ func (client *CloudHsmClustersClient) getHandleResponse(resp *http.Response) (Cl // 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 +// Generated from API version 2024-06-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - CloudHsmClustersClientListByResourceGroupOptions contains the optional parameters for the CloudHsmClustersClient.NewListByResourceGroupPager // method. @@ -317,7 +401,7 @@ func (client *CloudHsmClustersClient) listByResourceGroupCreateRequest(ctx conte if options != nil && options.Skiptoken != nil { reqQP.Set("$skiptoken", *options.Skiptoken) } - reqQP.Set("api-version", "2023-12-10-preview") + reqQP.Set("api-version", "2024-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -334,7 +418,7 @@ func (client *CloudHsmClustersClient) listByResourceGroupHandleResponse(resp *ht // NewListBySubscriptionPager - The List operation gets information about the Cloud HSM Clusters associated with the subscription. // -// Generated from API version 2023-12-10-preview +// Generated from API version 2024-06-30-preview // - options - CloudHsmClustersClientListBySubscriptionOptions contains the optional parameters for the CloudHsmClustersClient.NewListBySubscriptionPager // method. func (client *CloudHsmClustersClient) NewListBySubscriptionPager(options *CloudHsmClustersClientListBySubscriptionOptions) *runtime.Pager[CloudHsmClustersClientListBySubscriptionResponse] { @@ -375,7 +459,7 @@ func (client *CloudHsmClustersClient) listBySubscriptionCreateRequest(ctx contex if options != nil && options.Skiptoken != nil { reqQP.Set("$skiptoken", *options.Skiptoken) } - reqQP.Set("api-version", "2023-12-10-preview") + reqQP.Set("api-version", "2024-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -390,13 +474,95 @@ func (client *CloudHsmClustersClient) listBySubscriptionHandleResponse(resp *htt return result, nil } +// BeginRestore - Restores all key materials of a specified Cloud HSM Cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-30-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 23 characters in length. +// - restoreRequestProperties - Restore Operation Required properties +// - options - CloudHsmClustersClientBeginRestoreOptions contains the optional parameters for the CloudHsmClustersClient.BeginRestore +// method. +func (client *CloudHsmClustersClient) BeginRestore(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, restoreRequestProperties RestoreRequestProperties, options *CloudHsmClustersClientBeginRestoreOptions) (*runtime.Poller[CloudHsmClustersClientRestoreResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restore(ctx, resourceGroupName, cloudHsmClusterName, restoreRequestProperties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudHsmClustersClientRestoreResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudHsmClustersClientRestoreResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Restore - Restores all key materials of a specified Cloud HSM Cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-30-preview +func (client *CloudHsmClustersClient) restore(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, restoreRequestProperties RestoreRequestProperties, options *CloudHsmClustersClientBeginRestoreOptions) (*http.Response, error) { + var err error + const operationName = "CloudHsmClustersClient.BeginRestore" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.restoreCreateRequest(ctx, resourceGroupName, cloudHsmClusterName, restoreRequestProperties, 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 +} + +// restoreCreateRequest creates the Restore request. +func (client *CloudHsmClustersClient) restoreCreateRequest(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, restoreRequestProperties RestoreRequestProperties, options *CloudHsmClustersClientBeginRestoreOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/restore" + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-06-30-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, restoreRequestProperties); err != nil { + return nil, err + } + return req, 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 +// Generated from API version 2024-06-30-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. +// be between 3 and 23 characters in length. // - body - Parameters to create Cloud HSM Cluster // - options - CloudHsmClustersClientBeginUpdateOptions contains the optional parameters for the CloudHsmClustersClient.BeginUpdate // method. @@ -421,7 +587,7 @@ func (client *CloudHsmClustersClient) BeginUpdate(ctx context.Context, resourceG // 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 +// Generated from API version 2024-06-30-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" @@ -463,7 +629,7 @@ func (client *CloudHsmClustersClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-10-preview") + reqQP.Set("api-version", "2024-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -471,3 +637,173 @@ func (client *CloudHsmClustersClient) updateCreateRequest(ctx context.Context, r } return req, nil } + +// BeginValidateBackupProperties - Pre Backup operation to validate whether the customer can perform a backup on the Cloud +// HSM Cluster resource in the specified subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-30-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 23 characters in length. +// - options - CloudHsmClustersClientBeginValidateBackupPropertiesOptions contains the optional parameters for the CloudHsmClustersClient.BeginValidateBackupProperties +// method. +func (client *CloudHsmClustersClient) BeginValidateBackupProperties(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *CloudHsmClustersClientBeginValidateBackupPropertiesOptions) (*runtime.Poller[CloudHsmClustersClientValidateBackupPropertiesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.validateBackupProperties(ctx, resourceGroupName, cloudHsmClusterName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudHsmClustersClientValidateBackupPropertiesResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudHsmClustersClientValidateBackupPropertiesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ValidateBackupProperties - Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM +// Cluster resource in the specified subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-30-preview +func (client *CloudHsmClustersClient) validateBackupProperties(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *CloudHsmClustersClientBeginValidateBackupPropertiesOptions) (*http.Response, error) { + var err error + const operationName = "CloudHsmClustersClient.BeginValidateBackupProperties" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.validateBackupPropertiesCreateRequest(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) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// validateBackupPropertiesCreateRequest creates the ValidateBackupProperties request. +func (client *CloudHsmClustersClient) validateBackupPropertiesCreateRequest(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *CloudHsmClustersClientBeginValidateBackupPropertiesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/validateBackupProperties" + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-06-30-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.BackupRequestProperties != nil { + if err := runtime.MarshalAsJSON(req, *options.BackupRequestProperties); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// BeginValidateRestoreProperties - Queued validating pre restore operation +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-30-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 23 characters in length. +// - options - CloudHsmClustersClientBeginValidateRestorePropertiesOptions contains the optional parameters for the CloudHsmClustersClient.BeginValidateRestoreProperties +// method. +func (client *CloudHsmClustersClient) BeginValidateRestoreProperties(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *CloudHsmClustersClientBeginValidateRestorePropertiesOptions) (*runtime.Poller[CloudHsmClustersClientValidateRestorePropertiesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.validateRestoreProperties(ctx, resourceGroupName, cloudHsmClusterName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudHsmClustersClientValidateRestorePropertiesResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudHsmClustersClientValidateRestorePropertiesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ValidateRestoreProperties - Queued validating pre restore operation +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-30-preview +func (client *CloudHsmClustersClient) validateRestoreProperties(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *CloudHsmClustersClientBeginValidateRestorePropertiesOptions) (*http.Response, error) { + var err error + const operationName = "CloudHsmClustersClient.BeginValidateRestoreProperties" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.validateRestorePropertiesCreateRequest(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) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// validateRestorePropertiesCreateRequest creates the ValidateRestoreProperties request. +func (client *CloudHsmClustersClient) validateRestorePropertiesCreateRequest(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *CloudHsmClustersClientBeginValidateRestorePropertiesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/validateRestoreProperties" + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-06-30-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.RestoreRequestProperties != nil { + if err := runtime.MarshalAsJSON(req, *options.RestoreRequestProperties); err != nil { + return nil, err + } + return req, nil + } + 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 index ba6e6b2663..46dbb55c9b 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/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/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/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/CloudHsmCluster_CreateOrUpdate_MaximumSet_Gen.json func ExampleCloudHsmClustersClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -46,13 +46,7 @@ func ExampleCloudHsmClustersClient_BeginCreateOrUpdate() { 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), - }, + PublicNetworkAccess: to.Ptr(armhardwaresecuritymodules.PublicNetworkAccessDisabled), }, }, nil) if err != nil { @@ -96,24 +90,16 @@ func ExampleCloudHsmClustersClient_BeginCreateOrUpdate() { // 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"), - // }, + // ActivationState: to.Ptr(armhardwaresecuritymodules.ActivationState("null")), + // AutoGeneratedDomainNameLabelScope: to.Ptr(armhardwaresecuritymodules.AutoGeneratedDomainNameLabelScopeTenantReuse), // ProvisioningState: to.Ptr(armhardwaresecuritymodules.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Disabled"), - // SecurityDomain: &armhardwaresecuritymodules.CloudHsmClusterSecurityDomainProperties{ - // ActivationStatus: to.Ptr("null"), - // FipsState: to.Ptr[int32](2), - // }, + // PublicNetworkAccess: to.Ptr(armhardwaresecuritymodules.PublicNetworkAccessDisabled), // StatusMessage: to.Ptr("This is a status message"), // }, // } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/CloudHsmCluster_Update_MaximumSet_Gen.json func ExampleCloudHsmClustersClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -131,11 +117,6 @@ func ExampleCloudHsmClustersClient_BeginUpdate() { "/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"), @@ -184,24 +165,16 @@ func ExampleCloudHsmClustersClient_BeginUpdate() { // 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"), - // }, + // ActivationState: to.Ptr(armhardwaresecuritymodules.ActivationState("null")), + // AutoGeneratedDomainNameLabelScope: to.Ptr(armhardwaresecuritymodules.AutoGeneratedDomainNameLabelScopeTenantReuse), // ProvisioningState: to.Ptr(armhardwaresecuritymodules.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Disabled"), - // SecurityDomain: &armhardwaresecuritymodules.CloudHsmClusterSecurityDomainProperties{ - // ActivationStatus: to.Ptr("null"), - // FipsState: to.Ptr[int32](2), - // }, + // PublicNetworkAccess: to.Ptr(armhardwaresecuritymodules.PublicNetworkAccessDisabled), // StatusMessage: to.Ptr("This is a status message"), // }, // } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/CloudHsmCluster_Get_MaximumSet_Gen.json func ExampleCloudHsmClustersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -250,24 +223,16 @@ func ExampleCloudHsmClustersClient_Get() { // 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"), - // }, + // ActivationState: to.Ptr(armhardwaresecuritymodules.ActivationState("null")), + // AutoGeneratedDomainNameLabelScope: to.Ptr(armhardwaresecuritymodules.AutoGeneratedDomainNameLabelScopeTenantReuse), // ProvisioningState: to.Ptr(armhardwaresecuritymodules.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Disabled"), - // SecurityDomain: &armhardwaresecuritymodules.CloudHsmClusterSecurityDomainProperties{ - // ActivationStatus: to.Ptr("null"), - // FipsState: to.Ptr[int32](2), - // }, + // PublicNetworkAccess: to.Ptr(armhardwaresecuritymodules.PublicNetworkAccessDisabled), // StatusMessage: to.Ptr("This is a status message"), // }, // } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/CloudHsmCluster_Delete_MaximumSet_Gen.json func ExampleCloudHsmClustersClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -288,7 +253,7 @@ func ExampleCloudHsmClustersClient_BeginDelete() { } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/CloudHsmCluster_ListByResourceGroup_MaximumSet_Gen.json func ExampleCloudHsmClustersClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -343,18 +308,10 @@ func ExampleCloudHsmClustersClient_NewListByResourceGroupPager() { // 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"), - // }, + // ActivationState: to.Ptr(armhardwaresecuritymodules.ActivationState("null")), + // AutoGeneratedDomainNameLabelScope: to.Ptr(armhardwaresecuritymodules.AutoGeneratedDomainNameLabelScopeTenantReuse), // ProvisioningState: to.Ptr(armhardwaresecuritymodules.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Disabled"), - // SecurityDomain: &armhardwaresecuritymodules.CloudHsmClusterSecurityDomainProperties{ - // ActivationStatus: to.Ptr("null"), - // FipsState: to.Ptr[int32](2), - // }, + // PublicNetworkAccess: to.Ptr(armhardwaresecuritymodules.PublicNetworkAccessDisabled), // StatusMessage: to.Ptr("This is a status message"), // }, // }, @@ -389,25 +346,17 @@ func ExampleCloudHsmClustersClient_NewListByResourceGroupPager() { // 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"), - // }, + // ActivationState: to.Ptr(armhardwaresecuritymodules.ActivationState("null")), + // AutoGeneratedDomainNameLabelScope: to.Ptr(armhardwaresecuritymodules.AutoGeneratedDomainNameLabelScopeTenantReuse), // ProvisioningState: to.Ptr(armhardwaresecuritymodules.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Disabled"), - // SecurityDomain: &armhardwaresecuritymodules.CloudHsmClusterSecurityDomainProperties{ - // ActivationStatus: to.Ptr("null"), - // FipsState: to.Ptr[int32](2), - // }, + // PublicNetworkAccess: to.Ptr(armhardwaresecuritymodules.PublicNetworkAccessDisabled), // }, // }}, // } } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/CloudHsmCluster_ListBySubscription_MaximumSet_Gen.json func ExampleCloudHsmClustersClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -460,18 +409,10 @@ func ExampleCloudHsmClustersClient_NewListBySubscriptionPager() { // 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"), - // }, + // ActivationState: to.Ptr(armhardwaresecuritymodules.ActivationState("null")), + // AutoGeneratedDomainNameLabelScope: to.Ptr(armhardwaresecuritymodules.AutoGeneratedDomainNameLabelScopeTenantReuse), // ProvisioningState: to.Ptr(armhardwaresecuritymodules.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Disabled"), - // SecurityDomain: &armhardwaresecuritymodules.CloudHsmClusterSecurityDomainProperties{ - // ActivationStatus: to.Ptr("null"), - // FipsState: to.Ptr[int32](2), - // }, + // PublicNetworkAccess: to.Ptr(armhardwaresecuritymodules.PublicNetworkAccessDisabled), // StatusMessage: to.Ptr("This is a status message"), // }, // }, @@ -506,21 +447,84 @@ func ExampleCloudHsmClustersClient_NewListBySubscriptionPager() { // 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"), - // }, + // ActivationState: to.Ptr(armhardwaresecuritymodules.ActivationState("null")), + // AutoGeneratedDomainNameLabelScope: to.Ptr(armhardwaresecuritymodules.AutoGeneratedDomainNameLabelScopeTenantReuse), // ProvisioningState: to.Ptr(armhardwaresecuritymodules.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Disabled"), - // SecurityDomain: &armhardwaresecuritymodules.CloudHsmClusterSecurityDomainProperties{ - // ActivationStatus: to.Ptr("null"), - // FipsState: to.Ptr[int32](2), - // }, + // PublicNetworkAccess: to.Ptr(armhardwaresecuritymodules.PublicNetworkAccessDisabled), // StatusMessage: to.Ptr("This is a status message"), // }, // }}, // } } } + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/CloudHsmCluster_CreateOrValidate_Backup_MaximumSet_Gen.json +func ExampleCloudHsmClustersClient_BeginValidateBackupProperties() { + 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().BeginValidateBackupProperties(ctx, "rgcloudhsm", "chsm1", &armhardwaresecuritymodules.CloudHsmClustersClientBeginValidateBackupPropertiesOptions{BackupRequestProperties: 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.BackupResult = armhardwaresecuritymodules.BackupResult{ + // Properties: &armhardwaresecuritymodules.BackupResultProperties{ + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // JobID: to.Ptr("572a45927fc240e1ac075de27371680b"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // Status: to.Ptr(armhardwaresecuritymodules.BackupRestoreOperationStatusInProgress), + // StatusDetails: to.Ptr("Backup operation is in progress"), + // AzureStorageBlobContainerURI: to.Ptr("https://myaccount.blob.core.windows.net/sascontainer/sasContainer"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/CloudHsmCluster_RequestOrValidate_Restore_MaximumSet_Gen.json +func ExampleCloudHsmClustersClient_BeginValidateRestoreProperties() { + 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().BeginValidateRestoreProperties(ctx, "rgcloudhsm", "chsm1", &armhardwaresecuritymodules.CloudHsmClustersClientBeginValidateRestorePropertiesOptions{RestoreRequestProperties: &armhardwaresecuritymodules.RestoreRequestProperties{ + AzureStorageBlobContainerURI: to.Ptr("https://myaccount.blob.core.windows.net/sascontainer/sasContainer"), + BackupID: to.Ptr("backupId"), + }, + }) + 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.RestoreResult = armhardwaresecuritymodules.RestoreResult{ + // Properties: &armhardwaresecuritymodules.BackupRestoreBaseResultProperties{ + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // JobID: to.Ptr("572a45927fc240e1ac075de27371680b"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T12:00:00.000Z"); return t}()), + // Status: to.Ptr(armhardwaresecuritymodules.BackupRestoreOperationStatusInProgress), + // StatusDetails: to.Ptr("Restore operation is in progress"), + // }, + // } +} diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/constants.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/constants.go index 6e2057d98a..23c07e2a63 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/constants.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/constants.go @@ -10,9 +10,85 @@ package armhardwaresecuritymodules const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules" - moduleVersion = "v2.0.0-beta.1" + moduleVersion = "v2.0.0-beta.2" ) +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// ActivationState - State of security domain activation +type ActivationState string + +const ( + ActivationStateActive ActivationState = "Active" + ActivationStateFailed ActivationState = "Failed" + ActivationStateNotActivated ActivationState = "NotActivated" + ActivationStateNotDefined ActivationState = "NotDefined" + ActivationStateUnknown ActivationState = "Unknown" +) + +// PossibleActivationStateValues returns the possible values for the ActivationState const type. +func PossibleActivationStateValues() []ActivationState { + return []ActivationState{ + ActivationStateActive, + ActivationStateFailed, + ActivationStateNotActivated, + ActivationStateNotDefined, + ActivationStateUnknown, + } +} + +// AutoGeneratedDomainNameLabelScope - The Cloud HSM Cluster's auto-generated Domain Name Label Scope +type AutoGeneratedDomainNameLabelScope string + +const ( + AutoGeneratedDomainNameLabelScopeNoReuse AutoGeneratedDomainNameLabelScope = "NoReuse" + AutoGeneratedDomainNameLabelScopeResourceGroupReuse AutoGeneratedDomainNameLabelScope = "ResourceGroupReuse" + AutoGeneratedDomainNameLabelScopeSubscriptionReuse AutoGeneratedDomainNameLabelScope = "SubscriptionReuse" + AutoGeneratedDomainNameLabelScopeTenantReuse AutoGeneratedDomainNameLabelScope = "TenantReuse" +) + +// PossibleAutoGeneratedDomainNameLabelScopeValues returns the possible values for the AutoGeneratedDomainNameLabelScope const type. +func PossibleAutoGeneratedDomainNameLabelScopeValues() []AutoGeneratedDomainNameLabelScope { + return []AutoGeneratedDomainNameLabelScope{ + AutoGeneratedDomainNameLabelScopeNoReuse, + AutoGeneratedDomainNameLabelScopeResourceGroupReuse, + AutoGeneratedDomainNameLabelScopeSubscriptionReuse, + AutoGeneratedDomainNameLabelScopeTenantReuse, + } +} + +// BackupRestoreOperationStatus - Status of the backup/restore operation +type BackupRestoreOperationStatus string + +const ( + BackupRestoreOperationStatusCancelled BackupRestoreOperationStatus = "Cancelled" + BackupRestoreOperationStatusFailed BackupRestoreOperationStatus = "Failed" + BackupRestoreOperationStatusInProgress BackupRestoreOperationStatus = "InProgress" + BackupRestoreOperationStatusSucceeded BackupRestoreOperationStatus = "Succeeded" +) + +// PossibleBackupRestoreOperationStatusValues returns the possible values for the BackupRestoreOperationStatus const type. +func PossibleBackupRestoreOperationStatusValues() []BackupRestoreOperationStatus { + return []BackupRestoreOperationStatus{ + BackupRestoreOperationStatusCancelled, + BackupRestoreOperationStatusFailed, + BackupRestoreOperationStatusInProgress, + BackupRestoreOperationStatusSucceeded, + } +} + // CloudHsmClusterSKUFamily - Sku family of the Cloud HSM Cluster type CloudHsmClusterSKUFamily string @@ -99,7 +175,7 @@ const ( JSONWebKeyTypeFailed JSONWebKeyType = "Failed" // JSONWebKeyTypeProvisioning - The dedicated HSM is currently being provisioned. JSONWebKeyTypeProvisioning JSONWebKeyType = "Provisioning" - // JSONWebKeyTypeSucceeded - The dedicated HSM has been full provisioned. + // JSONWebKeyTypeSucceeded - The dedicated HSM has been fully provisioned. JSONWebKeyTypeSucceeded JSONWebKeyType = "Succeeded" ) @@ -136,6 +212,25 @@ func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { } } +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + OriginSystem Origin = "system" + OriginUser Origin = "user" + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + // PrivateEndpointConnectionProvisioningState - The current provisioning state. type PrivateEndpointConnectionProvisioningState string @@ -202,6 +297,20 @@ func PossibleProvisioningStateValues() []ProvisioningState { } } +// PublicNetworkAccess - The Cloud HSM Cluster public network access +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" +) + +// PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{ + PublicNetworkAccessDisabled, + } +} + // 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 ade7aa9a68..80c682b32f 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/dedicatedhsm_client.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/dedicatedhsm_client.go @@ -47,8 +47,8 @@ func NewDedicatedHsmClient(subscriptionID string, credential azcore.TokenCredent // BeginCreateOrUpdate - Create or Update a dedicated HSM in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-30 -// - resourceGroupName - The name of the Resource Group to which the resource belongs. +// Generated from API version 2024-06-30-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - name - Name of the dedicated Hsm // - parameters - Parameters to create or update the dedicated hsm // - options - DedicatedHsmClientBeginCreateOrUpdateOptions contains the optional parameters for the DedicatedHsmClient.BeginCreateOrUpdate @@ -73,7 +73,7 @@ func (client *DedicatedHsmClient) BeginCreateOrUpdate(ctx context.Context, resou // CreateOrUpdate - Create or Update a dedicated HSM in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-30 +// Generated from API version 2024-06-30-preview func (client *DedicatedHsmClient) createOrUpdate(ctx context.Context, resourceGroupName string, name string, parameters DedicatedHsm, options *DedicatedHsmClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "DedicatedHsmClient.BeginCreateOrUpdate" @@ -115,7 +115,7 @@ func (client *DedicatedHsmClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-30") + reqQP.Set("api-version", "2024-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -127,9 +127,9 @@ func (client *DedicatedHsmClient) createOrUpdateCreateRequest(ctx context.Contex // BeginDelete - Deletes the specified Azure Dedicated HSM. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-30 -// - resourceGroupName - The name of the Resource Group to which the dedicated HSM belongs. -// - name - The name of the dedicated HSM to delete +// Generated from API version 2024-06-30-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - name - Name of the dedicated Hsm // - options - DedicatedHsmClientBeginDeleteOptions contains the optional parameters for the DedicatedHsmClient.BeginDelete // method. func (client *DedicatedHsmClient) BeginDelete(ctx context.Context, resourceGroupName string, name string, options *DedicatedHsmClientBeginDeleteOptions) (*runtime.Poller[DedicatedHsmClientDeleteResponse], error) { @@ -152,7 +152,7 @@ func (client *DedicatedHsmClient) BeginDelete(ctx context.Context, resourceGroup // Delete - Deletes the specified Azure Dedicated HSM. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-30 +// Generated from API version 2024-06-30-preview func (client *DedicatedHsmClient) deleteOperation(ctx context.Context, resourceGroupName string, name string, options *DedicatedHsmClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "DedicatedHsmClient.BeginDelete" @@ -167,7 +167,7 @@ func (client *DedicatedHsmClient) deleteOperation(ctx context.Context, resourceG if err != nil { return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { err = runtime.NewResponseError(httpResp) return nil, err } @@ -194,7 +194,7 @@ func (client *DedicatedHsmClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-30") + reqQP.Set("api-version", "2024-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -203,9 +203,9 @@ func (client *DedicatedHsmClient) deleteCreateRequest(ctx context.Context, resou // Get - Gets the specified Azure dedicated HSM. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-30 -// - resourceGroupName - The name of the Resource Group to which the dedicated hsm belongs. -// - name - The name of the dedicated HSM. +// Generated from API version 2024-06-30-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - name - Name of the dedicated Hsm // - options - DedicatedHsmClientGetOptions contains the optional parameters for the DedicatedHsmClient.Get method. func (client *DedicatedHsmClient) Get(ctx context.Context, resourceGroupName string, name string, options *DedicatedHsmClientGetOptions) (DedicatedHsmClientGetResponse, error) { var err error @@ -249,7 +249,7 @@ func (client *DedicatedHsmClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-30") + reqQP.Set("api-version", "2024-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,8 +267,8 @@ func (client *DedicatedHsmClient) getHandleResponse(resp *http.Response) (Dedica // NewListByResourceGroupPager - The List operation gets information about the dedicated hsms associated with the subscription // and within the specified resource group. // -// Generated from API version 2021-11-30 -// - resourceGroupName - The name of the Resource Group to which the dedicated HSM belongs. +// Generated from API version 2024-06-30-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - DedicatedHsmClientListByResourceGroupOptions contains the optional parameters for the DedicatedHsmClient.NewListByResourceGroupPager // method. func (client *DedicatedHsmClient) NewListByResourceGroupPager(resourceGroupName string, options *DedicatedHsmClientListByResourceGroupOptions) *runtime.Pager[DedicatedHsmClientListByResourceGroupResponse] { @@ -313,7 +313,7 @@ func (client *DedicatedHsmClient) listByResourceGroupCreateRequest(ctx context.C if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2021-11-30") + reqQP.Set("api-version", "2024-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,7 +330,7 @@ func (client *DedicatedHsmClient) listByResourceGroupHandleResponse(resp *http.R // NewListBySubscriptionPager - The List operation gets information about the dedicated HSMs associated with the subscription. // -// Generated from API version 2021-11-30 +// Generated from API version 2024-06-30-preview // - options - DedicatedHsmClientListBySubscriptionOptions contains the optional parameters for the DedicatedHsmClient.NewListBySubscriptionPager // method. func (client *DedicatedHsmClient) NewListBySubscriptionPager(options *DedicatedHsmClientListBySubscriptionOptions) *runtime.Pager[DedicatedHsmClientListBySubscriptionResponse] { @@ -371,7 +371,7 @@ func (client *DedicatedHsmClient) listBySubscriptionCreateRequest(ctx context.Co if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2021-11-30") + reqQP.Set("api-version", "2024-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -389,9 +389,9 @@ func (client *DedicatedHsmClient) listBySubscriptionHandleResponse(resp *http.Re // NewListOutboundNetworkDependenciesEndpointsPager - Gets a list of egress endpoints (network endpoints of all outbound dependencies) // in the specified dedicated hsm resource. The operation returns properties of each egress endpoint. // -// Generated from API version 2021-11-30 -// - resourceGroupName - The name of the Resource Group to which the dedicated hsm belongs. -// - name - The name of the dedicated HSM. +// Generated from API version 2024-06-30-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - name - Name of the dedicated Hsm // - options - DedicatedHsmClientListOutboundNetworkDependenciesEndpointsOptions contains the optional parameters for the DedicatedHsmClient.NewListOutboundNetworkDependenciesEndpointsPager // method. func (client *DedicatedHsmClient) NewListOutboundNetworkDependenciesEndpointsPager(resourceGroupName string, name string, options *DedicatedHsmClientListOutboundNetworkDependenciesEndpointsOptions) *runtime.Pager[DedicatedHsmClientListOutboundNetworkDependenciesEndpointsResponse] { @@ -437,7 +437,7 @@ func (client *DedicatedHsmClient) listOutboundNetworkDependenciesEndpointsCreate return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-30") + reqQP.Set("api-version", "2024-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -455,9 +455,9 @@ func (client *DedicatedHsmClient) listOutboundNetworkDependenciesEndpointsHandle // BeginUpdate - Update a dedicated HSM in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-30 -// - resourceGroupName - The name of the Resource Group to which the server belongs. -// - name - Name of the dedicated HSM +// Generated from API version 2024-06-30-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - name - Name of the dedicated Hsm // - parameters - Parameters to patch the dedicated HSM // - options - DedicatedHsmClientBeginUpdateOptions contains the optional parameters for the DedicatedHsmClient.BeginUpdate // method. @@ -481,7 +481,7 @@ func (client *DedicatedHsmClient) BeginUpdate(ctx context.Context, resourceGroup // Update - Update a dedicated HSM in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-30 +// Generated from API version 2024-06-30-preview func (client *DedicatedHsmClient) update(ctx context.Context, resourceGroupName string, name string, parameters DedicatedHsmPatchParameters, options *DedicatedHsmClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "DedicatedHsmClient.BeginUpdate" @@ -496,7 +496,7 @@ func (client *DedicatedHsmClient) update(ctx context.Context, resourceGroupName if err != nil { return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { err = runtime.NewResponseError(httpResp) return nil, err } @@ -523,7 +523,7 @@ func (client *DedicatedHsmClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-30") + reqQP.Set("api-version", "2024-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); 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 cc0cf33d76..6ccd7cce1f 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/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/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/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/DedicatedHsm_CreateOrUpdate.json func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingDedicatedHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -31,9 +31,6 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingD } poller, err := clientFactory.NewDedicatedHsmClient().BeginCreateOrUpdate(ctx, "hsm-group", "hsm1", armhardwaresecuritymodules.DedicatedHsm{ Location: to.Ptr("westus"), - SKU: &armhardwaresecuritymodules.SKU{ - Name: to.Ptr(armhardwaresecuritymodules.SKUNameSafeNetLunaNetworkHSMA790), - }, Tags: map[string]*string{ "Dept": to.Ptr("hsm"), "Environment": to.Ptr("dogfood"), @@ -45,11 +42,14 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingD PrivateIPAddress: to.Ptr("1.0.0.1"), }}, Subnet: &armhardwaresecuritymodules.APIEntityReference{ - ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), }, }, StampID: to.Ptr("stamp01"), }, + SKU: &armhardwaresecuritymodules.SKU{ + Name: to.Ptr(armhardwaresecuritymodules.SKUNameSafeNetLunaNetworkHSMA790), + }, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -66,9 +66,6 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingD // Type: to.Ptr("Microsoft.HardwareSecurityModules/dedicatedHSMs"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm1"), // Location: to.Ptr("westus"), - // SKU: &armhardwaresecuritymodules.SKU{ - // Name: to.Ptr(armhardwaresecuritymodules.SKUNameSafeNetLunaNetworkHSMA790), - // }, // Tags: map[string]*string{ // "Dept": to.Ptr("hsm"), // "Environment": to.Ptr("dogfood"), @@ -77,21 +74,24 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingD // NetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm_vnic"), // PrivateIPAddress: to.Ptr("1.0.0.1"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm_vnic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // ProvisioningState: to.Ptr(armhardwaresecuritymodules.JSONWebKeyTypeSucceeded), // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, + // SKU: &armhardwaresecuritymodules.SKU{ + // Name: to.Ptr(armhardwaresecuritymodules.SKUNameSafeNetLunaNetworkHSMA790), + // }, // } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/PaymentHsm_CreateOrUpdate.json func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingPaymentHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -104,9 +104,6 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingP } poller, err := clientFactory.NewDedicatedHsmClient().BeginCreateOrUpdate(ctx, "hsm-group", "hsm1", armhardwaresecuritymodules.DedicatedHsm{ Location: to.Ptr("westus"), - SKU: &armhardwaresecuritymodules.SKU{ - Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), - }, Tags: map[string]*string{ "Dept": to.Ptr("hsm"), "Environment": to.Ptr("dogfood"), @@ -118,11 +115,14 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingP PrivateIPAddress: to.Ptr("1.0.0.1"), }}, Subnet: &armhardwaresecuritymodules.APIEntityReference{ - ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), }, }, StampID: to.Ptr("stamp01"), }, + SKU: &armhardwaresecuritymodules.SKU{ + Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), + }, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -138,10 +138,15 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingP // Name: to.Ptr("hsm1"), // Type: to.Ptr("Microsoft.HardwareSecurityModules/dedicatedHSMs"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm1"), - // Location: to.Ptr("westus"), - // SKU: &armhardwaresecuritymodules.SKU{ - // Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), + // 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), // }, + // Location: to.Ptr("westus"), // Tags: map[string]*string{ // "Dept": to.Ptr("hsm"), // "Environment": to.Ptr("dogfood"), @@ -150,39 +155,34 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingP // ManagementNetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMMgmtNic"), // PrivateIPAddress: to.Ptr("1.0.0.2"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMMgmtNic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // NetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMHost1Nic"), // PrivateIPAddress: to.Ptr("1.0.0.1"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMHost1Nic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // ProvisioningState: to.Ptr(armhardwaresecuritymodules.JSONWebKeyTypeSucceeded), // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // 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), - // 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.IdentityTypeUser), + // SKU: &armhardwaresecuritymodules.SKU{ + // Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), // }, // } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/PaymentHsm_CreateOrUpdate_WithManagementProfile.json func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingPaymentHsmWithManagementProfile() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -195,9 +195,6 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingP } poller, err := clientFactory.NewDedicatedHsmClient().BeginCreateOrUpdate(ctx, "hsm-group", "hsm1", armhardwaresecuritymodules.DedicatedHsm{ Location: to.Ptr("westus"), - SKU: &armhardwaresecuritymodules.SKU{ - Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), - }, Tags: map[string]*string{ "Dept": to.Ptr("hsm"), "Environment": to.Ptr("dogfood"), @@ -209,7 +206,7 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingP PrivateIPAddress: to.Ptr("1.0.0.2"), }}, Subnet: &armhardwaresecuritymodules.APIEntityReference{ - ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), }, }, NetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ @@ -218,11 +215,14 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingP PrivateIPAddress: to.Ptr("1.0.0.1"), }}, Subnet: &armhardwaresecuritymodules.APIEntityReference{ - ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), }, }, StampID: to.Ptr("stamp01"), }, + SKU: &armhardwaresecuritymodules.SKU{ + Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), + }, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -238,10 +238,15 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingP // Name: to.Ptr("hsm1"), // Type: to.Ptr("Microsoft.HardwareSecurityModules/dedicatedHSMs"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm1"), - // Location: to.Ptr("westus"), - // SKU: &armhardwaresecuritymodules.SKU{ - // Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), + // 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), // }, + // Location: to.Ptr("westus"), // Tags: map[string]*string{ // "Dept": to.Ptr("hsm"), // "Environment": to.Ptr("dogfood"), @@ -250,39 +255,34 @@ func ExampleDedicatedHsmClient_BeginCreateOrUpdate_createANewOrUpdateAnExistingP // ManagementNetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMMgmtNic"), // PrivateIPAddress: to.Ptr("1.0.0.2"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMMgmtNic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // NetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMHost1Nic"), // PrivateIPAddress: to.Ptr("1.0.0.1"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMHost1Nic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // ProvisioningState: to.Ptr(armhardwaresecuritymodules.JSONWebKeyTypeSucceeded), // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // 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), - // 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.IdentityTypeUser), + // SKU: &armhardwaresecuritymodules.SKU{ + // Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), // }, // } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/DedicatedHsm_Update.json func ExampleDedicatedHsmClient_BeginUpdate_updateAnExistingDedicatedHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -315,9 +315,6 @@ func ExampleDedicatedHsmClient_BeginUpdate_updateAnExistingDedicatedHsm() { // Type: to.Ptr("Microsoft.HardwareSecurityModules/dedicatedHSMs"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm1"), // Location: to.Ptr("westus"), - // SKU: &armhardwaresecuritymodules.SKU{ - // Name: to.Ptr(armhardwaresecuritymodules.SKUNameSafeNetLunaNetworkHSMA790), - // }, // Tags: map[string]*string{ // "Dept": to.Ptr("hsm"), // "Environment": to.Ptr("dogfood"), @@ -327,21 +324,24 @@ func ExampleDedicatedHsmClient_BeginUpdate_updateAnExistingDedicatedHsm() { // NetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm_vnic"), // PrivateIPAddress: to.Ptr("1.0.0.1"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm_vnic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // ProvisioningState: to.Ptr(armhardwaresecuritymodules.JSONWebKeyTypeSucceeded), // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, + // SKU: &armhardwaresecuritymodules.SKU{ + // Name: to.Ptr(armhardwaresecuritymodules.SKUNameSafeNetLunaNetworkHSMA790), + // }, // } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/PaymentHsm_Update.json func ExampleDedicatedHsmClient_BeginUpdate_updateAnExistingPaymentHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -373,10 +373,15 @@ func ExampleDedicatedHsmClient_BeginUpdate_updateAnExistingPaymentHsm() { // Name: to.Ptr("hsm1"), // Type: to.Ptr("Microsoft.HardwareSecurityModules/dedicatedHSMs"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm1"), - // Location: to.Ptr("westus"), - // SKU: &armhardwaresecuritymodules.SKU{ - // Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), + // 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), // }, + // Location: to.Ptr("westus"), // Tags: map[string]*string{ // "Dept": to.Ptr("hsm"), // "Environment": to.Ptr("dogfood"), @@ -386,39 +391,34 @@ func ExampleDedicatedHsmClient_BeginUpdate_updateAnExistingPaymentHsm() { // ManagementNetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMMgmtNic"), // PrivateIPAddress: to.Ptr("1.0.0.2"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMMgmtNic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // NetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMHost1Nic"), // PrivateIPAddress: to.Ptr("1.0.0.1"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMHost1Nic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // ProvisioningState: to.Ptr(armhardwaresecuritymodules.JSONWebKeyTypeSucceeded), // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // 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), - // 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.IdentityTypeUser), + // SKU: &armhardwaresecuritymodules.SKU{ + // Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), // }, // } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/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/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/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/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/DedicatedHsm_Get.json func ExampleDedicatedHsmClient_Get_getADedicatedHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -462,9 +462,6 @@ func ExampleDedicatedHsmClient_Get_getADedicatedHsm() { // Type: to.Ptr("Microsoft.HardwareSecurityModules/dedicatedHSMs"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm1"), // Location: to.Ptr("westus"), - // SKU: &armhardwaresecuritymodules.SKU{ - // Name: to.Ptr(armhardwaresecuritymodules.SKUNameSafeNetLunaNetworkHSMA790), - // }, // Tags: map[string]*string{ // "Dept": to.Ptr("hsm"), // "Environment": to.Ptr("dogfood"), @@ -474,21 +471,24 @@ func ExampleDedicatedHsmClient_Get_getADedicatedHsm() { // NetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm_vnic"), // PrivateIPAddress: to.Ptr("1.0.0.1"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm_vnic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // ProvisioningState: to.Ptr(armhardwaresecuritymodules.JSONWebKeyTypeSucceeded), // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, + // SKU: &armhardwaresecuritymodules.SKU{ + // Name: to.Ptr(armhardwaresecuritymodules.SKUNameSafeNetLunaNetworkHSMA790), + // }, // } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/PaymentHsm_Get.json func ExampleDedicatedHsmClient_Get_getAPaymentHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -510,10 +510,15 @@ func ExampleDedicatedHsmClient_Get_getAPaymentHsm() { // Name: to.Ptr("hsm1"), // Type: to.Ptr("Microsoft.HardwareSecurityModules/dedicatedHSMs"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm1"), - // Location: to.Ptr("westus"), - // SKU: &armhardwaresecuritymodules.SKU{ - // Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), + // 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), // }, + // Location: to.Ptr("westus"), // Tags: map[string]*string{ // "Dept": to.Ptr("hsm"), // "Environment": to.Ptr("dogfood"), @@ -523,39 +528,34 @@ func ExampleDedicatedHsmClient_Get_getAPaymentHsm() { // ManagementNetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMMgmtNic"), // PrivateIPAddress: to.Ptr("1.0.0.2"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMMgmtNic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // NetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMHost1Nic"), // PrivateIPAddress: to.Ptr("1.0.0.1"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMHost1Nic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // ProvisioningState: to.Ptr(armhardwaresecuritymodules.JSONWebKeyTypeSucceeded), // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // 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), - // 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.IdentityTypeUser), + // SKU: &armhardwaresecuritymodules.SKU{ + // Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), // }, // } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/PaymentHsm_Get_With_2018-10-31Preview_Version.json func ExampleDedicatedHsmClient_Get_getAPaymentHsmWith20181031PreviewApiVersion() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -578,9 +578,6 @@ func ExampleDedicatedHsmClient_Get_getAPaymentHsmWith20181031PreviewApiVersion() // Type: to.Ptr("Microsoft.HardwareSecurityModules/dedicatedHSMs"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm1"), // Location: to.Ptr("westus"), - // SKU: &armhardwaresecuritymodules.SKU{ - // Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), - // }, // Tags: map[string]*string{ // "Dept": to.Ptr("hsm"), // "Environment": to.Ptr("dogfood"), @@ -590,21 +587,24 @@ func ExampleDedicatedHsmClient_Get_getAPaymentHsmWith20181031PreviewApiVersion() // NetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMHost1Nic"), // PrivateIPAddress: to.Ptr("1.0.0.1"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMHost1Nic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // ProvisioningState: to.Ptr(armhardwaresecuritymodules.JSONWebKeyTypeSucceeded), // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, + // SKU: &armhardwaresecuritymodules.SKU{ + // Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), + // }, // } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/DedicatedHsm_ListByResourceGroup.json func ExampleDedicatedHsmClient_NewListByResourceGroupPager_listDedicatedHsmDevicesInAResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -633,9 +633,6 @@ func ExampleDedicatedHsmClient_NewListByResourceGroupPager_listDedicatedHsmDevic // Type: to.Ptr("Microsoft.HardwareSecurityModules/dedicatedHSMs"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm1"), // Location: to.Ptr("westus"), - // SKU: &armhardwaresecuritymodules.SKU{ - // Name: to.Ptr(armhardwaresecuritymodules.SKUNameSafeNetLunaNetworkHSMA790), - // }, // Tags: map[string]*string{ // "Dept": to.Ptr("hsm"), // "Environment": to.Ptr("dogfood"), @@ -645,26 +642,26 @@ func ExampleDedicatedHsmClient_NewListByResourceGroupPager_listDedicatedHsmDevic // NetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm_vnic"), // PrivateIPAddress: to.Ptr("1.0.0.1"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm_vnic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // ProvisioningState: to.Ptr(armhardwaresecuritymodules.JSONWebKeyTypeSucceeded), // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, + // SKU: &armhardwaresecuritymodules.SKU{ + // Name: to.Ptr(armhardwaresecuritymodules.SKUNameSafeNetLunaNetworkHSMA790), + // }, // }, // { // Name: to.Ptr("hsm1"), // Type: to.Ptr("Microsoft.HardwareSecurityModules/dedicatedHSMs"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm2"), // Location: to.Ptr("westus"), - // SKU: &armhardwaresecuritymodules.SKU{ - // Name: to.Ptr(armhardwaresecuritymodules.SKUNameSafeNetLunaNetworkHSMA790), - // }, // Tags: map[string]*string{ // "Dept": to.Ptr("hsm"), // "Environment": to.Ptr("dogfood"), @@ -674,23 +671,26 @@ func ExampleDedicatedHsmClient_NewListByResourceGroupPager_listDedicatedHsmDevic // NetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm_vnic"), // PrivateIPAddress: to.Ptr("1.0.0.2"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm_vnic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // ProvisioningState: to.Ptr(armhardwaresecuritymodules.JSONWebKeyTypeSucceeded), // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, + // SKU: &armhardwaresecuritymodules.SKU{ + // Name: to.Ptr(armhardwaresecuritymodules.SKUNameSafeNetLunaNetworkHSMA790), + // }, // }}, // } } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/PaymentHsm_ListByResourceGroup.json func ExampleDedicatedHsmClient_NewListByResourceGroupPager_listDedicatedHsmDevicesInAResourceGroupIncludingPaymentHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -718,10 +718,15 @@ func ExampleDedicatedHsmClient_NewListByResourceGroupPager_listDedicatedHsmDevic // Name: to.Ptr("hsm1"), // Type: to.Ptr("Microsoft.HardwareSecurityModules/dedicatedHSMs"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm1"), - // Location: to.Ptr("westus"), - // SKU: &armhardwaresecuritymodules.SKU{ - // Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), + // 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), // }, + // Location: to.Ptr("westus"), // Tags: map[string]*string{ // "Dept": to.Ptr("hsm"), // "Environment": to.Ptr("dogfood"), @@ -731,44 +736,44 @@ func ExampleDedicatedHsmClient_NewListByResourceGroupPager_listDedicatedHsmDevic // ManagementNetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMMgmtNic"), // PrivateIPAddress: to.Ptr("1.0.0.2"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMMgmtNic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // NetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMHost1Nic"), // PrivateIPAddress: to.Ptr("1.0.0.1"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMHost1Nic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // ProvisioningState: to.Ptr(armhardwaresecuritymodules.JSONWebKeyTypeSucceeded), // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // 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), - // 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.IdentityTypeUser), + // SKU: &armhardwaresecuritymodules.SKU{ + // Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), // }, // }, // { // Name: to.Ptr("hsm2"), // Type: to.Ptr("Microsoft.HardwareSecurityModules/dedicatedHSMs"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm2"), - // Location: to.Ptr("westus"), - // SKU: &armhardwaresecuritymodules.SKU{ - // Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), + // 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), // }, + // Location: to.Ptr("westus"), // Tags: map[string]*string{ // "Dept": to.Ptr("hsm"), // "Environment": to.Ptr("dogfood"), @@ -778,41 +783,36 @@ func ExampleDedicatedHsmClient_NewListByResourceGroupPager_listDedicatedHsmDevic // ManagementNetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm2_HSMMgmtNic"), // PrivateIPAddress: to.Ptr("1.0.0.4"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm2_HSMMgmtNic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // NetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm2_HSMHost1Nic"), // PrivateIPAddress: to.Ptr("1.0.0.3"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm2_HSMHost1Nic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // ProvisioningState: to.Ptr(armhardwaresecuritymodules.JSONWebKeyTypeSucceeded), // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // 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), - // 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.IdentityTypeUser), + // SKU: &armhardwaresecuritymodules.SKU{ + // Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), // }, // }}, // } } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/DedicatedHsm_ListBySubscription.json func ExampleDedicatedHsmClient_NewListBySubscriptionPager_listDedicatedHsmDevicesInASubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -841,9 +841,6 @@ func ExampleDedicatedHsmClient_NewListBySubscriptionPager_listDedicatedHsmDevice // Type: to.Ptr("Microsoft.HardwareSecurityModules/dedicatedHSMs"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm1"), // Location: to.Ptr("westus"), - // SKU: &armhardwaresecuritymodules.SKU{ - // Name: to.Ptr(armhardwaresecuritymodules.SKUNameSafeNetLunaNetworkHSMA790), - // }, // Tags: map[string]*string{ // "Dept": to.Ptr("hsm"), // "Environment": to.Ptr("dogfood"), @@ -853,26 +850,26 @@ func ExampleDedicatedHsmClient_NewListBySubscriptionPager_listDedicatedHsmDevice // NetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm_vnic"), // PrivateIPAddress: to.Ptr("1.0.0.1"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm_vnic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // ProvisioningState: to.Ptr(armhardwaresecuritymodules.JSONWebKeyTypeSucceeded), // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, + // SKU: &armhardwaresecuritymodules.SKU{ + // Name: to.Ptr(armhardwaresecuritymodules.SKUNameSafeNetLunaNetworkHSMA790), + // }, // }, // { // Name: to.Ptr("hsm1"), // Type: to.Ptr("Microsoft.HardwareSecurityModules/dedicatedHSMs"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm2"), // Location: to.Ptr("westus"), - // SKU: &armhardwaresecuritymodules.SKU{ - // Name: to.Ptr(armhardwaresecuritymodules.SKUNameSafeNetLunaNetworkHSMA790), - // }, // Tags: map[string]*string{ // "Dept": to.Ptr("hsm"), // "Environment": to.Ptr("dogfood"), @@ -882,23 +879,26 @@ func ExampleDedicatedHsmClient_NewListBySubscriptionPager_listDedicatedHsmDevice // NetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm_vnic"), // PrivateIPAddress: to.Ptr("1.0.0.2"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm_vnic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // ProvisioningState: to.Ptr(armhardwaresecuritymodules.JSONWebKeyTypeSucceeded), // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, + // SKU: &armhardwaresecuritymodules.SKU{ + // Name: to.Ptr(armhardwaresecuritymodules.SKUNameSafeNetLunaNetworkHSMA790), + // }, // }}, // } } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/PaymentHsm_ListBySubscription.json func ExampleDedicatedHsmClient_NewListBySubscriptionPager_listDedicatedHsmDevicesInASubscriptionIncludingPaymentHsm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -926,10 +926,15 @@ func ExampleDedicatedHsmClient_NewListBySubscriptionPager_listDedicatedHsmDevice // Name: to.Ptr("hsm1"), // Type: to.Ptr("Microsoft.HardwareSecurityModules/dedicatedHSMs"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm1"), - // Location: to.Ptr("westus"), - // SKU: &armhardwaresecuritymodules.SKU{ - // Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), + // 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), // }, + // Location: to.Ptr("westus"), // Tags: map[string]*string{ // "Dept": to.Ptr("hsm1"), // "Environment": to.Ptr("dogfood"), @@ -939,44 +944,44 @@ func ExampleDedicatedHsmClient_NewListBySubscriptionPager_listDedicatedHsmDevice // ManagementNetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMMgmtNic"), // PrivateIPAddress: to.Ptr("1.0.0.2"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMMgmtNic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // NetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMHost1Nic"), // PrivateIPAddress: to.Ptr("1.0.0.1"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm1_HSMHost1Nic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // ProvisioningState: to.Ptr(armhardwaresecuritymodules.JSONWebKeyTypeSucceeded), // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // 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), - // 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.IdentityTypeUser), + // SKU: &armhardwaresecuritymodules.SKU{ + // Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), // }, // }, // { // Name: to.Ptr("hsm2"), // Type: to.Ptr("Microsoft.HardwareSecurityModules/dedicatedHSMs"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm2"), - // Location: to.Ptr("westus"), - // SKU: &armhardwaresecuritymodules.SKU{ - // Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), + // 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), // }, + // Location: to.Ptr("westus"), // Tags: map[string]*string{ // "Dept": to.Ptr("hsm"), // "Environment": to.Ptr("dogfood"), @@ -986,41 +991,36 @@ func ExampleDedicatedHsmClient_NewListBySubscriptionPager_listDedicatedHsmDevice // ManagementNetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm2_HSMMgmtNic"), // PrivateIPAddress: to.Ptr("1.0.0.4"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm2_HSMMgmtNic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // NetworkProfile: &armhardwaresecuritymodules.NetworkProfile{ // NetworkInterfaces: []*armhardwaresecuritymodules.NetworkInterface{ // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm2_HSMHost1Nic"), // PrivateIPAddress: to.Ptr("1.0.0.3"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/networkInterfaces/hsm2_HSMHost1Nic"), // }}, // Subnet: &armhardwaresecuritymodules.APIEntityReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), + // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01"), // }, // }, // ProvisioningState: to.Ptr(armhardwaresecuritymodules.JSONWebKeyTypeSucceeded), // StampID: to.Ptr("stamp01"), // StatusMessage: to.Ptr("DedicatedHsm device is functional."), // }, - // 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), - // 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.IdentityTypeUser), + // SKU: &armhardwaresecuritymodules.SKU{ + // Name: to.Ptr(armhardwaresecuritymodules.SKUNamePayShield10KLMK1CPS60), // }, // }}, // } } } -// 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 +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/GetOutboundNetworkDependenciesEndpointsList.json func ExampleDedicatedHsmClient_NewListOutboundNetworkDependenciesEndpointsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterbackupstatus_server.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterbackupstatus_server.go new file mode 100644 index 0000000000..4806857cce --- /dev/null +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterbackupstatus_server.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 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" +) + +// CloudHsmClusterBackupStatusServer is a fake server for instances of the armhardwaresecuritymodules.CloudHsmClusterBackupStatusClient type. +type CloudHsmClusterBackupStatusServer struct { + // Get is the fake for method CloudHsmClusterBackupStatusClient.Get + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + Get func(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, jobID string, options *armhardwaresecuritymodules.CloudHsmClusterBackupStatusClientGetOptions) (resp azfake.Responder[armhardwaresecuritymodules.CloudHsmClusterBackupStatusClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewCloudHsmClusterBackupStatusServerTransport creates a new instance of CloudHsmClusterBackupStatusServerTransport with the provided implementation. +// The returned CloudHsmClusterBackupStatusServerTransport instance is connected to an instance of armhardwaresecuritymodules.CloudHsmClusterBackupStatusClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCloudHsmClusterBackupStatusServerTransport(srv *CloudHsmClusterBackupStatusServer) *CloudHsmClusterBackupStatusServerTransport { + return &CloudHsmClusterBackupStatusServerTransport{srv: srv} +} + +// CloudHsmClusterBackupStatusServerTransport connects instances of armhardwaresecuritymodules.CloudHsmClusterBackupStatusClient to instances of CloudHsmClusterBackupStatusServer. +// Don't use this type directly, use NewCloudHsmClusterBackupStatusServerTransport instead. +type CloudHsmClusterBackupStatusServerTransport struct { + srv *CloudHsmClusterBackupStatusServer +} + +// Do implements the policy.Transporter interface for CloudHsmClusterBackupStatusServerTransport. +func (c *CloudHsmClusterBackupStatusServerTransport) 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 "CloudHsmClusterBackupStatusClient.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 *CloudHsmClusterBackupStatusServerTransport) 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~%@]+)/backupOperationStatus/(?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 + } + jobIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobId")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, cloudHsmClusterNameParam, jobIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusAccepted}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BackupResult, req) + if err != nil { + return nil, err + } + if val := server.GetResponse(respr).Location; val != nil { + resp.Header.Set("Location", *val) + } + if val := server.GetResponse(respr).XMSRequestID; val != nil { + resp.Header.Set("x-ms-request-id", *val) + } + return resp, nil +} diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterprivateendpointconnections_server.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterprivateendpointconnections_server.go index 4702b791d7..ca8117d099 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterprivateendpointconnections_server.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterprivateendpointconnections_server.go @@ -28,7 +28,7 @@ type CloudHsmClusterPrivateEndpointConnectionsServer struct { 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 + // HTTP status codes to indicate success: 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 @@ -160,9 +160,9 @@ func (c *CloudHsmClusterPrivateEndpointConnectionsServerTransport) dispatchBegin return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{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)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { c.beginDelete.remove(req) diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterprivatelinkresources_server.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterprivatelinkresources_server.go index ee4e08dab4..f263eef3fc 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterprivatelinkresources_server.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterprivatelinkresources_server.go @@ -9,12 +9,12 @@ 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" @@ -23,22 +23,26 @@ import ( // CloudHsmClusterPrivateLinkResourcesServer is a fake server for instances of the armhardwaresecuritymodules.CloudHsmClusterPrivateLinkResourcesClient type. type CloudHsmClusterPrivateLinkResourcesServer struct { - // ListByCloudHsmCluster is the fake for method CloudHsmClusterPrivateLinkResourcesClient.ListByCloudHsmCluster + // NewListByCloudHsmClusterPager is the fake for method CloudHsmClusterPrivateLinkResourcesClient.NewListByCloudHsmClusterPager // 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) + NewListByCloudHsmClusterPager func(resourceGroupName string, cloudHsmClusterName string, options *armhardwaresecuritymodules.CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterOptions) (resp azfake.PagerResponder[armhardwaresecuritymodules.CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse]) } // 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} + return &CloudHsmClusterPrivateLinkResourcesServerTransport{ + srv: srv, + newListByCloudHsmClusterPager: newTracker[azfake.PagerResponder[armhardwaresecuritymodules.CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse]](), + } } // CloudHsmClusterPrivateLinkResourcesServerTransport connects instances of armhardwaresecuritymodules.CloudHsmClusterPrivateLinkResourcesClient to instances of CloudHsmClusterPrivateLinkResourcesServer. // Don't use this type directly, use NewCloudHsmClusterPrivateLinkResourcesServerTransport instead. type CloudHsmClusterPrivateLinkResourcesServerTransport struct { - srv *CloudHsmClusterPrivateLinkResourcesServer + srv *CloudHsmClusterPrivateLinkResourcesServer + newListByCloudHsmClusterPager *tracker[azfake.PagerResponder[armhardwaresecuritymodules.CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse]] } // Do implements the policy.Transporter interface for CloudHsmClusterPrivateLinkResourcesServerTransport. @@ -53,8 +57,8 @@ func (c *CloudHsmClusterPrivateLinkResourcesServerTransport) Do(req *http.Reques var err error switch method { - case "CloudHsmClusterPrivateLinkResourcesClient.ListByCloudHsmCluster": - resp, err = c.dispatchListByCloudHsmCluster(req) + case "CloudHsmClusterPrivateLinkResourcesClient.NewListByCloudHsmClusterPager": + resp, err = c.dispatchNewListByCloudHsmClusterPager(req) default: err = fmt.Errorf("unhandled API %s", method) } @@ -66,35 +70,43 @@ func (c *CloudHsmClusterPrivateLinkResourcesServerTransport) Do(req *http.Reques 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")} +func (c *CloudHsmClusterPrivateLinkResourcesServerTransport) dispatchNewListByCloudHsmClusterPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByCloudHsmClusterPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByCloudHsmClusterPager 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) + newListByCloudHsmClusterPager := c.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~%@]+)/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 + } + resp := c.srv.NewListByCloudHsmClusterPager(resourceGroupNameParam, cloudHsmClusterNameParam, nil) + newListByCloudHsmClusterPager = &resp + c.newListByCloudHsmClusterPager.add(req, newListByCloudHsmClusterPager) + server.PagerResponderInjectNextLinks(newListByCloudHsmClusterPager, req, func(page *armhardwaresecuritymodules.CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + resp, err := server.PagerResponderNext(newListByCloudHsmClusterPager, req) if err != nil { return nil, err } - cloudHsmClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudHsmClusterName")]) - if err != nil { - return nil, err + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListByCloudHsmClusterPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } - 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 + if !server.PagerResponderMore(newListByCloudHsmClusterPager) { + c.newListByCloudHsmClusterPager.remove(req) } return resp, nil } diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterrestorestatus_server.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterrestorestatus_server.go new file mode 100644 index 0000000000..f06171b5c7 --- /dev/null +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusterrestorestatus_server.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 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" +) + +// CloudHsmClusterRestoreStatusServer is a fake server for instances of the armhardwaresecuritymodules.CloudHsmClusterRestoreStatusClient type. +type CloudHsmClusterRestoreStatusServer struct { + // Get is the fake for method CloudHsmClusterRestoreStatusClient.Get + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + Get func(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, jobID string, options *armhardwaresecuritymodules.CloudHsmClusterRestoreStatusClientGetOptions) (resp azfake.Responder[armhardwaresecuritymodules.CloudHsmClusterRestoreStatusClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewCloudHsmClusterRestoreStatusServerTransport creates a new instance of CloudHsmClusterRestoreStatusServerTransport with the provided implementation. +// The returned CloudHsmClusterRestoreStatusServerTransport instance is connected to an instance of armhardwaresecuritymodules.CloudHsmClusterRestoreStatusClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCloudHsmClusterRestoreStatusServerTransport(srv *CloudHsmClusterRestoreStatusServer) *CloudHsmClusterRestoreStatusServerTransport { + return &CloudHsmClusterRestoreStatusServerTransport{srv: srv} +} + +// CloudHsmClusterRestoreStatusServerTransport connects instances of armhardwaresecuritymodules.CloudHsmClusterRestoreStatusClient to instances of CloudHsmClusterRestoreStatusServer. +// Don't use this type directly, use NewCloudHsmClusterRestoreStatusServerTransport instead. +type CloudHsmClusterRestoreStatusServerTransport struct { + srv *CloudHsmClusterRestoreStatusServer +} + +// Do implements the policy.Transporter interface for CloudHsmClusterRestoreStatusServerTransport. +func (c *CloudHsmClusterRestoreStatusServerTransport) 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 "CloudHsmClusterRestoreStatusClient.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 *CloudHsmClusterRestoreStatusServerTransport) 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~%@]+)/restoreOperationStatus/(?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 + } + jobIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobId")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, cloudHsmClusterNameParam, jobIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusAccepted}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RestoreResult, req) + if err != nil { + return nil, err + } + if val := server.GetResponse(respr).Location; val != nil { + resp.Header.Set("Location", *val) + } + if val := server.GetResponse(respr).XMSRequestID; val != nil { + resp.Header.Set("x-ms-request-id", *val) + } + return resp, nil +} diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusters_server.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusters_server.go index 400840e067..1fc313a443 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusters_server.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/cloudhsmclusters_server.go @@ -19,17 +19,22 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/v2" "net/http" "net/url" + "reflect" "regexp" ) // CloudHsmClustersServer is a fake server for instances of the armhardwaresecuritymodules.CloudHsmClustersClient type. type CloudHsmClustersServer struct { + // BeginBackup is the fake for method CloudHsmClustersClient.BeginBackup + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginBackup func(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *armhardwaresecuritymodules.CloudHsmClustersClientBeginBackupOptions) (resp azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientBackupResponse], errResp azfake.ErrorResponder) + // 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 + // HTTP status codes to indicate success: 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 @@ -44,9 +49,21 @@ type CloudHsmClustersServer struct { // HTTP status codes to indicate success: http.StatusOK NewListBySubscriptionPager func(options *armhardwaresecuritymodules.CloudHsmClustersClientListBySubscriptionOptions) (resp azfake.PagerResponder[armhardwaresecuritymodules.CloudHsmClustersClientListBySubscriptionResponse]) + // BeginRestore is the fake for method CloudHsmClustersClient.BeginRestore + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginRestore func(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, restoreRequestProperties armhardwaresecuritymodules.RestoreRequestProperties, options *armhardwaresecuritymodules.CloudHsmClustersClientBeginRestoreOptions) (resp azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientRestoreResponse], errResp azfake.ErrorResponder) + // 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) + + // BeginValidateBackupProperties is the fake for method CloudHsmClustersClient.BeginValidateBackupProperties + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginValidateBackupProperties func(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *armhardwaresecuritymodules.CloudHsmClustersClientBeginValidateBackupPropertiesOptions) (resp azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientValidateBackupPropertiesResponse], errResp azfake.ErrorResponder) + + // BeginValidateRestoreProperties is the fake for method CloudHsmClustersClient.BeginValidateRestoreProperties + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginValidateRestoreProperties func(ctx context.Context, resourceGroupName string, cloudHsmClusterName string, options *armhardwaresecuritymodules.CloudHsmClustersClientBeginValidateRestorePropertiesOptions) (resp azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientValidateRestorePropertiesResponse], errResp azfake.ErrorResponder) } // NewCloudHsmClustersServerTransport creates a new instance of CloudHsmClustersServerTransport with the provided implementation. @@ -54,24 +71,32 @@ type CloudHsmClustersServer struct { // 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]](), + srv: srv, + beginBackup: newTracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientBackupResponse]](), + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armhardwaresecuritymodules.CloudHsmClustersClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armhardwaresecuritymodules.CloudHsmClustersClientListBySubscriptionResponse]](), + beginRestore: newTracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientRestoreResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientUpdateResponse]](), + beginValidateBackupProperties: newTracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientValidateBackupPropertiesResponse]](), + beginValidateRestoreProperties: newTracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientValidateRestorePropertiesResponse]](), } } // 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]] + srv *CloudHsmClustersServer + beginBackup *tracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientBackupResponse]] + beginCreateOrUpdate *tracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armhardwaresecuritymodules.CloudHsmClustersClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armhardwaresecuritymodules.CloudHsmClustersClientListBySubscriptionResponse]] + beginRestore *tracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientRestoreResponse]] + beginUpdate *tracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientUpdateResponse]] + beginValidateBackupProperties *tracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientValidateBackupPropertiesResponse]] + beginValidateRestoreProperties *tracker[azfake.PollerResponder[armhardwaresecuritymodules.CloudHsmClustersClientValidateRestorePropertiesResponse]] } // Do implements the policy.Transporter interface for CloudHsmClustersServerTransport. @@ -86,6 +111,8 @@ func (c *CloudHsmClustersServerTransport) Do(req *http.Request) (*http.Response, var err error switch method { + case "CloudHsmClustersClient.BeginBackup": + resp, err = c.dispatchBeginBackup(req) case "CloudHsmClustersClient.BeginCreateOrUpdate": resp, err = c.dispatchBeginCreateOrUpdate(req) case "CloudHsmClustersClient.BeginDelete": @@ -96,8 +123,14 @@ func (c *CloudHsmClustersServerTransport) Do(req *http.Request) (*http.Response, resp, err = c.dispatchNewListByResourceGroupPager(req) case "CloudHsmClustersClient.NewListBySubscriptionPager": resp, err = c.dispatchNewListBySubscriptionPager(req) + case "CloudHsmClustersClient.BeginRestore": + resp, err = c.dispatchBeginRestore(req) case "CloudHsmClustersClient.BeginUpdate": resp, err = c.dispatchBeginUpdate(req) + case "CloudHsmClustersClient.BeginValidateBackupProperties": + resp, err = c.dispatchBeginValidateBackupProperties(req) + case "CloudHsmClustersClient.BeginValidateRestoreProperties": + resp, err = c.dispatchBeginValidateRestoreProperties(req) default: err = fmt.Errorf("unhandled API %s", method) } @@ -109,6 +142,60 @@ func (c *CloudHsmClustersServerTransport) Do(req *http.Request) (*http.Response, return resp, nil } +func (c *CloudHsmClustersServerTransport) dispatchBeginBackup(req *http.Request) (*http.Response, error) { + if c.srv.BeginBackup == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginBackup not implemented")} + } + beginBackup := c.beginBackup.get(req) + if beginBackup == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HardwareSecurityModules/cloudHsmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backup` + 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.BackupRequestProperties](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 + } + var options *armhardwaresecuritymodules.CloudHsmClustersClientBeginBackupOptions + if !reflect.ValueOf(body).IsZero() { + options = &armhardwaresecuritymodules.CloudHsmClustersClientBeginBackupOptions{ + BackupRequestProperties: &body, + } + } + respr, errRespr := c.srv.BeginBackup(req.Context(), resourceGroupNameParam, cloudHsmClusterNameParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginBackup = &respr + c.beginBackup.add(req, beginBackup) + } + + resp, err := server.PollerResponderNext(beginBackup, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginBackup.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginBackup) { + c.beginBackup.remove(req) + } + + 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")} @@ -190,9 +277,9 @@ func (c *CloudHsmClustersServerTransport) dispatchBeginDelete(req *http.Request) return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{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)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { c.beginDelete.remove(req) @@ -328,6 +415,54 @@ func (c *CloudHsmClustersServerTransport) dispatchNewListBySubscriptionPager(req return resp, nil } +func (c *CloudHsmClustersServerTransport) dispatchBeginRestore(req *http.Request) (*http.Response, error) { + if c.srv.BeginRestore == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRestore not implemented")} + } + beginRestore := c.beginRestore.get(req) + if beginRestore == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HardwareSecurityModules/cloudHsmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/restore` + 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.RestoreRequestProperties](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.BeginRestore(req.Context(), resourceGroupNameParam, cloudHsmClusterNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRestore = &respr + c.beginRestore.add(req, beginRestore) + } + + resp, err := server.PollerResponderNext(beginRestore, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginRestore.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginRestore) { + c.beginRestore.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")} @@ -375,3 +510,111 @@ func (c *CloudHsmClustersServerTransport) dispatchBeginUpdate(req *http.Request) return resp, nil } + +func (c *CloudHsmClustersServerTransport) dispatchBeginValidateBackupProperties(req *http.Request) (*http.Response, error) { + if c.srv.BeginValidateBackupProperties == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginValidateBackupProperties not implemented")} + } + beginValidateBackupProperties := c.beginValidateBackupProperties.get(req) + if beginValidateBackupProperties == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HardwareSecurityModules/cloudHsmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/validateBackupProperties` + 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.BackupRequestProperties](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 + } + var options *armhardwaresecuritymodules.CloudHsmClustersClientBeginValidateBackupPropertiesOptions + if !reflect.ValueOf(body).IsZero() { + options = &armhardwaresecuritymodules.CloudHsmClustersClientBeginValidateBackupPropertiesOptions{ + BackupRequestProperties: &body, + } + } + respr, errRespr := c.srv.BeginValidateBackupProperties(req.Context(), resourceGroupNameParam, cloudHsmClusterNameParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginValidateBackupProperties = &respr + c.beginValidateBackupProperties.add(req, beginValidateBackupProperties) + } + + resp, err := server.PollerResponderNext(beginValidateBackupProperties, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginValidateBackupProperties.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginValidateBackupProperties) { + c.beginValidateBackupProperties.remove(req) + } + + return resp, nil +} + +func (c *CloudHsmClustersServerTransport) dispatchBeginValidateRestoreProperties(req *http.Request) (*http.Response, error) { + if c.srv.BeginValidateRestoreProperties == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginValidateRestoreProperties not implemented")} + } + beginValidateRestoreProperties := c.beginValidateRestoreProperties.get(req) + if beginValidateRestoreProperties == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HardwareSecurityModules/cloudHsmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/validateRestoreProperties` + 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.RestoreRequestProperties](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 + } + var options *armhardwaresecuritymodules.CloudHsmClustersClientBeginValidateRestorePropertiesOptions + if !reflect.ValueOf(body).IsZero() { + options = &armhardwaresecuritymodules.CloudHsmClustersClientBeginValidateRestorePropertiesOptions{ + RestoreRequestProperties: &body, + } + } + respr, errRespr := c.srv.BeginValidateRestoreProperties(req.Context(), resourceGroupNameParam, cloudHsmClusterNameParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginValidateRestoreProperties = &respr + c.beginValidateRestoreProperties.add(req, beginValidateRestoreProperties) + } + + resp, err := server.PollerResponderNext(beginValidateRestoreProperties, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginValidateRestoreProperties.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginValidateRestoreProperties) { + c.beginValidateRestoreProperties.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 8d169d886a..70ebb3ab5e 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/dedicatedhsm_server.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/dedicatedhsm_server.go @@ -30,7 +30,7 @@ type DedicatedHsmServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, name string, parameters armhardwaresecuritymodules.DedicatedHsm, options *armhardwaresecuritymodules.DedicatedHsmClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armhardwaresecuritymodules.DedicatedHsmClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method DedicatedHsmClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, name string, options *armhardwaresecuritymodules.DedicatedHsmClientBeginDeleteOptions) (resp azfake.PollerResponder[armhardwaresecuritymodules.DedicatedHsmClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method DedicatedHsmClient.Get @@ -50,7 +50,7 @@ type DedicatedHsmServer struct { NewListOutboundNetworkDependenciesEndpointsPager func(resourceGroupName string, name string, options *armhardwaresecuritymodules.DedicatedHsmClientListOutboundNetworkDependenciesEndpointsOptions) (resp azfake.PagerResponder[armhardwaresecuritymodules.DedicatedHsmClientListOutboundNetworkDependenciesEndpointsResponse]) // BeginUpdate is the fake for method DedicatedHsmClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginUpdate func(ctx context.Context, resourceGroupName string, name string, parameters armhardwaresecuritymodules.DedicatedHsmPatchParameters, options *armhardwaresecuritymodules.DedicatedHsmClientBeginUpdateOptions) (resp azfake.PollerResponder[armhardwaresecuritymodules.DedicatedHsmClientUpdateResponse], errResp azfake.ErrorResponder) } @@ -199,9 +199,9 @@ func (d *DedicatedHsmServerTransport) dispatchBeginDelete(req *http.Request) (*h return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { d.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { d.beginDelete.remove(req) @@ -433,9 +433,9 @@ func (d *DedicatedHsmServerTransport) dispatchBeginUpdate(req *http.Request) (*h return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { d.beginUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } if !server.PollerResponderMore(beginUpdate) { d.beginUpdate.remove(req) diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/server_factory.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/server_factory.go index de8cd534bd..15e76883c1 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/server_factory.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/server_factory.go @@ -19,8 +19,10 @@ import ( // ServerFactory is a fake server for instances of the armhardwaresecuritymodules.ClientFactory type. type ServerFactory struct { + CloudHsmClusterBackupStatusServer CloudHsmClusterBackupStatusServer CloudHsmClusterPrivateEndpointConnectionsServer CloudHsmClusterPrivateEndpointConnectionsServer CloudHsmClusterPrivateLinkResourcesServer CloudHsmClusterPrivateLinkResourcesServer + CloudHsmClusterRestoreStatusServer CloudHsmClusterRestoreStatusServer CloudHsmClustersServer CloudHsmClustersServer DedicatedHsmServer DedicatedHsmServer OperationsServer OperationsServer @@ -41,8 +43,10 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { type ServerFactoryTransport struct { srv *ServerFactory trMu sync.Mutex + trCloudHsmClusterBackupStatusServer *CloudHsmClusterBackupStatusServerTransport trCloudHsmClusterPrivateEndpointConnectionsServer *CloudHsmClusterPrivateEndpointConnectionsServerTransport trCloudHsmClusterPrivateLinkResourcesServer *CloudHsmClusterPrivateLinkResourcesServerTransport + trCloudHsmClusterRestoreStatusServer *CloudHsmClusterRestoreStatusServerTransport trCloudHsmClustersServer *CloudHsmClustersServerTransport trDedicatedHsmServer *DedicatedHsmServerTransport trOperationsServer *OperationsServerTransport @@ -62,6 +66,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { + case "CloudHsmClusterBackupStatusClient": + initServer(s, &s.trCloudHsmClusterBackupStatusServer, func() *CloudHsmClusterBackupStatusServerTransport { + return NewCloudHsmClusterBackupStatusServerTransport(&s.srv.CloudHsmClusterBackupStatusServer) + }) + resp, err = s.trCloudHsmClusterBackupStatusServer.Do(req) case "CloudHsmClusterPrivateEndpointConnectionsClient": initServer(s, &s.trCloudHsmClusterPrivateEndpointConnectionsServer, func() *CloudHsmClusterPrivateEndpointConnectionsServerTransport { return NewCloudHsmClusterPrivateEndpointConnectionsServerTransport(&s.srv.CloudHsmClusterPrivateEndpointConnectionsServer) @@ -72,6 +81,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewCloudHsmClusterPrivateLinkResourcesServerTransport(&s.srv.CloudHsmClusterPrivateLinkResourcesServer) }) resp, err = s.trCloudHsmClusterPrivateLinkResourcesServer.Do(req) + case "CloudHsmClusterRestoreStatusClient": + initServer(s, &s.trCloudHsmClusterRestoreStatusServer, func() *CloudHsmClusterRestoreStatusServerTransport { + return NewCloudHsmClusterRestoreStatusServerTransport(&s.srv.CloudHsmClusterRestoreStatusServer) + }) + resp, err = s.trCloudHsmClusterRestoreStatusServer.Do(req) case "CloudHsmClustersClient": initServer(s, &s.trCloudHsmClustersServer, func() *CloudHsmClustersServerTransport { return NewCloudHsmClustersServerTransport(&s.srv.CloudHsmClustersServer) diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/time_rfc3339.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/time_rfc3339.go index b0535a7b63..81f308b0d3 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/time_rfc3339.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/fake/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models.go index aa8292a0db..3516ac3697 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models.go @@ -12,29 +12,80 @@ import "time" // APIEntityReference - The API entity reference. type APIEntityReference struct { - // The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/… - ID *string + // The Azure resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/… + ResourceID *string } -// BackupProperties - Cloud Hsm Cluster backup information -type BackupProperties struct { - // Azure storage Resource Uri - AzureStorageResourceURI *string +// BackupRequestProperties - Backup properties +type BackupRequestProperties struct { + // REQUIRED; The Azure blob storage container Uri which contains the backup + AzureStorageBlobContainerURI *string - // READ-ONLY; Last Date Time that Customer Enabled Backup was taken - LastBackupDateTime *time.Time - - // READ-ONLY; Status of last backup - LastBackupStatus *string + // The SAS token pointing to an Azure blob storage container. This property is reserved for Azure Backup Service. + Token *string } -// CHsmError - Error details -type CHsmError struct { - // READ-ONLY; The error code. - Code *string +// BackupRestoreBaseResultProperties - Backup and Restore operation common properties +type BackupRestoreBaseResultProperties struct { + // Error encountered, if any, during the backup/restore operation. + Error *ErrorDetail - // READ-ONLY; The error message. - Message *string + // Identifier for the backup/restore operation. + JobID *string + + // The status details of backup/restore operation + StatusDetails *string + + // READ-ONLY; The end time of the backup/restore operation in UTC + EndTime *time.Time + + // READ-ONLY; The start time of the backup/restore operation in UTC + StartTime *time.Time + + // READ-ONLY; Status of the backup/restore operation + Status *BackupRestoreOperationStatus +} + +// BackupRestoreRequestBaseProperties - Backup and Restore Common properties +type BackupRestoreRequestBaseProperties struct { + // REQUIRED; The Azure blob storage container Uri which contains the backup + AzureStorageBlobContainerURI *string + + // The SAS token pointing to an Azure blob storage container. This property is reserved for Azure Backup Service. + Token *string +} + +// BackupResult - Backup operation Result +type BackupResult struct { + // Properties of the Cloud HSM Cluster + Properties *BackupResultProperties +} + +// BackupResultProperties - Properties of the Cloud HSM Cluster +type BackupResultProperties struct { + // The Azure blob storage container Uri which contains the backup + AzureStorageBlobContainerURI *string + + // The ID of the backup. + BackupID *string + + // Error encountered, if any, during the backup/restore operation. + Error *ErrorDetail + + // Identifier for the backup/restore operation. + JobID *string + + // The status details of backup/restore operation + StatusDetails *string + + // READ-ONLY; The end time of the backup/restore operation in UTC + EndTime *time.Time + + // READ-ONLY; The start time of the backup/restore operation in UTC + StartTime *time.Time + + // READ-ONLY; Status of the backup/restore operation + Status *BackupRestoreOperationStatus } // CloudHsmCluster - Resource information with extended details. @@ -67,12 +118,6 @@ type CloudHsmCluster struct { 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. @@ -87,47 +132,29 @@ 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 + AutoGeneratedDomainNameLabelScope *AutoGeneratedDomainNameLabelScope // The Cloud HSM Cluster public network access - PublicNetworkAccess *string + PublicNetworkAccess *PublicNetworkAccess - // Cloud Hsm Cluster restore information - RestoreProperties *RestoreProperties + // READ-ONLY; State of security domain activation + ActivationState *ActivationState - // Security domain properties information for Cloud HSM cluster - SecurityDomain *CloudHsmClusterSecurityDomainProperties + // READ-ONLY; An array of Cloud HSM Cluster's HSMs + Hsms []*CloudHsmProperties + + // READ-ONLY; List of private endpoint connection resources + PrivateEndpointConnections []*PrivateEndpointConnection + + // READ-ONLY; The Cloud HSM Cluster's provisioningState + ProvisioningState *ProvisioningState // READ-ONLY; Cloud HSM Cluster status message StatusMessage *string @@ -172,21 +199,13 @@ type CloudHsmClusterSKU struct { 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 + // The Cloud HSM State. Values are: Deploying, ConfiguringSlb, Starting, Starting, Failed, Failed, Deleting, DeletingSlbEntry, + // InitialProvisioning, Updating State *string // The Cloud HSM State message @@ -195,31 +214,31 @@ type CloudHsmProperties struct { // DedicatedHsm - Resource information with extended details. type DedicatedHsm struct { - // REQUIRED; The supported Azure location where the dedicated HSM should be created. + // REQUIRED; The geo-location where the resource lives Location *string // REQUIRED; Properties of the dedicated HSM Properties *DedicatedHsmProperties - // SKU details + // REQUIRED; SKU details SKU *SKU - // Resource tags + // Resource tags. Tags map[string]*string // The Dedicated Hsm zones. Zones []*string - // READ-ONLY; The Azure Resource Manager resource ID for the dedicated HSM. + // 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; Metadata pertaining to creation and last modification of the resource - SystemData *DedicatedHsmSystemData + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; The resource type of the dedicated HSM. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -238,43 +257,6 @@ type DedicatedHsmListResult struct { Value []*DedicatedHsm } -// DedicatedHsmOperation - REST API operation -type DedicatedHsmOperation struct { - // The display string. - Display *DedicatedHsmOperationDisplay - - // 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 *bool -} - -// DedicatedHsmOperationDisplay - The display string. -type DedicatedHsmOperationDisplay struct { - // The object that represents the operation. - Description *string - - // Operation type: Read, write, delete, etc. - Operation *string - - // The Resource Provider of the operation - Provider *string - - // Resource on which the operation is performed. - Resource *string -} - -// DedicatedHsmOperationListResult - Result of the request to list Dedicated HSM Provider operations. It contains a list of -// operations. -type DedicatedHsmOperationListResult struct { - // List of Dedicated HSM Resource Provider operations. - Value []*DedicatedHsmOperation -} - // DedicatedHsmPatchParameters - Patchable properties of the dedicated HSM type DedicatedHsmPatchParameters struct { // Resource tags @@ -299,51 +281,6 @@ 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 -} - -// 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. @@ -380,6 +317,40 @@ type Error struct { Message *string } +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any + + // READ-ONLY; The additional info type. + Type *string +} + +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo + + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The error details. + Details []*ErrorDetail + + // READ-ONLY; The error message. + Message *string + + // READ-ONLY; The error target. + Target *string +} + +// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.). +type ErrorResponse struct { + // The error object. + Error *ErrorDetail +} + // 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). @@ -405,8 +376,8 @@ type NetworkInterface struct { // Private Ip address of the interface PrivateIPAddress *string - // READ-ONLY; The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/… - ID *string + // READ-ONLY; The Azure resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/… + ResourceID *string } // NetworkProfile - The network profile definition. @@ -418,6 +389,55 @@ type NetworkProfile struct { Subnet *APIEntityReference } +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + // operations. + IsDataAction *bool + + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin +} + +// OperationDisplay - Localized display information for this particular operation. +type OperationDisplay struct { + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. + Description *string + + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". + Operation *string + + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string +} + +// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to +// get the next set of results. +type OperationListResult struct { + // READ-ONLY; URL to get the next set of operation list results (if there are any). + NextLink *string + + // READ-ONLY; List of operations supported by the resource provider + Value []*Operation +} + // OutboundEnvironmentEndpoint - Egress endpoints which dedicated hsm service connects to for common purpose. type OutboundEnvironmentEndpoint struct { // The category of endpoints accessed by the dedicated hsm service, e.g. azure-resource-management, apiserver, etc. @@ -509,6 +529,9 @@ type PrivateLinkResource struct { type PrivateLinkResourceListResult struct { // Array of private link resources Value []*PrivateLinkResource + + // READ-ONLY; URL to get the next set of operation list results (if there are any). + NextLink *string } // PrivateLinkResourceProperties - Properties of a private link resource. @@ -567,22 +590,22 @@ type Resource struct { Type *string } -// ResourceListResult - List of dedicated HSM resources. -type ResourceListResult struct { - // The URL to get the next set of dedicated HSM resources. - NextLink *string +// RestoreRequestProperties - Cloud Hsm Cluster restore information +type RestoreRequestProperties struct { + // REQUIRED; The Azure blob storage container Uri which contains the backup + AzureStorageBlobContainerURI *string - // The list of dedicated HSM resources. - Value []*DedicatedHsmResource + // REQUIRED; An autogenerated unique string ID for labeling the backup. It contains both a UUID and a date timestamp. + BackupID *string + + // The SAS token pointing to an Azure blob storage container. This property is reserved for Azure Backup Service. + Token *string } -// 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 +// RestoreResult - Restore operation properties +type RestoreResult struct { + // Backup and Restore operation common properties + Properties *BackupRestoreBaseResultProperties } // SKU of the dedicated HSM diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models_serde.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models_serde.go index fd5c3a5e3c..964adf4042 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models_serde.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/models_serde.go @@ -19,7 +19,7 @@ import ( // MarshalJSON implements the json.Marshaller interface for type APIEntityReference. func (a APIEntityReference) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) + populate(objectMap, "resourceId", a.ResourceID) return json.Marshal(objectMap) } @@ -32,8 +32,8 @@ func (a *APIEntityReference) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) + case "resourceId": + err = unpopulate(val, "ResourceID", &a.ResourceID) delete(rawMsg, key) } if err != nil { @@ -43,17 +43,16 @@ func (a *APIEntityReference) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type BackupProperties. -func (b BackupProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BackupRequestProperties. +func (b BackupRequestProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "azureStorageResourceUri", b.AzureStorageResourceURI) - populateDateTimeRFC3339(objectMap, "lastBackupDateTime", b.LastBackupDateTime) - populate(objectMap, "lastBackupStatus", b.LastBackupStatus) + populate(objectMap, "azureStorageBlobContainerUri", b.AzureStorageBlobContainerURI) + populate(objectMap, "token", b.Token) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupProperties. -func (b *BackupProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupRequestProperties. +func (b *BackupRequestProperties) 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) @@ -61,14 +60,11 @@ func (b *BackupProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "azureStorageResourceUri": - err = unpopulate(val, "AzureStorageResourceURI", &b.AzureStorageResourceURI) + case "azureStorageBlobContainerUri": + err = unpopulate(val, "AzureStorageBlobContainerURI", &b.AzureStorageBlobContainerURI) delete(rawMsg, key) - case "lastBackupDateTime": - err = unpopulateDateTimeRFC3339(val, "LastBackupDateTime", &b.LastBackupDateTime) - delete(rawMsg, key) - case "lastBackupStatus": - err = unpopulate(val, "LastBackupStatus", &b.LastBackupStatus) + case "token": + err = unpopulate(val, "Token", &b.Token) delete(rawMsg, key) } if err != nil { @@ -78,32 +74,161 @@ func (b *BackupProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CHsmError. -func (c CHsmError) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BackupRestoreBaseResultProperties. +func (b BackupRestoreBaseResultProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", c.Code) - populate(objectMap, "message", c.Message) + populateDateTimeRFC3339(objectMap, "endTime", b.EndTime) + populate(objectMap, "error", b.Error) + populate(objectMap, "jobId", b.JobID) + populateDateTimeRFC3339(objectMap, "startTime", b.StartTime) + populate(objectMap, "status", b.Status) + populate(objectMap, "statusDetails", b.StatusDetails) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CHsmError. -func (c *CHsmError) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupRestoreBaseResultProperties. +func (b *BackupRestoreBaseResultProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &c.Code) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &b.EndTime) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &c.Message) + case "error": + err = unpopulate(val, "Error", &b.Error) + delete(rawMsg, key) + case "jobId": + err = unpopulate(val, "JobID", &b.JobID) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &b.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &b.Status) + delete(rawMsg, key) + case "statusDetails": + err = unpopulate(val, "StatusDetails", &b.StatusDetails) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupRestoreRequestBaseProperties. +func (b BackupRestoreRequestBaseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureStorageBlobContainerUri", b.AzureStorageBlobContainerURI) + populate(objectMap, "token", b.Token) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupRestoreRequestBaseProperties. +func (b *BackupRestoreRequestBaseProperties) 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 "azureStorageBlobContainerUri": + err = unpopulate(val, "AzureStorageBlobContainerURI", &b.AzureStorageBlobContainerURI) + delete(rawMsg, key) + case "token": + err = unpopulate(val, "Token", &b.Token) + 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 BackupResult. +func (b BackupResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", b.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupResult. +func (b *BackupResult) 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 "properties": + err = unpopulate(val, "Properties", &b.Properties) + 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 BackupResultProperties. +func (b BackupResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureStorageBlobContainerUri", b.AzureStorageBlobContainerURI) + populate(objectMap, "backupId", b.BackupID) + populateDateTimeRFC3339(objectMap, "endTime", b.EndTime) + populate(objectMap, "error", b.Error) + populate(objectMap, "jobId", b.JobID) + populateDateTimeRFC3339(objectMap, "startTime", b.StartTime) + populate(objectMap, "status", b.Status) + populate(objectMap, "statusDetails", b.StatusDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupResultProperties. +func (b *BackupResultProperties) 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 "azureStorageBlobContainerUri": + err = unpopulate(val, "AzureStorageBlobContainerURI", &b.AzureStorageBlobContainerURI) + delete(rawMsg, key) + case "backupId": + err = unpopulate(val, "BackupID", &b.BackupID) + delete(rawMsg, key) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &b.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &b.Error) + delete(rawMsg, key) + case "jobId": + err = unpopulate(val, "JobID", &b.JobID) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &b.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &b.Status) + delete(rawMsg, key) + case "statusDetails": + err = unpopulate(val, "StatusDetails", &b.StatusDetails) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil @@ -168,33 +293,6 @@ func (c *CloudHsmCluster) UnmarshalJSON(data []byte) error { 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) @@ -230,8 +328,6 @@ func (c *CloudHsmClusterListResult) UnmarshalJSON(data []byte) error { 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) } @@ -248,12 +344,6 @@ func (c *CloudHsmClusterPatchParameters) UnmarshalJSON(data []byte) error { 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) @@ -265,44 +355,15 @@ func (c *CloudHsmClusterPatchParameters) UnmarshalJSON(data []byte) error { 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, "activationState", c.ActivationState) 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) } @@ -316,12 +377,12 @@ func (c *CloudHsmClusterProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "activationState": + err = unpopulate(val, "ActivationState", &c.ActivationState) + delete(rawMsg, 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) @@ -334,12 +395,6 @@ func (c *CloudHsmClusterProperties) UnmarshalJSON(data []byte) error { 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) @@ -444,37 +499,6 @@ func (c *CloudHsmClusterSKU) UnmarshalJSON(data []byte) error { 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) @@ -627,111 +651,6 @@ func (d *DedicatedHsmListResult) UnmarshalJSON(data []byte) error { 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) @@ -802,104 +721,6 @@ func (d *DedicatedHsmProperties) UnmarshalJSON(data []byte) error { 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, "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 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) - } - 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 "sku": - err = unpopulate(val, "SKU", &d.SKU) - 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 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) @@ -1005,6 +826,107 @@ func (e *Error) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1047,8 +969,8 @@ func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NetworkInterface. func (n NetworkInterface) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", n.ID) populate(objectMap, "privateIpAddress", n.PrivateIPAddress) + populate(objectMap, "resourceId", n.ResourceID) return json.Marshal(objectMap) } @@ -1061,12 +983,12 @@ func (n *NetworkInterface) UnmarshalJSON(data []byte) error { 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) delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &n.ResourceID) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) @@ -1106,6 +1028,119 @@ func (n *NetworkProfile) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) 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 "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + 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 OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) 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 "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + 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 OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + 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 OutboundEnvironmentEndpoint. func (o OutboundEnvironmentEndpoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1358,6 +1393,7 @@ func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } @@ -1371,6 +1407,9 @@ func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) @@ -1530,16 +1569,17 @@ func (r *Resource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceListResult. -func (r ResourceListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RestoreRequestProperties. +func (r RestoreRequestProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + populate(objectMap, "azureStorageBlobContainerUri", r.AzureStorageBlobContainerURI) + populate(objectMap, "backupId", r.BackupID) + populate(objectMap, "token", r.Token) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceListResult. -func (r *ResourceListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreRequestProperties. +func (r *RestoreRequestProperties) 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) @@ -1547,11 +1587,14 @@ func (r *ResourceListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) + case "azureStorageBlobContainerUri": + err = unpopulate(val, "AzureStorageBlobContainerURI", &r.AzureStorageBlobContainerURI) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "backupId": + err = unpopulate(val, "BackupID", &r.BackupID) + delete(rawMsg, key) + case "token": + err = unpopulate(val, "Token", &r.Token) delete(rawMsg, key) } if err != nil { @@ -1561,16 +1604,15 @@ func (r *ResourceListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RestoreProperties. -func (r RestoreProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RestoreResult. +func (r RestoreResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "azureStorageResourceUri", r.AzureStorageResourceURI) - populate(objectMap, "foldername", r.Foldername) + populate(objectMap, "properties", r.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreProperties. -func (r *RestoreProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreResult. +func (r *RestoreResult) 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) @@ -1578,11 +1620,8 @@ func (r *RestoreProperties) UnmarshalJSON(data []byte) error { 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) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) delete(rawMsg, key) } if err != nil { @@ -1754,8 +1793,18 @@ func populate(m map[string]any, k string, v any) { } } +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/operations_client.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/operations_client.go index 0453de643d..ca2aaa8061 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/operations_client.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/operations_client.go @@ -37,9 +37,9 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - Get a list of Dedicated HSM operations. +// NewListPager - Get a list of Hardware Security Modules operations. // -// Generated from API version 2021-11-30 +// Generated from API version 2024-06-30-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -73,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-30") + reqQP.Set("api-version", "2024-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -82,7 +82,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { result := OperationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHsmOperationListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { return OperationsClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/operations_client_example_test.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/operations_client_example_test.go index 8566f17fa1..7e665f2363 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/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/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/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/OperationsList.json func ExampleOperationsClient_NewListPager_getAListOfDedicatedHsmOperations() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -39,57 +39,29 @@ func ExampleOperationsClient_NewListPager_getAListOfDedicatedHsmOperations() { _ = 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.DedicatedHsmOperationListResult = armhardwaresecuritymodules.DedicatedHsmOperationListResult{ - // Value: []*armhardwaresecuritymodules.DedicatedHsmOperation{ + // page.OperationListResult = armhardwaresecuritymodules.OperationListResult{ + // Value: []*armhardwaresecuritymodules.Operation{ // { - // Name: to.Ptr("hsm1"), - // Display: &armhardwaresecuritymodules.DedicatedHsmOperationDisplay{ - // Description: to.Ptr("Update a dedicated HSM in the specified subscription"), - // Operation: to.Ptr("DedicatedHsm_Update"), - // Provider: to.Ptr("Microsoft HardwareSecurityModules"), - // Resource: to.Ptr("Dedicated HSM"), + // Name: to.Ptr("Microsoft.HardwareSecurityModules/dedicatedhsms/read"), + // Display: &armhardwaresecuritymodules.OperationDisplay{ + // Description: to.Ptr("View the properties of a DedicatedHsm"), + // Operation: to.Ptr("View DedicatedHsm"), + // Provider: to.Ptr("Microsoft Hardware Security Modules"), + // Resource: to.Ptr("DedicatedHsm"), // }, // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("system"), - // }}, - // } - } -} - -// 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 { - 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.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DedicatedHsmOperationListResult = armhardwaresecuritymodules.DedicatedHsmOperationListResult{ - // Value: []*armhardwaresecuritymodules.DedicatedHsmOperation{ - // { - // Name: to.Ptr("hsm1"), - // Display: &armhardwaresecuritymodules.DedicatedHsmOperationDisplay{ - // Description: to.Ptr("Update a dedicated HSM in the specified subscription"), - // Operation: to.Ptr("DedicatedHsm_Update"), - // Provider: to.Ptr("Microsoft HardwareSecurityModules"), - // Resource: to.Ptr("Dedicated HSM"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("system"), + // Origin: to.Ptr(armhardwaresecuritymodules.OriginSystem), + // }, + // { + // Name: to.Ptr("Microsoft.HardwareSecurityModules/cloudHsmClusters/read"), + // Display: &armhardwaresecuritymodules.OperationDisplay{ + // Description: to.Ptr("View the properties of a CloudHsm"), + // Operation: to.Ptr("View CloudHsm"), + // Provider: to.Ptr("Microsoft Hardware Security Modules"), + // Resource: to.Ptr("CloudHsm"), + // }, + // IsDataAction: to.Ptr(false), + // Origin: to.Ptr(armhardwaresecuritymodules.OriginSystem), // }}, // } } diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/options.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/options.go index 27e13fdd75..d3a968b20f 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/options.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/options.go @@ -8,6 +8,12 @@ package armhardwaresecuritymodules +// CloudHsmClusterBackupStatusClientGetOptions contains the optional parameters for the CloudHsmClusterBackupStatusClient.Get +// method. +type CloudHsmClusterBackupStatusClientGetOptions struct { + // placeholder for future optional parameters +} + // CloudHsmClusterPrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the CloudHsmClusterPrivateEndpointConnectionsClient.BeginDelete // method. type CloudHsmClusterPrivateEndpointConnectionsClientBeginDeleteOptions struct { @@ -27,12 +33,27 @@ type CloudHsmClusterPrivateEndpointConnectionsClientGetOptions struct { // placeholder for future optional parameters } -// CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterOptions contains the optional parameters for the CloudHsmClusterPrivateLinkResourcesClient.ListByCloudHsmCluster +// CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterOptions contains the optional parameters for the CloudHsmClusterPrivateLinkResourcesClient.NewListByCloudHsmClusterPager // method. type CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterOptions struct { // placeholder for future optional parameters } +// CloudHsmClusterRestoreStatusClientGetOptions contains the optional parameters for the CloudHsmClusterRestoreStatusClient.Get +// method. +type CloudHsmClusterRestoreStatusClientGetOptions struct { + // placeholder for future optional parameters +} + +// CloudHsmClustersClientBeginBackupOptions contains the optional parameters for the CloudHsmClustersClient.BeginBackup method. +type CloudHsmClustersClientBeginBackupOptions struct { + // Azure storage Resource Uri + BackupRequestProperties *BackupRequestProperties + + // Resumes the LRO from the provided token. + ResumeToken string +} + // CloudHsmClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the CloudHsmClustersClient.BeginCreateOrUpdate // method. type CloudHsmClustersClientBeginCreateOrUpdateOptions struct { @@ -46,12 +67,39 @@ type CloudHsmClustersClientBeginDeleteOptions struct { ResumeToken string } +// CloudHsmClustersClientBeginRestoreOptions contains the optional parameters for the CloudHsmClustersClient.BeginRestore +// method. +type CloudHsmClustersClientBeginRestoreOptions 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 } +// CloudHsmClustersClientBeginValidateBackupPropertiesOptions contains the optional parameters for the CloudHsmClustersClient.BeginValidateBackupProperties +// method. +type CloudHsmClustersClientBeginValidateBackupPropertiesOptions struct { + // Backup Operation Required properties + BackupRequestProperties *BackupRequestProperties + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudHsmClustersClientBeginValidateRestorePropertiesOptions contains the optional parameters for the CloudHsmClustersClient.BeginValidateRestoreProperties +// method. +type CloudHsmClustersClientBeginValidateRestorePropertiesOptions struct { + // Optional Parameters to validate prior performing a restore operation. + RestoreRequestProperties *RestoreRequestProperties + + // 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 diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/privateendpointconnections_client.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/privateendpointconnections_client.go index a91255249e..20deebeffd 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/privateendpointconnections_client.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/privateendpointconnections_client.go @@ -46,10 +46,10 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // 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 +// Generated from API version 2024-06-30-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. +// be between 3 and 23 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] { @@ -95,7 +95,7 @@ func (client *PrivateEndpointConnectionsClient) listByCloudHsmClusterCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-10-preview") + reqQP.Set("api-version", "2024-06-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/privateendpointconnections_client_example_test.go index 8024273933..5144ad6a11 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/18b5c820705ab69735b7e1e2e0da5e37ca6e1969/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/e838027e88cca634c1545e744630de9262a6e72a/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30-preview/examples/CloudHsmClusterPrivateEndpointConnection_ListByCloudHsmCluster_MaximumSet_Gen.json func ExamplePrivateEndpointConnectionsClient_NewListByCloudHsmClusterPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/response_types.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/responses.go similarity index 71% rename from sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/response_types.go rename to sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/responses.go index f467350a43..e3481a171a 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/response_types.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/responses.go @@ -8,6 +8,18 @@ package armhardwaresecuritymodules +// CloudHsmClusterBackupStatusClientGetResponse contains the response from method CloudHsmClusterBackupStatusClient.Get. +type CloudHsmClusterBackupStatusClientGetResponse struct { + // Backup operation Result + BackupResult + + // Location contains the information returned from the Location header response. + Location *string + + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + // CloudHsmClusterPrivateEndpointConnectionsClientCreateResponse contains the response from method CloudHsmClusterPrivateEndpointConnectionsClient.Create. type CloudHsmClusterPrivateEndpointConnectionsClientCreateResponse struct { // The private endpoint connection resource. @@ -25,12 +37,30 @@ type CloudHsmClusterPrivateEndpointConnectionsClientGetResponse struct { PrivateEndpointConnection } -// CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse contains the response from method CloudHsmClusterPrivateLinkResourcesClient.ListByCloudHsmCluster. +// CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse contains the response from method CloudHsmClusterPrivateLinkResourcesClient.NewListByCloudHsmClusterPager. type CloudHsmClusterPrivateLinkResourcesClientListByCloudHsmClusterResponse struct { // A list of private link resources. PrivateLinkResourceListResult } +// CloudHsmClusterRestoreStatusClientGetResponse contains the response from method CloudHsmClusterRestoreStatusClient.Get. +type CloudHsmClusterRestoreStatusClientGetResponse struct { + // Restore operation properties + RestoreResult + + // Location contains the information returned from the Location header response. + Location *string + + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// CloudHsmClustersClientBackupResponse contains the response from method CloudHsmClustersClient.BeginBackup. +type CloudHsmClustersClientBackupResponse struct { + // Backup operation Result + BackupResult +} + // CloudHsmClustersClientCreateOrUpdateResponse contains the response from method CloudHsmClustersClient.BeginCreateOrUpdate. type CloudHsmClustersClientCreateOrUpdateResponse struct { // Resource information with extended details. @@ -60,12 +90,30 @@ type CloudHsmClustersClientListBySubscriptionResponse struct { CloudHsmClusterListResult } +// CloudHsmClustersClientRestoreResponse contains the response from method CloudHsmClustersClient.BeginRestore. +type CloudHsmClustersClientRestoreResponse struct { + // Restore operation properties + RestoreResult +} + // CloudHsmClustersClientUpdateResponse contains the response from method CloudHsmClustersClient.BeginUpdate. type CloudHsmClustersClientUpdateResponse struct { // Resource information with extended details. CloudHsmCluster } +// CloudHsmClustersClientValidateBackupPropertiesResponse contains the response from method CloudHsmClustersClient.BeginValidateBackupProperties. +type CloudHsmClustersClientValidateBackupPropertiesResponse struct { + // Backup operation Result + BackupResult +} + +// CloudHsmClustersClientValidateRestorePropertiesResponse contains the response from method CloudHsmClustersClient.BeginValidateRestoreProperties. +type CloudHsmClustersClientValidateRestorePropertiesResponse struct { + // Restore operation properties + RestoreResult +} + // DedicatedHsmClientCreateOrUpdateResponse contains the response from method DedicatedHsmClient.BeginCreateOrUpdate. type DedicatedHsmClientCreateOrUpdateResponse struct { // Resource information with extended details. @@ -109,8 +157,8 @@ type DedicatedHsmClientUpdateResponse struct { // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { - // Result of the request to list Dedicated HSM Provider operations. It contains a list of operations. - DedicatedHsmOperationListResult + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult } // PrivateEndpointConnectionsClientListByCloudHsmClusterResponse contains the response from method PrivateEndpointConnectionsClient.NewListByCloudHsmClusterPager. diff --git a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/time_rfc3339.go b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/time_rfc3339.go index 4bab566687..c075484365 100644 --- a/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/time_rfc3339.go +++ b/sdk/resourcemanager/hardwaresecuritymodules/armhardwaresecuritymodules/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339