diff --git a/sdk/security/keyvault/azkeys/autorest.md b/sdk/security/keyvault/azkeys/autorest.md index 12bbe95edc0f..1d78994d8c5f 100644 --- a/sdk/security/keyvault/azkeys/autorest.md +++ b/sdk/security/keyvault/azkeys/autorest.md @@ -12,7 +12,7 @@ output-folder: ../azkeys override-client-name: Client security: "AADToken" security-scopes: "https://vault.azure.net/.default" -use: "@autorest/go@4.0.0-preview.46" +use: "@autorest/go@4.0.0-preview.54" version: "^3.0.0" directive: @@ -218,6 +218,7 @@ directive: - from: - client.go - models.go + - options.go - response_types.go where: $ transform: return $.replace(/Client(\w+)((?:Options|Response))/g, "$1$2"); diff --git a/sdk/security/keyvault/azkeys/client.go b/sdk/security/keyvault/azkeys/client.go index 02ec6c7fd008..799ab5ad45d1 100644 --- a/sdk/security/keyvault/azkeys/client.go +++ b/sdk/security/keyvault/azkeys/client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package azkeys @@ -43,18 +42,21 @@ type Client struct { // - name - The name of the key. // - options - BackupKeyOptions contains the optional parameters for the Client.BackupKey method. func (client *Client) BackupKey(ctx context.Context, name string, options *BackupKeyOptions) (BackupKeyResponse, error) { + var err error req, err := client.backupKeyCreateRequest(ctx, name, options) if err != nil { return BackupKeyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return BackupKeyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return BackupKeyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BackupKeyResponse{}, err } - return client.backupKeyHandleResponse(resp) + resp, err := client.backupKeyHandleResponse(httpResp) + return resp, err } // backupKeyCreateRequest creates the BackupKey request. @@ -96,18 +98,21 @@ func (client *Client) backupKeyHandleResponse(resp *http.Response) (BackupKeyRes // - parameters - The parameters to create a key. // - options - CreateKeyOptions contains the optional parameters for the Client.CreateKey method. func (client *Client) CreateKey(ctx context.Context, name string, parameters CreateKeyParameters, options *CreateKeyOptions) (CreateKeyResponse, error) { + var err error req, err := client.createKeyCreateRequest(ctx, name, parameters, options) if err != nil { return CreateKeyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CreateKeyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CreateKeyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CreateKeyResponse{}, err } - return client.createKeyHandleResponse(resp) + resp, err := client.createKeyHandleResponse(httpResp) + return resp, err } // createKeyCreateRequest creates the CreateKey request. @@ -125,7 +130,10 @@ func (client *Client) createKeyCreateRequest(ctx context.Context, name string, p reqQP.Set("api-version", "7.4") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createKeyHandleResponse handles the CreateKey response. @@ -153,18 +161,21 @@ func (client *Client) createKeyHandleResponse(resp *http.Response) (CreateKeyRes // - parameters - The parameters for the decryption operation. // - options - DecryptOptions contains the optional parameters for the Client.Decrypt method. func (client *Client) Decrypt(ctx context.Context, name string, version string, parameters KeyOperationParameters, options *DecryptOptions) (DecryptResponse, error) { + var err error req, err := client.decryptCreateRequest(ctx, name, version, parameters, options) if err != nil { return DecryptResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DecryptResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DecryptResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DecryptResponse{}, err } - return client.decryptHandleResponse(resp) + resp, err := client.decryptHandleResponse(httpResp) + return resp, err } // decryptCreateRequest creates the Decrypt request. @@ -183,7 +194,10 @@ func (client *Client) decryptCreateRequest(ctx context.Context, name string, ver reqQP.Set("api-version", "7.4") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // decryptHandleResponse handles the Decrypt response. @@ -204,18 +218,21 @@ func (client *Client) decryptHandleResponse(resp *http.Response) (DecryptRespons // - name - The name of the key to delete. // - options - DeleteKeyOptions contains the optional parameters for the Client.DeleteKey method. func (client *Client) DeleteKey(ctx context.Context, name string, options *DeleteKeyOptions) (DeleteKeyResponse, error) { + var err error req, err := client.deleteKeyCreateRequest(ctx, name, options) if err != nil { return DeleteKeyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeleteKeyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeleteKeyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeleteKeyResponse{}, err } - return client.deleteKeyHandleResponse(resp) + resp, err := client.deleteKeyHandleResponse(httpResp) + return resp, err } // deleteKeyCreateRequest creates the DeleteKey request. @@ -260,18 +277,21 @@ func (client *Client) deleteKeyHandleResponse(resp *http.Response) (DeleteKeyRes // - parameters - The parameters for the encryption operation. // - options - EncryptOptions contains the optional parameters for the Client.Encrypt method. func (client *Client) Encrypt(ctx context.Context, name string, version string, parameters KeyOperationParameters, options *EncryptOptions) (EncryptResponse, error) { + var err error req, err := client.encryptCreateRequest(ctx, name, version, parameters, options) if err != nil { return EncryptResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return EncryptResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EncryptResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EncryptResponse{}, err } - return client.encryptHandleResponse(resp) + resp, err := client.encryptHandleResponse(httpResp) + return resp, err } // encryptCreateRequest creates the Encrypt request. @@ -290,7 +310,10 @@ func (client *Client) encryptCreateRequest(ctx context.Context, name string, ver reqQP.Set("api-version", "7.4") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // encryptHandleResponse handles the Encrypt response. @@ -311,18 +334,21 @@ func (client *Client) encryptHandleResponse(resp *http.Response) (EncryptRespons // - name - The name of the key. // - options - GetDeletedKeyOptions contains the optional parameters for the Client.GetDeletedKey method. func (client *Client) GetDeletedKey(ctx context.Context, name string, options *GetDeletedKeyOptions) (GetDeletedKeyResponse, error) { + var err error req, err := client.getDeletedKeyCreateRequest(ctx, name, options) if err != nil { return GetDeletedKeyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return GetDeletedKeyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GetDeletedKeyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GetDeletedKeyResponse{}, err } - return client.getDeletedKeyHandleResponse(resp) + resp, err := client.getDeletedKeyHandleResponse(httpResp) + return resp, err } // getDeletedKeyCreateRequest creates the GetDeletedKey request. @@ -362,18 +388,21 @@ func (client *Client) getDeletedKeyHandleResponse(resp *http.Response) (GetDelet // the latest version of the key is returned. // - options - GetKeyOptions contains the optional parameters for the Client.GetKey method. func (client *Client) GetKey(ctx context.Context, name string, version string, options *GetKeyOptions) (GetKeyResponse, error) { + var err error req, err := client.getKeyCreateRequest(ctx, name, version, options) if err != nil { return GetKeyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return GetKeyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GetKeyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GetKeyResponse{}, err } - return client.getKeyHandleResponse(resp) + resp, err := client.getKeyHandleResponse(httpResp) + return resp, err } // getKeyCreateRequest creates the GetKey request. @@ -412,18 +441,21 @@ func (client *Client) getKeyHandleResponse(resp *http.Response) (GetKeyResponse, // - name - The name of the key in a given key vault. // - options - GetKeyRotationPolicyOptions contains the optional parameters for the Client.GetKeyRotationPolicy method. func (client *Client) GetKeyRotationPolicy(ctx context.Context, name string, options *GetKeyRotationPolicyOptions) (GetKeyRotationPolicyResponse, error) { + var err error req, err := client.getKeyRotationPolicyCreateRequest(ctx, name, options) if err != nil { return GetKeyRotationPolicyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return GetKeyRotationPolicyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GetKeyRotationPolicyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GetKeyRotationPolicyResponse{}, err } - return client.getKeyRotationPolicyHandleResponse(resp) + resp, err := client.getKeyRotationPolicyHandleResponse(httpResp) + return resp, err } // getKeyRotationPolicyCreateRequest creates the GetKeyRotationPolicy request. @@ -460,18 +492,21 @@ func (client *Client) getKeyRotationPolicyHandleResponse(resp *http.Response) (G // - parameters - The request object to get random bytes. // - options - GetRandomBytesOptions contains the optional parameters for the Client.GetRandomBytes method. func (client *Client) GetRandomBytes(ctx context.Context, parameters GetRandomBytesParameters, options *GetRandomBytesOptions) (GetRandomBytesResponse, error) { + var err error req, err := client.getRandomBytesCreateRequest(ctx, parameters, options) if err != nil { return GetRandomBytesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return GetRandomBytesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GetRandomBytesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GetRandomBytesResponse{}, err } - return client.getRandomBytesHandleResponse(resp) + resp, err := client.getRandomBytesHandleResponse(httpResp) + return resp, err } // getRandomBytesCreateRequest creates the GetRandomBytes request. @@ -485,7 +520,10 @@ func (client *Client) getRandomBytesCreateRequest(ctx context.Context, parameter reqQP.Set("api-version", "7.4") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // getRandomBytesHandleResponse handles the GetRandomBytes response. @@ -508,18 +546,21 @@ func (client *Client) getRandomBytesHandleResponse(resp *http.Response) (GetRand // - parameters - The parameters to import a key. // - options - ImportKeyOptions contains the optional parameters for the Client.ImportKey method. func (client *Client) ImportKey(ctx context.Context, name string, parameters ImportKeyParameters, options *ImportKeyOptions) (ImportKeyResponse, error) { + var err error req, err := client.importKeyCreateRequest(ctx, name, parameters, options) if err != nil { return ImportKeyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ImportKeyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ImportKeyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ImportKeyResponse{}, err } - return client.importKeyHandleResponse(resp) + resp, err := client.importKeyHandleResponse(httpResp) + return resp, err } // importKeyCreateRequest creates the ImportKey request. @@ -537,7 +578,10 @@ func (client *Client) importKeyCreateRequest(ctx context.Context, name string, p reqQP.Set("api-version", "7.4") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // importKeyHandleResponse handles the ImportKey response. @@ -738,16 +782,18 @@ func (client *Client) listKeyPropertiesVersionsHandleResponse(resp *http.Respons // - name - The name of the key // - options - PurgeDeletedKeyOptions contains the optional parameters for the Client.PurgeDeletedKey method. func (client *Client) PurgeDeletedKey(ctx context.Context, name string, options *PurgeDeletedKeyOptions) (PurgeDeletedKeyResponse, error) { + var err error req, err := client.purgeDeletedKeyCreateRequest(ctx, name, options) if err != nil { return PurgeDeletedKeyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PurgeDeletedKeyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusNoContent) { - return PurgeDeletedKeyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return PurgeDeletedKeyResponse{}, err } return PurgeDeletedKeyResponse{}, nil } @@ -780,18 +826,21 @@ func (client *Client) purgeDeletedKeyCreateRequest(ctx context.Context, name str // - name - The name of the deleted key. // - options - RecoverDeletedKeyOptions contains the optional parameters for the Client.RecoverDeletedKey method. func (client *Client) RecoverDeletedKey(ctx context.Context, name string, options *RecoverDeletedKeyOptions) (RecoverDeletedKeyResponse, error) { + var err error req, err := client.recoverDeletedKeyCreateRequest(ctx, name, options) if err != nil { return RecoverDeletedKeyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return RecoverDeletedKeyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RecoverDeletedKeyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RecoverDeletedKeyResponse{}, err } - return client.recoverDeletedKeyHandleResponse(resp) + resp, err := client.recoverDeletedKeyHandleResponse(httpResp) + return resp, err } // recoverDeletedKeyCreateRequest creates the RecoverDeletedKey request. @@ -831,18 +880,21 @@ func (client *Client) recoverDeletedKeyHandleResponse(resp *http.Response) (Reco // - parameters - The parameters for the key release operation. // - options - ReleaseOptions contains the optional parameters for the Client.Release method. func (client *Client) Release(ctx context.Context, name string, version string, parameters ReleaseParameters, options *ReleaseOptions) (ReleaseResponse, error) { + var err error req, err := client.releaseCreateRequest(ctx, name, version, parameters, options) if err != nil { return ReleaseResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ReleaseResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ReleaseResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ReleaseResponse{}, err } - return client.releaseHandleResponse(resp) + resp, err := client.releaseHandleResponse(httpResp) + return resp, err } // releaseCreateRequest creates the Release request. @@ -861,7 +913,10 @@ func (client *Client) releaseCreateRequest(ctx context.Context, name string, ver reqQP.Set("api-version", "7.4") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // releaseHandleResponse handles the Release response. @@ -888,18 +943,21 @@ func (client *Client) releaseHandleResponse(resp *http.Response) (ReleaseRespons // - parameters - The parameters to restore the key. // - options - RestoreKeyOptions contains the optional parameters for the Client.RestoreKey method. func (client *Client) RestoreKey(ctx context.Context, parameters RestoreKeyParameters, options *RestoreKeyOptions) (RestoreKeyResponse, error) { + var err error req, err := client.restoreKeyCreateRequest(ctx, parameters, options) if err != nil { return RestoreKeyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return RestoreKeyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RestoreKeyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RestoreKeyResponse{}, err } - return client.restoreKeyHandleResponse(resp) + resp, err := client.restoreKeyHandleResponse(httpResp) + return resp, err } // restoreKeyCreateRequest creates the RestoreKey request. @@ -913,7 +971,10 @@ func (client *Client) restoreKeyCreateRequest(ctx context.Context, parameters Re reqQP.Set("api-version", "7.4") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // restoreKeyHandleResponse handles the RestoreKey response. @@ -932,18 +993,21 @@ func (client *Client) restoreKeyHandleResponse(resp *http.Response) (RestoreKeyR // - name - The name of key to be rotated. The system will generate a new version in the specified key. // - options - RotateKeyOptions contains the optional parameters for the Client.RotateKey method. func (client *Client) RotateKey(ctx context.Context, name string, options *RotateKeyOptions) (RotateKeyResponse, error) { + var err error req, err := client.rotateKeyCreateRequest(ctx, name, options) if err != nil { return RotateKeyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return RotateKeyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RotateKeyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RotateKeyResponse{}, err } - return client.rotateKeyHandleResponse(resp) + resp, err := client.rotateKeyHandleResponse(httpResp) + return resp, err } // rotateKeyCreateRequest creates the RotateKey request. @@ -983,18 +1047,21 @@ func (client *Client) rotateKeyHandleResponse(resp *http.Response) (RotateKeyRes // - parameters - The parameters for the signing operation. // - options - SignOptions contains the optional parameters for the Client.Sign method. func (client *Client) Sign(ctx context.Context, name string, version string, parameters SignParameters, options *SignOptions) (SignResponse, error) { + var err error req, err := client.signCreateRequest(ctx, name, version, parameters, options) if err != nil { return SignResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SignResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SignResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SignResponse{}, err } - return client.signHandleResponse(resp) + resp, err := client.signHandleResponse(httpResp) + return resp, err } // signCreateRequest creates the Sign request. @@ -1013,7 +1080,10 @@ func (client *Client) signCreateRequest(ctx context.Context, name string, versio reqQP.Set("api-version", "7.4") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // signHandleResponse handles the Sign response. @@ -1037,18 +1107,21 @@ func (client *Client) signHandleResponse(resp *http.Response) (SignResponse, err // - parameters - The parameters for the key operation. // - options - UnwrapKeyOptions contains the optional parameters for the Client.UnwrapKey method. func (client *Client) UnwrapKey(ctx context.Context, name string, version string, parameters KeyOperationParameters, options *UnwrapKeyOptions) (UnwrapKeyResponse, error) { + var err error req, err := client.unwrapKeyCreateRequest(ctx, name, version, parameters, options) if err != nil { return UnwrapKeyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return UnwrapKeyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return UnwrapKeyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UnwrapKeyResponse{}, err } - return client.unwrapKeyHandleResponse(resp) + resp, err := client.unwrapKeyHandleResponse(httpResp) + return resp, err } // unwrapKeyCreateRequest creates the UnwrapKey request. @@ -1067,7 +1140,10 @@ func (client *Client) unwrapKeyCreateRequest(ctx context.Context, name string, v reqQP.Set("api-version", "7.4") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // unwrapKeyHandleResponse handles the UnwrapKey response. @@ -1089,18 +1165,21 @@ func (client *Client) unwrapKeyHandleResponse(resp *http.Response) (UnwrapKeyRes // - parameters - The parameters of the key to update. // - options - UpdateKeyOptions contains the optional parameters for the Client.UpdateKey method. func (client *Client) UpdateKey(ctx context.Context, name string, version string, parameters UpdateKeyParameters, options *UpdateKeyOptions) (UpdateKeyResponse, error) { + var err error req, err := client.updateKeyCreateRequest(ctx, name, version, parameters, options) if err != nil { return UpdateKeyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return UpdateKeyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return UpdateKeyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UpdateKeyResponse{}, err } - return client.updateKeyHandleResponse(resp) + resp, err := client.updateKeyHandleResponse(httpResp) + return resp, err } // updateKeyCreateRequest creates the UpdateKey request. @@ -1119,7 +1198,10 @@ func (client *Client) updateKeyCreateRequest(ctx context.Context, name string, v reqQP.Set("api-version", "7.4") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // updateKeyHandleResponse handles the UpdateKey response. @@ -1141,18 +1223,21 @@ func (client *Client) updateKeyHandleResponse(resp *http.Response) (UpdateKeyRes // - options - UpdateKeyRotationPolicyOptions contains the optional parameters for the Client.UpdateKeyRotationPolicy // method. func (client *Client) UpdateKeyRotationPolicy(ctx context.Context, name string, keyRotationPolicy KeyRotationPolicy, options *UpdateKeyRotationPolicyOptions) (UpdateKeyRotationPolicyResponse, error) { + var err error req, err := client.updateKeyRotationPolicyCreateRequest(ctx, name, keyRotationPolicy, options) if err != nil { return UpdateKeyRotationPolicyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return UpdateKeyRotationPolicyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return UpdateKeyRotationPolicyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UpdateKeyRotationPolicyResponse{}, err } - return client.updateKeyRotationPolicyHandleResponse(resp) + resp, err := client.updateKeyRotationPolicyHandleResponse(httpResp) + return resp, err } // updateKeyRotationPolicyCreateRequest creates the UpdateKeyRotationPolicy request. @@ -1170,7 +1255,10 @@ func (client *Client) updateKeyRotationPolicyCreateRequest(ctx context.Context, reqQP.Set("api-version", "7.4") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, keyRotationPolicy) + if err := runtime.MarshalAsJSON(req, keyRotationPolicy); err != nil { + return nil, err + } + return req, nil } // updateKeyRotationPolicyHandleResponse handles the UpdateKeyRotationPolicy response. @@ -1195,18 +1283,21 @@ func (client *Client) updateKeyRotationPolicyHandleResponse(resp *http.Response) // - parameters - The parameters for verify operations. // - options - VerifyOptions contains the optional parameters for the Client.Verify method. func (client *Client) Verify(ctx context.Context, name string, version string, parameters VerifyParameters, options *VerifyOptions) (VerifyResponse, error) { + var err error req, err := client.verifyCreateRequest(ctx, name, version, parameters, options) if err != nil { return VerifyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VerifyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VerifyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VerifyResponse{}, err } - return client.verifyHandleResponse(resp) + resp, err := client.verifyHandleResponse(httpResp) + return resp, err } // verifyCreateRequest creates the Verify request. @@ -1225,7 +1316,10 @@ func (client *Client) verifyCreateRequest(ctx context.Context, name string, vers reqQP.Set("api-version", "7.4") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // verifyHandleResponse handles the Verify response. @@ -1251,18 +1345,21 @@ func (client *Client) verifyHandleResponse(resp *http.Response) (VerifyResponse, // - parameters - The parameters for wrap operation. // - options - WrapKeyOptions contains the optional parameters for the Client.WrapKey method. func (client *Client) WrapKey(ctx context.Context, name string, version string, parameters KeyOperationParameters, options *WrapKeyOptions) (WrapKeyResponse, error) { + var err error req, err := client.wrapKeyCreateRequest(ctx, name, version, parameters, options) if err != nil { return WrapKeyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return WrapKeyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return WrapKeyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WrapKeyResponse{}, err } - return client.wrapKeyHandleResponse(resp) + resp, err := client.wrapKeyHandleResponse(httpResp) + return resp, err } // wrapKeyCreateRequest creates the WrapKey request. @@ -1281,7 +1378,10 @@ func (client *Client) wrapKeyCreateRequest(ctx context.Context, name string, ver reqQP.Set("api-version", "7.4") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // wrapKeyHandleResponse handles the WrapKey response. diff --git a/sdk/security/keyvault/azkeys/constants.go b/sdk/security/keyvault/azkeys/constants.go index 64960a4090c6..1eaab58a6373 100644 --- a/sdk/security/keyvault/azkeys/constants.go +++ b/sdk/security/keyvault/azkeys/constants.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package azkeys @@ -198,17 +197,17 @@ func PossibleKeyEncryptionAlgorithmValues() []KeyEncryptionAlgorithm { type KeyRotationPolicyAction string const ( - // KeyRotationPolicyActionRotate - Rotate the key based on the key policy. - KeyRotationPolicyActionRotate KeyRotationPolicyAction = "rotate" // KeyRotationPolicyActionNotify - Trigger event grid events. For preview, the notification time is not configurable and it // is default to 30 days before expiry. KeyRotationPolicyActionNotify KeyRotationPolicyAction = "notify" + // KeyRotationPolicyActionRotate - Rotate the key based on the key policy. + KeyRotationPolicyActionRotate KeyRotationPolicyAction = "rotate" ) // PossibleKeyRotationPolicyActionValues returns the possible values for the KeyRotationPolicyAction const type. func PossibleKeyRotationPolicyActionValues() []KeyRotationPolicyAction { return []KeyRotationPolicyAction{ - KeyRotationPolicyActionRotate, KeyRotationPolicyActionNotify, + KeyRotationPolicyActionRotate, } } diff --git a/sdk/security/keyvault/azkeys/models.go b/sdk/security/keyvault/azkeys/models.go index c81b7a752fd4..257f931d825b 100644 --- a/sdk/security/keyvault/azkeys/models.go +++ b/sdk/security/keyvault/azkeys/models.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package azkeys @@ -14,535 +13,413 @@ import "time" // BackupKeyResult - The backup key result, containing the backup blob. type BackupKeyResult struct { // READ-ONLY; The backup blob containing the backed up key. - Value []byte `json:"value,omitempty" azure:"ro"` -} - -// BackupKeyOptions contains the optional parameters for the Client.BackupKey method. -type BackupKeyOptions struct { - // placeholder for future optional parameters -} - -// CreateKeyOptions contains the optional parameters for the Client.CreateKey method. -type CreateKeyOptions struct { - // placeholder for future optional parameters -} - -// DecryptOptions contains the optional parameters for the Client.Decrypt method. -type DecryptOptions struct { - // placeholder for future optional parameters -} - -// DeleteKeyOptions contains the optional parameters for the Client.DeleteKey method. -type DeleteKeyOptions struct { - // placeholder for future optional parameters -} - -// EncryptOptions contains the optional parameters for the Client.Encrypt method. -type EncryptOptions struct { - // placeholder for future optional parameters -} - -// GetDeletedKeyOptions contains the optional parameters for the Client.GetDeletedKey method. -type GetDeletedKeyOptions struct { - // placeholder for future optional parameters -} - -// GetKeyOptions contains the optional parameters for the Client.GetKey method. -type GetKeyOptions struct { - // placeholder for future optional parameters -} - -// GetKeyRotationPolicyOptions contains the optional parameters for the Client.GetKeyRotationPolicy method. -type GetKeyRotationPolicyOptions struct { - // placeholder for future optional parameters -} - -// GetRandomBytesOptions contains the optional parameters for the Client.GetRandomBytes method. -type GetRandomBytesOptions struct { - // placeholder for future optional parameters -} - -// ImportKeyOptions contains the optional parameters for the Client.ImportKey method. -type ImportKeyOptions struct { - // placeholder for future optional parameters -} - -// ListDeletedKeyPropertiesOptions contains the optional parameters for the Client.NewListDeletedKeyPropertiesPager -// method. -type ListDeletedKeyPropertiesOptions struct { - // placeholder for future optional parameters -} - -// ListKeyPropertiesOptions contains the optional parameters for the Client.NewListKeyPropertiesPager method. -type ListKeyPropertiesOptions struct { - // placeholder for future optional parameters -} - -// ListKeyPropertiesVersionsOptions contains the optional parameters for the Client.NewListKeyPropertiesVersionsPager -// method. -type ListKeyPropertiesVersionsOptions struct { - // placeholder for future optional parameters -} - -// PurgeDeletedKeyOptions contains the optional parameters for the Client.PurgeDeletedKey method. -type PurgeDeletedKeyOptions struct { - // placeholder for future optional parameters -} - -// RecoverDeletedKeyOptions contains the optional parameters for the Client.RecoverDeletedKey method. -type RecoverDeletedKeyOptions struct { - // placeholder for future optional parameters -} - -// ReleaseOptions contains the optional parameters for the Client.Release method. -type ReleaseOptions struct { - // placeholder for future optional parameters -} - -// RestoreKeyOptions contains the optional parameters for the Client.RestoreKey method. -type RestoreKeyOptions struct { - // placeholder for future optional parameters -} - -// RotateKeyOptions contains the optional parameters for the Client.RotateKey method. -type RotateKeyOptions struct { - // placeholder for future optional parameters -} - -// SignOptions contains the optional parameters for the Client.Sign method. -type SignOptions struct { - // placeholder for future optional parameters -} - -// UnwrapKeyOptions contains the optional parameters for the Client.UnwrapKey method. -type UnwrapKeyOptions struct { - // placeholder for future optional parameters -} - -// UpdateKeyOptions contains the optional parameters for the Client.UpdateKey method. -type UpdateKeyOptions struct { - // placeholder for future optional parameters -} - -// UpdateKeyRotationPolicyOptions contains the optional parameters for the Client.UpdateKeyRotationPolicy method. -type UpdateKeyRotationPolicyOptions struct { - // placeholder for future optional parameters -} - -// VerifyOptions contains the optional parameters for the Client.Verify method. -type VerifyOptions struct { - // placeholder for future optional parameters -} - -// WrapKeyOptions contains the optional parameters for the Client.WrapKey method. -type WrapKeyOptions struct { - // placeholder for future optional parameters + Value []byte } // CreateKeyParameters - The key create parameters. type CreateKeyParameters struct { // REQUIRED; The type of key to create. For valid values, see JsonWebKeyType. - Kty *KeyType `json:"kty,omitempty"` + Kty *KeyType // Elliptic curve name. For valid values, see JsonWebKeyCurveName. - Curve *CurveName `json:"crv,omitempty"` + Curve *CurveName // The attributes of a key managed by the key vault service. - KeyAttributes *KeyAttributes `json:"attributes,omitempty"` - KeyOps []*KeyOperation `json:"key_ops,omitempty"` + KeyAttributes *KeyAttributes + KeyOps []*KeyOperation // The key size in bits. For example: 2048, 3072, or 4096 for RSA. - KeySize *int32 `json:"key_size,omitempty"` + KeySize *int32 // The public exponent for a RSA key. - PublicExponent *int32 `json:"public_exponent,omitempty"` + PublicExponent *int32 // The policy rules under which the key can be exported. - ReleasePolicy *KeyReleasePolicy `json:"release_policy,omitempty"` + ReleasePolicy *KeyReleasePolicy // Application specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // DeletedKey - A DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion info type DeletedKey struct { // The key management attributes. - Attributes *KeyAttributes `json:"attributes,omitempty"` + Attributes *KeyAttributes // The Json web key. - Key *JSONWebKey `json:"key,omitempty"` + Key *JSONWebKey // The url of the recovery object, used to identify and recover the deleted key. - RecoveryID *string `json:"recoveryId,omitempty"` + RecoveryID *string // The policy rules under which the key can be exported. - ReleasePolicy *KeyReleasePolicy `json:"release_policy,omitempty"` + ReleasePolicy *KeyReleasePolicy // Application specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; The time when the key was deleted, in UTC - DeletedDate *time.Time `json:"deletedDate,omitempty" azure:"ro"` + DeletedDate *time.Time // READ-ONLY; True if the key's lifetime is managed by key vault. If this is a key backing a certificate, then managed will // be true. - Managed *bool `json:"managed,omitempty" azure:"ro"` + Managed *bool // READ-ONLY; The time when the key is scheduled to be purged, in UTC - ScheduledPurgeDate *time.Time `json:"scheduledPurgeDate,omitempty" azure:"ro"` + ScheduledPurgeDate *time.Time } // DeletedKeyProperties - The deleted key item containing the deleted key metadata and information about deletion. type DeletedKeyProperties struct { // The key management attributes. - Attributes *KeyAttributes `json:"attributes,omitempty"` + Attributes *KeyAttributes // Key identifier. - KID *ID `json:"kid,omitempty"` + KID *ID // The url of the recovery object, used to identify and recover the deleted key. - RecoveryID *string `json:"recoveryId,omitempty"` + RecoveryID *string // Application specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; The time when the key was deleted, in UTC - DeletedDate *time.Time `json:"deletedDate,omitempty" azure:"ro"` + DeletedDate *time.Time // READ-ONLY; True if the key's lifetime is managed by key vault. If this is a key backing a certificate, then managed will // be true. - Managed *bool `json:"managed,omitempty" azure:"ro"` + Managed *bool // READ-ONLY; The time when the key is scheduled to be purged, in UTC - ScheduledPurgeDate *time.Time `json:"scheduledPurgeDate,omitempty" azure:"ro"` + ScheduledPurgeDate *time.Time } // DeletedKeyPropertiesListResult - A list of keys that have been deleted in this vault. type DeletedKeyPropertiesListResult struct { // READ-ONLY; The URL to get the next set of deleted keys. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; A response message containing a list of deleted keys in the vault along with a link to the next page of deleted // keys - Value []*DeletedKeyProperties `json:"value,omitempty" azure:"ro"` + Value []*DeletedKeyProperties } // GetRandomBytesParameters - The get random bytes request object. type GetRandomBytesParameters struct { // REQUIRED; The requested number of random bytes. - Count *int32 `json:"count,omitempty"` + Count *int32 } // ImportKeyParameters - The key import parameters. type ImportKeyParameters struct { // REQUIRED; The Json web key - Key *JSONWebKey `json:"key,omitempty"` + Key *JSONWebKey // Whether to import as a hardware key (HSM) or software key. - HSM *bool `json:"Hsm,omitempty"` + HSM *bool // The key management attributes. - KeyAttributes *KeyAttributes `json:"attributes,omitempty"` + KeyAttributes *KeyAttributes // The policy rules under which the key can be exported. - ReleasePolicy *KeyReleasePolicy `json:"release_policy,omitempty"` + ReleasePolicy *KeyReleasePolicy // Application specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // JSONWebKey - As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18 type JSONWebKey struct { // Elliptic curve name. For valid values, see JsonWebKeyCurveName. - Crv *CurveName `json:"crv,omitempty"` + Crv *CurveName // RSA private exponent, or the D component of an EC private key. - D []byte `json:"d,omitempty"` + D []byte // RSA private key parameter. - DP []byte `json:"dp,omitempty"` + DP []byte // RSA private key parameter. - DQ []byte `json:"dq,omitempty"` + DQ []byte // RSA public exponent. - E []byte `json:"e,omitempty"` + E []byte // Symmetric key. - K []byte `json:"k,omitempty"` + K []byte // Key identifier. - KID *ID `json:"kid,omitempty"` - KeyOps []*KeyOperation `json:"key_ops,omitempty"` + KID *ID + KeyOps []*KeyOperation // JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. - Kty *KeyType `json:"kty,omitempty"` + Kty *KeyType // RSA modulus. - N []byte `json:"n,omitempty"` + N []byte // RSA secret prime. - P []byte `json:"p,omitempty"` + P []byte // RSA secret prime, with p < q. - Q []byte `json:"q,omitempty"` + Q []byte // RSA private key parameter. - QI []byte `json:"qi,omitempty"` + QI []byte // Protected Key, used with 'Bring Your Own Key'. - T []byte `json:"key_hsm,omitempty"` + T []byte // X component of an EC public key. - X []byte `json:"x,omitempty"` + X []byte // Y component of an EC public key. - Y []byte `json:"y,omitempty"` + Y []byte } // KeyAttributes - The attributes of a key managed by the key vault service. type KeyAttributes struct { // Determines whether the object is enabled. - Enabled *bool `json:"enabled,omitempty"` + Enabled *bool // Expiry date in UTC. - Expires *time.Time `json:"exp,omitempty"` + Expires *time.Time // Indicates if the private key can be exported. Release policy must be provided when creating the first version of an exportable // key. - Exportable *bool `json:"exportable,omitempty"` + Exportable *bool // Not before date in UTC. - NotBefore *time.Time `json:"nbf,omitempty"` + NotBefore *time.Time // READ-ONLY; Creation time in UTC. - Created *time.Time `json:"created,omitempty" azure:"ro"` + Created *time.Time // READ-ONLY; softDelete data retention days. Value should be >=7 and <=90 when softDelete enabled, otherwise 0. - RecoverableDays *int32 `json:"recoverableDays,omitempty" azure:"ro"` + RecoverableDays *int32 // READ-ONLY; Reflects the deletion recovery level currently in effect for keys in the current vault. If it contains 'Purgeable' // the key can be permanently deleted by a privileged user; otherwise, only the system // can purge the key, at the end of the retention interval. - RecoveryLevel *string `json:"recoveryLevel,omitempty" azure:"ro"` + RecoveryLevel *string // READ-ONLY; Last updated time in UTC. - Updated *time.Time `json:"updated,omitempty" azure:"ro"` + Updated *time.Time } // KeyBundle - A KeyBundle consisting of a WebKey plus its attributes. type KeyBundle struct { // The key management attributes. - Attributes *KeyAttributes `json:"attributes,omitempty"` + Attributes *KeyAttributes // The Json web key. - Key *JSONWebKey `json:"key,omitempty"` + Key *JSONWebKey // The policy rules under which the key can be exported. - ReleasePolicy *KeyReleasePolicy `json:"release_policy,omitempty"` + ReleasePolicy *KeyReleasePolicy // Application specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; True if the key's lifetime is managed by key vault. If this is a key backing a certificate, then managed will // be true. - Managed *bool `json:"managed,omitempty" azure:"ro"` + Managed *bool } // KeyOperationParameters - The key operations parameters. type KeyOperationParameters struct { // REQUIRED; algorithm identifier - Algorithm *EncryptionAlgorithm `json:"alg,omitempty"` + Algorithm *EncryptionAlgorithm // REQUIRED - Value []byte `json:"value,omitempty"` + Value []byte // Additional data to authenticate but not encrypt/decrypt when using authenticated crypto algorithms. - AdditionalAuthenticatedData []byte `json:"aad,omitempty"` + AdditionalAuthenticatedData []byte // The tag to authenticate when performing decryption with an authenticated algorithm. - AuthenticationTag []byte `json:"tag,omitempty"` + AuthenticationTag []byte // Cryptographically random, non-repeating initialization vector for symmetric algorithms. - IV []byte `json:"iv,omitempty"` + IV []byte } // KeyOperationResult - The key operation result. type KeyOperationResult struct { // READ-ONLY - AdditionalAuthenticatedData []byte `json:"aad,omitempty" azure:"ro"` + AdditionalAuthenticatedData []byte // READ-ONLY - AuthenticationTag []byte `json:"tag,omitempty" azure:"ro"` + AuthenticationTag []byte // READ-ONLY - IV []byte `json:"iv,omitempty" azure:"ro"` + IV []byte // READ-ONLY; Key identifier - KID *ID `json:"kid,omitempty" azure:"ro"` + KID *ID // READ-ONLY - Result []byte `json:"value,omitempty" azure:"ro"` + Result []byte } // KeyProperties - The key item containing key metadata. type KeyProperties struct { // The key management attributes. - Attributes *KeyAttributes `json:"attributes,omitempty"` + Attributes *KeyAttributes // Key identifier. - KID *ID `json:"kid,omitempty"` + KID *ID // Application specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; True if the key's lifetime is managed by key vault. If this is a key backing a certificate, then managed will // be true. - Managed *bool `json:"managed,omitempty" azure:"ro"` + Managed *bool } // KeyPropertiesListResult - The key list result. type KeyPropertiesListResult struct { // READ-ONLY; The URL to get the next set of keys. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; A response message containing a list of keys in the key vault along with a link to the next page of keys. - Value []*KeyProperties `json:"value,omitempty" azure:"ro"` + Value []*KeyProperties } // KeyReleasePolicy - The policy rules under which the key can be exported. type KeyReleasePolicy struct { // Content type and version of key release policy - ContentType *string `json:"contentType,omitempty"` + ContentType *string // Blob encoding the policy rules under which the key can be released. Blob must be base64 URL encoded. - EncodedPolicy []byte `json:"data,omitempty"` + EncodedPolicy []byte // Defines the mutability state of the policy. Once marked immutable, this flag cannot be reset and the policy cannot be changed // under any circumstances. - Immutable *bool `json:"immutable,omitempty"` + Immutable *bool } // KeyReleaseResult - The release result, containing the released key. type KeyReleaseResult struct { // READ-ONLY; A signed object containing the released key. - Value *string `json:"value,omitempty" azure:"ro"` + Value *string } // KeyRotationPolicy - Management policy for a key. type KeyRotationPolicy struct { // The key rotation policy attributes. - Attributes *KeyRotationPolicyAttributes `json:"attributes,omitempty"` + Attributes *KeyRotationPolicyAttributes // Actions that will be performed by Key Vault over the lifetime of a key. For preview, lifetimeActions can only have two // items at maximum: one for rotate, one for notify. Notification time would be // default to 30 days before expiry and it is not configurable. - LifetimeActions []*LifetimeAction `json:"lifetimeActions,omitempty"` + LifetimeActions []*LifetimeAction // READ-ONLY; The key policy id. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string } // KeyRotationPolicyAttributes - The key rotation policy attributes. type KeyRotationPolicyAttributes struct { // The expiryTime will be applied on the new key version. It should be at least 28 days. It will be in ISO 8601 Format. Examples: // 90 days: P90D, 3 months: P3M, 48 hours: PT48H, 1 year and 10 days: P1Y10D - ExpiryTime *string `json:"expiryTime,omitempty"` + ExpiryTime *string // READ-ONLY; The key rotation policy created time in UTC. - Created *time.Time `json:"created,omitempty" azure:"ro"` + Created *time.Time // READ-ONLY; The key rotation policy's last updated time in UTC. - Updated *time.Time `json:"updated,omitempty" azure:"ro"` + Updated *time.Time } // KeyVerifyResult - The key verify result. type KeyVerifyResult struct { // READ-ONLY; True if the signature is verified, otherwise false. - Value *bool `json:"value,omitempty" azure:"ro"` + Value *bool } // LifetimeAction - Action and its trigger that will be performed by Key Vault over the lifetime of a key. type LifetimeAction struct { // The action that will be executed. - Action *LifetimeActionType `json:"action,omitempty"` + Action *LifetimeActionType // The condition that will execute the action. - Trigger *LifetimeActionTrigger `json:"trigger,omitempty"` + Trigger *LifetimeActionTrigger } // LifetimeActionTrigger - A condition to be satisfied for an action to be executed. type LifetimeActionTrigger struct { // Time after creation to attempt to rotate. It only applies to rotate. It will be in ISO 8601 duration format. Example: 90 // days : "P90D" - TimeAfterCreate *string `json:"timeAfterCreate,omitempty"` + TimeAfterCreate *string // Time before expiry to attempt to rotate or notify. It will be in ISO 8601 duration format. Example: 90 days : "P90D" - TimeBeforeExpiry *string `json:"timeBeforeExpiry,omitempty"` + TimeBeforeExpiry *string } // LifetimeActionType - The action that will be executed. type LifetimeActionType struct { // The type of the action. - Type *KeyRotationPolicyAction `json:"type,omitempty"` + Type *KeyRotationPolicyAction } // RandomBytes - The get random bytes response object containing the bytes. type RandomBytes struct { // REQUIRED; The bytes encoded as a base64url string. - Value []byte `json:"value,omitempty"` + Value []byte } // ReleaseParameters - The release key parameters. type ReleaseParameters struct { // REQUIRED; The attestation assertion for the target of the key release. - TargetAttestationToken *string `json:"target,omitempty"` + TargetAttestationToken *string // The encryption algorithm to use to protected the exported key material - Algorithm *KeyEncryptionAlgorithm `json:"enc,omitempty"` + Algorithm *KeyEncryptionAlgorithm // A client provided nonce for freshness. - Nonce *string `json:"nonce,omitempty"` + Nonce *string } // RestoreKeyParameters - The key restore parameters. type RestoreKeyParameters struct { // REQUIRED; The backup blob associated with a key bundle. - KeyBackup []byte `json:"value,omitempty"` + KeyBackup []byte } // SignParameters - The key operations parameters. type SignParameters struct { // REQUIRED; The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. - Algorithm *SignatureAlgorithm `json:"alg,omitempty"` + Algorithm *SignatureAlgorithm // REQUIRED - Value []byte `json:"value,omitempty"` + Value []byte } // UpdateKeyParameters - The key update parameters. type UpdateKeyParameters struct { // The attributes of a key managed by the key vault service. - KeyAttributes *KeyAttributes `json:"attributes,omitempty"` + KeyAttributes *KeyAttributes // Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. - KeyOps []*KeyOperation `json:"key_ops,omitempty"` + KeyOps []*KeyOperation // The policy rules under which the key can be exported. - ReleasePolicy *KeyReleasePolicy `json:"release_policy,omitempty"` + ReleasePolicy *KeyReleasePolicy // Application specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // VerifyParameters - The key verify parameters. type VerifyParameters struct { // REQUIRED; The signing/verification algorithm. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. - Algorithm *SignatureAlgorithm `json:"alg,omitempty"` + Algorithm *SignatureAlgorithm // REQUIRED; The digest used for signing. - Digest []byte `json:"digest,omitempty"` + Digest []byte // REQUIRED; The signature to be verified. - Signature []byte `json:"value,omitempty"` + Signature []byte } diff --git a/sdk/security/keyvault/azkeys/models_serde.go b/sdk/security/keyvault/azkeys/models_serde.go index 2bcbe5563274..c83ccb2c5f26 100644 --- a/sdk/security/keyvault/azkeys/models_serde.go +++ b/sdk/security/keyvault/azkeys/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package azkeys diff --git a/sdk/security/keyvault/azkeys/options.go b/sdk/security/keyvault/azkeys/options.go new file mode 100644 index 000000000000..e3043e7a17e1 --- /dev/null +++ b/sdk/security/keyvault/azkeys/options.go @@ -0,0 +1,131 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package azkeys + +// BackupKeyOptions contains the optional parameters for the Client.BackupKey method. +type BackupKeyOptions struct { + // placeholder for future optional parameters +} + +// CreateKeyOptions contains the optional parameters for the Client.CreateKey method. +type CreateKeyOptions struct { + // placeholder for future optional parameters +} + +// DecryptOptions contains the optional parameters for the Client.Decrypt method. +type DecryptOptions struct { + // placeholder for future optional parameters +} + +// DeleteKeyOptions contains the optional parameters for the Client.DeleteKey method. +type DeleteKeyOptions struct { + // placeholder for future optional parameters +} + +// EncryptOptions contains the optional parameters for the Client.Encrypt method. +type EncryptOptions struct { + // placeholder for future optional parameters +} + +// GetDeletedKeyOptions contains the optional parameters for the Client.GetDeletedKey method. +type GetDeletedKeyOptions struct { + // placeholder for future optional parameters +} + +// GetKeyOptions contains the optional parameters for the Client.GetKey method. +type GetKeyOptions struct { + // placeholder for future optional parameters +} + +// GetKeyRotationPolicyOptions contains the optional parameters for the Client.GetKeyRotationPolicy method. +type GetKeyRotationPolicyOptions struct { + // placeholder for future optional parameters +} + +// GetRandomBytesOptions contains the optional parameters for the Client.GetRandomBytes method. +type GetRandomBytesOptions struct { + // placeholder for future optional parameters +} + +// ImportKeyOptions contains the optional parameters for the Client.ImportKey method. +type ImportKeyOptions struct { + // placeholder for future optional parameters +} + +// ListDeletedKeyPropertiesOptions contains the optional parameters for the Client.NewListDeletedKeyPropertiesPager +// method. +type ListDeletedKeyPropertiesOptions struct { + // placeholder for future optional parameters +} + +// ListKeyPropertiesOptions contains the optional parameters for the Client.NewListKeyPropertiesPager method. +type ListKeyPropertiesOptions struct { + // placeholder for future optional parameters +} + +// ListKeyPropertiesVersionsOptions contains the optional parameters for the Client.NewListKeyPropertiesVersionsPager +// method. +type ListKeyPropertiesVersionsOptions struct { + // placeholder for future optional parameters +} + +// PurgeDeletedKeyOptions contains the optional parameters for the Client.PurgeDeletedKey method. +type PurgeDeletedKeyOptions struct { + // placeholder for future optional parameters +} + +// RecoverDeletedKeyOptions contains the optional parameters for the Client.RecoverDeletedKey method. +type RecoverDeletedKeyOptions struct { + // placeholder for future optional parameters +} + +// ReleaseOptions contains the optional parameters for the Client.Release method. +type ReleaseOptions struct { + // placeholder for future optional parameters +} + +// RestoreKeyOptions contains the optional parameters for the Client.RestoreKey method. +type RestoreKeyOptions struct { + // placeholder for future optional parameters +} + +// RotateKeyOptions contains the optional parameters for the Client.RotateKey method. +type RotateKeyOptions struct { + // placeholder for future optional parameters +} + +// SignOptions contains the optional parameters for the Client.Sign method. +type SignOptions struct { + // placeholder for future optional parameters +} + +// UnwrapKeyOptions contains the optional parameters for the Client.UnwrapKey method. +type UnwrapKeyOptions struct { + // placeholder for future optional parameters +} + +// UpdateKeyOptions contains the optional parameters for the Client.UpdateKey method. +type UpdateKeyOptions struct { + // placeholder for future optional parameters +} + +// UpdateKeyRotationPolicyOptions contains the optional parameters for the Client.UpdateKeyRotationPolicy method. +type UpdateKeyRotationPolicyOptions struct { + // placeholder for future optional parameters +} + +// VerifyOptions contains the optional parameters for the Client.Verify method. +type VerifyOptions struct { + // placeholder for future optional parameters +} + +// WrapKeyOptions contains the optional parameters for the Client.WrapKey method. +type WrapKeyOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/security/keyvault/azkeys/response_types.go b/sdk/security/keyvault/azkeys/response_types.go index e9fe38e6b702..7eb1afbe8163 100644 --- a/sdk/security/keyvault/azkeys/response_types.go +++ b/sdk/security/keyvault/azkeys/response_types.go @@ -3,74 +3,86 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package azkeys // BackupKeyResponse contains the response from method Client.BackupKey. type BackupKeyResponse struct { + // The backup key result, containing the backup blob. BackupKeyResult } // CreateKeyResponse contains the response from method Client.CreateKey. type CreateKeyResponse struct { + // A KeyBundle consisting of a WebKey plus its attributes. KeyBundle } // DecryptResponse contains the response from method Client.Decrypt. type DecryptResponse struct { + // The key operation result. KeyOperationResult } // DeleteKeyResponse contains the response from method Client.DeleteKey. type DeleteKeyResponse struct { + // A DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion info DeletedKey } // EncryptResponse contains the response from method Client.Encrypt. type EncryptResponse struct { + // The key operation result. KeyOperationResult } // GetDeletedKeyResponse contains the response from method Client.GetDeletedKey. type GetDeletedKeyResponse struct { + // A DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion info DeletedKey } // GetKeyResponse contains the response from method Client.GetKey. type GetKeyResponse struct { + // A KeyBundle consisting of a WebKey plus its attributes. KeyBundle } // GetKeyRotationPolicyResponse contains the response from method Client.GetKeyRotationPolicy. type GetKeyRotationPolicyResponse struct { + // Management policy for a key. KeyRotationPolicy } // GetRandomBytesResponse contains the response from method Client.GetRandomBytes. type GetRandomBytesResponse struct { + // The get random bytes response object containing the bytes. RandomBytes } // ImportKeyResponse contains the response from method Client.ImportKey. type ImportKeyResponse struct { + // A KeyBundle consisting of a WebKey plus its attributes. KeyBundle } // ListDeletedKeyPropertiesResponse contains the response from method Client.NewListDeletedKeyPropertiesPager. type ListDeletedKeyPropertiesResponse struct { + // A list of keys that have been deleted in this vault. DeletedKeyPropertiesListResult } // ListKeyPropertiesResponse contains the response from method Client.NewListKeyPropertiesPager. type ListKeyPropertiesResponse struct { + // The key list result. KeyPropertiesListResult } // ListKeyPropertiesVersionsResponse contains the response from method Client.NewListKeyPropertiesVersionsPager. type ListKeyPropertiesVersionsResponse struct { + // The key list result. KeyPropertiesListResult } @@ -81,50 +93,60 @@ type PurgeDeletedKeyResponse struct { // RecoverDeletedKeyResponse contains the response from method Client.RecoverDeletedKey. type RecoverDeletedKeyResponse struct { + // A KeyBundle consisting of a WebKey plus its attributes. KeyBundle } // ReleaseResponse contains the response from method Client.Release. type ReleaseResponse struct { + // The release result, containing the released key. KeyReleaseResult } // RestoreKeyResponse contains the response from method Client.RestoreKey. type RestoreKeyResponse struct { + // A KeyBundle consisting of a WebKey plus its attributes. KeyBundle } // RotateKeyResponse contains the response from method Client.RotateKey. type RotateKeyResponse struct { + // A KeyBundle consisting of a WebKey plus its attributes. KeyBundle } // SignResponse contains the response from method Client.Sign. type SignResponse struct { + // The key operation result. KeyOperationResult } // UnwrapKeyResponse contains the response from method Client.UnwrapKey. type UnwrapKeyResponse struct { + // The key operation result. KeyOperationResult } // UpdateKeyResponse contains the response from method Client.UpdateKey. type UpdateKeyResponse struct { + // A KeyBundle consisting of a WebKey plus its attributes. KeyBundle } // UpdateKeyRotationPolicyResponse contains the response from method Client.UpdateKeyRotationPolicy. type UpdateKeyRotationPolicyResponse struct { + // Management policy for a key. KeyRotationPolicy } // VerifyResponse contains the response from method Client.Verify. type VerifyResponse struct { + // The key verify result. KeyVerifyResult } // WrapKeyResponse contains the response from method Client.WrapKey. type WrapKeyResponse struct { + // The key operation result. KeyOperationResult } diff --git a/sdk/security/keyvault/azkeys/time_unix.go b/sdk/security/keyvault/azkeys/time_unix.go index 077d3ae42d28..63591b5df9f8 100644 --- a/sdk/security/keyvault/azkeys/time_unix.go +++ b/sdk/security/keyvault/azkeys/time_unix.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package azkeys