From 6025a2a6463401621dd374b777e79c812b3f6ab8 Mon Sep 17 00:00:00 2001 From: gracewilcox Date: Tue, 3 Dec 2024 15:26:38 -0800 Subject: [PATCH] updates --- sdk/security/keyvault/azsecrets/build.go | 3 +- sdk/security/keyvault/azsecrets/client.go | 50 ++++++++++++++++++- .../keyvault/azsecrets/internal/transforms.go | 2 + sdk/security/keyvault/azsecrets/models.go | 19 ++++--- .../keyvault/azsecrets/tsp-location.yaml | 2 +- 5 files changed, 64 insertions(+), 12 deletions(-) diff --git a/sdk/security/keyvault/azsecrets/build.go b/sdk/security/keyvault/azsecrets/build.go index 4b59358234d3..24412631e3a0 100644 --- a/sdk/security/keyvault/azsecrets/build.go +++ b/sdk/security/keyvault/azsecrets/build.go @@ -1,8 +1,7 @@ //go:build go1.18 // +build go1.18 -//go:generate tsp-client sync --local-spec-repo /home/grace/code/azure-rest-api-specs/specification/keyvault/Security.KeyVault.Secrets -//go:generate tsp-client generate +//go:generate tsp-client update //go:generate go run ./internal/transforms.go //go:generate rm ./constants.go //go:generate gofmt -w . diff --git a/sdk/security/keyvault/azsecrets/client.go b/sdk/security/keyvault/azsecrets/client.go index 68ced264dcf8..56d21182d1ac 100644 --- a/sdk/security/keyvault/azsecrets/client.go +++ b/sdk/security/keyvault/azsecrets/client.go @@ -12,6 +12,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" + "strings" ) @@ -24,6 +25,10 @@ type Client struct { } // BackupSecret - Backs up the specified secret. +// +// Requests that a backup of the specified secret be downloaded to the client. All +// versions of the secret will be downloaded. This operation requires the +// secrets/backup permission. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 7.5 @@ -79,6 +84,10 @@ func (client *Client) backupSecretHandleResponse(resp *http.Response) (BackupSec } // DeleteSecret - Deletes a secret from a specified key vault. +// +// The DELETE operation applies to any secret stored in Azure Key Vault. DELETE +// cannot be applied to an individual version of a secret. This operation requires +// the secrets/delete permission. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 7.5 @@ -134,6 +143,9 @@ func (client *Client) deleteSecretHandleResponse(resp *http.Response) (DeleteSec } // GetDeletedSecret - Gets the specified deleted secret. +// +// The Get Deleted Secret operation returns the specified deleted secret along +// with its attributes. This operation requires the secrets/get permission. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 7.5 @@ -189,6 +201,9 @@ func (client *Client) getDeletedSecretHandleResponse(resp *http.Response) (GetDe } // GetSecret - Get a specified secret from a given key vault. +// +// The GET operation is applicable to any secret stored in Azure Key Vault. This +// operation requires the secrets/get permission. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 7.5 @@ -248,6 +263,10 @@ func (client *Client) getSecretHandleResponse(resp *http.Response) (GetSecretRes // NewListDeletedSecretPropertiesPager - Lists deleted secrets for the specified vault. // +// The Get Deleted Secrets operation returns the secrets that have been deleted +// for a vault enabled for soft-delete. This operation requires the secrets/list +// permission. +// // Generated from API version 7.5 // - options - ListDeletedSecretPropertiesOptions contains the optional parameters for the Client.NewListDeletedSecretPropertiesPager // method. @@ -300,6 +319,11 @@ func (client *Client) listDeletedSecretPropertiesHandleResponse(resp *http.Respo // NewListSecretPropertiesPager - List secrets in a specified key vault. // +// The Get Secrets operation is applicable to the entire vault. However, only the +// base secret identifier and its attributes are provided in the response. +// Individual secret versions are not listed in the response. This operation +// requires the secrets/list permission. +// // Generated from API version 7.5 // - options - ListSecretPropertiesOptions contains the optional parameters for the Client.NewListSecretPropertiesPager method. func (client *Client) NewListSecretPropertiesPager(options *ListSecretPropertiesOptions) *runtime.Pager[ListSecretPropertiesResponse] { @@ -351,6 +375,10 @@ func (client *Client) listSecretPropertiesHandleResponse(resp *http.Response) (L // NewListSecretPropertiesVersionsPager - List all versions of the specified secret. // +// The full secret identifier and attributes are provided in the response. No +// values are returned for the secrets. This operations requires the secrets/list +// permission. +// // Generated from API version 7.5 // - name - The name of the secret. // - options - ListSecretPropertiesVersionsOptions contains the optional parameters for the Client.NewListSecretPropertiesVersionsPager @@ -378,7 +406,7 @@ func (client *Client) NewListSecretPropertiesVersionsPager(name string, options } // listSecretPropertiesVersionsCreateRequest creates the ListSecretPropertiesVersions request. -func (client *Client) listSecretPropertiesVersionsCreateRequest(ctx context.Context, name string, _ *ListSecretPropertiesVersionsOptions) (*policy.Request, error) { +func (client *Client) listSecretPropertiesVersionsCreateRequest(ctx context.Context, name string, options *ListSecretPropertiesVersionsOptions) (*policy.Request, error) { host := "{vaultBaseUrl}" host = strings.ReplaceAll(host, "{vaultBaseUrl}", client.vaultBaseUrl) urlPath := "/secrets/{secret-name}/versions" @@ -407,6 +435,10 @@ func (client *Client) listSecretPropertiesVersionsHandleResponse(resp *http.Resp } // PurgeDeletedSecret - Permanently deletes the specified secret. +// +// The purge deleted secret operation removes the secret permanently, without the +// possibility of recovery. This operation can only be enabled on a soft-delete +// enabled vault. This operation requires the secrets/purge permission. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 7.5 @@ -452,6 +484,10 @@ func (client *Client) purgeDeletedSecretCreateRequest(ctx context.Context, name } // RecoverDeletedSecret - Recovers the deleted secret to the latest version. +// +// Recovers the deleted secret in the specified vault. This operation can only be +// performed on a soft-delete enabled vault. This operation requires the +// secrets/recover permission. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 7.5 @@ -507,6 +543,9 @@ func (client *Client) recoverDeletedSecretHandleResponse(resp *http.Response) (R } // RestoreSecret - Restores a backed up secret to a vault. +// +// Restores a backed up secret, and all its versions, to a vault. This operation +// requires the secrets/restore permission. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 7.5 @@ -562,6 +601,10 @@ func (client *Client) restoreSecretHandleResponse(resp *http.Response) (RestoreS } // SetSecret - Sets a secret in a specified key vault. +// +// The SET operation adds a secret to the Azure Key Vault. If the named secret +// already exists, Azure Key Vault creates a new version of that secret. This +// operation requires the secrets/set permission. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 7.5 @@ -624,6 +667,11 @@ func (client *Client) setSecretHandleResponse(resp *http.Response) (SetSecretRes } // UpdateSecretProperties - Updates the attributes associated with a specified secret in a given key vault. +// +// The UPDATE operation changes specified attributes of an existing stored secret. +// Attributes that are not specified in the request are left unchanged. The value +// of a secret itself cannot be changed. This operation requires the secrets/set +// permission. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 7.5 diff --git a/sdk/security/keyvault/azsecrets/internal/transforms.go b/sdk/security/keyvault/azsecrets/internal/transforms.go index 0d6d8afea579..5600757eaeb4 100644 --- a/sdk/security/keyvault/azsecrets/internal/transforms.go +++ b/sdk/security/keyvault/azsecrets/internal/transforms.go @@ -43,4 +43,6 @@ func main() { // remove Max Results parameter regexReplace("options.go", `(?:\/\/.*\s)+\sMaxresults \*int32`, `// placeholder for future optional parameters`) regexReplace("client.go", `\sif options != nil && options.Maxresults != nil \{\s+.+\)\s+\}\s`, "") + + regexReplace("client.go", `"strconv"`, "") } diff --git a/sdk/security/keyvault/azsecrets/models.go b/sdk/security/keyvault/azsecrets/models.go index d46dc3d48bd4..1b162ea7dc0c 100644 --- a/sdk/security/keyvault/azsecrets/models.go +++ b/sdk/security/keyvault/azsecrets/models.go @@ -78,11 +78,13 @@ type DeletedSecretProperties struct { // DeletedSecretPropertiesListResult - The deleted secret list result type DeletedSecretPropertiesListResult struct { - // REQUIRED; The DeletedSecretItem items on this page - Value []*DeletedSecretProperties - - // The link to the next page of items + // READ-ONLY; The URL to get the next set of deleted secrets. NextLink *string + + // READ-ONLY; A response message containing a list of deleted secrets in the key vault along with a link to the next page + // of + // deleted secrets. + Value []*DeletedSecretProperties } // RestoreSecretParameters - The secret restore parameters. @@ -166,11 +168,12 @@ type SecretProperties struct { // SecretPropertiesListResult - The secret list result. type SecretPropertiesListResult struct { - // REQUIRED; The SecretItem items on this page - Value []*SecretProperties - - // The link to the next page of items + // READ-ONLY; The URL to get the next set of secrets. NextLink *string + + // READ-ONLY; A response message containing a list of secrets in the key vault along with a link to the next page of + // secrets. + Value []*SecretProperties } // SetSecretParameters - The secret set parameters. diff --git a/sdk/security/keyvault/azsecrets/tsp-location.yaml b/sdk/security/keyvault/azsecrets/tsp-location.yaml index c56dd7988dcb..64c72a3f2de0 100644 --- a/sdk/security/keyvault/azsecrets/tsp-location.yaml +++ b/sdk/security/keyvault/azsecrets/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/keyvault/Security.KeyVault.Secrets -commit: 710421cf3ba21c688e97cc9e7ab75c30270e5d3d +commit: 84a5e77596f6499df90493dacb828c480f26542e repo: Azure/azure-rest-api-specs additionalDirectories: