From 75c982f1ad0e09469102a63c03419c79452023d7 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 8 Jul 2022 20:38:12 +0000 Subject: [PATCH] CodeGen from PR 19395 in Azure/azure-rest-api-specs Merge ff63535af8d98b47d1a57aa9796cba4ae070e393 into cd3bae20cb3d8b2125e98dffc46f24c5eaba729a --- .../keyvault/armkeyvault/CHANGELOG.md | 24 +- .../keyvault/armkeyvault/autorest.md | 6 +- ...zz_generated_constants.go => constants.go} | 27 +- .../keyvault/armkeyvault/go.mod | 2 +- ...enerated_keys_client.go => keys_client.go} | 21 +- ...edhsms_client.go => managedhsms_client.go} | 95 +- ... mhsmprivateendpointconnections_client.go} | 19 +- ....go => mhsmprivatelinkresources_client.go} | 5 +- .../{zz_generated_models.go => models.go} | 53 +- .../keyvault/armkeyvault/models_serde.go | 3279 +++++++++++++++++ ...rations_client.go => operations_client.go} | 5 +- ...o => privateendpointconnections_client.go} | 19 +- ...ient.go => privatelinkresources_client.go} | 5 +- ...ed_response_types.go => response_types.go} | 6 + ...ed_secrets_client.go => secrets_client.go} | 17 +- ...erated_time_rfc3339.go => time_rfc3339.go} | 1 + ...zz_generated_time_unix.go => time_unix.go} | 1 + ...ated_vaults_client.go => vaults_client.go} | 51 +- .../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 ---- 28 files changed, 3525 insertions(+), 2082 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} (97%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_managedhsms_client.go => managedhsms_client.go} (88%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_mhsmprivateendpointconnections_client.go => mhsmprivateendpointconnections_client.go} (97%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_mhsmprivatelinkresources_client.go => mhsmprivatelinkresources_client.go} (98%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_models.go => models.go} (96%) create mode 100644 sdk/resourcemanager/keyvault/armkeyvault/models_serde.go rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_operations_client.go => operations_client.go} (97%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_privateendpointconnections_client.go => privateendpointconnections_client.go} (97%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_privatelinkresources_client.go => privatelinkresources_client.go} (98%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_response_types.go => response_types.go} (97%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_secrets_client.go => secrets_client.go} (97%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_time_rfc3339.go => time_rfc3339.go} (99%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_time_unix.go => time_unix.go} (98%) rename sdk/resourcemanager/keyvault/armkeyvault/{zz_generated_vaults_client.go => vaults_client.go} (96%) 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..e8431f594c5f 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md +++ b/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md @@ -1,23 +1,31 @@ # Release History -## 1.1.0-beta.1 (2022-05-19) +## 1.1.0 (2022-07-08) ### Features Added -- New const `KeyRotationPolicyActionTypeNotify` -- New const `JSONWebKeyOperationRelease` - New const `KeyRotationPolicyActionTypeRotate` +- New const `ActivationStatusUnknown` +- New const `KeyPermissionsGetrotationpolicy` - New const `KeyPermissionsRotate` -- New const `KeyPermissionsRelease` +- New const `JSONWebKeyOperationRelease` - New const `KeyPermissionsSetrotationpolicy` -- New const `KeyPermissionsGetrotationpolicy` +- New const `ActivationStatusFailed` +- New const `KeyPermissionsRelease` +- New const `ActivationStatusActive` +- New const `KeyRotationPolicyActionTypeNotify` +- New const `ActivationStatusNotActivated` - New function `PossibleKeyRotationPolicyActionTypeValues() []KeyRotationPolicyActionType` -- New function `*KeyReleasePolicy.UnmarshalJSON([]byte) error` -- New function `KeyReleasePolicy.MarshalJSON() ([]byte, error)` -- New function `RotationPolicy.MarshalJSON() ([]byte, error)` +- New function `*ManagedHsmsClient.CheckMhsmNameAvailability(context.Context, CheckMhsmNameAvailabilityParameters, *ManagedHsmsClientCheckMhsmNameAvailabilityOptions) (ManagedHsmsClientCheckMhsmNameAvailabilityResponse, error)` +- New function `PossibleActivationStatusValues() []ActivationStatus` - New struct `Action` +- New struct `CheckMhsmNameAvailabilityParameters` +- New struct `CheckMhsmNameAvailabilityResult` - New struct `KeyReleasePolicy` - New struct `KeyRotationPolicyAttributes` - New struct `LifetimeAction` +- New struct `ManagedHSMSecurityDomainProperties` +- New struct `ManagedHsmsClientCheckMhsmNameAvailabilityOptions` +- New struct `ManagedHsmsClientCheckMhsmNameAvailabilityResponse` - New struct `RotationPolicy` - New struct `Trigger` - New field `ReleasePolicy` in struct `KeyProperties` diff --git a/sdk/resourcemanager/keyvault/armkeyvault/autorest.md b/sdk/resourcemanager/keyvault/armkeyvault/autorest.md index bb4f02c95677..5220fea3d332 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: 1.1.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..6bde0e0847cf 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 = "v1.1.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..8097b299f335 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/go.mod +++ b/sdk/resourcemanager/keyvault/armkeyvault/go.mod @@ -4,12 +4,12 @@ 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 97% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_keys_client.go rename to sdk/resourcemanager/keyvault/armkeyvault/keys_client.go index 5799f3cbddb9..e87b29afad6b 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 @@ -59,7 +60,7 @@ 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 +// Generated from API version 2022-07-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. @@ -104,7 +105,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -121,7 +122,7 @@ 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 +// Generated from API version 2022-07-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. @@ -165,7 +166,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +183,7 @@ 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 +// Generated from API version 2022-07-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. @@ -231,7 +232,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -248,7 +249,7 @@ 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 +// Generated from API version 2022-07-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.List method. @@ -300,7 +301,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -317,7 +318,7 @@ 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 +// Generated from API version 2022-07-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. @@ -374,7 +375,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-07-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_managedhsms_client.go b/sdk/resourcemanager/keyvault/armkeyvault/managedhsms_client.go similarity index 88% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_managedhsms_client.go rename to sdk/resourcemanager/keyvault/armkeyvault/managedhsms_client.go index cb2fc5e28deb..3808931d243d 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 @@ -56,9 +57,57 @@ 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-07-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-07-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 +// Generated from API version 2022-07-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 @@ -78,7 +127,7 @@ 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-07-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 +163,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -122,7 +171,7 @@ 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 +// Generated from API version 2022-07-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. @@ -140,7 +189,7 @@ 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-07-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 +225,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -184,7 +233,7 @@ 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 +// Generated from API version 2022-07-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. @@ -197,7 +246,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 +272,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -240,7 +289,7 @@ 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 +// Generated from API version 2022-07-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. @@ -279,7 +328,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -297,7 +346,7 @@ 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 +// Generated from API version 2022-07-01 // resourceGroupName - Name of the resource group that contains the managed HSM pool. // options - ManagedHsmsClientListByResourceGroupOptions contains the optional parameters for the ManagedHsmsClient.ListByResourceGroup // method. @@ -348,7 +397,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -365,7 +414,7 @@ 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 +// Generated from API version 2022-07-01 // options - ManagedHsmsClientListBySubscriptionOptions contains the optional parameters for the ManagedHsmsClient.ListBySubscription // method. func (client *ManagedHsmsClient) NewListBySubscriptionPager(options *ManagedHsmsClientListBySubscriptionOptions) *runtime.Pager[ManagedHsmsClientListBySubscriptionResponse] { @@ -411,7 +460,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -428,7 +477,7 @@ 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 +// Generated from API version 2022-07-01 // options - ManagedHsmsClientListDeletedOptions contains the optional parameters for the ManagedHsmsClient.ListDeleted method. func (client *ManagedHsmsClient) NewListDeletedPager(options *ManagedHsmsClientListDeletedOptions) *runtime.Pager[ManagedHsmsClientListDeletedResponse] { return runtime.NewPager(runtime.PagingHandler[ManagedHsmsClientListDeletedResponse]{ @@ -470,7 +519,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -487,7 +536,7 @@ 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 +// Generated from API version 2022-07-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 @@ -506,7 +555,7 @@ 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-07-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 +591,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -550,7 +599,7 @@ 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 +// Generated from API version 2022-07-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 @@ -569,7 +618,7 @@ 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-07-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 +654,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-07-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 97% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_mhsmprivateendpointconnections_client.go rename to sdk/resourcemanager/keyvault/armkeyvault/mhsmprivateendpointconnections_client.go index f161f1d181f6..2b04ed5c2170 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 @@ -58,7 +59,7 @@ 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 +// Generated from API version 2022-07-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. @@ -78,7 +79,7 @@ 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-07-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 +119,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -126,7 +127,7 @@ 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 +// Generated from API version 2022-07-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. @@ -171,7 +172,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -189,7 +190,7 @@ 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 +// Generated from API version 2022-07-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.ListByResource @@ -242,7 +243,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -259,7 +260,7 @@ 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 +// Generated from API version 2022-07-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. @@ -305,7 +306,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-07-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 98% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_mhsmprivatelinkresources_client.go rename to sdk/resourcemanager/keyvault/armkeyvault/mhsmprivatelinkresources_client.go index f90f3d3f732f..f76ceaa410c6 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 @@ -57,7 +58,7 @@ 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 +// Generated from API version 2022-07-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 @@ -97,7 +98,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-07-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 96% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_models.go rename to sdk/resourcemanager/keyvault/armkeyvault/models.go index 251559f2b5f2..e0172744352d 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,6 +51,26 @@ type Attributes struct { Updated *time.Time `json:"updated,omitempty" azure:"ro"` } +// 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"` + + // 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"` + + // 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"` +} + // CheckNameAvailabilityResult - The CheckNameAvailability operation response. type CheckNameAvailabilityResult struct { // READ-ONLY; An error message explaining the Reason value in more detail. @@ -535,6 +556,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. @@ -683,6 +713,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 @@ -1234,7 +1270,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 +1323,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 +1386,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 diff --git a/sdk/resourcemanager/keyvault/armkeyvault/models_serde.go b/sdk/resourcemanager/keyvault/armkeyvault/models_serde.go new file mode 100644 index 000000000000..db9ccc8b0226 --- /dev/null +++ b/sdk/resourcemanager/keyvault/armkeyvault/models_serde.go @@ -0,0 +1,3279 @@ +//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" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AccessPolicyEntry. +func (a AccessPolicyEntry) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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]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 +} + +// MarshalJSON implements the json.Marshaller interface for type CheckMhsmNameAvailabilityParameters. +func (c CheckMhsmNameAvailabilityParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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]interface{}) + 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 CloudError. +func (c CloudError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", c.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudError. +func (c *CloudError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &c.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudErrorBody. +func (c CloudErrorBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", c.Code) + populate(objectMap, "message", c.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudErrorBody. +func (c *CloudErrorBody) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &c.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DeletedManagedHsm. +func (d DeletedManagedHsm) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]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) +} + +// 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]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) +} + +// 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]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 KeyRotationPolicyAttributes. +func (k KeyRotationPolicyAttributes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]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) +} + +// 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]interface{}) + 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]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) +} + +// 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]interface{}) + 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 "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]interface{}) + 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]interface{}) + 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]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) +} + +// 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]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) +} + +// 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 ManagedHsmError. +func (m ManagedHsmError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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 ManagedHsmListResult. +func (m ManagedHsmListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]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) +} + +// 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 ManagedHsmSKU. +func (m ManagedHsmSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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 MetricSpecification. +func (m MetricSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]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) +} + +// 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]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) +} + +// 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]interface{}) + 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]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) +} + +// 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]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) +} + +// 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]interface{}) + 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]interface{}) + 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]interface{}) + 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 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) +} + +// 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]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) +} + +// 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]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) +} + +// 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]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 Trigger. +func (t Trigger) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]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) +} + +// 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]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) +} + +// 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]interface{}) + 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]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 +} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_operations_client.go b/sdk/resourcemanager/keyvault/armkeyvault/operations_client.go similarity index 97% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_operations_client.go rename to sdk/resourcemanager/keyvault/armkeyvault/operations_client.go index c8bc4f50e717..7d8bff10b742 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 @@ -50,7 +51,7 @@ 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 +// Generated from API version 2022-07-01 // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -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-07-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 97% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_privateendpointconnections_client.go rename to sdk/resourcemanager/keyvault/armkeyvault/privateendpointconnections_client.go index 2c37f963ce96..923ffedb29ef 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 @@ -58,7 +59,7 @@ 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 +// Generated from API version 2022-07-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. @@ -78,7 +79,7 @@ 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-07-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 +119,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -126,7 +127,7 @@ 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 +// Generated from API version 2022-07-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. @@ -171,7 +172,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -189,7 +190,7 @@ 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 +// Generated from API version 2022-07-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.ListByResource @@ -242,7 +243,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -259,7 +260,7 @@ 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 +// Generated from API version 2022-07-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. @@ -305,7 +306,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-07-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 98% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_privatelinkresources_client.go rename to sdk/resourcemanager/keyvault/armkeyvault/privatelinkresources_client.go index 720b74b51223..f7df9b8185a9 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 @@ -57,7 +58,7 @@ 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 +// Generated from API version 2022-07-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 @@ -97,7 +98,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-07-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 97% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_response_types.go rename to sdk/resourcemanager/keyvault/armkeyvault/response_types.go index 7513e14035c1..0ae2cc68c065 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 @@ -63,6 +64,11 @@ type MHSMPrivateLinkResourcesClientListByMHSMResourceResponse struct { MHSMPrivateLinkResourceListResult } +// ManagedHsmsClientCheckMhsmNameAvailabilityResponse contains the response from method ManagedHsmsClient.CheckMhsmNameAvailability. +type ManagedHsmsClientCheckMhsmNameAvailabilityResponse struct { + CheckMhsmNameAvailabilityResult +} + // ManagedHsmsClientCreateOrUpdateResponse contains the response from method ManagedHsmsClient.CreateOrUpdate. type ManagedHsmsClientCreateOrUpdateResponse struct { ManagedHsm diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_secrets_client.go b/sdk/resourcemanager/keyvault/armkeyvault/secrets_client.go similarity index 97% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_secrets_client.go rename to sdk/resourcemanager/keyvault/armkeyvault/secrets_client.go index ebe2ac8ccd98..00519019cb67 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 @@ -60,7 +61,7 @@ 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 +// Generated from API version 2022-07-01 // resourceGroupName - The name of the Resource Group to which the vault belongs. // vaultName - Name of the vault // secretName - Name of the secret @@ -105,7 +106,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -123,7 +124,7 @@ 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 +// Generated from API version 2022-07-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. @@ -167,7 +168,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -186,7 +187,7 @@ func (client *SecretsClient) getHandleResponse(resp *http.Response) (SecretsClie // 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 +// Generated from API version 2022-07-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.List method. @@ -241,7 +242,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -259,7 +260,7 @@ 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 +// Generated from API version 2022-07-01 // resourceGroupName - The name of the Resource Group to which the vault belongs. // vaultName - Name of the vault // secretName - Name of the secret @@ -304,7 +305,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-07-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 99% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/keyvault/armkeyvault/time_rfc3339.go index 543471aa0fd7..af4c2f83a108 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 diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_time_unix.go b/sdk/resourcemanager/keyvault/armkeyvault/time_unix.go similarity index 98% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_time_unix.go rename to sdk/resourcemanager/keyvault/armkeyvault/time_unix.go index 6ef8910872f9..61ebcf5d7e19 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 diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_vaults_client.go b/sdk/resourcemanager/keyvault/armkeyvault/vaults_client.go similarity index 96% rename from sdk/resourcemanager/keyvault/armkeyvault/zz_generated_vaults_client.go rename to sdk/resourcemanager/keyvault/armkeyvault/vaults_client.go index fbda80eb56c9..6ee429b21351 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 @@ -58,7 +59,7 @@ 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 +// Generated from API version 2022-07-01 // vaultName - The name of the vault. // options - VaultsClientCheckNameAvailabilityOptions contains the optional parameters for the VaultsClient.CheckNameAvailability // method. @@ -89,7 +90,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, vaultName) @@ -106,7 +107,7 @@ 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 +// Generated from API version 2022-07-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 @@ -126,7 +127,7 @@ 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-07-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 +163,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -170,7 +171,7 @@ 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 +// Generated from API version 2022-07-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. @@ -209,7 +210,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -217,7 +218,7 @@ 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 +// Generated from API version 2022-07-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. @@ -256,7 +257,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -273,7 +274,7 @@ 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 +// Generated from API version 2022-07-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. @@ -312,7 +313,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -329,7 +330,7 @@ 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 +// Generated from API version 2022-07-01 // options - VaultsClientListOptions contains the optional parameters for the VaultsClient.List method. func (client *VaultsClient) NewListPager(options *VaultsClientListOptions) *runtime.Pager[VaultsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[VaultsClientListResponse]{ @@ -393,7 +394,7 @@ 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 +// Generated from API version 2022-07-01 // resourceGroupName - The name of the Resource Group to which the vault belongs. // options - VaultsClientListByResourceGroupOptions contains the optional parameters for the VaultsClient.ListByResourceGroup // method. @@ -444,7 +445,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -461,7 +462,7 @@ 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 +// Generated from API version 2022-07-01 // options - VaultsClientListBySubscriptionOptions contains the optional parameters for the VaultsClient.ListBySubscription // method. func (client *VaultsClient) NewListBySubscriptionPager(options *VaultsClientListBySubscriptionOptions) *runtime.Pager[VaultsClientListBySubscriptionResponse] { @@ -507,7 +508,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -524,7 +525,7 @@ 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 +// Generated from API version 2022-07-01 // options - VaultsClientListDeletedOptions contains the optional parameters for the VaultsClient.ListDeleted method. func (client *VaultsClient) NewListDeletedPager(options *VaultsClientListDeletedOptions) *runtime.Pager[VaultsClientListDeletedResponse] { return runtime.NewPager(runtime.PagingHandler[VaultsClientListDeletedResponse]{ @@ -566,7 +567,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -583,7 +584,7 @@ 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 +// Generated from API version 2022-07-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 @@ -602,7 +603,7 @@ 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-07-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 +639,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -646,7 +647,7 @@ 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 +// Generated from API version 2022-07-01 // resourceGroupName - The name of the Resource Group to which the server belongs. // vaultName - Name of the vault // parameters - Parameters to patch the vault @@ -686,7 +687,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-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -703,7 +704,7 @@ 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 +// Generated from API version 2022-07-01 // resourceGroupName - The name of the Resource Group to which the vault belongs. // vaultName - Name of the vault // operationKind - Name of the operation @@ -749,7 +750,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-07-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 -}