diff --git a/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md b/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md index 77a737e73c98..df5e9a7ba62e 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md +++ b/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md @@ -1,5 +1,12 @@ # Release History +## 1.5.0 (2024-12-06) +### Features Added + +- New value `ManagedHsmSKUFamilyC` added to enum type `ManagedHsmSKUFamily` +- New value `ManagedHsmSKUNameCustomC10`, `ManagedHsmSKUNameCustomC42` added to enum type `ManagedHsmSKUName` + + ## 1.4.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/keyvault/armkeyvault/README.md b/sdk/resourcemanager/keyvault/armkeyvault/README.md index 213e17b299f7..c6652547cf26 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/README.md +++ b/sdk/resourcemanager/keyvault/armkeyvault/README.md @@ -55,7 +55,7 @@ clientFactory, err := armkeyvault.NewClientFactory(, cred, &opt A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. ```go -client := clientFactory.NewVaultsClient() +client := clientFactory.NewKeysClient() ``` ## Fakes diff --git a/sdk/resourcemanager/keyvault/armkeyvault/autorest.md b/sdk/resourcemanager/keyvault/armkeyvault/autorest.md index 25de347af4e2..d0e1bd20c7cf 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/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.4.0 +module-version: 1.5.0 modelerfour: seal-single-value-enum-by-default: true -tag: package-2023-07 ``` \ 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 90daa8e6f23b..f54fd0123375 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/client_factory.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/client_factory.go @@ -17,8 +17,7 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. @@ -28,78 +27,99 @@ type ClientFactory struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - subscriptionID: subscriptionID, credential: credential, - options: options.Clone(), + subscriptionID: subscriptionID, + internal: internal, }, nil } // NewKeysClient creates a new instance of KeysClient. func (c *ClientFactory) NewKeysClient() *KeysClient { - subClient, _ := NewKeysClient(c.subscriptionID, c.credential, c.options) - return subClient + return &KeysClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewMHSMPrivateEndpointConnectionsClient creates a new instance of MHSMPrivateEndpointConnectionsClient. func (c *ClientFactory) NewMHSMPrivateEndpointConnectionsClient() *MHSMPrivateEndpointConnectionsClient { - subClient, _ := NewMHSMPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &MHSMPrivateEndpointConnectionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewMHSMPrivateLinkResourcesClient creates a new instance of MHSMPrivateLinkResourcesClient. func (c *ClientFactory) NewMHSMPrivateLinkResourcesClient() *MHSMPrivateLinkResourcesClient { - subClient, _ := NewMHSMPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &MHSMPrivateLinkResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewMHSMRegionsClient creates a new instance of MHSMRegionsClient. func (c *ClientFactory) NewMHSMRegionsClient() *MHSMRegionsClient { - subClient, _ := NewMHSMRegionsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &MHSMRegionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewManagedHsmKeysClient creates a new instance of ManagedHsmKeysClient. func (c *ClientFactory) NewManagedHsmKeysClient() *ManagedHsmKeysClient { - subClient, _ := NewManagedHsmKeysClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ManagedHsmKeysClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewManagedHsmsClient creates a new instance of ManagedHsmsClient. func (c *ClientFactory) NewManagedHsmsClient() *ManagedHsmsClient { - subClient, _ := NewManagedHsmsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ManagedHsmsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient + return &OperationsClient{ + internal: c.internal, + } } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateEndpointConnectionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient. func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { - subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateLinkResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewSecretsClient creates a new instance of SecretsClient. func (c *ClientFactory) NewSecretsClient() *SecretsClient { - subClient, _ := NewSecretsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &SecretsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewVaultsClient creates a new instance of VaultsClient. func (c *ClientFactory) NewVaultsClient() *VaultsClient { - subClient, _ := NewVaultsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &VaultsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } diff --git a/sdk/resourcemanager/keyvault/armkeyvault/constants.go b/sdk/resourcemanager/keyvault/armkeyvault/constants.go index 0d763ddfb848..b0c3b8f34460 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/constants.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/constants.go @@ -10,7 +10,7 @@ package armkeyvault const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" - moduleVersion = "v1.4.0" + moduleVersion = "v1.5.0" ) type AccessPolicyUpdateKind string @@ -195,7 +195,8 @@ func PossibleIdentityTypeValues() []IdentityType { } } -// JSONWebKeyCurveName - The elliptic curve name. For valid values, see JsonWebKeyCurveName. +// JSONWebKeyCurveName - The elliptic curve name. For valid values, see JsonWebKeyCurveName. Default for EC and EC-HSM keys +// is P-256 type JSONWebKeyCurveName string const ( @@ -337,12 +338,14 @@ type ManagedHsmSKUFamily string const ( ManagedHsmSKUFamilyB ManagedHsmSKUFamily = "B" + ManagedHsmSKUFamilyC ManagedHsmSKUFamily = "C" ) // PossibleManagedHsmSKUFamilyValues returns the possible values for the ManagedHsmSKUFamily const type. func PossibleManagedHsmSKUFamilyValues() []ManagedHsmSKUFamily { return []ManagedHsmSKUFamily{ ManagedHsmSKUFamilyB, + ManagedHsmSKUFamilyC, } } @@ -352,6 +355,8 @@ type ManagedHsmSKUName string const ( ManagedHsmSKUNameCustomB32 ManagedHsmSKUName = "Custom_B32" ManagedHsmSKUNameCustomB6 ManagedHsmSKUName = "Custom_B6" + ManagedHsmSKUNameCustomC10 ManagedHsmSKUName = "Custom_C10" + ManagedHsmSKUNameCustomC42 ManagedHsmSKUName = "Custom_C42" ManagedHsmSKUNameStandardB1 ManagedHsmSKUName = "Standard_B1" ) @@ -360,6 +365,8 @@ func PossibleManagedHsmSKUNameValues() []ManagedHsmSKUName { return []ManagedHsmSKUName{ ManagedHsmSKUNameCustomB32, ManagedHsmSKUNameCustomB6, + ManagedHsmSKUNameCustomC10, + ManagedHsmSKUNameCustomC42, ManagedHsmSKUNameStandardB1, } } diff --git a/sdk/resourcemanager/keyvault/armkeyvault/fake/time_rfc3339.go b/sdk/resourcemanager/keyvault/armkeyvault/fake/time_rfc3339.go index b0535a7b63e6..81f308b0d343 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/fake/time_rfc3339.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/fake/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/keyvault/armkeyvault/fake/time_unix.go b/sdk/resourcemanager/keyvault/armkeyvault/fake/time_unix.go index cf5c6d7c0a04..637f8df8d357 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/fake/time_unix.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/fake/time_unix.go @@ -13,7 +13,6 @@ import ( "fmt" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" - "strings" "time" ) @@ -49,7 +48,7 @@ func populateTimeUnix(m map[string]any, k string, t *time.Time) { } func unpopulateTimeUnix(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux timeUnix diff --git a/sdk/resourcemanager/keyvault/armkeyvault/go.mod b/sdk/resourcemanager/keyvault/armkeyvault/go.mod index 3df3b6406dd9..1ff17eb04018 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/go.mod +++ b/sdk/resourcemanager/keyvault/armkeyvault/go.mod @@ -4,13 +4,13 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 github.com/stretchr/testify v1.9.0 ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/sdk/resourcemanager/keyvault/armkeyvault/keys_client.go b/sdk/resourcemanager/keyvault/armkeyvault/keys_client.go index 4942ef7dd3ef..177f622eaf7d 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/keys_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/keys_client.go @@ -49,7 +49,7 @@ func NewKeysClient(subscriptionID string, credential azcore.TokenCredential, opt // versions, and does not update existing keys. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the resource group which contains the specified key vault. // - vaultName - The name of the key vault which contains the key to be created. // - keyName - The name of the key to be created. The value you provide may be copied globally for the purpose of running the @@ -103,7 +103,7 @@ func (client *KeysClient) createIfNotExistCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -124,7 +124,7 @@ func (client *KeysClient) createIfNotExistHandleResponse(resp *http.Response) (K // Get - Gets the current version of the specified key from the specified key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the resource group which contains the specified key vault. // - vaultName - The name of the vault which contains the key to be retrieved. // - keyName - The name of the key to be retrieved. @@ -175,7 +175,7 @@ func (client *KeysClient) getCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -193,7 +193,7 @@ func (client *KeysClient) getHandleResponse(resp *http.Response) (KeysClientGetR // GetVersion - Gets the specified version of the specified key in the specified key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the resource group which contains the specified key vault. // - vaultName - The name of the vault which contains the key version to be retrieved. // - keyName - The name of the key version to be retrieved. @@ -249,7 +249,7 @@ func (client *KeysClient) getVersionCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -266,7 +266,7 @@ func (client *KeysClient) getVersionHandleResponse(resp *http.Response) (KeysCli // NewListPager - Lists the keys in the specified key vault. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the resource group which contains the specified key vault. // - vaultName - The name of the vault which contains the keys to be retrieved. // - options - KeysClientListOptions contains the optional parameters for the KeysClient.NewListPager method. @@ -313,7 +313,7 @@ func (client *KeysClient) listCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,7 +330,7 @@ func (client *KeysClient) listHandleResponse(resp *http.Response) (KeysClientLis // NewListVersionsPager - Lists the versions of the specified key in the specified key vault. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the resource group which contains the specified key vault. // - vaultName - The name of the vault which contains the key versions to be retrieved. // - keyName - The name of the key versions to be retrieved. @@ -382,7 +382,7 @@ func (client *KeysClient) listVersionsCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/keyvault/armkeyvault/keys_client_example_test.go b/sdk/resourcemanager/keyvault/armkeyvault/keys_client_example_test.go deleted file mode 100644 index 7217dda3ffee..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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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 eb94d15a95e3..089e572aa5bc 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/managedhsmkeys_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/managedhsmkeys_client.go @@ -49,7 +49,7 @@ func NewManagedHsmKeysClient(subscriptionID string, credential azcore.TokenCrede // versions, and does not update existing keys. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - name - The name of the Managed HSM Pool within the specified resource group. // - keyName - The name of the key to be created. The value you provide may be copied globally for the purpose of running the @@ -104,7 +104,7 @@ func (client *ManagedHsmKeysClient) createIfNotExistCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -125,7 +125,7 @@ func (client *ManagedHsmKeysClient) createIfNotExistHandleResponse(resp *http.Re // Get - Gets the current version of the specified key from the specified managed HSM. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - name - The name of the Managed HSM Pool within the specified resource group. // - keyName - The name of the key to be created. The value you provide may be copied globally for the purpose of running the @@ -178,7 +178,7 @@ func (client *ManagedHsmKeysClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -196,7 +196,7 @@ func (client *ManagedHsmKeysClient) getHandleResponse(resp *http.Response) (Mana // GetVersion - Gets the specified version of the specified key in the specified managed HSM. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - name - The name of the Managed HSM Pool within the specified resource group. // - keyName - The name of the key to be created. The value you provide may be copied globally for the purpose of running the @@ -255,7 +255,7 @@ func (client *ManagedHsmKeysClient) getVersionCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -272,7 +272,7 @@ func (client *ManagedHsmKeysClient) getVersionHandleResponse(resp *http.Response // NewListPager - Lists the keys in the specified managed HSM. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - name - The name of the Managed HSM Pool within the specified resource group. // - options - ManagedHsmKeysClientListOptions contains the optional parameters for the ManagedHsmKeysClient.NewListPager method. @@ -319,7 +319,7 @@ func (client *ManagedHsmKeysClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -336,7 +336,7 @@ func (client *ManagedHsmKeysClient) listHandleResponse(resp *http.Response) (Man // NewListVersionsPager - Lists the versions of the specified key in the specified managed HSM. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - name - The name of the Managed HSM Pool within the specified resource group. // - keyName - The name of the key to be created. The value you provide may be copied globally for the purpose of running the @@ -391,7 +391,7 @@ func (client *ManagedHsmKeysClient) listVersionsCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/keyvault/armkeyvault/managedhsmkeys_client_example_test.go b/sdk/resourcemanager/keyvault/armkeyvault/managedhsmkeys_client_example_test.go deleted file mode 100644 index 30e7b3a9b4e2..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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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 169d9b8be4f0..f876c5999b09 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/managedhsms_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/managedhsms_client.go @@ -48,7 +48,7 @@ func NewManagedHsmsClient(subscriptionID string, credential azcore.TokenCredenti // CheckMhsmNameAvailability - Checks that the managed hsm name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - mhsmName - The name of the managed hsm. // - options - ManagedHsmsClientCheckMhsmNameAvailabilityOptions contains the optional parameters for the ManagedHsmsClient.CheckMhsmNameAvailability // method. @@ -86,7 +86,7 @@ func (client *ManagedHsmsClient) checkMhsmNameAvailabilityCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, mhsmName); err != nil { @@ -107,7 +107,7 @@ func (client *ManagedHsmsClient) checkMhsmNameAvailabilityHandleResponse(resp *h // BeginCreateOrUpdate - Create or update a managed HSM Pool in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - name - Name of the managed HSM Pool // - parameters - Parameters to create or update the managed HSM Pool @@ -133,7 +133,7 @@ func (client *ManagedHsmsClient) BeginCreateOrUpdate(ctx context.Context, resour // CreateOrUpdate - Create or update a managed HSM Pool in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 func (client *ManagedHsmsClient) createOrUpdate(ctx context.Context, resourceGroupName string, name string, parameters ManagedHsm, options *ManagedHsmsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ManagedHsmsClient.BeginCreateOrUpdate" @@ -175,7 +175,7 @@ func (client *ManagedHsmsClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -187,7 +187,7 @@ func (client *ManagedHsmsClient) createOrUpdateCreateRequest(ctx context.Context // BeginDelete - Deletes the specified managed HSM Pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - name - The name of the managed HSM Pool to delete // - options - ManagedHsmsClientBeginDeleteOptions contains the optional parameters for the ManagedHsmsClient.BeginDelete method. @@ -211,7 +211,7 @@ func (client *ManagedHsmsClient) BeginDelete(ctx context.Context, resourceGroupN // Delete - Deletes the specified managed HSM Pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 func (client *ManagedHsmsClient) deleteOperation(ctx context.Context, resourceGroupName string, name string, options *ManagedHsmsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ManagedHsmsClient.BeginDelete" @@ -253,7 +253,7 @@ func (client *ManagedHsmsClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -262,7 +262,7 @@ func (client *ManagedHsmsClient) deleteCreateRequest(ctx context.Context, resour // Get - Gets the specified managed HSM Pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - name - The name of the managed HSM Pool. // - options - ManagedHsmsClientGetOptions contains the optional parameters for the ManagedHsmsClient.Get method. @@ -308,7 +308,7 @@ func (client *ManagedHsmsClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -326,7 +326,7 @@ func (client *ManagedHsmsClient) getHandleResponse(resp *http.Response) (Managed // GetDeleted - Gets the specified deleted managed HSM. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - name - The name of the deleted managed HSM. // - location - The location of the deleted managed HSM. // - options - ManagedHsmsClientGetDeletedOptions contains the optional parameters for the ManagedHsmsClient.GetDeleted method. @@ -372,7 +372,7 @@ func (client *ManagedHsmsClient) getDeletedCreateRequest(ctx context.Context, na return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -390,7 +390,7 @@ func (client *ManagedHsmsClient) getDeletedHandleResponse(resp *http.Response) ( // NewListByResourceGroupPager - The List operation gets information about the managed HSM Pools associated with the subscription // and within the specified resource group. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - options - ManagedHsmsClientListByResourceGroupOptions contains the optional parameters for the ManagedHsmsClient.NewListByResourceGroupPager // method. @@ -436,7 +436,7 @@ func (client *ManagedHsmsClient) listByResourceGroupCreateRequest(ctx context.Co if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -453,7 +453,7 @@ func (client *ManagedHsmsClient) listByResourceGroupHandleResponse(resp *http.Re // NewListBySubscriptionPager - The List operation gets information about the managed HSM Pools associated with the subscription. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - options - ManagedHsmsClientListBySubscriptionOptions contains the optional parameters for the ManagedHsmsClient.NewListBySubscriptionPager // method. func (client *ManagedHsmsClient) NewListBySubscriptionPager(options *ManagedHsmsClientListBySubscriptionOptions) *runtime.Pager[ManagedHsmsClientListBySubscriptionResponse] { @@ -494,7 +494,7 @@ func (client *ManagedHsmsClient) listBySubscriptionCreateRequest(ctx context.Con if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -511,7 +511,7 @@ func (client *ManagedHsmsClient) listBySubscriptionHandleResponse(resp *http.Res // NewListDeletedPager - The List operation gets information about the deleted managed HSMs associated with the subscription. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - options - ManagedHsmsClientListDeletedOptions contains the optional parameters for the ManagedHsmsClient.NewListDeletedPager // method. func (client *ManagedHsmsClient) NewListDeletedPager(options *ManagedHsmsClientListDeletedOptions) *runtime.Pager[ManagedHsmsClientListDeletedResponse] { @@ -549,7 +549,7 @@ func (client *ManagedHsmsClient) listDeletedCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -567,7 +567,7 @@ func (client *ManagedHsmsClient) listDeletedHandleResponse(resp *http.Response) // BeginPurgeDeleted - Permanently deletes the specified managed HSM. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - name - The name of the soft-deleted managed HSM. // - location - The location of the soft-deleted managed HSM. // - options - ManagedHsmsClientBeginPurgeDeletedOptions contains the optional parameters for the ManagedHsmsClient.BeginPurgeDeleted @@ -592,7 +592,7 @@ func (client *ManagedHsmsClient) BeginPurgeDeleted(ctx context.Context, name str // PurgeDeleted - Permanently deletes the specified managed HSM. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 func (client *ManagedHsmsClient) purgeDeleted(ctx context.Context, name string, location string, options *ManagedHsmsClientBeginPurgeDeletedOptions) (*http.Response, error) { var err error const operationName = "ManagedHsmsClient.BeginPurgeDeleted" @@ -634,7 +634,7 @@ func (client *ManagedHsmsClient) purgeDeletedCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -643,7 +643,7 @@ func (client *ManagedHsmsClient) purgeDeletedCreateRequest(ctx context.Context, // BeginUpdate - Update a managed HSM Pool in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - name - Name of the managed HSM Pool // - parameters - Parameters to patch the managed HSM Pool @@ -668,7 +668,7 @@ func (client *ManagedHsmsClient) BeginUpdate(ctx context.Context, resourceGroupN // Update - Update a managed HSM Pool in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 func (client *ManagedHsmsClient) update(ctx context.Context, resourceGroupName string, name string, parameters ManagedHsm, options *ManagedHsmsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ManagedHsmsClient.BeginUpdate" @@ -710,7 +710,7 @@ func (client *ManagedHsmsClient) updateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/keyvault/armkeyvault/managedhsms_client_example_test.go b/sdk/resourcemanager/keyvault/armkeyvault/managedhsms_client_example_test.go deleted file mode 100644 index 28713dfbca80..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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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:59.000Z"); 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:59.000Z"); 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:59.000Z"); 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:59.000Z"); 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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:59.000Z"); 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:59.000Z"); 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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 41cf70240c0e..b5ea0235b4a6 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivateendpointconnections_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivateendpointconnections_client.go @@ -48,7 +48,7 @@ func NewMHSMPrivateEndpointConnectionsClient(subscriptionID string, credential a // BeginDelete - Deletes the specified private endpoint connection associated with the managed hsm pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - name - Name of the managed HSM Pool // - privateEndpointConnectionName - Name of the private endpoint connection associated with the managed hsm pool. @@ -74,7 +74,7 @@ func (client *MHSMPrivateEndpointConnectionsClient) BeginDelete(ctx context.Cont // Delete - Deletes the specified private endpoint connection associated with the managed hsm pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 func (client *MHSMPrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, options *MHSMPrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "MHSMPrivateEndpointConnectionsClient.BeginDelete" @@ -120,7 +120,7 @@ func (client *MHSMPrivateEndpointConnectionsClient) deleteCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -129,7 +129,7 @@ func (client *MHSMPrivateEndpointConnectionsClient) deleteCreateRequest(ctx cont // Get - Gets the specified private endpoint connection associated with the managed HSM Pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - name - Name of the managed HSM Pool // - privateEndpointConnectionName - Name of the private endpoint connection associated with the managed hsm pool. @@ -181,7 +181,7 @@ func (client *MHSMPrivateEndpointConnectionsClient) getCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -199,7 +199,7 @@ func (client *MHSMPrivateEndpointConnectionsClient) getHandleResponse(resp *http // NewListByResourcePager - The List operation gets information about the private endpoint connections associated with the // managed HSM Pool. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - name - Name of the managed HSM Pool // - options - MHSMPrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.NewListByResourcePager @@ -247,7 +247,7 @@ func (client *MHSMPrivateEndpointConnectionsClient) listByResourceCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +265,7 @@ func (client *MHSMPrivateEndpointConnectionsClient) listByResourceHandleResponse // Put - Updates the specified private endpoint connection associated with the managed hsm pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - name - Name of the managed HSM Pool // - privateEndpointConnectionName - Name of the private endpoint connection associated with the managed hsm pool. @@ -318,7 +318,7 @@ func (client *MHSMPrivateEndpointConnectionsClient) putCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { 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 21bd081bd26e..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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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 319d6a7e8fe0..31c01b384684 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivatelinkresources_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivatelinkresources_client.go @@ -47,7 +47,7 @@ func NewMHSMPrivateLinkResourcesClient(subscriptionID string, credential azcore. // ListByMHSMResource - Gets the private link resources supported for the managed hsm pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - name - Name of the managed HSM Pool // - options - MHSMPrivateLinkResourcesClientListByMHSMResourceOptions contains the optional parameters for the MHSMPrivateLinkResourcesClient.ListByMHSMResource @@ -94,7 +94,7 @@ func (client *MHSMPrivateLinkResourcesClient) listByMHSMResourceCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivatelinkresources_client_example_test.go b/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivatelinkresources_client_example_test.go deleted file mode 100644 index 3d2647be0f93..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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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 15acd3c3a462..7a339d570d4c 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/mhsmregions_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/mhsmregions_client.go @@ -46,7 +46,7 @@ func NewMHSMRegionsClient(subscriptionID string, credential azcore.TokenCredenti // NewListByResourcePager - The List operation gets information about the regions associated with the managed HSM Pool. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - name - Name of the managed HSM Pool // - options - MHSMRegionsClientListByResourceOptions contains the optional parameters for the MHSMRegionsClient.NewListByResourcePager @@ -94,7 +94,7 @@ func (client *MHSMRegionsClient) listByResourceCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/keyvault/armkeyvault/mhsmregions_client_example_test.go b/sdk/resourcemanager/keyvault/armkeyvault/mhsmregions_client_example_test.go deleted file mode 100644 index fb96a468090a..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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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 edf63b437159..85e94ec7187a 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/models.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/models.go @@ -243,11 +243,12 @@ type KeyProperties struct { // The attributes of the key. Attributes *KeyAttributes - // The elliptic curve name. For valid values, see JsonWebKeyCurveName. + // The elliptic curve name. For valid values, see JsonWebKeyCurveName. Default for EC and EC-HSM keys is P-256 CurveName *JSONWebKeyCurveName KeyOps []*JSONWebKeyOperation - // The key size in bits. For example: 2048, 3072, or 4096 for RSA. + // The key size in bits. For example: 2048, 3072, or 4096 for RSA. Default for RSA and RSA-HSM keys is 2048. Exception made + // for bring your own key (BYOK), key exchange keys default to 4096. KeySize *int32 // The type of the key. For valid values, see JsonWebKeyType. @@ -598,11 +599,12 @@ type ManagedHsmKeyProperties struct { // The attributes of the key. Attributes *ManagedHsmKeyAttributes - // The elliptic curve name. For valid values, see JsonWebKeyCurveName. + // The elliptic curve name. For valid values, see JsonWebKeyCurveName. Default for EC and EC-HSM keys is P-256 CurveName *JSONWebKeyCurveName KeyOps []*JSONWebKeyOperation - // The key size in bits. For example: 2048, 3072, or 4096 for RSA. + // The key size in bits. For example: 2048, 3072, or 4096 for RSA. Default for RSA and RSA-HSM keys is 2048. Exception made + // for bring your own key (BYOK), key exchange keys default to 4096. KeySize *int32 // The type of the key. For valid values, see JsonWebKeyType. diff --git a/sdk/resourcemanager/keyvault/armkeyvault/models_serde.go b/sdk/resourcemanager/keyvault/armkeyvault/models_serde.go index fbc4d3172291..4f5fca0d2107 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/models_serde.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/models_serde.go @@ -699,7 +699,9 @@ func (k *KeyProperties) UnmarshalJSON(data []byte) error { func (k KeyReleasePolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "contentType", k.ContentType) - populateByteArray(objectMap, "data", k.Data, runtime.Base64URLFormat) + populateByteArray(objectMap, "data", k.Data, func() any { + return runtime.EncodeByteArray(k.Data, runtime.Base64URLFormat) + }) return json.Marshal(objectMap) } @@ -716,7 +718,9 @@ func (k *KeyReleasePolicy) UnmarshalJSON(data []byte) error { err = unpopulate(val, "ContentType", &k.ContentType) delete(rawMsg, key) case "data": - err = runtime.DecodeByteArray(string(val), &k.Data, runtime.Base64URLFormat) + if val != nil && string(val) != "null" { + err = runtime.DecodeByteArray(string(val), &k.Data, runtime.Base64URLFormat) + } delete(rawMsg, key) } if err != nil { @@ -1669,7 +1673,9 @@ func (m *ManagedHsmKeyProperties) UnmarshalJSON(data []byte) error { func (m ManagedHsmKeyReleasePolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "contentType", m.ContentType) - populateByteArray(objectMap, "data", m.Data, runtime.Base64URLFormat) + populateByteArray(objectMap, "data", m.Data, func() any { + return runtime.EncodeByteArray(m.Data, runtime.Base64URLFormat) + }) return json.Marshal(objectMap) } @@ -1686,7 +1692,9 @@ func (m *ManagedHsmKeyReleasePolicy) UnmarshalJSON(data []byte) error { err = unpopulate(val, "ContentType", &m.ContentType) delete(rawMsg, key) case "data": - err = runtime.DecodeByteArray(string(val), &m.Data, runtime.Base64URLFormat) + if val != nil && string(val) != "null" { + err = runtime.DecodeByteArray(string(val), &m.Data, runtime.Base64URLFormat) + } delete(rawMsg, key) } if err != nil { @@ -3615,18 +3623,18 @@ func populate(m map[string]any, k string, v any) { } } -func populateByteArray(m map[string]any, k string, b []byte, f runtime.Base64Encoding) { +func populateByteArray[T any](m map[string]any, k string, b []T, convert func() any) { if azcore.IsNullValue(b) { m[k] = nil } else if len(b) == 0 { return } else { - m[k] = runtime.EncodeByteArray(b, f) + m[k] = convert() } } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/keyvault/armkeyvault/operations_client.go b/sdk/resourcemanager/keyvault/armkeyvault/operations_client.go index 23c695a640a9..7bf050f81ae5 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/operations_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available Key Vault Rest API operations. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/keyvault/armkeyvault/operations_client_example_test.go b/sdk/resourcemanager/keyvault/armkeyvault/operations_client_example_test.go deleted file mode 100644 index 7991ecb70621..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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/privateendpointconnections_client.go b/sdk/resourcemanager/keyvault/armkeyvault/privateendpointconnections_client.go index 4941b953fccf..5510c17728de 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/privateendpointconnections_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/privateendpointconnections_client.go @@ -48,7 +48,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginDelete - Deletes the specified private endpoint connection associated with the key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - Name of the resource group that contains the key vault. // - vaultName - The name of the key vault. // - privateEndpointConnectionName - Name of the private endpoint connection associated with the key vault. @@ -74,7 +74,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes the specified private endpoint connection associated with the key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" @@ -120,7 +120,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -129,7 +129,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Gets the specified private endpoint connection associated with the key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - Name of the resource group that contains the key vault. // - vaultName - The name of the key vault. // - privateEndpointConnectionName - Name of the private endpoint connection associated with the key vault. @@ -181,7 +181,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -199,7 +199,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListByResourcePager - The List operation gets information about the private endpoint connections associated with the // vault. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - Name of the resource group that contains the key vault. // - vaultName - The name of the key vault. // - options - PrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByResourcePager @@ -247,7 +247,7 @@ func (client *PrivateEndpointConnectionsClient) listByResourceCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +265,7 @@ func (client *PrivateEndpointConnectionsClient) listByResourceHandleResponse(res // Put - Updates the specified private endpoint connection associated with the key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - Name of the resource group that contains the key vault. // - vaultName - The name of the key vault. // - privateEndpointConnectionName - Name of the private endpoint connection associated with the key vault. @@ -318,7 +318,7 @@ func (client *PrivateEndpointConnectionsClient) putCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { 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 b786cedca318..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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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 b329955a76d7..bae60fcae475 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/privatelinkresources_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/privatelinkresources_client.go @@ -47,7 +47,7 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // ListByVault - Gets the private link resources supported for the key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - Name of the resource group that contains the key vault. // - vaultName - The name of the key vault. // - options - PrivateLinkResourcesClientListByVaultOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByVault @@ -94,7 +94,7 @@ func (client *PrivateLinkResourcesClient) listByVaultCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/keyvault/armkeyvault/privatelinkresources_client_example_test.go b/sdk/resourcemanager/keyvault/armkeyvault/privatelinkresources_client_example_test.go deleted file mode 100644 index 3cdab75b5adc..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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/responses.go similarity index 100% rename from sdk/resourcemanager/keyvault/armkeyvault/response_types.go rename to sdk/resourcemanager/keyvault/armkeyvault/responses.go diff --git a/sdk/resourcemanager/keyvault/armkeyvault/secrets_client.go b/sdk/resourcemanager/keyvault/armkeyvault/secrets_client.go index d57157653999..9ca3a7c47eea 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/secrets_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/secrets_client.go @@ -50,7 +50,7 @@ func NewSecretsClient(subscriptionID string, credential azcore.TokenCredential, // with vault secrets. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the Resource Group to which the vault belongs. // - vaultName - Name of the vault // - secretName - Name of the secret. The value you provide may be copied globally for the purpose of running the service. The @@ -103,7 +103,7 @@ func (client *SecretsClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -125,7 +125,7 @@ func (client *SecretsClient) createOrUpdateHandleResponse(resp *http.Response) ( // REST service for interaction with vault secrets. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the Resource Group to which the vault belongs. // - vaultName - The name of the vault. // - secretName - The name of the secret. @@ -176,7 +176,7 @@ func (client *SecretsClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -195,7 +195,7 @@ func (client *SecretsClient) getHandleResponse(resp *http.Response) (SecretsClie // use in ARM deployments. Users should use the data-plane REST service for interaction with // vault secrets. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the Resource Group to which the vault belongs. // - vaultName - The name of the vault. // - options - SecretsClientListOptions contains the optional parameters for the SecretsClient.NewListPager method. @@ -245,7 +245,7 @@ func (client *SecretsClient) listCreateRequest(ctx context.Context, resourceGrou if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -264,7 +264,7 @@ func (client *SecretsClient) listHandleResponse(resp *http.Response) (SecretsCli // Users should use the data-plane REST service for interaction with vault secrets. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the Resource Group to which the vault belongs. // - vaultName - Name of the vault // - secretName - Name of the secret @@ -316,7 +316,7 @@ func (client *SecretsClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/keyvault/armkeyvault/secrets_client_example_test.go b/sdk/resourcemanager/keyvault/armkeyvault/secrets_client_example_test.go deleted file mode 100644 index 966aacf1e3b8..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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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 a7b9a6b4d854..0b21b4a3dcc1 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/time_rfc3339.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/keyvault/armkeyvault/time_unix.go b/sdk/resourcemanager/keyvault/armkeyvault/time_unix.go index bf0463717689..57f89b62f7bd 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/time_unix.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/time_unix.go @@ -13,7 +13,6 @@ import ( "fmt" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" - "strings" "time" ) @@ -49,7 +48,7 @@ func populateTimeUnix(m map[string]any, k string, t *time.Time) { } func unpopulateTimeUnix(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux timeUnix diff --git a/sdk/resourcemanager/keyvault/armkeyvault/vaults_client.go b/sdk/resourcemanager/keyvault/armkeyvault/vaults_client.go index 00075aff0924..fe4b401e0c6e 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/vaults_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/vaults_client.go @@ -48,7 +48,7 @@ func NewVaultsClient(subscriptionID string, credential azcore.TokenCredential, o // CheckNameAvailability - Checks that the vault name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - vaultName - The name of the vault. // - options - VaultsClientCheckNameAvailabilityOptions contains the optional parameters for the VaultsClient.CheckNameAvailability // method. @@ -86,7 +86,7 @@ func (client *VaultsClient) checkNameAvailabilityCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, vaultName); err != nil { @@ -107,7 +107,7 @@ func (client *VaultsClient) checkNameAvailabilityHandleResponse(resp *http.Respo // BeginCreateOrUpdate - Create or update a key vault in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the Resource Group to which the server belongs. // - vaultName - Name of the vault // - parameters - Parameters to create or update the vault @@ -133,7 +133,7 @@ func (client *VaultsClient) BeginCreateOrUpdate(ctx context.Context, resourceGro // CreateOrUpdate - Create or update a key vault in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 func (client *VaultsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, parameters VaultCreateOrUpdateParameters, options *VaultsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "VaultsClient.BeginCreateOrUpdate" @@ -175,7 +175,7 @@ func (client *VaultsClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -187,7 +187,7 @@ func (client *VaultsClient) createOrUpdateCreateRequest(ctx context.Context, res // Delete - Deletes the specified Azure key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the Resource Group to which the vault belongs. // - vaultName - The name of the vault to delete // - options - VaultsClientDeleteOptions contains the optional parameters for the VaultsClient.Delete method. @@ -232,7 +232,7 @@ func (client *VaultsClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -241,7 +241,7 @@ func (client *VaultsClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Gets the specified Azure key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the Resource Group to which the vault belongs. // - vaultName - The name of the vault. // - options - VaultsClientGetOptions contains the optional parameters for the VaultsClient.Get method. @@ -287,7 +287,7 @@ func (client *VaultsClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -305,7 +305,7 @@ func (client *VaultsClient) getHandleResponse(resp *http.Response) (VaultsClient // GetDeleted - Gets the deleted Azure key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - vaultName - The name of the vault. // - location - The location of the deleted vault. // - options - VaultsClientGetDeletedOptions contains the optional parameters for the VaultsClient.GetDeleted method. @@ -351,7 +351,7 @@ func (client *VaultsClient) getDeletedCreateRequest(ctx context.Context, vaultNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -368,7 +368,7 @@ func (client *VaultsClient) getDeletedHandleResponse(resp *http.Response) (Vault // NewListPager - The List operation gets information about the vaults associated with the subscription. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - options - VaultsClientListOptions contains the optional parameters for the VaultsClient.NewListPager method. func (client *VaultsClient) NewListPager(options *VaultsClientListOptions) *runtime.Pager[VaultsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[VaultsClientListResponse]{ @@ -427,7 +427,7 @@ func (client *VaultsClient) listHandleResponse(resp *http.Response) (VaultsClien // NewListByResourceGroupPager - The List operation gets information about the vaults associated with the subscription and // within the specified resource group. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the Resource Group to which the vault belongs. // - options - VaultsClientListByResourceGroupOptions contains the optional parameters for the VaultsClient.NewListByResourceGroupPager // method. @@ -473,7 +473,7 @@ func (client *VaultsClient) listByResourceGroupCreateRequest(ctx context.Context if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -490,7 +490,7 @@ func (client *VaultsClient) listByResourceGroupHandleResponse(resp *http.Respons // NewListBySubscriptionPager - The List operation gets information about the vaults associated with the subscription. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - options - VaultsClientListBySubscriptionOptions contains the optional parameters for the VaultsClient.NewListBySubscriptionPager // method. func (client *VaultsClient) NewListBySubscriptionPager(options *VaultsClientListBySubscriptionOptions) *runtime.Pager[VaultsClientListBySubscriptionResponse] { @@ -531,7 +531,7 @@ func (client *VaultsClient) listBySubscriptionCreateRequest(ctx context.Context, if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -548,7 +548,7 @@ func (client *VaultsClient) listBySubscriptionHandleResponse(resp *http.Response // NewListDeletedPager - Gets information about the deleted vaults in a subscription. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - options - VaultsClientListDeletedOptions contains the optional parameters for the VaultsClient.NewListDeletedPager method. func (client *VaultsClient) NewListDeletedPager(options *VaultsClientListDeletedOptions) *runtime.Pager[VaultsClientListDeletedResponse] { return runtime.NewPager(runtime.PagingHandler[VaultsClientListDeletedResponse]{ @@ -585,7 +585,7 @@ func (client *VaultsClient) listDeletedCreateRequest(ctx context.Context, option return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -603,7 +603,7 @@ func (client *VaultsClient) listDeletedHandleResponse(resp *http.Response) (Vaul // BeginPurgeDeleted - Permanently deletes the specified vault. aka Purges the deleted Azure key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - vaultName - The name of the soft-deleted vault. // - location - The location of the soft-deleted vault. // - options - VaultsClientBeginPurgeDeletedOptions contains the optional parameters for the VaultsClient.BeginPurgeDeleted @@ -628,7 +628,7 @@ func (client *VaultsClient) BeginPurgeDeleted(ctx context.Context, vaultName str // PurgeDeleted - Permanently deletes the specified vault. aka Purges the deleted Azure key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 func (client *VaultsClient) purgeDeleted(ctx context.Context, vaultName string, location string, options *VaultsClientBeginPurgeDeletedOptions) (*http.Response, error) { var err error const operationName = "VaultsClient.BeginPurgeDeleted" @@ -670,7 +670,7 @@ func (client *VaultsClient) purgeDeletedCreateRequest(ctx context.Context, vault return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -679,7 +679,7 @@ func (client *VaultsClient) purgeDeletedCreateRequest(ctx context.Context, vault // Update - Update a key vault in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the Resource Group to which the server belongs. // - vaultName - Name of the vault // - parameters - Parameters to patch the vault @@ -726,7 +726,7 @@ func (client *VaultsClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -747,7 +747,7 @@ func (client *VaultsClient) updateHandleResponse(resp *http.Response) (VaultsCli // UpdateAccessPolicy - Update access policies in a key vault in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the Resource Group to which the vault belongs. // - vaultName - Name of the vault // - operationKind - Name of the operation @@ -800,7 +800,7 @@ func (client *VaultsClient) updateAccessPolicyCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/keyvault/armkeyvault/vaults_client_example_test.go b/sdk/resourcemanager/keyvault/armkeyvault/vaults_client_example_test.go deleted file mode 100644 index 8735ef2c2202..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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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.000Z"); 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.000Z"); 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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.000Z"); 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.000Z"); 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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.000Z"); 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.000Z"); 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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.000Z"); 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.000Z"); 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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.000Z"); 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.000Z"); 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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.000Z"); 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.000Z"); 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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:59.000Z"); 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:59.000Z"); 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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:59.000Z"); 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:59.000Z"); 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-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), - // } -}