From af2aacb0bf5b03231cba3fdc08e330469f297cd4 Mon Sep 17 00:00:00 2001 From: Grace Wilcox <43627800+gracewilcox@users.noreply.github.com> Date: Thu, 16 Jan 2025 13:54:50 -0800 Subject: [PATCH] [azadmin] convert to typespec (#23906) * generate * update typespec and copyright * fix * charles feedback * update typespec commit --- .../keyvault/azadmin/backup/autorest.md | 103 ------------------ .../keyvault/azadmin/backup/client.go | 41 +++---- .../keyvault/azadmin/backup/client_test.go | 5 +- .../keyvault/azadmin/backup/custom_client.go | 21 ++-- .../keyvault/azadmin/backup/example_test.go | 2 +- .../backup/internal/pollers/restore_poller.go | 3 - .../keyvault/azadmin/backup/models.go | 19 ++-- .../keyvault/azadmin/backup/models_serde.go | 8 +- .../keyvault/azadmin/backup/options.go | 12 +- .../{response_types.go => responses.go} | 6 +- .../keyvault/azadmin/backup/time_unix.go | 9 +- .../keyvault/azadmin/backup/tsp-location.yaml | 6 + .../keyvault/azadmin/backup/utils_test.go | 5 +- sdk/security/keyvault/azadmin/build.go | 14 ++- .../azadmin/internal/generate/transforms.go | 62 +++++++++++ .../keyvault/azadmin/internal/version.go | 5 +- .../keyvault/azadmin/rbac/autorest.md | 89 --------------- sdk/security/keyvault/azadmin/rbac/client.go | 64 ++++++----- .../keyvault/azadmin/rbac/client_test.go | 5 +- .../keyvault/azadmin/rbac/constants.go | 7 +- .../keyvault/azadmin/rbac/custom_client.go | 5 +- .../keyvault/azadmin/rbac/example_test.go | 2 +- sdk/security/keyvault/azadmin/rbac/models.go | 6 +- .../keyvault/azadmin/rbac/models_serde.go | 8 +- sdk/security/keyvault/azadmin/rbac/options.go | 12 +- .../rbac/{response_types.go => responses.go} | 6 +- .../keyvault/azadmin/rbac/tsp-location.yaml | 6 + .../keyvault/azadmin/rbac/utils_test.go | 5 +- .../keyvault/azadmin/settings/autorest.md | 58 ---------- .../keyvault/azadmin/settings/client.go | 43 +++++--- .../keyvault/azadmin/settings/client_test.go | 5 +- .../keyvault/azadmin/settings/constants.go | 7 +- .../azadmin/settings/custom_client.go | 5 +- .../keyvault/azadmin/settings/models.go | 8 +- .../keyvault/azadmin/settings/models_serde.go | 8 +- .../keyvault/azadmin/settings/options.go | 6 +- .../{response_types.go => responses.go} | 10 +- .../azadmin/settings/tsp-location.yaml | 6 + .../keyvault/azadmin/settings/utils_test.go | 5 +- 39 files changed, 233 insertions(+), 464 deletions(-) delete mode 100644 sdk/security/keyvault/azadmin/backup/autorest.md rename sdk/security/keyvault/azadmin/backup/{response_types.go => responses.go} (78%) create mode 100644 sdk/security/keyvault/azadmin/backup/tsp-location.yaml create mode 100644 sdk/security/keyvault/azadmin/internal/generate/transforms.go delete mode 100644 sdk/security/keyvault/azadmin/rbac/autorest.md rename sdk/security/keyvault/azadmin/rbac/{response_types.go => responses.go} (89%) create mode 100644 sdk/security/keyvault/azadmin/rbac/tsp-location.yaml delete mode 100644 sdk/security/keyvault/azadmin/settings/autorest.md rename sdk/security/keyvault/azadmin/settings/{response_types.go => responses.go} (70%) create mode 100644 sdk/security/keyvault/azadmin/settings/tsp-location.yaml diff --git a/sdk/security/keyvault/azadmin/backup/autorest.md b/sdk/security/keyvault/azadmin/backup/autorest.md deleted file mode 100644 index 88a832c27532..000000000000 --- a/sdk/security/keyvault/azadmin/backup/autorest.md +++ /dev/null @@ -1,103 +0,0 @@ -## Go - -```yaml -clear-output-folder: false -export-clients: true -go: true -input-file: https://github.com/Azure/azure-rest-api-specs/blob/7452e1cc7db72fbc6cd9539b390d8b8e5c2a1864/specification/keyvault/data-plane/Microsoft.KeyVault/stable/7.5/backuprestore.json -license-header: MICROSOFT_MIT_NO_VERSION -openapi-type: "data-plane" -output-folder: ../backup -override-client-name: Client -security: "AADToken" -security-scopes: "https://vault.azure.net/.default" -use: "@autorest/go@4.0.0-preview.59" -inject-spans: true -version: "^3.0.0" - -directive: - - # make vault URL a parameter of the client constructor - - from: swagger-document - where: $["x-ms-parameterized-host"] - transform: $.parameters[0]["x-ms-parameter-location"] = "client" - - # rename restore operation from BeginFullRestoreOperation to BeginFullRestore - - rename-operation: - from: FullRestoreOperation - to: FullRestore - - rename-operation: - from: SelectiveKeyRestoreOperation - to: SelectiveKeyRestore - - # Fix SASToken names - - rename-model: - from: SASTokenParameter - to: SASTokenParameters - - from: swagger-document - where: $.definitions.RestoreOperationParameters.properties.sasTokenParameters - transform: $["x-ms-client-name"] = "SASTokenParameters" - - from: swagger-document - where: $.definitions.SelectiveKeyRestoreOperationParameters.properties.sasTokenParameters - transform: $["x-ms-client-name"] = "SASTokenParameters" - - # make SASToken parameter required - - from: swagger-document - where: $.paths["/backup"].post.parameters[0] - transform: $["required"] = true - - # delete backup and restore status methods - - from: swagger-document - where: $["paths"] - transform: > - delete $["/backup/{jobId}/pending"]; - - from: swagger-document - where: $["paths"] - transform: > - delete $["/restore/{jobId}/pending"]; - - # delete unused error models - - from: models.go - where: $ - transform: return $.replace(/(?:\/\/.*\s)+type (?:Error|KeyVaultError).+\{(?:\s.+\s)+\}\s/g, ""); - - from: models_serde.go - where: $ - transform: return $.replace(/(?:\/\/.*\s)+func \(\w \*?(?:Error|KeyVaultError)\).*\{\s(?:.+\s)+\}\s/g, ""); - - from: models.go - where: $ - transform: return $.replace(/Error \*Error/g, "Error *ErrorInfo"); - - # modify Restore to use implementation with custom poller handler - - from: client.go - where: $ - transform: return $.replace(/\[ClientFullRestoreResponse\], error\) \{\s(?:.+\s)+\}/, "[ClientFullRestoreResponse], error) {return client.beginFullRestore(ctx, restoreBlobDetails, options)}"); - - from: client.go - where: $ - transform: return $.replace(/\[ClientSelectiveKeyRestoreResponse\], error\) \{\s(?:.+\s)+\}/, "[ClientSelectiveKeyRestoreResponse], error) {return client.beginSelectiveKeyRestore(ctx, keyName, restoreBlobDetails, options)}"); - - # delete client name prefix from method options and response types - - from: - - client.go - - models.go - - options.go - - response_types.go - - options.go - where: $ - transform: return $.replace(/Client(\w+)((?:Options|Response))/g, "$1$2"); - - # add doc comments for models with missing descriptions - - from: swagger-document - where: $.definitions.SASTokenParameters - transform: $["description"] = "Contains the information required to access blob storage." - - from: swagger-document - where: $.definitions.RestoreOperationParameters - transform: $["description"] = "Parameters for the restore operation" - - from: swagger-document - where: $.definitions.SelectiveKeyRestoreOperationParameters - transform: $["description"] = "Parameters for the selective restore operation" - - # fix up span names - - from: client.go - where: $ - transform: return $.replace(/StartSpan\(ctx, "Client/g, "StartSpan(ctx, \"backup.Client"); -``` \ No newline at end of file diff --git a/sdk/security/keyvault/azadmin/backup/client.go b/sdk/security/keyvault/azadmin/backup/client.go index cca3b07cc464..fe0bd38daa8f 100644 --- a/sdk/security/keyvault/azadmin/backup/client.go +++ b/sdk/security/keyvault/azadmin/backup/client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package backup @@ -19,11 +15,11 @@ import ( "strings" ) -// Client contains the methods for the Client group. +// Client contains the methods for the group. // Don't use this type directly, use a constructor function instead. type Client struct { - internal *azcore.Client - endpoint string + internal *azcore.Client + vaultBaseUrl string } // BeginFullBackup - Creates a full backup using a user-provided SAS token to an Azure blob storage container. @@ -31,8 +27,7 @@ type Client struct { // // Generated from API version 7.5 // - azureStorageBlobContainerURI - Azure blob shared access signature token pointing to a valid Azure blob container where -// full backup needs to be stored. This token needs to be valid for at least next 24 hours from the time of making -// this call +// full backup needs to be stored. This token needs to be valid for at least next 24 hours from the time of making this call. // - options - BeginFullBackupOptions contains the optional parameters for the Client.BeginFullBackup method. func (client *Client) BeginFullBackup(ctx context.Context, azureStorageBlobContainerURI SASTokenParameters, options *BeginFullBackupOptions) (*runtime.Poller[FullBackupResponse], error) { if options == nil || options.ResumeToken == "" { @@ -76,9 +71,11 @@ func (client *Client) fullBackup(ctx context.Context, azureStorageBlobContainerU } // fullBackupCreateRequest creates the FullBackup request. -func (client *Client) fullBackupCreateRequest(ctx context.Context, azureStorageBlobContainerURI SASTokenParameters, options *BeginFullBackupOptions) (*policy.Request, error) { +func (client *Client) fullBackupCreateRequest(ctx context.Context, azureStorageBlobContainerURI SASTokenParameters, _ *BeginFullBackupOptions) (*policy.Request, error) { + host := "{vaultBaseUrl}" + host = strings.ReplaceAll(host, "{vaultBaseUrl}", client.vaultBaseUrl) urlPath := "/backup" - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.endpoint, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath)) if err != nil { return nil, err } @@ -86,6 +83,7 @@ func (client *Client) fullBackupCreateRequest(ctx context.Context, azureStorageB reqQP.Set("api-version", "7.5") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, azureStorageBlobContainerURI); err != nil { return nil, err } @@ -97,7 +95,7 @@ func (client *Client) fullBackupCreateRequest(ctx context.Context, azureStorageB // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 7.5 -// - restoreBlobDetails - The Azure blob SAS token pointing to a folder where the previous successful full backup was stored +// - restoreBlobDetails - The Azure blob SAS token pointing to a folder where the previous successful full backup was stored. // - options - BeginFullRestoreOptions contains the optional parameters for the Client.BeginFullRestore method. func (client *Client) BeginFullRestore(ctx context.Context, restoreBlobDetails RestoreOperationParameters, options *BeginFullRestoreOptions) (*runtime.Poller[FullRestoreResponse], error) { return client.beginFullRestore(ctx, restoreBlobDetails, options) @@ -128,9 +126,11 @@ func (client *Client) fullRestore(ctx context.Context, restoreBlobDetails Restor } // fullRestoreCreateRequest creates the FullRestore request. -func (client *Client) fullRestoreCreateRequest(ctx context.Context, restoreBlobDetails RestoreOperationParameters, options *BeginFullRestoreOptions) (*policy.Request, error) { +func (client *Client) fullRestoreCreateRequest(ctx context.Context, restoreBlobDetails RestoreOperationParameters, _ *BeginFullRestoreOptions) (*policy.Request, error) { + host := "{vaultBaseUrl}" + host = strings.ReplaceAll(host, "{vaultBaseUrl}", client.vaultBaseUrl) urlPath := "/restore" - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.endpoint, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(host, urlPath)) if err != nil { return nil, err } @@ -138,6 +138,7 @@ func (client *Client) fullRestoreCreateRequest(ctx context.Context, restoreBlobD reqQP.Set("api-version", "7.5") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, restoreBlobDetails); err != nil { return nil, err } @@ -151,8 +152,7 @@ func (client *Client) fullRestoreCreateRequest(ctx context.Context, restoreBlobD // Generated from API version 7.5 // - keyName - The name of the key to be restored from the user supplied backup // - restoreBlobDetails - The Azure blob SAS token pointing to a folder where the previous successful full backup was stored -// - options - BeginSelectiveKeyRestoreOptions contains the optional parameters for the Client.BeginSelectiveKeyRestore -// method. +// - options - BeginSelectiveKeyRestoreOptions contains the optional parameters for the Client.BeginSelectiveKeyRestore method. func (client *Client) BeginSelectiveKeyRestore(ctx context.Context, keyName string, restoreBlobDetails SelectiveKeyRestoreOperationParameters, options *BeginSelectiveKeyRestoreOptions) (*runtime.Poller[SelectiveKeyRestoreResponse], error) { return client.beginSelectiveKeyRestore(ctx, keyName, restoreBlobDetails, options) } @@ -182,13 +182,15 @@ func (client *Client) selectiveKeyRestore(ctx context.Context, keyName string, r } // selectiveKeyRestoreCreateRequest creates the SelectiveKeyRestore request. -func (client *Client) selectiveKeyRestoreCreateRequest(ctx context.Context, keyName string, restoreBlobDetails SelectiveKeyRestoreOperationParameters, options *BeginSelectiveKeyRestoreOptions) (*policy.Request, error) { +func (client *Client) selectiveKeyRestoreCreateRequest(ctx context.Context, keyName string, restoreBlobDetails SelectiveKeyRestoreOperationParameters, _ *BeginSelectiveKeyRestoreOptions) (*policy.Request, error) { + host := "{vaultBaseUrl}" + host = strings.ReplaceAll(host, "{vaultBaseUrl}", client.vaultBaseUrl) urlPath := "/keys/{keyName}/restore" if keyName == "" { return nil, errors.New("parameter keyName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{keyName}", url.PathEscape(keyName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.endpoint, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(host, urlPath)) if err != nil { return nil, err } @@ -196,6 +198,7 @@ func (client *Client) selectiveKeyRestoreCreateRequest(ctx context.Context, keyN reqQP.Set("api-version", "7.5") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, restoreBlobDetails); err != nil { return nil, err } diff --git a/sdk/security/keyvault/azadmin/backup/client_test.go b/sdk/security/keyvault/azadmin/backup/client_test.go index 427f1044a3eb..2e2e0bedaff7 100644 --- a/sdk/security/keyvault/azadmin/backup/client_test.go +++ b/sdk/security/keyvault/azadmin/backup/client_test.go @@ -1,8 +1,5 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. +// Licensed under the MIT License. See License.txt in the project root for license information. package backup_test diff --git a/sdk/security/keyvault/azadmin/backup/custom_client.go b/sdk/security/keyvault/azadmin/backup/custom_client.go index 3878b5b380b4..0ddefb840dd1 100644 --- a/sdk/security/keyvault/azadmin/backup/custom_client.go +++ b/sdk/security/keyvault/azadmin/backup/custom_client.go @@ -1,6 +1,3 @@ -//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. @@ -56,7 +53,7 @@ func NewClient(vaultURL string, credential azcore.TokenCredential, options *Clie if err != nil { return nil, err } - return &Client{endpoint: vaultURL, internal: azcoreClient}, nil + return &Client{vaultBaseUrl: vaultURL, internal: azcoreClient}, nil } // ErrorInfo - Internal error from Azure Key Vault server. @@ -98,17 +95,21 @@ func (client *Client) beginFullRestore(ctx context.Context, restoreBlobDetails R if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FullRestoreResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FullRestoreResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, Handler: handler, Tracer: client.internal.Tracer(), }) + return poller, err } else { handler, err := pollers.NewRestorePoller[FullRestoreResponse](client.internal.Pipeline(), nil, runtime.FinalStateViaAzureAsyncOp) if err != nil { return nil, err } - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FullRestoreResponse]{Handler: handler}) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FullRestoreResponse]{ + Handler: handler, + Tracer: client.internal.Tracer(), + }) } } @@ -124,16 +125,20 @@ func (client *Client) beginSelectiveKeyRestore(ctx context.Context, keyName stri if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SelectiveKeyRestoreResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SelectiveKeyRestoreResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, Handler: handler, Tracer: client.internal.Tracer(), }) + return poller, err } else { handler, err := pollers.NewRestorePoller[SelectiveKeyRestoreResponse](client.internal.Pipeline(), nil, runtime.FinalStateViaAzureAsyncOp) if err != nil { return nil, err } - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SelectiveKeyRestoreResponse]{Handler: handler}) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SelectiveKeyRestoreResponse]{ + Handler: handler, + Tracer: client.internal.Tracer(), + }) } } diff --git a/sdk/security/keyvault/azadmin/backup/example_test.go b/sdk/security/keyvault/azadmin/backup/example_test.go index 7d5e7e51c2c0..56e7945c5cb6 100644 --- a/sdk/security/keyvault/azadmin/backup/example_test.go +++ b/sdk/security/keyvault/azadmin/backup/example_test.go @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. +// Licensed under the MIT License. See License.txt in the project root for license information. package backup_test diff --git a/sdk/security/keyvault/azadmin/backup/internal/pollers/restore_poller.go b/sdk/security/keyvault/azadmin/backup/internal/pollers/restore_poller.go index 19a2df85c2af..6971b4601970 100644 --- a/sdk/security/keyvault/azadmin/backup/internal/pollers/restore_poller.go +++ b/sdk/security/keyvault/azadmin/backup/internal/pollers/restore_poller.go @@ -1,6 +1,3 @@ -//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. diff --git a/sdk/security/keyvault/azadmin/backup/models.go b/sdk/security/keyvault/azadmin/backup/models.go index 4b54990aa75f..47a39b616d9b 100644 --- a/sdk/security/keyvault/azadmin/backup/models.go +++ b/sdk/security/keyvault/azadmin/backup/models.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package backup @@ -55,16 +51,16 @@ type RestoreOperation struct { StatusDetails *string } -// RestoreOperationParameters - Parameters for the restore operation +// RestoreOperationParameters - The authentication method and location for the restore operation. type RestoreOperationParameters struct { // REQUIRED; The Folder name of the blob where the previous successful full backup was stored FolderToRestore *string - // REQUIRED; Contains the information required to access blob storage. + // REQUIRED; A user-provided SAS token to an Azure blob storage container. SASTokenParameters *SASTokenParameters } -// SASTokenParameters - Contains the information required to access blob storage. +// SASTokenParameters - An authentication method and location for the operation. type SASTokenParameters struct { // REQUIRED; Azure Blob storage container Uri StorageResourceURI *string @@ -73,8 +69,7 @@ type SASTokenParameters struct { Token *string // Indicates which authentication method should be used. If set to true, Managed HSM will use the configured user-assigned - // managed identity to authenticate with Azure Storage. Otherwise, a SAS token has - // to be specified. + // managed identity to authenticate with Azure Storage. Otherwise, a SAS token has to be specified. UseManagedIdentity *bool } @@ -99,11 +94,11 @@ type SelectiveKeyRestoreOperation struct { StatusDetails *string } -// SelectiveKeyRestoreOperationParameters - Parameters for the selective restore operation +// SelectiveKeyRestoreOperationParameters - The authentication method and location for the selective key restore operation. type SelectiveKeyRestoreOperationParameters struct { // REQUIRED; The Folder name of the blob where the previous successful full backup was stored Folder *string - // REQUIRED; Contains the information required to access blob storage. + // REQUIRED; A user-provided SAS token to an Azure blob storage container. SASTokenParameters *SASTokenParameters } diff --git a/sdk/security/keyvault/azadmin/backup/models_serde.go b/sdk/security/keyvault/azadmin/backup/models_serde.go index 0ce78096c93e..b00cdaf4f74b 100644 --- a/sdk/security/keyvault/azadmin/backup/models_serde.go +++ b/sdk/security/keyvault/azadmin/backup/models_serde.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package backup @@ -268,7 +264,7 @@ func populate(m map[string]any, k string, v any) { } 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/security/keyvault/azadmin/backup/options.go b/sdk/security/keyvault/azadmin/backup/options.go index 80beae988983..efed02f01220 100644 --- a/sdk/security/keyvault/azadmin/backup/options.go +++ b/sdk/security/keyvault/azadmin/backup/options.go @@ -1,27 +1,23 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package backup // BeginFullBackupOptions contains the optional parameters for the Client.BeginFullBackup method. type BeginFullBackupOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // BeginFullRestoreOptions contains the optional parameters for the Client.BeginFullRestore method. type BeginFullRestoreOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // BeginSelectiveKeyRestoreOptions contains the optional parameters for the Client.BeginSelectiveKeyRestore method. type BeginSelectiveKeyRestoreOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/security/keyvault/azadmin/backup/response_types.go b/sdk/security/keyvault/azadmin/backup/responses.go similarity index 78% rename from sdk/security/keyvault/azadmin/backup/response_types.go rename to sdk/security/keyvault/azadmin/backup/responses.go index f466288dce25..c1c7d3c2c48a 100644 --- a/sdk/security/keyvault/azadmin/backup/response_types.go +++ b/sdk/security/keyvault/azadmin/backup/responses.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package backup diff --git a/sdk/security/keyvault/azadmin/backup/time_unix.go b/sdk/security/keyvault/azadmin/backup/time_unix.go index ae6fea3c02eb..da4fa7964c87 100644 --- a/sdk/security/keyvault/azadmin/backup/time_unix.go +++ b/sdk/security/keyvault/azadmin/backup/time_unix.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package backup @@ -13,7 +9,6 @@ import ( "fmt" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" - "strings" "time" ) @@ -49,7 +44,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/security/keyvault/azadmin/backup/tsp-location.yaml b/sdk/security/keyvault/azadmin/backup/tsp-location.yaml new file mode 100644 index 000000000000..eeb60a1f7a10 --- /dev/null +++ b/sdk/security/keyvault/azadmin/backup/tsp-location.yaml @@ -0,0 +1,6 @@ +directory: specification/keyvault/Security.KeyVault.BackupRestore +commit: 70672ea0a1a550ee608aa4718598b71550d361df +repo: Azure/azure-rest-api-specs +additionalDirectories: +- specification/keyvault/Security.KeyVault.Common/ +# https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/Security.KeyVault.BackupRestore \ No newline at end of file diff --git a/sdk/security/keyvault/azadmin/backup/utils_test.go b/sdk/security/keyvault/azadmin/backup/utils_test.go index 259d2d6adac8..fdb17545d39d 100644 --- a/sdk/security/keyvault/azadmin/backup/utils_test.go +++ b/sdk/security/keyvault/azadmin/backup/utils_test.go @@ -1,8 +1,5 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. +// Licensed under the MIT License. See License.txt in the project root for license information. package backup_test diff --git a/sdk/security/keyvault/azadmin/build.go b/sdk/security/keyvault/azadmin/build.go index c0507290fc2f..6d779f5a9d7e 100644 --- a/sdk/security/keyvault/azadmin/build.go +++ b/sdk/security/keyvault/azadmin/build.go @@ -1,10 +1,12 @@ -//go:build go1.18 -// +build go1.18 - -//go:generate autorest ./settings/autorest.md -//go:generate autorest ./rbac/autorest.md -//go:generate autorest ./backup/autorest.md +//go:generate tsp-client update --output-dir ./settings +//go:generate tsp-client update --output-dir ./rbac +//go:generate tsp-client update --output-dir ./backup +//go:generate go run ./internal/generate/transforms.go //go:generate gofmt -w . +//go:generate rm ./backup/constants.go +//go:generate rm ./backup/go.mod +//go:generate rm ./rbac/go.mod +//go:generate rm ./settings/go.mod // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/security/keyvault/azadmin/internal/generate/transforms.go b/sdk/security/keyvault/azadmin/internal/generate/transforms.go new file mode 100644 index 000000000000..182e39e43b8d --- /dev/null +++ b/sdk/security/keyvault/azadmin/internal/generate/transforms.go @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +package main + +import ( + "log" + "os" + "regexp" +) + +// removing client prefix from types +func regexReplace(fileName string, regex string, replace string) { + file, err := os.ReadFile(fileName) + if err != nil { + log.Fatal(err) + } + + r := regexp.MustCompile(regex) + file = r.ReplaceAll(file, []byte(replace)) + + err = os.WriteFile(fileName, file, 0644) + if err != nil { + log.Fatal(err) + } +} + +func main() { + // settings + // fix up span names + regexReplace("settings/client.go", `StartSpan\(ctx, "Client`, `StartSpan(ctx, "settings.Client`) + + // rbac + // change type of scope parameter from string to RoleScope + regexReplace("rbac/client.go", `scope string`, "scope RoleScope") + regexReplace("rbac/client.go", `scope\)`, "string(scope))") + + // fix up span names + regexReplace("rbac/client.go", `StartSpan\(ctx, "Client`, `StartSpan(ctx, "rbac.Client`) + + // backup restore + // change type of Error from Error to ErrorInfo + // delete error struct + regexReplace("backup/models.go", `Error \*Error`, "Error *ErrorInfo") + regexReplace("backup/models.go", `(?:\/\/.*\s)+type Error struct.+\{(?:\s.+\s)+\}`, "") + regexReplace("backup/models_serde.go", `(?:\/\/.*\s)+func \(\w \*?Error\).*\{\s(?:.+\s)+\}\s`, "") + + // modify Restore to use implementation with custom poller handler + regexReplace("backup/client.go", `\[FullRestoreResponse\], error\) \{\s(?:.+\s)+\}`, "[FullRestoreResponse], error) {return client.beginFullRestore(ctx, restoreBlobDetails, options)}") + regexReplace("backup/client.go", `\[SelectiveKeyRestoreResponse\], error\) \{\s(?:.+\s)+\}`, "[SelectiveKeyRestoreResponse], error) {return client.beginSelectiveKeyRestore(ctx, keyName, restoreBlobDetails, options)}") + + // remove OperationStatus + regexReplace("backup/models.go", `OperationStatus`, "string") + + // replace FullBackupOperationError with ErrorInfo + regexReplace("backup/models.go", `type FullBackupOperationError.+\{(?:\s.+\s)+\}\s`, "") + regexReplace("backup/models_serde.go", `(?:\/\/.*\s)+func \(\w \*?FullBackupOperationError\).*\{\s(?:.+\s)+\}\s`, "") + regexReplace("backup/models.go", `FullBackupOperationError`, "ErrorInfo") + + // fix up span names + regexReplace("backup/client.go", `StartSpan\(ctx, "Client`, `StartSpan(ctx, "backup.Client`) +} diff --git a/sdk/security/keyvault/azadmin/internal/version.go b/sdk/security/keyvault/azadmin/internal/version.go index 48b65e2411cf..1e6c894ae096 100644 --- a/sdk/security/keyvault/azadmin/internal/version.go +++ b/sdk/security/keyvault/azadmin/internal/version.go @@ -1,8 +1,5 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. +// Licensed under the MIT License. See License.txt in the project root for license information. package internal diff --git a/sdk/security/keyvault/azadmin/rbac/autorest.md b/sdk/security/keyvault/azadmin/rbac/autorest.md deleted file mode 100644 index 9bcc87c80b0c..000000000000 --- a/sdk/security/keyvault/azadmin/rbac/autorest.md +++ /dev/null @@ -1,89 +0,0 @@ -## Go - -```yaml -clear-output-folder: false -export-clients: true -go: true -input-file: https://github.com/Azure/azure-rest-api-specs/blob/7452e1cc7db72fbc6cd9539b390d8b8e5c2a1864/specification/keyvault/data-plane/Microsoft.KeyVault/stable/7.5/rbac.json -license-header: MICROSOFT_MIT_NO_VERSION -openapi-type: "data-plane" -output-folder: ../rbac -override-client-name: Client -security: "AADToken" -security-scopes: "https://vault.azure.net/.default" -use: "@autorest/go@4.0.0-preview.59" -inject-spans: true -version: "^3.0.0" - -directive: - - # make vault URL a parameter of the client constructor - - from: swagger-document - where: $["x-ms-parameterized-host"] - transform: $.parameters[0]["x-ms-parameter-location"] = "client" - - # rename role definition and role assignment operations so they will generate as one access control client - - rename-operation: - from: RoleDefinitions_Delete - to: DeleteRoleDefinition - - rename-operation: - from: RoleAssignments_Delete - to: DeleteRoleAssignment - - rename-operation: - from: RoleDefinitions_CreateOrUpdate - to: CreateOrUpdateRoleDefinition - - rename-operation: - from: RoleAssignments_Create - to: CreateRoleAssignment - - rename-operation: - from: RoleDefinitions_Get - to: GetRoleDefinition - - rename-operation: - from: RoleAssignments_Get - to: GetRoleAssignment - - rename-operation: - from: RoleDefinitions_List - to: ListRoleDefinitions - - rename-operation: - from: RoleAssignments_ListForScope - to: ListRoleAssignments - - # delete unused error models - - from: models.go - where: $ - transform: return $.replace(/(?:\/\/.*\s)+type (?:Error|KeyVaultError).+\{(?:\s.+\s)+\}\s/g, ""); - - from: models_serde.go - where: $ - transform: return $.replace(/(?:\/\/.*\s)+func \(\w \*?(?:Error|KeyVaultError)\).*\{\s(?:.+\s)+\}\s/g, ""); - - # delete unused filter models - - from: models.go - where: $ - transform: return $.replace(/(?:\/\/.*\s)+type (?:RoleAssignmentFilter|RoleDefinitionFilter).+\{(?:\s.+\s)+\}\s/g, ""); - - from: models_serde.go - where: $ - transform: return $.replace(/(?:\/\/.*\s)+func \(\w \*?(?:RoleAssignmentFilter|RoleDefinitionFilter)\).*\{\s(?:.+\s)+\}\s/g, ""); - - # change type of scope parameter from string to RoleScope - - from: client.go - where: $ - transform: return $.replace(/scope string/g, "scope RoleScope"); - - from: client.go - where: $ - transform: return $.replace(/scope\)/g, "string(scope))"); - - # delete client name prefix from method options and response types - - from: - - client.go - - models.go - - options.go - - response_types.go - - options.go - where: $ - transform: return $.replace(/Client(\w+)((?:Options|Response))/g, "$1$2"); - - # fix up span names - - from: client.go - where: $ - transform: return $.replace(/StartSpan\(ctx, "Client/g, "StartSpan(ctx, \"rbac.Client"); -``` \ No newline at end of file diff --git a/sdk/security/keyvault/azadmin/rbac/client.go b/sdk/security/keyvault/azadmin/rbac/client.go index 9d3c748f1e30..955795a6afd5 100644 --- a/sdk/security/keyvault/azadmin/rbac/client.go +++ b/sdk/security/keyvault/azadmin/rbac/client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package rbac @@ -19,11 +15,11 @@ import ( "strings" ) -// Client contains the methods for the Client group. +// Client contains the methods for the group. // Don't use this type directly, use a constructor function instead. type Client struct { - internal *azcore.Client - endpoint string + internal *azcore.Client + vaultBaseUrl string } // CreateOrUpdateRoleDefinition - Creates or updates a custom role definition. @@ -56,14 +52,16 @@ func (client *Client) CreateOrUpdateRoleDefinition(ctx context.Context, scope Ro } // createOrUpdateRoleDefinitionCreateRequest creates the CreateOrUpdateRoleDefinition request. -func (client *Client) createOrUpdateRoleDefinitionCreateRequest(ctx context.Context, scope RoleScope, roleDefinitionName string, parameters RoleDefinitionCreateParameters, options *CreateOrUpdateRoleDefinitionOptions) (*policy.Request, error) { +func (client *Client) createOrUpdateRoleDefinitionCreateRequest(ctx context.Context, scope RoleScope, roleDefinitionName string, parameters RoleDefinitionCreateParameters, _ *CreateOrUpdateRoleDefinitionOptions) (*policy.Request, error) { + host := "{vaultBaseUrl}" + host = strings.ReplaceAll(host, "{vaultBaseUrl}", client.vaultBaseUrl) urlPath := "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}" urlPath = strings.ReplaceAll(urlPath, "{scope}", string(scope)) if roleDefinitionName == "" { return nil, errors.New("parameter roleDefinitionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{roleDefinitionName}", url.PathEscape(roleDefinitionName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.endpoint, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(host, urlPath)) if err != nil { return nil, err } @@ -71,6 +69,7 @@ func (client *Client) createOrUpdateRoleDefinitionCreateRequest(ctx context.Cont reqQP.Set("api-version", "7.5") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -115,14 +114,16 @@ func (client *Client) CreateRoleAssignment(ctx context.Context, scope RoleScope, } // createRoleAssignmentCreateRequest creates the CreateRoleAssignment request. -func (client *Client) createRoleAssignmentCreateRequest(ctx context.Context, scope RoleScope, roleAssignmentName string, parameters RoleAssignmentCreateParameters, options *CreateRoleAssignmentOptions) (*policy.Request, error) { +func (client *Client) createRoleAssignmentCreateRequest(ctx context.Context, scope RoleScope, roleAssignmentName string, parameters RoleAssignmentCreateParameters, _ *CreateRoleAssignmentOptions) (*policy.Request, error) { + host := "{vaultBaseUrl}" + host = strings.ReplaceAll(host, "{vaultBaseUrl}", client.vaultBaseUrl) urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}" urlPath = strings.ReplaceAll(urlPath, "{scope}", string(scope)) if roleAssignmentName == "" { return nil, errors.New("parameter roleAssignmentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentName}", url.PathEscape(roleAssignmentName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.endpoint, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(host, urlPath)) if err != nil { return nil, err } @@ -130,6 +131,7 @@ func (client *Client) createRoleAssignmentCreateRequest(ctx context.Context, sco reqQP.Set("api-version", "7.5") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -173,14 +175,16 @@ func (client *Client) DeleteRoleAssignment(ctx context.Context, scope RoleScope, } // deleteRoleAssignmentCreateRequest creates the DeleteRoleAssignment request. -func (client *Client) deleteRoleAssignmentCreateRequest(ctx context.Context, scope RoleScope, roleAssignmentName string, options *DeleteRoleAssignmentOptions) (*policy.Request, error) { +func (client *Client) deleteRoleAssignmentCreateRequest(ctx context.Context, scope RoleScope, roleAssignmentName string, _ *DeleteRoleAssignmentOptions) (*policy.Request, error) { + host := "{vaultBaseUrl}" + host = strings.ReplaceAll(host, "{vaultBaseUrl}", client.vaultBaseUrl) urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}" urlPath = strings.ReplaceAll(urlPath, "{scope}", string(scope)) if roleAssignmentName == "" { return nil, errors.New("parameter roleAssignmentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentName}", url.PathEscape(roleAssignmentName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.endpoint, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(host, urlPath)) if err != nil { return nil, err } @@ -228,14 +232,16 @@ func (client *Client) DeleteRoleDefinition(ctx context.Context, scope RoleScope, } // deleteRoleDefinitionCreateRequest creates the DeleteRoleDefinition request. -func (client *Client) deleteRoleDefinitionCreateRequest(ctx context.Context, scope RoleScope, roleDefinitionName string, options *DeleteRoleDefinitionOptions) (*policy.Request, error) { +func (client *Client) deleteRoleDefinitionCreateRequest(ctx context.Context, scope RoleScope, roleDefinitionName string, _ *DeleteRoleDefinitionOptions) (*policy.Request, error) { + host := "{vaultBaseUrl}" + host = strings.ReplaceAll(host, "{vaultBaseUrl}", client.vaultBaseUrl) urlPath := "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}" urlPath = strings.ReplaceAll(urlPath, "{scope}", string(scope)) if roleDefinitionName == "" { return nil, errors.New("parameter roleDefinitionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{roleDefinitionName}", url.PathEscape(roleDefinitionName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.endpoint, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(host, urlPath)) if err != nil { return nil, err } @@ -283,14 +289,16 @@ func (client *Client) GetRoleAssignment(ctx context.Context, scope RoleScope, ro } // getRoleAssignmentCreateRequest creates the GetRoleAssignment request. -func (client *Client) getRoleAssignmentCreateRequest(ctx context.Context, scope RoleScope, roleAssignmentName string, options *GetRoleAssignmentOptions) (*policy.Request, error) { +func (client *Client) getRoleAssignmentCreateRequest(ctx context.Context, scope RoleScope, roleAssignmentName string, _ *GetRoleAssignmentOptions) (*policy.Request, error) { + host := "{vaultBaseUrl}" + host = strings.ReplaceAll(host, "{vaultBaseUrl}", client.vaultBaseUrl) urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}" urlPath = strings.ReplaceAll(urlPath, "{scope}", string(scope)) if roleAssignmentName == "" { return nil, errors.New("parameter roleAssignmentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentName}", url.PathEscape(roleAssignmentName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.endpoint, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath)) if err != nil { return nil, err } @@ -338,14 +346,16 @@ func (client *Client) GetRoleDefinition(ctx context.Context, scope RoleScope, ro } // getRoleDefinitionCreateRequest creates the GetRoleDefinition request. -func (client *Client) getRoleDefinitionCreateRequest(ctx context.Context, scope RoleScope, roleDefinitionName string, options *GetRoleDefinitionOptions) (*policy.Request, error) { +func (client *Client) getRoleDefinitionCreateRequest(ctx context.Context, scope RoleScope, roleDefinitionName string, _ *GetRoleDefinitionOptions) (*policy.Request, error) { + host := "{vaultBaseUrl}" + host = strings.ReplaceAll(host, "{vaultBaseUrl}", client.vaultBaseUrl) urlPath := "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}" urlPath = strings.ReplaceAll(urlPath, "{scope}", string(scope)) if roleDefinitionName == "" { return nil, errors.New("parameter roleDefinitionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{roleDefinitionName}", url.PathEscape(roleDefinitionName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.endpoint, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath)) if err != nil { return nil, err } @@ -369,8 +379,7 @@ func (client *Client) getRoleDefinitionHandleResponse(resp *http.Response) (GetR // // Generated from API version 7.5 // - scope - The scope of the role assignments. -// - options - ListRoleAssignmentsOptions contains the optional parameters for the Client.NewListRoleAssignmentsPager -// method. +// - options - ListRoleAssignmentsOptions contains the optional parameters for the Client.NewListRoleAssignmentsPager method. func (client *Client) NewListRoleAssignmentsPager(scope RoleScope, options *ListRoleAssignmentsOptions) *runtime.Pager[ListRoleAssignmentsResponse] { return runtime.NewPager(runtime.PagingHandler[ListRoleAssignmentsResponse]{ More: func(page ListRoleAssignmentsResponse) bool { @@ -395,9 +404,11 @@ func (client *Client) NewListRoleAssignmentsPager(scope RoleScope, options *List // listRoleAssignmentsCreateRequest creates the ListRoleAssignments request. func (client *Client) listRoleAssignmentsCreateRequest(ctx context.Context, scope RoleScope, options *ListRoleAssignmentsOptions) (*policy.Request, error) { + host := "{vaultBaseUrl}" + host = strings.ReplaceAll(host, "{vaultBaseUrl}", client.vaultBaseUrl) urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignments" urlPath = strings.ReplaceAll(urlPath, "{scope}", string(scope)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.endpoint, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath)) if err != nil { return nil, err } @@ -424,8 +435,7 @@ func (client *Client) listRoleAssignmentsHandleResponse(resp *http.Response) (Li // // Generated from API version 7.5 // - scope - The scope of the role definition. -// - options - ListRoleDefinitionsOptions contains the optional parameters for the Client.NewListRoleDefinitionsPager -// method. +// - options - ListRoleDefinitionsOptions contains the optional parameters for the Client.NewListRoleDefinitionsPager method. func (client *Client) NewListRoleDefinitionsPager(scope RoleScope, options *ListRoleDefinitionsOptions) *runtime.Pager[ListRoleDefinitionsResponse] { return runtime.NewPager(runtime.PagingHandler[ListRoleDefinitionsResponse]{ More: func(page ListRoleDefinitionsResponse) bool { @@ -450,9 +460,11 @@ func (client *Client) NewListRoleDefinitionsPager(scope RoleScope, options *List // listRoleDefinitionsCreateRequest creates the ListRoleDefinitions request. func (client *Client) listRoleDefinitionsCreateRequest(ctx context.Context, scope RoleScope, options *ListRoleDefinitionsOptions) (*policy.Request, error) { + host := "{vaultBaseUrl}" + host = strings.ReplaceAll(host, "{vaultBaseUrl}", client.vaultBaseUrl) urlPath := "/{scope}/providers/Microsoft.Authorization/roleDefinitions" urlPath = strings.ReplaceAll(urlPath, "{scope}", string(scope)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.endpoint, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath)) if err != nil { return nil, err } diff --git a/sdk/security/keyvault/azadmin/rbac/client_test.go b/sdk/security/keyvault/azadmin/rbac/client_test.go index cb9fa8e58777..2a0b8d48aaa8 100644 --- a/sdk/security/keyvault/azadmin/rbac/client_test.go +++ b/sdk/security/keyvault/azadmin/rbac/client_test.go @@ -1,8 +1,5 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. +// Licensed under the MIT License. See License.txt in the project root for license information. package rbac_test diff --git a/sdk/security/keyvault/azadmin/rbac/constants.go b/sdk/security/keyvault/azadmin/rbac/constants.go index b97cffa8befb..66a48eb59b44 100644 --- a/sdk/security/keyvault/azadmin/rbac/constants.go +++ b/sdk/security/keyvault/azadmin/rbac/constants.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package rbac @@ -126,6 +122,7 @@ func PossibleDataActionValues() []DataAction { type RoleDefinitionType string const ( + // RoleDefinitionTypeMicrosoftAuthorizationRoleDefinitions - Microsoft-defined role definitions. RoleDefinitionTypeMicrosoftAuthorizationRoleDefinitions RoleDefinitionType = "Microsoft.Authorization/roleDefinitions" ) diff --git a/sdk/security/keyvault/azadmin/rbac/custom_client.go b/sdk/security/keyvault/azadmin/rbac/custom_client.go index d7f2df6ce273..d49fd8510a54 100644 --- a/sdk/security/keyvault/azadmin/rbac/custom_client.go +++ b/sdk/security/keyvault/azadmin/rbac/custom_client.go @@ -1,6 +1,3 @@ -//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. @@ -51,5 +48,5 @@ func NewClient(vaultURL string, credential azcore.TokenCredential, options *Clie if err != nil { return nil, err } - return &Client{endpoint: vaultURL, internal: azcoreClient}, nil + return &Client{vaultBaseUrl: vaultURL, internal: azcoreClient}, nil } diff --git a/sdk/security/keyvault/azadmin/rbac/example_test.go b/sdk/security/keyvault/azadmin/rbac/example_test.go index 0c2ff5c14f31..8a1515728767 100644 --- a/sdk/security/keyvault/azadmin/rbac/example_test.go +++ b/sdk/security/keyvault/azadmin/rbac/example_test.go @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. +// Licensed under the MIT License. See License.txt in the project root for license information. package rbac_test diff --git a/sdk/security/keyvault/azadmin/rbac/models.go b/sdk/security/keyvault/azadmin/rbac/models.go index d02fe348e76a..89a2eb134bb6 100644 --- a/sdk/security/keyvault/azadmin/rbac/models.go +++ b/sdk/security/keyvault/azadmin/rbac/models.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package rbac diff --git a/sdk/security/keyvault/azadmin/rbac/models_serde.go b/sdk/security/keyvault/azadmin/rbac/models_serde.go index 48fcfe88f276..794635e78651 100644 --- a/sdk/security/keyvault/azadmin/rbac/models_serde.go +++ b/sdk/security/keyvault/azadmin/rbac/models_serde.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package rbac @@ -368,7 +364,7 @@ func populate(m map[string]any, k string, v any) { } 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/security/keyvault/azadmin/rbac/options.go b/sdk/security/keyvault/azadmin/rbac/options.go index a08ebaf56fe8..af5e0368ec2d 100644 --- a/sdk/security/keyvault/azadmin/rbac/options.go +++ b/sdk/security/keyvault/azadmin/rbac/options.go @@ -1,15 +1,10 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package rbac -// CreateOrUpdateRoleDefinitionOptions contains the optional parameters for the Client.CreateOrUpdateRoleDefinition -// method. +// CreateOrUpdateRoleDefinitionOptions contains the optional parameters for the Client.CreateOrUpdateRoleDefinition method. type CreateOrUpdateRoleDefinitionOptions struct { // placeholder for future optional parameters } @@ -42,8 +37,7 @@ type GetRoleDefinitionOptions struct { // ListRoleAssignmentsOptions contains the optional parameters for the Client.NewListRoleAssignmentsPager method. type ListRoleAssignmentsOptions struct { // The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId - // eq {id} to return all role assignments at, above or below the - // scope for the specified principal. + // eq {id} to return all role assignments at, above or below the scope for the specified principal. Filter *string } diff --git a/sdk/security/keyvault/azadmin/rbac/response_types.go b/sdk/security/keyvault/azadmin/rbac/responses.go similarity index 89% rename from sdk/security/keyvault/azadmin/rbac/response_types.go rename to sdk/security/keyvault/azadmin/rbac/responses.go index 20ff6100d849..9446ea6a288e 100644 --- a/sdk/security/keyvault/azadmin/rbac/response_types.go +++ b/sdk/security/keyvault/azadmin/rbac/responses.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package rbac diff --git a/sdk/security/keyvault/azadmin/rbac/tsp-location.yaml b/sdk/security/keyvault/azadmin/rbac/tsp-location.yaml new file mode 100644 index 000000000000..a45902a14d6d --- /dev/null +++ b/sdk/security/keyvault/azadmin/rbac/tsp-location.yaml @@ -0,0 +1,6 @@ +directory: specification/keyvault/Security.KeyVault.RBAC +commit: 70672ea0a1a550ee608aa4718598b71550d361df +repo: Azure/azure-rest-api-specs +additionalDirectories: +- specification/keyvault/Security.KeyVault.Common/ +# https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/Security.KeyVault.RBAC \ No newline at end of file diff --git a/sdk/security/keyvault/azadmin/rbac/utils_test.go b/sdk/security/keyvault/azadmin/rbac/utils_test.go index 09f0a5457b76..8d5219c2e6ce 100644 --- a/sdk/security/keyvault/azadmin/rbac/utils_test.go +++ b/sdk/security/keyvault/azadmin/rbac/utils_test.go @@ -1,8 +1,5 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. +// Licensed under the MIT License. See License.txt in the project root for license information. package rbac_test diff --git a/sdk/security/keyvault/azadmin/settings/autorest.md b/sdk/security/keyvault/azadmin/settings/autorest.md deleted file mode 100644 index 84f38ac4f09d..000000000000 --- a/sdk/security/keyvault/azadmin/settings/autorest.md +++ /dev/null @@ -1,58 +0,0 @@ -## Go - -```yaml -clear-output-folder: false -export-clients: true -go: true -input-file: - - https://github.com/Azure/azure-rest-api-specs/blob/7452e1cc7db72fbc6cd9539b390d8b8e5c2a1864/specification/keyvault/data-plane/Microsoft.KeyVault/stable/7.5/settings.json -license-header: MICROSOFT_MIT_NO_VERSION -openapi-type: "data-plane" -output-folder: ../settings -override-client-name: Client -security: "AADToken" -security-scopes: "https://vault.azure.net/.default" -use: "@autorest/go@4.0.0-preview.59" -inject-spans: true -version: "^3.0.0" - -directive: - - # make vault URL a parameter of the client constructor - - from: swagger-document - where: $["x-ms-parameterized-host"] - transform: $.parameters[0]["x-ms-parameter-location"] = "client" - - # delete unused error models - - from: models.go - where: $ - transform: return $.replace(/(?:\/\/.*\s)+type (?:Error|KeyVaultError).+\{(?:\s.+\s)+\}\s/g, ""); - - from: models_serde.go - where: $ - transform: return $.replace(/(?:\/\/.*\s)+func \(\w \*?(?:Error|KeyVaultError)\).*\{\s(?:.+\s)+\}\s/g, ""); - - # delete client name prefix from method options and response types - - from: - - client.go - - models.go - - options.go - - response_types.go - - options.go - where: $ - transform: return $.replace(/Client(\w+)((?:Options|Response))/g, "$1$2"); - - # add doc comment for Setting - - from: swagger-document - where: $.definitions.Setting - transform: $["description"] = "A Key Vault setting." - - # remane SettingTypeEnum to SettingType - - from: swagger-document - where: $.definitions.Setting.properties.type.x-ms-enum - transform: $["name"] = "SettingType" - - # fix up span names - - from: client.go - where: $ - transform: return $.replace(/StartSpan\(ctx, "Client/g, "StartSpan(ctx, \"settings.Client"); -``` diff --git a/sdk/security/keyvault/azadmin/settings/client.go b/sdk/security/keyvault/azadmin/settings/client.go index a455ac171511..a4e2e1a0ce9d 100644 --- a/sdk/security/keyvault/azadmin/settings/client.go +++ b/sdk/security/keyvault/azadmin/settings/client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package settings @@ -19,14 +15,16 @@ import ( "strings" ) -// Client contains the methods for the Client group. +// Client - The key vault client performs cryptographic key operations and vault operations against the Key Vault service. // Don't use this type directly, use a constructor function instead. type Client struct { - internal *azcore.Client - endpoint string + internal *azcore.Client + vaultBaseUrl string } -// GetSetting - Retrieves the setting object of a specified setting name. +// GetSetting - Get specified account setting object. +// +// Retrieves the setting object of a specified setting name. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 7.5 @@ -53,13 +51,15 @@ func (client *Client) GetSetting(ctx context.Context, settingName string, option } // getSettingCreateRequest creates the GetSetting request. -func (client *Client) getSettingCreateRequest(ctx context.Context, settingName string, options *GetSettingOptions) (*policy.Request, error) { +func (client *Client) getSettingCreateRequest(ctx context.Context, settingName string, _ *GetSettingOptions) (*policy.Request, error) { + host := "{vaultBaseUrl}" + host = strings.ReplaceAll(host, "{vaultBaseUrl}", client.vaultBaseUrl) urlPath := "/settings/{setting-name}" if settingName == "" { return nil, errors.New("parameter settingName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{setting-name}", url.PathEscape(settingName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.endpoint, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath)) if err != nil { return nil, err } @@ -79,7 +79,9 @@ func (client *Client) getSettingHandleResponse(resp *http.Response) (GetSettingR return result, nil } -// GetSettings - Retrieves a list of all the available account settings that can be configured. +// GetSettings - List account settings. +// +// Retrieves a list of all the available account settings that can be configured. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 7.5 @@ -105,9 +107,11 @@ func (client *Client) GetSettings(ctx context.Context, options *GetSettingsOptio } // getSettingsCreateRequest creates the GetSettings request. -func (client *Client) getSettingsCreateRequest(ctx context.Context, options *GetSettingsOptions) (*policy.Request, error) { +func (client *Client) getSettingsCreateRequest(ctx context.Context, _ *GetSettingsOptions) (*policy.Request, error) { + host := "{vaultBaseUrl}" + host = strings.ReplaceAll(host, "{vaultBaseUrl}", client.vaultBaseUrl) urlPath := "/settings" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.endpoint, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath)) if err != nil { return nil, err } @@ -127,7 +131,9 @@ func (client *Client) getSettingsHandleResponse(resp *http.Response) (GetSetting return result, nil } -// UpdateSetting - Description of the pool setting to be updated +// UpdateSetting - Updates key vault account setting, stores it, then returns the setting name and value to the client. +// +// Description of the pool setting to be updated // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 7.5 @@ -155,13 +161,15 @@ func (client *Client) UpdateSetting(ctx context.Context, settingName string, par } // updateSettingCreateRequest creates the UpdateSetting request. -func (client *Client) updateSettingCreateRequest(ctx context.Context, settingName string, parameters UpdateSettingRequest, options *UpdateSettingOptions) (*policy.Request, error) { +func (client *Client) updateSettingCreateRequest(ctx context.Context, settingName string, parameters UpdateSettingRequest, _ *UpdateSettingOptions) (*policy.Request, error) { + host := "{vaultBaseUrl}" + host = strings.ReplaceAll(host, "{vaultBaseUrl}", client.vaultBaseUrl) urlPath := "/settings/{setting-name}" if settingName == "" { return nil, errors.New("parameter settingName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{setting-name}", url.PathEscape(settingName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.endpoint, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(host, urlPath)) if err != nil { return nil, err } @@ -169,6 +177,7 @@ func (client *Client) updateSettingCreateRequest(ctx context.Context, settingNam reqQP.Set("api-version", "7.5") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } diff --git a/sdk/security/keyvault/azadmin/settings/client_test.go b/sdk/security/keyvault/azadmin/settings/client_test.go index b729fe69f0c2..0edafa6cea23 100644 --- a/sdk/security/keyvault/azadmin/settings/client_test.go +++ b/sdk/security/keyvault/azadmin/settings/client_test.go @@ -1,8 +1,5 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. +// Licensed under the MIT License. See License.txt in the project root for license information. package settings_test diff --git a/sdk/security/keyvault/azadmin/settings/constants.go b/sdk/security/keyvault/azadmin/settings/constants.go index 571920d526ba..3357768de180 100644 --- a/sdk/security/keyvault/azadmin/settings/constants.go +++ b/sdk/security/keyvault/azadmin/settings/constants.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package settings @@ -12,6 +8,7 @@ package settings type SettingType string const ( + // SettingTypeBoolean - A boolean setting value. SettingTypeBoolean SettingType = "boolean" ) diff --git a/sdk/security/keyvault/azadmin/settings/custom_client.go b/sdk/security/keyvault/azadmin/settings/custom_client.go index 025f61a9ab24..152557e9819a 100644 --- a/sdk/security/keyvault/azadmin/settings/custom_client.go +++ b/sdk/security/keyvault/azadmin/settings/custom_client.go @@ -1,6 +1,3 @@ -//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. @@ -51,5 +48,5 @@ func NewClient(vaultURL string, credential azcore.TokenCredential, options *Clie if err != nil { return nil, err } - return &Client{endpoint: vaultURL, internal: azcoreClient}, nil + return &Client{vaultBaseUrl: vaultURL, internal: azcoreClient}, nil } diff --git a/sdk/security/keyvault/azadmin/settings/models.go b/sdk/security/keyvault/azadmin/settings/models.go index fa344960583c..ac4c373ea646 100644 --- a/sdk/security/keyvault/azadmin/settings/models.go +++ b/sdk/security/keyvault/azadmin/settings/models.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package settings @@ -14,7 +10,7 @@ type ListResult struct { Settings []*Setting } -// Setting - A Key Vault setting. +// Setting - A Key Vault account setting. type Setting struct { // REQUIRED; The account setting to be updated Name *string diff --git a/sdk/security/keyvault/azadmin/settings/models_serde.go b/sdk/security/keyvault/azadmin/settings/models_serde.go index a9df2d104508..fab8ebd329b3 100644 --- a/sdk/security/keyvault/azadmin/settings/models_serde.go +++ b/sdk/security/keyvault/azadmin/settings/models_serde.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package settings @@ -115,7 +111,7 @@ func populate(m map[string]any, k string, v any) { } 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/security/keyvault/azadmin/settings/options.go b/sdk/security/keyvault/azadmin/settings/options.go index 4756672c8522..86a9d221e7a8 100644 --- a/sdk/security/keyvault/azadmin/settings/options.go +++ b/sdk/security/keyvault/azadmin/settings/options.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package settings diff --git a/sdk/security/keyvault/azadmin/settings/response_types.go b/sdk/security/keyvault/azadmin/settings/responses.go similarity index 70% rename from sdk/security/keyvault/azadmin/settings/response_types.go rename to sdk/security/keyvault/azadmin/settings/responses.go index 61bdb6065372..7184cd0fdc58 100644 --- a/sdk/security/keyvault/azadmin/settings/response_types.go +++ b/sdk/security/keyvault/azadmin/settings/responses.go @@ -1,16 +1,12 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package settings // GetSettingResponse contains the response from method Client.GetSetting. type GetSettingResponse struct { - // A Key Vault setting. + // A Key Vault account setting. Setting } @@ -22,6 +18,6 @@ type GetSettingsResponse struct { // UpdateSettingResponse contains the response from method Client.UpdateSetting. type UpdateSettingResponse struct { - // A Key Vault setting. + // A Key Vault account setting. Setting } diff --git a/sdk/security/keyvault/azadmin/settings/tsp-location.yaml b/sdk/security/keyvault/azadmin/settings/tsp-location.yaml new file mode 100644 index 000000000000..a5370061a475 --- /dev/null +++ b/sdk/security/keyvault/azadmin/settings/tsp-location.yaml @@ -0,0 +1,6 @@ +directory: specification/keyvault/Security.KeyVault.Settings +commit: 70672ea0a1a550ee608aa4718598b71550d361df +repo: Azure/azure-rest-api-specs +additionalDirectories: +- specification/keyvault/Security.KeyVault.Common/ +# https://github.com/Azure/azure-rest-api-specs/tree/main/specification/keyvault/Security.KeyVault.Settings \ No newline at end of file diff --git a/sdk/security/keyvault/azadmin/settings/utils_test.go b/sdk/security/keyvault/azadmin/settings/utils_test.go index 23638f9155d3..8312fa07fd62 100644 --- a/sdk/security/keyvault/azadmin/settings/utils_test.go +++ b/sdk/security/keyvault/azadmin/settings/utils_test.go @@ -1,8 +1,5 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. +// Licensed under the MIT License. See License.txt in the project root for license information. package settings_test