From 4cf3099617ba76c6cd75b9d6dd3440955aeb65fc Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 3 Feb 2023 03:08:50 +0000 Subject: [PATCH] CodeGen from PR 20839 in Azure/azure-rest-api-specs Merge 4b0f04d08b3661e5014c6665656f756d24ae8b53 into 8021313f4e40586531a026e4554a0777c15fb94d --- .../keyvault/armkeyvault/CHANGELOG.md | 50 +- .../keyvault/armkeyvault/autorest.md | 6 +- ...zz_generated_constants.go => constants.go} | 27 +- .../keyvault/armkeyvault/go.mod | 4 +- ...enerated_keys_client.go => keys_client.go} | 80 +- .../armkeyvault/managedhsmkeys_client.go | 405 ++ ...edhsms_client.go => managedhsms_client.go} | 177 +- ... mhsmprivateendpointconnections_client.go} | 73 +- ....go => mhsmprivatelinkresources_client.go} | 22 +- .../{zz_generated_models.go => models.go} | 286 +- .../keyvault/armkeyvault/models_serde.go | 3680 +++++++++++++++++ ...rations_client.go => operations_client.go} | 13 +- ...o => privateendpointconnections_client.go} | 73 +- ...ient.go => privatelinkresources_client.go} | 22 +- ...ed_response_types.go => response_types.go} | 73 +- ...ed_secrets_client.go => secrets_client.go} | 65 +- ...erated_time_rfc3339.go => time_rfc3339.go} | 3 +- ...zz_generated_time_unix.go => time_unix.go} | 3 +- ...ated_vaults_client.go => vaults_client.go} | 153 +- .../ze_generated_example_keys_client_test.go | 146 - ...nerated_example_managedhsms_client_test.go | 261 -- ...mprivateendpointconnections_client_test.go | 125 - ...le_mhsmprivatelinkresources_client_test.go | 39 - ...enerated_example_operations_client_test.go | 41 - ..._privateendpointconnections_client_test.go | 126 - ...xample_privatelinkresources_client_test.go | 39 - ...e_generated_example_secrets_client_test.go | 123 - ...ze_generated_example_vaults_client_test.go | 438 -- .../armkeyvault/zz_generated_models_serde.go | 633 --- 29 files changed, 4848 insertions(+), 2338 deletions(-) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_constants.go => constants.go} (95%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_keys_client.go => keys_client.go} (84%) create mode 100644 sdk/resourcemanager/keyvault/armkeyvault/managedhsmkeys_client.go rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_managedhsms_client.go => managedhsms_client.go} (80%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_mhsmprivateendpointconnections_client.go => mhsmprivateendpointconnections_client.go} (86%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_mhsmprivatelinkresources_client.go => mhsmprivatelinkresources_client.go} (86%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_models.go => models.go} (84%) create mode 100644 sdk/resourcemanager/keyvault/armkeyvault/models_serde.go rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_operations_client.go => operations_client.go} (89%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_privateendpointconnections_client.go => privateendpointconnections_client.go} (86%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_privatelinkresources_client.go => privatelinkresources_client.go} (86%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_response_types.go => response_types.go} (77%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_secrets_client.go => secrets_client.go} (86%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_time_rfc3339.go => time_rfc3339.go} (96%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_time_unix.go => time_unix.go} (94%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_vaults_client.go => vaults_client.go} (87%) delete mode 100644 sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_keys_client_test.go delete mode 100644 sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_managedhsms_client_test.go delete mode 100644 sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_mhsmprivateendpointconnections_client_test.go delete mode 100644 sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_mhsmprivatelinkresources_client_test.go delete mode 100644 sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_operations_client_test.go delete mode 100644 sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_privateendpointconnections_client_test.go delete mode 100644 sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_privatelinkresources_client_test.go delete mode 100644 sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_secrets_client_test.go delete mode 100644 sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_vaults_client_test.go delete mode 100644 sdk/resourcemanager/keyvault/armkeyvault/zz_generated_models_serde.go diff --git a/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md b/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md index 5961104a444f..aa29d03bcf6a 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md +++ b/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md @@ -1,27 +1,53 @@ # Release History -## 1.1.0-beta.1 (2022-05-19) +## 2.0.0 (2023-02-03) +### Breaking Changes + +- Struct `CloudError` has been removed +- Struct `CloudErrorBody` has been removed + ### Features Added -- New const `KeyRotationPolicyActionTypeNotify` -- New const `JSONWebKeyOperationRelease` -- New const `KeyRotationPolicyActionTypeRotate` -- New const `KeyPermissionsRotate` -- New const `KeyPermissionsRelease` -- New const `KeyPermissionsSetrotationpolicy` -- New const `KeyPermissionsGetrotationpolicy` -- New function `PossibleKeyRotationPolicyActionTypeValues() []KeyRotationPolicyActionType` -- New function `*KeyReleasePolicy.UnmarshalJSON([]byte) error` -- New function `KeyReleasePolicy.MarshalJSON() ([]byte, error)` -- New function `RotationPolicy.MarshalJSON() ([]byte, error)` +- New value `JSONWebKeyOperationRelease` added to type alias `JSONWebKeyOperation` +- New value `KeyPermissionsGetrotationpolicy`, `KeyPermissionsRelease`, `KeyPermissionsRotate`, `KeyPermissionsSetrotationpolicy` added to type alias `KeyPermissions` +- New type alias `ActivationStatus` with values `ActivationStatusActive`, `ActivationStatusFailed`, `ActivationStatusNotActivated`, `ActivationStatusUnknown` +- New type alias `KeyRotationPolicyActionType` with values `KeyRotationPolicyActionTypeNotify`, `KeyRotationPolicyActionTypeRotate` +- New function `NewManagedHsmKeysClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ManagedHsmKeysClient, error)` +- New function `*ManagedHsmKeysClient.CreateIfNotExist(context.Context, string, string, string, ManagedHsmKeyCreateParameters, *ManagedHsmKeysClientCreateIfNotExistOptions) (ManagedHsmKeysClientCreateIfNotExistResponse, error)` +- New function `*ManagedHsmKeysClient.Get(context.Context, string, string, string, *ManagedHsmKeysClientGetOptions) (ManagedHsmKeysClientGetResponse, error)` +- New function `*ManagedHsmKeysClient.GetVersion(context.Context, string, string, string, string, *ManagedHsmKeysClientGetVersionOptions) (ManagedHsmKeysClientGetVersionResponse, error)` +- New function `*ManagedHsmKeysClient.NewListPager(string, string, *ManagedHsmKeysClientListOptions) *runtime.Pager[ManagedHsmKeysClientListResponse]` +- New function `*ManagedHsmKeysClient.NewListVersionsPager(string, string, string, *ManagedHsmKeysClientListVersionsOptions) *runtime.Pager[ManagedHsmKeysClientListVersionsResponse]` +- New function `*ManagedHsmsClient.CheckMhsmNameAvailability(context.Context, CheckMhsmNameAvailabilityParameters, *ManagedHsmsClientCheckMhsmNameAvailabilityOptions) (ManagedHsmsClientCheckMhsmNameAvailabilityResponse, error)` - New struct `Action` +- New struct `CheckMhsmNameAvailabilityParameters` +- New struct `CheckMhsmNameAvailabilityResult` - New struct `KeyReleasePolicy` - New struct `KeyRotationPolicyAttributes` - New struct `LifetimeAction` +- New struct `ManagedHSMSecurityDomainProperties` +- New struct `ManagedHsmAction` +- New struct `ManagedHsmKey` +- New struct `ManagedHsmKeyAttributes` +- New struct `ManagedHsmKeyCreateParameters` +- New struct `ManagedHsmKeyListResult` +- New struct `ManagedHsmKeyProperties` +- New struct `ManagedHsmKeyReleasePolicy` +- New struct `ManagedHsmKeyRotationPolicyAttributes` +- New struct `ManagedHsmKeysClient` +- New struct `ManagedHsmKeysClientListResponse` +- New struct `ManagedHsmKeysClientListVersionsResponse` +- New struct `ManagedHsmLifetimeAction` +- New struct `ManagedHsmRotationPolicy` +- New struct `ManagedHsmTrigger` +- New struct `ProxyResourceWithoutSystemData` - New struct `RotationPolicy` - New struct `Trigger` - New field `ReleasePolicy` in struct `KeyProperties` - New field `RotationPolicy` in struct `KeyProperties` +- New field `Etag` in struct `MHSMPrivateEndpointConnectionItem` +- New field `ID` in struct `MHSMPrivateEndpointConnectionItem` +- New field `SecurityDomainProperties` in struct `ManagedHsmProperties` ## 1.0.0 (2022-05-16) diff --git a/sdk/resourcemanager/keyvault/armkeyvault/autorest.md b/sdk/resourcemanager/keyvault/armkeyvault/autorest.md index bb4f02c95677..9efc0ab5f00a 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/autorest.md +++ b/sdk/resourcemanager/keyvault/armkeyvault/autorest.md @@ -5,10 +5,10 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/2f2b633d940230cbbd5bcf1339a2e1c48674e4a2/specification/keyvault/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/2f2b633d940230cbbd5bcf1339a2e1c48674e4a2/specification/keyvault/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/keyvault/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/keyvault/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.0-beta.1 +module-version: 2.0.0 modelerfour: seal-single-value-enum-by-default: true ``` \ No newline at end of file diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_constants.go b/sdk/resourcemanager/keyvault/armkeyvault/constants.go similarity index 95% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_constants.go rename to sdk/resourcemanager/keyvault/armkeyvault/constants.go index a0d8d142ce87..6c134bfe7f9e 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_constants.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/constants.go @@ -5,12 +5,13 @@ // 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 armkeyvault const ( moduleName = "armkeyvault" - moduleVersion = "v1.1.0-beta.1" + moduleVersion = "v2.0.0" ) type AccessPolicyUpdateKind string @@ -44,6 +45,30 @@ func PossibleActionsRequiredValues() []ActionsRequired { } } +// ActivationStatus - Activation Status +type ActivationStatus string + +const ( + // ActivationStatusActive - The managed HSM Pool is active. + ActivationStatusActive ActivationStatus = "Active" + // ActivationStatusFailed - Failed to activate managed hsm. + ActivationStatusFailed ActivationStatus = "Failed" + // ActivationStatusNotActivated - The managed HSM Pool is not yet activated. + ActivationStatusNotActivated ActivationStatus = "NotActivated" + // ActivationStatusUnknown - An unknown error occurred while activating managed hsm. + ActivationStatusUnknown ActivationStatus = "Unknown" +) + +// PossibleActivationStatusValues returns the possible values for the ActivationStatus const type. +func PossibleActivationStatusValues() []ActivationStatus { + return []ActivationStatus{ + ActivationStatusActive, + ActivationStatusFailed, + ActivationStatusNotActivated, + ActivationStatusUnknown, + } +} + type CertificatePermissions string const ( diff --git a/sdk/resourcemanager/keyvault/armkeyvault/go.mod b/sdk/resourcemanager/keyvault/armkeyvault/go.mod index e114102521c0..dbe0133a31d4 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/go.mod +++ b/sdk/resourcemanager/keyvault/armkeyvault/go.mod @@ -1,15 +1,15 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/v2 go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.0.0 github.com/stretchr/testify v1.7.0 ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_keys_client.go b/sdk/resourcemanager/keyvault/armkeyvault/keys_client.go similarity index 84% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_keys_client.go rename to sdk/resourcemanager/keyvault/armkeyvault/keys_client.go index 5799f3cbddb9..2c1fd094ce65 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_keys_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/keys_client.go @@ -5,6 +5,7 @@ // 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 armkeyvault @@ -31,10 +32,10 @@ type KeysClient struct { } // NewKeysClient creates a new instance of KeysClient with the specified values. -// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*KeysClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -59,12 +60,15 @@ func NewKeysClient(subscriptionID string, credential azcore.TokenCredential, opt // key is returned without any write operations being performed. This API does not create subsequent // versions, and does not update existing keys. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - The name of the resource group which contains the specified key vault. -// vaultName - The name of the key vault which contains the key to be created. -// keyName - The name of the key to be created. -// parameters - The parameters used to create the specified key. -// options - KeysClientCreateIfNotExistOptions contains the optional parameters for the KeysClient.CreateIfNotExist method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group which contains the specified key vault. +// - vaultName - The name of the key vault which contains the key to be created. +// - keyName - The name of the key to be created. The value you provide may be copied globally for the purpose of running the +// service. The value provided should not include personally identifiable or sensitive +// information. +// - parameters - The parameters used to create the specified key. +// - options - KeysClientCreateIfNotExistOptions contains the optional parameters for the KeysClient.CreateIfNotExist method. func (client *KeysClient) CreateIfNotExist(ctx context.Context, resourceGroupName string, vaultName string, keyName string, parameters KeyCreateParameters, options *KeysClientCreateIfNotExistOptions) (KeysClientCreateIfNotExistResponse, error) { req, err := client.createIfNotExistCreateRequest(ctx, resourceGroupName, vaultName, keyName, parameters, options) if err != nil { @@ -104,7 +108,7 @@ func (client *KeysClient) createIfNotExistCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -121,11 +125,12 @@ func (client *KeysClient) createIfNotExistHandleResponse(resp *http.Response) (K // Get - Gets the current version of the specified key from the specified key vault. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - The name of the resource group which contains the specified key vault. -// vaultName - The name of the vault which contains the key to be retrieved. -// keyName - The name of the key to be retrieved. -// options - KeysClientGetOptions contains the optional parameters for the KeysClient.Get method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group which contains the specified key vault. +// - vaultName - The name of the vault which contains the key to be retrieved. +// - keyName - The name of the key to be retrieved. +// - options - KeysClientGetOptions contains the optional parameters for the KeysClient.Get method. func (client *KeysClient) Get(ctx context.Context, resourceGroupName string, vaultName string, keyName string, options *KeysClientGetOptions) (KeysClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, keyName, options) if err != nil { @@ -165,7 +170,7 @@ func (client *KeysClient) getCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,12 +187,13 @@ func (client *KeysClient) getHandleResponse(resp *http.Response) (KeysClientGetR // GetVersion - Gets the specified version of the specified key in the specified key vault. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - The name of the resource group which contains the specified key vault. -// vaultName - The name of the vault which contains the key version to be retrieved. -// keyName - The name of the key version to be retrieved. -// keyVersion - The version of the key to be retrieved. -// options - KeysClientGetVersionOptions contains the optional parameters for the KeysClient.GetVersion method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group which contains the specified key vault. +// - vaultName - The name of the vault which contains the key version to be retrieved. +// - keyName - The name of the key version to be retrieved. +// - keyVersion - The version of the key to be retrieved. +// - options - KeysClientGetVersionOptions contains the optional parameters for the KeysClient.GetVersion method. func (client *KeysClient) GetVersion(ctx context.Context, resourceGroupName string, vaultName string, keyName string, keyVersion string, options *KeysClientGetVersionOptions) (KeysClientGetVersionResponse, error) { req, err := client.getVersionCreateRequest(ctx, resourceGroupName, vaultName, keyName, keyVersion, options) if err != nil { @@ -231,7 +237,7 @@ func (client *KeysClient) getVersionCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -247,11 +253,11 @@ func (client *KeysClient) getVersionHandleResponse(resp *http.Response) (KeysCli } // NewListPager - Lists the keys in the specified key vault. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - The name of the resource group which contains the specified key vault. -// vaultName - The name of the vault which contains the keys to be retrieved. -// options - KeysClientListOptions contains the optional parameters for the KeysClient.List method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group which contains the specified key vault. +// - vaultName - The name of the vault which contains the keys to be retrieved. +// - options - KeysClientListOptions contains the optional parameters for the KeysClient.NewListPager method. func (client *KeysClient) NewListPager(resourceGroupName string, vaultName string, options *KeysClientListOptions) *runtime.Pager[KeysClientListResponse] { return runtime.NewPager(runtime.PagingHandler[KeysClientListResponse]{ More: func(page KeysClientListResponse) bool { @@ -300,7 +306,7 @@ func (client *KeysClient) listCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -316,12 +322,12 @@ func (client *KeysClient) listHandleResponse(resp *http.Response) (KeysClientLis } // NewListVersionsPager - Lists the versions of the specified key in the specified key vault. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - The name of the resource group which contains the specified key vault. -// vaultName - The name of the vault which contains the key versions to be retrieved. -// keyName - The name of the key versions to be retrieved. -// options - KeysClientListVersionsOptions contains the optional parameters for the KeysClient.ListVersions method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group which contains the specified key vault. +// - vaultName - The name of the vault which contains the key versions to be retrieved. +// - keyName - The name of the key versions to be retrieved. +// - options - KeysClientListVersionsOptions contains the optional parameters for the KeysClient.NewListVersionsPager method. func (client *KeysClient) NewListVersionsPager(resourceGroupName string, vaultName string, keyName string, options *KeysClientListVersionsOptions) *runtime.Pager[KeysClientListVersionsResponse] { return runtime.NewPager(runtime.PagingHandler[KeysClientListVersionsResponse]{ More: func(page KeysClientListVersionsResponse) bool { @@ -374,7 +380,7 @@ func (client *KeysClient) listVersionsCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/keyvault/armkeyvault/managedhsmkeys_client.go b/sdk/resourcemanager/keyvault/armkeyvault/managedhsmkeys_client.go new file mode 100644 index 000000000000..5990e687876a --- /dev/null +++ b/sdk/resourcemanager/keyvault/armkeyvault/managedhsmkeys_client.go @@ -0,0 +1,405 @@ +//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 armkeyvault + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ManagedHsmKeysClient contains the methods for the ManagedHsmKeys group. +// Don't use this type directly, use NewManagedHsmKeysClient() instead. +type ManagedHsmKeysClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewManagedHsmKeysClient creates a new instance of ManagedHsmKeysClient with the specified values. +// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewManagedHsmKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedHsmKeysClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ManagedHsmKeysClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateIfNotExist - Creates the first version of a new key if it does not exist. If it already exists, then the existing +// key is returned without any write operations being performed. This API does not create subsequent +// versions, and does not update existing keys. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - name - The name of the Managed HSM Pool within the specified resource group. +// - keyName - The name of the key to be created. The value you provide may be copied globally for the purpose of running the +// service. The value provided should not include personally identifiable or sensitive +// information. +// - parameters - The parameters used to create the specified key. +// - options - ManagedHsmKeysClientCreateIfNotExistOptions contains the optional parameters for the ManagedHsmKeysClient.CreateIfNotExist +// method. +func (client *ManagedHsmKeysClient) CreateIfNotExist(ctx context.Context, resourceGroupName string, name string, keyName string, parameters ManagedHsmKeyCreateParameters, options *ManagedHsmKeysClientCreateIfNotExistOptions) (ManagedHsmKeysClientCreateIfNotExistResponse, error) { + req, err := client.createIfNotExistCreateRequest(ctx, resourceGroupName, name, keyName, parameters, options) + if err != nil { + return ManagedHsmKeysClientCreateIfNotExistResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedHsmKeysClientCreateIfNotExistResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedHsmKeysClientCreateIfNotExistResponse{}, runtime.NewResponseError(resp) + } + return client.createIfNotExistHandleResponse(resp) +} + +// createIfNotExistCreateRequest creates the CreateIfNotExist request. +func (client *ManagedHsmKeysClient) createIfNotExistCreateRequest(ctx context.Context, resourceGroupName string, name string, keyName string, parameters ManagedHsmKeyCreateParameters, options *ManagedHsmKeysClientCreateIfNotExistOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if keyName == "" { + return nil, errors.New("parameter keyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{keyName}", url.PathEscape(keyName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createIfNotExistHandleResponse handles the CreateIfNotExist response. +func (client *ManagedHsmKeysClient) createIfNotExistHandleResponse(resp *http.Response) (ManagedHsmKeysClientCreateIfNotExistResponse, error) { + result := ManagedHsmKeysClientCreateIfNotExistResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedHsmKey); err != nil { + return ManagedHsmKeysClientCreateIfNotExistResponse{}, err + } + return result, nil +} + +// Get - Gets the current version of the specified key from the specified managed HSM. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - name - The name of the Managed HSM Pool within the specified resource group. +// - keyName - The name of the key to be created. The value you provide may be copied globally for the purpose of running the +// service. The value provided should not include personally identifiable or sensitive +// information. +// - options - ManagedHsmKeysClientGetOptions contains the optional parameters for the ManagedHsmKeysClient.Get method. +func (client *ManagedHsmKeysClient) Get(ctx context.Context, resourceGroupName string, name string, keyName string, options *ManagedHsmKeysClientGetOptions) (ManagedHsmKeysClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, name, keyName, options) + if err != nil { + return ManagedHsmKeysClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedHsmKeysClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedHsmKeysClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ManagedHsmKeysClient) getCreateRequest(ctx context.Context, resourceGroupName string, name string, keyName string, options *ManagedHsmKeysClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if keyName == "" { + return nil, errors.New("parameter keyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{keyName}", url.PathEscape(keyName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ManagedHsmKeysClient) getHandleResponse(resp *http.Response) (ManagedHsmKeysClientGetResponse, error) { + result := ManagedHsmKeysClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedHsmKey); err != nil { + return ManagedHsmKeysClientGetResponse{}, err + } + return result, nil +} + +// GetVersion - Gets the specified version of the specified key in the specified managed HSM. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - name - The name of the Managed HSM Pool within the specified resource group. +// - keyName - The name of the key to be created. The value you provide may be copied globally for the purpose of running the +// service. The value provided should not include personally identifiable or sensitive +// information. +// - keyVersion - The version of the key to be retrieved. +// - options - ManagedHsmKeysClientGetVersionOptions contains the optional parameters for the ManagedHsmKeysClient.GetVersion +// method. +func (client *ManagedHsmKeysClient) GetVersion(ctx context.Context, resourceGroupName string, name string, keyName string, keyVersion string, options *ManagedHsmKeysClientGetVersionOptions) (ManagedHsmKeysClientGetVersionResponse, error) { + req, err := client.getVersionCreateRequest(ctx, resourceGroupName, name, keyName, keyVersion, options) + if err != nil { + return ManagedHsmKeysClientGetVersionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedHsmKeysClientGetVersionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedHsmKeysClientGetVersionResponse{}, runtime.NewResponseError(resp) + } + return client.getVersionHandleResponse(resp) +} + +// getVersionCreateRequest creates the GetVersion request. +func (client *ManagedHsmKeysClient) getVersionCreateRequest(ctx context.Context, resourceGroupName string, name string, keyName string, keyVersion string, options *ManagedHsmKeysClientGetVersionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions/{keyVersion}" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if keyName == "" { + return nil, errors.New("parameter keyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{keyName}", url.PathEscape(keyName)) + if keyVersion == "" { + return nil, errors.New("parameter keyVersion cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{keyVersion}", url.PathEscape(keyVersion)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getVersionHandleResponse handles the GetVersion response. +func (client *ManagedHsmKeysClient) getVersionHandleResponse(resp *http.Response) (ManagedHsmKeysClientGetVersionResponse, error) { + result := ManagedHsmKeysClientGetVersionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedHsmKey); err != nil { + return ManagedHsmKeysClientGetVersionResponse{}, err + } + return result, nil +} + +// NewListPager - Lists the keys in the specified managed HSM. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - name - The name of the Managed HSM Pool within the specified resource group. +// - options - ManagedHsmKeysClientListOptions contains the optional parameters for the ManagedHsmKeysClient.NewListPager method. +func (client *ManagedHsmKeysClient) NewListPager(resourceGroupName string, name string, options *ManagedHsmKeysClientListOptions) *runtime.Pager[ManagedHsmKeysClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedHsmKeysClientListResponse]{ + More: func(page ManagedHsmKeysClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedHsmKeysClientListResponse) (ManagedHsmKeysClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, name, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagedHsmKeysClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedHsmKeysClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedHsmKeysClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ManagedHsmKeysClient) listCreateRequest(ctx context.Context, resourceGroupName string, name string, options *ManagedHsmKeysClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ManagedHsmKeysClient) listHandleResponse(resp *http.Response) (ManagedHsmKeysClientListResponse, error) { + result := ManagedHsmKeysClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedHsmKeyListResult); err != nil { + return ManagedHsmKeysClientListResponse{}, err + } + return result, nil +} + +// NewListVersionsPager - Lists the versions of the specified key in the specified managed HSM. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - name - The name of the Managed HSM Pool within the specified resource group. +// - keyName - The name of the key to be created. The value you provide may be copied globally for the purpose of running the +// service. The value provided should not include personally identifiable or sensitive +// information. +// - options - ManagedHsmKeysClientListVersionsOptions contains the optional parameters for the ManagedHsmKeysClient.NewListVersionsPager +// method. +func (client *ManagedHsmKeysClient) NewListVersionsPager(resourceGroupName string, name string, keyName string, options *ManagedHsmKeysClientListVersionsOptions) *runtime.Pager[ManagedHsmKeysClientListVersionsResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedHsmKeysClientListVersionsResponse]{ + More: func(page ManagedHsmKeysClientListVersionsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedHsmKeysClientListVersionsResponse) (ManagedHsmKeysClientListVersionsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listVersionsCreateRequest(ctx, resourceGroupName, name, keyName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagedHsmKeysClientListVersionsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedHsmKeysClientListVersionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedHsmKeysClientListVersionsResponse{}, runtime.NewResponseError(resp) + } + return client.listVersionsHandleResponse(resp) + }, + }) +} + +// listVersionsCreateRequest creates the ListVersions request. +func (client *ManagedHsmKeysClient) listVersionsCreateRequest(ctx context.Context, resourceGroupName string, name string, keyName string, options *ManagedHsmKeysClientListVersionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions" + 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 name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if keyName == "" { + return nil, errors.New("parameter keyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{keyName}", url.PathEscape(keyName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listVersionsHandleResponse handles the ListVersions response. +func (client *ManagedHsmKeysClient) listVersionsHandleResponse(resp *http.Response) (ManagedHsmKeysClientListVersionsResponse, error) { + result := ManagedHsmKeysClientListVersionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedHsmKeyListResult); err != nil { + return ManagedHsmKeysClientListVersionsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_managedhsms_client.go b/sdk/resourcemanager/keyvault/armkeyvault/managedhsms_client.go similarity index 80% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_managedhsms_client.go rename to sdk/resourcemanager/keyvault/armkeyvault/managedhsms_client.go index cb2fc5e28deb..da8e365bed23 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_managedhsms_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/managedhsms_client.go @@ -5,6 +5,7 @@ // 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 armkeyvault @@ -32,10 +33,10 @@ type ManagedHsmsClient struct { } // NewManagedHsmsClient creates a new instance of ManagedHsmsClient with the specified values. -// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewManagedHsmsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedHsmsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -56,14 +57,64 @@ func NewManagedHsmsClient(subscriptionID string, credential azcore.TokenCredenti return client, nil } +// CheckMhsmNameAvailability - Checks that the managed hsm name is valid and is not already in use. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01 +// - mhsmName - The name of the managed hsm. +// - options - ManagedHsmsClientCheckMhsmNameAvailabilityOptions contains the optional parameters for the ManagedHsmsClient.CheckMhsmNameAvailability +// method. +func (client *ManagedHsmsClient) CheckMhsmNameAvailability(ctx context.Context, mhsmName CheckMhsmNameAvailabilityParameters, options *ManagedHsmsClientCheckMhsmNameAvailabilityOptions) (ManagedHsmsClientCheckMhsmNameAvailabilityResponse, error) { + req, err := client.checkMhsmNameAvailabilityCreateRequest(ctx, mhsmName, options) + if err != nil { + return ManagedHsmsClientCheckMhsmNameAvailabilityResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedHsmsClientCheckMhsmNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedHsmsClientCheckMhsmNameAvailabilityResponse{}, runtime.NewResponseError(resp) + } + return client.checkMhsmNameAvailabilityHandleResponse(resp) +} + +// checkMhsmNameAvailabilityCreateRequest creates the CheckMhsmNameAvailability request. +func (client *ManagedHsmsClient) checkMhsmNameAvailabilityCreateRequest(ctx context.Context, mhsmName CheckMhsmNameAvailabilityParameters, options *ManagedHsmsClientCheckMhsmNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkMhsmNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, mhsmName) +} + +// checkMhsmNameAvailabilityHandleResponse handles the CheckMhsmNameAvailability response. +func (client *ManagedHsmsClient) checkMhsmNameAvailabilityHandleResponse(resp *http.Response) (ManagedHsmsClientCheckMhsmNameAvailabilityResponse, error) { + result := ManagedHsmsClientCheckMhsmNameAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckMhsmNameAvailabilityResult); err != nil { + return ManagedHsmsClientCheckMhsmNameAvailabilityResponse{}, err + } + return result, nil +} + // BeginCreateOrUpdate - Create or update a managed HSM Pool in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - Name of the resource group that contains the managed HSM pool. -// name - Name of the managed HSM Pool -// parameters - Parameters to create or update the managed HSM Pool -// options - ManagedHsmsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedHsmsClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - Name of the resource group that contains the managed HSM pool. +// - name - Name of the managed HSM Pool +// - parameters - Parameters to create or update the managed HSM Pool +// - options - ManagedHsmsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedHsmsClient.BeginCreateOrUpdate +// method. func (client *ManagedHsmsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, name string, parameters ManagedHsm, options *ManagedHsmsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ManagedHsmsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, name, parameters, options) @@ -78,7 +129,8 @@ func (client *ManagedHsmsClient) BeginCreateOrUpdate(ctx context.Context, resour // CreateOrUpdate - Create or update a managed HSM Pool in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// +// Generated from API version 2022-11-01 func (client *ManagedHsmsClient) createOrUpdate(ctx context.Context, resourceGroupName string, name string, parameters ManagedHsm, options *ManagedHsmsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, name, parameters, options) if err != nil { @@ -114,7 +166,7 @@ func (client *ManagedHsmsClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -122,10 +174,11 @@ func (client *ManagedHsmsClient) createOrUpdateCreateRequest(ctx context.Context // BeginDelete - Deletes the specified managed HSM Pool. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - Name of the resource group that contains the managed HSM pool. -// name - The name of the managed HSM Pool to delete -// options - ManagedHsmsClientBeginDeleteOptions contains the optional parameters for the ManagedHsmsClient.BeginDelete method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - Name of the resource group that contains the managed HSM pool. +// - name - The name of the managed HSM Pool to delete +// - options - ManagedHsmsClientBeginDeleteOptions contains the optional parameters for the ManagedHsmsClient.BeginDelete method. func (client *ManagedHsmsClient) BeginDelete(ctx context.Context, resourceGroupName string, name string, options *ManagedHsmsClientBeginDeleteOptions) (*runtime.Poller[ManagedHsmsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, name, options) @@ -140,7 +193,8 @@ func (client *ManagedHsmsClient) BeginDelete(ctx context.Context, resourceGroupN // Delete - Deletes the specified managed HSM Pool. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// +// Generated from API version 2022-11-01 func (client *ManagedHsmsClient) deleteOperation(ctx context.Context, resourceGroupName string, name string, options *ManagedHsmsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, name, options) if err != nil { @@ -176,7 +230,7 @@ func (client *ManagedHsmsClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -184,10 +238,11 @@ func (client *ManagedHsmsClient) deleteCreateRequest(ctx context.Context, resour // Get - Gets the specified managed HSM Pool. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - Name of the resource group that contains the managed HSM pool. -// name - The name of the managed HSM Pool. -// options - ManagedHsmsClientGetOptions contains the optional parameters for the ManagedHsmsClient.Get method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - Name of the resource group that contains the managed HSM pool. +// - name - The name of the managed HSM Pool. +// - options - ManagedHsmsClientGetOptions contains the optional parameters for the ManagedHsmsClient.Get method. func (client *ManagedHsmsClient) Get(ctx context.Context, resourceGroupName string, name string, options *ManagedHsmsClientGetOptions) (ManagedHsmsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, name, options) if err != nil { @@ -197,7 +252,7 @@ func (client *ManagedHsmsClient) Get(ctx context.Context, resourceGroupName stri if err != nil { return ManagedHsmsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return ManagedHsmsClientGetResponse{}, runtime.NewResponseError(resp) } return client.getHandleResponse(resp) @@ -223,7 +278,7 @@ func (client *ManagedHsmsClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -240,10 +295,11 @@ func (client *ManagedHsmsClient) getHandleResponse(resp *http.Response) (Managed // GetDeleted - Gets the specified deleted managed HSM. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// name - The name of the deleted managed HSM. -// location - The location of the deleted managed HSM. -// options - ManagedHsmsClientGetDeletedOptions contains the optional parameters for the ManagedHsmsClient.GetDeleted method. +// +// Generated from API version 2022-11-01 +// - name - The name of the deleted managed HSM. +// - location - The location of the deleted managed HSM. +// - options - ManagedHsmsClientGetDeletedOptions contains the optional parameters for the ManagedHsmsClient.GetDeleted method. func (client *ManagedHsmsClient) GetDeleted(ctx context.Context, name string, location string, options *ManagedHsmsClientGetDeletedOptions) (ManagedHsmsClientGetDeletedResponse, error) { req, err := client.getDeletedCreateRequest(ctx, name, location, options) if err != nil { @@ -279,7 +335,7 @@ func (client *ManagedHsmsClient) getDeletedCreateRequest(ctx context.Context, na return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -296,11 +352,11 @@ func (client *ManagedHsmsClient) getDeletedHandleResponse(resp *http.Response) ( // NewListByResourceGroupPager - The List operation gets information about the managed HSM Pools associated with the subscription // and within the specified resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - Name of the resource group that contains the managed HSM pool. -// options - ManagedHsmsClientListByResourceGroupOptions contains the optional parameters for the ManagedHsmsClient.ListByResourceGroup -// method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - Name of the resource group that contains the managed HSM pool. +// - options - ManagedHsmsClientListByResourceGroupOptions contains the optional parameters for the ManagedHsmsClient.NewListByResourceGroupPager +// method. func (client *ManagedHsmsClient) NewListByResourceGroupPager(resourceGroupName string, options *ManagedHsmsClientListByResourceGroupOptions) *runtime.Pager[ManagedHsmsClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[ManagedHsmsClientListByResourceGroupResponse]{ More: func(page ManagedHsmsClientListByResourceGroupResponse) bool { @@ -348,7 +404,7 @@ func (client *ManagedHsmsClient) listByResourceGroupCreateRequest(ctx context.Co if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -364,10 +420,10 @@ func (client *ManagedHsmsClient) listByResourceGroupHandleResponse(resp *http.Re } // NewListBySubscriptionPager - The List operation gets information about the managed HSM Pools associated with the subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// options - ManagedHsmsClientListBySubscriptionOptions contains the optional parameters for the ManagedHsmsClient.ListBySubscription -// method. +// +// Generated from API version 2022-11-01 +// - options - ManagedHsmsClientListBySubscriptionOptions contains the optional parameters for the ManagedHsmsClient.NewListBySubscriptionPager +// method. func (client *ManagedHsmsClient) NewListBySubscriptionPager(options *ManagedHsmsClientListBySubscriptionOptions) *runtime.Pager[ManagedHsmsClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[ManagedHsmsClientListBySubscriptionResponse]{ More: func(page ManagedHsmsClientListBySubscriptionResponse) bool { @@ -411,7 +467,7 @@ func (client *ManagedHsmsClient) listBySubscriptionCreateRequest(ctx context.Con if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -427,9 +483,10 @@ func (client *ManagedHsmsClient) listBySubscriptionHandleResponse(resp *http.Res } // NewListDeletedPager - The List operation gets information about the deleted managed HSMs associated with the subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// options - ManagedHsmsClientListDeletedOptions contains the optional parameters for the ManagedHsmsClient.ListDeleted method. +// +// Generated from API version 2022-11-01 +// - options - ManagedHsmsClientListDeletedOptions contains the optional parameters for the ManagedHsmsClient.NewListDeletedPager +// method. func (client *ManagedHsmsClient) NewListDeletedPager(options *ManagedHsmsClientListDeletedOptions) *runtime.Pager[ManagedHsmsClientListDeletedResponse] { return runtime.NewPager(runtime.PagingHandler[ManagedHsmsClientListDeletedResponse]{ More: func(page ManagedHsmsClientListDeletedResponse) bool { @@ -470,7 +527,7 @@ func (client *ManagedHsmsClient) listDeletedCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -487,11 +544,12 @@ func (client *ManagedHsmsClient) listDeletedHandleResponse(resp *http.Response) // BeginPurgeDeleted - Permanently deletes the specified managed HSM. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// name - The name of the soft-deleted managed HSM. -// location - The location of the soft-deleted managed HSM. -// options - ManagedHsmsClientBeginPurgeDeletedOptions contains the optional parameters for the ManagedHsmsClient.BeginPurgeDeleted -// method. +// +// Generated from API version 2022-11-01 +// - name - The name of the soft-deleted managed HSM. +// - location - The location of the soft-deleted managed HSM. +// - options - ManagedHsmsClientBeginPurgeDeletedOptions contains the optional parameters for the ManagedHsmsClient.BeginPurgeDeleted +// method. func (client *ManagedHsmsClient) BeginPurgeDeleted(ctx context.Context, name string, location string, options *ManagedHsmsClientBeginPurgeDeletedOptions) (*runtime.Poller[ManagedHsmsClientPurgeDeletedResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.purgeDeleted(ctx, name, location, options) @@ -506,7 +564,8 @@ func (client *ManagedHsmsClient) BeginPurgeDeleted(ctx context.Context, name str // PurgeDeleted - Permanently deletes the specified managed HSM. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// +// Generated from API version 2022-11-01 func (client *ManagedHsmsClient) purgeDeleted(ctx context.Context, name string, location string, options *ManagedHsmsClientBeginPurgeDeletedOptions) (*http.Response, error) { req, err := client.purgeDeletedCreateRequest(ctx, name, location, options) if err != nil { @@ -542,7 +601,7 @@ func (client *ManagedHsmsClient) purgeDeletedCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -550,11 +609,12 @@ func (client *ManagedHsmsClient) purgeDeletedCreateRequest(ctx context.Context, // BeginUpdate - Update a managed HSM Pool in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - Name of the resource group that contains the managed HSM pool. -// name - Name of the managed HSM Pool -// parameters - Parameters to patch the managed HSM Pool -// options - ManagedHsmsClientBeginUpdateOptions contains the optional parameters for the ManagedHsmsClient.BeginUpdate method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - Name of the resource group that contains the managed HSM pool. +// - name - Name of the managed HSM Pool +// - parameters - Parameters to patch the managed HSM Pool +// - options - ManagedHsmsClientBeginUpdateOptions contains the optional parameters for the ManagedHsmsClient.BeginUpdate method. func (client *ManagedHsmsClient) BeginUpdate(ctx context.Context, resourceGroupName string, name string, parameters ManagedHsm, options *ManagedHsmsClientBeginUpdateOptions) (*runtime.Poller[ManagedHsmsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.update(ctx, resourceGroupName, name, parameters, options) @@ -569,7 +629,8 @@ func (client *ManagedHsmsClient) BeginUpdate(ctx context.Context, resourceGroupN // Update - Update a managed HSM Pool in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// +// Generated from API version 2022-11-01 func (client *ManagedHsmsClient) update(ctx context.Context, resourceGroupName string, name string, parameters ManagedHsm, options *ManagedHsmsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, name, parameters, options) if err != nil { @@ -605,7 +666,7 @@ func (client *ManagedHsmsClient) updateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_mhsmprivateendpointconnections_client.go b/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivateendpointconnections_client.go similarity index 86% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_mhsmprivateendpointconnections_client.go rename to sdk/resourcemanager/keyvault/armkeyvault/mhsmprivateendpointconnections_client.go index f161f1d181f6..20b34d7140bd 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_mhsmprivateendpointconnections_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivateendpointconnections_client.go @@ -5,6 +5,7 @@ // 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 armkeyvault @@ -32,10 +33,10 @@ type MHSMPrivateEndpointConnectionsClient struct { } // NewMHSMPrivateEndpointConnectionsClient creates a new instance of MHSMPrivateEndpointConnectionsClient with the specified values. -// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewMHSMPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MHSMPrivateEndpointConnectionsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -58,12 +59,13 @@ func NewMHSMPrivateEndpointConnectionsClient(subscriptionID string, credential a // BeginDelete - Deletes the specified private endpoint connection associated with the managed hsm pool. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - Name of the resource group that contains the managed HSM pool. -// name - Name of the managed HSM Pool -// privateEndpointConnectionName - Name of the private endpoint connection associated with the managed hsm pool. -// options - MHSMPrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.BeginDelete -// method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - Name of the resource group that contains the managed HSM pool. +// - name - Name of the managed HSM Pool +// - privateEndpointConnectionName - Name of the private endpoint connection associated with the managed hsm pool. +// - options - MHSMPrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.BeginDelete +// method. func (client *MHSMPrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, options *MHSMPrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[MHSMPrivateEndpointConnectionsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, name, privateEndpointConnectionName, options) @@ -78,7 +80,8 @@ func (client *MHSMPrivateEndpointConnectionsClient) BeginDelete(ctx context.Cont // Delete - Deletes the specified private endpoint connection associated with the managed hsm pool. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// +// Generated from API version 2022-11-01 func (client *MHSMPrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, options *MHSMPrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, name, privateEndpointConnectionName, options) if err != nil { @@ -118,7 +121,7 @@ func (client *MHSMPrivateEndpointConnectionsClient) deleteCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -126,12 +129,13 @@ func (client *MHSMPrivateEndpointConnectionsClient) deleteCreateRequest(ctx cont // Get - Gets the specified private endpoint connection associated with the managed HSM Pool. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - Name of the resource group that contains the managed HSM pool. -// name - Name of the managed HSM Pool -// privateEndpointConnectionName - Name of the private endpoint connection associated with the managed hsm pool. -// options - MHSMPrivateEndpointConnectionsClientGetOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.Get -// method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - Name of the resource group that contains the managed HSM pool. +// - name - Name of the managed HSM Pool +// - privateEndpointConnectionName - Name of the private endpoint connection associated with the managed hsm pool. +// - options - MHSMPrivateEndpointConnectionsClientGetOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.Get +// method. func (client *MHSMPrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, options *MHSMPrivateEndpointConnectionsClientGetOptions) (MHSMPrivateEndpointConnectionsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, name, privateEndpointConnectionName, options) if err != nil { @@ -171,7 +175,7 @@ func (client *MHSMPrivateEndpointConnectionsClient) getCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,12 +192,12 @@ func (client *MHSMPrivateEndpointConnectionsClient) getHandleResponse(resp *http // NewListByResourcePager - The List operation gets information about the private endpoint connections associated with the // managed HSM Pool. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - Name of the resource group that contains the managed HSM pool. -// name - Name of the managed HSM Pool -// options - MHSMPrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.ListByResource -// method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - Name of the resource group that contains the managed HSM pool. +// - name - Name of the managed HSM Pool +// - options - MHSMPrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.NewListByResourcePager +// method. func (client *MHSMPrivateEndpointConnectionsClient) NewListByResourcePager(resourceGroupName string, name string, options *MHSMPrivateEndpointConnectionsClientListByResourceOptions) *runtime.Pager[MHSMPrivateEndpointConnectionsClientListByResourceResponse] { return runtime.NewPager(runtime.PagingHandler[MHSMPrivateEndpointConnectionsClientListByResourceResponse]{ More: func(page MHSMPrivateEndpointConnectionsClientListByResourceResponse) bool { @@ -242,7 +246,7 @@ func (client *MHSMPrivateEndpointConnectionsClient) listByResourceCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -259,13 +263,14 @@ func (client *MHSMPrivateEndpointConnectionsClient) listByResourceHandleResponse // Put - Updates the specified private endpoint connection associated with the managed hsm pool. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - Name of the resource group that contains the managed HSM pool. -// name - Name of the managed HSM Pool -// privateEndpointConnectionName - Name of the private endpoint connection associated with the managed hsm pool. -// properties - The intended state of private endpoint connection. -// options - MHSMPrivateEndpointConnectionsClientPutOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.Put -// method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - Name of the resource group that contains the managed HSM pool. +// - name - Name of the managed HSM Pool +// - privateEndpointConnectionName - Name of the private endpoint connection associated with the managed hsm pool. +// - properties - The intended state of private endpoint connection. +// - options - MHSMPrivateEndpointConnectionsClientPutOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.Put +// method. func (client *MHSMPrivateEndpointConnectionsClient) Put(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, properties MHSMPrivateEndpointConnection, options *MHSMPrivateEndpointConnectionsClientPutOptions) (MHSMPrivateEndpointConnectionsClientPutResponse, error) { req, err := client.putCreateRequest(ctx, resourceGroupName, name, privateEndpointConnectionName, properties, options) if err != nil { @@ -305,7 +310,7 @@ func (client *MHSMPrivateEndpointConnectionsClient) putCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, properties) diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_mhsmprivatelinkresources_client.go b/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivatelinkresources_client.go similarity index 86% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_mhsmprivatelinkresources_client.go rename to sdk/resourcemanager/keyvault/armkeyvault/mhsmprivatelinkresources_client.go index f90f3d3f732f..293afba67d86 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_mhsmprivatelinkresources_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivatelinkresources_client.go @@ -5,6 +5,7 @@ // 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 armkeyvault @@ -31,10 +32,10 @@ type MHSMPrivateLinkResourcesClient struct { } // NewMHSMPrivateLinkResourcesClient creates a new instance of MHSMPrivateLinkResourcesClient with the specified values. -// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewMHSMPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MHSMPrivateLinkResourcesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,11 +58,12 @@ func NewMHSMPrivateLinkResourcesClient(subscriptionID string, credential azcore. // ListByMHSMResource - Gets the private link resources supported for the managed hsm pool. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - Name of the resource group that contains the managed HSM pool. -// name - Name of the managed HSM Pool -// options - MHSMPrivateLinkResourcesClientListByMHSMResourceOptions contains the optional parameters for the MHSMPrivateLinkResourcesClient.ListByMHSMResource -// method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - Name of the resource group that contains the managed HSM pool. +// - name - Name of the managed HSM Pool +// - options - MHSMPrivateLinkResourcesClientListByMHSMResourceOptions contains the optional parameters for the MHSMPrivateLinkResourcesClient.ListByMHSMResource +// method. func (client *MHSMPrivateLinkResourcesClient) ListByMHSMResource(ctx context.Context, resourceGroupName string, name string, options *MHSMPrivateLinkResourcesClientListByMHSMResourceOptions) (MHSMPrivateLinkResourcesClientListByMHSMResourceResponse, error) { req, err := client.listByMHSMResourceCreateRequest(ctx, resourceGroupName, name, options) if err != nil { @@ -97,7 +99,7 @@ func (client *MHSMPrivateLinkResourcesClient) listByMHSMResourceCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_models.go b/sdk/resourcemanager/keyvault/armkeyvault/models.go similarity index 84% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_models.go rename to sdk/resourcemanager/keyvault/armkeyvault/models.go index 251559f2b5f2..ed64e9940484 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_models.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/models.go @@ -5,6 +5,7 @@ // 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 armkeyvault @@ -50,8 +51,14 @@ type Attributes struct { Updated *time.Time `json:"updated,omitempty" azure:"ro"` } -// CheckNameAvailabilityResult - The CheckNameAvailability operation response. -type CheckNameAvailabilityResult struct { +// CheckMhsmNameAvailabilityParameters - The parameters used to check the availability of the managed hsm name. +type CheckMhsmNameAvailabilityParameters struct { + // REQUIRED; The managed hsm name. + Name *string `json:"name,omitempty"` +} + +// CheckMhsmNameAvailabilityResult - The CheckMhsmNameAvailability operation response. +type CheckMhsmNameAvailabilityResult struct { // READ-ONLY; An error message explaining the Reason value in more detail. Message *string `json:"message,omitempty" azure:"ro"` @@ -59,23 +66,22 @@ type CheckNameAvailabilityResult struct { // If false, the name has already been taken or is invalid and cannot be used. NameAvailable *bool `json:"nameAvailable,omitempty" azure:"ro"` - // READ-ONLY; The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. + // READ-ONLY; The reason that a managed hsm name could not be used. The reason element is only returned if NameAvailable is + // false. Reason *Reason `json:"reason,omitempty" azure:"ro"` } -// CloudError - An error response from Key Vault resource provider -type CloudError struct { - // An error response from Key Vault resource provider - Error *CloudErrorBody `json:"error,omitempty"` -} +// CheckNameAvailabilityResult - The CheckNameAvailability operation response. +type CheckNameAvailabilityResult struct { + // READ-ONLY; An error message explaining the Reason value in more detail. + Message *string `json:"message,omitempty" azure:"ro"` -// CloudErrorBody - An error response from Key Vault resource provider -type CloudErrorBody struct { - // Error code. This is a mnemonic that can be consumed programmatically. - Code *string `json:"code,omitempty"` + // READ-ONLY; A boolean value that indicates whether the name is available for you to use. If true, the name is available. + // If false, the name has already been taken or is invalid and cannot be used. + NameAvailable *bool `json:"nameAvailable,omitempty" azure:"ro"` - // User friendly error message. The message is typically localized and may vary with service version. - Message *string `json:"message,omitempty"` + // READ-ONLY; The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. + Reason *Reason `json:"reason,omitempty" azure:"ro"` } type DeletedManagedHsm struct { @@ -325,12 +331,12 @@ type KeysClientGetVersionOptions struct { // placeholder for future optional parameters } -// KeysClientListOptions contains the optional parameters for the KeysClient.List method. +// KeysClientListOptions contains the optional parameters for the KeysClient.NewListPager method. type KeysClientListOptions struct { // placeholder for future optional parameters } -// KeysClientListVersionsOptions contains the optional parameters for the KeysClient.ListVersions method. +// KeysClientListVersionsOptions contains the optional parameters for the KeysClient.NewListVersionsPager method. type KeysClientListVersionsOptions struct { // placeholder for future optional parameters } @@ -355,7 +361,7 @@ type LogSpecification struct { Name *string `json:"name,omitempty"` } -// MHSMIPRule - A rule governing the accessibility of a managed hsm pool from a specific ip address or ip range. +// MHSMIPRule - A rule governing the accessibility of a managed HSM pool from a specific IP address or IP range. type MHSMIPRule struct { // REQUIRED; An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses // that start with 124.56.78). @@ -416,6 +422,12 @@ type MHSMPrivateEndpointConnection struct { // MHSMPrivateEndpointConnectionItem - Private endpoint connection item. type MHSMPrivateEndpointConnectionItem struct { + // Modified whenever there is a change in the state of private endpoint connection. + Etag *string `json:"etag,omitempty"` + + // Id of private endpoint connection. + ID *string `json:"id,omitempty"` + // Private endpoint connection properties. Properties *MHSMPrivateEndpointConnectionProperties `json:"properties,omitempty"` } @@ -445,7 +457,7 @@ type MHSMPrivateEndpointConnectionsClientGetOptions struct { // placeholder for future optional parameters } -// MHSMPrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.ListByResource +// MHSMPrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.NewListByResourcePager // method. type MHSMPrivateEndpointConnectionsClientListByResourceOptions struct { // placeholder for future optional parameters @@ -535,6 +547,15 @@ type MHSMVirtualNetworkRule struct { ID *string `json:"id,omitempty"` } +// ManagedHSMSecurityDomainProperties - The security domain properties of the managed hsm. +type ManagedHSMSecurityDomainProperties struct { + // READ-ONLY; Activation Status + ActivationStatus *ActivationStatus `json:"activationStatus,omitempty" azure:"ro"` + + // READ-ONLY; Activation Status Message. + ActivationStatusMessage *string `json:"activationStatusMessage,omitempty" azure:"ro"` +} + // ManagedHsm - Resource information with extended details. type ManagedHsm struct { // The supported Azure location where the managed HSM Pool should be created. @@ -562,12 +583,161 @@ type ManagedHsm struct { Type *string `json:"type,omitempty" azure:"ro"` } +type ManagedHsmAction struct { + // The type of action. + Type *KeyRotationPolicyActionType `json:"type,omitempty"` +} + // ManagedHsmError - The error exception. type ManagedHsmError struct { // READ-ONLY; The server error. Error *Error `json:"error,omitempty" azure:"ro"` } +// ManagedHsmKey - The key resource. +type ManagedHsmKey struct { + // REQUIRED; The properties of the key. + Properties *ManagedHsmKeyProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ManagedHsmKeyAttributes - The object attributes managed by the Azure Key Vault service. +type ManagedHsmKeyAttributes struct { + // Determines whether or not the object is enabled. + Enabled *bool `json:"enabled,omitempty"` + + // Expiry date in seconds since 1970-01-01T00:00:00Z. + Expires *int64 `json:"exp,omitempty"` + + // Indicates if the private key can be exported. + Exportable *bool `json:"exportable,omitempty"` + + // Not before date in seconds since 1970-01-01T00:00:00Z. + NotBefore *int64 `json:"nbf,omitempty"` + + // READ-ONLY; Creation time in seconds since 1970-01-01T00:00:00Z. + Created *int64 `json:"created,omitempty" azure:"ro"` + + // READ-ONLY; The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object + // can be permanently deleted by a privileged user; otherwise, only the system can purge the + // object at the end of the retention interval. + RecoveryLevel *DeletionRecoveryLevel `json:"recoveryLevel,omitempty" azure:"ro"` + + // READ-ONLY; Last updated time in seconds since 1970-01-01T00:00:00Z. + Updated *int64 `json:"updated,omitempty" azure:"ro"` +} + +// ManagedHsmKeyCreateParameters - The parameters used to create a key. +type ManagedHsmKeyCreateParameters struct { + // REQUIRED; The properties of the key to be created. + Properties *ManagedHsmKeyProperties `json:"properties,omitempty"` + + // The tags that will be assigned to the key. + Tags map[string]*string `json:"tags,omitempty"` +} + +// ManagedHsmKeyListResult - The page of keys. +type ManagedHsmKeyListResult struct { + // The URL to get the next page of keys. + NextLink *string `json:"nextLink,omitempty"` + + // The key resources. + Value []*ManagedHsmKey `json:"value,omitempty"` +} + +// ManagedHsmKeyProperties - The properties of the key. +type ManagedHsmKeyProperties struct { + // The attributes of the key. + Attributes *ManagedHsmKeyAttributes `json:"attributes,omitempty"` + + // The elliptic curve name. For valid values, see JsonWebKeyCurveName. + CurveName *JSONWebKeyCurveName `json:"curveName,omitempty"` + KeyOps []*JSONWebKeyOperation `json:"keyOps,omitempty"` + + // The key size in bits. For example: 2048, 3072, or 4096 for RSA. + KeySize *int32 `json:"keySize,omitempty"` + + // The type of the key. For valid values, see JsonWebKeyType. + Kty *JSONWebKeyType `json:"kty,omitempty"` + + // Key release policy in response. It will be used for both output and input. Omitted if empty + ReleasePolicy *ManagedHsmKeyReleasePolicy `json:"release_policy,omitempty"` + + // Key rotation policy in response. It will be used for both output and input. Omitted if empty + RotationPolicy *ManagedHsmRotationPolicy `json:"rotationPolicy,omitempty"` + + // READ-ONLY; The URI to retrieve the current version of the key. + KeyURI *string `json:"keyUri,omitempty" azure:"ro"` + + // READ-ONLY; The URI to retrieve the specific version of the key. + KeyURIWithVersion *string `json:"keyUriWithVersion,omitempty" azure:"ro"` +} + +type ManagedHsmKeyReleasePolicy struct { + // Content type and version of key release policy + ContentType *string `json:"contentType,omitempty"` + + // Blob encoding the policy rules under which the key can be released. + Data []byte `json:"data,omitempty"` +} + +type ManagedHsmKeyRotationPolicyAttributes struct { + // The expiration time for the new key version. It should be in ISO8601 format. Eg: 'P90D', 'P1Y'. + ExpiryTime *string `json:"expiryTime,omitempty"` + + // READ-ONLY; Creation time in seconds since 1970-01-01T00:00:00Z. + Created *int64 `json:"created,omitempty" azure:"ro"` + + // READ-ONLY; Last updated time in seconds since 1970-01-01T00:00:00Z. + Updated *int64 `json:"updated,omitempty" azure:"ro"` +} + +// ManagedHsmKeysClientCreateIfNotExistOptions contains the optional parameters for the ManagedHsmKeysClient.CreateIfNotExist +// method. +type ManagedHsmKeysClientCreateIfNotExistOptions struct { + // placeholder for future optional parameters +} + +// ManagedHsmKeysClientGetOptions contains the optional parameters for the ManagedHsmKeysClient.Get method. +type ManagedHsmKeysClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedHsmKeysClientGetVersionOptions contains the optional parameters for the ManagedHsmKeysClient.GetVersion method. +type ManagedHsmKeysClientGetVersionOptions struct { + // placeholder for future optional parameters +} + +// ManagedHsmKeysClientListOptions contains the optional parameters for the ManagedHsmKeysClient.NewListPager method. +type ManagedHsmKeysClientListOptions struct { + // placeholder for future optional parameters +} + +// ManagedHsmKeysClientListVersionsOptions contains the optional parameters for the ManagedHsmKeysClient.NewListVersionsPager +// method. +type ManagedHsmKeysClientListVersionsOptions struct { + // placeholder for future optional parameters +} + +type ManagedHsmLifetimeAction struct { + // The action of key rotation policy lifetimeAction. + Action *ManagedHsmAction `json:"action,omitempty"` + + // The trigger of key rotation policy lifetimeAction. + Trigger *ManagedHsmTrigger `json:"trigger,omitempty"` +} + // ManagedHsmListResult - List of managed HSM Pools type ManagedHsmListResult struct { // The URL to get the next set of managed HSM Pools. @@ -620,6 +790,9 @@ type ManagedHsmProperties struct { // READ-ONLY; The scheduled purge date in UTC. ScheduledPurgeDate *time.Time `json:"scheduledPurgeDate,omitempty" azure:"ro"` + // READ-ONLY; Managed HSM security domain properties. + SecurityDomainProperties *ManagedHSMSecurityDomainProperties `json:"securityDomainProperties,omitempty" azure:"ro"` + // READ-ONLY; Resource Status Message. StatusMessage *string `json:"statusMessage,omitempty" azure:"ro"` } @@ -648,6 +821,14 @@ type ManagedHsmResource struct { Type *string `json:"type,omitempty" azure:"ro"` } +type ManagedHsmRotationPolicy struct { + // The attributes of key rotation policy. + Attributes *ManagedHsmKeyRotationPolicyAttributes `json:"attributes,omitempty"` + + // The lifetimeActions for key rotation action. + LifetimeActions []*ManagedHsmLifetimeAction `json:"lifetimeActions,omitempty"` +} + // ManagedHsmSKU - SKU details type ManagedHsmSKU struct { // REQUIRED; SKU Family of the managed HSM Pool @@ -657,6 +838,15 @@ type ManagedHsmSKU struct { Name *ManagedHsmSKUName `json:"name,omitempty"` } +type ManagedHsmTrigger struct { + // The time duration after key creation to rotate the key. It only applies to rotate. It will be in ISO 8601 duration format. + // Eg: 'P90D', 'P1Y'. + TimeAfterCreate *string `json:"timeAfterCreate,omitempty"` + + // The time duration before key expiring to rotate or notify. It will be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. + TimeBeforeExpiry *string `json:"timeBeforeExpiry,omitempty"` +} + // ManagedHsmsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedHsmsClient.BeginCreateOrUpdate // method. type ManagedHsmsClientBeginCreateOrUpdateOptions struct { @@ -683,6 +873,12 @@ type ManagedHsmsClientBeginUpdateOptions struct { ResumeToken string } +// ManagedHsmsClientCheckMhsmNameAvailabilityOptions contains the optional parameters for the ManagedHsmsClient.CheckMhsmNameAvailability +// method. +type ManagedHsmsClientCheckMhsmNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + // ManagedHsmsClientGetDeletedOptions contains the optional parameters for the ManagedHsmsClient.GetDeleted method. type ManagedHsmsClientGetDeletedOptions struct { // placeholder for future optional parameters @@ -693,21 +889,21 @@ type ManagedHsmsClientGetOptions struct { // placeholder for future optional parameters } -// ManagedHsmsClientListByResourceGroupOptions contains the optional parameters for the ManagedHsmsClient.ListByResourceGroup +// ManagedHsmsClientListByResourceGroupOptions contains the optional parameters for the ManagedHsmsClient.NewListByResourceGroupPager // method. type ManagedHsmsClientListByResourceGroupOptions struct { // Maximum number of results to return. Top *int32 } -// ManagedHsmsClientListBySubscriptionOptions contains the optional parameters for the ManagedHsmsClient.ListBySubscription +// ManagedHsmsClientListBySubscriptionOptions contains the optional parameters for the ManagedHsmsClient.NewListBySubscriptionPager // method. type ManagedHsmsClientListBySubscriptionOptions struct { // Maximum number of results to return. Top *int32 } -// ManagedHsmsClientListDeletedOptions contains the optional parameters for the ManagedHsmsClient.ListDeleted method. +// ManagedHsmsClientListDeletedOptions contains the optional parameters for the ManagedHsmsClient.NewListDeletedPager method. type ManagedHsmsClientListDeletedOptions struct { // placeholder for future optional parameters } @@ -813,7 +1009,7 @@ type OperationProperties struct { ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters } @@ -909,7 +1105,7 @@ type PrivateEndpointConnectionsClientGetOptions struct { // placeholder for future optional parameters } -// PrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.ListByResource +// PrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByResourcePager // method. type PrivateEndpointConnectionsClientListByResourceOptions struct { // placeholder for future optional parameters @@ -978,6 +1174,21 @@ type PrivateLinkServiceConnectionState struct { Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` } +// ProxyResourceWithoutSystemData - Common fields that are returned in the response for all Azure Resource Manager resources +type ProxyResourceWithoutSystemData struct { + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + // Resource - Key Vault resource type Resource struct { // READ-ONLY; Fully qualified identifier of the key vault resource. @@ -1130,7 +1341,7 @@ type SecretsClientGetOptions struct { // placeholder for future optional parameters } -// SecretsClientListOptions contains the optional parameters for the SecretsClient.List method. +// SecretsClientListOptions contains the optional parameters for the SecretsClient.NewListPager method. type SecretsClientListOptions struct { // Maximum number of results to return. Top *int32 @@ -1234,7 +1445,8 @@ type VaultCheckNameAvailabilityParameters struct { // REQUIRED; The vault name. Name *string `json:"name,omitempty"` - // REQUIRED; The type of resource, Microsoft.KeyVault/vaults + // CONSTANT; The type of resource, Microsoft.KeyVault/vaults + // Field has constant value "Microsoft.KeyVault/vaults", any specified value is ignored. Type *string `json:"type,omitempty"` } @@ -1286,9 +1498,9 @@ type VaultPatchProperties struct { // Property that controls how data actions are authorized. When true, the key vault will use Role Based Access Control (RBAC) // for authorization of data actions, and the access policies specified in vault - // properties will be ignored (warning: this is a preview feature). When false, the key vault will use the access policies - // specified in vault properties, and any policy stored on Azure Resource Manager - // will be ignored. If null or not specified, the value of this property will not change. + // properties will be ignored. When false, the key vault will use the access policies specified in vault properties, and any + // policy stored on Azure Resource Manager will be ignored. If null or not + // specified, the value of this property will not change. EnableRbacAuthorization *bool `json:"enableRbacAuthorization,omitempty"` // Property to specify whether the 'soft delete' functionality is enabled for this key vault. Once set to true, it cannot @@ -1349,10 +1561,10 @@ type VaultProperties struct { // Property that controls how data actions are authorized. When true, the key vault will use Role Based Access Control (RBAC) // for authorization of data actions, and the access policies specified in vault - // properties will be ignored (warning: this is a preview feature). When false, the key vault will use the access policies - // specified in vault properties, and any policy stored on Azure Resource Manager - // will be ignored. If null or not specified, the vault is created with the default value of false. Note that management actions - // are always authorized with RBAC. + // properties will be ignored. When false, the key vault will use the access policies specified in vault properties, and any + // policy stored on Azure Resource Manager will be ignored. If null or not + // specified, the vault is created with the default value of false. Note that management actions are always authorized with + // RBAC. EnableRbacAuthorization *bool `json:"enableRbacAuthorization,omitempty"` // Property to specify whether the 'soft delete' functionality is enabled for this key vault. If it's not set to any value(true @@ -1427,24 +1639,26 @@ type VaultsClientGetOptions struct { // placeholder for future optional parameters } -// VaultsClientListByResourceGroupOptions contains the optional parameters for the VaultsClient.ListByResourceGroup method. +// VaultsClientListByResourceGroupOptions contains the optional parameters for the VaultsClient.NewListByResourceGroupPager +// method. type VaultsClientListByResourceGroupOptions struct { // Maximum number of results to return. Top *int32 } -// VaultsClientListBySubscriptionOptions contains the optional parameters for the VaultsClient.ListBySubscription method. +// VaultsClientListBySubscriptionOptions contains the optional parameters for the VaultsClient.NewListBySubscriptionPager +// method. type VaultsClientListBySubscriptionOptions struct { // Maximum number of results to return. Top *int32 } -// VaultsClientListDeletedOptions contains the optional parameters for the VaultsClient.ListDeleted method. +// VaultsClientListDeletedOptions contains the optional parameters for the VaultsClient.NewListDeletedPager method. type VaultsClientListDeletedOptions struct { // placeholder for future optional parameters } -// VaultsClientListOptions contains the optional parameters for the VaultsClient.List method. +// VaultsClientListOptions contains the optional parameters for the VaultsClient.NewListPager method. type VaultsClientListOptions struct { // Maximum number of results to return. Top *int32 diff --git a/sdk/resourcemanager/keyvault/armkeyvault/models_serde.go b/sdk/resourcemanager/keyvault/armkeyvault/models_serde.go new file mode 100644 index 000000000000..bb08d4e1e60b --- /dev/null +++ b/sdk/resourcemanager/keyvault/armkeyvault/models_serde.go @@ -0,0 +1,3680 @@ +//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 armkeyvault + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AccessPolicyEntry. +func (a AccessPolicyEntry) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applicationId", a.ApplicationID) + populate(objectMap, "objectId", a.ObjectID) + populate(objectMap, "permissions", a.Permissions) + populate(objectMap, "tenantId", a.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessPolicyEntry. +func (a *AccessPolicyEntry) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applicationId": + err = unpopulate(val, "ApplicationID", &a.ApplicationID) + delete(rawMsg, key) + case "objectId": + err = unpopulate(val, "ObjectID", &a.ObjectID) + delete(rawMsg, key) + case "permissions": + err = unpopulate(val, "Permissions", &a.Permissions) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &a.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Action. +func (a Action) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Action. +func (a *Action) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Attributes. +func (a Attributes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeUnix(objectMap, "created", a.Created) + populate(objectMap, "enabled", a.Enabled) + populateTimeUnix(objectMap, "exp", a.Expires) + populateTimeUnix(objectMap, "nbf", a.NotBefore) + populateTimeUnix(objectMap, "updated", a.Updated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Attributes. +func (a *Attributes) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "created": + err = unpopulateTimeUnix(val, "Created", &a.Created) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &a.Enabled) + delete(rawMsg, key) + case "exp": + err = unpopulateTimeUnix(val, "Expires", &a.Expires) + delete(rawMsg, key) + case "nbf": + err = unpopulateTimeUnix(val, "NotBefore", &a.NotBefore) + delete(rawMsg, key) + case "updated": + err = unpopulateTimeUnix(val, "Updated", &a.Updated) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CheckMhsmNameAvailabilityParameters. +func (c CheckMhsmNameAvailabilityParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", c.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckMhsmNameAvailabilityParameters. +func (c *CheckMhsmNameAvailabilityParameters) 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 "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CheckMhsmNameAvailabilityResult. +func (c CheckMhsmNameAvailabilityResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", c.Message) + populate(objectMap, "nameAvailable", c.NameAvailable) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckMhsmNameAvailabilityResult. +func (c *CheckMhsmNameAvailabilityResult) 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 "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &c.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &c.Reason) + 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 CheckNameAvailabilityResult. +func (c CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", c.Message) + populate(objectMap, "nameAvailable", c.NameAvailable) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityResult. +func (c *CheckNameAvailabilityResult) 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 "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &c.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &c.Reason) + 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 DeletedManagedHsm. +func (d DeletedManagedHsm) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedManagedHsm. +func (d *DeletedManagedHsm) 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 "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + 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 DeletedManagedHsmListResult. +func (d DeletedManagedHsmListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedManagedHsmListResult. +func (d *DeletedManagedHsmListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DeletedManagedHsmProperties. +func (d DeletedManagedHsmProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "deletionDate", d.DeletionDate) + populate(objectMap, "location", d.Location) + populate(objectMap, "mhsmId", d.MhsmID) + populate(objectMap, "purgeProtectionEnabled", d.PurgeProtectionEnabled) + populateTimeRFC3339(objectMap, "scheduledPurgeDate", d.ScheduledPurgeDate) + populate(objectMap, "tags", d.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedManagedHsmProperties. +func (d *DeletedManagedHsmProperties) 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 "deletionDate": + err = unpopulateTimeRFC3339(val, "DeletionDate", &d.DeletionDate) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "mhsmId": + err = unpopulate(val, "MhsmID", &d.MhsmID) + delete(rawMsg, key) + case "purgeProtectionEnabled": + err = unpopulate(val, "PurgeProtectionEnabled", &d.PurgeProtectionEnabled) + delete(rawMsg, key) + case "scheduledPurgeDate": + err = unpopulateTimeRFC3339(val, "ScheduledPurgeDate", &d.ScheduledPurgeDate) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DeletedVault. +func (d DeletedVault) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedVault. +func (d *DeletedVault) 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 "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + 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 DeletedVaultListResult. +func (d DeletedVaultListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedVaultListResult. +func (d *DeletedVaultListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DeletedVaultProperties. +func (d DeletedVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "deletionDate", d.DeletionDate) + populate(objectMap, "location", d.Location) + populate(objectMap, "purgeProtectionEnabled", d.PurgeProtectionEnabled) + populateTimeRFC3339(objectMap, "scheduledPurgeDate", d.ScheduledPurgeDate) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "vaultId", d.VaultID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedVaultProperties. +func (d *DeletedVaultProperties) 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 "deletionDate": + err = unpopulateTimeRFC3339(val, "DeletionDate", &d.DeletionDate) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "purgeProtectionEnabled": + err = unpopulate(val, "PurgeProtectionEnabled", &d.PurgeProtectionEnabled) + delete(rawMsg, key) + case "scheduledPurgeDate": + err = unpopulateTimeRFC3339(val, "ScheduledPurgeDate", &d.ScheduledPurgeDate) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + case "vaultId": + err = unpopulate(val, "VaultID", &d.VaultID) + 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 DimensionProperties. +func (d DimensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", d.DisplayName) + populate(objectMap, "name", d.Name) + populate(objectMap, "toBeExportedForShoebox", d.ToBeExportedForShoebox) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DimensionProperties. +func (d *DimensionProperties) 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 "displayName": + err = unpopulate(val, "DisplayName", &d.DisplayName) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "toBeExportedForShoebox": + err = unpopulate(val, "ToBeExportedForShoebox", &d.ToBeExportedForShoebox) + 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 Error. +func (e Error) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", e.Code) + populate(objectMap, "innererror", e.InnerError) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Error. +func (e *Error) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "innererror": + err = unpopulate(val, "InnerError", &e.InnerError) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + 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 IPRule. +func (i IPRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPRule. +func (i *IPRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Key. +func (k Key) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", k.ID) + populate(objectMap, "location", k.Location) + populate(objectMap, "name", k.Name) + populate(objectMap, "properties", k.Properties) + populate(objectMap, "tags", k.Tags) + populate(objectMap, "type", k.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Key. +func (k *Key) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &k.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &k.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &k.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &k.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &k.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &k.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyAttributes. +func (k KeyAttributes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "created", k.Created) + populate(objectMap, "enabled", k.Enabled) + populate(objectMap, "exp", k.Expires) + populate(objectMap, "exportable", k.Exportable) + populate(objectMap, "nbf", k.NotBefore) + populate(objectMap, "recoveryLevel", k.RecoveryLevel) + populate(objectMap, "updated", k.Updated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyAttributes. +func (k *KeyAttributes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "created": + err = unpopulate(val, "Created", &k.Created) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &k.Enabled) + delete(rawMsg, key) + case "exp": + err = unpopulate(val, "Expires", &k.Expires) + delete(rawMsg, key) + case "exportable": + err = unpopulate(val, "Exportable", &k.Exportable) + delete(rawMsg, key) + case "nbf": + err = unpopulate(val, "NotBefore", &k.NotBefore) + delete(rawMsg, key) + case "recoveryLevel": + err = unpopulate(val, "RecoveryLevel", &k.RecoveryLevel) + delete(rawMsg, key) + case "updated": + err = unpopulate(val, "Updated", &k.Updated) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyCreateParameters. +func (k KeyCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", k.Properties) + populate(objectMap, "tags", k.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyCreateParameters. +func (k *KeyCreateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &k.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &k.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyListResult. +func (k KeyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", k.NextLink) + populate(objectMap, "value", k.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyListResult. +func (k *KeyListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &k.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &k.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyProperties. +func (k KeyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "attributes", k.Attributes) + populate(objectMap, "curveName", k.CurveName) + populate(objectMap, "keyOps", k.KeyOps) + populate(objectMap, "keySize", k.KeySize) + populate(objectMap, "keyUri", k.KeyURI) + populate(objectMap, "keyUriWithVersion", k.KeyURIWithVersion) + populate(objectMap, "kty", k.Kty) + populate(objectMap, "release_policy", k.ReleasePolicy) + populate(objectMap, "rotationPolicy", k.RotationPolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyProperties. +func (k *KeyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "attributes": + err = unpopulate(val, "Attributes", &k.Attributes) + delete(rawMsg, key) + case "curveName": + err = unpopulate(val, "CurveName", &k.CurveName) + delete(rawMsg, key) + case "keyOps": + err = unpopulate(val, "KeyOps", &k.KeyOps) + delete(rawMsg, key) + case "keySize": + err = unpopulate(val, "KeySize", &k.KeySize) + delete(rawMsg, key) + case "keyUri": + err = unpopulate(val, "KeyURI", &k.KeyURI) + delete(rawMsg, key) + case "keyUriWithVersion": + err = unpopulate(val, "KeyURIWithVersion", &k.KeyURIWithVersion) + delete(rawMsg, key) + case "kty": + err = unpopulate(val, "Kty", &k.Kty) + delete(rawMsg, key) + case "release_policy": + err = unpopulate(val, "ReleasePolicy", &k.ReleasePolicy) + delete(rawMsg, key) + case "rotationPolicy": + err = unpopulate(val, "RotationPolicy", &k.RotationPolicy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyReleasePolicy. +func (k KeyReleasePolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "contentType", k.ContentType) + populateByteArray(objectMap, "data", k.Data, runtime.Base64URLFormat) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyReleasePolicy. +func (k *KeyReleasePolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "contentType": + err = unpopulate(val, "ContentType", &k.ContentType) + delete(rawMsg, key) + case "data": + err = runtime.DecodeByteArray(string(val), &k.Data, runtime.Base64URLFormat) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyRotationPolicyAttributes. +func (k KeyRotationPolicyAttributes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "created", k.Created) + populate(objectMap, "expiryTime", k.ExpiryTime) + populate(objectMap, "updated", k.Updated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyRotationPolicyAttributes. +func (k *KeyRotationPolicyAttributes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "created": + err = unpopulate(val, "Created", &k.Created) + delete(rawMsg, key) + case "expiryTime": + err = unpopulate(val, "ExpiryTime", &k.ExpiryTime) + delete(rawMsg, key) + case "updated": + err = unpopulate(val, "Updated", &k.Updated) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LifetimeAction. +func (l LifetimeAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "action", l.Action) + populate(objectMap, "trigger", l.Trigger) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LifetimeAction. +func (l *LifetimeAction) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &l.Action) + delete(rawMsg, key) + case "trigger": + err = unpopulate(val, "Trigger", &l.Trigger) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogSpecification. +func (l LogSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blobDuration", l.BlobDuration) + populate(objectMap, "displayName", l.DisplayName) + populate(objectMap, "name", l.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogSpecification. +func (l *LogSpecification) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "blobDuration": + err = unpopulate(val, "BlobDuration", &l.BlobDuration) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &l.DisplayName) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MHSMIPRule. +func (m MHSMIPRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MHSMIPRule. +func (m *MHSMIPRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MHSMNetworkRuleSet. +func (m MHSMNetworkRuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "bypass", m.Bypass) + populate(objectMap, "defaultAction", m.DefaultAction) + populate(objectMap, "ipRules", m.IPRules) + populate(objectMap, "virtualNetworkRules", m.VirtualNetworkRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MHSMNetworkRuleSet. +func (m *MHSMNetworkRuleSet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bypass": + err = unpopulate(val, "Bypass", &m.Bypass) + delete(rawMsg, key) + case "defaultAction": + err = unpopulate(val, "DefaultAction", &m.DefaultAction) + delete(rawMsg, key) + case "ipRules": + err = unpopulate(val, "IPRules", &m.IPRules) + delete(rawMsg, key) + case "virtualNetworkRules": + err = unpopulate(val, "VirtualNetworkRules", &m.VirtualNetworkRules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MHSMPrivateEndpoint. +func (m MHSMPrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MHSMPrivateEndpoint. +func (m *MHSMPrivateEndpoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MHSMPrivateEndpointConnection. +func (m MHSMPrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", m.Etag) + populate(objectMap, "id", m.ID) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "sku", m.SKU) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MHSMPrivateEndpointConnection. +func (m *MHSMPrivateEndpointConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &m.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &m.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MHSMPrivateEndpointConnectionItem. +func (m MHSMPrivateEndpointConnectionItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", m.Etag) + populate(objectMap, "id", m.ID) + populate(objectMap, "properties", m.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MHSMPrivateEndpointConnectionItem. +func (m *MHSMPrivateEndpointConnectionItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &m.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MHSMPrivateEndpointConnectionProperties. +func (m MHSMPrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "privateEndpoint", m.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", m.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", m.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MHSMPrivateEndpointConnectionProperties. +func (m *MHSMPrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &m.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &m.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MHSMPrivateEndpointConnectionsListResult. +func (m MHSMPrivateEndpointConnectionsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MHSMPrivateEndpointConnectionsListResult. +func (m *MHSMPrivateEndpointConnectionsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MHSMPrivateLinkResource. +func (m MHSMPrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "sku", m.SKU) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MHSMPrivateLinkResource. +func (m *MHSMPrivateLinkResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &m.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MHSMPrivateLinkResourceListResult. +func (m MHSMPrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MHSMPrivateLinkResourceListResult. +func (m *MHSMPrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MHSMPrivateLinkResourceProperties. +func (m MHSMPrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupId", m.GroupID) + populate(objectMap, "requiredMembers", m.RequiredMembers) + populate(objectMap, "requiredZoneNames", m.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MHSMPrivateLinkResourceProperties. +func (m *MHSMPrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &m.GroupID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &m.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &m.RequiredZoneNames) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MHSMPrivateLinkServiceConnectionState. +func (m MHSMPrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionsRequired", m.ActionsRequired) + populate(objectMap, "description", m.Description) + populate(objectMap, "status", m.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MHSMPrivateLinkServiceConnectionState. +func (m *MHSMPrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &m.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &m.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &m.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MHSMVirtualNetworkRule. +func (m MHSMVirtualNetworkRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MHSMVirtualNetworkRule. +func (m *MHSMVirtualNetworkRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedHSMSecurityDomainProperties. +func (m ManagedHSMSecurityDomainProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "activationStatus", m.ActivationStatus) + populate(objectMap, "activationStatusMessage", m.ActivationStatusMessage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedHSMSecurityDomainProperties. +func (m *ManagedHSMSecurityDomainProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "activationStatus": + err = unpopulate(val, "ActivationStatus", &m.ActivationStatus) + delete(rawMsg, key) + case "activationStatusMessage": + err = unpopulate(val, "ActivationStatusMessage", &m.ActivationStatusMessage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedHsm. +func (m ManagedHsm) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "sku", m.SKU) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedHsm. +func (m *ManagedHsm) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &m.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedHsmAction. +func (m ManagedHsmAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedHsmAction. +func (m *ManagedHsmAction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedHsmError. +func (m ManagedHsmError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", m.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedHsmError. +func (m *ManagedHsmError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &m.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedHsmKey. +func (m ManagedHsmKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedHsmKey. +func (m *ManagedHsmKey) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedHsmKeyAttributes. +func (m ManagedHsmKeyAttributes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "created", m.Created) + populate(objectMap, "enabled", m.Enabled) + populate(objectMap, "exp", m.Expires) + populate(objectMap, "exportable", m.Exportable) + populate(objectMap, "nbf", m.NotBefore) + populate(objectMap, "recoveryLevel", m.RecoveryLevel) + populate(objectMap, "updated", m.Updated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedHsmKeyAttributes. +func (m *ManagedHsmKeyAttributes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "created": + err = unpopulate(val, "Created", &m.Created) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + delete(rawMsg, key) + case "exp": + err = unpopulate(val, "Expires", &m.Expires) + delete(rawMsg, key) + case "exportable": + err = unpopulate(val, "Exportable", &m.Exportable) + delete(rawMsg, key) + case "nbf": + err = unpopulate(val, "NotBefore", &m.NotBefore) + delete(rawMsg, key) + case "recoveryLevel": + err = unpopulate(val, "RecoveryLevel", &m.RecoveryLevel) + delete(rawMsg, key) + case "updated": + err = unpopulate(val, "Updated", &m.Updated) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedHsmKeyCreateParameters. +func (m ManagedHsmKeyCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "tags", m.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedHsmKeyCreateParameters. +func (m *ManagedHsmKeyCreateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedHsmKeyListResult. +func (m ManagedHsmKeyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedHsmKeyListResult. +func (m *ManagedHsmKeyListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedHsmKeyProperties. +func (m ManagedHsmKeyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "attributes", m.Attributes) + populate(objectMap, "curveName", m.CurveName) + populate(objectMap, "keyOps", m.KeyOps) + populate(objectMap, "keySize", m.KeySize) + populate(objectMap, "keyUri", m.KeyURI) + populate(objectMap, "keyUriWithVersion", m.KeyURIWithVersion) + populate(objectMap, "kty", m.Kty) + populate(objectMap, "release_policy", m.ReleasePolicy) + populate(objectMap, "rotationPolicy", m.RotationPolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedHsmKeyProperties. +func (m *ManagedHsmKeyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "attributes": + err = unpopulate(val, "Attributes", &m.Attributes) + delete(rawMsg, key) + case "curveName": + err = unpopulate(val, "CurveName", &m.CurveName) + delete(rawMsg, key) + case "keyOps": + err = unpopulate(val, "KeyOps", &m.KeyOps) + delete(rawMsg, key) + case "keySize": + err = unpopulate(val, "KeySize", &m.KeySize) + delete(rawMsg, key) + case "keyUri": + err = unpopulate(val, "KeyURI", &m.KeyURI) + delete(rawMsg, key) + case "keyUriWithVersion": + err = unpopulate(val, "KeyURIWithVersion", &m.KeyURIWithVersion) + delete(rawMsg, key) + case "kty": + err = unpopulate(val, "Kty", &m.Kty) + delete(rawMsg, key) + case "release_policy": + err = unpopulate(val, "ReleasePolicy", &m.ReleasePolicy) + delete(rawMsg, key) + case "rotationPolicy": + err = unpopulate(val, "RotationPolicy", &m.RotationPolicy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedHsmKeyReleasePolicy. +func (m ManagedHsmKeyReleasePolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "contentType", m.ContentType) + populateByteArray(objectMap, "data", m.Data, runtime.Base64URLFormat) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedHsmKeyReleasePolicy. +func (m *ManagedHsmKeyReleasePolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "contentType": + err = unpopulate(val, "ContentType", &m.ContentType) + delete(rawMsg, key) + case "data": + err = runtime.DecodeByteArray(string(val), &m.Data, runtime.Base64URLFormat) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedHsmKeyRotationPolicyAttributes. +func (m ManagedHsmKeyRotationPolicyAttributes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "created", m.Created) + populate(objectMap, "expiryTime", m.ExpiryTime) + populate(objectMap, "updated", m.Updated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedHsmKeyRotationPolicyAttributes. +func (m *ManagedHsmKeyRotationPolicyAttributes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "created": + err = unpopulate(val, "Created", &m.Created) + delete(rawMsg, key) + case "expiryTime": + err = unpopulate(val, "ExpiryTime", &m.ExpiryTime) + delete(rawMsg, key) + case "updated": + err = unpopulate(val, "Updated", &m.Updated) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedHsmLifetimeAction. +func (m ManagedHsmLifetimeAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "action", m.Action) + populate(objectMap, "trigger", m.Trigger) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedHsmLifetimeAction. +func (m *ManagedHsmLifetimeAction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &m.Action) + delete(rawMsg, key) + case "trigger": + err = unpopulate(val, "Trigger", &m.Trigger) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedHsmListResult. +func (m ManagedHsmListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedHsmListResult. +func (m *ManagedHsmListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedHsmProperties. +func (m ManagedHsmProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "createMode", m.CreateMode) + populate(objectMap, "enablePurgeProtection", m.EnablePurgeProtection) + populate(objectMap, "enableSoftDelete", m.EnableSoftDelete) + populate(objectMap, "hsmUri", m.HsmURI) + populate(objectMap, "initialAdminObjectIds", m.InitialAdminObjectIDs) + populate(objectMap, "networkAcls", m.NetworkACLs) + populate(objectMap, "privateEndpointConnections", m.PrivateEndpointConnections) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "publicNetworkAccess", m.PublicNetworkAccess) + populateTimeRFC3339(objectMap, "scheduledPurgeDate", m.ScheduledPurgeDate) + populate(objectMap, "securityDomainProperties", m.SecurityDomainProperties) + populate(objectMap, "softDeleteRetentionInDays", m.SoftDeleteRetentionInDays) + populate(objectMap, "statusMessage", m.StatusMessage) + populate(objectMap, "tenantId", m.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedHsmProperties. +func (m *ManagedHsmProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createMode": + err = unpopulate(val, "CreateMode", &m.CreateMode) + delete(rawMsg, key) + case "enablePurgeProtection": + err = unpopulate(val, "EnablePurgeProtection", &m.EnablePurgeProtection) + delete(rawMsg, key) + case "enableSoftDelete": + err = unpopulate(val, "EnableSoftDelete", &m.EnableSoftDelete) + delete(rawMsg, key) + case "hsmUri": + err = unpopulate(val, "HsmURI", &m.HsmURI) + delete(rawMsg, key) + case "initialAdminObjectIds": + err = unpopulate(val, "InitialAdminObjectIDs", &m.InitialAdminObjectIDs) + delete(rawMsg, key) + case "networkAcls": + err = unpopulate(val, "NetworkACLs", &m.NetworkACLs) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &m.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &m.PublicNetworkAccess) + delete(rawMsg, key) + case "scheduledPurgeDate": + err = unpopulateTimeRFC3339(val, "ScheduledPurgeDate", &m.ScheduledPurgeDate) + delete(rawMsg, key) + case "securityDomainProperties": + err = unpopulate(val, "SecurityDomainProperties", &m.SecurityDomainProperties) + delete(rawMsg, key) + case "softDeleteRetentionInDays": + err = unpopulate(val, "SoftDeleteRetentionInDays", &m.SoftDeleteRetentionInDays) + delete(rawMsg, key) + case "statusMessage": + err = unpopulate(val, "StatusMessage", &m.StatusMessage) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedHsmResource. +func (m ManagedHsmResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "sku", m.SKU) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedHsmResource. +func (m *ManagedHsmResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &m.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedHsmRotationPolicy. +func (m ManagedHsmRotationPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "attributes", m.Attributes) + populate(objectMap, "lifetimeActions", m.LifetimeActions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedHsmRotationPolicy. +func (m *ManagedHsmRotationPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "attributes": + err = unpopulate(val, "Attributes", &m.Attributes) + delete(rawMsg, key) + case "lifetimeActions": + err = unpopulate(val, "LifetimeActions", &m.LifetimeActions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedHsmSKU. +func (m ManagedHsmSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + if m.Family == nil { + m.Family = to.Ptr(ManagedHsmSKUFamilyB) + } + populate(objectMap, "family", m.Family) + populate(objectMap, "name", m.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedHsmSKU. +func (m *ManagedHsmSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "family": + err = unpopulate(val, "Family", &m.Family) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedHsmTrigger. +func (m ManagedHsmTrigger) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "timeAfterCreate", m.TimeAfterCreate) + populate(objectMap, "timeBeforeExpiry", m.TimeBeforeExpiry) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedHsmTrigger. +func (m *ManagedHsmTrigger) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "timeAfterCreate": + err = unpopulate(val, "TimeAfterCreate", &m.TimeAfterCreate) + delete(rawMsg, key) + case "timeBeforeExpiry": + err = unpopulate(val, "TimeBeforeExpiry", &m.TimeBeforeExpiry) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricSpecification. +func (m MetricSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "aggregationType", m.AggregationType) + populate(objectMap, "dimensions", m.Dimensions) + populate(objectMap, "displayDescription", m.DisplayDescription) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "fillGapWithZero", m.FillGapWithZero) + populate(objectMap, "internalMetricName", m.InternalMetricName) + populate(objectMap, "lockAggregationType", m.LockAggregationType) + populate(objectMap, "name", m.Name) + populate(objectMap, "supportedAggregationTypes", m.SupportedAggregationTypes) + populate(objectMap, "supportedTimeGrainTypes", m.SupportedTimeGrainTypes) + populate(objectMap, "unit", m.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricSpecification. +func (m *MetricSpecification) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregationType": + err = unpopulate(val, "AggregationType", &m.AggregationType) + delete(rawMsg, key) + case "dimensions": + err = unpopulate(val, "Dimensions", &m.Dimensions) + delete(rawMsg, key) + case "displayDescription": + err = unpopulate(val, "DisplayDescription", &m.DisplayDescription) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "fillGapWithZero": + err = unpopulate(val, "FillGapWithZero", &m.FillGapWithZero) + delete(rawMsg, key) + case "internalMetricName": + err = unpopulate(val, "InternalMetricName", &m.InternalMetricName) + delete(rawMsg, key) + case "lockAggregationType": + err = unpopulate(val, "LockAggregationType", &m.LockAggregationType) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "supportedAggregationTypes": + err = unpopulate(val, "SupportedAggregationTypes", &m.SupportedAggregationTypes) + delete(rawMsg, key) + case "supportedTimeGrainTypes": + err = unpopulate(val, "SupportedTimeGrainTypes", &m.SupportedTimeGrainTypes) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &m.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkRuleSet. +func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "bypass", n.Bypass) + populate(objectMap, "defaultAction", n.DefaultAction) + populate(objectMap, "ipRules", n.IPRules) + populate(objectMap, "virtualNetworkRules", n.VirtualNetworkRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkRuleSet. +func (n *NetworkRuleSet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bypass": + err = unpopulate(val, "Bypass", &n.Bypass) + delete(rawMsg, key) + case "defaultAction": + err = unpopulate(val, "DefaultAction", &n.DefaultAction) + delete(rawMsg, key) + case "ipRules": + err = unpopulate(val, "IPRules", &n.IPRules) + delete(rawMsg, key) + case "virtualNetworkRules": + err = unpopulate(val, "VirtualNetworkRules", &n.VirtualNetworkRules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.OperationProperties) + 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 "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 "properties": + err = unpopulate(val, "OperationProperties", &o.OperationProperties) + 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 OperationProperties. +func (o OperationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "serviceSpecification", o.ServiceSpecification) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationProperties. +func (o *OperationProperties) 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 "serviceSpecification": + err = unpopulate(val, "ServiceSpecification", &o.ServiceSpecification) + 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 Permissions. +func (p Permissions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "certificates", p.Certificates) + populate(objectMap, "keys", p.Keys) + populate(objectMap, "secrets", p.Secrets) + populate(objectMap, "storage", p.Storage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Permissions. +func (p *Permissions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "certificates": + err = unpopulate(val, "Certificates", &p.Certificates) + delete(rawMsg, key) + case "keys": + err = unpopulate(val, "Keys", &p.Keys) + delete(rawMsg, key) + case "secrets": + err = unpopulate(val, "Secrets", &p.Secrets) + delete(rawMsg, key) + case "storage": + err = unpopulate(val, "Storage", &p.Storage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. +func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. +func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionItem. +func (p PrivateEndpointConnectionItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionItem. +func (p *PrivateEndpointConnectionItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. +func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. +func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyResourceWithoutSystemData. +func (p ProxyResourceWithoutSystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResourceWithoutSystemData. +func (p *ProxyResourceWithoutSystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceListResult. +func (r ResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceListResult. +func (r *ResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RotationPolicy. +func (r RotationPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "attributes", r.Attributes) + populate(objectMap, "lifetimeActions", r.LifetimeActions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RotationPolicy. +func (r *RotationPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "attributes": + err = unpopulate(val, "Attributes", &r.Attributes) + delete(rawMsg, key) + case "lifetimeActions": + err = unpopulate(val, "LifetimeActions", &r.LifetimeActions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SKU. +func (s SKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + if s.Family == nil { + s.Family = to.Ptr(SKUFamilyA) + } + populate(objectMap, "family", s.Family) + populate(objectMap, "name", s.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKU. +func (s *SKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "family": + err = unpopulate(val, "Family", &s.Family) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Secret. +func (s Secret) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Secret. +func (s *Secret) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecretAttributes. +func (s SecretAttributes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeUnix(objectMap, "created", s.Created) + populate(objectMap, "enabled", s.Enabled) + populateTimeUnix(objectMap, "exp", s.Expires) + populateTimeUnix(objectMap, "nbf", s.NotBefore) + populateTimeUnix(objectMap, "updated", s.Updated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretAttributes. +func (s *SecretAttributes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "created": + err = unpopulateTimeUnix(val, "Created", &s.Created) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &s.Enabled) + delete(rawMsg, key) + case "exp": + err = unpopulateTimeUnix(val, "Expires", &s.Expires) + delete(rawMsg, key) + case "nbf": + err = unpopulateTimeUnix(val, "NotBefore", &s.NotBefore) + delete(rawMsg, key) + case "updated": + err = unpopulateTimeUnix(val, "Updated", &s.Updated) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecretCreateOrUpdateParameters. +func (s SecretCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretCreateOrUpdateParameters. +func (s *SecretCreateOrUpdateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecretListResult. +func (s SecretListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretListResult. +func (s *SecretListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecretPatchParameters. +func (s SecretPatchParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretPatchParameters. +func (s *SecretPatchParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecretPatchProperties. +func (s SecretPatchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "attributes", s.Attributes) + populate(objectMap, "contentType", s.ContentType) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretPatchProperties. +func (s *SecretPatchProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "attributes": + err = unpopulate(val, "Attributes", &s.Attributes) + delete(rawMsg, key) + case "contentType": + err = unpopulate(val, "ContentType", &s.ContentType) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecretProperties. +func (s SecretProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "attributes", s.Attributes) + populate(objectMap, "contentType", s.ContentType) + populate(objectMap, "secretUri", s.SecretURI) + populate(objectMap, "secretUriWithVersion", s.SecretURIWithVersion) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretProperties. +func (s *SecretProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "attributes": + err = unpopulate(val, "Attributes", &s.Attributes) + delete(rawMsg, key) + case "contentType": + err = unpopulate(val, "ContentType", &s.ContentType) + delete(rawMsg, key) + case "secretUri": + err = unpopulate(val, "SecretURI", &s.SecretURI) + delete(rawMsg, key) + case "secretUriWithVersion": + err = unpopulate(val, "SecretURIWithVersion", &s.SecretURIWithVersion) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceSpecification. +func (s ServiceSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "logSpecifications", s.LogSpecifications) + populate(objectMap, "metricSpecifications", s.MetricSpecifications) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceSpecification. +func (s *ServiceSpecification) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logSpecifications": + err = unpopulate(val, "LogSpecifications", &s.LogSpecifications) + delete(rawMsg, key) + case "metricSpecifications": + err = unpopulate(val, "MetricSpecifications", &s.MetricSpecifications) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Trigger. +func (t Trigger) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "timeAfterCreate", t.TimeAfterCreate) + populate(objectMap, "timeBeforeExpiry", t.TimeBeforeExpiry) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Trigger. +func (t *Trigger) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "timeAfterCreate": + err = unpopulate(val, "TimeAfterCreate", &t.TimeAfterCreate) + delete(rawMsg, key) + case "timeBeforeExpiry": + err = unpopulate(val, "TimeBeforeExpiry", &t.TimeBeforeExpiry) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Vault. +func (v Vault) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "systemData", v.SystemData) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Vault. +func (v *Vault) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &v.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VaultAccessPolicyParameters. +func (v VaultAccessPolicyParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VaultAccessPolicyParameters. +func (v *VaultAccessPolicyParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VaultAccessPolicyProperties. +func (v VaultAccessPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accessPolicies", v.AccessPolicies) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VaultAccessPolicyProperties. +func (v *VaultAccessPolicyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accessPolicies": + err = unpopulate(val, "AccessPolicies", &v.AccessPolicies) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VaultCheckNameAvailabilityParameters. +func (v VaultCheckNameAvailabilityParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", v.Name) + objectMap["type"] = "Microsoft.KeyVault/vaults" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VaultCheckNameAvailabilityParameters. +func (v *VaultCheckNameAvailabilityParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VaultCreateOrUpdateParameters. +func (v VaultCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "location", v.Location) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VaultCreateOrUpdateParameters. +func (v *VaultCreateOrUpdateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VaultListResult. +func (v VaultListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VaultListResult. +func (v *VaultListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VaultPatchParameters. +func (v VaultPatchParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VaultPatchParameters. +func (v *VaultPatchParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VaultPatchProperties. +func (v VaultPatchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accessPolicies", v.AccessPolicies) + populate(objectMap, "createMode", v.CreateMode) + populate(objectMap, "enablePurgeProtection", v.EnablePurgeProtection) + populate(objectMap, "enableRbacAuthorization", v.EnableRbacAuthorization) + populate(objectMap, "enableSoftDelete", v.EnableSoftDelete) + populate(objectMap, "enabledForDeployment", v.EnabledForDeployment) + populate(objectMap, "enabledForDiskEncryption", v.EnabledForDiskEncryption) + populate(objectMap, "enabledForTemplateDeployment", v.EnabledForTemplateDeployment) + populate(objectMap, "networkAcls", v.NetworkACLs) + populate(objectMap, "publicNetworkAccess", v.PublicNetworkAccess) + populate(objectMap, "sku", v.SKU) + populate(objectMap, "softDeleteRetentionInDays", v.SoftDeleteRetentionInDays) + populate(objectMap, "tenantId", v.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VaultPatchProperties. +func (v *VaultPatchProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accessPolicies": + err = unpopulate(val, "AccessPolicies", &v.AccessPolicies) + delete(rawMsg, key) + case "createMode": + err = unpopulate(val, "CreateMode", &v.CreateMode) + delete(rawMsg, key) + case "enablePurgeProtection": + err = unpopulate(val, "EnablePurgeProtection", &v.EnablePurgeProtection) + delete(rawMsg, key) + case "enableRbacAuthorization": + err = unpopulate(val, "EnableRbacAuthorization", &v.EnableRbacAuthorization) + delete(rawMsg, key) + case "enableSoftDelete": + err = unpopulate(val, "EnableSoftDelete", &v.EnableSoftDelete) + delete(rawMsg, key) + case "enabledForDeployment": + err = unpopulate(val, "EnabledForDeployment", &v.EnabledForDeployment) + delete(rawMsg, key) + case "enabledForDiskEncryption": + err = unpopulate(val, "EnabledForDiskEncryption", &v.EnabledForDiskEncryption) + delete(rawMsg, key) + case "enabledForTemplateDeployment": + err = unpopulate(val, "EnabledForTemplateDeployment", &v.EnabledForTemplateDeployment) + delete(rawMsg, key) + case "networkAcls": + err = unpopulate(val, "NetworkACLs", &v.NetworkACLs) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &v.PublicNetworkAccess) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &v.SKU) + delete(rawMsg, key) + case "softDeleteRetentionInDays": + err = unpopulate(val, "SoftDeleteRetentionInDays", &v.SoftDeleteRetentionInDays) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &v.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VaultProperties. +func (v VaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accessPolicies", v.AccessPolicies) + populate(objectMap, "createMode", v.CreateMode) + populate(objectMap, "enablePurgeProtection", v.EnablePurgeProtection) + populate(objectMap, "enableRbacAuthorization", v.EnableRbacAuthorization) + populate(objectMap, "enableSoftDelete", v.EnableSoftDelete) + populate(objectMap, "enabledForDeployment", v.EnabledForDeployment) + populate(objectMap, "enabledForDiskEncryption", v.EnabledForDiskEncryption) + populate(objectMap, "enabledForTemplateDeployment", v.EnabledForTemplateDeployment) + populate(objectMap, "hsmPoolResourceId", v.HsmPoolResourceID) + populate(objectMap, "networkAcls", v.NetworkACLs) + populate(objectMap, "privateEndpointConnections", v.PrivateEndpointConnections) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "publicNetworkAccess", v.PublicNetworkAccess) + populate(objectMap, "sku", v.SKU) + populate(objectMap, "softDeleteRetentionInDays", v.SoftDeleteRetentionInDays) + populate(objectMap, "tenantId", v.TenantID) + populate(objectMap, "vaultUri", v.VaultURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VaultProperties. +func (v *VaultProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accessPolicies": + err = unpopulate(val, "AccessPolicies", &v.AccessPolicies) + delete(rawMsg, key) + case "createMode": + err = unpopulate(val, "CreateMode", &v.CreateMode) + delete(rawMsg, key) + case "enablePurgeProtection": + err = unpopulate(val, "EnablePurgeProtection", &v.EnablePurgeProtection) + delete(rawMsg, key) + case "enableRbacAuthorization": + err = unpopulate(val, "EnableRbacAuthorization", &v.EnableRbacAuthorization) + delete(rawMsg, key) + case "enableSoftDelete": + err = unpopulate(val, "EnableSoftDelete", &v.EnableSoftDelete) + delete(rawMsg, key) + case "enabledForDeployment": + err = unpopulate(val, "EnabledForDeployment", &v.EnabledForDeployment) + delete(rawMsg, key) + case "enabledForDiskEncryption": + err = unpopulate(val, "EnabledForDiskEncryption", &v.EnabledForDiskEncryption) + delete(rawMsg, key) + case "enabledForTemplateDeployment": + err = unpopulate(val, "EnabledForTemplateDeployment", &v.EnabledForTemplateDeployment) + delete(rawMsg, key) + case "hsmPoolResourceId": + err = unpopulate(val, "HsmPoolResourceID", &v.HsmPoolResourceID) + delete(rawMsg, key) + case "networkAcls": + err = unpopulate(val, "NetworkACLs", &v.NetworkACLs) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &v.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &v.PublicNetworkAccess) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &v.SKU) + delete(rawMsg, key) + case "softDeleteRetentionInDays": + err = unpopulate(val, "SoftDeleteRetentionInDays", &v.SoftDeleteRetentionInDays) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &v.TenantID) + delete(rawMsg, key) + case "vaultUri": + err = unpopulate(val, "VaultURI", &v.VaultURI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkRule. +func (v VirtualNetworkRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", v.ID) + populate(objectMap, "ignoreMissingVnetServiceEndpoint", v.IgnoreMissingVnetServiceEndpoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkRule. +func (v *VirtualNetworkRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "ignoreMissingVnetServiceEndpoint": + err = unpopulate(val, "IgnoreMissingVnetServiceEndpoint", &v.IgnoreMissingVnetServiceEndpoint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func populateByteArray(m map[string]any, k string, b []byte, f runtime.Base64Encoding) { + if azcore.IsNullValue(b) { + m[k] = nil + } else if len(b) == 0 { + return + } else { + m[k] = runtime.EncodeByteArray(b, f) + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_operations_client.go b/sdk/resourcemanager/keyvault/armkeyvault/operations_client.go similarity index 89% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_operations_client.go rename to sdk/resourcemanager/keyvault/armkeyvault/operations_client.go index c8bc4f50e717..1b8eb821718a 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_operations_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/operations_client.go @@ -5,6 +5,7 @@ // 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 armkeyvault @@ -27,8 +28,8 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -49,9 +50,9 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists all of the available Key Vault Rest API operations. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// +// Generated from API version 2022-11-01 +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ More: func(page OperationsClientListResponse) bool { @@ -88,7 +89,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/keyvault/armkeyvault/privateendpointconnections_client.go similarity index 86% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_privateendpointconnections_client.go rename to sdk/resourcemanager/keyvault/armkeyvault/privateendpointconnections_client.go index 2c37f963ce96..b064e6fb63ce 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/privateendpointconnections_client.go @@ -5,6 +5,7 @@ // 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 armkeyvault @@ -32,10 +33,10 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -58,12 +59,13 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginDelete - Deletes the specified private endpoint connection associated with the key vault. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - Name of the resource group that contains the key vault. -// vaultName - The name of the key vault. -// privateEndpointConnectionName - Name of the private endpoint connection associated with the key vault. -// options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete -// method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - Name of the resource group that contains the key vault. +// - vaultName - The name of the key vault. +// - privateEndpointConnectionName - Name of the private endpoint connection associated with the key vault. +// - options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, vaultName, privateEndpointConnectionName, options) @@ -78,7 +80,8 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes the specified private endpoint connection associated with the key vault. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// +// Generated from API version 2022-11-01 func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vaultName, privateEndpointConnectionName, options) if err != nil { @@ -118,7 +121,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -126,12 +129,13 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Gets the specified private endpoint connection associated with the key vault. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - Name of the resource group that contains the key vault. -// vaultName - The name of the key vault. -// privateEndpointConnectionName - Name of the private endpoint connection associated with the key vault. -// options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - Name of the resource group that contains the key vault. +// - vaultName - The name of the key vault. +// - privateEndpointConnectionName - Name of the private endpoint connection associated with the key vault. +// - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, privateEndpointConnectionName, options) if err != nil { @@ -171,7 +175,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,12 +192,12 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListByResourcePager - The List operation gets information about the private endpoint connections associated with the // vault. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - Name of the resource group that contains the key vault. -// vaultName - The name of the key vault. -// options - PrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.ListByResource -// method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - Name of the resource group that contains the key vault. +// - vaultName - The name of the key vault. +// - options - PrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByResourcePager +// method. func (client *PrivateEndpointConnectionsClient) NewListByResourcePager(resourceGroupName string, vaultName string, options *PrivateEndpointConnectionsClientListByResourceOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByResourceResponse] { return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListByResourceResponse]{ More: func(page PrivateEndpointConnectionsClientListByResourceResponse) bool { @@ -242,7 +246,7 @@ func (client *PrivateEndpointConnectionsClient) listByResourceCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -259,13 +263,14 @@ func (client *PrivateEndpointConnectionsClient) listByResourceHandleResponse(res // Put - Updates the specified private endpoint connection associated with the key vault. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - Name of the resource group that contains the key vault. -// vaultName - The name of the key vault. -// privateEndpointConnectionName - Name of the private endpoint connection associated with the key vault. -// properties - The intended state of private endpoint connection. -// options - PrivateEndpointConnectionsClientPutOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Put -// method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - Name of the resource group that contains the key vault. +// - vaultName - The name of the key vault. +// - privateEndpointConnectionName - Name of the private endpoint connection associated with the key vault. +// - properties - The intended state of private endpoint connection. +// - options - PrivateEndpointConnectionsClientPutOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Put +// method. func (client *PrivateEndpointConnectionsClient) Put(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsClientPutOptions) (PrivateEndpointConnectionsClientPutResponse, error) { req, err := client.putCreateRequest(ctx, resourceGroupName, vaultName, privateEndpointConnectionName, properties, options) if err != nil { @@ -305,7 +310,7 @@ func (client *PrivateEndpointConnectionsClient) putCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, properties) diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/keyvault/armkeyvault/privatelinkresources_client.go similarity index 86% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_privatelinkresources_client.go rename to sdk/resourcemanager/keyvault/armkeyvault/privatelinkresources_client.go index 720b74b51223..5c43cd535a9f 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/privatelinkresources_client.go @@ -5,6 +5,7 @@ // 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 armkeyvault @@ -31,10 +32,10 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,11 +58,12 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // ListByVault - Gets the private link resources supported for the key vault. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - Name of the resource group that contains the key vault. -// vaultName - The name of the key vault. -// options - PrivateLinkResourcesClientListByVaultOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByVault -// method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - Name of the resource group that contains the key vault. +// - vaultName - The name of the key vault. +// - options - PrivateLinkResourcesClientListByVaultOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByVault +// method. func (client *PrivateLinkResourcesClient) ListByVault(ctx context.Context, resourceGroupName string, vaultName string, options *PrivateLinkResourcesClientListByVaultOptions) (PrivateLinkResourcesClientListByVaultResponse, error) { req, err := client.listByVaultCreateRequest(ctx, resourceGroupName, vaultName, options) if err != nil { @@ -97,7 +99,7 @@ func (client *PrivateLinkResourcesClient) listByVaultCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_response_types.go b/sdk/resourcemanager/keyvault/armkeyvault/response_types.go similarity index 77% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_response_types.go rename to sdk/resourcemanager/keyvault/armkeyvault/response_types.go index 7513e14035c1..ef6be5b9507b 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_response_types.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/response_types.go @@ -5,6 +5,7 @@ // 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 armkeyvault @@ -23,17 +24,17 @@ type KeysClientGetVersionResponse struct { Key } -// KeysClientListResponse contains the response from method KeysClient.List. +// KeysClientListResponse contains the response from method KeysClient.NewListPager. type KeysClientListResponse struct { KeyListResult } -// KeysClientListVersionsResponse contains the response from method KeysClient.ListVersions. +// KeysClientListVersionsResponse contains the response from method KeysClient.NewListVersionsPager. type KeysClientListVersionsResponse struct { KeyListResult } -// MHSMPrivateEndpointConnectionsClientDeleteResponse contains the response from method MHSMPrivateEndpointConnectionsClient.Delete. +// MHSMPrivateEndpointConnectionsClientDeleteResponse contains the response from method MHSMPrivateEndpointConnectionsClient.BeginDelete. type MHSMPrivateEndpointConnectionsClientDeleteResponse struct { MHSMPrivateEndpointConnection } @@ -43,7 +44,7 @@ type MHSMPrivateEndpointConnectionsClientGetResponse struct { MHSMPrivateEndpointConnection } -// MHSMPrivateEndpointConnectionsClientListByResourceResponse contains the response from method MHSMPrivateEndpointConnectionsClient.ListByResource. +// MHSMPrivateEndpointConnectionsClientListByResourceResponse contains the response from method MHSMPrivateEndpointConnectionsClient.NewListByResourcePager. type MHSMPrivateEndpointConnectionsClientListByResourceResponse struct { MHSMPrivateEndpointConnectionsListResult } @@ -63,12 +64,42 @@ type MHSMPrivateLinkResourcesClientListByMHSMResourceResponse struct { MHSMPrivateLinkResourceListResult } -// ManagedHsmsClientCreateOrUpdateResponse contains the response from method ManagedHsmsClient.CreateOrUpdate. +// ManagedHsmKeysClientCreateIfNotExistResponse contains the response from method ManagedHsmKeysClient.CreateIfNotExist. +type ManagedHsmKeysClientCreateIfNotExistResponse struct { + ManagedHsmKey +} + +// ManagedHsmKeysClientGetResponse contains the response from method ManagedHsmKeysClient.Get. +type ManagedHsmKeysClientGetResponse struct { + ManagedHsmKey +} + +// ManagedHsmKeysClientGetVersionResponse contains the response from method ManagedHsmKeysClient.GetVersion. +type ManagedHsmKeysClientGetVersionResponse struct { + ManagedHsmKey +} + +// ManagedHsmKeysClientListResponse contains the response from method ManagedHsmKeysClient.NewListPager. +type ManagedHsmKeysClientListResponse struct { + ManagedHsmKeyListResult +} + +// ManagedHsmKeysClientListVersionsResponse contains the response from method ManagedHsmKeysClient.NewListVersionsPager. +type ManagedHsmKeysClientListVersionsResponse struct { + ManagedHsmKeyListResult +} + +// ManagedHsmsClientCheckMhsmNameAvailabilityResponse contains the response from method ManagedHsmsClient.CheckMhsmNameAvailability. +type ManagedHsmsClientCheckMhsmNameAvailabilityResponse struct { + CheckMhsmNameAvailabilityResult +} + +// ManagedHsmsClientCreateOrUpdateResponse contains the response from method ManagedHsmsClient.BeginCreateOrUpdate. type ManagedHsmsClientCreateOrUpdateResponse struct { ManagedHsm } -// ManagedHsmsClientDeleteResponse contains the response from method ManagedHsmsClient.Delete. +// ManagedHsmsClientDeleteResponse contains the response from method ManagedHsmsClient.BeginDelete. type ManagedHsmsClientDeleteResponse struct { // placeholder for future response values } @@ -83,37 +114,37 @@ type ManagedHsmsClientGetResponse struct { ManagedHsm } -// ManagedHsmsClientListByResourceGroupResponse contains the response from method ManagedHsmsClient.ListByResourceGroup. +// ManagedHsmsClientListByResourceGroupResponse contains the response from method ManagedHsmsClient.NewListByResourceGroupPager. type ManagedHsmsClientListByResourceGroupResponse struct { ManagedHsmListResult } -// ManagedHsmsClientListBySubscriptionResponse contains the response from method ManagedHsmsClient.ListBySubscription. +// ManagedHsmsClientListBySubscriptionResponse contains the response from method ManagedHsmsClient.NewListBySubscriptionPager. type ManagedHsmsClientListBySubscriptionResponse struct { ManagedHsmListResult } -// ManagedHsmsClientListDeletedResponse contains the response from method ManagedHsmsClient.ListDeleted. +// ManagedHsmsClientListDeletedResponse contains the response from method ManagedHsmsClient.NewListDeletedPager. type ManagedHsmsClientListDeletedResponse struct { DeletedManagedHsmListResult } -// ManagedHsmsClientPurgeDeletedResponse contains the response from method ManagedHsmsClient.PurgeDeleted. +// ManagedHsmsClientPurgeDeletedResponse contains the response from method ManagedHsmsClient.BeginPurgeDeleted. type ManagedHsmsClientPurgeDeletedResponse struct { // placeholder for future response values } -// ManagedHsmsClientUpdateResponse contains the response from method ManagedHsmsClient.Update. +// ManagedHsmsClientUpdateResponse contains the response from method ManagedHsmsClient.BeginUpdate. type ManagedHsmsClientUpdateResponse struct { ManagedHsm } -// OperationsClientListResponse contains the response from method OperationsClient.List. +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { OperationListResult } -// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.Delete. +// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. type PrivateEndpointConnectionsClientDeleteResponse struct { PrivateEndpointConnection } @@ -123,7 +154,7 @@ type PrivateEndpointConnectionsClientGetResponse struct { PrivateEndpointConnection } -// PrivateEndpointConnectionsClientListByResourceResponse contains the response from method PrivateEndpointConnectionsClient.ListByResource. +// PrivateEndpointConnectionsClientListByResourceResponse contains the response from method PrivateEndpointConnectionsClient.NewListByResourcePager. type PrivateEndpointConnectionsClientListByResourceResponse struct { PrivateEndpointConnectionListResult } @@ -153,7 +184,7 @@ type SecretsClientGetResponse struct { Secret } -// SecretsClientListResponse contains the response from method SecretsClient.List. +// SecretsClientListResponse contains the response from method SecretsClient.NewListPager. type SecretsClientListResponse struct { SecretListResult } @@ -168,7 +199,7 @@ type VaultsClientCheckNameAvailabilityResponse struct { CheckNameAvailabilityResult } -// VaultsClientCreateOrUpdateResponse contains the response from method VaultsClient.CreateOrUpdate. +// VaultsClientCreateOrUpdateResponse contains the response from method VaultsClient.BeginCreateOrUpdate. type VaultsClientCreateOrUpdateResponse struct { Vault } @@ -188,27 +219,27 @@ type VaultsClientGetResponse struct { Vault } -// VaultsClientListByResourceGroupResponse contains the response from method VaultsClient.ListByResourceGroup. +// VaultsClientListByResourceGroupResponse contains the response from method VaultsClient.NewListByResourceGroupPager. type VaultsClientListByResourceGroupResponse struct { VaultListResult } -// VaultsClientListBySubscriptionResponse contains the response from method VaultsClient.ListBySubscription. +// VaultsClientListBySubscriptionResponse contains the response from method VaultsClient.NewListBySubscriptionPager. type VaultsClientListBySubscriptionResponse struct { VaultListResult } -// VaultsClientListDeletedResponse contains the response from method VaultsClient.ListDeleted. +// VaultsClientListDeletedResponse contains the response from method VaultsClient.NewListDeletedPager. type VaultsClientListDeletedResponse struct { DeletedVaultListResult } -// VaultsClientListResponse contains the response from method VaultsClient.List. +// VaultsClientListResponse contains the response from method VaultsClient.NewListPager. type VaultsClientListResponse struct { ResourceListResult } -// VaultsClientPurgeDeletedResponse contains the response from method VaultsClient.PurgeDeleted. +// VaultsClientPurgeDeletedResponse contains the response from method VaultsClient.BeginPurgeDeleted. type VaultsClientPurgeDeletedResponse struct { // placeholder for future response values } diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_secrets_client.go b/sdk/resourcemanager/keyvault/armkeyvault/secrets_client.go similarity index 86% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_secrets_client.go rename to sdk/resourcemanager/keyvault/armkeyvault/secrets_client.go index ebe2ac8ccd98..b724f58b4a76 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_secrets_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/secrets_client.go @@ -5,6 +5,7 @@ // 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 armkeyvault @@ -32,10 +33,10 @@ type SecretsClient struct { } // NewSecretsClient creates a new instance of SecretsClient with the specified values. -// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewSecretsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SecretsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -60,12 +61,14 @@ func NewSecretsClient(subscriptionID string, credential azcore.TokenCredential, // internal use in ARM deployments. Users should use the data-plane REST service for interaction // with vault secrets. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - The name of the Resource Group to which the vault belongs. -// vaultName - Name of the vault -// secretName - Name of the secret -// parameters - Parameters to create or update the secret -// options - SecretsClientCreateOrUpdateOptions contains the optional parameters for the SecretsClient.CreateOrUpdate method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the Resource Group to which the vault belongs. +// - vaultName - Name of the vault +// - secretName - Name of the secret. The value you provide may be copied globally for the purpose of running the service. The +// value provided should not include personally identifiable or sensitive information. +// - parameters - Parameters to create or update the secret +// - options - SecretsClientCreateOrUpdateOptions contains the optional parameters for the SecretsClient.CreateOrUpdate method. func (client *SecretsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, secretName string, parameters SecretCreateOrUpdateParameters, options *SecretsClientCreateOrUpdateOptions) (SecretsClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vaultName, secretName, parameters, options) if err != nil { @@ -105,7 +108,7 @@ func (client *SecretsClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -123,11 +126,12 @@ func (client *SecretsClient) createOrUpdateHandleResponse(resp *http.Response) ( // Get - Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane // REST service for interaction with vault secrets. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - The name of the Resource Group to which the vault belongs. -// vaultName - The name of the vault. -// secretName - The name of the secret. -// options - SecretsClientGetOptions contains the optional parameters for the SecretsClient.Get method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the Resource Group to which the vault belongs. +// - vaultName - The name of the vault. +// - secretName - The name of the secret. +// - options - SecretsClientGetOptions contains the optional parameters for the SecretsClient.Get method. func (client *SecretsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, secretName string, options *SecretsClientGetOptions) (SecretsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, secretName, options) if err != nil { @@ -167,7 +171,7 @@ func (client *SecretsClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -185,11 +189,11 @@ func (client *SecretsClient) getHandleResponse(resp *http.Response) (SecretsClie // NewListPager - The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal // use in ARM deployments. Users should use the data-plane REST service for interaction with // vault secrets. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - The name of the Resource Group to which the vault belongs. -// vaultName - The name of the vault. -// options - SecretsClientListOptions contains the optional parameters for the SecretsClient.List method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the Resource Group to which the vault belongs. +// - vaultName - The name of the vault. +// - options - SecretsClientListOptions contains the optional parameters for the SecretsClient.NewListPager method. func (client *SecretsClient) NewListPager(resourceGroupName string, vaultName string, options *SecretsClientListOptions) *runtime.Pager[SecretsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SecretsClientListResponse]{ More: func(page SecretsClientListResponse) bool { @@ -241,7 +245,7 @@ func (client *SecretsClient) listCreateRequest(ctx context.Context, resourceGrou if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -259,12 +263,13 @@ func (client *SecretsClient) listHandleResponse(resp *http.Response) (SecretsCli // Update - Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. // Users should use the data-plane REST service for interaction with vault secrets. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - The name of the Resource Group to which the vault belongs. -// vaultName - Name of the vault -// secretName - Name of the secret -// parameters - Parameters to patch the secret -// options - SecretsClientUpdateOptions contains the optional parameters for the SecretsClient.Update method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the Resource Group to which the vault belongs. +// - vaultName - Name of the vault +// - secretName - Name of the secret +// - parameters - Parameters to patch the secret +// - options - SecretsClientUpdateOptions contains the optional parameters for the SecretsClient.Update method. func (client *SecretsClient) Update(ctx context.Context, resourceGroupName string, vaultName string, secretName string, parameters SecretPatchParameters, options *SecretsClientUpdateOptions) (SecretsClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vaultName, secretName, parameters, options) if err != nil { @@ -304,7 +309,7 @@ func (client *SecretsClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_time_rfc3339.go b/sdk/resourcemanager/keyvault/armkeyvault/time_rfc3339.go similarity index 96% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/keyvault/armkeyvault/time_rfc3339.go index 543471aa0fd7..6b10975133d0 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/time_rfc3339.go @@ -5,6 +5,7 @@ // 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 armkeyvault @@ -61,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_time_unix.go b/sdk/resourcemanager/keyvault/armkeyvault/time_unix.go similarity index 94% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_time_unix.go rename to sdk/resourcemanager/keyvault/armkeyvault/time_unix.go index 6ef8910872f9..569805882692 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_time_unix.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/time_unix.go @@ -5,6 +5,7 @@ // 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 armkeyvault @@ -36,7 +37,7 @@ func (t timeUnix) String() string { return fmt.Sprintf("%d", time.Time(t).Unix()) } -func populateTimeUnix(m map[string]interface{}, k string, t *time.Time) { +func populateTimeUnix(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_vaults_client.go b/sdk/resourcemanager/keyvault/armkeyvault/vaults_client.go similarity index 87% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_vaults_client.go rename to sdk/resourcemanager/keyvault/armkeyvault/vaults_client.go index fbda80eb56c9..84a5e47dc085 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_vaults_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/vaults_client.go @@ -5,6 +5,7 @@ // 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 armkeyvault @@ -32,10 +33,10 @@ type VaultsClient struct { } // NewVaultsClient creates a new instance of VaultsClient with the specified values. -// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewVaultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VaultsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -58,10 +59,11 @@ func NewVaultsClient(subscriptionID string, credential azcore.TokenCredential, o // CheckNameAvailability - Checks that the vault name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// vaultName - The name of the vault. -// options - VaultsClientCheckNameAvailabilityOptions contains the optional parameters for the VaultsClient.CheckNameAvailability -// method. +// +// Generated from API version 2022-11-01 +// - vaultName - The name of the vault. +// - options - VaultsClientCheckNameAvailabilityOptions contains the optional parameters for the VaultsClient.CheckNameAvailability +// method. func (client *VaultsClient) CheckNameAvailability(ctx context.Context, vaultName VaultCheckNameAvailabilityParameters, options *VaultsClientCheckNameAvailabilityOptions) (VaultsClientCheckNameAvailabilityResponse, error) { req, err := client.checkNameAvailabilityCreateRequest(ctx, vaultName, options) if err != nil { @@ -89,7 +91,7 @@ func (client *VaultsClient) checkNameAvailabilityCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, vaultName) @@ -106,12 +108,13 @@ func (client *VaultsClient) checkNameAvailabilityHandleResponse(resp *http.Respo // BeginCreateOrUpdate - Create or update a key vault in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - The name of the Resource Group to which the server belongs. -// vaultName - Name of the vault -// parameters - Parameters to create or update the vault -// options - VaultsClientBeginCreateOrUpdateOptions contains the optional parameters for the VaultsClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the Resource Group to which the server belongs. +// - vaultName - Name of the vault +// - parameters - Parameters to create or update the vault +// - options - VaultsClientBeginCreateOrUpdateOptions contains the optional parameters for the VaultsClient.BeginCreateOrUpdate +// method. func (client *VaultsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, parameters VaultCreateOrUpdateParameters, options *VaultsClientBeginCreateOrUpdateOptions) (*runtime.Poller[VaultsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, vaultName, parameters, options) @@ -126,7 +129,8 @@ func (client *VaultsClient) BeginCreateOrUpdate(ctx context.Context, resourceGro // CreateOrUpdate - Create or update a key vault in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// +// Generated from API version 2022-11-01 func (client *VaultsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, parameters VaultCreateOrUpdateParameters, options *VaultsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vaultName, parameters, options) if err != nil { @@ -162,7 +166,7 @@ func (client *VaultsClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -170,10 +174,11 @@ func (client *VaultsClient) createOrUpdateCreateRequest(ctx context.Context, res // Delete - Deletes the specified Azure key vault. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - The name of the Resource Group to which the vault belongs. -// vaultName - The name of the vault to delete -// options - VaultsClientDeleteOptions contains the optional parameters for the VaultsClient.Delete method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the Resource Group to which the vault belongs. +// - vaultName - The name of the vault to delete +// - options - VaultsClientDeleteOptions contains the optional parameters for the VaultsClient.Delete method. func (client *VaultsClient) Delete(ctx context.Context, resourceGroupName string, vaultName string, options *VaultsClientDeleteOptions) (VaultsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vaultName, options) if err != nil { @@ -209,7 +214,7 @@ func (client *VaultsClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -217,10 +222,11 @@ func (client *VaultsClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Gets the specified Azure key vault. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - The name of the Resource Group to which the vault belongs. -// vaultName - The name of the vault. -// options - VaultsClientGetOptions contains the optional parameters for the VaultsClient.Get method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the Resource Group to which the vault belongs. +// - vaultName - The name of the vault. +// - options - VaultsClientGetOptions contains the optional parameters for the VaultsClient.Get method. func (client *VaultsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, options *VaultsClientGetOptions) (VaultsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, options) if err != nil { @@ -256,7 +262,7 @@ func (client *VaultsClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -273,10 +279,11 @@ func (client *VaultsClient) getHandleResponse(resp *http.Response) (VaultsClient // GetDeleted - Gets the deleted Azure key vault. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// vaultName - The name of the vault. -// location - The location of the deleted vault. -// options - VaultsClientGetDeletedOptions contains the optional parameters for the VaultsClient.GetDeleted method. +// +// Generated from API version 2022-11-01 +// - vaultName - The name of the vault. +// - location - The location of the deleted vault. +// - options - VaultsClientGetDeletedOptions contains the optional parameters for the VaultsClient.GetDeleted method. func (client *VaultsClient) GetDeleted(ctx context.Context, vaultName string, location string, options *VaultsClientGetDeletedOptions) (VaultsClientGetDeletedResponse, error) { req, err := client.getDeletedCreateRequest(ctx, vaultName, location, options) if err != nil { @@ -312,7 +319,7 @@ func (client *VaultsClient) getDeletedCreateRequest(ctx context.Context, vaultNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -328,9 +335,9 @@ func (client *VaultsClient) getDeletedHandleResponse(resp *http.Response) (Vault } // NewListPager - The List operation gets information about the vaults associated with the subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// options - VaultsClientListOptions contains the optional parameters for the VaultsClient.List method. +// +// Generated from API version 2022-11-01 +// - options - VaultsClientListOptions contains the optional parameters for the VaultsClient.NewListPager method. func (client *VaultsClient) NewListPager(options *VaultsClientListOptions) *runtime.Pager[VaultsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[VaultsClientListResponse]{ More: func(page VaultsClientListResponse) bool { @@ -392,11 +399,11 @@ func (client *VaultsClient) listHandleResponse(resp *http.Response) (VaultsClien // NewListByResourceGroupPager - The List operation gets information about the vaults associated with the subscription and // within the specified resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - The name of the Resource Group to which the vault belongs. -// options - VaultsClientListByResourceGroupOptions contains the optional parameters for the VaultsClient.ListByResourceGroup -// method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the Resource Group to which the vault belongs. +// - options - VaultsClientListByResourceGroupOptions contains the optional parameters for the VaultsClient.NewListByResourceGroupPager +// method. func (client *VaultsClient) NewListByResourceGroupPager(resourceGroupName string, options *VaultsClientListByResourceGroupOptions) *runtime.Pager[VaultsClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[VaultsClientListByResourceGroupResponse]{ More: func(page VaultsClientListByResourceGroupResponse) bool { @@ -444,7 +451,7 @@ func (client *VaultsClient) listByResourceGroupCreateRequest(ctx context.Context if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -460,10 +467,10 @@ func (client *VaultsClient) listByResourceGroupHandleResponse(resp *http.Respons } // NewListBySubscriptionPager - The List operation gets information about the vaults associated with the subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// options - VaultsClientListBySubscriptionOptions contains the optional parameters for the VaultsClient.ListBySubscription -// method. +// +// Generated from API version 2022-11-01 +// - options - VaultsClientListBySubscriptionOptions contains the optional parameters for the VaultsClient.NewListBySubscriptionPager +// method. func (client *VaultsClient) NewListBySubscriptionPager(options *VaultsClientListBySubscriptionOptions) *runtime.Pager[VaultsClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[VaultsClientListBySubscriptionResponse]{ More: func(page VaultsClientListBySubscriptionResponse) bool { @@ -507,7 +514,7 @@ func (client *VaultsClient) listBySubscriptionCreateRequest(ctx context.Context, if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -523,9 +530,9 @@ func (client *VaultsClient) listBySubscriptionHandleResponse(resp *http.Response } // NewListDeletedPager - Gets information about the deleted vaults in a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// options - VaultsClientListDeletedOptions contains the optional parameters for the VaultsClient.ListDeleted method. +// +// Generated from API version 2022-11-01 +// - options - VaultsClientListDeletedOptions contains the optional parameters for the VaultsClient.NewListDeletedPager method. func (client *VaultsClient) NewListDeletedPager(options *VaultsClientListDeletedOptions) *runtime.Pager[VaultsClientListDeletedResponse] { return runtime.NewPager(runtime.PagingHandler[VaultsClientListDeletedResponse]{ More: func(page VaultsClientListDeletedResponse) bool { @@ -566,7 +573,7 @@ func (client *VaultsClient) listDeletedCreateRequest(ctx context.Context, option return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -583,11 +590,12 @@ func (client *VaultsClient) listDeletedHandleResponse(resp *http.Response) (Vaul // BeginPurgeDeleted - Permanently deletes the specified vault. aka Purges the deleted Azure key vault. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// vaultName - The name of the soft-deleted vault. -// location - The location of the soft-deleted vault. -// options - VaultsClientBeginPurgeDeletedOptions contains the optional parameters for the VaultsClient.BeginPurgeDeleted -// method. +// +// Generated from API version 2022-11-01 +// - vaultName - The name of the soft-deleted vault. +// - location - The location of the soft-deleted vault. +// - options - VaultsClientBeginPurgeDeletedOptions contains the optional parameters for the VaultsClient.BeginPurgeDeleted +// method. func (client *VaultsClient) BeginPurgeDeleted(ctx context.Context, vaultName string, location string, options *VaultsClientBeginPurgeDeletedOptions) (*runtime.Poller[VaultsClientPurgeDeletedResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.purgeDeleted(ctx, vaultName, location, options) @@ -602,7 +610,8 @@ func (client *VaultsClient) BeginPurgeDeleted(ctx context.Context, vaultName str // PurgeDeleted - Permanently deletes the specified vault. aka Purges the deleted Azure key vault. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// +// Generated from API version 2022-11-01 func (client *VaultsClient) purgeDeleted(ctx context.Context, vaultName string, location string, options *VaultsClientBeginPurgeDeletedOptions) (*http.Response, error) { req, err := client.purgeDeletedCreateRequest(ctx, vaultName, location, options) if err != nil { @@ -638,7 +647,7 @@ func (client *VaultsClient) purgeDeletedCreateRequest(ctx context.Context, vault return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -646,11 +655,12 @@ func (client *VaultsClient) purgeDeletedCreateRequest(ctx context.Context, vault // Update - Update a key vault in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - The name of the Resource Group to which the server belongs. -// vaultName - Name of the vault -// parameters - Parameters to patch the vault -// options - VaultsClientUpdateOptions contains the optional parameters for the VaultsClient.Update method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the Resource Group to which the server belongs. +// - vaultName - Name of the vault +// - parameters - Parameters to patch the vault +// - options - VaultsClientUpdateOptions contains the optional parameters for the VaultsClient.Update method. func (client *VaultsClient) Update(ctx context.Context, resourceGroupName string, vaultName string, parameters VaultPatchParameters, options *VaultsClientUpdateOptions) (VaultsClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vaultName, parameters, options) if err != nil { @@ -686,7 +696,7 @@ func (client *VaultsClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -703,13 +713,14 @@ func (client *VaultsClient) updateHandleResponse(resp *http.Response) (VaultsCli // UpdateAccessPolicy - Update access policies in a key vault in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview -// resourceGroupName - The name of the Resource Group to which the vault belongs. -// vaultName - Name of the vault -// operationKind - Name of the operation -// parameters - Access policy to merge into the vault -// options - VaultsClientUpdateAccessPolicyOptions contains the optional parameters for the VaultsClient.UpdateAccessPolicy -// method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the Resource Group to which the vault belongs. +// - vaultName - Name of the vault +// - operationKind - Name of the operation +// - parameters - Access policy to merge into the vault +// - options - VaultsClientUpdateAccessPolicyOptions contains the optional parameters for the VaultsClient.UpdateAccessPolicy +// method. func (client *VaultsClient) UpdateAccessPolicy(ctx context.Context, resourceGroupName string, vaultName string, operationKind AccessPolicyUpdateKind, parameters VaultAccessPolicyParameters, options *VaultsClientUpdateAccessPolicyOptions) (VaultsClientUpdateAccessPolicyResponse, error) { req, err := client.updateAccessPolicyCreateRequest(ctx, resourceGroupName, vaultName, operationKind, parameters, options) if err != nil { @@ -749,7 +760,7 @@ func (client *VaultsClient) updateAccessPolicyCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_keys_client_test.go b/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_keys_client_test.go deleted file mode 100644 index ad505511bd51..000000000000 --- a/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_keys_client_test.go +++ /dev/null @@ -1,146 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armkeyvault_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/createKey.json -func ExampleKeysClient_CreateIfNotExist() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewKeysClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateIfNotExist(ctx, - "sample-group", - "sample-vault-name", - "sample-key-name", - armkeyvault.KeyCreateParameters{ - Properties: &armkeyvault.KeyProperties{ - Kty: to.Ptr(armkeyvault.JSONWebKeyTypeRSA), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/getKey.json -func ExampleKeysClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewKeysClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "sample-group", - "sample-vault-name", - "sample-key-name", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/listKeys.json -func ExampleKeysClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewKeysClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("sample-group", - "sample-vault-name", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/getKeyVersion.json -func ExampleKeysClient_GetVersion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewKeysClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetVersion(ctx, - "sample-group", - "sample-vault-name", - "sample-key-name", - "fd618d9519b74f9aae94ade66b876acc", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/listKeyVersions.json -func ExampleKeysClient_NewListVersionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewKeysClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListVersionsPager("sample-group", - "sample-vault-name", - "sample-key-name", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_managedhsms_client_test.go b/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_managedhsms_client_test.go deleted file mode 100644 index f33122ece142..000000000000 --- a/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_managedhsms_client_test.go +++ /dev/null @@ -1,261 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armkeyvault_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/ManagedHsm_CreateOrUpdate.json -func ExampleManagedHsmsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewManagedHsmsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "hsm-group", - "hsm1", - armkeyvault.ManagedHsm{ - Location: to.Ptr("westus"), - SKU: &armkeyvault.ManagedHsmSKU{ - Name: to.Ptr(armkeyvault.ManagedHsmSKUNameStandardB1), - Family: to.Ptr(armkeyvault.ManagedHsmSKUFamilyB), - }, - Tags: map[string]*string{ - "Dept": to.Ptr("hsm"), - "Environment": to.Ptr("dogfood"), - }, - Properties: &armkeyvault.ManagedHsmProperties{ - EnablePurgeProtection: to.Ptr(true), - EnableSoftDelete: to.Ptr(true), - InitialAdminObjectIDs: []*string{ - to.Ptr("00000000-0000-0000-0000-000000000000")}, - SoftDeleteRetentionInDays: to.Ptr[int32](90), - TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - }, - }, - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/ManagedHsm_Update.json -func ExampleManagedHsmsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewManagedHsmsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "hsm-group", - "hsm1", - armkeyvault.ManagedHsm{ - Tags: map[string]*string{ - "Dept": to.Ptr("hsm"), - "Environment": to.Ptr("dogfood"), - "Slice": to.Ptr("A"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/ManagedHsm_Delete.json -func ExampleManagedHsmsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewManagedHsmsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "hsm-group", - "hsm1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/ManagedHsm_Get.json -func ExampleManagedHsmsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewManagedHsmsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "hsm-group", - "hsm1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/ManagedHsm_ListByResourceGroup.json -func ExampleManagedHsmsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewManagedHsmsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("hsm-group", - &armkeyvault.ManagedHsmsClientListByResourceGroupOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/ManagedHsm_ListBySubscription.json -func ExampleManagedHsmsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewManagedHsmsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(&armkeyvault.ManagedHsmsClientListBySubscriptionOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/DeletedManagedHsm_List.json -func ExampleManagedHsmsClient_NewListDeletedPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewManagedHsmsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListDeletedPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/DeletedManagedHsm_Get.json -func ExampleManagedHsmsClient_GetDeleted() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewManagedHsmsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetDeleted(ctx, - "hsm1", - "westus", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/DeletedManagedHsm_Purge.json -func ExampleManagedHsmsClient_BeginPurgeDeleted() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewManagedHsmsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPurgeDeleted(ctx, - "hsm1", - "westus", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_mhsmprivateendpointconnections_client_test.go b/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_mhsmprivateendpointconnections_client_test.go deleted file mode 100644 index e27c800bfb77..000000000000 --- a/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_mhsmprivateendpointconnections_client_test.go +++ /dev/null @@ -1,125 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armkeyvault_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/ManagedHsm_ListPrivateEndpointConnectionsByResource.json -func ExampleMHSMPrivateEndpointConnectionsClient_NewListByResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewMHSMPrivateEndpointConnectionsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourcePager("sample-group", - "sample-mhsm", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/ManagedHsm_getPrivateEndpointConnection.json -func ExampleMHSMPrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewMHSMPrivateEndpointConnectionsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "sample-group", - "sample-mhsm", - "sample-pec", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/ManagedHsm_putPrivateEndpointConnection.json -func ExampleMHSMPrivateEndpointConnectionsClient_Put() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewMHSMPrivateEndpointConnectionsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Put(ctx, - "sample-group", - "sample-mhsm", - "sample-pec", - armkeyvault.MHSMPrivateEndpointConnection{ - Properties: &armkeyvault.MHSMPrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armkeyvault.MHSMPrivateLinkServiceConnectionState{ - Description: to.Ptr("My name is Joe and I'm approving this."), - Status: to.Ptr(armkeyvault.PrivateEndpointServiceConnectionStatusApproved), - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/ManagedHsm_deletePrivateEndpointConnection.json -func ExampleMHSMPrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewMHSMPrivateEndpointConnectionsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "sample-group", - "sample-mhsm", - "sample-pec", - 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) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_mhsmprivatelinkresources_client_test.go b/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_mhsmprivatelinkresources_client_test.go deleted file mode 100644 index 67aeb637875b..000000000000 --- a/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_mhsmprivatelinkresources_client_test.go +++ /dev/null @@ -1,39 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armkeyvault_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/ManagedHsm_listPrivateLinkResources.json -func ExampleMHSMPrivateLinkResourcesClient_ListByMHSMResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewMHSMPrivateLinkResourcesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListByMHSMResource(ctx, - "sample-group", - "sample-mhsm", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_operations_client_test.go deleted file mode 100644 index 409fdab2b35e..000000000000 --- a/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_operations_client_test.go +++ /dev/null @@ -1,41 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armkeyvault_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/listOperations.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_privateendpointconnections_client_test.go b/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_privateendpointconnections_client_test.go deleted file mode 100644 index b0e5e689daf6..000000000000 --- a/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_privateendpointconnections_client_test.go +++ /dev/null @@ -1,126 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armkeyvault_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/getPrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewPrivateEndpointConnectionsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "sample-group", - "sample-vault", - "sample-pec", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/putPrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionsClient_Put() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewPrivateEndpointConnectionsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Put(ctx, - "sample-group", - "sample-vault", - "sample-pec", - armkeyvault.PrivateEndpointConnection{ - Etag: to.Ptr(""), - Properties: &armkeyvault.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armkeyvault.PrivateLinkServiceConnectionState{ - Description: to.Ptr("My name is Joe and I'm approving this."), - Status: to.Ptr(armkeyvault.PrivateEndpointServiceConnectionStatusApproved), - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/deletePrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewPrivateEndpointConnectionsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "sample-group", - "sample-vault", - "sample-pec", - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/listPrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionsClient_NewListByResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewPrivateEndpointConnectionsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourcePager("sample-group", - "sample-vault", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_privatelinkresources_client_test.go b/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_privatelinkresources_client_test.go deleted file mode 100644 index 30d91621682d..000000000000 --- a/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_privatelinkresources_client_test.go +++ /dev/null @@ -1,39 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armkeyvault_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/listPrivateLinkResources.json -func ExamplePrivateLinkResourcesClient_ListByVault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewPrivateLinkResourcesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListByVault(ctx, - "sample-group", - "sample-vault", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_secrets_client_test.go b/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_secrets_client_test.go deleted file mode 100644 index c10351dbc1b5..000000000000 --- a/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_secrets_client_test.go +++ /dev/null @@ -1,123 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armkeyvault_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/createSecret.json -func ExampleSecretsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewSecretsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "sample-group", - "sample-vault", - "secret-name", - armkeyvault.SecretCreateOrUpdateParameters{ - Properties: &armkeyvault.SecretProperties{ - Value: to.Ptr("secret-value"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/updateSecret.json -func ExampleSecretsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewSecretsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "sample-group", - "sample-vault", - "secret-name", - armkeyvault.SecretPatchParameters{ - Properties: &armkeyvault.SecretPatchProperties{ - Value: to.Ptr("secret-value2"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/getSecret.json -func ExampleSecretsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewSecretsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "sample-group", - "sample-vault", - "secret-name", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/listSecrets.json -func ExampleSecretsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewSecretsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("sample-group", - "sample-vault", - &armkeyvault.SecretsClientListOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_vaults_client_test.go b/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_vaults_client_test.go deleted file mode 100644 index 3ea10603e53d..000000000000 --- a/sdk/resourcemanager/keyvault/armkeyvault/ze_generated_example_vaults_client_test.go +++ /dev/null @@ -1,438 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armkeyvault_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/createVault.json -func ExampleVaultsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewVaultsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "sample-resource-group", - "sample-vault", - armkeyvault.VaultCreateOrUpdateParameters{ - Location: to.Ptr("westus"), - Properties: &armkeyvault.VaultProperties{ - AccessPolicies: []*armkeyvault.AccessPolicyEntry{ - { - ObjectID: to.Ptr("00000000-0000-0000-0000-000000000000"), - Permissions: &armkeyvault.Permissions{ - Certificates: []*armkeyvault.CertificatePermissions{ - to.Ptr(armkeyvault.CertificatePermissionsGet), - to.Ptr(armkeyvault.CertificatePermissionsList), - to.Ptr(armkeyvault.CertificatePermissionsDelete), - to.Ptr(armkeyvault.CertificatePermissionsCreate), - to.Ptr(armkeyvault.CertificatePermissionsImport), - to.Ptr(armkeyvault.CertificatePermissionsUpdate), - to.Ptr(armkeyvault.CertificatePermissionsManagecontacts), - to.Ptr(armkeyvault.CertificatePermissionsGetissuers), - to.Ptr(armkeyvault.CertificatePermissionsListissuers), - to.Ptr(armkeyvault.CertificatePermissionsSetissuers), - to.Ptr(armkeyvault.CertificatePermissionsDeleteissuers), - to.Ptr(armkeyvault.CertificatePermissionsManageissuers), - to.Ptr(armkeyvault.CertificatePermissionsRecover), - to.Ptr(armkeyvault.CertificatePermissionsPurge)}, - Keys: []*armkeyvault.KeyPermissions{ - to.Ptr(armkeyvault.KeyPermissionsEncrypt), - to.Ptr(armkeyvault.KeyPermissionsDecrypt), - to.Ptr(armkeyvault.KeyPermissionsWrapKey), - to.Ptr(armkeyvault.KeyPermissionsUnwrapKey), - to.Ptr(armkeyvault.KeyPermissionsSign), - to.Ptr(armkeyvault.KeyPermissionsVerify), - to.Ptr(armkeyvault.KeyPermissionsGet), - to.Ptr(armkeyvault.KeyPermissionsList), - to.Ptr(armkeyvault.KeyPermissionsCreate), - to.Ptr(armkeyvault.KeyPermissionsUpdate), - to.Ptr(armkeyvault.KeyPermissionsImport), - to.Ptr(armkeyvault.KeyPermissionsDelete), - to.Ptr(armkeyvault.KeyPermissionsBackup), - to.Ptr(armkeyvault.KeyPermissionsRestore), - to.Ptr(armkeyvault.KeyPermissionsRecover), - to.Ptr(armkeyvault.KeyPermissionsPurge)}, - Secrets: []*armkeyvault.SecretPermissions{ - to.Ptr(armkeyvault.SecretPermissionsGet), - to.Ptr(armkeyvault.SecretPermissionsList), - to.Ptr(armkeyvault.SecretPermissionsSet), - to.Ptr(armkeyvault.SecretPermissionsDelete), - to.Ptr(armkeyvault.SecretPermissionsBackup), - to.Ptr(armkeyvault.SecretPermissionsRestore), - to.Ptr(armkeyvault.SecretPermissionsRecover), - to.Ptr(armkeyvault.SecretPermissionsPurge)}, - }, - TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - }}, - EnabledForDeployment: to.Ptr(true), - EnabledForDiskEncryption: to.Ptr(true), - EnabledForTemplateDeployment: to.Ptr(true), - PublicNetworkAccess: to.Ptr("Enabled"), - SKU: &armkeyvault.SKU{ - Name: to.Ptr(armkeyvault.SKUNameStandard), - Family: to.Ptr(armkeyvault.SKUFamilyA), - }, - TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - }, - }, - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/updateVault.json -func ExampleVaultsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewVaultsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "sample-resource-group", - "sample-vault", - armkeyvault.VaultPatchParameters{ - Properties: &armkeyvault.VaultPatchProperties{ - AccessPolicies: []*armkeyvault.AccessPolicyEntry{ - { - ObjectID: to.Ptr("00000000-0000-0000-0000-000000000000"), - Permissions: &armkeyvault.Permissions{ - Certificates: []*armkeyvault.CertificatePermissions{ - to.Ptr(armkeyvault.CertificatePermissionsGet), - to.Ptr(armkeyvault.CertificatePermissionsList), - to.Ptr(armkeyvault.CertificatePermissionsDelete), - to.Ptr(armkeyvault.CertificatePermissionsCreate), - to.Ptr(armkeyvault.CertificatePermissionsImport), - to.Ptr(armkeyvault.CertificatePermissionsUpdate), - to.Ptr(armkeyvault.CertificatePermissionsManagecontacts), - to.Ptr(armkeyvault.CertificatePermissionsGetissuers), - to.Ptr(armkeyvault.CertificatePermissionsListissuers), - to.Ptr(armkeyvault.CertificatePermissionsSetissuers), - to.Ptr(armkeyvault.CertificatePermissionsDeleteissuers), - to.Ptr(armkeyvault.CertificatePermissionsManageissuers), - to.Ptr(armkeyvault.CertificatePermissionsRecover), - to.Ptr(armkeyvault.CertificatePermissionsPurge)}, - Keys: []*armkeyvault.KeyPermissions{ - to.Ptr(armkeyvault.KeyPermissionsEncrypt), - to.Ptr(armkeyvault.KeyPermissionsDecrypt), - to.Ptr(armkeyvault.KeyPermissionsWrapKey), - to.Ptr(armkeyvault.KeyPermissionsUnwrapKey), - to.Ptr(armkeyvault.KeyPermissionsSign), - to.Ptr(armkeyvault.KeyPermissionsVerify), - to.Ptr(armkeyvault.KeyPermissionsGet), - to.Ptr(armkeyvault.KeyPermissionsList), - to.Ptr(armkeyvault.KeyPermissionsCreate), - to.Ptr(armkeyvault.KeyPermissionsUpdate), - to.Ptr(armkeyvault.KeyPermissionsImport), - to.Ptr(armkeyvault.KeyPermissionsDelete), - to.Ptr(armkeyvault.KeyPermissionsBackup), - to.Ptr(armkeyvault.KeyPermissionsRestore), - to.Ptr(armkeyvault.KeyPermissionsRecover), - to.Ptr(armkeyvault.KeyPermissionsPurge)}, - Secrets: []*armkeyvault.SecretPermissions{ - to.Ptr(armkeyvault.SecretPermissionsGet), - to.Ptr(armkeyvault.SecretPermissionsList), - to.Ptr(armkeyvault.SecretPermissionsSet), - to.Ptr(armkeyvault.SecretPermissionsDelete), - to.Ptr(armkeyvault.SecretPermissionsBackup), - to.Ptr(armkeyvault.SecretPermissionsRestore), - to.Ptr(armkeyvault.SecretPermissionsRecover), - to.Ptr(armkeyvault.SecretPermissionsPurge)}, - }, - TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - }}, - EnabledForDeployment: to.Ptr(true), - EnabledForDiskEncryption: to.Ptr(true), - EnabledForTemplateDeployment: to.Ptr(true), - PublicNetworkAccess: to.Ptr("Enabled"), - SKU: &armkeyvault.SKU{ - Name: to.Ptr(armkeyvault.SKUNameStandard), - Family: to.Ptr(armkeyvault.SKUFamilyA), - }, - TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/deleteVault.json -func ExampleVaultsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewVaultsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "sample-resource-group", - "sample-vault", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/getVault.json -func ExampleVaultsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewVaultsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "sample-resource-group", - "sample-vault", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/updateAccessPoliciesAdd.json -func ExampleVaultsClient_UpdateAccessPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewVaultsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.UpdateAccessPolicy(ctx, - "sample-group", - "sample-vault", - armkeyvault.AccessPolicyUpdateKindAdd, - armkeyvault.VaultAccessPolicyParameters{ - Properties: &armkeyvault.VaultAccessPolicyProperties{ - AccessPolicies: []*armkeyvault.AccessPolicyEntry{ - { - ObjectID: to.Ptr("00000000-0000-0000-0000-000000000000"), - Permissions: &armkeyvault.Permissions{ - Certificates: []*armkeyvault.CertificatePermissions{ - to.Ptr(armkeyvault.CertificatePermissionsGet)}, - Keys: []*armkeyvault.KeyPermissions{ - to.Ptr(armkeyvault.KeyPermissionsEncrypt)}, - Secrets: []*armkeyvault.SecretPermissions{ - to.Ptr(armkeyvault.SecretPermissionsGet)}, - }, - TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - }}, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/listVaultByResourceGroup.json -func ExampleVaultsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewVaultsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("sample-group", - &armkeyvault.VaultsClientListByResourceGroupOptions{Top: to.Ptr[int32](1)}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/listVaultBySubscription.json -func ExampleVaultsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewVaultsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(&armkeyvault.VaultsClientListBySubscriptionOptions{Top: to.Ptr[int32](1)}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/listDeletedVaults.json -func ExampleVaultsClient_NewListDeletedPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewVaultsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListDeletedPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/getDeletedVault.json -func ExampleVaultsClient_GetDeleted() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewVaultsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetDeleted(ctx, - "sample-vault", - "westus", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/purgeDeletedVault.json -func ExampleVaultsClient_BeginPurgeDeleted() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewVaultsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPurgeDeleted(ctx, - "sample-vault", - "westus", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/listVault.json -func ExampleVaultsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewVaultsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armkeyvault.VaultsClientListOptions{Top: to.Ptr[int32](1)}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/resource-manager/Microsoft.KeyVault/preview/2021-11-01-preview/examples/checkVaultNameAvailability.json -func ExampleVaultsClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkeyvault.NewVaultsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CheckNameAvailability(ctx, - armkeyvault.VaultCheckNameAvailabilityParameters{ - Name: to.Ptr("sample-vault"), - Type: to.Ptr("Microsoft.KeyVault/vaults"), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_models_serde.go b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_models_serde.go deleted file mode 100644 index 711c77411c0a..000000000000 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_models_serde.go +++ /dev/null @@ -1,633 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armkeyvault - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type Attributes. -func (a Attributes) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeUnix(objectMap, "created", a.Created) - populate(objectMap, "enabled", a.Enabled) - populateTimeUnix(objectMap, "exp", a.Expires) - populateTimeUnix(objectMap, "nbf", a.NotBefore) - populateTimeUnix(objectMap, "updated", a.Updated) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Attributes. -func (a *Attributes) 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", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "created": - err = unpopulateTimeUnix(val, "Created", &a.Created) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) - delete(rawMsg, key) - case "exp": - err = unpopulateTimeUnix(val, "Expires", &a.Expires) - delete(rawMsg, key) - case "nbf": - err = unpopulateTimeUnix(val, "NotBefore", &a.NotBefore) - delete(rawMsg, key) - case "updated": - err = unpopulateTimeUnix(val, "Updated", &a.Updated) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedManagedHsmProperties. -func (d *DeletedManagedHsmProperties) 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 "deletionDate": - err = unpopulateTimeRFC3339(val, "DeletionDate", &d.DeletionDate) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &d.Location) - delete(rawMsg, key) - case "mhsmId": - err = unpopulate(val, "MhsmID", &d.MhsmID) - delete(rawMsg, key) - case "purgeProtectionEnabled": - err = unpopulate(val, "PurgeProtectionEnabled", &d.PurgeProtectionEnabled) - delete(rawMsg, key) - case "scheduledPurgeDate": - err = unpopulateTimeRFC3339(val, "ScheduledPurgeDate", &d.ScheduledPurgeDate) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &d.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedVaultProperties. -func (d *DeletedVaultProperties) 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 "deletionDate": - err = unpopulateTimeRFC3339(val, "DeletionDate", &d.DeletionDate) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &d.Location) - delete(rawMsg, key) - case "purgeProtectionEnabled": - err = unpopulate(val, "PurgeProtectionEnabled", &d.PurgeProtectionEnabled) - delete(rawMsg, key) - case "scheduledPurgeDate": - err = unpopulateTimeRFC3339(val, "ScheduledPurgeDate", &d.ScheduledPurgeDate) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &d.Tags) - delete(rawMsg, key) - case "vaultId": - err = unpopulate(val, "VaultID", &d.VaultID) - 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 Key. -func (k Key) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", k.ID) - populate(objectMap, "location", k.Location) - populate(objectMap, "name", k.Name) - populate(objectMap, "properties", k.Properties) - populate(objectMap, "tags", k.Tags) - populate(objectMap, "type", k.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type KeyCreateParameters. -func (k KeyCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", k.Properties) - populate(objectMap, "tags", k.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type KeyProperties. -func (k KeyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "attributes", k.Attributes) - populate(objectMap, "curveName", k.CurveName) - populate(objectMap, "keyOps", k.KeyOps) - populate(objectMap, "keySize", k.KeySize) - populate(objectMap, "keyUri", k.KeyURI) - populate(objectMap, "keyUriWithVersion", k.KeyURIWithVersion) - populate(objectMap, "kty", k.Kty) - populate(objectMap, "release_policy", k.ReleasePolicy) - populate(objectMap, "rotationPolicy", k.RotationPolicy) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type KeyReleasePolicy. -func (k KeyReleasePolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "contentType", k.ContentType) - populateByteArray(objectMap, "data", k.Data, runtime.Base64URLFormat) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type KeyReleasePolicy. -func (k *KeyReleasePolicy) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "contentType": - err = unpopulate(val, "ContentType", &k.ContentType) - delete(rawMsg, key) - case "data": - err = runtime.DecodeByteArray(string(val), &k.Data, runtime.Base64URLFormat) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MHSMNetworkRuleSet. -func (m MHSMNetworkRuleSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "bypass", m.Bypass) - populate(objectMap, "defaultAction", m.DefaultAction) - populate(objectMap, "ipRules", m.IPRules) - populate(objectMap, "virtualNetworkRules", m.VirtualNetworkRules) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MHSMPrivateEndpointConnection. -func (m MHSMPrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", m.Etag) - populate(objectMap, "id", m.ID) - populate(objectMap, "location", m.Location) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "sku", m.SKU) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "tags", m.Tags) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MHSMPrivateLinkResource. -func (m MHSMPrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", m.ID) - populate(objectMap, "location", m.Location) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "sku", m.SKU) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "tags", m.Tags) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MHSMPrivateLinkResourceProperties. -func (m MHSMPrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "groupId", m.GroupID) - populate(objectMap, "requiredMembers", m.RequiredMembers) - populate(objectMap, "requiredZoneNames", m.RequiredZoneNames) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ManagedHsm. -func (m ManagedHsm) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", m.ID) - populate(objectMap, "location", m.Location) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "sku", m.SKU) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "tags", m.Tags) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ManagedHsmProperties. -func (m ManagedHsmProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "createMode", m.CreateMode) - populate(objectMap, "enablePurgeProtection", m.EnablePurgeProtection) - populate(objectMap, "enableSoftDelete", m.EnableSoftDelete) - populate(objectMap, "hsmUri", m.HsmURI) - populate(objectMap, "initialAdminObjectIds", m.InitialAdminObjectIDs) - populate(objectMap, "networkAcls", m.NetworkACLs) - populate(objectMap, "privateEndpointConnections", m.PrivateEndpointConnections) - populate(objectMap, "provisioningState", m.ProvisioningState) - populate(objectMap, "publicNetworkAccess", m.PublicNetworkAccess) - populateTimeRFC3339(objectMap, "scheduledPurgeDate", m.ScheduledPurgeDate) - populate(objectMap, "softDeleteRetentionInDays", m.SoftDeleteRetentionInDays) - populate(objectMap, "statusMessage", m.StatusMessage) - populate(objectMap, "tenantId", m.TenantID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedHsmProperties. -func (m *ManagedHsmProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createMode": - err = unpopulate(val, "CreateMode", &m.CreateMode) - delete(rawMsg, key) - case "enablePurgeProtection": - err = unpopulate(val, "EnablePurgeProtection", &m.EnablePurgeProtection) - delete(rawMsg, key) - case "enableSoftDelete": - err = unpopulate(val, "EnableSoftDelete", &m.EnableSoftDelete) - delete(rawMsg, key) - case "hsmUri": - err = unpopulate(val, "HsmURI", &m.HsmURI) - delete(rawMsg, key) - case "initialAdminObjectIds": - err = unpopulate(val, "InitialAdminObjectIDs", &m.InitialAdminObjectIDs) - delete(rawMsg, key) - case "networkAcls": - err = unpopulate(val, "NetworkACLs", &m.NetworkACLs) - delete(rawMsg, key) - case "privateEndpointConnections": - err = unpopulate(val, "PrivateEndpointConnections", &m.PrivateEndpointConnections) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) - delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &m.PublicNetworkAccess) - delete(rawMsg, key) - case "scheduledPurgeDate": - err = unpopulateTimeRFC3339(val, "ScheduledPurgeDate", &m.ScheduledPurgeDate) - delete(rawMsg, key) - case "softDeleteRetentionInDays": - err = unpopulate(val, "SoftDeleteRetentionInDays", &m.SoftDeleteRetentionInDays) - delete(rawMsg, key) - case "statusMessage": - err = unpopulate(val, "StatusMessage", &m.StatusMessage) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &m.TenantID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ManagedHsmResource. -func (m ManagedHsmResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", m.ID) - populate(objectMap, "location", m.Location) - populate(objectMap, "name", m.Name) - populate(objectMap, "sku", m.SKU) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "tags", m.Tags) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type NetworkRuleSet. -func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "bypass", n.Bypass) - populate(objectMap, "defaultAction", n.DefaultAction) - populate(objectMap, "ipRules", n.IPRules) - populate(objectMap, "virtualNetworkRules", n.VirtualNetworkRules) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Permissions. -func (p Permissions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "certificates", p.Certificates) - populate(objectMap, "keys", p.Keys) - populate(objectMap, "secrets", p.Secrets) - populate(objectMap, "storage", p.Storage) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. -func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", p.Etag) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. -func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. -func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "groupId", p.GroupID) - populate(objectMap, "requiredMembers", p.RequiredMembers) - populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RotationPolicy. -func (r RotationPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "attributes", r.Attributes) - populate(objectMap, "lifetimeActions", r.LifetimeActions) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Secret. -func (s Secret) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", s.ID) - populate(objectMap, "location", s.Location) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "tags", s.Tags) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SecretAttributes. -func (s SecretAttributes) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeUnix(objectMap, "created", s.Created) - populate(objectMap, "enabled", s.Enabled) - populateTimeUnix(objectMap, "exp", s.Expires) - populateTimeUnix(objectMap, "nbf", s.NotBefore) - populateTimeUnix(objectMap, "updated", s.Updated) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SecretAttributes. -func (s *SecretAttributes) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "created": - err = unpopulateTimeUnix(val, "Created", &s.Created) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &s.Enabled) - delete(rawMsg, key) - case "exp": - err = unpopulateTimeUnix(val, "Expires", &s.Expires) - delete(rawMsg, key) - case "nbf": - err = unpopulateTimeUnix(val, "NotBefore", &s.NotBefore) - delete(rawMsg, key) - case "updated": - err = unpopulateTimeUnix(val, "Updated", &s.Updated) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SecretCreateOrUpdateParameters. -func (s SecretCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "tags", s.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SecretPatchParameters. -func (s SecretPatchParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "tags", s.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type VaultAccessPolicyProperties. -func (v VaultAccessPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "accessPolicies", v.AccessPolicies) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type VaultCreateOrUpdateParameters. -func (v VaultCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "location", v.Location) - populate(objectMap, "properties", v.Properties) - populate(objectMap, "tags", v.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type VaultPatchParameters. -func (v VaultPatchParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", v.Properties) - populate(objectMap, "tags", v.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type VaultPatchProperties. -func (v VaultPatchProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "accessPolicies", v.AccessPolicies) - populate(objectMap, "createMode", v.CreateMode) - populate(objectMap, "enablePurgeProtection", v.EnablePurgeProtection) - populate(objectMap, "enableRbacAuthorization", v.EnableRbacAuthorization) - populate(objectMap, "enableSoftDelete", v.EnableSoftDelete) - populate(objectMap, "enabledForDeployment", v.EnabledForDeployment) - populate(objectMap, "enabledForDiskEncryption", v.EnabledForDiskEncryption) - populate(objectMap, "enabledForTemplateDeployment", v.EnabledForTemplateDeployment) - populate(objectMap, "networkAcls", v.NetworkACLs) - populate(objectMap, "publicNetworkAccess", v.PublicNetworkAccess) - populate(objectMap, "sku", v.SKU) - populate(objectMap, "softDeleteRetentionInDays", v.SoftDeleteRetentionInDays) - populate(objectMap, "tenantId", v.TenantID) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type VaultProperties. -func (v VaultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "accessPolicies", v.AccessPolicies) - populate(objectMap, "createMode", v.CreateMode) - populate(objectMap, "enablePurgeProtection", v.EnablePurgeProtection) - populate(objectMap, "enableRbacAuthorization", v.EnableRbacAuthorization) - populate(objectMap, "enableSoftDelete", v.EnableSoftDelete) - populate(objectMap, "enabledForDeployment", v.EnabledForDeployment) - populate(objectMap, "enabledForDiskEncryption", v.EnabledForDiskEncryption) - populate(objectMap, "enabledForTemplateDeployment", v.EnabledForTemplateDeployment) - populate(objectMap, "hsmPoolResourceId", v.HsmPoolResourceID) - populate(objectMap, "networkAcls", v.NetworkACLs) - populate(objectMap, "privateEndpointConnections", v.PrivateEndpointConnections) - populate(objectMap, "provisioningState", v.ProvisioningState) - populate(objectMap, "publicNetworkAccess", v.PublicNetworkAccess) - populate(objectMap, "sku", v.SKU) - populate(objectMap, "softDeleteRetentionInDays", v.SoftDeleteRetentionInDays) - populate(objectMap, "tenantId", v.TenantID) - populate(objectMap, "vaultUri", v.VaultURI) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func populateByteArray(m map[string]interface{}, k string, b []byte, f runtime.Base64Encoding) { - if azcore.IsNullValue(b) { - m[k] = nil - } else if len(b) == 0 { - return - } else { - m[k] = runtime.EncodeByteArray(b, f) - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -}