diff --git a/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md b/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md index f9cd65aaaa1e..43f3a9d74e96 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md +++ b/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 1.3.0 (2023-08-23) +### Features Added + +- New value `ManagedHsmSKUNameCustomB6` added to enum type `ManagedHsmSKUName` + + ## 1.2.0 (2023-04-28) ### Features Added diff --git a/sdk/resourcemanager/keyvault/armkeyvault/autorest.md b/sdk/resourcemanager/keyvault/armkeyvault/autorest.md index 4692f2f562e1..e7f865880a82 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/autorest.md +++ b/sdk/resourcemanager/keyvault/armkeyvault/autorest.md @@ -5,11 +5,10 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/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.2.0 +module-version: 1.3.0 modelerfour: seal-single-value-enum-by-default: true -tag: package-2023-02 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/keyvault/armkeyvault/client_factory.go b/sdk/resourcemanager/keyvault/armkeyvault/client_factory.go index ff61f9101ef7..d5f33c14a1d8 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/client_factory.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/client_factory.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -44,23 +43,23 @@ func (c *ClientFactory) NewKeysClient() *KeysClient { return subClient } -func (c *ClientFactory) NewManagedHsmKeysClient() *ManagedHsmKeysClient { - subClient, _ := NewManagedHsmKeysClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewMHSMPrivateEndpointConnectionsClient() *MHSMPrivateEndpointConnectionsClient { + subClient, _ := NewMHSMPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewVaultsClient() *VaultsClient { - subClient, _ := NewVaultsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewMHSMPrivateLinkResourcesClient() *MHSMPrivateLinkResourcesClient { + subClient, _ := NewMHSMPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewMHSMRegionsClient() *MHSMRegionsClient { + subClient, _ := NewMHSMRegionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { - subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewManagedHsmKeysClient() *ManagedHsmKeysClient { + subClient, _ := NewManagedHsmKeysClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -69,27 +68,27 @@ func (c *ClientFactory) NewManagedHsmsClient() *ManagedHsmsClient { return subClient } -func (c *ClientFactory) NewMHSMPrivateEndpointConnectionsClient() *MHSMPrivateEndpointConnectionsClient { - subClient, _ := NewMHSMPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewMHSMPrivateLinkResourcesClient() *MHSMPrivateLinkResourcesClient { - subClient, _ := NewMHSMPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewMHSMRegionsClient() *MHSMRegionsClient { - subClient, _ := NewMHSMRegionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { + subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +func (c *ClientFactory) NewSecretsClient() *SecretsClient { + subClient, _ := NewSecretsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewSecretsClient() *SecretsClient { - subClient, _ := NewSecretsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVaultsClient() *VaultsClient { + subClient, _ := NewVaultsClient(c.subscriptionID, c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/keyvault/armkeyvault/constants.go b/sdk/resourcemanager/keyvault/armkeyvault/constants.go index d6415ed56047..2a238075efd0 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/constants.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/constants.go @@ -3,31 +3,30 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault const ( moduleName = "armkeyvault" - moduleVersion = "v1.2.0" + moduleVersion = "v1.3.0" ) type AccessPolicyUpdateKind string const ( AccessPolicyUpdateKindAdd AccessPolicyUpdateKind = "add" - AccessPolicyUpdateKindReplace AccessPolicyUpdateKind = "replace" AccessPolicyUpdateKindRemove AccessPolicyUpdateKind = "remove" + AccessPolicyUpdateKindReplace AccessPolicyUpdateKind = "replace" ) // PossibleAccessPolicyUpdateKindValues returns the possible values for the AccessPolicyUpdateKind const type. func PossibleAccessPolicyUpdateKindValues() []AccessPolicyUpdateKind { return []AccessPolicyUpdateKind{ AccessPolicyUpdateKindAdd, - AccessPolicyUpdateKindReplace, AccessPolicyUpdateKindRemove, + AccessPolicyUpdateKindReplace, } } @@ -118,15 +117,15 @@ func PossibleCertificatePermissionsValues() []CertificatePermissions { type CreateMode string const ( - CreateModeRecover CreateMode = "recover" CreateModeDefault CreateMode = "default" + CreateModeRecover CreateMode = "recover" ) // PossibleCreateModeValues returns the possible values for the CreateMode const type. func PossibleCreateModeValues() []CreateMode { return []CreateMode{ - CreateModeRecover, CreateModeDefault, + CreateModeRecover, } } @@ -317,19 +316,26 @@ func PossibleKeyPermissionsValues() []KeyPermissions { } } -// KeyRotationPolicyActionType - The type of action. +// KeyRotationPolicyActionType - The type of the action. type KeyRotationPolicyActionType string const ( + // KeyRotationPolicyActionTypeNotify - Trigger Event Grid events. Defaults to 30 days before expiry. Key Vault only. + KeyRotationPolicyActionTypeNotify KeyRotationPolicyActionType = "Notify" + // KeyRotationPolicyActionTypeRotate - Rotate the key based on the key policy. Key Vault only. Managed HSM uses camelCase + // 'rotate' instead. + KeyRotationPolicyActionTypeRotate KeyRotationPolicyActionType = "Rotate" + // KeyRotationPolicyActionTypeRotate - Rotate the key based on the key policy. Managed HSM only. Key Vault uses PascalCase + // 'Rotate' instead. KeyRotationPolicyActionTypeRotate KeyRotationPolicyActionType = "rotate" - KeyRotationPolicyActionTypeNotify KeyRotationPolicyActionType = "notify" ) // PossibleKeyRotationPolicyActionTypeValues returns the possible values for the KeyRotationPolicyActionType const type. func PossibleKeyRotationPolicyActionTypeValues() []KeyRotationPolicyActionType { return []KeyRotationPolicyActionType{ - KeyRotationPolicyActionTypeRotate, KeyRotationPolicyActionTypeNotify, + KeyRotationPolicyActionTypeRotate, + KeyRotationPolicyActionTypeRotate, } } @@ -351,15 +357,17 @@ func PossibleManagedHsmSKUFamilyValues() []ManagedHsmSKUFamily { type ManagedHsmSKUName string const ( - ManagedHsmSKUNameStandardB1 ManagedHsmSKUName = "Standard_B1" ManagedHsmSKUNameCustomB32 ManagedHsmSKUName = "Custom_B32" + ManagedHsmSKUNameCustomB6 ManagedHsmSKUName = "Custom_B6" + ManagedHsmSKUNameStandardB1 ManagedHsmSKUName = "Standard_B1" ) // PossibleManagedHsmSKUNameValues returns the possible values for the ManagedHsmSKUName const type. func PossibleManagedHsmSKUNameValues() []ManagedHsmSKUName { return []ManagedHsmSKUName{ - ManagedHsmSKUNameStandardB1, ManagedHsmSKUNameCustomB32, + ManagedHsmSKUNameCustomB6, + ManagedHsmSKUNameStandardB1, } } @@ -477,7 +485,7 @@ func PossibleProvisioningStateValues() []ProvisioningState { } } -// PublicNetworkAccess - Control permission for data plane traffic coming from public networks while private endpoint is enabled. +// PublicNetworkAccess - Control permission to the managed HSM from public networks. type PublicNetworkAccess string const ( @@ -527,15 +535,15 @@ func PossibleSKUFamilyValues() []SKUFamily { type SKUName string const ( - SKUNameStandard SKUName = "standard" SKUNamePremium SKUName = "premium" + SKUNameStandard SKUName = "standard" ) // PossibleSKUNameValues returns the possible values for the SKUName const type. func PossibleSKUNameValues() []SKUName { return []SKUName{ - SKUNameStandard, SKUNamePremium, + SKUNameStandard, } } diff --git a/sdk/resourcemanager/keyvault/armkeyvault/go.mod b/sdk/resourcemanager/keyvault/armkeyvault/go.mod index 10794b172667..20ba013c47aa 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/go.mod +++ b/sdk/resourcemanager/keyvault/armkeyvault/go.mod @@ -3,14 +3,14 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvaul go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 github.com/stretchr/testify v1.7.0 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.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.7.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -21,9 +21,9 @@ require ( github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/sys v0.6.0 // indirect + golang.org/x/text v0.8.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/keyvault/armkeyvault/go.sum b/sdk/resourcemanager/keyvault/armkeyvault/go.sum index b0f97586a165..592e81cc36bb 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/go.sum +++ b/sdk/resourcemanager/keyvault/armkeyvault/go.sum @@ -1,9 +1,9 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 h1:t/W5MYAuQy81cvM8VUNfRLzhtKpXhVUAN7Cd7KVbTyc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0/go.mod h1:NBanQUfSWiWn3QEpWDTCU0IjBECKOYvl2R8xdRtMtiM= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2/go.mod h1:FbdwsQ2EzwvXxOPcMFYO8ogEc9uMMIj3YkmCdXdAFmk= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8= @@ -31,12 +31,12 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/sdk/resourcemanager/keyvault/armkeyvault/keys_client.go b/sdk/resourcemanager/keyvault/armkeyvault/keys_client.go index bd55b5b7cc2c..4c3dd95a7fb2 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/keys_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/keys_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -59,18 +58,21 @@ func NewKeysClient(subscriptionID string, credential azcore.TokenCredential, opt // - parameters - The parameters used to create the specified key. // - options - KeysClientCreateIfNotExistOptions contains the optional parameters for the KeysClient.CreateIfNotExist method. func (client *KeysClient) CreateIfNotExist(ctx context.Context, resourceGroupName string, vaultName string, keyName string, parameters KeyCreateParameters, options *KeysClientCreateIfNotExistOptions) (KeysClientCreateIfNotExistResponse, error) { + var err error req, err := client.createIfNotExistCreateRequest(ctx, resourceGroupName, vaultName, keyName, parameters, options) if err != nil { return KeysClientCreateIfNotExistResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return KeysClientCreateIfNotExistResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return KeysClientCreateIfNotExistResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return KeysClientCreateIfNotExistResponse{}, err } - return client.createIfNotExistHandleResponse(resp) + resp, err := client.createIfNotExistHandleResponse(httpResp) + return resp, err } // createIfNotExistCreateRequest creates the CreateIfNotExist request. @@ -100,7 +102,10 @@ func (client *KeysClient) createIfNotExistCreateRequest(ctx context.Context, res reqQP.Set("api-version", "2023-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createIfNotExistHandleResponse handles the CreateIfNotExist response. @@ -121,18 +126,21 @@ func (client *KeysClient) createIfNotExistHandleResponse(resp *http.Response) (K // - keyName - The name of the key to be retrieved. // - options - KeysClientGetOptions contains the optional parameters for the KeysClient.Get method. func (client *KeysClient) Get(ctx context.Context, resourceGroupName string, vaultName string, keyName string, options *KeysClientGetOptions) (KeysClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, keyName, options) if err != nil { return KeysClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return KeysClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return KeysClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return KeysClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -184,18 +192,21 @@ func (client *KeysClient) getHandleResponse(resp *http.Response) (KeysClientGetR // - keyVersion - The version of the key to be retrieved. // - options - KeysClientGetVersionOptions contains the optional parameters for the KeysClient.GetVersion method. func (client *KeysClient) GetVersion(ctx context.Context, resourceGroupName string, vaultName string, keyName string, keyVersion string, options *KeysClientGetVersionOptions) (KeysClientGetVersionResponse, error) { + var err error req, err := client.getVersionCreateRequest(ctx, resourceGroupName, vaultName, keyName, keyVersion, options) if err != nil { return KeysClientGetVersionResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return KeysClientGetVersionResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return KeysClientGetVersionResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return KeysClientGetVersionResponse{}, err } - return client.getVersionHandleResponse(resp) + resp, err := client.getVersionHandleResponse(httpResp) + return resp, err } // getVersionCreateRequest creates the GetVersion request. diff --git a/sdk/resourcemanager/keyvault/armkeyvault/keys_client_example_test.go b/sdk/resourcemanager/keyvault/armkeyvault/keys_client_example_test.go deleted file mode 100644 index 0ae869b948e6..000000000000 --- a/sdk/resourcemanager/keyvault/armkeyvault/keys_client_example_test.go +++ /dev/null @@ -1,276 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewKeysClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Key = armkeyvault.Key{ - // Name: to.Ptr("sample-key-name"), - // Type: to.Ptr("Microsoft.KeyVault/vaults/keys"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault-name/keys/sample-key-name"), - // Location: to.Ptr("westus"), - // Properties: &armkeyvault.KeyProperties{ - // Attributes: &armkeyvault.KeyAttributes{ - // Created: to.Ptr[int64](1598533051), - // Enabled: to.Ptr(true), - // RecoveryLevel: to.Ptr(armkeyvault.DeletionRecoveryLevelPurgeable), - // Updated: to.Ptr[int64](1598533051), - // }, - // KeyOps: []*armkeyvault.JSONWebKeyOperation{ - // to.Ptr(armkeyvault.JSONWebKeyOperationEncrypt), - // to.Ptr(armkeyvault.JSONWebKeyOperationDecrypt), - // to.Ptr(armkeyvault.JSONWebKeyOperationSign), - // to.Ptr(armkeyvault.JSONWebKeyOperationVerify), - // to.Ptr(armkeyvault.JSONWebKeyOperationWrapKey), - // to.Ptr(armkeyvault.JSONWebKeyOperationUnwrapKey)}, - // KeySize: to.Ptr[int32](2048), - // KeyURI: to.Ptr("https://sample-vault-name.vault.azure.net:443/keys/sample-key-name"), - // KeyURIWithVersion: to.Ptr("https://sample-vault-name.vault.azure.net:443/keys/sample-key-name/fd618d9519b74f9aae94ade66b876acc"), - // Kty: to.Ptr(armkeyvault.JSONWebKeyTypeRSA), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewKeysClient().Get(ctx, "sample-group", "sample-vault-name", "sample-key-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Key = armkeyvault.Key{ - // Name: to.Ptr("sample-key-name"), - // Type: to.Ptr("Microsoft.KeyVault/vaults/keys"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault-name/keys/sample-key-name"), - // Location: to.Ptr("westus"), - // Properties: &armkeyvault.KeyProperties{ - // Attributes: &armkeyvault.KeyAttributes{ - // Created: to.Ptr[int64](1598533051), - // Enabled: to.Ptr(true), - // RecoveryLevel: to.Ptr(armkeyvault.DeletionRecoveryLevelPurgeable), - // Updated: to.Ptr[int64](1598533051), - // }, - // KeyOps: []*armkeyvault.JSONWebKeyOperation{ - // to.Ptr(armkeyvault.JSONWebKeyOperationEncrypt), - // to.Ptr(armkeyvault.JSONWebKeyOperationDecrypt), - // to.Ptr(armkeyvault.JSONWebKeyOperationSign), - // to.Ptr(armkeyvault.JSONWebKeyOperationVerify), - // to.Ptr(armkeyvault.JSONWebKeyOperationWrapKey), - // to.Ptr(armkeyvault.JSONWebKeyOperationUnwrapKey)}, - // KeySize: to.Ptr[int32](2048), - // KeyURI: to.Ptr("https://sample-vault-name.vault.azure.net:443/keys/sample-key-name"), - // KeyURIWithVersion: to.Ptr("https://sample-vault-name.vault.azure.net:443/keys/sample-key-name/fd618d9519b74f9aae94ade66b876acc"), - // Kty: to.Ptr(armkeyvault.JSONWebKeyTypeRSA), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewKeysClient().NewListPager("sample-group", "sample-vault-name", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.KeyListResult = armkeyvault.KeyListResult{ - // Value: []*armkeyvault.Key{ - // { - // Name: to.Ptr("sample-key-name-1"), - // Type: to.Ptr("Microsoft.KeyVault/vaults/keys"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault-name/keys/sample-key-name-1"), - // Location: to.Ptr("westus"), - // Properties: &armkeyvault.KeyProperties{ - // Attributes: &armkeyvault.KeyAttributes{ - // Created: to.Ptr[int64](1596493796), - // Enabled: to.Ptr(true), - // RecoveryLevel: to.Ptr(armkeyvault.DeletionRecoveryLevelPurgeable), - // Updated: to.Ptr[int64](1596493796), - // }, - // KeyURI: to.Ptr("https://sample-vault-name.vault.azure.net:443/keys/sample-key-name-1"), - // }, - // }, - // { - // Name: to.Ptr("sample-key-name-2"), - // Type: to.Ptr("Microsoft.KeyVault/vaults/keys"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault-name/keys/sample-key-name-2"), - // Location: to.Ptr("westus"), - // Properties: &armkeyvault.KeyProperties{ - // Attributes: &armkeyvault.KeyAttributes{ - // Created: to.Ptr[int64](1596493797), - // Enabled: to.Ptr(true), - // RecoveryLevel: to.Ptr(armkeyvault.DeletionRecoveryLevelPurgeable), - // Updated: to.Ptr[int64](1596493797), - // }, - // KeyURI: to.Ptr("https://sample-vault-name.vault.azure.net:443/keys/sample-key-name-2"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewKeysClient().GetVersion(ctx, "sample-group", "sample-vault-name", "sample-key-name", "fd618d9519b74f9aae94ade66b876acc", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Key = armkeyvault.Key{ - // Name: to.Ptr("fd618d9519b74f9aae94ade66b876acc"), - // Type: to.Ptr("Microsoft.KeyVault/vaults/keys/versions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault-name/keys/sample-key-name/versions/fd618d9519b74f9aae94ade66b876acc"), - // Location: to.Ptr("westus"), - // Properties: &armkeyvault.KeyProperties{ - // Attributes: &armkeyvault.KeyAttributes{ - // Created: to.Ptr[int64](1598533051), - // Enabled: to.Ptr(true), - // RecoveryLevel: to.Ptr(armkeyvault.DeletionRecoveryLevelPurgeable), - // Updated: to.Ptr[int64](1598533051), - // }, - // KeyOps: []*armkeyvault.JSONWebKeyOperation{ - // to.Ptr(armkeyvault.JSONWebKeyOperationEncrypt), - // to.Ptr(armkeyvault.JSONWebKeyOperationDecrypt), - // to.Ptr(armkeyvault.JSONWebKeyOperationSign), - // to.Ptr(armkeyvault.JSONWebKeyOperationVerify), - // to.Ptr(armkeyvault.JSONWebKeyOperationWrapKey), - // to.Ptr(armkeyvault.JSONWebKeyOperationUnwrapKey)}, - // KeySize: to.Ptr[int32](2048), - // KeyURI: to.Ptr("https://sample-vault-name.vault.azure.net:443/keys/sample-key-name"), - // KeyURIWithVersion: to.Ptr("https://sample-vault-name.vault.azure.net:443/keys/sample-key-name/fd618d9519b74f9aae94ade66b876acc"), - // Kty: to.Ptr(armkeyvault.JSONWebKeyTypeRSA), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewKeysClient().NewListVersionsPager("sample-group", "sample-vault-name", "sample-key-name", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.KeyListResult = armkeyvault.KeyListResult{ - // Value: []*armkeyvault.Key{ - // { - // Name: to.Ptr("c2296aa24acf4daf86942bff5aca73dd"), - // Type: to.Ptr("Microsoft.KeyVault/vaults/keys/versions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault-name/keys/sample-key-name/versions/c2296aa24acf4daf86942bff5aca73dd"), - // Location: to.Ptr("westus"), - // Properties: &armkeyvault.KeyProperties{ - // Attributes: &armkeyvault.KeyAttributes{ - // Created: to.Ptr[int64](1598641074), - // Enabled: to.Ptr(true), - // RecoveryLevel: to.Ptr(armkeyvault.DeletionRecoveryLevelPurgeable), - // Updated: to.Ptr[int64](1598641074), - // }, - // KeyURI: to.Ptr("https://sample-vault-name.vault.azure.net:443/keys/sample-key-name"), - // KeyURIWithVersion: to.Ptr("https://sample-vault-name.vault.azure.net:443/keys/sample-key-name/c2296aa24acf4daf86942bff5aca73dd"), - // }, - // }, - // { - // Name: to.Ptr("d5a04667b6f44b0ca62825f5eae93da6"), - // Type: to.Ptr("Microsoft.KeyVault/vaults/keys/versions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault-name/keys/sample-key-name/versions/d5a04667b6f44b0ca62825f5eae93da6"), - // Location: to.Ptr("westus"), - // Properties: &armkeyvault.KeyProperties{ - // Attributes: &armkeyvault.KeyAttributes{ - // Created: to.Ptr[int64](1598641295), - // Enabled: to.Ptr(true), - // RecoveryLevel: to.Ptr(armkeyvault.DeletionRecoveryLevelPurgeable), - // Updated: to.Ptr[int64](1598641295), - // }, - // KeyURI: to.Ptr("https://sample-vault-name.vault.azure.net:443/keys/sample-key-name"), - // KeyURIWithVersion: to.Ptr("https://sample-vault-name.vault.azure.net:443/keys/sample-key-name/d5a04667b6f44b0ca62825f5eae93da6"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/managedhsmkeys_client.go b/sdk/resourcemanager/keyvault/armkeyvault/managedhsmkeys_client.go index 3288eefd3f28..2c91fd014d19 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/managedhsmkeys_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/managedhsmkeys_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -60,18 +59,21 @@ func NewManagedHsmKeysClient(subscriptionID string, credential azcore.TokenCrede // - options - ManagedHsmKeysClientCreateIfNotExistOptions contains the optional parameters for the ManagedHsmKeysClient.CreateIfNotExist // method. func (client *ManagedHsmKeysClient) CreateIfNotExist(ctx context.Context, resourceGroupName string, name string, keyName string, parameters ManagedHsmKeyCreateParameters, options *ManagedHsmKeysClientCreateIfNotExistOptions) (ManagedHsmKeysClientCreateIfNotExistResponse, error) { + var err error req, err := client.createIfNotExistCreateRequest(ctx, resourceGroupName, name, keyName, parameters, options) if err != nil { return ManagedHsmKeysClientCreateIfNotExistResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedHsmKeysClientCreateIfNotExistResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedHsmKeysClientCreateIfNotExistResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedHsmKeysClientCreateIfNotExistResponse{}, err } - return client.createIfNotExistHandleResponse(resp) + resp, err := client.createIfNotExistHandleResponse(httpResp) + return resp, err } // createIfNotExistCreateRequest creates the CreateIfNotExist request. @@ -101,7 +103,10 @@ func (client *ManagedHsmKeysClient) createIfNotExistCreateRequest(ctx context.Co reqQP.Set("api-version", "2023-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createIfNotExistHandleResponse handles the CreateIfNotExist response. @@ -124,18 +129,21 @@ func (client *ManagedHsmKeysClient) createIfNotExistHandleResponse(resp *http.Re // information. // - options - ManagedHsmKeysClientGetOptions contains the optional parameters for the ManagedHsmKeysClient.Get method. func (client *ManagedHsmKeysClient) Get(ctx context.Context, resourceGroupName string, name string, keyName string, options *ManagedHsmKeysClientGetOptions) (ManagedHsmKeysClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, name, keyName, options) if err != nil { return ManagedHsmKeysClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedHsmKeysClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedHsmKeysClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedHsmKeysClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -190,18 +198,21 @@ func (client *ManagedHsmKeysClient) getHandleResponse(resp *http.Response) (Mana // - options - ManagedHsmKeysClientGetVersionOptions contains the optional parameters for the ManagedHsmKeysClient.GetVersion // method. func (client *ManagedHsmKeysClient) GetVersion(ctx context.Context, resourceGroupName string, name string, keyName string, keyVersion string, options *ManagedHsmKeysClientGetVersionOptions) (ManagedHsmKeysClientGetVersionResponse, error) { + var err error req, err := client.getVersionCreateRequest(ctx, resourceGroupName, name, keyName, keyVersion, options) if err != nil { return ManagedHsmKeysClientGetVersionResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedHsmKeysClientGetVersionResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedHsmKeysClientGetVersionResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedHsmKeysClientGetVersionResponse{}, err } - return client.getVersionHandleResponse(resp) + resp, err := client.getVersionHandleResponse(httpResp) + return resp, err } // getVersionCreateRequest creates the GetVersion request. diff --git a/sdk/resourcemanager/keyvault/armkeyvault/managedhsmkeys_client_example_test.go b/sdk/resourcemanager/keyvault/armkeyvault/managedhsmkeys_client_example_test.go deleted file mode 100644 index 4a13e1f796a2..000000000000 --- a/sdk/resourcemanager/keyvault/armkeyvault/managedhsmkeys_client_example_test.go +++ /dev/null @@ -1,269 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/managedHsmCreateKey.json -func ExampleManagedHsmKeysClient_CreateIfNotExist() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedHsmKeysClient().CreateIfNotExist(ctx, "sample-group", "sample-managedhsm-name", "sample-key-name", armkeyvault.ManagedHsmKeyCreateParameters{ - Properties: &armkeyvault.ManagedHsmKeyProperties{ - Kty: to.Ptr(armkeyvault.JSONWebKeyTypeRSA), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedHsmKey = armkeyvault.ManagedHsmKey{ - // Name: to.Ptr("sample-key-name"), - // Type: to.Ptr("Microsoft.KeyVault/managedHSMs/keys"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/managedHSMs/sample-managedhsm-name/keys/sample-key-name"), - // Properties: &armkeyvault.ManagedHsmKeyProperties{ - // Attributes: &armkeyvault.ManagedHsmKeyAttributes{ - // Created: to.Ptr[int64](1598533051), - // Enabled: to.Ptr(true), - // RecoveryLevel: to.Ptr(armkeyvault.DeletionRecoveryLevelPurgeable), - // Updated: to.Ptr[int64](1598533051), - // }, - // KeyOps: []*armkeyvault.JSONWebKeyOperation{ - // to.Ptr(armkeyvault.JSONWebKeyOperationEncrypt), - // to.Ptr(armkeyvault.JSONWebKeyOperationDecrypt), - // to.Ptr(armkeyvault.JSONWebKeyOperationSign), - // to.Ptr(armkeyvault.JSONWebKeyOperationVerify), - // to.Ptr(armkeyvault.JSONWebKeyOperationWrapKey), - // to.Ptr(armkeyvault.JSONWebKeyOperationUnwrapKey)}, - // KeySize: to.Ptr[int32](2048), - // KeyURI: to.Ptr("https://sample-managedhsm-name.managedhsm.azure.net:443/keys/sample-key-name"), - // KeyURIWithVersion: to.Ptr("https://sample-managedhsm-name.managedhsm.azure.net:443/keys/sample-key-name/fd618d9519b74f9aae94ade66b876acc"), - // Kty: to.Ptr(armkeyvault.JSONWebKeyTypeRSA), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/managedHsmGetKey.json -func ExampleManagedHsmKeysClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedHsmKeysClient().Get(ctx, "sample-group", "sample-managedhsm-name", "sample-key-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedHsmKey = armkeyvault.ManagedHsmKey{ - // Name: to.Ptr("sample-key-name"), - // Type: to.Ptr("Microsoft.KeyVault/managedHSMs/keys"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/managedHSMs/sample-managedhsm-name/keys/sample-key-name"), - // Properties: &armkeyvault.ManagedHsmKeyProperties{ - // Attributes: &armkeyvault.ManagedHsmKeyAttributes{ - // Created: to.Ptr[int64](1598533051), - // Enabled: to.Ptr(true), - // RecoveryLevel: to.Ptr(armkeyvault.DeletionRecoveryLevelPurgeable), - // Updated: to.Ptr[int64](1598533051), - // }, - // KeyOps: []*armkeyvault.JSONWebKeyOperation{ - // to.Ptr(armkeyvault.JSONWebKeyOperationEncrypt), - // to.Ptr(armkeyvault.JSONWebKeyOperationDecrypt), - // to.Ptr(armkeyvault.JSONWebKeyOperationSign), - // to.Ptr(armkeyvault.JSONWebKeyOperationVerify), - // to.Ptr(armkeyvault.JSONWebKeyOperationWrapKey), - // to.Ptr(armkeyvault.JSONWebKeyOperationUnwrapKey)}, - // KeySize: to.Ptr[int32](2048), - // KeyURI: to.Ptr("https://sample-managedhsm-name.managedhsm.azure.net:443/keys/sample-key-name"), - // KeyURIWithVersion: to.Ptr("https://sample-managedhsm-name.managedhsm.azure.net:443/keys/sample-key-name/fd618d9519b74f9aae94ade66b876acc"), - // Kty: to.Ptr(armkeyvault.JSONWebKeyTypeRSA), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/managedHsmListKeys.json -func ExampleManagedHsmKeysClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedHsmKeysClient().NewListPager("sample-group", "sample-managedhsm-name", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedHsmKeyListResult = armkeyvault.ManagedHsmKeyListResult{ - // Value: []*armkeyvault.ManagedHsmKey{ - // { - // Name: to.Ptr("sample-key-name-1"), - // Type: to.Ptr("Microsoft.KeyVault/managedHSMs/keys"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/managedHSMs/sample-managedhsm-name/keys/sample-key-name-1"), - // Properties: &armkeyvault.ManagedHsmKeyProperties{ - // Attributes: &armkeyvault.ManagedHsmKeyAttributes{ - // Created: to.Ptr[int64](1596493796), - // Enabled: to.Ptr(true), - // RecoveryLevel: to.Ptr(armkeyvault.DeletionRecoveryLevelPurgeable), - // Updated: to.Ptr[int64](1596493796), - // }, - // KeyURI: to.Ptr("https://sample-managedhsm-name.managedhsm.azure.net:443/keys/sample-key-name-1"), - // }, - // }, - // { - // Name: to.Ptr("sample-key-name-2"), - // Type: to.Ptr("Microsoft.KeyVault/managedHSMs/keys"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/managedHSMs/sample-managedhsm-name/keys/sample-key-name-2"), - // Properties: &armkeyvault.ManagedHsmKeyProperties{ - // Attributes: &armkeyvault.ManagedHsmKeyAttributes{ - // Created: to.Ptr[int64](1596493797), - // Enabled: to.Ptr(true), - // RecoveryLevel: to.Ptr(armkeyvault.DeletionRecoveryLevelPurgeable), - // Updated: to.Ptr[int64](1596493797), - // }, - // KeyURI: to.Ptr("https://sample-managedhsm-name.managedhsm.azure.net:443/keys/sample-key-name-2"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/managedHsmGetKeyVersion.json -func ExampleManagedHsmKeysClient_GetVersion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedHsmKeysClient().GetVersion(ctx, "sample-group", "sample-managedhsm-name", "sample-key-name", "fd618d9519b74f9aae94ade66b876acc", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedHsmKey = armkeyvault.ManagedHsmKey{ - // Name: to.Ptr("fd618d9519b74f9aae94ade66b876acc"), - // Type: to.Ptr("Microsoft.KeyVault/managedHSMs/keys/versions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/managedHSMs/sample-managedhsm-name/keys/sample-key-name/versions/fd618d9519b74f9aae94ade66b876acc"), - // Properties: &armkeyvault.ManagedHsmKeyProperties{ - // Attributes: &armkeyvault.ManagedHsmKeyAttributes{ - // Created: to.Ptr[int64](1598533051), - // Enabled: to.Ptr(true), - // RecoveryLevel: to.Ptr(armkeyvault.DeletionRecoveryLevelPurgeable), - // Updated: to.Ptr[int64](1598533051), - // }, - // KeyOps: []*armkeyvault.JSONWebKeyOperation{ - // to.Ptr(armkeyvault.JSONWebKeyOperationEncrypt), - // to.Ptr(armkeyvault.JSONWebKeyOperationDecrypt), - // to.Ptr(armkeyvault.JSONWebKeyOperationSign), - // to.Ptr(armkeyvault.JSONWebKeyOperationVerify), - // to.Ptr(armkeyvault.JSONWebKeyOperationWrapKey), - // to.Ptr(armkeyvault.JSONWebKeyOperationUnwrapKey)}, - // KeySize: to.Ptr[int32](2048), - // KeyURI: to.Ptr("https://sample-managedhsm-name.managedhsm.azure.net:443/keys/sample-key-name"), - // KeyURIWithVersion: to.Ptr("https://sample-managedhsm-name.managedhsm.azure.net:443/keys/sample-key-name/fd618d9519b74f9aae94ade66b876acc"), - // Kty: to.Ptr(armkeyvault.JSONWebKeyTypeRSA), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/managedHsmListKeyVersions.json -func ExampleManagedHsmKeysClient_NewListVersionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedHsmKeysClient().NewListVersionsPager("sample-group", "sample-managedhsm-name", "sample-key-name", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedHsmKeyListResult = armkeyvault.ManagedHsmKeyListResult{ - // Value: []*armkeyvault.ManagedHsmKey{ - // { - // Name: to.Ptr("c2296aa24acf4daf86942bff5aca73dd"), - // Type: to.Ptr("Microsoft.KeyVault/managedHSMs/keys/versions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/managedHSMs/sample-managedhsm-name/keys/sample-key-name/versions/c2296aa24acf4daf86942bff5aca73dd"), - // Properties: &armkeyvault.ManagedHsmKeyProperties{ - // Attributes: &armkeyvault.ManagedHsmKeyAttributes{ - // Created: to.Ptr[int64](1598641074), - // Enabled: to.Ptr(true), - // RecoveryLevel: to.Ptr(armkeyvault.DeletionRecoveryLevelPurgeable), - // Updated: to.Ptr[int64](1598641074), - // }, - // KeyURI: to.Ptr("https://sample-managedhsm-name.managedhsm.azure.net:443/keys/sample-key-name"), - // KeyURIWithVersion: to.Ptr("https://sample-managedhsm-name.managedhsm.azure.net:443/keys/sample-key-name/c2296aa24acf4daf86942bff5aca73dd"), - // }, - // }, - // { - // Name: to.Ptr("d5a04667b6f44b0ca62825f5eae93da6"), - // Type: to.Ptr("Microsoft.KeyVault/managedHSMs/keys/versions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/managedHSMs/sample-managedhsm-name/keys/sample-key-name/versions/d5a04667b6f44b0ca62825f5eae93da6"), - // Properties: &armkeyvault.ManagedHsmKeyProperties{ - // Attributes: &armkeyvault.ManagedHsmKeyAttributes{ - // Created: to.Ptr[int64](1598641295), - // Enabled: to.Ptr(true), - // RecoveryLevel: to.Ptr(armkeyvault.DeletionRecoveryLevelPurgeable), - // Updated: to.Ptr[int64](1598641295), - // }, - // KeyURI: to.Ptr("https://sample-managedhsm-name.managedhsm.azure.net:443/keys/sample-key-name"), - // KeyURIWithVersion: to.Ptr("https://sample-managedhsm-name.managedhsm.azure.net:443/keys/sample-key-name/d5a04667b6f44b0ca62825f5eae93da6"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/managedhsms_client.go b/sdk/resourcemanager/keyvault/armkeyvault/managedhsms_client.go index 21d87f4e5ccf..bc8f7485fd77 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/managedhsms_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/managedhsms_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -54,18 +53,21 @@ func NewManagedHsmsClient(subscriptionID string, credential azcore.TokenCredenti // - options - ManagedHsmsClientCheckMhsmNameAvailabilityOptions contains the optional parameters for the ManagedHsmsClient.CheckMhsmNameAvailability // method. func (client *ManagedHsmsClient) CheckMhsmNameAvailability(ctx context.Context, mhsmName CheckMhsmNameAvailabilityParameters, options *ManagedHsmsClientCheckMhsmNameAvailabilityOptions) (ManagedHsmsClientCheckMhsmNameAvailabilityResponse, error) { + var err error req, err := client.checkMhsmNameAvailabilityCreateRequest(ctx, mhsmName, options) if err != nil { return ManagedHsmsClientCheckMhsmNameAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedHsmsClientCheckMhsmNameAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedHsmsClientCheckMhsmNameAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedHsmsClientCheckMhsmNameAvailabilityResponse{}, err } - return client.checkMhsmNameAvailabilityHandleResponse(resp) + resp, err := client.checkMhsmNameAvailabilityHandleResponse(httpResp) + return resp, err } // checkMhsmNameAvailabilityCreateRequest creates the CheckMhsmNameAvailability request. @@ -83,7 +85,10 @@ func (client *ManagedHsmsClient) checkMhsmNameAvailabilityCreateRequest(ctx cont reqQP.Set("api-version", "2023-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, mhsmName) + if err := runtime.MarshalAsJSON(req, mhsmName); err != nil { + return nil, err + } + return req, nil } // checkMhsmNameAvailabilityHandleResponse handles the CheckMhsmNameAvailability response. @@ -110,7 +115,8 @@ func (client *ManagedHsmsClient) BeginCreateOrUpdate(ctx context.Context, resour if err != nil { return nil, err } - return runtime.NewPoller[ManagedHsmsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedHsmsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedHsmsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -121,18 +127,20 @@ func (client *ManagedHsmsClient) BeginCreateOrUpdate(ctx context.Context, resour // // Generated from API version 2023-02-01 func (client *ManagedHsmsClient) createOrUpdate(ctx context.Context, resourceGroupName string, name string, parameters ManagedHsm, options *ManagedHsmsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, name, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -158,7 +166,10 @@ func (client *ManagedHsmsClient) createOrUpdateCreateRequest(ctx context.Context reqQP.Set("api-version", "2023-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes the specified managed HSM Pool. @@ -174,7 +185,8 @@ func (client *ManagedHsmsClient) BeginDelete(ctx context.Context, resourceGroupN if err != nil { return nil, err } - return runtime.NewPoller[ManagedHsmsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedHsmsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedHsmsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -185,18 +197,20 @@ func (client *ManagedHsmsClient) BeginDelete(ctx context.Context, resourceGroupN // // Generated from API version 2023-02-01 func (client *ManagedHsmsClient) deleteOperation(ctx context.Context, resourceGroupName string, name string, options *ManagedHsmsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, name, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -233,18 +247,21 @@ func (client *ManagedHsmsClient) deleteCreateRequest(ctx context.Context, resour // - name - The name of the managed HSM Pool. // - options - ManagedHsmsClientGetOptions contains the optional parameters for the ManagedHsmsClient.Get method. func (client *ManagedHsmsClient) Get(ctx context.Context, resourceGroupName string, name string, options *ManagedHsmsClientGetOptions) (ManagedHsmsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, name, options) if err != nil { return ManagedHsmsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedHsmsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return ManagedHsmsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ManagedHsmsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -290,18 +307,21 @@ func (client *ManagedHsmsClient) getHandleResponse(resp *http.Response) (Managed // - location - The location of the deleted managed HSM. // - options - ManagedHsmsClientGetDeletedOptions contains the optional parameters for the ManagedHsmsClient.GetDeleted method. func (client *ManagedHsmsClient) GetDeleted(ctx context.Context, name string, location string, options *ManagedHsmsClientGetDeletedOptions) (ManagedHsmsClientGetDeletedResponse, error) { + var err error req, err := client.getDeletedCreateRequest(ctx, name, location, options) if err != nil { return ManagedHsmsClientGetDeletedResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedHsmsClientGetDeletedResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedHsmsClientGetDeletedResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedHsmsClientGetDeletedResponse{}, err } - return client.getDeletedHandleResponse(resp) + resp, err := client.getDeletedHandleResponse(httpResp) + return resp, err } // getDeletedCreateRequest creates the GetDeleted request. @@ -545,7 +565,8 @@ func (client *ManagedHsmsClient) BeginPurgeDeleted(ctx context.Context, name str if err != nil { return nil, err } - return runtime.NewPoller[ManagedHsmsClientPurgeDeletedResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedHsmsClientPurgeDeletedResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedHsmsClientPurgeDeletedResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -556,18 +577,20 @@ func (client *ManagedHsmsClient) BeginPurgeDeleted(ctx context.Context, name str // // Generated from API version 2023-02-01 func (client *ManagedHsmsClient) purgeDeleted(ctx context.Context, name string, location string, options *ManagedHsmsClientBeginPurgeDeletedOptions) (*http.Response, error) { + var err error req, err := client.purgeDeletedCreateRequest(ctx, name, location, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // purgeDeletedCreateRequest creates the PurgeDeleted request. @@ -610,7 +633,8 @@ func (client *ManagedHsmsClient) BeginUpdate(ctx context.Context, resourceGroupN if err != nil { return nil, err } - return runtime.NewPoller[ManagedHsmsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedHsmsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedHsmsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -621,18 +645,20 @@ func (client *ManagedHsmsClient) BeginUpdate(ctx context.Context, resourceGroupN // // Generated from API version 2023-02-01 func (client *ManagedHsmsClient) update(ctx context.Context, resourceGroupName string, name string, parameters ManagedHsm, options *ManagedHsmsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, name, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -658,5 +684,8 @@ func (client *ManagedHsmsClient) updateCreateRequest(ctx context.Context, resour reqQP.Set("api-version", "2023-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/keyvault/armkeyvault/managedhsms_client_example_test.go b/sdk/resourcemanager/keyvault/armkeyvault/managedhsms_client_example_test.go deleted file mode 100644 index ce9dc516c40d..000000000000 --- a/sdk/resourcemanager/keyvault/armkeyvault/managedhsms_client_example_test.go +++ /dev/null @@ -1,506 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedHsmsClient().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(false), - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedHsm = armkeyvault.ManagedHsm{ - // Name: to.Ptr("hsm1"), - // Type: to.Ptr("Microsoft.KeyVault/managedHSMs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.KeyVault/managedHSMs/hsm1"), - // 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(false), - // EnableSoftDelete: to.Ptr(true), - // HsmURI: to.Ptr("https://westus.hsm1.managedhsm.azure.net"), - // InitialAdminObjectIDs: []*string{ - // to.Ptr("00000000-0000-0000-0000-000000000000")}, - // ProvisioningState: to.Ptr(armkeyvault.ProvisioningStateSucceeded), - // SoftDeleteRetentionInDays: to.Ptr[int32](90), - // StatusMessage: to.Ptr("ManagedHsm is functional."), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedHsmsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedHsm = armkeyvault.ManagedHsm{ - // Name: to.Ptr("hsm1"), - // Type: to.Ptr("Microsoft.KeyVault/managedHSMs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.KeyVault/managedHSMs/hsm1"), - // 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"), - // "Slice": to.Ptr("A"), - // }, - // Properties: &armkeyvault.ManagedHsmProperties{ - // EnablePurgeProtection: to.Ptr(false), - // EnableSoftDelete: to.Ptr(true), - // HsmURI: to.Ptr("https://westus.hsm1.managedhsm.azure.net"), - // InitialAdminObjectIDs: []*string{ - // to.Ptr("00000000-0000-0000-0000-000000000000")}, - // ProvisioningState: to.Ptr(armkeyvault.ProvisioningStateSucceeded), - // SoftDeleteRetentionInDays: to.Ptr[int32](90), - // StatusMessage: to.Ptr("ManagedHsm is functional."), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedHsmsClient().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/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedHsmsClient().Get(ctx, "hsm-group", "hsm1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedHsm = armkeyvault.ManagedHsm{ - // Name: to.Ptr("hsm1"), - // Type: to.Ptr("Microsoft.KeyVault/managedHSMs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.KeyVault/managedHSMs/hsm1"), - // 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(false), - // EnableSoftDelete: to.Ptr(true), - // HsmURI: to.Ptr("https://westus.hsm1.managedhsm.azure.net"), - // InitialAdminObjectIDs: []*string{ - // to.Ptr("00000000-0000-0000-0000-000000000000")}, - // ProvisioningState: to.Ptr(armkeyvault.ProvisioningStateSucceeded), - // SoftDeleteRetentionInDays: to.Ptr[int32](90), - // StatusMessage: to.Ptr("ManagedHsm is functional."), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedHsmsClient().NewListByResourceGroupPager("hsm-group", &armkeyvault.ManagedHsmsClientListByResourceGroupOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedHsmListResult = armkeyvault.ManagedHsmListResult{ - // Value: []*armkeyvault.ManagedHsm{ - // { - // Name: to.Ptr("hsm1"), - // Type: to.Ptr("Microsoft.KeyVault/managedHSMs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.KeyVault/managedHSMs/hsm1"), - // 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(false), - // EnableSoftDelete: to.Ptr(true), - // HsmURI: to.Ptr("https://westus.hsm1.managedhsm.azure.net"), - // InitialAdminObjectIDs: []*string{ - // to.Ptr("00000000-0000-0000-0000-000000000000")}, - // ProvisioningState: to.Ptr(armkeyvault.ProvisioningStateSucceeded), - // SoftDeleteRetentionInDays: to.Ptr[int32](90), - // StatusMessage: to.Ptr("ManagedHsm is functional."), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // { - // Name: to.Ptr("hsm2"), - // Type: to.Ptr("Microsoft.KeyVault/managedHSMs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.KeyVault/managedHSMs/hsm2"), - // 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("production"), - // }, - // Properties: &armkeyvault.ManagedHsmProperties{ - // EnablePurgeProtection: to.Ptr(false), - // EnableSoftDelete: to.Ptr(true), - // HsmURI: to.Ptr("https://westus.hsm2.managedhsm.azure.net"), - // InitialAdminObjectIDs: []*string{ - // to.Ptr("00000000-0000-0000-0000-000000000000")}, - // ProvisioningState: to.Ptr(armkeyvault.ProvisioningStateSucceeded), - // SoftDeleteRetentionInDays: to.Ptr[int32](90), - // StatusMessage: to.Ptr("ManagedHsm is functional."), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedHsmsClient().NewListBySubscriptionPager(&armkeyvault.ManagedHsmsClientListBySubscriptionOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedHsmListResult = armkeyvault.ManagedHsmListResult{ - // Value: []*armkeyvault.ManagedHsm{ - // { - // Name: to.Ptr("hsm1"), - // Type: to.Ptr("Microsoft.KeyVault/managedHSMs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.KeyVault/managedHSMs/hsm1"), - // 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(false), - // EnableSoftDelete: to.Ptr(true), - // HsmURI: to.Ptr("https://westus.hsm1.managedhsm.azure.net"), - // InitialAdminObjectIDs: []*string{ - // to.Ptr("00000000-0000-0000-0000-000000000000")}, - // ProvisioningState: to.Ptr(armkeyvault.ProvisioningStateSucceeded), - // SoftDeleteRetentionInDays: to.Ptr[int32](90), - // StatusMessage: to.Ptr("ManagedHsm is functional."), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // { - // Name: to.Ptr("hsm2"), - // Type: to.Ptr("Microsoft.KeyVault/managedHSMs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.KeyVault/managedHSMs/hsm2"), - // 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("production"), - // }, - // Properties: &armkeyvault.ManagedHsmProperties{ - // EnablePurgeProtection: to.Ptr(false), - // EnableSoftDelete: to.Ptr(true), - // HsmURI: to.Ptr("https://westus.hsm2.managedhsm.azure.net"), - // InitialAdminObjectIDs: []*string{ - // to.Ptr("00000000-0000-0000-0000-000000000000")}, - // ProvisioningState: to.Ptr(armkeyvault.ProvisioningStateSucceeded), - // SoftDeleteRetentionInDays: to.Ptr[int32](90), - // StatusMessage: to.Ptr("ManagedHsm is functional."), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedHsmsClient().NewListDeletedPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DeletedManagedHsmListResult = armkeyvault.DeletedManagedHsmListResult{ - // Value: []*armkeyvault.DeletedManagedHsm{ - // { - // Name: to.Ptr("vault-agile-drawer-6404"), - // Type: to.Ptr("Microsoft.KeyVault/deletedManagedHSMs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/westus/deletedManagedHSMs/hsm1"), - // Properties: &armkeyvault.DeletedManagedHsmProperties{ - // DeletionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T00:00:59Z"); return t}()), - // Location: to.Ptr("westus"), - // MhsmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.KeyVault/managedHSMs/hsm1"), - // PurgeProtectionEnabled: to.Ptr(true), - // ScheduledPurgeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T00:00:59Z"); return t}()), - // Tags: map[string]*string{ - // "Dept": to.Ptr("hsm"), - // "Environment": to.Ptr("production"), - // }, - // }, - // }, - // { - // Name: to.Ptr("vault-agile-drawer-6404"), - // Type: to.Ptr("Microsoft.KeyVault/deletedManagedHSMs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/westus/deletedManagedHSMs/hsm2"), - // Properties: &armkeyvault.DeletedManagedHsmProperties{ - // DeletionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T00:00:59Z"); return t}()), - // Location: to.Ptr("westus"), - // MhsmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.KeyVault/managedHSMs/hsm2"), - // PurgeProtectionEnabled: to.Ptr(true), - // ScheduledPurgeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T00:00:59Z"); return t}()), - // Tags: map[string]*string{ - // "Dept": to.Ptr("hsm"), - // "Environment": to.Ptr("production"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedHsmsClient().GetDeleted(ctx, "hsm1", "westus", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DeletedManagedHsm = armkeyvault.DeletedManagedHsm{ - // Name: to.Ptr("vault-agile-drawer-6404"), - // Type: to.Ptr("Microsoft.KeyVault/deletedManagedHSMs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/westus/deletedManagedHSMs/hsm1"), - // Properties: &armkeyvault.DeletedManagedHsmProperties{ - // DeletionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T00:00:59Z"); return t}()), - // Location: to.Ptr("westus"), - // MhsmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.KeyVault/managedHSMs/hsm1"), - // PurgeProtectionEnabled: to.Ptr(true), - // ScheduledPurgeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T00:00:59Z"); return t}()), - // Tags: map[string]*string{ - // "Dept": to.Ptr("hsm"), - // "Environment": to.Ptr("production"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedHsmsClient().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) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_checkMhsmNameAvailability.json -func ExampleManagedHsmsClient_CheckMhsmNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedHsmsClient().CheckMhsmNameAvailability(ctx, armkeyvault.CheckMhsmNameAvailabilityParameters{ - Name: to.Ptr("sample-mhsm"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckMhsmNameAvailabilityResult = armkeyvault.CheckMhsmNameAvailabilityResult{ - // NameAvailable: to.Ptr(true), - // } -} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivateendpointconnections_client.go b/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivateendpointconnections_client.go index b8b66a494414..e0e1431d4874 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivateendpointconnections_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivateendpointconnections_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -61,7 +60,8 @@ func (client *MHSMPrivateEndpointConnectionsClient) BeginDelete(ctx context.Cont if err != nil { return nil, err } - return runtime.NewPoller[MHSMPrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[MHSMPrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[MHSMPrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -72,18 +72,20 @@ func (client *MHSMPrivateEndpointConnectionsClient) BeginDelete(ctx context.Cont // // Generated from API version 2023-02-01 func (client *MHSMPrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, options *MHSMPrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, name, privateEndpointConnectionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -126,18 +128,21 @@ func (client *MHSMPrivateEndpointConnectionsClient) deleteCreateRequest(ctx cont // - options - MHSMPrivateEndpointConnectionsClientGetOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.Get // method. func (client *MHSMPrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, options *MHSMPrivateEndpointConnectionsClientGetOptions) (MHSMPrivateEndpointConnectionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, name, privateEndpointConnectionName, options) if err != nil { return MHSMPrivateEndpointConnectionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MHSMPrivateEndpointConnectionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MHSMPrivateEndpointConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MHSMPrivateEndpointConnectionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -261,18 +266,21 @@ func (client *MHSMPrivateEndpointConnectionsClient) listByResourceHandleResponse // - options - MHSMPrivateEndpointConnectionsClientPutOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.Put // method. func (client *MHSMPrivateEndpointConnectionsClient) Put(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, properties MHSMPrivateEndpointConnection, options *MHSMPrivateEndpointConnectionsClientPutOptions) (MHSMPrivateEndpointConnectionsClientPutResponse, error) { + var err error req, err := client.putCreateRequest(ctx, resourceGroupName, name, privateEndpointConnectionName, properties, options) if err != nil { return MHSMPrivateEndpointConnectionsClientPutResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MHSMPrivateEndpointConnectionsClientPutResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MHSMPrivateEndpointConnectionsClientPutResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MHSMPrivateEndpointConnectionsClientPutResponse{}, err } - return client.putHandleResponse(resp) + resp, err := client.putHandleResponse(httpResp) + return resp, err } // putCreateRequest creates the Put request. @@ -302,12 +310,18 @@ func (client *MHSMPrivateEndpointConnectionsClient) putCreateRequest(ctx context reqQP.Set("api-version", "2023-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, properties) + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil } // putHandleResponse handles the Put response. func (client *MHSMPrivateEndpointConnectionsClient) putHandleResponse(resp *http.Response) (MHSMPrivateEndpointConnectionsClientPutResponse, error) { result := MHSMPrivateEndpointConnectionsClientPutResponse{} + if val := resp.Header.Get("Azure-AsyncOperation"); val != "" { + result.AzureAsyncOperation = &val + } if val := resp.Header.Get("Retry-After"); val != "" { retryAfter32, err := strconv.ParseInt(val, 10, 32) retryAfter := int32(retryAfter32) @@ -316,9 +330,6 @@ func (client *MHSMPrivateEndpointConnectionsClient) putHandleResponse(resp *http } result.RetryAfter = &retryAfter } - if val := resp.Header.Get("Azure-AsyncOperation"); val != "" { - result.AzureAsyncOperation = &val - } if err := runtime.UnmarshalAsJSON(resp, &result.MHSMPrivateEndpointConnection); err != nil { return MHSMPrivateEndpointConnectionsClientPutResponse{}, err } diff --git a/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivateendpointconnections_client_example_test.go b/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivateendpointconnections_client_example_test.go deleted file mode 100644 index a267b3e4323a..000000000000 --- a/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivateendpointconnections_client_example_test.go +++ /dev/null @@ -1,193 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMHSMPrivateEndpointConnectionsClient().NewListByResourcePager("sample-group", "sample-mhsm", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MHSMPrivateEndpointConnectionsListResult = armkeyvault.MHSMPrivateEndpointConnectionsListResult{ - // Value: []*armkeyvault.MHSMPrivateEndpointConnection{ - // { - // Name: to.Ptr("sample-pec1"), - // Type: to.Ptr("Microsoft.KeyVault/managedhsms/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/managedhsms/sample-mhsm/privateEndpointConnections/sample-pec1"), - // Etag: to.Ptr(""), - // Properties: &armkeyvault.MHSMPrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armkeyvault.MHSMPrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-1234-000000000000/resourceGroups/sample-group/providers/Microsoft.Network/privateEndpoints/sample-pe1"), - // }, - // PrivateLinkServiceConnectionState: &armkeyvault.MHSMPrivateLinkServiceConnectionState{ - // Description: to.Ptr("This was automatically approved by user1234@contoso.com"), - // ActionsRequired: to.Ptr(armkeyvault.ActionsRequiredNone), - // Status: to.Ptr(armkeyvault.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armkeyvault.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("sample-pec2"), - // Type: to.Ptr("Microsoft.KeyVault/managedhsms/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/managedhsms/sample-mhsm/privateEndpointConnections/sample-pec2"), - // Etag: to.Ptr(""), - // Properties: &armkeyvault.MHSMPrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armkeyvault.MHSMPrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-1234-000000000000/resourceGroups/sample-group/providers/Microsoft.Network/privateEndpoints/sample-pe2"), - // }, - // PrivateLinkServiceConnectionState: &armkeyvault.MHSMPrivateLinkServiceConnectionState{ - // Description: to.Ptr("This was automatically approved by user1234@contoso.com"), - // ActionsRequired: to.Ptr(armkeyvault.ActionsRequiredNone), - // Status: to.Ptr(armkeyvault.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armkeyvault.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMHSMPrivateEndpointConnectionsClient().Get(ctx, "sample-group", "sample-mhsm", "sample-pec", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MHSMPrivateEndpointConnection = armkeyvault.MHSMPrivateEndpointConnection{ - // Name: to.Ptr("sample-pec"), - // Type: to.Ptr("Microsoft.KeyVault/managedhsms/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/managedhsms/sample-mhsm/privateEndpointConnections/sample-pec"), - // Etag: to.Ptr(""), - // Properties: &armkeyvault.MHSMPrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armkeyvault.MHSMPrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-1234-000000000000/resourceGroups/sample-group/providers/Microsoft.Network/privateEndpoints/sample-pe"), - // }, - // PrivateLinkServiceConnectionState: &armkeyvault.MHSMPrivateLinkServiceConnectionState{ - // Description: to.Ptr("This was automatically approved by user1234@contoso.com"), - // ActionsRequired: to.Ptr(armkeyvault.ActionsRequiredNone), - // Status: to.Ptr(armkeyvault.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armkeyvault.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMHSMPrivateEndpointConnectionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MHSMPrivateEndpointConnection = armkeyvault.MHSMPrivateEndpointConnection{ - // Name: to.Ptr("sample-pec"), - // Type: to.Ptr("Microsoft.KeyVault/managedhsms/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/managedhsms/sample-mhsm/privateEndpointConnections/sample-pec"), - // Properties: &armkeyvault.MHSMPrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armkeyvault.MHSMPrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-1234-000000000000/resourceGroups/sample-group/providers/Microsoft.Network/privateEndpoints/sample-pe"), - // }, - // PrivateLinkServiceConnectionState: &armkeyvault.MHSMPrivateLinkServiceConnectionState{ - // Description: to.Ptr("My name is Joe and I'm approving this."), - // ActionsRequired: to.Ptr(armkeyvault.ActionsRequiredNone), - // Status: to.Ptr(armkeyvault.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armkeyvault.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMHSMPrivateEndpointConnectionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MHSMPrivateEndpointConnection = armkeyvault.MHSMPrivateEndpointConnection{ - // Name: to.Ptr("sample-pec"), - // Type: to.Ptr("Microsoft.KeyVault/managedhsms/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/managedhsms/sample-vault/privateEndpointConnections/sample-pec"), - // Properties: &armkeyvault.MHSMPrivateEndpointConnectionProperties{ - // ProvisioningState: to.Ptr(armkeyvault.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivatelinkresources_client.go b/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivatelinkresources_client.go index 4bff50b0f79d..1f55a1e742df 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivatelinkresources_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivatelinkresources_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -54,18 +53,21 @@ func NewMHSMPrivateLinkResourcesClient(subscriptionID string, credential azcore. // - options - MHSMPrivateLinkResourcesClientListByMHSMResourceOptions contains the optional parameters for the MHSMPrivateLinkResourcesClient.ListByMHSMResource // method. func (client *MHSMPrivateLinkResourcesClient) ListByMHSMResource(ctx context.Context, resourceGroupName string, name string, options *MHSMPrivateLinkResourcesClientListByMHSMResourceOptions) (MHSMPrivateLinkResourcesClientListByMHSMResourceResponse, error) { + var err error req, err := client.listByMHSMResourceCreateRequest(ctx, resourceGroupName, name, options) if err != nil { return MHSMPrivateLinkResourcesClientListByMHSMResourceResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MHSMPrivateLinkResourcesClientListByMHSMResourceResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MHSMPrivateLinkResourcesClientListByMHSMResourceResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MHSMPrivateLinkResourcesClientListByMHSMResourceResponse{}, err } - return client.listByMHSMResourceHandleResponse(resp) + resp, err := client.listByMHSMResourceHandleResponse(httpResp) + return resp, err } // listByMHSMResourceCreateRequest creates the ListByMHSMResource request. diff --git a/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivatelinkresources_client_example_test.go b/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivatelinkresources_client_example_test.go deleted file mode 100644 index 164cf084d304..000000000000 --- a/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivatelinkresources_client_example_test.go +++ /dev/null @@ -1,53 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMHSMPrivateLinkResourcesClient().ListByMHSMResource(ctx, "sample-group", "sample-mhsm", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MHSMPrivateLinkResourceListResult = armkeyvault.MHSMPrivateLinkResourceListResult{ - // Value: []*armkeyvault.MHSMPrivateLinkResource{ - // { - // Name: to.Ptr("managedhsm"), - // Type: to.Ptr("Microsoft.KeyVault/managedhsms/privateLinkResources"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-resource-group/providers/Microsoft.KeyVault/managedhsms/sample-mhsm/privateLinkResources/managedhsm"), - // Properties: &armkeyvault.MHSMPrivateLinkResourceProperties{ - // GroupID: to.Ptr("managedhsms"), - // RequiredMembers: []*string{ - // to.Ptr("default")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.managedhsm.azure.net")}, - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/mhsmregions_client.go b/sdk/resourcemanager/keyvault/armkeyvault/mhsmregions_client.go index 64692ec10312..cf0179427577 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/mhsmregions_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/mhsmregions_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault diff --git a/sdk/resourcemanager/keyvault/armkeyvault/mhsmregions_client_example_test.go b/sdk/resourcemanager/keyvault/armkeyvault/mhsmregions_client_example_test.go deleted file mode 100644 index c0ce6b61180a..000000000000 --- a/sdk/resourcemanager/keyvault/armkeyvault/mhsmregions_client_example_test.go +++ /dev/null @@ -1,56 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_ListRegionsByResource.json -func ExampleMHSMRegionsClient_NewListByResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMHSMRegionsClient().NewListByResourcePager("sample-group", "sample-mhsm", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MHSMRegionsListResult = armkeyvault.MHSMRegionsListResult{ - // Value: []*armkeyvault.MHSMGeoReplicatedRegion{ - // { - // Name: to.Ptr("sample-region1"), - // IsPrimary: to.Ptr(true), - // ProvisioningState: to.Ptr(armkeyvault.GeoReplicationRegionProvisioningStateSucceeded), - // }, - // { - // Name: to.Ptr("sample-region2"), - // IsPrimary: to.Ptr(false), - // ProvisioningState: to.Ptr(armkeyvault.GeoReplicationRegionProvisioningStateSucceeded), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/models.go b/sdk/resourcemanager/keyvault/armkeyvault/models.go index 27413da2a258..7d055b4cc39b 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/models.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/models.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -16,1578 +15,1371 @@ import "time" type AccessPolicyEntry struct { // REQUIRED; The object ID of a user, service principal or security group in the Azure Active Directory tenant for the vault. // The object ID must be unique for the list of access policies. - ObjectID *string `json:"objectId,omitempty"` + ObjectID *string // REQUIRED; Permissions the identity has for keys, secrets and certificates. - Permissions *Permissions `json:"permissions,omitempty"` + Permissions *Permissions // REQUIRED; The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. - TenantID *string `json:"tenantId,omitempty"` + TenantID *string // Application ID of the client making request on behalf of a principal - ApplicationID *string `json:"applicationId,omitempty"` + ApplicationID *string } type Action struct { - // The type of action. - Type *KeyRotationPolicyActionType `json:"type,omitempty"` + // The type of the action. + Type *KeyRotationPolicyActionType } // Attributes - The object attributes managed by the KeyVault service. type Attributes struct { // Determines whether the object is enabled. - Enabled *bool `json:"enabled,omitempty"` + Enabled *bool // Expiry date in seconds since 1970-01-01T00:00:00Z. - Expires *time.Time `json:"exp,omitempty"` + Expires *time.Time // Not before date in seconds since 1970-01-01T00:00:00Z. - NotBefore *time.Time `json:"nbf,omitempty"` + NotBefore *time.Time // READ-ONLY; Creation time in seconds since 1970-01-01T00:00:00Z. - Created *time.Time `json:"created,omitempty" azure:"ro"` + Created *time.Time // READ-ONLY; Last updated time in seconds since 1970-01-01T00:00:00Z. - Updated *time.Time `json:"updated,omitempty" azure:"ro"` + Updated *time.Time } // 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"` + Name *string } // 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"` + Message *string // 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"` + NameAvailable *bool // 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"` + Reason *Reason } // CheckNameAvailabilityResult - The CheckNameAvailability operation response. type CheckNameAvailabilityResult struct { // READ-ONLY; An error message explaining the Reason value in more detail. - Message *string `json:"message,omitempty" azure:"ro"` + Message *string // 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"` + NameAvailable *bool // READ-ONLY; The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. - Reason *Reason `json:"reason,omitempty" azure:"ro"` + Reason *Reason } type DeletedManagedHsm struct { // Properties of the deleted managed HSM - Properties *DeletedManagedHsmProperties `json:"properties,omitempty"` + Properties *DeletedManagedHsmProperties // READ-ONLY; The Azure Resource Manager resource ID for the deleted managed HSM Pool. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the managed HSM Pool. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The resource type of the managed HSM Pool. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // DeletedManagedHsmListResult - List of deleted managed HSM Pools type DeletedManagedHsmListResult struct { // The URL to get the next set of deleted managed HSM Pools. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The list of deleted managed HSM Pools. - Value []*DeletedManagedHsm `json:"value,omitempty"` + Value []*DeletedManagedHsm } // DeletedManagedHsmProperties - Properties of the deleted managed HSM. type DeletedManagedHsmProperties struct { // READ-ONLY; The deleted date. - DeletionDate *time.Time `json:"deletionDate,omitempty" azure:"ro"` + DeletionDate *time.Time // READ-ONLY; The location of the original managed HSM. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; The resource id of the original managed HSM. - MhsmID *string `json:"mhsmId,omitempty" azure:"ro"` + MhsmID *string // READ-ONLY; Purge protection status of the original managed HSM. - PurgeProtectionEnabled *bool `json:"purgeProtectionEnabled,omitempty" azure:"ro"` + PurgeProtectionEnabled *bool // READ-ONLY; The scheduled purged date. - ScheduledPurgeDate *time.Time `json:"scheduledPurgeDate,omitempty" azure:"ro"` + ScheduledPurgeDate *time.Time // READ-ONLY; Tags of the original managed HSM. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string } // DeletedVault - Deleted vault information with extended details. type DeletedVault struct { // Properties of the vault - Properties *DeletedVaultProperties `json:"properties,omitempty"` + Properties *DeletedVaultProperties // READ-ONLY; The resource ID for the deleted key vault. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the key vault. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The resource type of the key vault. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // DeletedVaultListResult - List of vaults type DeletedVaultListResult struct { // The URL to get the next set of deleted vaults. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The list of deleted vaults. - Value []*DeletedVault `json:"value,omitempty"` + Value []*DeletedVault } // DeletedVaultProperties - Properties of the deleted vault. type DeletedVaultProperties struct { // READ-ONLY; The deleted date. - DeletionDate *time.Time `json:"deletionDate,omitempty" azure:"ro"` + DeletionDate *time.Time // READ-ONLY; The location of the original vault. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Purge protection status of the original vault. - PurgeProtectionEnabled *bool `json:"purgeProtectionEnabled,omitempty" azure:"ro"` + PurgeProtectionEnabled *bool // READ-ONLY; The scheduled purged date. - ScheduledPurgeDate *time.Time `json:"scheduledPurgeDate,omitempty" azure:"ro"` + ScheduledPurgeDate *time.Time // READ-ONLY; Tags of the original vault. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; The resource id of the original vault. - VaultID *string `json:"vaultId,omitempty" azure:"ro"` + VaultID *string } // DimensionProperties - Type of operation: get, read, delete, etc. type DimensionProperties struct { // Display name of dimension. - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string // Name of dimension. - Name *string `json:"name,omitempty"` + Name *string // Property to specify whether the dimension should be exported for Shoebox. - ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` + ToBeExportedForShoebox *bool } // Error - The server error. type Error struct { // READ-ONLY; The error code. - Code *string `json:"code,omitempty" azure:"ro"` + Code *string // READ-ONLY; The inner error, contains a more specific error code. - InnerError *Error `json:"innererror,omitempty" azure:"ro"` + InnerError *Error // READ-ONLY; The error message. - Message *string `json:"message,omitempty" azure:"ro"` + Message *string } // IPRule - A rule governing the accessibility of a vault from a specific ip address or ip range. type IPRule struct { // REQUIRED; An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses // that start with 124.56.78). - Value *string `json:"value,omitempty"` + Value *string } // Key - The key resource. type Key struct { // REQUIRED; The properties of the key. - Properties *KeyProperties `json:"properties,omitempty"` + Properties *KeyProperties // READ-ONLY; Fully qualified identifier of the key vault resource. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Azure location of the key vault resource. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Name of the key vault resource. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Tags assigned to the key vault resource. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type of the key vault resource. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // KeyAttributes - The object attributes managed by the Azure Key Vault service. type KeyAttributes struct { // Determines whether or not the object is enabled. - Enabled *bool `json:"enabled,omitempty"` + Enabled *bool // Expiry date in seconds since 1970-01-01T00:00:00Z. - Expires *int64 `json:"exp,omitempty"` + Expires *int64 // Indicates if the private key can be exported. - Exportable *bool `json:"exportable,omitempty"` + Exportable *bool // Not before date in seconds since 1970-01-01T00:00:00Z. - NotBefore *int64 `json:"nbf,omitempty"` + NotBefore *int64 // READ-ONLY; Creation time in seconds since 1970-01-01T00:00:00Z. - Created *int64 `json:"created,omitempty" azure:"ro"` + Created *int64 // READ-ONLY; The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object // can be permanently deleted by a privileged user; otherwise, only the system can purge the // object at the end of the retention interval. - RecoveryLevel *DeletionRecoveryLevel `json:"recoveryLevel,omitempty" azure:"ro"` + RecoveryLevel *DeletionRecoveryLevel // READ-ONLY; Last updated time in seconds since 1970-01-01T00:00:00Z. - Updated *int64 `json:"updated,omitempty" azure:"ro"` + Updated *int64 } // KeyCreateParameters - The parameters used to create a key. type KeyCreateParameters struct { // REQUIRED; The properties of the key to be created. - Properties *KeyProperties `json:"properties,omitempty"` + Properties *KeyProperties // The tags that will be assigned to the key. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // KeyListResult - The page of keys. type KeyListResult struct { // The URL to get the next page of keys. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The key resources. - Value []*Key `json:"value,omitempty"` + Value []*Key } // KeyProperties - The properties of the key. type KeyProperties struct { // The attributes of the key. - Attributes *KeyAttributes `json:"attributes,omitempty"` + Attributes *KeyAttributes // The elliptic curve name. For valid values, see JsonWebKeyCurveName. - CurveName *JSONWebKeyCurveName `json:"curveName,omitempty"` - KeyOps []*JSONWebKeyOperation `json:"keyOps,omitempty"` + CurveName *JSONWebKeyCurveName + KeyOps []*JSONWebKeyOperation // The key size in bits. For example: 2048, 3072, or 4096 for RSA. - KeySize *int32 `json:"keySize,omitempty"` + KeySize *int32 // The type of the key. For valid values, see JsonWebKeyType. - Kty *JSONWebKeyType `json:"kty,omitempty"` + Kty *JSONWebKeyType // Key release policy in response. It will be used for both output and input. Omitted if empty - ReleasePolicy *KeyReleasePolicy `json:"release_policy,omitempty"` + ReleasePolicy *KeyReleasePolicy // Key rotation policy in response. It will be used for both output and input. Omitted if empty - RotationPolicy *RotationPolicy `json:"rotationPolicy,omitempty"` + RotationPolicy *RotationPolicy // READ-ONLY; The URI to retrieve the current version of the key. - KeyURI *string `json:"keyUri,omitempty" azure:"ro"` + KeyURI *string // READ-ONLY; The URI to retrieve the specific version of the key. - KeyURIWithVersion *string `json:"keyUriWithVersion,omitempty" azure:"ro"` + KeyURIWithVersion *string } type KeyReleasePolicy struct { // Content type and version of key release policy - ContentType *string `json:"contentType,omitempty"` + ContentType *string // Blob encoding the policy rules under which the key can be released. - Data []byte `json:"data,omitempty"` + Data []byte } type KeyRotationPolicyAttributes struct { // The expiration time for the new key version. It should be in ISO8601 format. Eg: 'P90D', 'P1Y'. - ExpiryTime *string `json:"expiryTime,omitempty"` + ExpiryTime *string // READ-ONLY; Creation time in seconds since 1970-01-01T00:00:00Z. - Created *int64 `json:"created,omitempty" azure:"ro"` + Created *int64 // READ-ONLY; Last updated time in seconds since 1970-01-01T00:00:00Z. - Updated *int64 `json:"updated,omitempty" azure:"ro"` -} - -// KeysClientCreateIfNotExistOptions contains the optional parameters for the KeysClient.CreateIfNotExist method. -type KeysClientCreateIfNotExistOptions struct { - // placeholder for future optional parameters -} - -// KeysClientGetOptions contains the optional parameters for the KeysClient.Get method. -type KeysClientGetOptions struct { - // placeholder for future optional parameters -} - -// KeysClientGetVersionOptions contains the optional parameters for the KeysClient.GetVersion method. -type KeysClientGetVersionOptions struct { - // placeholder for future optional parameters -} - -// KeysClientListOptions contains the optional parameters for the KeysClient.NewListPager method. -type KeysClientListOptions struct { - // placeholder for future optional parameters -} - -// KeysClientListVersionsOptions contains the optional parameters for the KeysClient.NewListVersionsPager method. -type KeysClientListVersionsOptions struct { - // placeholder for future optional parameters + Updated *int64 } type LifetimeAction struct { // The action of key rotation policy lifetimeAction. - Action *Action `json:"action,omitempty"` + Action *Action // The trigger of key rotation policy lifetimeAction. - Trigger *Trigger `json:"trigger,omitempty"` + Trigger *Trigger } // LogSpecification - Log specification of operation. type LogSpecification struct { // Blob duration of specification. - BlobDuration *string `json:"blobDuration,omitempty"` + BlobDuration *string // Display name of log specification. - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string // Name of log specification. - Name *string `json:"name,omitempty"` + Name *string } // MHSMGeoReplicatedRegion - A region that this managed HSM Pool has been extended to. type MHSMGeoReplicatedRegion struct { // A boolean value that indicates whether the region is the primary region or a secondary region. - IsPrimary *bool `json:"isPrimary,omitempty"` + IsPrimary *bool // Name of the geo replicated region. - Name *string `json:"name,omitempty"` + Name *string // READ-ONLY; Provisioning state of the geo replicated region. - ProvisioningState *GeoReplicationRegionProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + ProvisioningState *GeoReplicationRegionProvisioningState } // MHSMIPRule - A rule governing the accessibility of a managed HSM pool from a specific IP address or IP range. type MHSMIPRule struct { // REQUIRED; An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses // that start with 124.56.78). - Value *string `json:"value,omitempty"` + Value *string } // MHSMNetworkRuleSet - A set of rules governing the network accessibility of a managed hsm pool. type MHSMNetworkRuleSet struct { // Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. - Bypass *NetworkRuleBypassOptions `json:"bypass,omitempty"` + Bypass *NetworkRuleBypassOptions // The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property // has been evaluated. - DefaultAction *NetworkRuleAction `json:"defaultAction,omitempty"` + DefaultAction *NetworkRuleAction // The list of IP address rules. - IPRules []*MHSMIPRule `json:"ipRules,omitempty"` + IPRules []*MHSMIPRule // The list of virtual network rules. - VirtualNetworkRules []*MHSMVirtualNetworkRule `json:"virtualNetworkRules,omitempty"` + VirtualNetworkRules []*MHSMVirtualNetworkRule } // MHSMPrivateEndpoint - Private endpoint object properties. type MHSMPrivateEndpoint struct { // READ-ONLY; Full identifier of the private endpoint resource. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string } // MHSMPrivateEndpointConnection - Private endpoint connection resource. type MHSMPrivateEndpointConnection struct { // Modified whenever there is a change in the state of private endpoint connection. - Etag *string `json:"etag,omitempty"` + Etag *string // The supported Azure location where the managed HSM Pool should be created. - Location *string `json:"location,omitempty"` + Location *string // Resource properties. - Properties *MHSMPrivateEndpointConnectionProperties `json:"properties,omitempty"` + Properties *MHSMPrivateEndpointConnectionProperties // SKU details - SKU *ManagedHsmSKU `json:"sku,omitempty"` + SKU *ManagedHsmSKU // Resource tags - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; The Azure Resource Manager resource ID for the managed HSM Pool. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the managed HSM Pool. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Metadata pertaining to creation and last modification of the key vault resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The resource type of the managed HSM Pool. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // MHSMPrivateEndpointConnectionItem - Private endpoint connection item. type MHSMPrivateEndpointConnectionItem struct { // Modified whenever there is a change in the state of private endpoint connection. - Etag *string `json:"etag,omitempty"` + Etag *string // Id of private endpoint connection. - ID *string `json:"id,omitempty"` + ID *string // Private endpoint connection properties. - Properties *MHSMPrivateEndpointConnectionProperties `json:"properties,omitempty"` + Properties *MHSMPrivateEndpointConnectionProperties } // MHSMPrivateEndpointConnectionProperties - Properties of the private endpoint connection resource. type MHSMPrivateEndpointConnectionProperties struct { // Properties of the private endpoint object. - PrivateEndpoint *MHSMPrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateEndpoint *MHSMPrivateEndpoint // Approval state of the private link connection. - PrivateLinkServiceConnectionState *MHSMPrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + PrivateLinkServiceConnectionState *MHSMPrivateLinkServiceConnectionState // Provisioning state of the private endpoint connection. - ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` -} - -// MHSMPrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.BeginDelete -// method. -type MHSMPrivateEndpointConnectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// MHSMPrivateEndpointConnectionsClientGetOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.Get -// method. -type MHSMPrivateEndpointConnectionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// MHSMPrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.NewListByResourcePager -// method. -type MHSMPrivateEndpointConnectionsClientListByResourceOptions struct { - // placeholder for future optional parameters -} - -// MHSMPrivateEndpointConnectionsClientPutOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.Put -// method. -type MHSMPrivateEndpointConnectionsClientPutOptions struct { - // placeholder for future optional parameters + ProvisioningState *PrivateEndpointConnectionProvisioningState } // MHSMPrivateEndpointConnectionsListResult - List of private endpoint connections associated with a managed HSM Pools type MHSMPrivateEndpointConnectionsListResult struct { // The URL to get the next set of managed HSM Pools. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The private endpoint connection associated with a managed HSM Pools. - Value []*MHSMPrivateEndpointConnection `json:"value,omitempty"` + Value []*MHSMPrivateEndpointConnection } // MHSMPrivateLinkResource - A private link resource type MHSMPrivateLinkResource struct { // The supported Azure location where the managed HSM Pool should be created. - Location *string `json:"location,omitempty"` + Location *string // Resource properties. - Properties *MHSMPrivateLinkResourceProperties `json:"properties,omitempty"` + Properties *MHSMPrivateLinkResourceProperties // SKU details - SKU *ManagedHsmSKU `json:"sku,omitempty"` + SKU *ManagedHsmSKU // Resource tags - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; The Azure Resource Manager resource ID for the managed HSM Pool. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the managed HSM Pool. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Metadata pertaining to creation and last modification of the key vault resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The resource type of the managed HSM Pool. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // MHSMPrivateLinkResourceListResult - A list of private link resources type MHSMPrivateLinkResourceListResult struct { // Array of private link resources - Value []*MHSMPrivateLinkResource `json:"value,omitempty"` + Value []*MHSMPrivateLinkResource } // MHSMPrivateLinkResourceProperties - Properties of a private link resource. type MHSMPrivateLinkResourceProperties struct { // Required DNS zone names of the the private link resource. - RequiredZoneNames []*string `json:"requiredZoneNames,omitempty"` + RequiredZoneNames []*string // READ-ONLY; Group identifier of private link resource. - GroupID *string `json:"groupId,omitempty" azure:"ro"` + GroupID *string // READ-ONLY; Required member names of private link resource. - RequiredMembers []*string `json:"requiredMembers,omitempty" azure:"ro"` -} - -// MHSMPrivateLinkResourcesClientListByMHSMResourceOptions contains the optional parameters for the MHSMPrivateLinkResourcesClient.ListByMHSMResource -// method. -type MHSMPrivateLinkResourcesClientListByMHSMResourceOptions struct { - // placeholder for future optional parameters + RequiredMembers []*string } // MHSMPrivateLinkServiceConnectionState - An object that represents the approval state of the private link connection. type MHSMPrivateLinkServiceConnectionState struct { // A message indicating if changes on the service provider require any updates on the consumer. - ActionsRequired *ActionsRequired `json:"actionsRequired,omitempty"` + ActionsRequired *ActionsRequired // The reason for approval or rejection. - Description *string `json:"description,omitempty"` + Description *string // Indicates whether the connection has been approved, rejected or removed by the key vault owner. - Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` -} - -// MHSMRegionsClientListByResourceOptions contains the optional parameters for the MHSMRegionsClient.NewListByResourcePager -// method. -type MHSMRegionsClientListByResourceOptions struct { - // placeholder for future optional parameters + Status *PrivateEndpointServiceConnectionStatus } // MHSMRegionsListResult - List of regions associated with a managed HSM Pools type MHSMRegionsListResult struct { // The URL to get the next set of managed HSM Pools. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The region associated with a managed HSM Pools. - Value []*MHSMGeoReplicatedRegion `json:"value,omitempty"` + Value []*MHSMGeoReplicatedRegion } // MHSMVirtualNetworkRule - A rule governing the accessibility of a managed hsm pool from a specific virtual network. type MHSMVirtualNetworkRule struct { // REQUIRED; Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - ID *string `json:"id,omitempty"` + ID *string } // ManagedHSMSecurityDomainProperties - The security domain properties of the managed hsm. type ManagedHSMSecurityDomainProperties struct { // READ-ONLY; Activation Status - ActivationStatus *ActivationStatus `json:"activationStatus,omitempty" azure:"ro"` + ActivationStatus *ActivationStatus // READ-ONLY; Activation Status Message. - ActivationStatusMessage *string `json:"activationStatusMessage,omitempty" azure:"ro"` + ActivationStatusMessage *string } // ManagedHsm - Resource information with extended details. type ManagedHsm struct { // The supported Azure location where the managed HSM Pool should be created. - Location *string `json:"location,omitempty"` + Location *string // Properties of the managed HSM - Properties *ManagedHsmProperties `json:"properties,omitempty"` + Properties *ManagedHsmProperties // SKU details - SKU *ManagedHsmSKU `json:"sku,omitempty"` + SKU *ManagedHsmSKU // Resource tags - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; The Azure Resource Manager resource ID for the managed HSM Pool. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the managed HSM Pool. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Metadata pertaining to creation and last modification of the key vault resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The resource type of the managed HSM Pool. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } type ManagedHsmAction struct { - // The type of action. - Type *KeyRotationPolicyActionType `json:"type,omitempty"` + // The type of the action. + Type *KeyRotationPolicyActionType } // ManagedHsmError - The error exception. type ManagedHsmError struct { // READ-ONLY; The server error. - Error *Error `json:"error,omitempty" azure:"ro"` + Error *Error } // ManagedHsmKey - The key resource. type ManagedHsmKey struct { // REQUIRED; The properties of the key. - Properties *ManagedHsmKeyProperties `json:"properties,omitempty"` + Properties *ManagedHsmKeyProperties // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ManagedHsmKeyAttributes - The object attributes managed by the Azure Key Vault service. type ManagedHsmKeyAttributes struct { // Determines whether or not the object is enabled. - Enabled *bool `json:"enabled,omitempty"` + Enabled *bool // Expiry date in seconds since 1970-01-01T00:00:00Z. - Expires *int64 `json:"exp,omitempty"` + Expires *int64 // Indicates if the private key can be exported. - Exportable *bool `json:"exportable,omitempty"` + Exportable *bool // Not before date in seconds since 1970-01-01T00:00:00Z. - NotBefore *int64 `json:"nbf,omitempty"` + NotBefore *int64 // READ-ONLY; Creation time in seconds since 1970-01-01T00:00:00Z. - Created *int64 `json:"created,omitempty" azure:"ro"` + Created *int64 // READ-ONLY; The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object // can be permanently deleted by a privileged user; otherwise, only the system can purge the // object at the end of the retention interval. - RecoveryLevel *DeletionRecoveryLevel `json:"recoveryLevel,omitempty" azure:"ro"` + RecoveryLevel *DeletionRecoveryLevel // READ-ONLY; Last updated time in seconds since 1970-01-01T00:00:00Z. - Updated *int64 `json:"updated,omitempty" azure:"ro"` + Updated *int64 } // ManagedHsmKeyCreateParameters - The parameters used to create a key. type ManagedHsmKeyCreateParameters struct { // REQUIRED; The properties of the key to be created. - Properties *ManagedHsmKeyProperties `json:"properties,omitempty"` + Properties *ManagedHsmKeyProperties // The tags that will be assigned to the key. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // ManagedHsmKeyListResult - The page of keys. type ManagedHsmKeyListResult struct { // The URL to get the next page of keys. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The key resources. - Value []*ManagedHsmKey `json:"value,omitempty"` + Value []*ManagedHsmKey } // ManagedHsmKeyProperties - The properties of the key. type ManagedHsmKeyProperties struct { // The attributes of the key. - Attributes *ManagedHsmKeyAttributes `json:"attributes,omitempty"` + Attributes *ManagedHsmKeyAttributes // The elliptic curve name. For valid values, see JsonWebKeyCurveName. - CurveName *JSONWebKeyCurveName `json:"curveName,omitempty"` - KeyOps []*JSONWebKeyOperation `json:"keyOps,omitempty"` + CurveName *JSONWebKeyCurveName + KeyOps []*JSONWebKeyOperation // The key size in bits. For example: 2048, 3072, or 4096 for RSA. - KeySize *int32 `json:"keySize,omitempty"` + KeySize *int32 // The type of the key. For valid values, see JsonWebKeyType. - Kty *JSONWebKeyType `json:"kty,omitempty"` + Kty *JSONWebKeyType // Key release policy in response. It will be used for both output and input. Omitted if empty - ReleasePolicy *ManagedHsmKeyReleasePolicy `json:"release_policy,omitempty"` + ReleasePolicy *ManagedHsmKeyReleasePolicy // Key rotation policy in response. It will be used for both output and input. Omitted if empty - RotationPolicy *ManagedHsmRotationPolicy `json:"rotationPolicy,omitempty"` + RotationPolicy *ManagedHsmRotationPolicy // READ-ONLY; The URI to retrieve the current version of the key. - KeyURI *string `json:"keyUri,omitempty" azure:"ro"` + KeyURI *string // READ-ONLY; The URI to retrieve the specific version of the key. - KeyURIWithVersion *string `json:"keyUriWithVersion,omitempty" azure:"ro"` + KeyURIWithVersion *string } type ManagedHsmKeyReleasePolicy struct { // Content type and version of key release policy - ContentType *string `json:"contentType,omitempty"` + ContentType *string // Blob encoding the policy rules under which the key can be released. - Data []byte `json:"data,omitempty"` + Data []byte } type ManagedHsmKeyRotationPolicyAttributes struct { // The expiration time for the new key version. It should be in ISO8601 format. Eg: 'P90D', 'P1Y'. - ExpiryTime *string `json:"expiryTime,omitempty"` + ExpiryTime *string // READ-ONLY; Creation time in seconds since 1970-01-01T00:00:00Z. - Created *int64 `json:"created,omitempty" azure:"ro"` + Created *int64 // READ-ONLY; Last updated time in seconds since 1970-01-01T00:00:00Z. - Updated *int64 `json:"updated,omitempty" azure:"ro"` -} - -// ManagedHsmKeysClientCreateIfNotExistOptions contains the optional parameters for the ManagedHsmKeysClient.CreateIfNotExist -// method. -type ManagedHsmKeysClientCreateIfNotExistOptions struct { - // placeholder for future optional parameters -} - -// ManagedHsmKeysClientGetOptions contains the optional parameters for the ManagedHsmKeysClient.Get method. -type ManagedHsmKeysClientGetOptions struct { - // placeholder for future optional parameters -} - -// ManagedHsmKeysClientGetVersionOptions contains the optional parameters for the ManagedHsmKeysClient.GetVersion method. -type ManagedHsmKeysClientGetVersionOptions struct { - // placeholder for future optional parameters -} - -// ManagedHsmKeysClientListOptions contains the optional parameters for the ManagedHsmKeysClient.NewListPager method. -type ManagedHsmKeysClientListOptions struct { - // placeholder for future optional parameters -} - -// ManagedHsmKeysClientListVersionsOptions contains the optional parameters for the ManagedHsmKeysClient.NewListVersionsPager -// method. -type ManagedHsmKeysClientListVersionsOptions struct { - // placeholder for future optional parameters + Updated *int64 } type ManagedHsmLifetimeAction struct { // The action of key rotation policy lifetimeAction. - Action *ManagedHsmAction `json:"action,omitempty"` + Action *ManagedHsmAction // The trigger of key rotation policy lifetimeAction. - Trigger *ManagedHsmTrigger `json:"trigger,omitempty"` + Trigger *ManagedHsmTrigger } // ManagedHsmListResult - List of managed HSM Pools type ManagedHsmListResult struct { // The URL to get the next set of managed HSM Pools. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The list of managed HSM Pools. - Value []*ManagedHsm `json:"value,omitempty"` + Value []*ManagedHsm } // ManagedHsmProperties - Properties of the managed HSM Pool type ManagedHsmProperties struct { // The create mode to indicate whether the resource is being created or is being recovered from a deleted resource. - CreateMode *CreateMode `json:"createMode,omitempty"` + CreateMode *CreateMode // Property specifying whether protection against purge is enabled for this managed HSM pool. Setting this property to true // activates protection against purge for this managed HSM pool and its content - - // only the Managed HSM service may initiate a hard, irrecoverable deletion. The setting is effective only if soft delete - // is also enabled. Enabling this functionality is irreversible. - EnablePurgeProtection *bool `json:"enablePurgeProtection,omitempty"` + // only the Managed HSM service may initiate a hard, irrecoverable deletion. Enabling this functionality is irreversible. + EnablePurgeProtection *bool - // Property to specify whether the 'soft delete' functionality is enabled for this managed HSM pool. If it's not set to any - // value(true or false) when creating new managed HSM pool, it will be set to true - // by default. Once set to true, it cannot be reverted to false. - EnableSoftDelete *bool `json:"enableSoftDelete,omitempty"` + // Property to specify whether the 'soft delete' functionality is enabled for this managed HSM pool. Soft delete is enabled + // by default for all managed HSMs and is immutable. + EnableSoftDelete *bool // Array of initial administrators object ids for this managed hsm pool. - InitialAdminObjectIDs []*string `json:"initialAdminObjectIds,omitempty"` + InitialAdminObjectIDs []*string // Rules governing the accessibility of the key vault from specific network locations. - NetworkACLs *MHSMNetworkRuleSet `json:"networkAcls,omitempty"` + NetworkACLs *MHSMNetworkRuleSet - // Control permission for data plane traffic coming from public networks while private endpoint is enabled. - PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // Control permission to the managed HSM from public networks. + PublicNetworkAccess *PublicNetworkAccess // List of all regions associated with the managed hsm pool. - Regions []*MHSMGeoReplicatedRegion `json:"regions,omitempty"` + Regions []*MHSMGeoReplicatedRegion - // softDelete data retention days. It accepts >=7 and <=90. - SoftDeleteRetentionInDays *int32 `json:"softDeleteRetentionInDays,omitempty"` + // Soft deleted data retention days. When you delete an HSM or a key, it will remain recoverable for the configured retention + // period or for a default period of 90 days. It accepts values between 7 and + // 90. + SoftDeleteRetentionInDays *int32 // The Azure Active Directory tenant ID that should be used for authenticating requests to the managed HSM pool. - TenantID *string `json:"tenantId,omitempty"` + TenantID *string // READ-ONLY; The URI of the managed hsm pool for performing operations on keys. - HsmURI *string `json:"hsmUri,omitempty" azure:"ro"` + HsmURI *string // READ-ONLY; List of private endpoint connections associated with the managed hsm pool. - PrivateEndpointConnections []*MHSMPrivateEndpointConnectionItem `json:"privateEndpointConnections,omitempty" azure:"ro"` + PrivateEndpointConnections []*MHSMPrivateEndpointConnectionItem // READ-ONLY; Provisioning state. - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + ProvisioningState *ProvisioningState // READ-ONLY; The scheduled purge date in UTC. - ScheduledPurgeDate *time.Time `json:"scheduledPurgeDate,omitempty" azure:"ro"` + ScheduledPurgeDate *time.Time // READ-ONLY; Managed HSM security domain properties. - SecurityDomainProperties *ManagedHSMSecurityDomainProperties `json:"securityDomainProperties,omitempty" azure:"ro"` + SecurityDomainProperties *ManagedHSMSecurityDomainProperties // READ-ONLY; Resource Status Message. - StatusMessage *string `json:"statusMessage,omitempty" azure:"ro"` + StatusMessage *string } // ManagedHsmResource - Managed HSM resource type ManagedHsmResource struct { // The supported Azure location where the managed HSM Pool should be created. - Location *string `json:"location,omitempty"` + Location *string // SKU details - SKU *ManagedHsmSKU `json:"sku,omitempty"` + SKU *ManagedHsmSKU // Resource tags - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; The Azure Resource Manager resource ID for the managed HSM Pool. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the managed HSM Pool. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Metadata pertaining to creation and last modification of the key vault resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The resource type of the managed HSM Pool. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } type ManagedHsmRotationPolicy struct { // The attributes of key rotation policy. - Attributes *ManagedHsmKeyRotationPolicyAttributes `json:"attributes,omitempty"` + Attributes *ManagedHsmKeyRotationPolicyAttributes // The lifetimeActions for key rotation action. - LifetimeActions []*ManagedHsmLifetimeAction `json:"lifetimeActions,omitempty"` + LifetimeActions []*ManagedHsmLifetimeAction } // ManagedHsmSKU - SKU details type ManagedHsmSKU struct { // REQUIRED; SKU Family of the managed HSM Pool - Family *ManagedHsmSKUFamily `json:"family,omitempty"` + Family *ManagedHsmSKUFamily // REQUIRED; SKU of the managed HSM Pool - Name *ManagedHsmSKUName `json:"name,omitempty"` + Name *ManagedHsmSKUName } type ManagedHsmTrigger struct { // The time duration after key creation to rotate the key. It only applies to rotate. It will be in ISO 8601 duration format. // Eg: 'P90D', 'P1Y'. - TimeAfterCreate *string `json:"timeAfterCreate,omitempty"` + TimeAfterCreate *string // The time duration before key expiring to rotate or notify. It will be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. - TimeBeforeExpiry *string `json:"timeBeforeExpiry,omitempty"` -} - -// ManagedHsmsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedHsmsClient.BeginCreateOrUpdate -// method. -type ManagedHsmsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedHsmsClientBeginDeleteOptions contains the optional parameters for the ManagedHsmsClient.BeginDelete method. -type ManagedHsmsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedHsmsClientBeginPurgeDeletedOptions contains the optional parameters for the ManagedHsmsClient.BeginPurgeDeleted -// method. -type ManagedHsmsClientBeginPurgeDeletedOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedHsmsClientBeginUpdateOptions contains the optional parameters for the ManagedHsmsClient.BeginUpdate method. -type ManagedHsmsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - 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 -} - -// ManagedHsmsClientGetOptions contains the optional parameters for the ManagedHsmsClient.Get method. -type ManagedHsmsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ManagedHsmsClientListByResourceGroupOptions contains the optional parameters for the ManagedHsmsClient.NewListByResourceGroupPager -// method. -type ManagedHsmsClientListByResourceGroupOptions struct { - // Maximum number of results to return. - Top *int32 -} - -// ManagedHsmsClientListBySubscriptionOptions contains the optional parameters for the ManagedHsmsClient.NewListBySubscriptionPager -// method. -type ManagedHsmsClientListBySubscriptionOptions struct { - // Maximum number of results to return. - Top *int32 -} - -// ManagedHsmsClientListDeletedOptions contains the optional parameters for the ManagedHsmsClient.NewListDeletedPager method. -type ManagedHsmsClientListDeletedOptions struct { - // placeholder for future optional parameters + TimeBeforeExpiry *string } // MetricSpecification - Metric specification of operation. type MetricSpecification struct { // The metric aggregation type. Possible values include: 'Average', 'Count', 'Total'. - AggregationType *string `json:"aggregationType,omitempty"` + AggregationType *string // The dimensions of metric - Dimensions []*DimensionProperties `json:"dimensions,omitempty"` + Dimensions []*DimensionProperties // Display description of metric specification. - DisplayDescription *string `json:"displayDescription,omitempty"` + DisplayDescription *string // Display name of metric specification. - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string // Property to specify whether to fill gap with zero. - FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + FillGapWithZero *bool // The internal metric name. - InternalMetricName *string `json:"internalMetricName,omitempty"` + InternalMetricName *string // The metric lock aggregation type. - LockAggregationType *string `json:"lockAggregationType,omitempty"` + LockAggregationType *string // Name of metric specification. - Name *string `json:"name,omitempty"` + Name *string // The supported aggregation types for the metrics. - SupportedAggregationTypes []*string `json:"supportedAggregationTypes,omitempty"` + SupportedAggregationTypes []*string // The supported time grain types for the metrics. - SupportedTimeGrainTypes []*string `json:"supportedTimeGrainTypes,omitempty"` + SupportedTimeGrainTypes []*string // The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. - Unit *string `json:"unit,omitempty"` + Unit *string } // NetworkRuleSet - A set of rules governing the network accessibility of a vault. type NetworkRuleSet struct { // Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. - Bypass *NetworkRuleBypassOptions `json:"bypass,omitempty"` + Bypass *NetworkRuleBypassOptions // The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property // has been evaluated. - DefaultAction *NetworkRuleAction `json:"defaultAction,omitempty"` + DefaultAction *NetworkRuleAction // The list of IP address rules. - IPRules []*IPRule `json:"ipRules,omitempty"` + IPRules []*IPRule // The list of virtual network rules. - VirtualNetworkRules []*VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` + VirtualNetworkRules []*VirtualNetworkRule } // Operation - Key Vault REST API operation definition. type Operation struct { // Display metadata associated with the operation. - Display *OperationDisplay `json:"display,omitempty"` + Display *OperationDisplay // Property to specify whether the action is a data action. - IsDataAction *bool `json:"isDataAction,omitempty"` + IsDataAction *bool // Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` + Name *string // Properties of operation, include metric specifications. - OperationProperties *OperationProperties `json:"properties,omitempty"` + OperationProperties *OperationProperties // The origin of operations. - Origin *string `json:"origin,omitempty"` + Origin *string } // OperationDisplay - Display metadata associated with the operation. type OperationDisplay struct { // Description of operation. - Description *string `json:"description,omitempty"` + Description *string // Type of operation: get, read, delete, etc. - Operation *string `json:"operation,omitempty"` + Operation *string // Service provider: Microsoft Key Vault. - Provider *string `json:"provider,omitempty"` + Provider *string // Resource on which the operation is performed etc. - Resource *string `json:"resource,omitempty"` + Resource *string } // OperationListResult - Result of the request to list Storage operations. It contains a list of operations and a URL link // to get the next set of results. type OperationListResult struct { // The URL to get the next set of operations. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // List of Storage operations supported by the Storage resource provider. - Value []*Operation `json:"value,omitempty"` + Value []*Operation } // OperationProperties - Properties of operation, include metric specifications. type OperationProperties struct { // One property of operation, include metric specifications. - ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters + ServiceSpecification *ServiceSpecification } // Permissions the identity has for keys, secrets, certificates and storage. type Permissions struct { // Permissions to certificates - Certificates []*CertificatePermissions `json:"certificates,omitempty"` + Certificates []*CertificatePermissions // Permissions to keys - Keys []*KeyPermissions `json:"keys,omitempty"` + Keys []*KeyPermissions // Permissions to secrets - Secrets []*SecretPermissions `json:"secrets,omitempty"` + Secrets []*SecretPermissions // Permissions to storage accounts - Storage []*StoragePermissions `json:"storage,omitempty"` + Storage []*StoragePermissions } // PrivateEndpoint - Private endpoint object properties. type PrivateEndpoint struct { // READ-ONLY; Full identifier of the private endpoint resource. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string } // PrivateEndpointConnection - Private endpoint connection resource. type PrivateEndpointConnection struct { // Modified whenever there is a change in the state of private endpoint connection. - Etag *string `json:"etag,omitempty"` + Etag *string // Resource properties. - Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + Properties *PrivateEndpointConnectionProperties // READ-ONLY; Fully qualified identifier of the key vault resource. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Azure location of the key vault resource. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Name of the key vault resource. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Tags assigned to the key vault resource. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type of the key vault resource. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // PrivateEndpointConnectionItem - Private endpoint connection item. type PrivateEndpointConnectionItem struct { // Modified whenever there is a change in the state of private endpoint connection. - Etag *string `json:"etag,omitempty"` + Etag *string // Id of private endpoint connection. - ID *string `json:"id,omitempty"` + ID *string // Private endpoint connection properties. - Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + Properties *PrivateEndpointConnectionProperties } // PrivateEndpointConnectionListResult - List of private endpoint connections. type PrivateEndpointConnectionListResult struct { // The URL to get the next set of private endpoint connections. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The list of private endpoint connections. - Value []*PrivateEndpointConnection `json:"value,omitempty"` + Value []*PrivateEndpointConnection } // PrivateEndpointConnectionProperties - Properties of the private endpoint connection resource. type PrivateEndpointConnectionProperties struct { // Properties of the private endpoint object. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateEndpoint *PrivateEndpoint // Approval state of the private link connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState // Provisioning state of the private endpoint connection. - ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` -} - -// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete -// method. -type PrivateEndpointConnectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. -type PrivateEndpointConnectionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByResourcePager -// method. -type PrivateEndpointConnectionsClientListByResourceOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientPutOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Put -// method. -type PrivateEndpointConnectionsClientPutOptions struct { - // placeholder for future optional parameters + ProvisioningState *PrivateEndpointConnectionProvisioningState } // PrivateLinkResource - A private link resource type PrivateLinkResource struct { // Resource properties. - Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` + Properties *PrivateLinkResourceProperties // READ-ONLY; Fully qualified identifier of the key vault resource. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Azure location of the key vault resource. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Name of the key vault resource. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Tags assigned to the key vault resource. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type of the key vault resource. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // PrivateLinkResourceListResult - A list of private link resources type PrivateLinkResourceListResult struct { // Array of private link resources - Value []*PrivateLinkResource `json:"value,omitempty"` + Value []*PrivateLinkResource } // PrivateLinkResourceProperties - Properties of a private link resource. type PrivateLinkResourceProperties struct { // Required DNS zone names of the the private link resource. - RequiredZoneNames []*string `json:"requiredZoneNames,omitempty"` + RequiredZoneNames []*string // READ-ONLY; Group identifier of private link resource. - GroupID *string `json:"groupId,omitempty" azure:"ro"` + GroupID *string // READ-ONLY; Required member names of private link resource. - RequiredMembers []*string `json:"requiredMembers,omitempty" azure:"ro"` -} - -// PrivateLinkResourcesClientListByVaultOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByVault -// method. -type PrivateLinkResourcesClientListByVaultOptions struct { - // placeholder for future optional parameters + RequiredMembers []*string } // PrivateLinkServiceConnectionState - An object that represents the approval state of the private link connection. type PrivateLinkServiceConnectionState struct { // A message indicating if changes on the service provider require any updates on the consumer. - ActionsRequired *ActionsRequired `json:"actionsRequired,omitempty"` + ActionsRequired *ActionsRequired // The reason for approval or rejection. - Description *string `json:"description,omitempty"` + Description *string // Indicates whether the connection has been approved, rejected or removed by the key vault owner. - Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` + Status *PrivateEndpointServiceConnectionStatus } // ProxyResourceWithoutSystemData - Common fields that are returned in the response for all Azure Resource Manager resources type ProxyResourceWithoutSystemData struct { // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // Resource - Key Vault resource type Resource struct { // READ-ONLY; Fully qualified identifier of the key vault resource. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Azure location of the key vault resource. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Name of the key vault resource. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Tags assigned to the key vault resource. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type of the key vault resource. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ResourceListResult - List of vault resources. type ResourceListResult struct { // The URL to get the next set of vault resources. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The list of vault resources. - Value []*Resource `json:"value,omitempty"` + Value []*Resource } type RotationPolicy struct { // The attributes of key rotation policy. - Attributes *KeyRotationPolicyAttributes `json:"attributes,omitempty"` + Attributes *KeyRotationPolicyAttributes // The lifetimeActions for key rotation action. - LifetimeActions []*LifetimeAction `json:"lifetimeActions,omitempty"` + LifetimeActions []*LifetimeAction } // SKU details type SKU struct { // REQUIRED; SKU family name - Family *SKUFamily `json:"family,omitempty"` + Family *SKUFamily // REQUIRED; SKU name to specify whether the key vault is a standard vault or a premium vault. - Name *SKUName `json:"name,omitempty"` + Name *SKUName } // Secret - Resource information with extended details. type Secret struct { // REQUIRED; Properties of the secret - Properties *SecretProperties `json:"properties,omitempty"` + Properties *SecretProperties // READ-ONLY; Fully qualified identifier of the key vault resource. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Azure location of the key vault resource. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Name of the key vault resource. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Tags assigned to the key vault resource. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type of the key vault resource. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // SecretAttributes - The secret management attributes. type SecretAttributes struct { // Determines whether the object is enabled. - Enabled *bool `json:"enabled,omitempty"` + Enabled *bool // Expiry date in seconds since 1970-01-01T00:00:00Z. - Expires *time.Time `json:"exp,omitempty"` + Expires *time.Time // Not before date in seconds since 1970-01-01T00:00:00Z. - NotBefore *time.Time `json:"nbf,omitempty"` + NotBefore *time.Time // READ-ONLY; Creation time in seconds since 1970-01-01T00:00:00Z. - Created *time.Time `json:"created,omitempty" azure:"ro"` + Created *time.Time // READ-ONLY; Last updated time in seconds since 1970-01-01T00:00:00Z. - Updated *time.Time `json:"updated,omitempty" azure:"ro"` + Updated *time.Time } // SecretCreateOrUpdateParameters - Parameters for creating or updating a secret type SecretCreateOrUpdateParameters struct { // REQUIRED; Properties of the secret - Properties *SecretProperties `json:"properties,omitempty"` + Properties *SecretProperties // The tags that will be assigned to the secret. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // SecretListResult - List of secrets type SecretListResult struct { // The URL to get the next set of secrets. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The list of secrets. - Value []*Secret `json:"value,omitempty"` + Value []*Secret } // SecretPatchParameters - Parameters for patching a secret type SecretPatchParameters struct { // Properties of the secret - Properties *SecretPatchProperties `json:"properties,omitempty"` + Properties *SecretPatchProperties // The tags that will be assigned to the secret. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // SecretPatchProperties - Properties of the secret type SecretPatchProperties struct { // The attributes of the secret. - Attributes *SecretAttributes `json:"attributes,omitempty"` + Attributes *SecretAttributes // The content type of the secret. - ContentType *string `json:"contentType,omitempty"` + ContentType *string // The value of the secret. - Value *string `json:"value,omitempty"` + Value *string } // SecretProperties - Properties of the secret type SecretProperties struct { // The attributes of the secret. - Attributes *SecretAttributes `json:"attributes,omitempty"` + Attributes *SecretAttributes // The content type of the secret. - ContentType *string `json:"contentType,omitempty"` + ContentType *string // The value of the secret. NOTE: 'value' will never be returned from the service, as APIs using this model are is intended // for internal use in ARM deployments. Users should use the data-plane REST // service for interaction with vault secrets. - Value *string `json:"value,omitempty"` + Value *string // READ-ONLY; The URI to retrieve the current version of the secret. - SecretURI *string `json:"secretUri,omitempty" azure:"ro"` + SecretURI *string // READ-ONLY; The URI to retrieve the specific version of the secret. - SecretURIWithVersion *string `json:"secretUriWithVersion,omitempty" azure:"ro"` -} - -// SecretsClientCreateOrUpdateOptions contains the optional parameters for the SecretsClient.CreateOrUpdate method. -type SecretsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// SecretsClientGetOptions contains the optional parameters for the SecretsClient.Get method. -type SecretsClientGetOptions struct { - // placeholder for future optional parameters -} - -// SecretsClientListOptions contains the optional parameters for the SecretsClient.NewListPager method. -type SecretsClientListOptions struct { - // Maximum number of results to return. - Top *int32 -} - -// SecretsClientUpdateOptions contains the optional parameters for the SecretsClient.Update method. -type SecretsClientUpdateOptions struct { - // placeholder for future optional parameters + SecretURIWithVersion *string } // ServiceSpecification - One property of operation, include log specifications. type ServiceSpecification struct { // Log specifications of operation. - LogSpecifications []*LogSpecification `json:"logSpecifications,omitempty"` + LogSpecifications []*LogSpecification // Metric specifications of operation. - MetricSpecifications []*MetricSpecification `json:"metricSpecifications,omitempty"` + MetricSpecifications []*MetricSpecification } // SystemData - Metadata pertaining to creation and last modification of the key vault resource. type SystemData struct { // The timestamp of the key vault resource creation (UTC). - CreatedAt *time.Time `json:"createdAt,omitempty"` + CreatedAt *time.Time // The identity that created the key vault resource. - CreatedBy *string `json:"createdBy,omitempty"` + CreatedBy *string // The type of identity that created the key vault resource. - CreatedByType *IdentityType `json:"createdByType,omitempty"` + CreatedByType *IdentityType // The timestamp of the key vault resource last modification (UTC). - LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + LastModifiedAt *time.Time // The identity that last modified the key vault resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + LastModifiedBy *string // The type of identity that last modified the key vault resource. - LastModifiedByType *IdentityType `json:"lastModifiedByType,omitempty"` + LastModifiedByType *IdentityType } type Trigger struct { // The time duration after key creation to rotate the key. It only applies to rotate. It will be in ISO 8601 duration format. // Eg: 'P90D', 'P1Y'. - TimeAfterCreate *string `json:"timeAfterCreate,omitempty"` + TimeAfterCreate *string // The time duration before key expiring to rotate or notify. It will be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. - TimeBeforeExpiry *string `json:"timeBeforeExpiry,omitempty"` + TimeBeforeExpiry *string } // Vault - Resource information with extended details. type Vault struct { // REQUIRED; Properties of the vault - Properties *VaultProperties `json:"properties,omitempty"` + Properties *VaultProperties // Azure location of the key vault resource. - Location *string `json:"location,omitempty"` + Location *string // Tags assigned to the key vault resource. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Fully qualified identifier of the key vault resource. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Name of the key vault resource. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; System metadata for the key vault. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; Resource type of the key vault resource. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // VaultAccessPolicyParameters - Parameters for updating the access policy in a vault type VaultAccessPolicyParameters struct { // REQUIRED; Properties of the access policy - Properties *VaultAccessPolicyProperties `json:"properties,omitempty"` + Properties *VaultAccessPolicyProperties // READ-ONLY; The resource id of the access policy. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The resource type of the access policy. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; The resource name of the access policy. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The resource name of the access policy. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // VaultAccessPolicyProperties - Properties of the vault access policy type VaultAccessPolicyProperties struct { // REQUIRED; An array of 0 to 16 identities that have access to the key vault. All identities in the array must use the same // tenant ID as the key vault's tenant ID. - AccessPolicies []*AccessPolicyEntry `json:"accessPolicies,omitempty"` + AccessPolicies []*AccessPolicyEntry } // VaultCheckNameAvailabilityParameters - The parameters used to check the availability of the vault name. type VaultCheckNameAvailabilityParameters struct { // REQUIRED; The vault name. - Name *string `json:"name,omitempty"` + Name *string // 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"` + Type *string } // VaultCreateOrUpdateParameters - Parameters for creating or updating a vault type VaultCreateOrUpdateParameters struct { // REQUIRED; The supported Azure location where the key vault should be created. - Location *string `json:"location,omitempty"` + Location *string // REQUIRED; Properties of the vault - Properties *VaultProperties `json:"properties,omitempty"` + Properties *VaultProperties // The tags that will be assigned to the key vault. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // VaultListResult - List of vaults type VaultListResult struct { // The URL to get the next set of vaults. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The list of vaults. - Value []*Vault `json:"value,omitempty"` + Value []*Vault } // VaultPatchParameters - Parameters for creating or updating a vault type VaultPatchParameters struct { // Properties of the vault - Properties *VaultPatchProperties `json:"properties,omitempty"` + Properties *VaultPatchProperties // The tags that will be assigned to the key vault. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // VaultPatchProperties - Properties of the vault type VaultPatchProperties struct { // An array of 0 to 16 identities that have access to the key vault. All identities in the array must use the same tenant // ID as the key vault's tenant ID. - AccessPolicies []*AccessPolicyEntry `json:"accessPolicies,omitempty"` + AccessPolicies []*AccessPolicyEntry // The vault's create mode to indicate whether the vault need to be recovered or not. - CreateMode *CreateMode `json:"createMode,omitempty"` + CreateMode *CreateMode // Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates // protection against purge for this vault and its content - only the Key Vault // service may initiate a hard, irrecoverable deletion. The setting is effective only if soft delete is also enabled. Enabling // this functionality is irreversible - that is, the property does not accept // false as its value. - EnablePurgeProtection *bool `json:"enablePurgeProtection,omitempty"` + EnablePurgeProtection *bool // 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. 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"` + EnableRbacAuthorization *bool // Property to specify whether the 'soft delete' functionality is enabled for this key vault. Once set to true, it cannot // be reverted to false. - EnableSoftDelete *bool `json:"enableSoftDelete,omitempty"` + EnableSoftDelete *bool // Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key // vault. - EnabledForDeployment *bool `json:"enabledForDeployment,omitempty"` + EnabledForDeployment *bool // Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys. - EnabledForDiskEncryption *bool `json:"enabledForDiskEncryption,omitempty"` + EnabledForDiskEncryption *bool // Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault. - EnabledForTemplateDeployment *bool `json:"enabledForTemplateDeployment,omitempty"` + EnabledForTemplateDeployment *bool // A collection of rules governing the accessibility of the vault from specific network locations. - NetworkACLs *NetworkRuleSet `json:"networkAcls,omitempty"` + NetworkACLs *NetworkRuleSet // Property to specify whether the vault will accept traffic from public internet. If set to 'disabled' all traffic except // private endpoint traffic and that that originates from trusted services will be // blocked. This will override the set firewall rules, meaning that even if the firewall rules are present we will not honor // the rules. - PublicNetworkAccess *string `json:"publicNetworkAccess,omitempty"` + PublicNetworkAccess *string // SKU details - SKU *SKU `json:"sku,omitempty"` + SKU *SKU // softDelete data retention days. It accepts >=7 and <=90. - SoftDeleteRetentionInDays *int32 `json:"softDeleteRetentionInDays,omitempty"` + SoftDeleteRetentionInDays *int32 // The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. - TenantID *string `json:"tenantId,omitempty"` + TenantID *string } // VaultProperties - Properties of the vault type VaultProperties struct { // REQUIRED; SKU details - SKU *SKU `json:"sku,omitempty"` + SKU *SKU // REQUIRED; The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. - TenantID *string `json:"tenantId,omitempty"` + TenantID *string // An array of 0 to 1024 identities that have access to the key vault. All identities in the array must use the same tenant // ID as the key vault's tenant ID. When createMode is set to recover, access // policies are not required. Otherwise, access policies are required. - AccessPolicies []*AccessPolicyEntry `json:"accessPolicies,omitempty"` + AccessPolicies []*AccessPolicyEntry // The vault's create mode to indicate whether the vault need to be recovered or not. - CreateMode *CreateMode `json:"createMode,omitempty"` + CreateMode *CreateMode // Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates // protection against purge for this vault and its content - only the Key Vault // service may initiate a hard, irrecoverable deletion. The setting is effective only if soft delete is also enabled. Enabling // this functionality is irreversible - that is, the property does not accept // false as its value. - EnablePurgeProtection *bool `json:"enablePurgeProtection,omitempty"` + EnablePurgeProtection *bool // 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 @@ -1595,120 +1387,53 @@ type VaultProperties struct { // 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"` + EnableRbacAuthorization *bool // Property to specify whether the 'soft delete' functionality is enabled for this key vault. If it's not set to any value(true // or false) when creating new key vault, it will be set to true by default. // Once set to true, it cannot be reverted to false. - EnableSoftDelete *bool `json:"enableSoftDelete,omitempty"` + EnableSoftDelete *bool // Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key // vault. - EnabledForDeployment *bool `json:"enabledForDeployment,omitempty"` + EnabledForDeployment *bool // Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys. - EnabledForDiskEncryption *bool `json:"enabledForDiskEncryption,omitempty"` + EnabledForDiskEncryption *bool // Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault. - EnabledForTemplateDeployment *bool `json:"enabledForTemplateDeployment,omitempty"` + EnabledForTemplateDeployment *bool // Rules governing the accessibility of the key vault from specific network locations. - NetworkACLs *NetworkRuleSet `json:"networkAcls,omitempty"` + NetworkACLs *NetworkRuleSet // Provisioning state of the vault. - ProvisioningState *VaultProvisioningState `json:"provisioningState,omitempty"` + ProvisioningState *VaultProvisioningState // Property to specify whether the vault will accept traffic from public internet. If set to 'disabled' all traffic except // private endpoint traffic and that that originates from trusted services will be // blocked. This will override the set firewall rules, meaning that even if the firewall rules are present we will not honor // the rules. - PublicNetworkAccess *string `json:"publicNetworkAccess,omitempty"` + PublicNetworkAccess *string // softDelete data retention days. It accepts >=7 and <=90. - SoftDeleteRetentionInDays *int32 `json:"softDeleteRetentionInDays,omitempty"` + SoftDeleteRetentionInDays *int32 // The URI of the vault for performing operations on keys and secrets. - VaultURI *string `json:"vaultUri,omitempty"` + VaultURI *string // READ-ONLY; The resource id of HSM Pool. - HsmPoolResourceID *string `json:"hsmPoolResourceId,omitempty" azure:"ro"` + HsmPoolResourceID *string // READ-ONLY; List of private endpoint connections associated with the key vault. - PrivateEndpointConnections []*PrivateEndpointConnectionItem `json:"privateEndpointConnections,omitempty" azure:"ro"` -} - -// VaultsClientBeginCreateOrUpdateOptions contains the optional parameters for the VaultsClient.BeginCreateOrUpdate method. -type VaultsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VaultsClientBeginPurgeDeletedOptions contains the optional parameters for the VaultsClient.BeginPurgeDeleted method. -type VaultsClientBeginPurgeDeletedOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VaultsClientCheckNameAvailabilityOptions contains the optional parameters for the VaultsClient.CheckNameAvailability method. -type VaultsClientCheckNameAvailabilityOptions struct { - // placeholder for future optional parameters -} - -// VaultsClientDeleteOptions contains the optional parameters for the VaultsClient.Delete method. -type VaultsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// VaultsClientGetDeletedOptions contains the optional parameters for the VaultsClient.GetDeleted method. -type VaultsClientGetDeletedOptions struct { - // placeholder for future optional parameters -} - -// VaultsClientGetOptions contains the optional parameters for the VaultsClient.Get method. -type VaultsClientGetOptions struct { - // placeholder for future optional parameters -} - -// VaultsClientListByResourceGroupOptions contains the optional parameters for the VaultsClient.NewListByResourceGroupPager -// method. -type VaultsClientListByResourceGroupOptions struct { - // Maximum number of results to return. - Top *int32 -} - -// VaultsClientListBySubscriptionOptions contains the optional parameters for the VaultsClient.NewListBySubscriptionPager -// method. -type VaultsClientListBySubscriptionOptions struct { - // Maximum number of results to return. - Top *int32 -} - -// VaultsClientListDeletedOptions contains the optional parameters for the VaultsClient.NewListDeletedPager method. -type VaultsClientListDeletedOptions struct { - // placeholder for future optional parameters -} - -// VaultsClientListOptions contains the optional parameters for the VaultsClient.NewListPager method. -type VaultsClientListOptions struct { - // Maximum number of results to return. - Top *int32 -} - -// VaultsClientUpdateAccessPolicyOptions contains the optional parameters for the VaultsClient.UpdateAccessPolicy method. -type VaultsClientUpdateAccessPolicyOptions struct { - // placeholder for future optional parameters -} - -// VaultsClientUpdateOptions contains the optional parameters for the VaultsClient.Update method. -type VaultsClientUpdateOptions struct { - // placeholder for future optional parameters + PrivateEndpointConnections []*PrivateEndpointConnectionItem } // VirtualNetworkRule - A rule governing the accessibility of a vault from a specific virtual network. type VirtualNetworkRule struct { // REQUIRED; Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - ID *string `json:"id,omitempty"` + ID *string // Property to specify whether NRP will ignore the check if parent subnet has serviceEndpoints configured. - IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` + IgnoreMissingVnetServiceEndpoint *bool } diff --git a/sdk/resourcemanager/keyvault/armkeyvault/models_serde.go b/sdk/resourcemanager/keyvault/armkeyvault/models_serde.go index 7f7a5e10c31d..9dc9c7104808 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/models_serde.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault diff --git a/sdk/resourcemanager/keyvault/armkeyvault/operations_client.go b/sdk/resourcemanager/keyvault/armkeyvault/operations_client.go index 3b7216f1d5bd..2aa70db8392e 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/operations_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/operations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault diff --git a/sdk/resourcemanager/keyvault/armkeyvault/operations_client_example_test.go b/sdk/resourcemanager/keyvault/armkeyvault/operations_client_example_test.go deleted file mode 100644 index fa6c9b0495b4..000000000000 --- a/sdk/resourcemanager/keyvault/armkeyvault/operations_client_example_test.go +++ /dev/null @@ -1,361 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armkeyvault.OperationListResult{ - // Value: []*armkeyvault.Operation{ - // { - // Name: to.Ptr("Microsoft.KeyVault/vaults/read"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("View the properties of a key vault"), - // Operation: to.Ptr("View Key Vault"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Key Vault"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/vaults/write"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("Create a new key vault or update the properties of an existing key vault"), - // Operation: to.Ptr("Update Key Vault"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Key Vault"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/vaults/delete"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("Delete a key vault"), - // Operation: to.Ptr("Delete Key Vault"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Key Vault"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/vaults/deploy/action"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("Enables access to secrets in a key vault when deploying Azure resources"), - // Operation: to.Ptr("Use Vault for Azure Deployments"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Key Vault"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/vaults/secrets/read"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("View the properties of a secret, but not its value"), - // Operation: to.Ptr("View Secret Properties"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Secret"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/vaults/secrets/write"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("Create a new secret or update the value of an existing secret"), - // Operation: to.Ptr("Update Secret"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Secret"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/vaults/accessPolicies/write"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("Update an existing access policy by merging or replacing, or add a new access policy to a vault."), - // Operation: to.Ptr("Update Access Policy"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Access Policy"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/vaults/providers/Microsoft.Insights/logDefinitions/read"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("Gets the available logs for a key vault"), - // Operation: to.Ptr("Read log definition"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Key Vault Log Definition"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("system"), - // OperationProperties: &armkeyvault.OperationProperties{ - // ServiceSpecification: &armkeyvault.ServiceSpecification{ - // LogSpecifications: []*armkeyvault.LogSpecification{ - // { - // Name: to.Ptr("AuditEvent"), - // BlobDuration: to.Ptr("PT1H"), - // DisplayName: to.Ptr("Audit Logs"), - // }}, - // MetricSpecifications: []*armkeyvault.MetricSpecification{ - // { - // Name: to.Ptr("ServiceApiHit"), - // AggregationType: to.Ptr(""), - // Dimensions: []*armkeyvault.DimensionProperties{ - // { - // Name: to.Ptr("ActivityType"), - // DisplayName: to.Ptr(""), - // ToBeExportedForShoebox: to.Ptr(true), - // }, - // { - // Name: to.Ptr("ActivityName"), - // DisplayName: to.Ptr(""), - // ToBeExportedForShoebox: to.Ptr(true), - // }}, - // DisplayDescription: to.Ptr(""), - // DisplayName: to.Ptr(""), - // FillGapWithZero: to.Ptr(false), - // InternalMetricName: to.Ptr("AuditEvent"), - // LockAggregationType: to.Ptr(""), - // SupportedAggregationTypes: []*string{ - // to.Ptr("")}, - // SupportedTimeGrainTypes: []*string{ - // to.Ptr("")}, - // Unit: to.Ptr(""), - // }}, - // }, - // }, - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/vaults/providers/Microsoft.Insights/diagnosticSettings/Read"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("Gets the diagnostic setting for the resource"), - // Operation: to.Ptr("Read diagnostic setting"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Key Vault Diagnostic Settings"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("system"), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/vaults/providers/Microsoft.Insights/diagnosticSettings/Write"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("Creates or updates the diagnostic setting for the resource"), - // Operation: to.Ptr("Write diagnostic setting"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Key Vault Diagnostic Settings"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("system"), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/register/action"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("Registers a subscription"), - // Operation: to.Ptr("Register Subscription"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Subscription"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/unregister/action"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("Unregisters a subscription"), - // Operation: to.Ptr("Unregister Subscription"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Subscription"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/operations/read"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("Lists operations available on Microsoft.KeyVault resource provider"), - // Operation: to.Ptr("Available Key Vault Operations"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Operations"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/checkNameAvailability/read"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("Checks that a key vault name is valid and is not in use"), - // Operation: to.Ptr("Check Name Availability"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Name Availability"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/deletedVaults/read"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("View the properties of soft deleted key vaults"), - // Operation: to.Ptr("View Soft Deleted Vaults"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Soft Deleted Key Vault"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/locations/deletedVaults/read"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("View the properties of a soft deleted key vault"), - // Operation: to.Ptr("View Soft Deleted Key Vault"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Soft Deleted Key Vault"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/locations/deletedVaults/purge/action"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("Purge a soft deleted key vault"), - // Operation: to.Ptr("Purge Soft Deleted Key Vault"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Soft Deleted Key Vault"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/locations/operationResults/read"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("Check the result of a long run operation"), - // Operation: to.Ptr("Check Operation Result"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Long Run Operation Result"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/hsmPools/read"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("View the properties of an HSM pool"), - // Operation: to.Ptr("View HSM pool"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("HSM pool"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/hsmPools/write"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("Create a new HSM pool of update the properties of an existing HSM pool"), - // Operation: to.Ptr("Create or Update HSM pool"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("HSM pool"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/hsmPools/delete"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("Delete an HSM pool"), - // Operation: to.Ptr("Delete HSM pool"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("HSM pool"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/hsmPools/joinVault/action"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("Join a key vault to an HSM pool"), - // Operation: to.Ptr("Join KeyVault to HSM pool"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("HSM pool"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/managedHSMs/read"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("View the properties of a Managed HSM"), - // Operation: to.Ptr("View Managed HSM"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Managed HSM"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/managedHSMs/write"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("Create a new Managed HSM of update the properties of an existing Managed HSM"), - // Operation: to.Ptr("Create or Update Managed HSM"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Managed HSM"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/managedHSMs/delete"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("Delete a Managed HSM"), - // Operation: to.Ptr("Delete Managed HSM"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Managed HSM"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/vaults/providers/Microsoft.Insights/metricDefinitions/read"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("Gets the available metrics for a key vault"), - // Operation: to.Ptr("Read metric definition"), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Key Vault Metric Definition"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("system"), - // OperationProperties: &armkeyvault.OperationProperties{ - // ServiceSpecification: &armkeyvault.ServiceSpecification{ - // }, - // }, - // }, - // { - // Name: to.Ptr("Microsoft.KeyVault/locations/deleteVirtualNetworkOrSubnets/action"), - // Display: &armkeyvault.OperationDisplay{ - // Description: to.Ptr("Notifies Microsoft.KeyVault that a virtual network or subnet is being deleted"), - // Operation: to.Ptr("Modify Network ACLs containing the deleted Vitual Network or Subnet "), - // Provider: to.Ptr("Microsoft Key Vault"), - // Resource: to.Ptr("Location"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("system"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/options.go b/sdk/resourcemanager/keyvault/armkeyvault/options.go new file mode 100644 index 000000000000..0f351542402a --- /dev/null +++ b/sdk/resourcemanager/keyvault/armkeyvault/options.go @@ -0,0 +1,283 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armkeyvault + +// KeysClientCreateIfNotExistOptions contains the optional parameters for the KeysClient.CreateIfNotExist method. +type KeysClientCreateIfNotExistOptions struct { + // placeholder for future optional parameters +} + +// KeysClientGetOptions contains the optional parameters for the KeysClient.Get method. +type KeysClientGetOptions struct { + // placeholder for future optional parameters +} + +// KeysClientGetVersionOptions contains the optional parameters for the KeysClient.GetVersion method. +type KeysClientGetVersionOptions struct { + // placeholder for future optional parameters +} + +// KeysClientListOptions contains the optional parameters for the KeysClient.NewListPager method. +type KeysClientListOptions struct { + // placeholder for future optional parameters +} + +// KeysClientListVersionsOptions contains the optional parameters for the KeysClient.NewListVersionsPager method. +type KeysClientListVersionsOptions struct { + // placeholder for future optional parameters +} + +// MHSMPrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.BeginDelete +// method. +type MHSMPrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MHSMPrivateEndpointConnectionsClientGetOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.Get +// method. +type MHSMPrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// MHSMPrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.NewListByResourcePager +// method. +type MHSMPrivateEndpointConnectionsClientListByResourceOptions struct { + // placeholder for future optional parameters +} + +// MHSMPrivateEndpointConnectionsClientPutOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.Put +// method. +type MHSMPrivateEndpointConnectionsClientPutOptions struct { + // placeholder for future optional parameters +} + +// MHSMPrivateLinkResourcesClientListByMHSMResourceOptions contains the optional parameters for the MHSMPrivateLinkResourcesClient.ListByMHSMResource +// method. +type MHSMPrivateLinkResourcesClientListByMHSMResourceOptions struct { + // placeholder for future optional parameters +} + +// MHSMRegionsClientListByResourceOptions contains the optional parameters for the MHSMRegionsClient.NewListByResourcePager +// method. +type MHSMRegionsClientListByResourceOptions struct { + // placeholder for future optional parameters +} + +// ManagedHsmKeysClientCreateIfNotExistOptions contains the optional parameters for the ManagedHsmKeysClient.CreateIfNotExist +// method. +type ManagedHsmKeysClientCreateIfNotExistOptions struct { + // placeholder for future optional parameters +} + +// ManagedHsmKeysClientGetOptions contains the optional parameters for the ManagedHsmKeysClient.Get method. +type ManagedHsmKeysClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedHsmKeysClientGetVersionOptions contains the optional parameters for the ManagedHsmKeysClient.GetVersion method. +type ManagedHsmKeysClientGetVersionOptions struct { + // placeholder for future optional parameters +} + +// ManagedHsmKeysClientListOptions contains the optional parameters for the ManagedHsmKeysClient.NewListPager method. +type ManagedHsmKeysClientListOptions struct { + // placeholder for future optional parameters +} + +// ManagedHsmKeysClientListVersionsOptions contains the optional parameters for the ManagedHsmKeysClient.NewListVersionsPager +// method. +type ManagedHsmKeysClientListVersionsOptions struct { + // placeholder for future optional parameters +} + +// ManagedHsmsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedHsmsClient.BeginCreateOrUpdate +// method. +type ManagedHsmsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedHsmsClientBeginDeleteOptions contains the optional parameters for the ManagedHsmsClient.BeginDelete method. +type ManagedHsmsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedHsmsClientBeginPurgeDeletedOptions contains the optional parameters for the ManagedHsmsClient.BeginPurgeDeleted +// method. +type ManagedHsmsClientBeginPurgeDeletedOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedHsmsClientBeginUpdateOptions contains the optional parameters for the ManagedHsmsClient.BeginUpdate method. +type ManagedHsmsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + 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 +} + +// ManagedHsmsClientGetOptions contains the optional parameters for the ManagedHsmsClient.Get method. +type ManagedHsmsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedHsmsClientListByResourceGroupOptions contains the optional parameters for the ManagedHsmsClient.NewListByResourceGroupPager +// method. +type ManagedHsmsClientListByResourceGroupOptions struct { + // Maximum number of results to return. + Top *int32 +} + +// ManagedHsmsClientListBySubscriptionOptions contains the optional parameters for the ManagedHsmsClient.NewListBySubscriptionPager +// method. +type ManagedHsmsClientListBySubscriptionOptions struct { + // Maximum number of results to return. + Top *int32 +} + +// ManagedHsmsClientListDeletedOptions contains the optional parameters for the ManagedHsmsClient.NewListDeletedPager method. +type ManagedHsmsClientListDeletedOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +type PrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByResourcePager +// method. +type PrivateEndpointConnectionsClientListByResourceOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientPutOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Put +// method. +type PrivateEndpointConnectionsClientPutOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListByVaultOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByVault +// method. +type PrivateLinkResourcesClientListByVaultOptions struct { + // placeholder for future optional parameters +} + +// SecretsClientCreateOrUpdateOptions contains the optional parameters for the SecretsClient.CreateOrUpdate method. +type SecretsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// SecretsClientGetOptions contains the optional parameters for the SecretsClient.Get method. +type SecretsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SecretsClientListOptions contains the optional parameters for the SecretsClient.NewListPager method. +type SecretsClientListOptions struct { + // Maximum number of results to return. + Top *int32 +} + +// SecretsClientUpdateOptions contains the optional parameters for the SecretsClient.Update method. +type SecretsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// VaultsClientBeginCreateOrUpdateOptions contains the optional parameters for the VaultsClient.BeginCreateOrUpdate method. +type VaultsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VaultsClientBeginPurgeDeletedOptions contains the optional parameters for the VaultsClient.BeginPurgeDeleted method. +type VaultsClientBeginPurgeDeletedOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VaultsClientCheckNameAvailabilityOptions contains the optional parameters for the VaultsClient.CheckNameAvailability method. +type VaultsClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// VaultsClientDeleteOptions contains the optional parameters for the VaultsClient.Delete method. +type VaultsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// VaultsClientGetDeletedOptions contains the optional parameters for the VaultsClient.GetDeleted method. +type VaultsClientGetDeletedOptions struct { + // placeholder for future optional parameters +} + +// VaultsClientGetOptions contains the optional parameters for the VaultsClient.Get method. +type VaultsClientGetOptions struct { + // placeholder for future optional parameters +} + +// VaultsClientListByResourceGroupOptions contains the optional parameters for the VaultsClient.NewListByResourceGroupPager +// method. +type VaultsClientListByResourceGroupOptions struct { + // Maximum number of results to return. + Top *int32 +} + +// VaultsClientListBySubscriptionOptions contains the optional parameters for the VaultsClient.NewListBySubscriptionPager +// method. +type VaultsClientListBySubscriptionOptions struct { + // Maximum number of results to return. + Top *int32 +} + +// VaultsClientListDeletedOptions contains the optional parameters for the VaultsClient.NewListDeletedPager method. +type VaultsClientListDeletedOptions struct { + // placeholder for future optional parameters +} + +// VaultsClientListOptions contains the optional parameters for the VaultsClient.NewListPager method. +type VaultsClientListOptions struct { + // Maximum number of results to return. + Top *int32 +} + +// VaultsClientUpdateAccessPolicyOptions contains the optional parameters for the VaultsClient.UpdateAccessPolicy method. +type VaultsClientUpdateAccessPolicyOptions struct { + // placeholder for future optional parameters +} + +// VaultsClientUpdateOptions contains the optional parameters for the VaultsClient.Update method. +type VaultsClientUpdateOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/privateendpointconnections_client.go b/sdk/resourcemanager/keyvault/armkeyvault/privateendpointconnections_client.go index 5d48db74b8b7..0458c17bf5db 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/privateendpointconnections_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/privateendpointconnections_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -61,7 +60,8 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -72,18 +72,20 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // // Generated from API version 2023-02-01 func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, vaultName, privateEndpointConnectionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -126,18 +128,21 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get // method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return PrivateEndpointConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -261,18 +266,21 @@ func (client *PrivateEndpointConnectionsClient) listByResourceHandleResponse(res // - options - PrivateEndpointConnectionsClientPutOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Put // method. func (client *PrivateEndpointConnectionsClient) Put(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsClientPutOptions) (PrivateEndpointConnectionsClientPutResponse, error) { + var err error req, err := client.putCreateRequest(ctx, resourceGroupName, vaultName, privateEndpointConnectionName, properties, options) if err != nil { return PrivateEndpointConnectionsClientPutResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientPutResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientPutResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientPutResponse{}, err } - return client.putHandleResponse(resp) + resp, err := client.putHandleResponse(httpResp) + return resp, err } // putCreateRequest creates the Put request. @@ -302,12 +310,18 @@ func (client *PrivateEndpointConnectionsClient) putCreateRequest(ctx context.Con reqQP.Set("api-version", "2023-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, properties) + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil } // putHandleResponse handles the Put response. func (client *PrivateEndpointConnectionsClient) putHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientPutResponse, error) { result := PrivateEndpointConnectionsClientPutResponse{} + if val := resp.Header.Get("Azure-AsyncOperation"); val != "" { + result.AzureAsyncOperation = &val + } if val := resp.Header.Get("Retry-After"); val != "" { retryAfter32, err := strconv.ParseInt(val, 10, 32) retryAfter := int32(retryAfter32) @@ -316,9 +330,6 @@ func (client *PrivateEndpointConnectionsClient) putHandleResponse(resp *http.Res } result.RetryAfter = &retryAfter } - if val := resp.Header.Get("Azure-AsyncOperation"); val != "" { - result.AzureAsyncOperation = &val - } if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { return PrivateEndpointConnectionsClientPutResponse{}, err } diff --git a/sdk/resourcemanager/keyvault/armkeyvault/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/keyvault/armkeyvault/privateendpointconnections_client_example_test.go deleted file mode 100644 index 5a7d862e35dd..000000000000 --- a/sdk/resourcemanager/keyvault/armkeyvault/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,195 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "sample-group", "sample-vault", "sample-pec", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armkeyvault.PrivateEndpointConnection{ - // Name: to.Ptr("sample-pec"), - // Type: to.Ptr("Microsoft.KeyVault/vaults/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/privateEndpointConnections/sample-pec"), - // Etag: to.Ptr(""), - // Properties: &armkeyvault.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armkeyvault.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-1234-000000000000/resourceGroups/sample-group/providers/Microsoft.Network/privateEndpoints/sample-pe"), - // }, - // PrivateLinkServiceConnectionState: &armkeyvault.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("This was automatically approved by user1234@contoso.com"), - // ActionsRequired: to.Ptr(armkeyvault.ActionsRequiredNone), - // Status: to.Ptr(armkeyvault.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armkeyvault.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armkeyvault.PrivateEndpointConnection{ - // Name: to.Ptr("sample-pec"), - // Type: to.Ptr("Microsoft.KeyVault/vaults/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/privateEndpointConnections/sample-pec"), - // Etag: to.Ptr(""), - // Properties: &armkeyvault.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armkeyvault.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-1234-000000000000/resourceGroups/sample-group/providers/Microsoft.Network/privateEndpoints/sample-pe"), - // }, - // PrivateLinkServiceConnectionState: &armkeyvault.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("My name is Joe and I'm approving this."), - // ActionsRequired: to.Ptr(armkeyvault.ActionsRequiredNone), - // Status: to.Ptr(armkeyvault.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armkeyvault.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armkeyvault.PrivateEndpointConnection{ - // Name: to.Ptr("sample-pec"), - // Type: to.Ptr("Microsoft.KeyVault/vaults/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/privateEndpointConnections/sample-pec"), - // Properties: &armkeyvault.PrivateEndpointConnectionProperties{ - // ProvisioningState: to.Ptr(armkeyvault.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListByResourcePager("sample-group", "sample-vault", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateEndpointConnectionListResult = armkeyvault.PrivateEndpointConnectionListResult{ - // Value: []*armkeyvault.PrivateEndpointConnection{ - // { - // Name: to.Ptr("sample-pec"), - // Type: to.Ptr("Microsoft.KeyVault/vaults/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/privateEndpointConnections/sample-pec"), - // Etag: to.Ptr(""), - // Properties: &armkeyvault.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armkeyvault.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-1234-000000000000/resourceGroups/sample-group/providers/Microsoft.Network/privateEndpoints/sample-pe"), - // }, - // PrivateLinkServiceConnectionState: &armkeyvault.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("This was automatically approved by user1234@contoso.com"), - // ActionsRequired: to.Ptr(armkeyvault.ActionsRequiredNone), - // Status: to.Ptr(armkeyvault.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armkeyvault.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("sample-pec"), - // Type: to.Ptr("Microsoft.KeyVault/vaults/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/privateEndpointConnections/sample-pec"), - // Etag: to.Ptr(""), - // Properties: &armkeyvault.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armkeyvault.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-1234-000000000000/resourceGroups/sample-group/providers/Microsoft.Network/privateEndpoints/sample-pe"), - // }, - // PrivateLinkServiceConnectionState: &armkeyvault.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("This was automatically approved by user1234@contoso.com"), - // ActionsRequired: to.Ptr(armkeyvault.ActionsRequiredNone), - // Status: to.Ptr(armkeyvault.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armkeyvault.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/privatelinkresources_client.go b/sdk/resourcemanager/keyvault/armkeyvault/privatelinkresources_client.go index 731c8aa545de..7d886e53fbd6 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/privatelinkresources_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/privatelinkresources_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -54,18 +53,21 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // - options - PrivateLinkResourcesClientListByVaultOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByVault // method. func (client *PrivateLinkResourcesClient) ListByVault(ctx context.Context, resourceGroupName string, vaultName string, options *PrivateLinkResourcesClientListByVaultOptions) (PrivateLinkResourcesClientListByVaultResponse, error) { + var err error req, err := client.listByVaultCreateRequest(ctx, resourceGroupName, vaultName, options) if err != nil { return PrivateLinkResourcesClientListByVaultResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkResourcesClientListByVaultResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateLinkResourcesClientListByVaultResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkResourcesClientListByVaultResponse{}, err } - return client.listByVaultHandleResponse(resp) + resp, err := client.listByVaultHandleResponse(httpResp) + return resp, err } // listByVaultCreateRequest creates the ListByVault request. diff --git a/sdk/resourcemanager/keyvault/armkeyvault/privatelinkresources_client_example_test.go b/sdk/resourcemanager/keyvault/armkeyvault/privatelinkresources_client_example_test.go deleted file mode 100644 index 25bb06d79c95..000000000000 --- a/sdk/resourcemanager/keyvault/armkeyvault/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,53 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().ListByVault(ctx, "sample-group", "sample-vault", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResourceListResult = armkeyvault.PrivateLinkResourceListResult{ - // Value: []*armkeyvault.PrivateLinkResource{ - // { - // Name: to.Ptr("vault"), - // Type: to.Ptr("Microsoft.KeyVault/vaults/privateLinkResources"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-resource-group/providers/Microsoft.KeyVault/vaults/sample-vault/privateLinkResources/vault"), - // Properties: &armkeyvault.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("vault"), - // RequiredMembers: []*string{ - // to.Ptr("default")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.vaultcore.azure.net")}, - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/response_types.go b/sdk/resourcemanager/keyvault/armkeyvault/response_types.go index a1fd185c6524..efeaaf1c7d17 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/response_types.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/response_types.go @@ -3,55 +3,64 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault // KeysClientCreateIfNotExistResponse contains the response from method KeysClient.CreateIfNotExist. type KeysClientCreateIfNotExistResponse struct { + // The key resource. Key } // KeysClientGetResponse contains the response from method KeysClient.Get. type KeysClientGetResponse struct { + // The key resource. Key } // KeysClientGetVersionResponse contains the response from method KeysClient.GetVersion. type KeysClientGetVersionResponse struct { + // The key resource. Key } // KeysClientListResponse contains the response from method KeysClient.NewListPager. type KeysClientListResponse struct { + // The page of keys. KeyListResult } // KeysClientListVersionsResponse contains the response from method KeysClient.NewListVersionsPager. type KeysClientListVersionsResponse struct { + // The page of keys. KeyListResult } // MHSMPrivateEndpointConnectionsClientDeleteResponse contains the response from method MHSMPrivateEndpointConnectionsClient.BeginDelete. type MHSMPrivateEndpointConnectionsClientDeleteResponse struct { + // Private endpoint connection resource. MHSMPrivateEndpointConnection } // MHSMPrivateEndpointConnectionsClientGetResponse contains the response from method MHSMPrivateEndpointConnectionsClient.Get. type MHSMPrivateEndpointConnectionsClientGetResponse struct { + // Private endpoint connection resource. MHSMPrivateEndpointConnection } // MHSMPrivateEndpointConnectionsClientListByResourceResponse contains the response from method MHSMPrivateEndpointConnectionsClient.NewListByResourcePager. type MHSMPrivateEndpointConnectionsClientListByResourceResponse struct { + // List of private endpoint connections associated with a managed HSM Pools MHSMPrivateEndpointConnectionsListResult } // MHSMPrivateEndpointConnectionsClientPutResponse contains the response from method MHSMPrivateEndpointConnectionsClient.Put. type MHSMPrivateEndpointConnectionsClientPutResponse struct { + // Private endpoint connection resource. MHSMPrivateEndpointConnection + // AzureAsyncOperation contains the information returned from the Azure-AsyncOperation header response. AzureAsyncOperation *string @@ -61,46 +70,55 @@ type MHSMPrivateEndpointConnectionsClientPutResponse struct { // MHSMPrivateLinkResourcesClientListByMHSMResourceResponse contains the response from method MHSMPrivateLinkResourcesClient.ListByMHSMResource. type MHSMPrivateLinkResourcesClientListByMHSMResourceResponse struct { + // A list of private link resources MHSMPrivateLinkResourceListResult } // MHSMRegionsClientListByResourceResponse contains the response from method MHSMRegionsClient.NewListByResourcePager. type MHSMRegionsClientListByResourceResponse struct { + // List of regions associated with a managed HSM Pools MHSMRegionsListResult } // ManagedHsmKeysClientCreateIfNotExistResponse contains the response from method ManagedHsmKeysClient.CreateIfNotExist. type ManagedHsmKeysClientCreateIfNotExistResponse struct { + // The key resource. ManagedHsmKey } // ManagedHsmKeysClientGetResponse contains the response from method ManagedHsmKeysClient.Get. type ManagedHsmKeysClientGetResponse struct { + // The key resource. ManagedHsmKey } // ManagedHsmKeysClientGetVersionResponse contains the response from method ManagedHsmKeysClient.GetVersion. type ManagedHsmKeysClientGetVersionResponse struct { + // The key resource. ManagedHsmKey } // ManagedHsmKeysClientListResponse contains the response from method ManagedHsmKeysClient.NewListPager. type ManagedHsmKeysClientListResponse struct { + // The page of keys. ManagedHsmKeyListResult } // ManagedHsmKeysClientListVersionsResponse contains the response from method ManagedHsmKeysClient.NewListVersionsPager. type ManagedHsmKeysClientListVersionsResponse struct { + // The page of keys. ManagedHsmKeyListResult } // ManagedHsmsClientCheckMhsmNameAvailabilityResponse contains the response from method ManagedHsmsClient.CheckMhsmNameAvailability. type ManagedHsmsClientCheckMhsmNameAvailabilityResponse struct { + // The CheckMhsmNameAvailability operation response. CheckMhsmNameAvailabilityResult } // ManagedHsmsClientCreateOrUpdateResponse contains the response from method ManagedHsmsClient.BeginCreateOrUpdate. type ManagedHsmsClientCreateOrUpdateResponse struct { + // Resource information with extended details. ManagedHsm } @@ -116,21 +134,25 @@ type ManagedHsmsClientGetDeletedResponse struct { // ManagedHsmsClientGetResponse contains the response from method ManagedHsmsClient.Get. type ManagedHsmsClientGetResponse struct { + // Resource information with extended details. ManagedHsm } // ManagedHsmsClientListByResourceGroupResponse contains the response from method ManagedHsmsClient.NewListByResourceGroupPager. type ManagedHsmsClientListByResourceGroupResponse struct { + // List of managed HSM Pools ManagedHsmListResult } // ManagedHsmsClientListBySubscriptionResponse contains the response from method ManagedHsmsClient.NewListBySubscriptionPager. type ManagedHsmsClientListBySubscriptionResponse struct { + // List of managed HSM Pools ManagedHsmListResult } // ManagedHsmsClientListDeletedResponse contains the response from method ManagedHsmsClient.NewListDeletedPager. type ManagedHsmsClientListDeletedResponse struct { + // List of deleted managed HSM Pools DeletedManagedHsmListResult } @@ -141,32 +163,40 @@ type ManagedHsmsClientPurgeDeletedResponse struct { // ManagedHsmsClientUpdateResponse contains the response from method ManagedHsmsClient.BeginUpdate. type ManagedHsmsClientUpdateResponse struct { + // Resource information with extended details. ManagedHsm } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of + // results. OperationListResult } // PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. type PrivateEndpointConnectionsClientDeleteResponse struct { + // Private endpoint connection resource. PrivateEndpointConnection } // PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. type PrivateEndpointConnectionsClientGetResponse struct { + // Private endpoint connection resource. PrivateEndpointConnection } // PrivateEndpointConnectionsClientListByResourceResponse contains the response from method PrivateEndpointConnectionsClient.NewListByResourcePager. type PrivateEndpointConnectionsClientListByResourceResponse struct { + // List of private endpoint connections. PrivateEndpointConnectionListResult } // PrivateEndpointConnectionsClientPutResponse contains the response from method PrivateEndpointConnectionsClient.Put. type PrivateEndpointConnectionsClientPutResponse struct { + // Private endpoint connection resource. PrivateEndpointConnection + // AzureAsyncOperation contains the information returned from the Azure-AsyncOperation header response. AzureAsyncOperation *string @@ -176,36 +206,43 @@ type PrivateEndpointConnectionsClientPutResponse struct { // PrivateLinkResourcesClientListByVaultResponse contains the response from method PrivateLinkResourcesClient.ListByVault. type PrivateLinkResourcesClientListByVaultResponse struct { + // A list of private link resources PrivateLinkResourceListResult } // SecretsClientCreateOrUpdateResponse contains the response from method SecretsClient.CreateOrUpdate. type SecretsClientCreateOrUpdateResponse struct { + // Resource information with extended details. Secret } // SecretsClientGetResponse contains the response from method SecretsClient.Get. type SecretsClientGetResponse struct { + // Resource information with extended details. Secret } // SecretsClientListResponse contains the response from method SecretsClient.NewListPager. type SecretsClientListResponse struct { + // List of secrets SecretListResult } // SecretsClientUpdateResponse contains the response from method SecretsClient.Update. type SecretsClientUpdateResponse struct { + // Resource information with extended details. Secret } // VaultsClientCheckNameAvailabilityResponse contains the response from method VaultsClient.CheckNameAvailability. type VaultsClientCheckNameAvailabilityResponse struct { + // The CheckNameAvailability operation response. CheckNameAvailabilityResult } // VaultsClientCreateOrUpdateResponse contains the response from method VaultsClient.BeginCreateOrUpdate. type VaultsClientCreateOrUpdateResponse struct { + // Resource information with extended details. Vault } @@ -216,31 +253,37 @@ type VaultsClientDeleteResponse struct { // VaultsClientGetDeletedResponse contains the response from method VaultsClient.GetDeleted. type VaultsClientGetDeletedResponse struct { + // Deleted vault information with extended details. DeletedVault } // VaultsClientGetResponse contains the response from method VaultsClient.Get. type VaultsClientGetResponse struct { + // Resource information with extended details. Vault } // VaultsClientListByResourceGroupResponse contains the response from method VaultsClient.NewListByResourceGroupPager. type VaultsClientListByResourceGroupResponse struct { + // List of vaults VaultListResult } // VaultsClientListBySubscriptionResponse contains the response from method VaultsClient.NewListBySubscriptionPager. type VaultsClientListBySubscriptionResponse struct { + // List of vaults VaultListResult } // VaultsClientListDeletedResponse contains the response from method VaultsClient.NewListDeletedPager. type VaultsClientListDeletedResponse struct { + // List of vaults DeletedVaultListResult } // VaultsClientListResponse contains the response from method VaultsClient.NewListPager. type VaultsClientListResponse struct { + // List of vault resources. ResourceListResult } @@ -251,10 +294,12 @@ type VaultsClientPurgeDeletedResponse struct { // VaultsClientUpdateAccessPolicyResponse contains the response from method VaultsClient.UpdateAccessPolicy. type VaultsClientUpdateAccessPolicyResponse struct { + // Parameters for updating the access policy in a vault VaultAccessPolicyParameters } // VaultsClientUpdateResponse contains the response from method VaultsClient.Update. type VaultsClientUpdateResponse struct { + // Resource information with extended details. Vault } diff --git a/sdk/resourcemanager/keyvault/armkeyvault/secrets_client.go b/sdk/resourcemanager/keyvault/armkeyvault/secrets_client.go index cf43971e133b..053e2af29007 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/secrets_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/secrets_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -59,18 +58,21 @@ func NewSecretsClient(subscriptionID string, credential azcore.TokenCredential, // - parameters - Parameters to create or update the secret // - options - SecretsClientCreateOrUpdateOptions contains the optional parameters for the SecretsClient.CreateOrUpdate method. func (client *SecretsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, secretName string, parameters SecretCreateOrUpdateParameters, options *SecretsClientCreateOrUpdateOptions) (SecretsClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vaultName, secretName, parameters, options) if err != nil { return SecretsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SecretsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return SecretsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SecretsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -100,7 +102,10 @@ func (client *SecretsClient) createOrUpdateCreateRequest(ctx context.Context, re reqQP.Set("api-version", "2023-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -122,18 +127,21 @@ func (client *SecretsClient) createOrUpdateHandleResponse(resp *http.Response) ( // - secretName - The name of the secret. // - options - SecretsClientGetOptions contains the optional parameters for the SecretsClient.Get method. func (client *SecretsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, secretName string, options *SecretsClientGetOptions) (SecretsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, secretName, options) if err != nil { return SecretsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SecretsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SecretsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SecretsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -260,18 +268,21 @@ func (client *SecretsClient) listHandleResponse(resp *http.Response) (SecretsCli // - parameters - Parameters to patch the secret // - options - SecretsClientUpdateOptions contains the optional parameters for the SecretsClient.Update method. func (client *SecretsClient) Update(ctx context.Context, resourceGroupName string, vaultName string, secretName string, parameters SecretPatchParameters, options *SecretsClientUpdateOptions) (SecretsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, vaultName, secretName, parameters, options) if err != nil { return SecretsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SecretsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return SecretsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SecretsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -301,7 +312,10 @@ func (client *SecretsClient) updateCreateRequest(ctx context.Context, resourceGr reqQP.Set("api-version", "2023-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/keyvault/armkeyvault/secrets_client_example_test.go b/sdk/resourcemanager/keyvault/armkeyvault/secrets_client_example_test.go deleted file mode 100644 index 3407eb28e6db..000000000000 --- a/sdk/resourcemanager/keyvault/armkeyvault/secrets_client_example_test.go +++ /dev/null @@ -1,190 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSecretsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Secret = armkeyvault.Secret{ - // Name: to.Ptr("secret-name"), - // Type: to.Ptr("Microsoft.KeyVault/vaults/secrets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/secrets/secret-name"), - // Location: to.Ptr("westus"), - // Properties: &armkeyvault.SecretProperties{ - // Attributes: &armkeyvault.SecretAttributes{ - // Created: to.Ptr(time.Unix(1514938738, 0)), - // Enabled: to.Ptr(true), - // Updated: to.Ptr(time.Unix(1514938738, 0)), - // }, - // SecretURI: to.Ptr("https://sample-vault.vault.azure.net/secrets/secret-name"), - // SecretURIWithVersion: to.Ptr("https:/sample-vault.vault.azure.net/secrets/secret-name/baf6de32c4774c7c81345f6476cf90a4"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSecretsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Secret = armkeyvault.Secret{ - // Name: to.Ptr("secret-name"), - // Type: to.Ptr("Microsoft.KeyVault/vaults/secrets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/secrets/secret-name"), - // Location: to.Ptr("westus"), - // Properties: &armkeyvault.SecretProperties{ - // Attributes: &armkeyvault.SecretAttributes{ - // Created: to.Ptr(time.Unix(1514940684, 0)), - // Enabled: to.Ptr(true), - // Updated: to.Ptr(time.Unix(1514940698, 0)), - // }, - // SecretURI: to.Ptr("https://sample-vault.vault.azure.net/secrets/secret-name"), - // SecretURIWithVersion: to.Ptr("https://sample-vault.vault.azure.net/secrets/secret-name/b8c802f549764f2d97885d152f92ee9d"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSecretsClient().Get(ctx, "sample-group", "sample-vault", "secret-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Secret = armkeyvault.Secret{ - // Name: to.Ptr("secret-name"), - // Type: to.Ptr("Microsoft.KeyVault/vaults/secrets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/secrets/secret-name"), - // Location: to.Ptr("westus"), - // Properties: &armkeyvault.SecretProperties{ - // Attributes: &armkeyvault.SecretAttributes{ - // Created: to.Ptr(time.Unix(1514940950, 0)), - // Enabled: to.Ptr(true), - // Updated: to.Ptr(time.Unix(1514940950, 0)), - // }, - // SecretURI: to.Ptr("https://sample-vault.vault.azure.net/secrets/secret-name"), - // SecretURIWithVersion: to.Ptr("https://sample-vault.vault.azure.net/secrets/secret-name/77445834f7de41bab81d0723bf996860"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSecretsClient().NewListPager("sample-group", "sample-vault", &armkeyvault.SecretsClientListOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SecretListResult = armkeyvault.SecretListResult{ - // Value: []*armkeyvault.Secret{ - // { - // Name: to.Ptr("secret-name"), - // Type: to.Ptr("Microsoft.KeyVault/vaults/secrets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/secrets/secret-name"), - // Location: to.Ptr("westus"), - // Properties: &armkeyvault.SecretProperties{ - // Attributes: &armkeyvault.SecretAttributes{ - // Created: to.Ptr(time.Unix(1514941476, 0)), - // Enabled: to.Ptr(true), - // Updated: to.Ptr(time.Unix(1514941476, 0)), - // }, - // SecretURI: to.Ptr("https://sample-vault.vault.azure.net/secrets/secret-name"), - // SecretURIWithVersion: to.Ptr("https://sample-vault.vault.azure.net/secrets/secret-name/40af42fbc10047f8a756a73211492f56"), - // }, - // }, - // { - // Name: to.Ptr("secret-name2"), - // Type: to.Ptr("Microsoft.KeyVault/vaults/secrets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/secrets/secret-name2"), - // Location: to.Ptr("westus"), - // Properties: &armkeyvault.SecretProperties{ - // Attributes: &armkeyvault.SecretAttributes{ - // Created: to.Ptr(time.Unix(1514941476, 0)), - // Enabled: to.Ptr(true), - // Updated: to.Ptr(time.Unix(1514941476, 0)), - // }, - // SecretURI: to.Ptr("https://sample-vault.vault.azure.net/secrets/secret-name2"), - // SecretURIWithVersion: to.Ptr("https://sample-vault.vault.azure.net/secrets/secret-name2/cd7264a6f56c44d1b594423c80609aae"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/time_rfc3339.go b/sdk/resourcemanager/keyvault/armkeyvault/time_rfc3339.go index 6b10975133d0..59d8c8054efe 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/time_rfc3339.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/time_rfc3339.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault diff --git a/sdk/resourcemanager/keyvault/armkeyvault/time_unix.go b/sdk/resourcemanager/keyvault/armkeyvault/time_unix.go index 569805882692..bf0463717689 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/time_unix.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/time_unix.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault diff --git a/sdk/resourcemanager/keyvault/armkeyvault/vaults_client.go b/sdk/resourcemanager/keyvault/armkeyvault/vaults_client.go index b087a90a98f4..f64a94efc001 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/vaults_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/vaults_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -54,18 +53,21 @@ func NewVaultsClient(subscriptionID string, credential azcore.TokenCredential, o // - options - VaultsClientCheckNameAvailabilityOptions contains the optional parameters for the VaultsClient.CheckNameAvailability // method. func (client *VaultsClient) CheckNameAvailability(ctx context.Context, vaultName VaultCheckNameAvailabilityParameters, options *VaultsClientCheckNameAvailabilityOptions) (VaultsClientCheckNameAvailabilityResponse, error) { + var err error req, err := client.checkNameAvailabilityCreateRequest(ctx, vaultName, options) if err != nil { return VaultsClientCheckNameAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VaultsClientCheckNameAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VaultsClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VaultsClientCheckNameAvailabilityResponse{}, err } - return client.checkNameAvailabilityHandleResponse(resp) + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. @@ -83,7 +85,10 @@ func (client *VaultsClient) checkNameAvailabilityCreateRequest(ctx context.Conte reqQP.Set("api-version", "2023-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, vaultName) + if err := runtime.MarshalAsJSON(req, vaultName); err != nil { + return nil, err + } + return req, nil } // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. @@ -110,7 +115,8 @@ func (client *VaultsClient) BeginCreateOrUpdate(ctx context.Context, resourceGro if err != nil { return nil, err } - return runtime.NewPoller[VaultsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[VaultsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[VaultsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -121,18 +127,20 @@ func (client *VaultsClient) BeginCreateOrUpdate(ctx context.Context, resourceGro // // Generated from API version 2023-02-01 func (client *VaultsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, parameters VaultCreateOrUpdateParameters, options *VaultsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vaultName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -158,7 +166,10 @@ func (client *VaultsClient) createOrUpdateCreateRequest(ctx context.Context, res reqQP.Set("api-version", "2023-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Delete - Deletes the specified Azure key vault. @@ -169,16 +180,18 @@ func (client *VaultsClient) createOrUpdateCreateRequest(ctx context.Context, res // - vaultName - The name of the vault to delete // - options - VaultsClientDeleteOptions contains the optional parameters for the VaultsClient.Delete method. func (client *VaultsClient) Delete(ctx context.Context, resourceGroupName string, vaultName string, options *VaultsClientDeleteOptions) (VaultsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, vaultName, options) if err != nil { return VaultsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VaultsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return VaultsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return VaultsClientDeleteResponse{}, err } return VaultsClientDeleteResponse{}, nil } @@ -217,18 +230,21 @@ func (client *VaultsClient) deleteCreateRequest(ctx context.Context, resourceGro // - vaultName - The name of the vault. // - options - VaultsClientGetOptions contains the optional parameters for the VaultsClient.Get method. func (client *VaultsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, options *VaultsClientGetOptions) (VaultsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, options) if err != nil { return VaultsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VaultsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VaultsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VaultsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -274,18 +290,21 @@ func (client *VaultsClient) getHandleResponse(resp *http.Response) (VaultsClient // - location - The location of the deleted vault. // - options - VaultsClientGetDeletedOptions contains the optional parameters for the VaultsClient.GetDeleted method. func (client *VaultsClient) GetDeleted(ctx context.Context, vaultName string, location string, options *VaultsClientGetDeletedOptions) (VaultsClientGetDeletedResponse, error) { + var err error req, err := client.getDeletedCreateRequest(ctx, vaultName, location, options) if err != nil { return VaultsClientGetDeletedResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VaultsClientGetDeletedResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VaultsClientGetDeletedResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VaultsClientGetDeletedResponse{}, err } - return client.getDeletedHandleResponse(resp) + resp, err := client.getDeletedHandleResponse(httpResp) + return resp, err } // getDeletedCreateRequest creates the GetDeleted request. @@ -591,7 +610,8 @@ func (client *VaultsClient) BeginPurgeDeleted(ctx context.Context, vaultName str if err != nil { return nil, err } - return runtime.NewPoller[VaultsClientPurgeDeletedResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[VaultsClientPurgeDeletedResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[VaultsClientPurgeDeletedResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -602,18 +622,20 @@ func (client *VaultsClient) BeginPurgeDeleted(ctx context.Context, vaultName str // // Generated from API version 2023-02-01 func (client *VaultsClient) purgeDeleted(ctx context.Context, vaultName string, location string, options *VaultsClientBeginPurgeDeletedOptions) (*http.Response, error) { + var err error req, err := client.purgeDeletedCreateRequest(ctx, vaultName, location, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // purgeDeletedCreateRequest creates the PurgeDeleted request. @@ -651,18 +673,21 @@ func (client *VaultsClient) purgeDeletedCreateRequest(ctx context.Context, vault // - parameters - Parameters to patch the vault // - options - VaultsClientUpdateOptions contains the optional parameters for the VaultsClient.Update method. func (client *VaultsClient) Update(ctx context.Context, resourceGroupName string, vaultName string, parameters VaultPatchParameters, options *VaultsClientUpdateOptions) (VaultsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, vaultName, parameters, options) if err != nil { return VaultsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VaultsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return VaultsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return VaultsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -688,7 +713,10 @@ func (client *VaultsClient) updateCreateRequest(ctx context.Context, resourceGro reqQP.Set("api-version", "2023-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. @@ -711,18 +739,21 @@ func (client *VaultsClient) updateHandleResponse(resp *http.Response) (VaultsCli // - options - VaultsClientUpdateAccessPolicyOptions contains the optional parameters for the VaultsClient.UpdateAccessPolicy // method. func (client *VaultsClient) UpdateAccessPolicy(ctx context.Context, resourceGroupName string, vaultName string, operationKind AccessPolicyUpdateKind, parameters VaultAccessPolicyParameters, options *VaultsClientUpdateAccessPolicyOptions) (VaultsClientUpdateAccessPolicyResponse, error) { + var err error req, err := client.updateAccessPolicyCreateRequest(ctx, resourceGroupName, vaultName, operationKind, parameters, options) if err != nil { return VaultsClientUpdateAccessPolicyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VaultsClientUpdateAccessPolicyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return VaultsClientUpdateAccessPolicyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return VaultsClientUpdateAccessPolicyResponse{}, err } - return client.updateAccessPolicyHandleResponse(resp) + resp, err := client.updateAccessPolicyHandleResponse(httpResp) + return resp, err } // updateAccessPolicyCreateRequest creates the UpdateAccessPolicy request. @@ -752,7 +783,10 @@ func (client *VaultsClient) updateAccessPolicyCreateRequest(ctx context.Context, reqQP.Set("api-version", "2023-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // updateAccessPolicyHandleResponse handles the UpdateAccessPolicy response. diff --git a/sdk/resourcemanager/keyvault/armkeyvault/vaults_client_example_test.go b/sdk/resourcemanager/keyvault/armkeyvault/vaults_client_example_test.go deleted file mode 100644 index 1ced2417e804..000000000000 --- a/sdk/resourcemanager/keyvault/armkeyvault/vaults_client_example_test.go +++ /dev/null @@ -1,1030 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/createVault.json -func ExampleVaultsClient_BeginCreateOrUpdate_createANewVaultOrUpdateAnExistingVault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVaultsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Vault = armkeyvault.Vault{ - // Name: to.Ptr("sample-vault"), - // Type: to.Ptr("Microsoft.KeyVault/vaults"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-resource-group/providers/Microsoft.KeyVault/vaults/sample-vault"), - // 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), - // HsmPoolResourceID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // NetworkACLs: &armkeyvault.NetworkRuleSet{ - // Bypass: to.Ptr(armkeyvault.NetworkRuleBypassOptionsAzureServices), - // DefaultAction: to.Ptr(armkeyvault.NetworkRuleActionDeny), - // IPRules: []*armkeyvault.IPRule{ - // { - // Value: to.Ptr(""), - // }}, - // VirtualNetworkRules: []*armkeyvault.VirtualNetworkRule{ - // { - // ID: to.Ptr(""), - // IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - // }}, - // }, - // PrivateEndpointConnections: []*armkeyvault.PrivateEndpointConnectionItem{ - // { - // Etag: to.Ptr(""), - // ID: to.Ptr(""), - // Properties: &armkeyvault.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armkeyvault.PrivateEndpoint{ - // ID: to.Ptr(""), - // }, - // PrivateLinkServiceConnectionState: &armkeyvault.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr(armkeyvault.ActionsRequiredNone), - // Status: to.Ptr(armkeyvault.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armkeyvault.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armkeyvault.VaultProvisioningStateSucceeded), - // 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"), - // VaultURI: to.Ptr("https://sample-vault.vault.azure.net"), - // }, - // SystemData: &armkeyvault.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.0000000Z"); return t}()), - // CreatedBy: to.Ptr("keyVaultUser1"), - // CreatedByType: to.Ptr(armkeyvault.IdentityTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.0000000Z"); return t}()), - // LastModifiedBy: to.Ptr("keyVaultUser2"), - // LastModifiedByType: to.Ptr(armkeyvault.IdentityTypeUser), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/createVaultWithNetworkAcls.json -func ExampleVaultsClient_BeginCreateOrUpdate_createOrUpdateAVaultWithNetworkAcls() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVaultsClient().BeginCreateOrUpdate(ctx, "sample-resource-group", "sample-vault", armkeyvault.VaultCreateOrUpdateParameters{ - Location: to.Ptr("westus"), - Properties: &armkeyvault.VaultProperties{ - EnabledForDeployment: to.Ptr(true), - EnabledForDiskEncryption: to.Ptr(true), - EnabledForTemplateDeployment: to.Ptr(true), - NetworkACLs: &armkeyvault.NetworkRuleSet{ - Bypass: to.Ptr(armkeyvault.NetworkRuleBypassOptionsAzureServices), - DefaultAction: to.Ptr(armkeyvault.NetworkRuleActionDeny), - IPRules: []*armkeyvault.IPRule{ - { - Value: to.Ptr("124.56.78.91"), - }, - { - Value: to.Ptr("'10.91.4.0/24'"), - }}, - VirtualNetworkRules: []*armkeyvault.VirtualNetworkRule{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1"), - }}, - }, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Vault = armkeyvault.Vault{ - // Name: to.Ptr("sample-vault"), - // Type: to.Ptr("Microsoft.KeyVault/vaults"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-resource-group/providers/Microsoft.KeyVault/vaults/sample-vault"), - // Location: to.Ptr("westus"), - // Properties: &armkeyvault.VaultProperties{ - // EnabledForDeployment: to.Ptr(true), - // EnabledForDiskEncryption: to.Ptr(true), - // EnabledForTemplateDeployment: to.Ptr(true), - // HsmPoolResourceID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // NetworkACLs: &armkeyvault.NetworkRuleSet{ - // Bypass: to.Ptr(armkeyvault.NetworkRuleBypassOptionsAzureServices), - // DefaultAction: to.Ptr(armkeyvault.NetworkRuleActionDeny), - // IPRules: []*armkeyvault.IPRule{ - // { - // Value: to.Ptr("124.56.78.91/32"), - // }, - // { - // Value: to.Ptr("'10.91.4.0/24'"), - // }}, - // VirtualNetworkRules: []*armkeyvault.VirtualNetworkRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.network/virtualnetworks/test-vnet/subnets/subnet1"), - // }}, - // }, - // SKU: &armkeyvault.SKU{ - // Name: to.Ptr(armkeyvault.SKUNameStandard), - // Family: to.Ptr(armkeyvault.SKUFamilyA), - // }, - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // VaultURI: to.Ptr("https://sample-vault.vault.azure.net"), - // }, - // SystemData: &armkeyvault.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.0000000Z"); return t}()), - // CreatedBy: to.Ptr("keyVaultUser1"), - // CreatedByType: to.Ptr(armkeyvault.IdentityTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.0000000Z"); return t}()), - // LastModifiedBy: to.Ptr("keyVaultUser2"), - // LastModifiedByType: to.Ptr(armkeyvault.IdentityTypeUser), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVaultsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Vault = armkeyvault.Vault{ - // Name: to.Ptr("sample-vault"), - // Type: to.Ptr("Microsoft.KeyVault/vaults"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-resource-group/providers/Microsoft.KeyVault/vaults/sample-vault"), - // 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), - // HsmPoolResourceID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // NetworkACLs: &armkeyvault.NetworkRuleSet{ - // Bypass: to.Ptr(armkeyvault.NetworkRuleBypassOptionsAzureServices), - // DefaultAction: to.Ptr(armkeyvault.NetworkRuleActionDeny), - // IPRules: []*armkeyvault.IPRule{ - // { - // Value: to.Ptr(""), - // }}, - // VirtualNetworkRules: []*armkeyvault.VirtualNetworkRule{ - // { - // ID: to.Ptr(""), - // IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - // }}, - // }, - // PrivateEndpointConnections: []*armkeyvault.PrivateEndpointConnectionItem{ - // { - // ID: to.Ptr(""), - // Properties: &armkeyvault.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armkeyvault.PrivateEndpoint{ - // ID: to.Ptr(""), - // }, - // PrivateLinkServiceConnectionState: &armkeyvault.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr(armkeyvault.ActionsRequiredNone), - // Status: to.Ptr(armkeyvault.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armkeyvault.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armkeyvault.VaultProvisioningStateSucceeded), - // 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"), - // VaultURI: to.Ptr("https://sample-vault.vault.azure.net"), - // }, - // SystemData: &armkeyvault.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.0000000Z"); return t}()), - // CreatedBy: to.Ptr("keyVaultUser1"), - // CreatedByType: to.Ptr(armkeyvault.IdentityTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.0000000Z"); return t}()), - // LastModifiedBy: to.Ptr("keyVaultUser2"), - // LastModifiedByType: to.Ptr(armkeyvault.IdentityTypeUser), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewVaultsClient().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/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVaultsClient().Get(ctx, "sample-resource-group", "sample-vault", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Vault = armkeyvault.Vault{ - // Name: to.Ptr("sample-vault"), - // Type: to.Ptr("Microsoft.KeyVault/vaults"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-resource-group/providers/Microsoft.KeyVault/vaults/sample-vault"), - // 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), - // HsmPoolResourceID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ProvisioningState: to.Ptr(armkeyvault.VaultProvisioningStateSucceeded), - // 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"), - // VaultURI: to.Ptr("https://sample-vault.vault.azure.net"), - // }, - // SystemData: &armkeyvault.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.0000000Z"); return t}()), - // CreatedBy: to.Ptr("keyVaultUser1"), - // CreatedByType: to.Ptr(armkeyvault.IdentityTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.0000000Z"); return t}()), - // LastModifiedBy: to.Ptr("keyVaultUser2"), - // LastModifiedByType: to.Ptr(armkeyvault.IdentityTypeUser), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVaultsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VaultAccessPolicyParameters = armkeyvault.VaultAccessPolicyParameters{ - // Type: to.Ptr("Microsoft.KeyVault/vaults/accessPolicies"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/accessPolicies/"), - // 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"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVaultsClient().NewListByResourceGroupPager("sample-group", &armkeyvault.VaultsClientListByResourceGroupOptions{Top: to.Ptr[int32](1)}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VaultListResult = armkeyvault.VaultListResult{ - // Value: []*armkeyvault.Vault{ - // { - // Name: to.Ptr("sample-vault"), - // Type: to.Ptr("Microsoft.KeyVault/vaults"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault"), - // 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"), - // }}, - // EnableSoftDelete: to.Ptr(true), - // EnabledForDeployment: to.Ptr(true), - // EnabledForDiskEncryption: to.Ptr(true), - // EnabledForTemplateDeployment: to.Ptr(true), - // HsmPoolResourceID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ProvisioningState: to.Ptr(armkeyvault.VaultProvisioningStateSucceeded), - // SKU: &armkeyvault.SKU{ - // Name: to.Ptr(armkeyvault.SKUNamePremium), - // Family: to.Ptr(armkeyvault.SKUFamilyA), - // }, - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // VaultURI: to.Ptr("https://sample-vault.vault.azure.net/"), - // }, - // SystemData: &armkeyvault.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.0000000Z"); return t}()), - // CreatedBy: to.Ptr("keyVaultUser1"), - // CreatedByType: to.Ptr(armkeyvault.IdentityTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.0000000Z"); return t}()), - // LastModifiedBy: to.Ptr("keyVaultUser2"), - // LastModifiedByType: to.Ptr(armkeyvault.IdentityTypeUser), - // }, - // Tags: map[string]*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVaultsClient().NewListBySubscriptionPager(&armkeyvault.VaultsClientListBySubscriptionOptions{Top: to.Ptr[int32](1)}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VaultListResult = armkeyvault.VaultListResult{ - // Value: []*armkeyvault.Vault{ - // { - // Name: to.Ptr("sample-vault"), - // Type: to.Ptr("Microsoft.KeyVault/vaults"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault"), - // 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"), - // }}, - // EnableSoftDelete: to.Ptr(true), - // EnabledForDeployment: to.Ptr(true), - // EnabledForDiskEncryption: to.Ptr(true), - // EnabledForTemplateDeployment: to.Ptr(true), - // HsmPoolResourceID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ProvisioningState: to.Ptr(armkeyvault.VaultProvisioningStateSucceeded), - // SKU: &armkeyvault.SKU{ - // Name: to.Ptr(armkeyvault.SKUNamePremium), - // Family: to.Ptr(armkeyvault.SKUFamilyA), - // }, - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // VaultURI: to.Ptr("https://sample-vault.vault.azure.net/"), - // }, - // SystemData: &armkeyvault.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.0000000Z"); return t}()), - // CreatedBy: to.Ptr("keyVaultUser1"), - // CreatedByType: to.Ptr(armkeyvault.IdentityTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T12:00:00.0000000Z"); return t}()), - // LastModifiedBy: to.Ptr("keyVaultUser2"), - // LastModifiedByType: to.Ptr(armkeyvault.IdentityTypeUser), - // }, - // Tags: map[string]*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVaultsClient().NewListDeletedPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DeletedVaultListResult = armkeyvault.DeletedVaultListResult{ - // Value: []*armkeyvault.DeletedVault{ - // { - // Name: to.Ptr("vault-agile-drawer-6404"), - // Type: to.Ptr("Microsoft.KeyVault/deletedVaults"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/westus/deletedVaults/sample-vault"), - // Properties: &armkeyvault.DeletedVaultProperties{ - // DeletionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-01T00:00:59Z"); return t}()), - // Location: to.Ptr("westus"), - // PurgeProtectionEnabled: to.Ptr(true), - // ScheduledPurgeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-01T00:00:59Z"); return t}()), - // Tags: map[string]*string{ - // }, - // VaultID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVaultsClient().GetDeleted(ctx, "sample-vault", "westus", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DeletedVault = armkeyvault.DeletedVault{ - // Name: to.Ptr("sample-vault"), - // Type: to.Ptr("Microsoft.KeyVault/deletedVaults"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/westus/deletedVaults/sample-vault"), - // Properties: &armkeyvault.DeletedVaultProperties{ - // DeletionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-01T00:00:59Z"); return t}()), - // Location: to.Ptr("westus"), - // PurgeProtectionEnabled: to.Ptr(true), - // ScheduledPurgeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-01T00:00:59Z"); return t}()), - // Tags: map[string]*string{ - // }, - // VaultID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVaultsClient().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/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVaultsClient().NewListPager(&armkeyvault.VaultsClientListOptions{Top: to.Ptr[int32](1)}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceListResult = armkeyvault.ResourceListResult{ - // Value: []*armkeyvault.Resource{ - // { - // Name: to.Ptr("sample-vault"), - // Type: to.Ptr("Microsoft.KeyVault/vaults"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/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() - clientFactory, err := armkeyvault.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVaultsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckNameAvailabilityResult = armkeyvault.CheckNameAvailabilityResult{ - // NameAvailable: to.Ptr(true), - // } -}