diff --git a/profiles/preview/keyvault/mgmt/keyvault/models.go b/profiles/preview/keyvault/mgmt/keyvault/models.go index 37dff205d95e..8b276ba8c430 100644 --- a/profiles/preview/keyvault/mgmt/keyvault/models.go +++ b/profiles/preview/keyvault/mgmt/keyvault/models.go @@ -19,7 +19,7 @@ package keyvault -import original "github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2016-10-01/keyvault" +import original "github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2018-02-14/keyvault" const ( DefaultBaseURI = original.DefaultBaseURI @@ -37,6 +37,7 @@ const ( type CertificatePermissions = original.CertificatePermissions const ( + Backup CertificatePermissions = original.Backup Create CertificatePermissions = original.Create Delete CertificatePermissions = original.Delete Deleteissuers CertificatePermissions = original.Deleteissuers @@ -49,6 +50,7 @@ const ( Manageissuers CertificatePermissions = original.Manageissuers Purge CertificatePermissions = original.Purge Recover CertificatePermissions = original.Recover + Restore CertificatePermissions = original.Restore Setissuers CertificatePermissions = original.Setissuers Update CertificatePermissions = original.Update ) @@ -81,6 +83,20 @@ const ( KeyPermissionsWrapKey KeyPermissions = original.KeyPermissionsWrapKey ) +type NetworkRuleAction = original.NetworkRuleAction + +const ( + Allow NetworkRuleAction = original.Allow + Deny NetworkRuleAction = original.Deny +) + +type NetworkRuleBypassOptions = original.NetworkRuleBypassOptions + +const ( + AzureServices NetworkRuleBypassOptions = original.AzureServices + None NetworkRuleBypassOptions = original.None +) + type Reason = original.Reason const ( @@ -134,7 +150,9 @@ type DeletedVaultListResult = original.DeletedVaultListResult type DeletedVaultListResultIterator = original.DeletedVaultListResultIterator type DeletedVaultListResultPage = original.DeletedVaultListResultPage type DeletedVaultProperties = original.DeletedVaultProperties +type IPRule = original.IPRule type LogSpecification = original.LogSpecification +type NetworkRuleSet = original.NetworkRuleSet type Operation = original.Operation type OperationDisplay = original.OperationDisplay type OperationListResult = original.OperationListResult @@ -159,7 +177,9 @@ type VaultListResultPage = original.VaultListResultPage type VaultPatchParameters = original.VaultPatchParameters type VaultPatchProperties = original.VaultPatchProperties type VaultProperties = original.VaultProperties +type VaultsCreateOrUpdateFuture = original.VaultsCreateOrUpdateFuture type VaultsPurgeDeletedFuture = original.VaultsPurgeDeletedFuture +type VirtualNetworkRule = original.VirtualNetworkRule type OperationsClient = original.OperationsClient type VaultsClient = original.VaultsClient @@ -181,6 +201,12 @@ func PossibleCreateModeValues() []CreateMode { func PossibleKeyPermissionsValues() []KeyPermissions { return original.PossibleKeyPermissionsValues() } +func PossibleNetworkRuleActionValues() []NetworkRuleAction { + return original.PossibleNetworkRuleActionValues() +} +func PossibleNetworkRuleBypassOptionsValues() []NetworkRuleBypassOptions { + return original.PossibleNetworkRuleBypassOptionsValues() +} func PossibleReasonValues() []Reason { return original.PossibleReasonValues() } diff --git a/profiles/preview/preview/keyvault/keyvault/models.go b/profiles/preview/preview/keyvault/keyvault/models.go index 511fe28c6ce1..d47450288067 100644 --- a/profiles/preview/preview/keyvault/keyvault/models.go +++ b/profiles/preview/preview/keyvault/keyvault/models.go @@ -41,10 +41,10 @@ const ( type JSONWebKeyCurveName = original.JSONWebKeyCurveName const ( - P256 JSONWebKeyCurveName = original.P256 - P384 JSONWebKeyCurveName = original.P384 - P521 JSONWebKeyCurveName = original.P521 - SECP256K1 JSONWebKeyCurveName = original.SECP256K1 + P256 JSONWebKeyCurveName = original.P256 + P256K JSONWebKeyCurveName = original.P256K + P384 JSONWebKeyCurveName = original.P384 + P521 JSONWebKeyCurveName = original.P521 ) type JSONWebKeyEncryptionAlgorithm = original.JSONWebKeyEncryptionAlgorithm @@ -69,17 +69,17 @@ const ( type JSONWebKeySignatureAlgorithm = original.JSONWebKeySignatureAlgorithm const ( - ECDSA256 JSONWebKeySignatureAlgorithm = original.ECDSA256 - ES256 JSONWebKeySignatureAlgorithm = original.ES256 - ES384 JSONWebKeySignatureAlgorithm = original.ES384 - ES512 JSONWebKeySignatureAlgorithm = original.ES512 - PS256 JSONWebKeySignatureAlgorithm = original.PS256 - PS384 JSONWebKeySignatureAlgorithm = original.PS384 - PS512 JSONWebKeySignatureAlgorithm = original.PS512 - RS256 JSONWebKeySignatureAlgorithm = original.RS256 - RS384 JSONWebKeySignatureAlgorithm = original.RS384 - RS512 JSONWebKeySignatureAlgorithm = original.RS512 - RSNULL JSONWebKeySignatureAlgorithm = original.RSNULL + ES256 JSONWebKeySignatureAlgorithm = original.ES256 + ES256K JSONWebKeySignatureAlgorithm = original.ES256K + ES384 JSONWebKeySignatureAlgorithm = original.ES384 + ES512 JSONWebKeySignatureAlgorithm = original.ES512 + PS256 JSONWebKeySignatureAlgorithm = original.PS256 + PS384 JSONWebKeySignatureAlgorithm = original.PS384 + PS512 JSONWebKeySignatureAlgorithm = original.PS512 + RS256 JSONWebKeySignatureAlgorithm = original.RS256 + RS384 JSONWebKeySignatureAlgorithm = original.RS384 + RS512 JSONWebKeySignatureAlgorithm = original.RS512 + RSNULL JSONWebKeySignatureAlgorithm = original.RSNULL ) type JSONWebKeyType = original.JSONWebKeyType @@ -116,6 +116,7 @@ const ( type Action = original.Action type AdministratorDetails = original.AdministratorDetails type Attributes = original.Attributes +type BackupCertificateResult = original.BackupCertificateResult type BackupKeyResult = original.BackupKeyResult type BackupSecretResult = original.BackupSecretResult type BackupStorageResult = original.BackupStorageResult @@ -137,6 +138,7 @@ type CertificateMergeParameters = original.CertificateMergeParameters type CertificateOperation = original.CertificateOperation type CertificateOperationUpdateParameter = original.CertificateOperationUpdateParameter type CertificatePolicy = original.CertificatePolicy +type CertificateRestoreParameters = original.CertificateRestoreParameters type CertificateUpdateParameters = original.CertificateUpdateParameters type Contact = original.Contact type Contacts = original.Contacts diff --git a/services/keyvault/2015-06-01/keyvault/client.go b/services/keyvault/2015-06-01/keyvault/client.go index a6b4b502d5f2..c068556699a5 100644 --- a/services/keyvault/2015-06-01/keyvault/client.go +++ b/services/keyvault/2015-06-01/keyvault/client.go @@ -1060,7 +1060,7 @@ func (client BaseClient) GetCertificateIssuers(ctx context.Context, vaultBaseURL if err := validation.Validate([]validation.Validation{ {TargetValue: maxresults, Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, }}}}}); err != nil { return result, validation.NewError("keyvault.BaseClient", "GetCertificateIssuers", err.Error()) @@ -1304,7 +1304,7 @@ func (client BaseClient) GetCertificates(ctx context.Context, vaultBaseURL strin if err := validation.Validate([]validation.Validation{ {TargetValue: maxresults, Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, }}}}}); err != nil { return result, validation.NewError("keyvault.BaseClient", "GetCertificates", err.Error()) @@ -1411,7 +1411,7 @@ func (client BaseClient) GetCertificateVersions(ctx context.Context, vaultBaseUR if err := validation.Validate([]validation.Validation{ {TargetValue: maxresults, Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, }}}}}); err != nil { return result, validation.NewError("keyvault.BaseClient", "GetCertificateVersions", err.Error()) @@ -1592,7 +1592,7 @@ func (client BaseClient) GetKeys(ctx context.Context, vaultBaseURL string, maxre if err := validation.Validate([]validation.Validation{ {TargetValue: maxresults, Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, }}}}}); err != nil { return result, validation.NewError("keyvault.BaseClient", "GetKeys", err.Error()) @@ -1699,7 +1699,7 @@ func (client BaseClient) GetKeyVersions(ctx context.Context, vaultBaseURL string if err := validation.Validate([]validation.Validation{ {TargetValue: maxresults, Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, }}}}}); err != nil { return result, validation.NewError("keyvault.BaseClient", "GetKeyVersions", err.Error()) @@ -1880,7 +1880,7 @@ func (client BaseClient) GetSecrets(ctx context.Context, vaultBaseURL string, ma if err := validation.Validate([]validation.Validation{ {TargetValue: maxresults, Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, }}}}}); err != nil { return result, validation.NewError("keyvault.BaseClient", "GetSecrets", err.Error()) @@ -1987,7 +1987,7 @@ func (client BaseClient) GetSecretVersions(ctx context.Context, vaultBaseURL str if err := validation.Validate([]validation.Validation{ {TargetValue: maxresults, Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, }}}}}); err != nil { return result, validation.NewError("keyvault.BaseClient", "GetSecretVersions", err.Error()) diff --git a/services/keyvault/2015-06-01/keyvault/models.go b/services/keyvault/2015-06-01/keyvault/models.go index fa923c8e3c24..1b0407015fed 100644 --- a/services/keyvault/2015-06-01/keyvault/models.go +++ b/services/keyvault/2015-06-01/keyvault/models.go @@ -837,7 +837,7 @@ func (kb KeyBundle) MarshalJSON() ([]byte, error) { type KeyCreateParameters struct { // Kty - The type of key to create. Valid key types, see JsonWebKeyType. Supported JsonWebKey key types (kty) for Elliptic Curve, RSA, HSM, Octet. Possible values include: 'EC', 'RSA', 'RSAHSM', 'Oct' Kty JSONWebKeyType `json:"kty,omitempty"` - // KeySize - The key size in bytes. e.g. 1024 or 2048. + // KeySize - The key size in bits. e.g. 1024 or 2048. KeySize *int32 `json:"key_size,omitempty"` KeyOps *[]JSONWebKeyOperation `json:"key_ops,omitempty"` KeyAttributes *KeyAttributes `json:"attributes,omitempty"` @@ -1049,7 +1049,7 @@ type KeyProperties struct { Exportable *bool `json:"exportable,omitempty"` // KeyType - The key type. KeyType *string `json:"kty,omitempty"` - // KeySize - The key size in bytes. e.g. 2048. + // KeySize - The key size in bits. e.g. 2048. KeySize *int32 `json:"key_size,omitempty"` // ReuseKey - Indicates if the same key pair will be used on certificate renewal. ReuseKey *bool `json:"reuse_key,omitempty"` diff --git a/services/keyvault/2016-10-01/keyvault/client.go b/services/keyvault/2016-10-01/keyvault/client.go index 73558939d68f..731e99857f56 100644 --- a/services/keyvault/2016-10-01/keyvault/client.go +++ b/services/keyvault/2016-10-01/keyvault/client.go @@ -1316,7 +1316,7 @@ func (client BaseClient) GetCertificateIssuers(ctx context.Context, vaultBaseURL if err := validation.Validate([]validation.Validation{ {TargetValue: maxresults, Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, }}}}}); err != nil { return result, validation.NewError("keyvault.BaseClient", "GetCertificateIssuers", err.Error()) @@ -1563,7 +1563,7 @@ func (client BaseClient) GetCertificates(ctx context.Context, vaultBaseURL strin if err := validation.Validate([]validation.Validation{ {TargetValue: maxresults, Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, }}}}}); err != nil { return result, validation.NewError("keyvault.BaseClient", "GetCertificates", err.Error()) @@ -1671,7 +1671,7 @@ func (client BaseClient) GetCertificateVersions(ctx context.Context, vaultBaseUR if err := validation.Validate([]validation.Validation{ {TargetValue: maxresults, Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, }}}}}); err != nil { return result, validation.NewError("keyvault.BaseClient", "GetCertificateVersions", err.Error()) @@ -1855,7 +1855,7 @@ func (client BaseClient) GetDeletedCertificates(ctx context.Context, vaultBaseUR if err := validation.Validate([]validation.Validation{ {TargetValue: maxresults, Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, }}}}}); err != nil { return result, validation.NewError("keyvault.BaseClient", "GetDeletedCertificates", err.Error()) @@ -2035,7 +2035,7 @@ func (client BaseClient) GetDeletedKeys(ctx context.Context, vaultBaseURL string if err := validation.Validate([]validation.Validation{ {TargetValue: maxresults, Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, }}}}}); err != nil { return result, validation.NewError("keyvault.BaseClient", "GetDeletedKeys", err.Error()) @@ -2212,7 +2212,7 @@ func (client BaseClient) GetDeletedSecrets(ctx context.Context, vaultBaseURL str if err := validation.Validate([]validation.Validation{ {TargetValue: maxresults, Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, }}}}}); err != nil { return result, validation.NewError("keyvault.BaseClient", "GetDeletedSecrets", err.Error()) @@ -2393,7 +2393,7 @@ func (client BaseClient) GetKeys(ctx context.Context, vaultBaseURL string, maxre if err := validation.Validate([]validation.Validation{ {TargetValue: maxresults, Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, }}}}}); err != nil { return result, validation.NewError("keyvault.BaseClient", "GetKeys", err.Error()) @@ -2501,7 +2501,7 @@ func (client BaseClient) GetKeyVersions(ctx context.Context, vaultBaseURL string if err := validation.Validate([]validation.Validation{ {TargetValue: maxresults, Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, }}}}}); err != nil { return result, validation.NewError("keyvault.BaseClient", "GetKeyVersions", err.Error()) @@ -2695,7 +2695,7 @@ func (client BaseClient) GetSasDefinitions(ctx context.Context, vaultBaseURL str Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, {TargetValue: maxresults, Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, }}}}}); err != nil { return result, validation.NewError("keyvault.BaseClient", "GetSasDefinitions", err.Error()) @@ -2879,7 +2879,7 @@ func (client BaseClient) GetSecrets(ctx context.Context, vaultBaseURL string, ma if err := validation.Validate([]validation.Validation{ {TargetValue: maxresults, Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, }}}}}); err != nil { return result, validation.NewError("keyvault.BaseClient", "GetSecrets", err.Error()) @@ -2987,7 +2987,7 @@ func (client BaseClient) GetSecretVersions(ctx context.Context, vaultBaseURL str if err := validation.Validate([]validation.Validation{ {TargetValue: maxresults, Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, }}}}}); err != nil { return result, validation.NewError("keyvault.BaseClient", "GetSecretVersions", err.Error()) @@ -3174,7 +3174,7 @@ func (client BaseClient) GetStorageAccounts(ctx context.Context, vaultBaseURL st if err := validation.Validate([]validation.Validation{ {TargetValue: maxresults, Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, }}}}}); err != nil { return result, validation.NewError("keyvault.BaseClient", "GetStorageAccounts", err.Error()) diff --git a/services/keyvault/mgmt/2018-02-14/keyvault/client.go b/services/keyvault/mgmt/2018-02-14/keyvault/client.go new file mode 100644 index 000000000000..4491a94067c5 --- /dev/null +++ b/services/keyvault/mgmt/2018-02-14/keyvault/client.go @@ -0,0 +1,51 @@ +// Package keyvault implements the Azure ARM Keyvault service API version 2018-02-14. +// +// The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. +package keyvault + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Keyvault + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Keyvault. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/keyvault/mgmt/2018-02-14/keyvault/models.go b/services/keyvault/mgmt/2018-02-14/keyvault/models.go new file mode 100644 index 000000000000..1c4cbca7aae0 --- /dev/null +++ b/services/keyvault/mgmt/2018-02-14/keyvault/models.go @@ -0,0 +1,1162 @@ +package keyvault + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/satori/go.uuid" + "net/http" +) + +// AccessPolicyUpdateKind enumerates the values for access policy update kind. +type AccessPolicyUpdateKind string + +const ( + // Add ... + Add AccessPolicyUpdateKind = "add" + // Remove ... + Remove AccessPolicyUpdateKind = "remove" + // Replace ... + Replace AccessPolicyUpdateKind = "replace" +) + +// PossibleAccessPolicyUpdateKindValues returns an array of possible values for the AccessPolicyUpdateKind const type. +func PossibleAccessPolicyUpdateKindValues() []AccessPolicyUpdateKind { + return []AccessPolicyUpdateKind{Add, Remove, Replace} +} + +// CertificatePermissions enumerates the values for certificate permissions. +type CertificatePermissions string + +const ( + // Backup ... + Backup CertificatePermissions = "backup" + // Create ... + Create CertificatePermissions = "create" + // Delete ... + Delete CertificatePermissions = "delete" + // Deleteissuers ... + Deleteissuers CertificatePermissions = "deleteissuers" + // Get ... + Get CertificatePermissions = "get" + // Getissuers ... + Getissuers CertificatePermissions = "getissuers" + // Import ... + Import CertificatePermissions = "import" + // List ... + List CertificatePermissions = "list" + // Listissuers ... + Listissuers CertificatePermissions = "listissuers" + // Managecontacts ... + Managecontacts CertificatePermissions = "managecontacts" + // Manageissuers ... + Manageissuers CertificatePermissions = "manageissuers" + // Purge ... + Purge CertificatePermissions = "purge" + // Recover ... + Recover CertificatePermissions = "recover" + // Restore ... + Restore CertificatePermissions = "restore" + // Setissuers ... + Setissuers CertificatePermissions = "setissuers" + // Update ... + Update CertificatePermissions = "update" +) + +// PossibleCertificatePermissionsValues returns an array of possible values for the CertificatePermissions const type. +func PossibleCertificatePermissionsValues() []CertificatePermissions { + return []CertificatePermissions{Backup, Create, Delete, Deleteissuers, Get, Getissuers, Import, List, Listissuers, Managecontacts, Manageissuers, Purge, Recover, Restore, Setissuers, Update} +} + +// CreateMode enumerates the values for create mode. +type CreateMode string + +const ( + // CreateModeDefault ... + CreateModeDefault CreateMode = "default" + // CreateModeRecover ... + CreateModeRecover CreateMode = "recover" +) + +// PossibleCreateModeValues returns an array of possible values for the CreateMode const type. +func PossibleCreateModeValues() []CreateMode { + return []CreateMode{CreateModeDefault, CreateModeRecover} +} + +// KeyPermissions enumerates the values for key permissions. +type KeyPermissions string + +const ( + // KeyPermissionsBackup ... + KeyPermissionsBackup KeyPermissions = "backup" + // KeyPermissionsCreate ... + KeyPermissionsCreate KeyPermissions = "create" + // KeyPermissionsDecrypt ... + KeyPermissionsDecrypt KeyPermissions = "decrypt" + // KeyPermissionsDelete ... + KeyPermissionsDelete KeyPermissions = "delete" + // KeyPermissionsEncrypt ... + KeyPermissionsEncrypt KeyPermissions = "encrypt" + // KeyPermissionsGet ... + KeyPermissionsGet KeyPermissions = "get" + // KeyPermissionsImport ... + KeyPermissionsImport KeyPermissions = "import" + // KeyPermissionsList ... + KeyPermissionsList KeyPermissions = "list" + // KeyPermissionsPurge ... + KeyPermissionsPurge KeyPermissions = "purge" + // KeyPermissionsRecover ... + KeyPermissionsRecover KeyPermissions = "recover" + // KeyPermissionsRestore ... + KeyPermissionsRestore KeyPermissions = "restore" + // KeyPermissionsSign ... + KeyPermissionsSign KeyPermissions = "sign" + // KeyPermissionsUnwrapKey ... + KeyPermissionsUnwrapKey KeyPermissions = "unwrapKey" + // KeyPermissionsUpdate ... + KeyPermissionsUpdate KeyPermissions = "update" + // KeyPermissionsVerify ... + KeyPermissionsVerify KeyPermissions = "verify" + // KeyPermissionsWrapKey ... + KeyPermissionsWrapKey KeyPermissions = "wrapKey" +) + +// PossibleKeyPermissionsValues returns an array of possible values for the KeyPermissions const type. +func PossibleKeyPermissionsValues() []KeyPermissions { + return []KeyPermissions{KeyPermissionsBackup, KeyPermissionsCreate, KeyPermissionsDecrypt, KeyPermissionsDelete, KeyPermissionsEncrypt, KeyPermissionsGet, KeyPermissionsImport, KeyPermissionsList, KeyPermissionsPurge, KeyPermissionsRecover, KeyPermissionsRestore, KeyPermissionsSign, KeyPermissionsUnwrapKey, KeyPermissionsUpdate, KeyPermissionsVerify, KeyPermissionsWrapKey} +} + +// NetworkRuleAction enumerates the values for network rule action. +type NetworkRuleAction string + +const ( + // Allow ... + Allow NetworkRuleAction = "Allow" + // Deny ... + Deny NetworkRuleAction = "Deny" +) + +// PossibleNetworkRuleActionValues returns an array of possible values for the NetworkRuleAction const type. +func PossibleNetworkRuleActionValues() []NetworkRuleAction { + return []NetworkRuleAction{Allow, Deny} +} + +// NetworkRuleBypassOptions enumerates the values for network rule bypass options. +type NetworkRuleBypassOptions string + +const ( + // AzureServices ... + AzureServices NetworkRuleBypassOptions = "AzureServices" + // None ... + None NetworkRuleBypassOptions = "None" +) + +// PossibleNetworkRuleBypassOptionsValues returns an array of possible values for the NetworkRuleBypassOptions const type. +func PossibleNetworkRuleBypassOptionsValues() []NetworkRuleBypassOptions { + return []NetworkRuleBypassOptions{AzureServices, None} +} + +// Reason enumerates the values for reason. +type Reason string + +const ( + // AccountNameInvalid ... + AccountNameInvalid Reason = "AccountNameInvalid" + // AlreadyExists ... + AlreadyExists Reason = "AlreadyExists" +) + +// PossibleReasonValues returns an array of possible values for the Reason const type. +func PossibleReasonValues() []Reason { + return []Reason{AccountNameInvalid, AlreadyExists} +} + +// SecretPermissions enumerates the values for secret permissions. +type SecretPermissions string + +const ( + // SecretPermissionsBackup ... + SecretPermissionsBackup SecretPermissions = "backup" + // SecretPermissionsDelete ... + SecretPermissionsDelete SecretPermissions = "delete" + // SecretPermissionsGet ... + SecretPermissionsGet SecretPermissions = "get" + // SecretPermissionsList ... + SecretPermissionsList SecretPermissions = "list" + // SecretPermissionsPurge ... + SecretPermissionsPurge SecretPermissions = "purge" + // SecretPermissionsRecover ... + SecretPermissionsRecover SecretPermissions = "recover" + // SecretPermissionsRestore ... + SecretPermissionsRestore SecretPermissions = "restore" + // SecretPermissionsSet ... + SecretPermissionsSet SecretPermissions = "set" +) + +// PossibleSecretPermissionsValues returns an array of possible values for the SecretPermissions const type. +func PossibleSecretPermissionsValues() []SecretPermissions { + return []SecretPermissions{SecretPermissionsBackup, SecretPermissionsDelete, SecretPermissionsGet, SecretPermissionsList, SecretPermissionsPurge, SecretPermissionsRecover, SecretPermissionsRestore, SecretPermissionsSet} +} + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // Premium ... + Premium SkuName = "premium" + // Standard ... + Standard SkuName = "standard" +) + +// PossibleSkuNameValues returns an array of possible values for the SkuName const type. +func PossibleSkuNameValues() []SkuName { + return []SkuName{Premium, Standard} +} + +// StoragePermissions enumerates the values for storage permissions. +type StoragePermissions string + +const ( + // StoragePermissionsBackup ... + StoragePermissionsBackup StoragePermissions = "backup" + // StoragePermissionsDelete ... + StoragePermissionsDelete StoragePermissions = "delete" + // StoragePermissionsDeletesas ... + StoragePermissionsDeletesas StoragePermissions = "deletesas" + // StoragePermissionsGet ... + StoragePermissionsGet StoragePermissions = "get" + // StoragePermissionsGetsas ... + StoragePermissionsGetsas StoragePermissions = "getsas" + // StoragePermissionsList ... + StoragePermissionsList StoragePermissions = "list" + // StoragePermissionsListsas ... + StoragePermissionsListsas StoragePermissions = "listsas" + // StoragePermissionsPurge ... + StoragePermissionsPurge StoragePermissions = "purge" + // StoragePermissionsRecover ... + StoragePermissionsRecover StoragePermissions = "recover" + // StoragePermissionsRegeneratekey ... + StoragePermissionsRegeneratekey StoragePermissions = "regeneratekey" + // StoragePermissionsRestore ... + StoragePermissionsRestore StoragePermissions = "restore" + // StoragePermissionsSet ... + StoragePermissionsSet StoragePermissions = "set" + // StoragePermissionsSetsas ... + StoragePermissionsSetsas StoragePermissions = "setsas" + // StoragePermissionsUpdate ... + StoragePermissionsUpdate StoragePermissions = "update" +) + +// PossibleStoragePermissionsValues returns an array of possible values for the StoragePermissions const type. +func PossibleStoragePermissionsValues() []StoragePermissions { + return []StoragePermissions{StoragePermissionsBackup, StoragePermissionsDelete, StoragePermissionsDeletesas, StoragePermissionsGet, StoragePermissionsGetsas, StoragePermissionsList, StoragePermissionsListsas, StoragePermissionsPurge, StoragePermissionsRecover, StoragePermissionsRegeneratekey, StoragePermissionsRestore, StoragePermissionsSet, StoragePermissionsSetsas, StoragePermissionsUpdate} +} + +// AccessPolicyEntry an identity that have access to the key vault. All identities in the array must use the same +// tenant ID as the key vault's tenant ID. +type AccessPolicyEntry struct { + // TenantID - The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // ObjectID - The object ID of a user, service principal or security group in the Azure Active Directory tenant for the vault. The object ID must be unique for the list of access policies. + ObjectID *string `json:"objectId,omitempty"` + // ApplicationID - Application ID of the client making request on behalf of a principal + ApplicationID *uuid.UUID `json:"applicationId,omitempty"` + // Permissions - Permissions the identity has for keys, secrets and certificates. + Permissions *Permissions `json:"permissions,omitempty"` +} + +// CheckNameAvailabilityResult the CheckNameAvailability operation response. +type CheckNameAvailabilityResult struct { + autorest.Response `json:"-"` + // NameAvailable - A boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or is invalid and cannot be used. + NameAvailable *bool `json:"nameAvailable,omitempty"` + // Reason - The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. Possible values include: 'AccountNameInvalid', 'AlreadyExists' + Reason Reason `json:"reason,omitempty"` + // Message - An error message explaining the Reason value in more detail. + Message *string `json:"message,omitempty"` +} + +// DeletedVault deleted vault information with extended details. +type DeletedVault struct { + autorest.Response `json:"-"` + // ID - The resource ID for the deleted key vault. + ID *string `json:"id,omitempty"` + // Name - The name of the key vault. + Name *string `json:"name,omitempty"` + // Type - The resource type of the key vault. + Type *string `json:"type,omitempty"` + // Properties - Properties of the vault + Properties *DeletedVaultProperties `json:"properties,omitempty"` +} + +// DeletedVaultListResult list of vaults +type DeletedVaultListResult struct { + autorest.Response `json:"-"` + // Value - The list of deleted vaults. + Value *[]DeletedVault `json:"value,omitempty"` + // NextLink - The URL to get the next set of deleted vaults. + NextLink *string `json:"nextLink,omitempty"` +} + +// DeletedVaultListResultIterator provides access to a complete listing of DeletedVault values. +type DeletedVaultListResultIterator struct { + i int + page DeletedVaultListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DeletedVaultListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DeletedVaultListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DeletedVaultListResultIterator) Response() DeletedVaultListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DeletedVaultListResultIterator) Value() DeletedVault { + if !iter.page.NotDone() { + return DeletedVault{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (dvlr DeletedVaultListResult) IsEmpty() bool { + return dvlr.Value == nil || len(*dvlr.Value) == 0 +} + +// deletedVaultListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dvlr DeletedVaultListResult) deletedVaultListResultPreparer() (*http.Request, error) { + if dvlr.NextLink == nil || len(to.String(dvlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dvlr.NextLink))) +} + +// DeletedVaultListResultPage contains a page of DeletedVault values. +type DeletedVaultListResultPage struct { + fn func(DeletedVaultListResult) (DeletedVaultListResult, error) + dvlr DeletedVaultListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DeletedVaultListResultPage) Next() error { + next, err := page.fn(page.dvlr) + if err != nil { + return err + } + page.dvlr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DeletedVaultListResultPage) NotDone() bool { + return !page.dvlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DeletedVaultListResultPage) Response() DeletedVaultListResult { + return page.dvlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DeletedVaultListResultPage) Values() []DeletedVault { + if page.dvlr.IsEmpty() { + return nil + } + return *page.dvlr.Value +} + +// DeletedVaultProperties properties of the deleted vault. +type DeletedVaultProperties struct { + // VaultID - The resource id of the original vault. + VaultID *string `json:"vaultId,omitempty"` + // Location - The location of the original vault. + Location *string `json:"location,omitempty"` + // DeletionDate - The deleted date. + DeletionDate *date.Time `json:"deletionDate,omitempty"` + // ScheduledPurgeDate - The scheduled purged date. + ScheduledPurgeDate *date.Time `json:"scheduledPurgeDate,omitempty"` + // Tags - Tags of the original vault. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for DeletedVaultProperties. +func (dvp DeletedVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dvp.VaultID != nil { + objectMap["vaultId"] = dvp.VaultID + } + if dvp.Location != nil { + objectMap["location"] = dvp.Location + } + if dvp.DeletionDate != nil { + objectMap["deletionDate"] = dvp.DeletionDate + } + if dvp.ScheduledPurgeDate != nil { + objectMap["scheduledPurgeDate"] = dvp.ScheduledPurgeDate + } + if dvp.Tags != nil { + objectMap["tags"] = dvp.Tags + } + return json.Marshal(objectMap) +} + +// IPRule a rule governing the accesibility of a vault from a specific ip address or ip range. +type IPRule struct { + // Value - An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). + Value *string `json:"value,omitempty"` +} + +// LogSpecification log specification of operation. +type LogSpecification struct { + // Name - Name of log specification. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of log specification. + DisplayName *string `json:"displayName,omitempty"` + // BlobDuration - Blob duration of specification. + BlobDuration *string `json:"blobDuration,omitempty"` +} + +// NetworkRuleSet a set of rules governing the network accessibility of a vault. +type NetworkRuleSet struct { + // Bypass - Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. Possible values include: 'AzureServices', 'None' + Bypass NetworkRuleBypassOptions `json:"bypass,omitempty"` + // DefaultAction - The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. Possible values include: 'Allow', 'Deny' + DefaultAction NetworkRuleAction `json:"defaultAction,omitempty"` + // IPRules - The list of IP address rules. + IPRules *[]IPRule `json:"ipRules,omitempty"` + // VirtualNetworkRules - The list of virtual network rules. + VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` +} + +// Operation key Vault REST API operation definition. +type Operation struct { + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - Display metadata associated with the operation. + Display *OperationDisplay `json:"display,omitempty"` + // Origin - The origin of operations. + Origin *string `json:"origin,omitempty"` + // OperationProperties - Properties of operation, include metric specifications. + *OperationProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.Name != nil { + objectMap["name"] = o.Name + } + if o.Display != nil { + objectMap["display"] = o.Display + } + if o.Origin != nil { + objectMap["origin"] = o.Origin + } + if o.OperationProperties != nil { + objectMap["properties"] = o.OperationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Operation struct. +func (o *Operation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + o.Name = &name + } + case "display": + if v != nil { + var display OperationDisplay + err = json.Unmarshal(*v, &display) + if err != nil { + return err + } + o.Display = &display + } + case "origin": + if v != nil { + var origin string + err = json.Unmarshal(*v, &origin) + if err != nil { + return err + } + o.Origin = &origin + } + case "properties": + if v != nil { + var operationProperties OperationProperties + err = json.Unmarshal(*v, &operationProperties) + if err != nil { + return err + } + o.OperationProperties = &operationProperties + } + } + } + + return nil +} + +// OperationDisplay display metadata associated with the operation. +type OperationDisplay struct { + // Provider - Service provider: Microsoft Key Vault. + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed etc. + Resource *string `json:"resource,omitempty"` + // Operation - Type of operation: get, read, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Decription of operation. + Description *string `json:"description,omitempty"` +} + +// OperationListResult result of the request to list Storage operations. It contains a list of operations and a URL +// link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - List of Storage operations supported by the Storage resource provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - The URL to get the next set of operations. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer() (*http.Request, error) { + if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) Next() error { + next, err := page.fn(page.olr) + if err != nil { + return err + } + page.olr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// OperationProperties properties of operation, include metric specifications. +type OperationProperties struct { + // ServiceSpecification - One property of operation, include metric specifications. + ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// Permissions permissions the identity has for keys, secrets, certificates and storage. +type Permissions struct { + // Keys - Permissions to keys + Keys *[]KeyPermissions `json:"keys,omitempty"` + // Secrets - Permissions to secrets + Secrets *[]SecretPermissions `json:"secrets,omitempty"` + // Certificates - Permissions to certificates + Certificates *[]CertificatePermissions `json:"certificates,omitempty"` + // Storage - Permissions to storage accounts + Storage *[]StoragePermissions `json:"storage,omitempty"` +} + +// Resource key Vault resource +type Resource struct { + // ID - The Azure Resource Manager resource ID for the key vault. + ID *string `json:"id,omitempty"` + // Name - The name of the key vault. + Name *string `json:"name,omitempty"` + // Type - The resource type of the key vault. + Type *string `json:"type,omitempty"` + // Location - The supported Azure location where the key vault should be created. + Location *string `json:"location,omitempty"` + // Tags - The tags that will be assigned to the key vault. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.ID != nil { + objectMap["id"] = r.ID + } + if r.Name != nil { + objectMap["name"] = r.Name + } + if r.Type != nil { + objectMap["type"] = r.Type + } + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// ResourceListResult list of vault resources. +type ResourceListResult struct { + autorest.Response `json:"-"` + // Value - The list of vault resources. + Value *[]Resource `json:"value,omitempty"` + // NextLink - The URL to get the next set of vault resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResourceListResultIterator provides access to a complete listing of Resource values. +type ResourceListResultIterator struct { + i int + page ResourceListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ResourceListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResourceListResultIterator) Response() ResourceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResourceListResultIterator) Value() Resource { + if !iter.page.NotDone() { + return Resource{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rlr ResourceListResult) IsEmpty() bool { + return rlr.Value == nil || len(*rlr.Value) == 0 +} + +// resourceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rlr ResourceListResult) resourceListResultPreparer() (*http.Request, error) { + if rlr.NextLink == nil || len(to.String(rlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rlr.NextLink))) +} + +// ResourceListResultPage contains a page of Resource values. +type ResourceListResultPage struct { + fn func(ResourceListResult) (ResourceListResult, error) + rlr ResourceListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResourceListResultPage) Next() error { + next, err := page.fn(page.rlr) + if err != nil { + return err + } + page.rlr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceListResultPage) NotDone() bool { + return !page.rlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceListResultPage) Response() ResourceListResult { + return page.rlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceListResultPage) Values() []Resource { + if page.rlr.IsEmpty() { + return nil + } + return *page.rlr.Value +} + +// ServiceSpecification one property of operation, include log specifications. +type ServiceSpecification struct { + // LogSpecifications - Log specifications of operation. + LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` +} + +// Sku SKU details +type Sku struct { + // Family - SKU family name + Family *string `json:"family,omitempty"` + // Name - SKU name to specify whether the key vault is a standard vault or a premium vault. Possible values include: 'Standard', 'Premium' + Name SkuName `json:"name,omitempty"` +} + +// Vault resource information with extended details. +type Vault struct { + autorest.Response `json:"-"` + // Properties - Properties of the vault + Properties *VaultProperties `json:"properties,omitempty"` + // ID - The Azure Resource Manager resource ID for the key vault. + ID *string `json:"id,omitempty"` + // Name - The name of the key vault. + Name *string `json:"name,omitempty"` + // Type - The resource type of the key vault. + Type *string `json:"type,omitempty"` + // Location - The supported Azure location where the key vault should be created. + Location *string `json:"location,omitempty"` + // Tags - The tags that will be assigned to the key vault. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Vault. +func (vVar Vault) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vVar.Properties != nil { + objectMap["properties"] = vVar.Properties + } + if vVar.ID != nil { + objectMap["id"] = vVar.ID + } + if vVar.Name != nil { + objectMap["name"] = vVar.Name + } + if vVar.Type != nil { + objectMap["type"] = vVar.Type + } + if vVar.Location != nil { + objectMap["location"] = vVar.Location + } + if vVar.Tags != nil { + objectMap["tags"] = vVar.Tags + } + return json.Marshal(objectMap) +} + +// VaultAccessPolicyParameters parameters for updating the access policy in a vault +type VaultAccessPolicyParameters struct { + autorest.Response `json:"-"` + // ID - The resource id of the access policy. + ID *string `json:"id,omitempty"` + // Name - The resource name of the access policy. + Name *string `json:"name,omitempty"` + // Type - The resource name of the access policy. + Type *string `json:"type,omitempty"` + // Location - The resource type of the the access policy. + Location *string `json:"location,omitempty"` + // Properties - Properties of the access policy + Properties *VaultAccessPolicyProperties `json:"properties,omitempty"` +} + +// VaultAccessPolicyProperties properties of the vault access policy +type VaultAccessPolicyProperties struct { + // AccessPolicies - An array of 0 to 16 identities that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. + AccessPolicies *[]AccessPolicyEntry `json:"accessPolicies,omitempty"` +} + +// VaultCheckNameAvailabilityParameters the parameters used to check the availabity of the vault name. +type VaultCheckNameAvailabilityParameters struct { + // Name - The vault name. + Name *string `json:"name,omitempty"` + // Type - The type of resource, Microsoft.KeyVault/vaults + Type *string `json:"type,omitempty"` +} + +// VaultCreateOrUpdateParameters parameters for creating or updating a vault +type VaultCreateOrUpdateParameters struct { + // Location - The supported Azure location where the key vault should be created. + Location *string `json:"location,omitempty"` + // Tags - The tags that will be assigned to the key vault. + Tags map[string]*string `json:"tags"` + // Properties - Properties of the vault + Properties *VaultProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for VaultCreateOrUpdateParameters. +func (vcoup VaultCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vcoup.Location != nil { + objectMap["location"] = vcoup.Location + } + if vcoup.Tags != nil { + objectMap["tags"] = vcoup.Tags + } + if vcoup.Properties != nil { + objectMap["properties"] = vcoup.Properties + } + return json.Marshal(objectMap) +} + +// VaultListResult list of vaults +type VaultListResult struct { + autorest.Response `json:"-"` + // Value - The list of vaults. + Value *[]Vault `json:"value,omitempty"` + // NextLink - The URL to get the next set of vaults. + NextLink *string `json:"nextLink,omitempty"` +} + +// VaultListResultIterator provides access to a complete listing of Vault values. +type VaultListResultIterator struct { + i int + page VaultListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VaultListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VaultListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VaultListResultIterator) Response() VaultListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VaultListResultIterator) Value() Vault { + if !iter.page.NotDone() { + return Vault{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (vlr VaultListResult) IsEmpty() bool { + return vlr.Value == nil || len(*vlr.Value) == 0 +} + +// vaultListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vlr VaultListResult) vaultListResultPreparer() (*http.Request, error) { + if vlr.NextLink == nil || len(to.String(vlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vlr.NextLink))) +} + +// VaultListResultPage contains a page of Vault values. +type VaultListResultPage struct { + fn func(VaultListResult) (VaultListResult, error) + vlr VaultListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VaultListResultPage) Next() error { + next, err := page.fn(page.vlr) + if err != nil { + return err + } + page.vlr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VaultListResultPage) NotDone() bool { + return !page.vlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VaultListResultPage) Response() VaultListResult { + return page.vlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VaultListResultPage) Values() []Vault { + if page.vlr.IsEmpty() { + return nil + } + return *page.vlr.Value +} + +// VaultPatchParameters parameters for creating or updating a vault +type VaultPatchParameters struct { + // Tags - The tags that will be assigned to the key vault. + Tags map[string]*string `json:"tags"` + // Properties - Properties of the vault + Properties *VaultPatchProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for VaultPatchParameters. +func (vpp VaultPatchParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vpp.Tags != nil { + objectMap["tags"] = vpp.Tags + } + if vpp.Properties != nil { + objectMap["properties"] = vpp.Properties + } + return json.Marshal(objectMap) +} + +// VaultPatchProperties properties of the vault +type VaultPatchProperties struct { + // TenantID - The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // Sku - SKU details + Sku *Sku `json:"sku,omitempty"` + // AccessPolicies - An array of 0 to 16 identities that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. + AccessPolicies *[]AccessPolicyEntry `json:"accessPolicies,omitempty"` + // EnabledForDeployment - Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault. + EnabledForDeployment *bool `json:"enabledForDeployment,omitempty"` + // EnabledForDiskEncryption - Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys. + EnabledForDiskEncryption *bool `json:"enabledForDiskEncryption,omitempty"` + // EnabledForTemplateDeployment - Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault. + EnabledForTemplateDeployment *bool `json:"enabledForTemplateDeployment,omitempty"` + // EnableSoftDelete - Property to specify whether the 'soft delete' functionality is enabled for this key vault. It does not accept false value. + EnableSoftDelete *bool `json:"enableSoftDelete,omitempty"` + // CreateMode - The vault's create mode to indicate whether the vault need to be recovered or not. Possible values include: 'CreateModeRecover', 'CreateModeDefault' + CreateMode CreateMode `json:"createMode,omitempty"` + // EnablePurgeProtection - Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The setting is effective only if soft delete is also enabled. Enabling this functionality is irreversible - that is, the property does not accept false as its value. + EnablePurgeProtection *bool `json:"enablePurgeProtection,omitempty"` + // NetworkAcls - A collection of rules governing the accessibility of the vault from specific network locations. + NetworkAcls *NetworkRuleSet `json:"networkAcls,omitempty"` +} + +// VaultProperties properties of the vault +type VaultProperties struct { + // TenantID - The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // Sku - SKU details + Sku *Sku `json:"sku,omitempty"` + // AccessPolicies - An array of 0 to 16 identities that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. + AccessPolicies *[]AccessPolicyEntry `json:"accessPolicies,omitempty"` + // VaultURI - The URI of the vault for performing operations on keys and secrets. + VaultURI *string `json:"vaultUri,omitempty"` + // EnabledForDeployment - Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault. + EnabledForDeployment *bool `json:"enabledForDeployment,omitempty"` + // EnabledForDiskEncryption - Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys. + EnabledForDiskEncryption *bool `json:"enabledForDiskEncryption,omitempty"` + // EnabledForTemplateDeployment - Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault. + EnabledForTemplateDeployment *bool `json:"enabledForTemplateDeployment,omitempty"` + // EnableSoftDelete - Property to specify whether the 'soft delete' functionality is enabled for this key vault. It does not accept false value. + EnableSoftDelete *bool `json:"enableSoftDelete,omitempty"` + // CreateMode - The vault's create mode to indicate whether the vault need to be recovered or not. Possible values include: 'CreateModeRecover', 'CreateModeDefault' + CreateMode CreateMode `json:"createMode,omitempty"` + // EnablePurgeProtection - Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The setting is effective only if soft delete is also enabled. Enabling this functionality is irreversible - that is, the property does not accept false as its value. + EnablePurgeProtection *bool `json:"enablePurgeProtection,omitempty"` + // NetworkAcls - A collection of rules governing the accessibility of the vault from specific network locations. + NetworkAcls *NetworkRuleSet `json:"networkAcls,omitempty"` +} + +// VaultsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type VaultsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VaultsCreateOrUpdateFuture) Result(client VaultsClient) (vVar Vault, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("keyvault.VaultsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vVar.Response.Response, err = future.GetResult(sender); err == nil && vVar.Response.Response.StatusCode != http.StatusNoContent { + vVar, err = client.CreateOrUpdateResponder(vVar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsCreateOrUpdateFuture", "Result", vVar.Response.Response, "Failure responding to request") + } + } + return +} + +// VaultsPurgeDeletedFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type VaultsPurgeDeletedFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VaultsPurgeDeletedFuture) Result(client VaultsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsPurgeDeletedFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("keyvault.VaultsPurgeDeletedFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetworkRule a rule governing the accesibility of a vault from a specific virtual network. +type VirtualNetworkRule struct { + // ID - Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + ID *string `json:"id,omitempty"` +} diff --git a/services/keyvault/mgmt/2018-02-14/keyvault/operations.go b/services/keyvault/mgmt/2018-02-14/keyvault/operations.go new file mode 100644 index 000000000000..13d26390d2b2 --- /dev/null +++ b/services/keyvault/mgmt/2018-02-14/keyvault/operations.go @@ -0,0 +1,127 @@ +package keyvault + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// OperationsClient is the the Azure management API provides a RESTful set of web services that interact with Azure Key +// Vault. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available Key Vault Rest API operations. +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2018-02-14" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.KeyVault/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + result.page, err = client.List(ctx) + return +} diff --git a/services/keyvault/mgmt/2018-02-14/keyvault/vaults.go b/services/keyvault/mgmt/2018-02-14/keyvault/vaults.go new file mode 100644 index 000000000000..826a1b38bcdd --- /dev/null +++ b/services/keyvault/mgmt/2018-02-14/keyvault/vaults.go @@ -0,0 +1,1008 @@ +package keyvault + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// VaultsClient is the the Azure management API provides a RESTful set of web services that interact with Azure Key +// Vault. +type VaultsClient struct { + BaseClient +} + +// NewVaultsClient creates an instance of the VaultsClient client. +func NewVaultsClient(subscriptionID string) VaultsClient { + return NewVaultsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVaultsClientWithBaseURI creates an instance of the VaultsClient client. +func NewVaultsClientWithBaseURI(baseURI string, subscriptionID string) VaultsClient { + return VaultsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability checks that the vault name is valid and is not already in use. +// Parameters: +// vaultName - the name of the vault. +func (client VaultsClient) CheckNameAvailability(ctx context.Context, vaultName VaultCheckNameAvailabilityParameters) (result CheckNameAvailabilityResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: vaultName, + Constraints: []validation.Constraint{{Target: "vaultName.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "vaultName.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.VaultsClient", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, vaultName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "CheckNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client VaultsClient) CheckNameAvailabilityPreparer(ctx context.Context, vaultName VaultCheckNameAvailabilityParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-02-14" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability", pathParameters), + autorest.WithJSON(vaultName), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client VaultsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate create or update a key vault in the specified subscription. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the server belongs. +// vaultName - name of the vault +// parameters - parameters to create or update the vault +func (client VaultsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, parameters VaultCreateOrUpdateParameters) (result VaultsCreateOrUpdateFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: vaultName, + Constraints: []validation.Constraint{{Target: "vaultName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.TenantID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Properties.Sku", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.Sku.Family", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("keyvault.VaultsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, vaultName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VaultsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, vaultName string, parameters VaultCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2018-02-14" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) CreateOrUpdateSender(req *http.Request) (future VaultsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VaultsClient) CreateOrUpdateResponder(resp *http.Response) (result Vault, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified Azure key vault. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the vault belongs. +// vaultName - the name of the vault to delete +func (client VaultsClient) Delete(ctx context.Context, resourceGroupName string, vaultName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, vaultName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VaultsClient) DeletePreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2018-02-14" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VaultsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified Azure key vault. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the vault belongs. +// vaultName - the name of the vault. +func (client VaultsClient) Get(ctx context.Context, resourceGroupName string, vaultName string) (result Vault, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, vaultName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VaultsClient) GetPreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2018-02-14" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VaultsClient) GetResponder(resp *http.Response) (result Vault, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDeleted gets the deleted Azure key vault. +// Parameters: +// vaultName - the name of the vault. +// location - the location of the deleted vault. +func (client VaultsClient) GetDeleted(ctx context.Context, vaultName string, location string) (result DeletedVault, err error) { + req, err := client.GetDeletedPreparer(ctx, vaultName, location) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "GetDeleted", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeletedSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "GetDeleted", resp, "Failure sending request") + return + } + + result, err = client.GetDeletedResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "GetDeleted", resp, "Failure responding to request") + } + + return +} + +// GetDeletedPreparer prepares the GetDeleted request. +func (client VaultsClient) GetDeletedPreparer(ctx context.Context, vaultName string, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2018-02-14" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeletedSender sends the GetDeleted request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) GetDeletedSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetDeletedResponder handles the response to the GetDeleted request. The method always +// closes the http.Response Body. +func (client VaultsClient) GetDeletedResponder(resp *http.Response) (result DeletedVault, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List the List operation gets information about the vaults associated with the subscription. +// Parameters: +// top - maximum number of results to return. +func (client VaultsClient) List(ctx context.Context, top *int32) (result ResourceListResultPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, top) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", resp, "Failure sending request") + return + } + + result.rlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VaultsClient) ListPreparer(ctx context.Context, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-11-01" + queryParameters := map[string]interface{}{ + "$filter": autorest.Encode("query", "resourceType eq 'Microsoft.KeyVault/vaults'"), + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VaultsClient) ListResponder(resp *http.Response) (result ResourceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VaultsClient) listNextResults(lastResults ResourceListResult) (result ResourceListResult, err error) { + req, err := lastResults.resourceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VaultsClient) ListComplete(ctx context.Context, top *int32) (result ResourceListResultIterator, err error) { + result.page, err = client.List(ctx, top) + return +} + +// ListByResourceGroup the List operation gets information about the vaults associated with the subscription and within +// the specified resource group. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the vault belongs. +// top - maximum number of results to return. +func (client VaultsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, top *int32) (result VaultListResultPage, err error) { + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.vlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.vlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client VaultsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-02-14" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client VaultsClient) ListByResourceGroupResponder(resp *http.Response) (result VaultListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client VaultsClient) listByResourceGroupNextResults(lastResults VaultListResult) (result VaultListResult, err error) { + req, err := lastResults.vaultListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client VaultsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, top *int32) (result VaultListResultIterator, err error) { + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, top) + return +} + +// ListBySubscription the List operation gets information about the vaults associated with the subscription. +// Parameters: +// top - maximum number of results to return. +func (client VaultsClient) ListBySubscription(ctx context.Context, top *int32) (result VaultListResultPage, err error) { + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx, top) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.vlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.vlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client VaultsClient) ListBySubscriptionPreparer(ctx context.Context, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-02-14" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client VaultsClient) ListBySubscriptionResponder(resp *http.Response) (result VaultListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client VaultsClient) listBySubscriptionNextResults(lastResults VaultListResult) (result VaultListResult, err error) { + req, err := lastResults.vaultListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client VaultsClient) ListBySubscriptionComplete(ctx context.Context, top *int32) (result VaultListResultIterator, err error) { + result.page, err = client.ListBySubscription(ctx, top) + return +} + +// ListDeleted gets information about the deleted vaults in a subscription. +func (client VaultsClient) ListDeleted(ctx context.Context) (result DeletedVaultListResultPage, err error) { + result.fn = client.listDeletedNextResults + req, err := client.ListDeletedPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListDeleted", nil, "Failure preparing request") + return + } + + resp, err := client.ListDeletedSender(req) + if err != nil { + result.dvlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListDeleted", resp, "Failure sending request") + return + } + + result.dvlr, err = client.ListDeletedResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListDeleted", resp, "Failure responding to request") + } + + return +} + +// ListDeletedPreparer prepares the ListDeleted request. +func (client VaultsClient) ListDeletedPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-02-14" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListDeletedSender sends the ListDeleted request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) ListDeletedSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListDeletedResponder handles the response to the ListDeleted request. The method always +// closes the http.Response Body. +func (client VaultsClient) ListDeletedResponder(resp *http.Response) (result DeletedVaultListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listDeletedNextResults retrieves the next set of results, if any. +func (client VaultsClient) listDeletedNextResults(lastResults DeletedVaultListResult) (result DeletedVaultListResult, err error) { + req, err := lastResults.deletedVaultListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listDeletedNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListDeletedSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listDeletedNextResults", resp, "Failure sending next results request") + } + result, err = client.ListDeletedResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listDeletedNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListDeletedComplete enumerates all values, automatically crossing page boundaries as required. +func (client VaultsClient) ListDeletedComplete(ctx context.Context) (result DeletedVaultListResultIterator, err error) { + result.page, err = client.ListDeleted(ctx) + return +} + +// PurgeDeleted permanently deletes the specified vault. aka Purges the deleted Azure key vault. +// Parameters: +// vaultName - the name of the soft-deleted vault. +// location - the location of the soft-deleted vault. +func (client VaultsClient) PurgeDeleted(ctx context.Context, vaultName string, location string) (result VaultsPurgeDeletedFuture, err error) { + req, err := client.PurgeDeletedPreparer(ctx, vaultName, location) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "PurgeDeleted", nil, "Failure preparing request") + return + } + + result, err = client.PurgeDeletedSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "PurgeDeleted", result.Response(), "Failure sending request") + return + } + + return +} + +// PurgeDeletedPreparer prepares the PurgeDeleted request. +func (client VaultsClient) PurgeDeletedPreparer(ctx context.Context, vaultName string, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2018-02-14" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PurgeDeletedSender sends the PurgeDeleted request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) PurgeDeletedSender(req *http.Request) (future VaultsPurgeDeletedFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// PurgeDeletedResponder handles the response to the PurgeDeleted request. The method always +// closes the http.Response Body. +func (client VaultsClient) PurgeDeletedResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update update a key vault in the specified subscription. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the server belongs. +// vaultName - name of the vault +// parameters - parameters to patch the vault +func (client VaultsClient) Update(ctx context.Context, resourceGroupName string, vaultName string, parameters VaultPatchParameters) (result Vault, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: vaultName, + Constraints: []validation.Constraint{{Target: "vaultName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.VaultsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, vaultName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VaultsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, vaultName string, parameters VaultPatchParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2018-02-14" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client VaultsClient) UpdateResponder(resp *http.Response) (result Vault, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateAccessPolicy update access policies in a key vault in the specified subscription. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the vault belongs. +// vaultName - name of the vault +// operationKind - name of the operation +// parameters - access policy to merge into the vault +func (client VaultsClient) UpdateAccessPolicy(ctx context.Context, resourceGroupName string, vaultName string, operationKind AccessPolicyUpdateKind, parameters VaultAccessPolicyParameters) (result VaultAccessPolicyParameters, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: vaultName, + Constraints: []validation.Constraint{{Target: "vaultName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.AccessPolicies", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("keyvault.VaultsClient", "UpdateAccessPolicy", err.Error()) + } + + req, err := client.UpdateAccessPolicyPreparer(ctx, resourceGroupName, vaultName, operationKind, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "UpdateAccessPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateAccessPolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "UpdateAccessPolicy", resp, "Failure sending request") + return + } + + result, err = client.UpdateAccessPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "UpdateAccessPolicy", resp, "Failure responding to request") + } + + return +} + +// UpdateAccessPolicyPreparer prepares the UpdateAccessPolicy request. +func (client VaultsClient) UpdateAccessPolicyPreparer(ctx context.Context, resourceGroupName string, vaultName string, operationKind AccessPolicyUpdateKind, parameters VaultAccessPolicyParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "operationKind": autorest.Encode("path", operationKind), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2018-02-14" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateAccessPolicySender sends the UpdateAccessPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) UpdateAccessPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateAccessPolicyResponder handles the response to the UpdateAccessPolicy request. The method always +// closes the http.Response Body. +func (client VaultsClient) UpdateAccessPolicyResponder(resp *http.Response) (result VaultAccessPolicyParameters, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/keyvault/mgmt/2018-02-14/keyvault/version.go b/services/keyvault/mgmt/2018-02-14/keyvault/version.go new file mode 100644 index 000000000000..c6119f5e941f --- /dev/null +++ b/services/keyvault/mgmt/2018-02-14/keyvault/version.go @@ -0,0 +1,30 @@ +package keyvault + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + version.Number + " keyvault/2018-02-14" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/keyvault/v7.0/keyvault/client.go b/services/keyvault/v7.0/keyvault/client.go new file mode 100644 index 000000000000..76cfea00f2a8 --- /dev/null +++ b/services/keyvault/v7.0/keyvault/client.go @@ -0,0 +1,6420 @@ +// Package keyvault implements the Azure ARM Keyvault service API version 7.0. +// +// The key vault client performs cryptographic key operations and vault operations against the Key Vault service. +package keyvault + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// BaseClient is the base client for Keyvault. +type BaseClient struct { + autorest.Client +} + +// New creates an instance of the BaseClient client. +func New() BaseClient { + return NewWithoutDefaults() +} + +// NewWithoutDefaults creates an instance of the BaseClient client. +func NewWithoutDefaults() BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + } +} + +// BackupCertificate requests that a backup of the specified certificate be downloaded to the client. All versions of +// the certificate will be downloaded. This operation requires the certificates/backup permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// certificateName - the name of the certificate. +func (client BaseClient) BackupCertificate(ctx context.Context, vaultBaseURL string, certificateName string) (result BackupCertificateResult, err error) { + req, err := client.BackupCertificatePreparer(ctx, vaultBaseURL, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.BackupCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupCertificate", resp, "Failure sending request") + return + } + + result, err = client.BackupCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupCertificate", resp, "Failure responding to request") + } + + return +} + +// BackupCertificatePreparer prepares the BackupCertificate request. +func (client BaseClient) BackupCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/backup", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// BackupCertificateSender sends the BackupCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) BackupCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// BackupCertificateResponder handles the response to the BackupCertificate request. The method always +// closes the http.Response Body. +func (client BaseClient) BackupCertificateResponder(resp *http.Response) (result BackupCertificateResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// BackupKey the Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this operation +// does NOT return key material in a form that can be used outside the Azure Key Vault system, the returned key +// material is either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The intent of this operation is +// to allow a client to GENERATE a key in one Azure Key Vault instance, BACKUP the key, and then RESTORE it into +// another Azure Key Vault instance. The BACKUP operation may be used to export, in protected form, any key type from +// Azure Key Vault. Individual versions of a key cannot be backed up. BACKUP / RESTORE can be performed within +// geographical boundaries only; meaning that a BACKUP from one geographical area cannot be restored to another +// geographical area. For example, a backup from the US geographical area cannot be restored in an EU geographical +// area. This operation requires the key/backup permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// keyName - the name of the key. +func (client BaseClient) BackupKey(ctx context.Context, vaultBaseURL string, keyName string) (result BackupKeyResult, err error) { + req, err := client.BackupKeyPreparer(ctx, vaultBaseURL, keyName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupKey", nil, "Failure preparing request") + return + } + + resp, err := client.BackupKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupKey", resp, "Failure sending request") + return + } + + result, err = client.BackupKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupKey", resp, "Failure responding to request") + } + + return +} + +// BackupKeyPreparer prepares the BackupKey request. +func (client BaseClient) BackupKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/backup", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// BackupKeySender sends the BackupKey request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) BackupKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// BackupKeyResponder handles the response to the BackupKey request. The method always +// closes the http.Response Body. +func (client BaseClient) BackupKeyResponder(resp *http.Response) (result BackupKeyResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// BackupSecret requests that a backup of the specified secret be downloaded to the client. All versions of the secret +// will be downloaded. This operation requires the secrets/backup permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// secretName - the name of the secret. +func (client BaseClient) BackupSecret(ctx context.Context, vaultBaseURL string, secretName string) (result BackupSecretResult, err error) { + req, err := client.BackupSecretPreparer(ctx, vaultBaseURL, secretName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupSecret", nil, "Failure preparing request") + return + } + + resp, err := client.BackupSecretSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupSecret", resp, "Failure sending request") + return + } + + result, err = client.BackupSecretResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupSecret", resp, "Failure responding to request") + } + + return +} + +// BackupSecretPreparer prepares the BackupSecret request. +func (client BaseClient) BackupSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "secret-name": autorest.Encode("path", secretName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/secrets/{secret-name}/backup", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// BackupSecretSender sends the BackupSecret request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) BackupSecretSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// BackupSecretResponder handles the response to the BackupSecret request. The method always +// closes the http.Response Body. +func (client BaseClient) BackupSecretResponder(resp *http.Response) (result BackupSecretResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// BackupStorageAccount requests that a backup of the specified storage account be downloaded to the client. This +// operation requires the storage/backup permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// storageAccountName - the name of the storage account. +func (client BaseClient) BackupStorageAccount(ctx context.Context, vaultBaseURL string, storageAccountName string) (result BackupStorageResult, err error) { + req, err := client.BackupStorageAccountPreparer(ctx, vaultBaseURL, storageAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupStorageAccount", nil, "Failure preparing request") + return + } + + resp, err := client.BackupStorageAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupStorageAccount", resp, "Failure sending request") + return + } + + result, err = client.BackupStorageAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupStorageAccount", resp, "Failure responding to request") + } + + return +} + +// BackupStorageAccountPreparer prepares the BackupStorageAccount request. +func (client BaseClient) BackupStorageAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "storage-account-name": autorest.Encode("path", storageAccountName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/storage/{storage-account-name}/backup", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// BackupStorageAccountSender sends the BackupStorageAccount request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) BackupStorageAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// BackupStorageAccountResponder handles the response to the BackupStorageAccount request. The method always +// closes the http.Response Body. +func (client BaseClient) BackupStorageAccountResponder(resp *http.Response) (result BackupStorageResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateCertificate if this is the first version, the certificate resource is created. This operation requires the +// certificates/create permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// certificateName - the name of the certificate. +// parameters - the parameters to create a certificate. +func (client BaseClient) CreateCertificate(ctx context.Context, vaultBaseURL string, certificateName string, parameters CertificateCreateParameters) (result CertificateOperation, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: certificateName, + Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.CertificatePolicy", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties.ValidityInMonths", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties.ValidityInMonths", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "CreateCertificate", err.Error()) + } + + req, err := client.CreateCertificatePreparer(ctx, vaultBaseURL, certificateName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "CreateCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "CreateCertificate", resp, "Failure sending request") + return + } + + result, err = client.CreateCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "CreateCertificate", resp, "Failure responding to request") + } + + return +} + +// CreateCertificatePreparer prepares the CreateCertificate request. +func (client BaseClient) CreateCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string, parameters CertificateCreateParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/create", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateCertificateSender sends the CreateCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) CreateCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CreateCertificateResponder handles the response to the CreateCertificate request. The method always +// closes the http.Response Body. +func (client BaseClient) CreateCertificateResponder(resp *http.Response) (result CertificateOperation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateKey the create key operation can be used to create any key type in Azure Key Vault. If the named key already +// exists, Azure Key Vault creates a new version of the key. It requires the keys/create permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// keyName - the name for the new key. The system will generate the version name for the new key. +// parameters - the parameters to create a key. +func (client BaseClient) CreateKey(ctx context.Context, vaultBaseURL string, keyName string, parameters KeyCreateParameters) (result KeyBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: keyName, + Constraints: []validation.Constraint{{Target: "keyName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "CreateKey", err.Error()) + } + + req, err := client.CreateKeyPreparer(ctx, vaultBaseURL, keyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "CreateKey", nil, "Failure preparing request") + return + } + + resp, err := client.CreateKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "CreateKey", resp, "Failure sending request") + return + } + + result, err = client.CreateKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "CreateKey", resp, "Failure responding to request") + } + + return +} + +// CreateKeyPreparer prepares the CreateKey request. +func (client BaseClient) CreateKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string, parameters KeyCreateParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/create", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateKeySender sends the CreateKey request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) CreateKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CreateKeyResponder handles the response to the CreateKey request. The method always +// closes the http.Response Body. +func (client BaseClient) CreateKeyResponder(resp *http.Response) (result KeyBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Decrypt the DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption key and +// specified algorithm. This operation is the reverse of the ENCRYPT operation; only a single block of data may be +// decrypted, the size of this block is dependent on the target key and the algorithm to be used. The DECRYPT operation +// applies to asymmetric and symmetric keys stored in Azure Key Vault since it uses the private portion of the key. +// This operation requires the keys/decrypt permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// keyName - the name of the key. +// keyVersion - the version of the key. +// parameters - the parameters for the decryption operation. +func (client BaseClient) Decrypt(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (result KeyOperationResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "Decrypt", err.Error()) + } + + req, err := client.DecryptPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Decrypt", nil, "Failure preparing request") + return + } + + resp, err := client.DecryptSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Decrypt", resp, "Failure sending request") + return + } + + result, err = client.DecryptResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Decrypt", resp, "Failure responding to request") + } + + return +} + +// DecryptPreparer prepares the Decrypt request. +func (client BaseClient) DecryptPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + "key-version": autorest.Encode("path", keyVersion), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/{key-version}/decrypt", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DecryptSender sends the Decrypt request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) DecryptSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DecryptResponder handles the response to the Decrypt request. The method always +// closes the http.Response Body. +func (client BaseClient) DecryptResponder(resp *http.Response) (result KeyOperationResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteCertificate deletes all versions of a certificate object along with its associated policy. Delete certificate +// cannot be used to remove individual versions of a certificate object. This operation requires the +// certificates/delete permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// certificateName - the name of the certificate. +func (client BaseClient) DeleteCertificate(ctx context.Context, vaultBaseURL string, certificateName string) (result DeletedCertificateBundle, err error) { + req, err := client.DeleteCertificatePreparer(ctx, vaultBaseURL, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificate", resp, "Failure sending request") + return + } + + result, err = client.DeleteCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificate", resp, "Failure responding to request") + } + + return +} + +// DeleteCertificatePreparer prepares the DeleteCertificate request. +func (client BaseClient) DeleteCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteCertificateSender sends the DeleteCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) DeleteCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteCertificateResponder handles the response to the DeleteCertificate request. The method always +// closes the http.Response Body. +func (client BaseClient) DeleteCertificateResponder(resp *http.Response) (result DeletedCertificateBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteCertificateContacts deletes the certificate contacts for a specified key vault certificate. This operation +// requires the certificates/managecontacts permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +func (client BaseClient) DeleteCertificateContacts(ctx context.Context, vaultBaseURL string) (result Contacts, err error) { + req, err := client.DeleteCertificateContactsPreparer(ctx, vaultBaseURL) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateContacts", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteCertificateContactsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateContacts", resp, "Failure sending request") + return + } + + result, err = client.DeleteCertificateContactsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateContacts", resp, "Failure responding to request") + } + + return +} + +// DeleteCertificateContactsPreparer prepares the DeleteCertificateContacts request. +func (client BaseClient) DeleteCertificateContactsPreparer(ctx context.Context, vaultBaseURL string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/certificates/contacts"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteCertificateContactsSender sends the DeleteCertificateContacts request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) DeleteCertificateContactsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteCertificateContactsResponder handles the response to the DeleteCertificateContacts request. The method always +// closes the http.Response Body. +func (client BaseClient) DeleteCertificateContactsResponder(resp *http.Response) (result Contacts, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteCertificateIssuer the DeleteCertificateIssuer operation permanently removes the specified certificate issuer +// from the vault. This operation requires the certificates/manageissuers/deleteissuers permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// issuerName - the name of the issuer. +func (client BaseClient) DeleteCertificateIssuer(ctx context.Context, vaultBaseURL string, issuerName string) (result IssuerBundle, err error) { + req, err := client.DeleteCertificateIssuerPreparer(ctx, vaultBaseURL, issuerName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateIssuer", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteCertificateIssuerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateIssuer", resp, "Failure sending request") + return + } + + result, err = client.DeleteCertificateIssuerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateIssuer", resp, "Failure responding to request") + } + + return +} + +// DeleteCertificateIssuerPreparer prepares the DeleteCertificateIssuer request. +func (client BaseClient) DeleteCertificateIssuerPreparer(ctx context.Context, vaultBaseURL string, issuerName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "issuer-name": autorest.Encode("path", issuerName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/issuers/{issuer-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteCertificateIssuerSender sends the DeleteCertificateIssuer request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) DeleteCertificateIssuerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteCertificateIssuerResponder handles the response to the DeleteCertificateIssuer request. The method always +// closes the http.Response Body. +func (client BaseClient) DeleteCertificateIssuerResponder(resp *http.Response) (result IssuerBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteCertificateOperation deletes the creation operation for a specified certificate that is in the process of +// being created. The certificate is no longer created. This operation requires the certificates/update permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// certificateName - the name of the certificate. +func (client BaseClient) DeleteCertificateOperation(ctx context.Context, vaultBaseURL string, certificateName string) (result CertificateOperation, err error) { + req, err := client.DeleteCertificateOperationPreparer(ctx, vaultBaseURL, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateOperation", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteCertificateOperationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateOperation", resp, "Failure sending request") + return + } + + result, err = client.DeleteCertificateOperationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateOperation", resp, "Failure responding to request") + } + + return +} + +// DeleteCertificateOperationPreparer prepares the DeleteCertificateOperation request. +func (client BaseClient) DeleteCertificateOperationPreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/pending", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteCertificateOperationSender sends the DeleteCertificateOperation request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) DeleteCertificateOperationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteCertificateOperationResponder handles the response to the DeleteCertificateOperation request. The method always +// closes the http.Response Body. +func (client BaseClient) DeleteCertificateOperationResponder(resp *http.Response) (result CertificateOperation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteKey the delete key operation cannot be used to remove individual versions of a key. This operation removes the +// cryptographic material associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or +// Encrypt/Decrypt operations. This operation requires the keys/delete permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// keyName - the name of the key to delete. +func (client BaseClient) DeleteKey(ctx context.Context, vaultBaseURL string, keyName string) (result DeletedKeyBundle, err error) { + req, err := client.DeleteKeyPreparer(ctx, vaultBaseURL, keyName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteKey", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteKey", resp, "Failure sending request") + return + } + + result, err = client.DeleteKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteKey", resp, "Failure responding to request") + } + + return +} + +// DeleteKeyPreparer prepares the DeleteKey request. +func (client BaseClient) DeleteKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteKeySender sends the DeleteKey request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) DeleteKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteKeyResponder handles the response to the DeleteKey request. The method always +// closes the http.Response Body. +func (client BaseClient) DeleteKeyResponder(resp *http.Response) (result DeletedKeyBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteSasDefinition deletes a SAS definition from a specified storage account. This operation requires the +// storage/deletesas permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// storageAccountName - the name of the storage account. +// sasDefinitionName - the name of the SAS definition. +func (client BaseClient) DeleteSasDefinition(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string) (result DeletedSasDefinitionBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: storageAccountName, + Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, + {TargetValue: sasDefinitionName, + Constraints: []validation.Constraint{{Target: "sasDefinitionName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "DeleteSasDefinition", err.Error()) + } + + req, err := client.DeleteSasDefinitionPreparer(ctx, vaultBaseURL, storageAccountName, sasDefinitionName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteSasDefinition", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSasDefinitionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteSasDefinition", resp, "Failure sending request") + return + } + + result, err = client.DeleteSasDefinitionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteSasDefinition", resp, "Failure responding to request") + } + + return +} + +// DeleteSasDefinitionPreparer prepares the DeleteSasDefinition request. +func (client BaseClient) DeleteSasDefinitionPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "sas-definition-name": autorest.Encode("path", sasDefinitionName), + "storage-account-name": autorest.Encode("path", storageAccountName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/storage/{storage-account-name}/sas/{sas-definition-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSasDefinitionSender sends the DeleteSasDefinition request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) DeleteSasDefinitionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteSasDefinitionResponder handles the response to the DeleteSasDefinition request. The method always +// closes the http.Response Body. +func (client BaseClient) DeleteSasDefinitionResponder(resp *http.Response) (result DeletedSasDefinitionBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteSecret the DELETE operation applies to any secret stored in Azure Key Vault. DELETE cannot be applied to an +// individual version of a secret. This operation requires the secrets/delete permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// secretName - the name of the secret. +func (client BaseClient) DeleteSecret(ctx context.Context, vaultBaseURL string, secretName string) (result DeletedSecretBundle, err error) { + req, err := client.DeleteSecretPreparer(ctx, vaultBaseURL, secretName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteSecret", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSecretSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteSecret", resp, "Failure sending request") + return + } + + result, err = client.DeleteSecretResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteSecret", resp, "Failure responding to request") + } + + return +} + +// DeleteSecretPreparer prepares the DeleteSecret request. +func (client BaseClient) DeleteSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "secret-name": autorest.Encode("path", secretName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/secrets/{secret-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSecretSender sends the DeleteSecret request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) DeleteSecretSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteSecretResponder handles the response to the DeleteSecret request. The method always +// closes the http.Response Body. +func (client BaseClient) DeleteSecretResponder(resp *http.Response) (result DeletedSecretBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteStorageAccount deletes a storage account. This operation requires the storage/delete permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// storageAccountName - the name of the storage account. +func (client BaseClient) DeleteStorageAccount(ctx context.Context, vaultBaseURL string, storageAccountName string) (result DeletedStorageBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: storageAccountName, + Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "DeleteStorageAccount", err.Error()) + } + + req, err := client.DeleteStorageAccountPreparer(ctx, vaultBaseURL, storageAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteStorageAccount", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteStorageAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteStorageAccount", resp, "Failure sending request") + return + } + + result, err = client.DeleteStorageAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteStorageAccount", resp, "Failure responding to request") + } + + return +} + +// DeleteStorageAccountPreparer prepares the DeleteStorageAccount request. +func (client BaseClient) DeleteStorageAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "storage-account-name": autorest.Encode("path", storageAccountName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/storage/{storage-account-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteStorageAccountSender sends the DeleteStorageAccount request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) DeleteStorageAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteStorageAccountResponder handles the response to the DeleteStorageAccount request. The method always +// closes the http.Response Body. +func (client BaseClient) DeleteStorageAccountResponder(resp *http.Response) (result DeletedStorageBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Encrypt the ENCRYPT operation encrypts an arbitrary sequence of bytes using an encryption key that is stored in +// Azure Key Vault. Note that the ENCRYPT operation only supports a single block of data, the size of which is +// dependent on the target key and the encryption algorithm to be used. The ENCRYPT operation is only strictly +// necessary for symmetric keys stored in Azure Key Vault since protection with an asymmetric key can be performed +// using public portion of the key. This operation is supported for asymmetric keys as a convenience for callers that +// have a key-reference but do not have access to the public key material. This operation requires the keys/encypt +// permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// keyName - the name of the key. +// keyVersion - the version of the key. +// parameters - the parameters for the encryption operation. +func (client BaseClient) Encrypt(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (result KeyOperationResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "Encrypt", err.Error()) + } + + req, err := client.EncryptPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Encrypt", nil, "Failure preparing request") + return + } + + resp, err := client.EncryptSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Encrypt", resp, "Failure sending request") + return + } + + result, err = client.EncryptResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Encrypt", resp, "Failure responding to request") + } + + return +} + +// EncryptPreparer prepares the Encrypt request. +func (client BaseClient) EncryptPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + "key-version": autorest.Encode("path", keyVersion), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/{key-version}/encrypt", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// EncryptSender sends the Encrypt request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) EncryptSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// EncryptResponder handles the response to the Encrypt request. The method always +// closes the http.Response Body. +func (client BaseClient) EncryptResponder(resp *http.Response) (result KeyOperationResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCertificate gets information about a specific certificate. This operation requires the certificates/get +// permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// certificateName - the name of the certificate in the given vault. +// certificateVersion - the version of the certificate. +func (client BaseClient) GetCertificate(ctx context.Context, vaultBaseURL string, certificateName string, certificateVersion string) (result CertificateBundle, err error) { + req, err := client.GetCertificatePreparer(ctx, vaultBaseURL, certificateName, certificateVersion) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.GetCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificate", resp, "Failure sending request") + return + } + + result, err = client.GetCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificate", resp, "Failure responding to request") + } + + return +} + +// GetCertificatePreparer prepares the GetCertificate request. +func (client BaseClient) GetCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string, certificateVersion string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + "certificate-version": autorest.Encode("path", certificateVersion), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/{certificate-version}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCertificateSender sends the GetCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetCertificateResponder handles the response to the GetCertificate request. The method always +// closes the http.Response Body. +func (client BaseClient) GetCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCertificateContacts the GetCertificateContacts operation returns the set of certificate contact resources in the +// specified key vault. This operation requires the certificates/managecontacts permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +func (client BaseClient) GetCertificateContacts(ctx context.Context, vaultBaseURL string) (result Contacts, err error) { + req, err := client.GetCertificateContactsPreparer(ctx, vaultBaseURL) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateContacts", nil, "Failure preparing request") + return + } + + resp, err := client.GetCertificateContactsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateContacts", resp, "Failure sending request") + return + } + + result, err = client.GetCertificateContactsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateContacts", resp, "Failure responding to request") + } + + return +} + +// GetCertificateContactsPreparer prepares the GetCertificateContacts request. +func (client BaseClient) GetCertificateContactsPreparer(ctx context.Context, vaultBaseURL string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/certificates/contacts"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCertificateContactsSender sends the GetCertificateContacts request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetCertificateContactsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetCertificateContactsResponder handles the response to the GetCertificateContacts request. The method always +// closes the http.Response Body. +func (client BaseClient) GetCertificateContactsResponder(resp *http.Response) (result Contacts, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCertificateIssuer the GetCertificateIssuer operation returns the specified certificate issuer resources in the +// specified key vault. This operation requires the certificates/manageissuers/getissuers permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// issuerName - the name of the issuer. +func (client BaseClient) GetCertificateIssuer(ctx context.Context, vaultBaseURL string, issuerName string) (result IssuerBundle, err error) { + req, err := client.GetCertificateIssuerPreparer(ctx, vaultBaseURL, issuerName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateIssuer", nil, "Failure preparing request") + return + } + + resp, err := client.GetCertificateIssuerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateIssuer", resp, "Failure sending request") + return + } + + result, err = client.GetCertificateIssuerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateIssuer", resp, "Failure responding to request") + } + + return +} + +// GetCertificateIssuerPreparer prepares the GetCertificateIssuer request. +func (client BaseClient) GetCertificateIssuerPreparer(ctx context.Context, vaultBaseURL string, issuerName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "issuer-name": autorest.Encode("path", issuerName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/issuers/{issuer-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCertificateIssuerSender sends the GetCertificateIssuer request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetCertificateIssuerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetCertificateIssuerResponder handles the response to the GetCertificateIssuer request. The method always +// closes the http.Response Body. +func (client BaseClient) GetCertificateIssuerResponder(resp *http.Response) (result IssuerBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCertificateIssuers the GetCertificateIssuers operation returns the set of certificate issuer resources in the +// specified key vault. This operation requires the certificates/manageissuers/getissuers permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// maxresults - maximum number of results to return in a page. If not specified the service will return up to +// 25 results. +func (client BaseClient) GetCertificateIssuers(ctx context.Context, vaultBaseURL string, maxresults *int32) (result CertificateIssuerListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxresults, + Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, + {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "GetCertificateIssuers", err.Error()) + } + + result.fn = client.getCertificateIssuersNextResults + req, err := client.GetCertificateIssuersPreparer(ctx, vaultBaseURL, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateIssuers", nil, "Failure preparing request") + return + } + + resp, err := client.GetCertificateIssuersSender(req) + if err != nil { + result.cilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateIssuers", resp, "Failure sending request") + return + } + + result.cilr, err = client.GetCertificateIssuersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateIssuers", resp, "Failure responding to request") + } + + return +} + +// GetCertificateIssuersPreparer prepares the GetCertificateIssuers request. +func (client BaseClient) GetCertificateIssuersPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/certificates/issuers"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCertificateIssuersSender sends the GetCertificateIssuers request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetCertificateIssuersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetCertificateIssuersResponder handles the response to the GetCertificateIssuers request. The method always +// closes the http.Response Body. +func (client BaseClient) GetCertificateIssuersResponder(resp *http.Response) (result CertificateIssuerListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getCertificateIssuersNextResults retrieves the next set of results, if any. +func (client BaseClient) getCertificateIssuersNextResults(lastResults CertificateIssuerListResult) (result CertificateIssuerListResult, err error) { + req, err := lastResults.certificateIssuerListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificateIssuersNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetCertificateIssuersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificateIssuersNextResults", resp, "Failure sending next results request") + } + result, err = client.GetCertificateIssuersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificateIssuersNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetCertificateIssuersComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) GetCertificateIssuersComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result CertificateIssuerListResultIterator, err error) { + result.page, err = client.GetCertificateIssuers(ctx, vaultBaseURL, maxresults) + return +} + +// GetCertificateOperation gets the creation operation associated with a specified certificate. This operation requires +// the certificates/get permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// certificateName - the name of the certificate. +func (client BaseClient) GetCertificateOperation(ctx context.Context, vaultBaseURL string, certificateName string) (result CertificateOperation, err error) { + req, err := client.GetCertificateOperationPreparer(ctx, vaultBaseURL, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateOperation", nil, "Failure preparing request") + return + } + + resp, err := client.GetCertificateOperationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateOperation", resp, "Failure sending request") + return + } + + result, err = client.GetCertificateOperationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateOperation", resp, "Failure responding to request") + } + + return +} + +// GetCertificateOperationPreparer prepares the GetCertificateOperation request. +func (client BaseClient) GetCertificateOperationPreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/pending", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCertificateOperationSender sends the GetCertificateOperation request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetCertificateOperationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetCertificateOperationResponder handles the response to the GetCertificateOperation request. The method always +// closes the http.Response Body. +func (client BaseClient) GetCertificateOperationResponder(resp *http.Response) (result CertificateOperation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCertificatePolicy the GetCertificatePolicy operation returns the specified certificate policy resources in the +// specified key vault. This operation requires the certificates/get permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// certificateName - the name of the certificate in a given key vault. +func (client BaseClient) GetCertificatePolicy(ctx context.Context, vaultBaseURL string, certificateName string) (result CertificatePolicy, err error) { + req, err := client.GetCertificatePolicyPreparer(ctx, vaultBaseURL, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificatePolicy", nil, "Failure preparing request") + return + } + + resp, err := client.GetCertificatePolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificatePolicy", resp, "Failure sending request") + return + } + + result, err = client.GetCertificatePolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificatePolicy", resp, "Failure responding to request") + } + + return +} + +// GetCertificatePolicyPreparer prepares the GetCertificatePolicy request. +func (client BaseClient) GetCertificatePolicyPreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/policy", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCertificatePolicySender sends the GetCertificatePolicy request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetCertificatePolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetCertificatePolicyResponder handles the response to the GetCertificatePolicy request. The method always +// closes the http.Response Body. +func (client BaseClient) GetCertificatePolicyResponder(resp *http.Response) (result CertificatePolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCertificates the GetCertificates operation returns the set of certificates resources in the specified key vault. +// This operation requires the certificates/list permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// maxresults - maximum number of results to return in a page. If not specified the service will return up to +// 25 results. +// includePending - specifies whether to include certificates which are not completely provisioned. +func (client BaseClient) GetCertificates(ctx context.Context, vaultBaseURL string, maxresults *int32, includePending *bool) (result CertificateListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxresults, + Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, + {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "GetCertificates", err.Error()) + } + + result.fn = client.getCertificatesNextResults + req, err := client.GetCertificatesPreparer(ctx, vaultBaseURL, maxresults, includePending) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificates", nil, "Failure preparing request") + return + } + + resp, err := client.GetCertificatesSender(req) + if err != nil { + result.clr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificates", resp, "Failure sending request") + return + } + + result.clr, err = client.GetCertificatesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificates", resp, "Failure responding to request") + } + + return +} + +// GetCertificatesPreparer prepares the GetCertificates request. +func (client BaseClient) GetCertificatesPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32, includePending *bool) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + if includePending != nil { + queryParameters["includePending"] = autorest.Encode("query", *includePending) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/certificates"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCertificatesSender sends the GetCertificates request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetCertificatesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetCertificatesResponder handles the response to the GetCertificates request. The method always +// closes the http.Response Body. +func (client BaseClient) GetCertificatesResponder(resp *http.Response) (result CertificateListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getCertificatesNextResults retrieves the next set of results, if any. +func (client BaseClient) getCertificatesNextResults(lastResults CertificateListResult) (result CertificateListResult, err error) { + req, err := lastResults.certificateListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificatesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetCertificatesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificatesNextResults", resp, "Failure sending next results request") + } + result, err = client.GetCertificatesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificatesNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetCertificatesComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) GetCertificatesComplete(ctx context.Context, vaultBaseURL string, maxresults *int32, includePending *bool) (result CertificateListResultIterator, err error) { + result.page, err = client.GetCertificates(ctx, vaultBaseURL, maxresults, includePending) + return +} + +// GetCertificateVersions the GetCertificateVersions operation returns the versions of a certificate in the specified +// key vault. This operation requires the certificates/list permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// certificateName - the name of the certificate. +// maxresults - maximum number of results to return in a page. If not specified the service will return up to +// 25 results. +func (client BaseClient) GetCertificateVersions(ctx context.Context, vaultBaseURL string, certificateName string, maxresults *int32) (result CertificateListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxresults, + Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, + {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "GetCertificateVersions", err.Error()) + } + + result.fn = client.getCertificateVersionsNextResults + req, err := client.GetCertificateVersionsPreparer(ctx, vaultBaseURL, certificateName, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateVersions", nil, "Failure preparing request") + return + } + + resp, err := client.GetCertificateVersionsSender(req) + if err != nil { + result.clr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateVersions", resp, "Failure sending request") + return + } + + result.clr, err = client.GetCertificateVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateVersions", resp, "Failure responding to request") + } + + return +} + +// GetCertificateVersionsPreparer prepares the GetCertificateVersions request. +func (client BaseClient) GetCertificateVersionsPreparer(ctx context.Context, vaultBaseURL string, certificateName string, maxresults *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCertificateVersionsSender sends the GetCertificateVersions request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetCertificateVersionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetCertificateVersionsResponder handles the response to the GetCertificateVersions request. The method always +// closes the http.Response Body. +func (client BaseClient) GetCertificateVersionsResponder(resp *http.Response) (result CertificateListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getCertificateVersionsNextResults retrieves the next set of results, if any. +func (client BaseClient) getCertificateVersionsNextResults(lastResults CertificateListResult) (result CertificateListResult, err error) { + req, err := lastResults.certificateListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificateVersionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetCertificateVersionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificateVersionsNextResults", resp, "Failure sending next results request") + } + result, err = client.GetCertificateVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificateVersionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetCertificateVersionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) GetCertificateVersionsComplete(ctx context.Context, vaultBaseURL string, certificateName string, maxresults *int32) (result CertificateListResultIterator, err error) { + result.page, err = client.GetCertificateVersions(ctx, vaultBaseURL, certificateName, maxresults) + return +} + +// GetDeletedCertificate the GetDeletedCertificate operation retrieves the deleted certificate information plus its +// attributes, such as retention interval, scheduled permanent deletion and the current deletion recovery level. This +// operation requires the certificates/get permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// certificateName - the name of the certificate +func (client BaseClient) GetDeletedCertificate(ctx context.Context, vaultBaseURL string, certificateName string) (result DeletedCertificateBundle, err error) { + req, err := client.GetDeletedCertificatePreparer(ctx, vaultBaseURL, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeletedCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedCertificate", resp, "Failure sending request") + return + } + + result, err = client.GetDeletedCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedCertificate", resp, "Failure responding to request") + } + + return +} + +// GetDeletedCertificatePreparer prepares the GetDeletedCertificate request. +func (client BaseClient) GetDeletedCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/deletedcertificates/{certificate-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeletedCertificateSender sends the GetDeletedCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetDeletedCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetDeletedCertificateResponder handles the response to the GetDeletedCertificate request. The method always +// closes the http.Response Body. +func (client BaseClient) GetDeletedCertificateResponder(resp *http.Response) (result DeletedCertificateBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDeletedCertificates the GetDeletedCertificates operation retrieves the certificates in the current vault which +// are in a deleted state and ready for recovery or purging. This operation includes deletion-specific information. +// This operation requires the certificates/get/list permission. This operation can only be enabled on soft-delete +// enabled vaults. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// maxresults - maximum number of results to return in a page. If not specified the service will return up to +// 25 results. +// includePending - specifies whether to include certificates which are not completely provisioned. +func (client BaseClient) GetDeletedCertificates(ctx context.Context, vaultBaseURL string, maxresults *int32, includePending *bool) (result DeletedCertificateListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxresults, + Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, + {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "GetDeletedCertificates", err.Error()) + } + + result.fn = client.getDeletedCertificatesNextResults + req, err := client.GetDeletedCertificatesPreparer(ctx, vaultBaseURL, maxresults, includePending) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedCertificates", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeletedCertificatesSender(req) + if err != nil { + result.dclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedCertificates", resp, "Failure sending request") + return + } + + result.dclr, err = client.GetDeletedCertificatesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedCertificates", resp, "Failure responding to request") + } + + return +} + +// GetDeletedCertificatesPreparer prepares the GetDeletedCertificates request. +func (client BaseClient) GetDeletedCertificatesPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32, includePending *bool) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + if includePending != nil { + queryParameters["includePending"] = autorest.Encode("query", *includePending) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/deletedcertificates"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeletedCertificatesSender sends the GetDeletedCertificates request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetDeletedCertificatesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetDeletedCertificatesResponder handles the response to the GetDeletedCertificates request. The method always +// closes the http.Response Body. +func (client BaseClient) GetDeletedCertificatesResponder(resp *http.Response) (result DeletedCertificateListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getDeletedCertificatesNextResults retrieves the next set of results, if any. +func (client BaseClient) getDeletedCertificatesNextResults(lastResults DeletedCertificateListResult) (result DeletedCertificateListResult, err error) { + req, err := lastResults.deletedCertificateListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedCertificatesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetDeletedCertificatesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedCertificatesNextResults", resp, "Failure sending next results request") + } + result, err = client.GetDeletedCertificatesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedCertificatesNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetDeletedCertificatesComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) GetDeletedCertificatesComplete(ctx context.Context, vaultBaseURL string, maxresults *int32, includePending *bool) (result DeletedCertificateListResultIterator, err error) { + result.page, err = client.GetDeletedCertificates(ctx, vaultBaseURL, maxresults, includePending) + return +} + +// GetDeletedKey the Get Deleted Key operation is applicable for soft-delete enabled vaults. While the operation can be +// invoked on any vault, it will return an error if invoked on a non soft-delete enabled vault. This operation requires +// the keys/get permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// keyName - the name of the key. +func (client BaseClient) GetDeletedKey(ctx context.Context, vaultBaseURL string, keyName string) (result DeletedKeyBundle, err error) { + req, err := client.GetDeletedKeyPreparer(ctx, vaultBaseURL, keyName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedKey", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeletedKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedKey", resp, "Failure sending request") + return + } + + result, err = client.GetDeletedKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedKey", resp, "Failure responding to request") + } + + return +} + +// GetDeletedKeyPreparer prepares the GetDeletedKey request. +func (client BaseClient) GetDeletedKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/deletedkeys/{key-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeletedKeySender sends the GetDeletedKey request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetDeletedKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetDeletedKeyResponder handles the response to the GetDeletedKey request. The method always +// closes the http.Response Body. +func (client BaseClient) GetDeletedKeyResponder(resp *http.Response) (result DeletedKeyBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDeletedKeys retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part +// of a deleted key. This operation includes deletion-specific information. The Get Deleted Keys operation is +// applicable for vaults enabled for soft-delete. While the operation can be invoked on any vault, it will return an +// error if invoked on a non soft-delete enabled vault. This operation requires the keys/list permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// maxresults - maximum number of results to return in a page. If not specified the service will return up to +// 25 results. +func (client BaseClient) GetDeletedKeys(ctx context.Context, vaultBaseURL string, maxresults *int32) (result DeletedKeyListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxresults, + Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, + {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "GetDeletedKeys", err.Error()) + } + + result.fn = client.getDeletedKeysNextResults + req, err := client.GetDeletedKeysPreparer(ctx, vaultBaseURL, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedKeys", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeletedKeysSender(req) + if err != nil { + result.dklr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedKeys", resp, "Failure sending request") + return + } + + result.dklr, err = client.GetDeletedKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedKeys", resp, "Failure responding to request") + } + + return +} + +// GetDeletedKeysPreparer prepares the GetDeletedKeys request. +func (client BaseClient) GetDeletedKeysPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/deletedkeys"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeletedKeysSender sends the GetDeletedKeys request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetDeletedKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetDeletedKeysResponder handles the response to the GetDeletedKeys request. The method always +// closes the http.Response Body. +func (client BaseClient) GetDeletedKeysResponder(resp *http.Response) (result DeletedKeyListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getDeletedKeysNextResults retrieves the next set of results, if any. +func (client BaseClient) getDeletedKeysNextResults(lastResults DeletedKeyListResult) (result DeletedKeyListResult, err error) { + req, err := lastResults.deletedKeyListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedKeysNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetDeletedKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedKeysNextResults", resp, "Failure sending next results request") + } + result, err = client.GetDeletedKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedKeysNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetDeletedKeysComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) GetDeletedKeysComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result DeletedKeyListResultIterator, err error) { + result.page, err = client.GetDeletedKeys(ctx, vaultBaseURL, maxresults) + return +} + +// GetDeletedSasDefinition the Get Deleted SAS Definition operation returns the specified deleted SAS definition along +// with its attributes. This operation requires the storage/getsas permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// storageAccountName - the name of the storage account. +// sasDefinitionName - the name of the SAS definition. +func (client BaseClient) GetDeletedSasDefinition(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string) (result DeletedSasDefinitionBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: storageAccountName, + Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, + {TargetValue: sasDefinitionName, + Constraints: []validation.Constraint{{Target: "sasDefinitionName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "GetDeletedSasDefinition", err.Error()) + } + + req, err := client.GetDeletedSasDefinitionPreparer(ctx, vaultBaseURL, storageAccountName, sasDefinitionName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSasDefinition", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeletedSasDefinitionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSasDefinition", resp, "Failure sending request") + return + } + + result, err = client.GetDeletedSasDefinitionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSasDefinition", resp, "Failure responding to request") + } + + return +} + +// GetDeletedSasDefinitionPreparer prepares the GetDeletedSasDefinition request. +func (client BaseClient) GetDeletedSasDefinitionPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "sas-definition-name": autorest.Encode("path", sasDefinitionName), + "storage-account-name": autorest.Encode("path", storageAccountName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/deletedstorage/{storage-account-name}/sas/{sas-definition-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeletedSasDefinitionSender sends the GetDeletedSasDefinition request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetDeletedSasDefinitionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetDeletedSasDefinitionResponder handles the response to the GetDeletedSasDefinition request. The method always +// closes the http.Response Body. +func (client BaseClient) GetDeletedSasDefinitionResponder(resp *http.Response) (result DeletedSasDefinitionBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDeletedSasDefinitions the Get Deleted Sas Definitions operation returns the SAS definitions that have been +// deleted for a vault enabled for soft-delete. This operation requires the storage/listsas permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// storageAccountName - the name of the storage account. +// maxresults - maximum number of results to return in a page. If not specified the service will return up to +// 25 results. +func (client BaseClient) GetDeletedSasDefinitions(ctx context.Context, vaultBaseURL string, storageAccountName string, maxresults *int32) (result DeletedSasDefinitionListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: storageAccountName, + Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, + {TargetValue: maxresults, + Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, + {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "GetDeletedSasDefinitions", err.Error()) + } + + result.fn = client.getDeletedSasDefinitionsNextResults + req, err := client.GetDeletedSasDefinitionsPreparer(ctx, vaultBaseURL, storageAccountName, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSasDefinitions", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeletedSasDefinitionsSender(req) + if err != nil { + result.dsdlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSasDefinitions", resp, "Failure sending request") + return + } + + result.dsdlr, err = client.GetDeletedSasDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSasDefinitions", resp, "Failure responding to request") + } + + return +} + +// GetDeletedSasDefinitionsPreparer prepares the GetDeletedSasDefinitions request. +func (client BaseClient) GetDeletedSasDefinitionsPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, maxresults *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "storage-account-name": autorest.Encode("path", storageAccountName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/deletedstorage/{storage-account-name}/sas", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeletedSasDefinitionsSender sends the GetDeletedSasDefinitions request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetDeletedSasDefinitionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetDeletedSasDefinitionsResponder handles the response to the GetDeletedSasDefinitions request. The method always +// closes the http.Response Body. +func (client BaseClient) GetDeletedSasDefinitionsResponder(resp *http.Response) (result DeletedSasDefinitionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getDeletedSasDefinitionsNextResults retrieves the next set of results, if any. +func (client BaseClient) getDeletedSasDefinitionsNextResults(lastResults DeletedSasDefinitionListResult) (result DeletedSasDefinitionListResult, err error) { + req, err := lastResults.deletedSasDefinitionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedSasDefinitionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetDeletedSasDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedSasDefinitionsNextResults", resp, "Failure sending next results request") + } + result, err = client.GetDeletedSasDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedSasDefinitionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetDeletedSasDefinitionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) GetDeletedSasDefinitionsComplete(ctx context.Context, vaultBaseURL string, storageAccountName string, maxresults *int32) (result DeletedSasDefinitionListResultIterator, err error) { + result.page, err = client.GetDeletedSasDefinitions(ctx, vaultBaseURL, storageAccountName, maxresults) + return +} + +// GetDeletedSecret the Get Deleted Secret operation returns the specified deleted secret along with its attributes. +// This operation requires the secrets/get permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// secretName - the name of the secret. +func (client BaseClient) GetDeletedSecret(ctx context.Context, vaultBaseURL string, secretName string) (result DeletedSecretBundle, err error) { + req, err := client.GetDeletedSecretPreparer(ctx, vaultBaseURL, secretName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSecret", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeletedSecretSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSecret", resp, "Failure sending request") + return + } + + result, err = client.GetDeletedSecretResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSecret", resp, "Failure responding to request") + } + + return +} + +// GetDeletedSecretPreparer prepares the GetDeletedSecret request. +func (client BaseClient) GetDeletedSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "secret-name": autorest.Encode("path", secretName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/deletedsecrets/{secret-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeletedSecretSender sends the GetDeletedSecret request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetDeletedSecretSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetDeletedSecretResponder handles the response to the GetDeletedSecret request. The method always +// closes the http.Response Body. +func (client BaseClient) GetDeletedSecretResponder(resp *http.Response) (result DeletedSecretBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDeletedSecrets the Get Deleted Secrets operation returns the secrets that have been deleted for a vault enabled +// for soft-delete. This operation requires the secrets/list permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// maxresults - maximum number of results to return in a page. If not specified the service will return up to +// 25 results. +func (client BaseClient) GetDeletedSecrets(ctx context.Context, vaultBaseURL string, maxresults *int32) (result DeletedSecretListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxresults, + Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, + {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "GetDeletedSecrets", err.Error()) + } + + result.fn = client.getDeletedSecretsNextResults + req, err := client.GetDeletedSecretsPreparer(ctx, vaultBaseURL, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSecrets", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeletedSecretsSender(req) + if err != nil { + result.dslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSecrets", resp, "Failure sending request") + return + } + + result.dslr, err = client.GetDeletedSecretsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSecrets", resp, "Failure responding to request") + } + + return +} + +// GetDeletedSecretsPreparer prepares the GetDeletedSecrets request. +func (client BaseClient) GetDeletedSecretsPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/deletedsecrets"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeletedSecretsSender sends the GetDeletedSecrets request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetDeletedSecretsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetDeletedSecretsResponder handles the response to the GetDeletedSecrets request. The method always +// closes the http.Response Body. +func (client BaseClient) GetDeletedSecretsResponder(resp *http.Response) (result DeletedSecretListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getDeletedSecretsNextResults retrieves the next set of results, if any. +func (client BaseClient) getDeletedSecretsNextResults(lastResults DeletedSecretListResult) (result DeletedSecretListResult, err error) { + req, err := lastResults.deletedSecretListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedSecretsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetDeletedSecretsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedSecretsNextResults", resp, "Failure sending next results request") + } + result, err = client.GetDeletedSecretsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedSecretsNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetDeletedSecretsComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) GetDeletedSecretsComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result DeletedSecretListResultIterator, err error) { + result.page, err = client.GetDeletedSecrets(ctx, vaultBaseURL, maxresults) + return +} + +// GetDeletedStorageAccount the Get Deleted Storage Account operation returns the specified deleted storage account +// along with its attributes. This operation requires the storage/get permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// storageAccountName - the name of the storage account. +func (client BaseClient) GetDeletedStorageAccount(ctx context.Context, vaultBaseURL string, storageAccountName string) (result DeletedStorageBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: storageAccountName, + Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "GetDeletedStorageAccount", err.Error()) + } + + req, err := client.GetDeletedStorageAccountPreparer(ctx, vaultBaseURL, storageAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedStorageAccount", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeletedStorageAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedStorageAccount", resp, "Failure sending request") + return + } + + result, err = client.GetDeletedStorageAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedStorageAccount", resp, "Failure responding to request") + } + + return +} + +// GetDeletedStorageAccountPreparer prepares the GetDeletedStorageAccount request. +func (client BaseClient) GetDeletedStorageAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "storage-account-name": autorest.Encode("path", storageAccountName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/deletedstorage/{storage-account-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeletedStorageAccountSender sends the GetDeletedStorageAccount request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetDeletedStorageAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetDeletedStorageAccountResponder handles the response to the GetDeletedStorageAccount request. The method always +// closes the http.Response Body. +func (client BaseClient) GetDeletedStorageAccountResponder(resp *http.Response) (result DeletedStorageBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDeletedStorageAccounts the Get Deleted Storage Accounts operation returns the storage accounts that have been +// deleted for a vault enabled for soft-delete. This operation requires the storage/list permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// maxresults - maximum number of results to return in a page. If not specified the service will return up to +// 25 results. +func (client BaseClient) GetDeletedStorageAccounts(ctx context.Context, vaultBaseURL string, maxresults *int32) (result DeletedStorageListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxresults, + Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, + {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "GetDeletedStorageAccounts", err.Error()) + } + + result.fn = client.getDeletedStorageAccountsNextResults + req, err := client.GetDeletedStorageAccountsPreparer(ctx, vaultBaseURL, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedStorageAccounts", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeletedStorageAccountsSender(req) + if err != nil { + result.dslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedStorageAccounts", resp, "Failure sending request") + return + } + + result.dslr, err = client.GetDeletedStorageAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedStorageAccounts", resp, "Failure responding to request") + } + + return +} + +// GetDeletedStorageAccountsPreparer prepares the GetDeletedStorageAccounts request. +func (client BaseClient) GetDeletedStorageAccountsPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/deletedstorage"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeletedStorageAccountsSender sends the GetDeletedStorageAccounts request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetDeletedStorageAccountsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetDeletedStorageAccountsResponder handles the response to the GetDeletedStorageAccounts request. The method always +// closes the http.Response Body. +func (client BaseClient) GetDeletedStorageAccountsResponder(resp *http.Response) (result DeletedStorageListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getDeletedStorageAccountsNextResults retrieves the next set of results, if any. +func (client BaseClient) getDeletedStorageAccountsNextResults(lastResults DeletedStorageListResult) (result DeletedStorageListResult, err error) { + req, err := lastResults.deletedStorageListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedStorageAccountsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetDeletedStorageAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedStorageAccountsNextResults", resp, "Failure sending next results request") + } + result, err = client.GetDeletedStorageAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedStorageAccountsNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetDeletedStorageAccountsComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) GetDeletedStorageAccountsComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result DeletedStorageListResultIterator, err error) { + result.page, err = client.GetDeletedStorageAccounts(ctx, vaultBaseURL, maxresults) + return +} + +// GetKey the get key operation is applicable to all key types. If the requested key is symmetric, then no key material +// is released in the response. This operation requires the keys/get permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// keyName - the name of the key to get. +// keyVersion - adding the version parameter retrieves a specific version of a key. +func (client BaseClient) GetKey(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string) (result KeyBundle, err error) { + req, err := client.GetKeyPreparer(ctx, vaultBaseURL, keyName, keyVersion) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKey", nil, "Failure preparing request") + return + } + + resp, err := client.GetKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKey", resp, "Failure sending request") + return + } + + result, err = client.GetKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKey", resp, "Failure responding to request") + } + + return +} + +// GetKeyPreparer prepares the GetKey request. +func (client BaseClient) GetKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + "key-version": autorest.Encode("path", keyVersion), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/{key-version}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetKeySender sends the GetKey request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetKeyResponder handles the response to the GetKey request. The method always +// closes the http.Response Body. +func (client BaseClient) GetKeyResponder(resp *http.Response) (result KeyBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetKeys retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part of a +// stored key. The LIST operation is applicable to all key types, however only the base key identifier, attributes, and +// tags are provided in the response. Individual versions of a key are not listed in the response. This operation +// requires the keys/list permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// maxresults - maximum number of results to return in a page. If not specified the service will return up to +// 25 results. +func (client BaseClient) GetKeys(ctx context.Context, vaultBaseURL string, maxresults *int32) (result KeyListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxresults, + Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, + {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "GetKeys", err.Error()) + } + + result.fn = client.getKeysNextResults + req, err := client.GetKeysPreparer(ctx, vaultBaseURL, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKeys", nil, "Failure preparing request") + return + } + + resp, err := client.GetKeysSender(req) + if err != nil { + result.klr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKeys", resp, "Failure sending request") + return + } + + result.klr, err = client.GetKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKeys", resp, "Failure responding to request") + } + + return +} + +// GetKeysPreparer prepares the GetKeys request. +func (client BaseClient) GetKeysPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/keys"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetKeysSender sends the GetKeys request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetKeysResponder handles the response to the GetKeys request. The method always +// closes the http.Response Body. +func (client BaseClient) GetKeysResponder(resp *http.Response) (result KeyListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getKeysNextResults retrieves the next set of results, if any. +func (client BaseClient) getKeysNextResults(lastResults KeyListResult) (result KeyListResult, err error) { + req, err := lastResults.keyListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getKeysNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getKeysNextResults", resp, "Failure sending next results request") + } + result, err = client.GetKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getKeysNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetKeysComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) GetKeysComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result KeyListResultIterator, err error) { + result.page, err = client.GetKeys(ctx, vaultBaseURL, maxresults) + return +} + +// GetKeyVersions the full key identifier, attributes, and tags are provided in the response. This operation requires +// the keys/list permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// keyName - the name of the key. +// maxresults - maximum number of results to return in a page. If not specified the service will return up to +// 25 results. +func (client BaseClient) GetKeyVersions(ctx context.Context, vaultBaseURL string, keyName string, maxresults *int32) (result KeyListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxresults, + Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, + {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "GetKeyVersions", err.Error()) + } + + result.fn = client.getKeyVersionsNextResults + req, err := client.GetKeyVersionsPreparer(ctx, vaultBaseURL, keyName, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKeyVersions", nil, "Failure preparing request") + return + } + + resp, err := client.GetKeyVersionsSender(req) + if err != nil { + result.klr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKeyVersions", resp, "Failure sending request") + return + } + + result.klr, err = client.GetKeyVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKeyVersions", resp, "Failure responding to request") + } + + return +} + +// GetKeyVersionsPreparer prepares the GetKeyVersions request. +func (client BaseClient) GetKeyVersionsPreparer(ctx context.Context, vaultBaseURL string, keyName string, maxresults *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetKeyVersionsSender sends the GetKeyVersions request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetKeyVersionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetKeyVersionsResponder handles the response to the GetKeyVersions request. The method always +// closes the http.Response Body. +func (client BaseClient) GetKeyVersionsResponder(resp *http.Response) (result KeyListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getKeyVersionsNextResults retrieves the next set of results, if any. +func (client BaseClient) getKeyVersionsNextResults(lastResults KeyListResult) (result KeyListResult, err error) { + req, err := lastResults.keyListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getKeyVersionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetKeyVersionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getKeyVersionsNextResults", resp, "Failure sending next results request") + } + result, err = client.GetKeyVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getKeyVersionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetKeyVersionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) GetKeyVersionsComplete(ctx context.Context, vaultBaseURL string, keyName string, maxresults *int32) (result KeyListResultIterator, err error) { + result.page, err = client.GetKeyVersions(ctx, vaultBaseURL, keyName, maxresults) + return +} + +// GetSasDefinition gets information about a SAS definition for the specified storage account. This operation requires +// the storage/getsas permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// storageAccountName - the name of the storage account. +// sasDefinitionName - the name of the SAS definition. +func (client BaseClient) GetSasDefinition(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string) (result SasDefinitionBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: storageAccountName, + Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, + {TargetValue: sasDefinitionName, + Constraints: []validation.Constraint{{Target: "sasDefinitionName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "GetSasDefinition", err.Error()) + } + + req, err := client.GetSasDefinitionPreparer(ctx, vaultBaseURL, storageAccountName, sasDefinitionName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSasDefinition", nil, "Failure preparing request") + return + } + + resp, err := client.GetSasDefinitionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSasDefinition", resp, "Failure sending request") + return + } + + result, err = client.GetSasDefinitionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSasDefinition", resp, "Failure responding to request") + } + + return +} + +// GetSasDefinitionPreparer prepares the GetSasDefinition request. +func (client BaseClient) GetSasDefinitionPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "sas-definition-name": autorest.Encode("path", sasDefinitionName), + "storage-account-name": autorest.Encode("path", storageAccountName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/storage/{storage-account-name}/sas/{sas-definition-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSasDefinitionSender sends the GetSasDefinition request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetSasDefinitionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetSasDefinitionResponder handles the response to the GetSasDefinition request. The method always +// closes the http.Response Body. +func (client BaseClient) GetSasDefinitionResponder(resp *http.Response) (result SasDefinitionBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSasDefinitions list storage SAS definitions for the given storage account. This operation requires the +// storage/listsas permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// storageAccountName - the name of the storage account. +// maxresults - maximum number of results to return in a page. If not specified the service will return up to +// 25 results. +func (client BaseClient) GetSasDefinitions(ctx context.Context, vaultBaseURL string, storageAccountName string, maxresults *int32) (result SasDefinitionListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: storageAccountName, + Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, + {TargetValue: maxresults, + Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, + {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "GetSasDefinitions", err.Error()) + } + + result.fn = client.getSasDefinitionsNextResults + req, err := client.GetSasDefinitionsPreparer(ctx, vaultBaseURL, storageAccountName, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSasDefinitions", nil, "Failure preparing request") + return + } + + resp, err := client.GetSasDefinitionsSender(req) + if err != nil { + result.sdlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSasDefinitions", resp, "Failure sending request") + return + } + + result.sdlr, err = client.GetSasDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSasDefinitions", resp, "Failure responding to request") + } + + return +} + +// GetSasDefinitionsPreparer prepares the GetSasDefinitions request. +func (client BaseClient) GetSasDefinitionsPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, maxresults *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "storage-account-name": autorest.Encode("path", storageAccountName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/storage/{storage-account-name}/sas", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSasDefinitionsSender sends the GetSasDefinitions request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetSasDefinitionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetSasDefinitionsResponder handles the response to the GetSasDefinitions request. The method always +// closes the http.Response Body. +func (client BaseClient) GetSasDefinitionsResponder(resp *http.Response) (result SasDefinitionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getSasDefinitionsNextResults retrieves the next set of results, if any. +func (client BaseClient) getSasDefinitionsNextResults(lastResults SasDefinitionListResult) (result SasDefinitionListResult, err error) { + req, err := lastResults.sasDefinitionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSasDefinitionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetSasDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSasDefinitionsNextResults", resp, "Failure sending next results request") + } + result, err = client.GetSasDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSasDefinitionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetSasDefinitionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) GetSasDefinitionsComplete(ctx context.Context, vaultBaseURL string, storageAccountName string, maxresults *int32) (result SasDefinitionListResultIterator, err error) { + result.page, err = client.GetSasDefinitions(ctx, vaultBaseURL, storageAccountName, maxresults) + return +} + +// GetSecret the GET operation is applicable to any secret stored in Azure Key Vault. This operation requires the +// secrets/get permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// secretName - the name of the secret. +// secretVersion - the version of the secret. +func (client BaseClient) GetSecret(ctx context.Context, vaultBaseURL string, secretName string, secretVersion string) (result SecretBundle, err error) { + req, err := client.GetSecretPreparer(ctx, vaultBaseURL, secretName, secretVersion) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecret", nil, "Failure preparing request") + return + } + + resp, err := client.GetSecretSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecret", resp, "Failure sending request") + return + } + + result, err = client.GetSecretResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecret", resp, "Failure responding to request") + } + + return +} + +// GetSecretPreparer prepares the GetSecret request. +func (client BaseClient) GetSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string, secretVersion string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "secret-name": autorest.Encode("path", secretName), + "secret-version": autorest.Encode("path", secretVersion), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/secrets/{secret-name}/{secret-version}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSecretSender sends the GetSecret request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetSecretSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetSecretResponder handles the response to the GetSecret request. The method always +// closes the http.Response Body. +func (client BaseClient) GetSecretResponder(resp *http.Response) (result SecretBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSecrets the Get Secrets operation is applicable to the entire vault. However, only the base secret identifier and +// its attributes are provided in the response. Individual secret versions are not listed in the response. This +// operation requires the secrets/list permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// maxresults - maximum number of results to return in a page. If not specified, the service will return up to +// 25 results. +func (client BaseClient) GetSecrets(ctx context.Context, vaultBaseURL string, maxresults *int32) (result SecretListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxresults, + Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, + {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "GetSecrets", err.Error()) + } + + result.fn = client.getSecretsNextResults + req, err := client.GetSecretsPreparer(ctx, vaultBaseURL, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecrets", nil, "Failure preparing request") + return + } + + resp, err := client.GetSecretsSender(req) + if err != nil { + result.slr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecrets", resp, "Failure sending request") + return + } + + result.slr, err = client.GetSecretsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecrets", resp, "Failure responding to request") + } + + return +} + +// GetSecretsPreparer prepares the GetSecrets request. +func (client BaseClient) GetSecretsPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/secrets"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSecretsSender sends the GetSecrets request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetSecretsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetSecretsResponder handles the response to the GetSecrets request. The method always +// closes the http.Response Body. +func (client BaseClient) GetSecretsResponder(resp *http.Response) (result SecretListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getSecretsNextResults retrieves the next set of results, if any. +func (client BaseClient) getSecretsNextResults(lastResults SecretListResult) (result SecretListResult, err error) { + req, err := lastResults.secretListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSecretsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetSecretsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSecretsNextResults", resp, "Failure sending next results request") + } + result, err = client.GetSecretsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSecretsNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetSecretsComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) GetSecretsComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result SecretListResultIterator, err error) { + result.page, err = client.GetSecrets(ctx, vaultBaseURL, maxresults) + return +} + +// GetSecretVersions the full secret identifier and attributes are provided in the response. No values are returned for +// the secrets. This operations requires the secrets/list permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// secretName - the name of the secret. +// maxresults - maximum number of results to return in a page. If not specified, the service will return up to +// 25 results. +func (client BaseClient) GetSecretVersions(ctx context.Context, vaultBaseURL string, secretName string, maxresults *int32) (result SecretListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxresults, + Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, + {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "GetSecretVersions", err.Error()) + } + + result.fn = client.getSecretVersionsNextResults + req, err := client.GetSecretVersionsPreparer(ctx, vaultBaseURL, secretName, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecretVersions", nil, "Failure preparing request") + return + } + + resp, err := client.GetSecretVersionsSender(req) + if err != nil { + result.slr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecretVersions", resp, "Failure sending request") + return + } + + result.slr, err = client.GetSecretVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecretVersions", resp, "Failure responding to request") + } + + return +} + +// GetSecretVersionsPreparer prepares the GetSecretVersions request. +func (client BaseClient) GetSecretVersionsPreparer(ctx context.Context, vaultBaseURL string, secretName string, maxresults *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "secret-name": autorest.Encode("path", secretName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/secrets/{secret-name}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSecretVersionsSender sends the GetSecretVersions request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetSecretVersionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetSecretVersionsResponder handles the response to the GetSecretVersions request. The method always +// closes the http.Response Body. +func (client BaseClient) GetSecretVersionsResponder(resp *http.Response) (result SecretListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getSecretVersionsNextResults retrieves the next set of results, if any. +func (client BaseClient) getSecretVersionsNextResults(lastResults SecretListResult) (result SecretListResult, err error) { + req, err := lastResults.secretListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSecretVersionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetSecretVersionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSecretVersionsNextResults", resp, "Failure sending next results request") + } + result, err = client.GetSecretVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSecretVersionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetSecretVersionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) GetSecretVersionsComplete(ctx context.Context, vaultBaseURL string, secretName string, maxresults *int32) (result SecretListResultIterator, err error) { + result.page, err = client.GetSecretVersions(ctx, vaultBaseURL, secretName, maxresults) + return +} + +// GetStorageAccount gets information about a specified storage account. This operation requires the storage/get +// permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// storageAccountName - the name of the storage account. +func (client BaseClient) GetStorageAccount(ctx context.Context, vaultBaseURL string, storageAccountName string) (result StorageBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: storageAccountName, + Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "GetStorageAccount", err.Error()) + } + + req, err := client.GetStorageAccountPreparer(ctx, vaultBaseURL, storageAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetStorageAccount", nil, "Failure preparing request") + return + } + + resp, err := client.GetStorageAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetStorageAccount", resp, "Failure sending request") + return + } + + result, err = client.GetStorageAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetStorageAccount", resp, "Failure responding to request") + } + + return +} + +// GetStorageAccountPreparer prepares the GetStorageAccount request. +func (client BaseClient) GetStorageAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "storage-account-name": autorest.Encode("path", storageAccountName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/storage/{storage-account-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetStorageAccountSender sends the GetStorageAccount request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetStorageAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetStorageAccountResponder handles the response to the GetStorageAccount request. The method always +// closes the http.Response Body. +func (client BaseClient) GetStorageAccountResponder(resp *http.Response) (result StorageBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetStorageAccounts list storage accounts managed by the specified key vault. This operation requires the +// storage/list permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// maxresults - maximum number of results to return in a page. If not specified the service will return up to +// 25 results. +func (client BaseClient) GetStorageAccounts(ctx context.Context, vaultBaseURL string, maxresults *int32) (result StorageListResultPage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxresults, + Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, + {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "GetStorageAccounts", err.Error()) + } + + result.fn = client.getStorageAccountsNextResults + req, err := client.GetStorageAccountsPreparer(ctx, vaultBaseURL, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetStorageAccounts", nil, "Failure preparing request") + return + } + + resp, err := client.GetStorageAccountsSender(req) + if err != nil { + result.slr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetStorageAccounts", resp, "Failure sending request") + return + } + + result.slr, err = client.GetStorageAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetStorageAccounts", resp, "Failure responding to request") + } + + return +} + +// GetStorageAccountsPreparer prepares the GetStorageAccounts request. +func (client BaseClient) GetStorageAccountsPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/storage"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetStorageAccountsSender sends the GetStorageAccounts request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetStorageAccountsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetStorageAccountsResponder handles the response to the GetStorageAccounts request. The method always +// closes the http.Response Body. +func (client BaseClient) GetStorageAccountsResponder(resp *http.Response) (result StorageListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getStorageAccountsNextResults retrieves the next set of results, if any. +func (client BaseClient) getStorageAccountsNextResults(lastResults StorageListResult) (result StorageListResult, err error) { + req, err := lastResults.storageListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getStorageAccountsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetStorageAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getStorageAccountsNextResults", resp, "Failure sending next results request") + } + result, err = client.GetStorageAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getStorageAccountsNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetStorageAccountsComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) GetStorageAccountsComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result StorageListResultIterator, err error) { + result.page, err = client.GetStorageAccounts(ctx, vaultBaseURL, maxresults) + return +} + +// ImportCertificate imports an existing valid certificate, containing a private key, into Azure Key Vault. The +// certificate to be imported can be in either PFX or PEM format. If the certificate is in PEM format the PEM file must +// contain the key as well as x509 certificates. This operation requires the certificates/import permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// certificateName - the name of the certificate. +// parameters - the parameters to import the certificate. +func (client BaseClient) ImportCertificate(ctx context.Context, vaultBaseURL string, certificateName string, parameters CertificateImportParameters) (result CertificateBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: certificateName, + Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Base64EncodedCertificate", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.CertificatePolicy", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties.ValidityInMonths", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties.ValidityInMonths", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "ImportCertificate", err.Error()) + } + + req, err := client.ImportCertificatePreparer(ctx, vaultBaseURL, certificateName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "ImportCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.ImportCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "ImportCertificate", resp, "Failure sending request") + return + } + + result, err = client.ImportCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "ImportCertificate", resp, "Failure responding to request") + } + + return +} + +// ImportCertificatePreparer prepares the ImportCertificate request. +func (client BaseClient) ImportCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string, parameters CertificateImportParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/import", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ImportCertificateSender sends the ImportCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ImportCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ImportCertificateResponder handles the response to the ImportCertificate request. The method always +// closes the http.Response Body. +func (client BaseClient) ImportCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ImportKey the import key operation may be used to import any key type into an Azure Key Vault. If the named key +// already exists, Azure Key Vault creates a new version of the key. This operation requires the keys/import +// permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// keyName - name for the imported key. +// parameters - the parameters to import a key. +func (client BaseClient) ImportKey(ctx context.Context, vaultBaseURL string, keyName string, parameters KeyImportParameters) (result KeyBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: keyName, + Constraints: []validation.Constraint{{Target: "keyName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Key", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "ImportKey", err.Error()) + } + + req, err := client.ImportKeyPreparer(ctx, vaultBaseURL, keyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "ImportKey", nil, "Failure preparing request") + return + } + + resp, err := client.ImportKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "ImportKey", resp, "Failure sending request") + return + } + + result, err = client.ImportKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "ImportKey", resp, "Failure responding to request") + } + + return +} + +// ImportKeyPreparer prepares the ImportKey request. +func (client BaseClient) ImportKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string, parameters KeyImportParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ImportKeySender sends the ImportKey request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ImportKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ImportKeyResponder handles the response to the ImportKey request. The method always +// closes the http.Response Body. +func (client BaseClient) ImportKeyResponder(resp *http.Response) (result KeyBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// MergeCertificate the MergeCertificate operation performs the merging of a certificate or certificate chain with a +// key pair currently available in the service. This operation requires the certificates/create permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// certificateName - the name of the certificate. +// parameters - the parameters to merge certificate. +func (client BaseClient) MergeCertificate(ctx context.Context, vaultBaseURL string, certificateName string, parameters CertificateMergeParameters) (result CertificateBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.X509Certificates", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "MergeCertificate", err.Error()) + } + + req, err := client.MergeCertificatePreparer(ctx, vaultBaseURL, certificateName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "MergeCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.MergeCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "MergeCertificate", resp, "Failure sending request") + return + } + + result, err = client.MergeCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "MergeCertificate", resp, "Failure responding to request") + } + + return +} + +// MergeCertificatePreparer prepares the MergeCertificate request. +func (client BaseClient) MergeCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string, parameters CertificateMergeParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/pending/merge", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// MergeCertificateSender sends the MergeCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) MergeCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// MergeCertificateResponder handles the response to the MergeCertificate request. The method always +// closes the http.Response Body. +func (client BaseClient) MergeCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// PurgeDeletedCertificate the PurgeDeletedCertificate operation performs an irreversible deletion of the specified +// certificate, without possibility for recovery. The operation is not available if the recovery level does not specify +// 'Purgeable'. This operation requires the certificate/purge permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// certificateName - the name of the certificate +func (client BaseClient) PurgeDeletedCertificate(ctx context.Context, vaultBaseURL string, certificateName string) (result autorest.Response, err error) { + req, err := client.PurgeDeletedCertificatePreparer(ctx, vaultBaseURL, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.PurgeDeletedCertificateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedCertificate", resp, "Failure sending request") + return + } + + result, err = client.PurgeDeletedCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedCertificate", resp, "Failure responding to request") + } + + return +} + +// PurgeDeletedCertificatePreparer prepares the PurgeDeletedCertificate request. +func (client BaseClient) PurgeDeletedCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/deletedcertificates/{certificate-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PurgeDeletedCertificateSender sends the PurgeDeletedCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) PurgeDeletedCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// PurgeDeletedCertificateResponder handles the response to the PurgeDeletedCertificate request. The method always +// closes the http.Response Body. +func (client BaseClient) PurgeDeletedCertificateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// PurgeDeletedKey the Purge Deleted Key operation is applicable for soft-delete enabled vaults. While the operation +// can be invoked on any vault, it will return an error if invoked on a non soft-delete enabled vault. This operation +// requires the keys/purge permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// keyName - the name of the key +func (client BaseClient) PurgeDeletedKey(ctx context.Context, vaultBaseURL string, keyName string) (result autorest.Response, err error) { + req, err := client.PurgeDeletedKeyPreparer(ctx, vaultBaseURL, keyName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedKey", nil, "Failure preparing request") + return + } + + resp, err := client.PurgeDeletedKeySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedKey", resp, "Failure sending request") + return + } + + result, err = client.PurgeDeletedKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedKey", resp, "Failure responding to request") + } + + return +} + +// PurgeDeletedKeyPreparer prepares the PurgeDeletedKey request. +func (client BaseClient) PurgeDeletedKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/deletedkeys/{key-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PurgeDeletedKeySender sends the PurgeDeletedKey request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) PurgeDeletedKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// PurgeDeletedKeyResponder handles the response to the PurgeDeletedKey request. The method always +// closes the http.Response Body. +func (client BaseClient) PurgeDeletedKeyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// PurgeDeletedSecret the purge deleted secret operation removes the secret permanently, without the possibility of +// recovery. This operation can only be enabled on a soft-delete enabled vault. This operation requires the +// secrets/purge permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// secretName - the name of the secret. +func (client BaseClient) PurgeDeletedSecret(ctx context.Context, vaultBaseURL string, secretName string) (result autorest.Response, err error) { + req, err := client.PurgeDeletedSecretPreparer(ctx, vaultBaseURL, secretName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedSecret", nil, "Failure preparing request") + return + } + + resp, err := client.PurgeDeletedSecretSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedSecret", resp, "Failure sending request") + return + } + + result, err = client.PurgeDeletedSecretResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedSecret", resp, "Failure responding to request") + } + + return +} + +// PurgeDeletedSecretPreparer prepares the PurgeDeletedSecret request. +func (client BaseClient) PurgeDeletedSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "secret-name": autorest.Encode("path", secretName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/deletedsecrets/{secret-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PurgeDeletedSecretSender sends the PurgeDeletedSecret request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) PurgeDeletedSecretSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// PurgeDeletedSecretResponder handles the response to the PurgeDeletedSecret request. The method always +// closes the http.Response Body. +func (client BaseClient) PurgeDeletedSecretResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// PurgeDeletedStorageAccount the purge deleted storage account operation removes the secret permanently, without the +// possibility of recovery. This operation can only be performed on a soft-delete enabled vault. This operation +// requires the storage/purge permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// storageAccountName - the name of the storage account. +func (client BaseClient) PurgeDeletedStorageAccount(ctx context.Context, vaultBaseURL string, storageAccountName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: storageAccountName, + Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "PurgeDeletedStorageAccount", err.Error()) + } + + req, err := client.PurgeDeletedStorageAccountPreparer(ctx, vaultBaseURL, storageAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedStorageAccount", nil, "Failure preparing request") + return + } + + resp, err := client.PurgeDeletedStorageAccountSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedStorageAccount", resp, "Failure sending request") + return + } + + result, err = client.PurgeDeletedStorageAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedStorageAccount", resp, "Failure responding to request") + } + + return +} + +// PurgeDeletedStorageAccountPreparer prepares the PurgeDeletedStorageAccount request. +func (client BaseClient) PurgeDeletedStorageAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "storage-account-name": autorest.Encode("path", storageAccountName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/deletedstorage/{storage-account-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PurgeDeletedStorageAccountSender sends the PurgeDeletedStorageAccount request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) PurgeDeletedStorageAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// PurgeDeletedStorageAccountResponder handles the response to the PurgeDeletedStorageAccount request. The method always +// closes the http.Response Body. +func (client BaseClient) PurgeDeletedStorageAccountResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// RecoverDeletedCertificate the RecoverDeletedCertificate operation performs the reversal of the Delete operation. The +// operation is applicable in vaults enabled for soft-delete, and must be issued during the retention interval +// (available in the deleted certificate's attributes). This operation requires the certificates/recover permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// certificateName - the name of the deleted certificate +func (client BaseClient) RecoverDeletedCertificate(ctx context.Context, vaultBaseURL string, certificateName string) (result CertificateBundle, err error) { + req, err := client.RecoverDeletedCertificatePreparer(ctx, vaultBaseURL, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.RecoverDeletedCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedCertificate", resp, "Failure sending request") + return + } + + result, err = client.RecoverDeletedCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedCertificate", resp, "Failure responding to request") + } + + return +} + +// RecoverDeletedCertificatePreparer prepares the RecoverDeletedCertificate request. +func (client BaseClient) RecoverDeletedCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/deletedcertificates/{certificate-name}/recover", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RecoverDeletedCertificateSender sends the RecoverDeletedCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) RecoverDeletedCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// RecoverDeletedCertificateResponder handles the response to the RecoverDeletedCertificate request. The method always +// closes the http.Response Body. +func (client BaseClient) RecoverDeletedCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RecoverDeletedKey the Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults. It +// recovers the deleted key back to its latest version under /keys. An attempt to recover an non-deleted key will +// return an error. Consider this the inverse of the delete operation on soft-delete enabled vaults. This operation +// requires the keys/recover permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// keyName - the name of the deleted key. +func (client BaseClient) RecoverDeletedKey(ctx context.Context, vaultBaseURL string, keyName string) (result KeyBundle, err error) { + req, err := client.RecoverDeletedKeyPreparer(ctx, vaultBaseURL, keyName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedKey", nil, "Failure preparing request") + return + } + + resp, err := client.RecoverDeletedKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedKey", resp, "Failure sending request") + return + } + + result, err = client.RecoverDeletedKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedKey", resp, "Failure responding to request") + } + + return +} + +// RecoverDeletedKeyPreparer prepares the RecoverDeletedKey request. +func (client BaseClient) RecoverDeletedKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/deletedkeys/{key-name}/recover", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RecoverDeletedKeySender sends the RecoverDeletedKey request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) RecoverDeletedKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// RecoverDeletedKeyResponder handles the response to the RecoverDeletedKey request. The method always +// closes the http.Response Body. +func (client BaseClient) RecoverDeletedKeyResponder(resp *http.Response) (result KeyBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RecoverDeletedSasDefinition recovers the deleted SAS definition for the specified storage account. This operation +// can only be performed on a soft-delete enabled vault. This operation requires the storage/recover permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// storageAccountName - the name of the storage account. +// sasDefinitionName - the name of the SAS definition. +func (client BaseClient) RecoverDeletedSasDefinition(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string) (result SasDefinitionBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: storageAccountName, + Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, + {TargetValue: sasDefinitionName, + Constraints: []validation.Constraint{{Target: "sasDefinitionName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "RecoverDeletedSasDefinition", err.Error()) + } + + req, err := client.RecoverDeletedSasDefinitionPreparer(ctx, vaultBaseURL, storageAccountName, sasDefinitionName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedSasDefinition", nil, "Failure preparing request") + return + } + + resp, err := client.RecoverDeletedSasDefinitionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedSasDefinition", resp, "Failure sending request") + return + } + + result, err = client.RecoverDeletedSasDefinitionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedSasDefinition", resp, "Failure responding to request") + } + + return +} + +// RecoverDeletedSasDefinitionPreparer prepares the RecoverDeletedSasDefinition request. +func (client BaseClient) RecoverDeletedSasDefinitionPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "sas-definition-name": autorest.Encode("path", sasDefinitionName), + "storage-account-name": autorest.Encode("path", storageAccountName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RecoverDeletedSasDefinitionSender sends the RecoverDeletedSasDefinition request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) RecoverDeletedSasDefinitionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// RecoverDeletedSasDefinitionResponder handles the response to the RecoverDeletedSasDefinition request. The method always +// closes the http.Response Body. +func (client BaseClient) RecoverDeletedSasDefinitionResponder(resp *http.Response) (result SasDefinitionBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RecoverDeletedSecret recovers the deleted secret in the specified vault. This operation can only be performed on a +// soft-delete enabled vault. This operation requires the secrets/recover permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// secretName - the name of the deleted secret. +func (client BaseClient) RecoverDeletedSecret(ctx context.Context, vaultBaseURL string, secretName string) (result SecretBundle, err error) { + req, err := client.RecoverDeletedSecretPreparer(ctx, vaultBaseURL, secretName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedSecret", nil, "Failure preparing request") + return + } + + resp, err := client.RecoverDeletedSecretSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedSecret", resp, "Failure sending request") + return + } + + result, err = client.RecoverDeletedSecretResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedSecret", resp, "Failure responding to request") + } + + return +} + +// RecoverDeletedSecretPreparer prepares the RecoverDeletedSecret request. +func (client BaseClient) RecoverDeletedSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "secret-name": autorest.Encode("path", secretName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/deletedsecrets/{secret-name}/recover", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RecoverDeletedSecretSender sends the RecoverDeletedSecret request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) RecoverDeletedSecretSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// RecoverDeletedSecretResponder handles the response to the RecoverDeletedSecret request. The method always +// closes the http.Response Body. +func (client BaseClient) RecoverDeletedSecretResponder(resp *http.Response) (result SecretBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RecoverDeletedStorageAccount recovers the deleted storage account in the specified vault. This operation can only be +// performed on a soft-delete enabled vault. This operation requires the storage/recover permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// storageAccountName - the name of the storage account. +func (client BaseClient) RecoverDeletedStorageAccount(ctx context.Context, vaultBaseURL string, storageAccountName string) (result StorageBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: storageAccountName, + Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "RecoverDeletedStorageAccount", err.Error()) + } + + req, err := client.RecoverDeletedStorageAccountPreparer(ctx, vaultBaseURL, storageAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedStorageAccount", nil, "Failure preparing request") + return + } + + resp, err := client.RecoverDeletedStorageAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedStorageAccount", resp, "Failure sending request") + return + } + + result, err = client.RecoverDeletedStorageAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedStorageAccount", resp, "Failure responding to request") + } + + return +} + +// RecoverDeletedStorageAccountPreparer prepares the RecoverDeletedStorageAccount request. +func (client BaseClient) RecoverDeletedStorageAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "storage-account-name": autorest.Encode("path", storageAccountName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/deletedstorage/{storage-account-name}/recover", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RecoverDeletedStorageAccountSender sends the RecoverDeletedStorageAccount request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) RecoverDeletedStorageAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// RecoverDeletedStorageAccountResponder handles the response to the RecoverDeletedStorageAccount request. The method always +// closes the http.Response Body. +func (client BaseClient) RecoverDeletedStorageAccountResponder(resp *http.Response) (result StorageBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateStorageAccountKey regenerates the specified key value for the given storage account. This operation +// requires the storage/regeneratekey permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// storageAccountName - the name of the storage account. +// parameters - the parameters to regenerate storage account key. +func (client BaseClient) RegenerateStorageAccountKey(ctx context.Context, vaultBaseURL string, storageAccountName string, parameters StorageAccountRegenerteKeyParameters) (result StorageBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: storageAccountName, + Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "RegenerateStorageAccountKey", err.Error()) + } + + req, err := client.RegenerateStorageAccountKeyPreparer(ctx, vaultBaseURL, storageAccountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RegenerateStorageAccountKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateStorageAccountKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RegenerateStorageAccountKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateStorageAccountKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RegenerateStorageAccountKey", resp, "Failure responding to request") + } + + return +} + +// RegenerateStorageAccountKeyPreparer prepares the RegenerateStorageAccountKey request. +func (client BaseClient) RegenerateStorageAccountKeyPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, parameters StorageAccountRegenerteKeyParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "storage-account-name": autorest.Encode("path", storageAccountName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/storage/{storage-account-name}/regeneratekey", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegenerateStorageAccountKeySender sends the RegenerateStorageAccountKey request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) RegenerateStorageAccountKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// RegenerateStorageAccountKeyResponder handles the response to the RegenerateStorageAccountKey request. The method always +// closes the http.Response Body. +func (client BaseClient) RegenerateStorageAccountKeyResponder(resp *http.Response) (result StorageBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RestoreCertificate restores a backed up certificate, and all its versions, to a vault. This operation requires the +// certificates/restore permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// parameters - the parameters to restore the certificate. +func (client BaseClient) RestoreCertificate(ctx context.Context, vaultBaseURL string, parameters CertificateRestoreParameters) (result CertificateBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.CertificateBundleBackup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "RestoreCertificate", err.Error()) + } + + req, err := client.RestoreCertificatePreparer(ctx, vaultBaseURL, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.RestoreCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreCertificate", resp, "Failure sending request") + return + } + + result, err = client.RestoreCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreCertificate", resp, "Failure responding to request") + } + + return +} + +// RestoreCertificatePreparer prepares the RestoreCertificate request. +func (client BaseClient) RestoreCertificatePreparer(ctx context.Context, vaultBaseURL string, parameters CertificateRestoreParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/certificates/restore"), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestoreCertificateSender sends the RestoreCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) RestoreCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// RestoreCertificateResponder handles the response to the RestoreCertificate request. The method always +// closes the http.Response Body. +func (client BaseClient) RestoreCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RestoreKey imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, +// attributes and access control policies. The RESTORE operation may be used to import a previously backed up key. +// Individual versions of a key cannot be restored. The key is restored in its entirety with the same key name as it +// had when it was backed up. If the key name is not available in the target Key Vault, the RESTORE operation will be +// rejected. While the key name is retained during restore, the final key identifier will change if the key is restored +// to a different vault. Restore will restore all versions and preserve version identifiers. The RESTORE operation is +// subject to security constraints: The target Key Vault must be owned by the same Microsoft Azure Subscription as the +// source Key Vault The user must have RESTORE permission in the target Key Vault. This operation requires the +// keys/restore permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// parameters - the parameters to restore the key. +func (client BaseClient) RestoreKey(ctx context.Context, vaultBaseURL string, parameters KeyRestoreParameters) (result KeyBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.KeyBundleBackup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "RestoreKey", err.Error()) + } + + req, err := client.RestoreKeyPreparer(ctx, vaultBaseURL, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreKey", nil, "Failure preparing request") + return + } + + resp, err := client.RestoreKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreKey", resp, "Failure sending request") + return + } + + result, err = client.RestoreKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreKey", resp, "Failure responding to request") + } + + return +} + +// RestoreKeyPreparer prepares the RestoreKey request. +func (client BaseClient) RestoreKeyPreparer(ctx context.Context, vaultBaseURL string, parameters KeyRestoreParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/keys/restore"), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestoreKeySender sends the RestoreKey request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) RestoreKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// RestoreKeyResponder handles the response to the RestoreKey request. The method always +// closes the http.Response Body. +func (client BaseClient) RestoreKeyResponder(resp *http.Response) (result KeyBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RestoreSecret restores a backed up secret, and all its versions, to a vault. This operation requires the +// secrets/restore permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// parameters - the parameters to restore the secret. +func (client BaseClient) RestoreSecret(ctx context.Context, vaultBaseURL string, parameters SecretRestoreParameters) (result SecretBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.SecretBundleBackup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "RestoreSecret", err.Error()) + } + + req, err := client.RestoreSecretPreparer(ctx, vaultBaseURL, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreSecret", nil, "Failure preparing request") + return + } + + resp, err := client.RestoreSecretSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreSecret", resp, "Failure sending request") + return + } + + result, err = client.RestoreSecretResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreSecret", resp, "Failure responding to request") + } + + return +} + +// RestoreSecretPreparer prepares the RestoreSecret request. +func (client BaseClient) RestoreSecretPreparer(ctx context.Context, vaultBaseURL string, parameters SecretRestoreParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/secrets/restore"), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestoreSecretSender sends the RestoreSecret request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) RestoreSecretSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// RestoreSecretResponder handles the response to the RestoreSecret request. The method always +// closes the http.Response Body. +func (client BaseClient) RestoreSecretResponder(resp *http.Response) (result SecretBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RestoreStorageAccount restores a backed up storage account to a vault. This operation requires the storage/restore +// permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// parameters - the parameters to restore the storage account. +func (client BaseClient) RestoreStorageAccount(ctx context.Context, vaultBaseURL string, parameters StorageRestoreParameters) (result StorageBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.StorageBundleBackup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "RestoreStorageAccount", err.Error()) + } + + req, err := client.RestoreStorageAccountPreparer(ctx, vaultBaseURL, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreStorageAccount", nil, "Failure preparing request") + return + } + + resp, err := client.RestoreStorageAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreStorageAccount", resp, "Failure sending request") + return + } + + result, err = client.RestoreStorageAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreStorageAccount", resp, "Failure responding to request") + } + + return +} + +// RestoreStorageAccountPreparer prepares the RestoreStorageAccount request. +func (client BaseClient) RestoreStorageAccountPreparer(ctx context.Context, vaultBaseURL string, parameters StorageRestoreParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/storage/restore"), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestoreStorageAccountSender sends the RestoreStorageAccount request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) RestoreStorageAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// RestoreStorageAccountResponder handles the response to the RestoreStorageAccount request. The method always +// closes the http.Response Body. +func (client BaseClient) RestoreStorageAccountResponder(resp *http.Response) (result StorageBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SetCertificateContacts sets the certificate contacts for the specified key vault. This operation requires the +// certificates/managecontacts permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// contacts - the contacts for the key vault certificate. +func (client BaseClient) SetCertificateContacts(ctx context.Context, vaultBaseURL string, contacts Contacts) (result Contacts, err error) { + req, err := client.SetCertificateContactsPreparer(ctx, vaultBaseURL, contacts) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetCertificateContacts", nil, "Failure preparing request") + return + } + + resp, err := client.SetCertificateContactsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetCertificateContacts", resp, "Failure sending request") + return + } + + result, err = client.SetCertificateContactsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetCertificateContacts", resp, "Failure responding to request") + } + + return +} + +// SetCertificateContactsPreparer prepares the SetCertificateContacts request. +func (client BaseClient) SetCertificateContactsPreparer(ctx context.Context, vaultBaseURL string, contacts Contacts) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/certificates/contacts"), + autorest.WithJSON(contacts), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SetCertificateContactsSender sends the SetCertificateContacts request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) SetCertificateContactsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// SetCertificateContactsResponder handles the response to the SetCertificateContacts request. The method always +// closes the http.Response Body. +func (client BaseClient) SetCertificateContactsResponder(resp *http.Response) (result Contacts, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SetCertificateIssuer the SetCertificateIssuer operation adds or updates the specified certificate issuer. This +// operation requires the certificates/setissuers permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// issuerName - the name of the issuer. +// parameter - certificate issuer set parameter. +func (client BaseClient) SetCertificateIssuer(ctx context.Context, vaultBaseURL string, issuerName string, parameter CertificateIssuerSetParameters) (result IssuerBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameter, + Constraints: []validation.Constraint{{Target: "parameter.Provider", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "SetCertificateIssuer", err.Error()) + } + + req, err := client.SetCertificateIssuerPreparer(ctx, vaultBaseURL, issuerName, parameter) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetCertificateIssuer", nil, "Failure preparing request") + return + } + + resp, err := client.SetCertificateIssuerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetCertificateIssuer", resp, "Failure sending request") + return + } + + result, err = client.SetCertificateIssuerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetCertificateIssuer", resp, "Failure responding to request") + } + + return +} + +// SetCertificateIssuerPreparer prepares the SetCertificateIssuer request. +func (client BaseClient) SetCertificateIssuerPreparer(ctx context.Context, vaultBaseURL string, issuerName string, parameter CertificateIssuerSetParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "issuer-name": autorest.Encode("path", issuerName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/issuers/{issuer-name}", pathParameters), + autorest.WithJSON(parameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SetCertificateIssuerSender sends the SetCertificateIssuer request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) SetCertificateIssuerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// SetCertificateIssuerResponder handles the response to the SetCertificateIssuer request. The method always +// closes the http.Response Body. +func (client BaseClient) SetCertificateIssuerResponder(resp *http.Response) (result IssuerBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SetSasDefinition creates or updates a new SAS definition for the specified storage account. This operation requires +// the storage/setsas permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// storageAccountName - the name of the storage account. +// sasDefinitionName - the name of the SAS definition. +// parameters - the parameters to create a SAS definition. +func (client BaseClient) SetSasDefinition(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string, parameters SasDefinitionCreateParameters) (result SasDefinitionBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: storageAccountName, + Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, + {TargetValue: sasDefinitionName, + Constraints: []validation.Constraint{{Target: "sasDefinitionName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TemplateURI", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ValidityPeriod", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "SetSasDefinition", err.Error()) + } + + req, err := client.SetSasDefinitionPreparer(ctx, vaultBaseURL, storageAccountName, sasDefinitionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetSasDefinition", nil, "Failure preparing request") + return + } + + resp, err := client.SetSasDefinitionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetSasDefinition", resp, "Failure sending request") + return + } + + result, err = client.SetSasDefinitionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetSasDefinition", resp, "Failure responding to request") + } + + return +} + +// SetSasDefinitionPreparer prepares the SetSasDefinition request. +func (client BaseClient) SetSasDefinitionPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string, parameters SasDefinitionCreateParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "sas-definition-name": autorest.Encode("path", sasDefinitionName), + "storage-account-name": autorest.Encode("path", storageAccountName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/storage/{storage-account-name}/sas/{sas-definition-name}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SetSasDefinitionSender sends the SetSasDefinition request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) SetSasDefinitionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// SetSasDefinitionResponder handles the response to the SetSasDefinition request. The method always +// closes the http.Response Body. +func (client BaseClient) SetSasDefinitionResponder(resp *http.Response) (result SasDefinitionBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SetSecret the SET operation adds a secret to the Azure Key Vault. If the named secret already exists, Azure Key +// Vault creates a new version of that secret. This operation requires the secrets/set permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// secretName - the name of the secret. +// parameters - the parameters for setting the secret. +func (client BaseClient) SetSecret(ctx context.Context, vaultBaseURL string, secretName string, parameters SecretSetParameters) (result SecretBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: secretName, + Constraints: []validation.Constraint{{Target: "secretName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "SetSecret", err.Error()) + } + + req, err := client.SetSecretPreparer(ctx, vaultBaseURL, secretName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetSecret", nil, "Failure preparing request") + return + } + + resp, err := client.SetSecretSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetSecret", resp, "Failure sending request") + return + } + + result, err = client.SetSecretResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetSecret", resp, "Failure responding to request") + } + + return +} + +// SetSecretPreparer prepares the SetSecret request. +func (client BaseClient) SetSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string, parameters SecretSetParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "secret-name": autorest.Encode("path", secretName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/secrets/{secret-name}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SetSecretSender sends the SetSecret request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) SetSecretSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// SetSecretResponder handles the response to the SetSecret request. The method always +// closes the http.Response Body. +func (client BaseClient) SetSecretResponder(resp *http.Response) (result SecretBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SetStorageAccount creates or updates a new storage account. This operation requires the storage/set permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// storageAccountName - the name of the storage account. +// parameters - the parameters to create a storage account. +func (client BaseClient) SetStorageAccount(ctx context.Context, vaultBaseURL string, storageAccountName string, parameters StorageAccountCreateParameters) (result StorageBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: storageAccountName, + Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ResourceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ActiveKeyName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AutoRegenerateKey", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "SetStorageAccount", err.Error()) + } + + req, err := client.SetStorageAccountPreparer(ctx, vaultBaseURL, storageAccountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetStorageAccount", nil, "Failure preparing request") + return + } + + resp, err := client.SetStorageAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetStorageAccount", resp, "Failure sending request") + return + } + + result, err = client.SetStorageAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetStorageAccount", resp, "Failure responding to request") + } + + return +} + +// SetStorageAccountPreparer prepares the SetStorageAccount request. +func (client BaseClient) SetStorageAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, parameters StorageAccountCreateParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "storage-account-name": autorest.Encode("path", storageAccountName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/storage/{storage-account-name}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SetStorageAccountSender sends the SetStorageAccount request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) SetStorageAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// SetStorageAccountResponder handles the response to the SetStorageAccount request. The method always +// closes the http.Response Body. +func (client BaseClient) SetStorageAccountResponder(resp *http.Response) (result StorageBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Sign the SIGN operation is applicable to asymmetric and symmetric keys stored in Azure Key Vault since this +// operation uses the private portion of the key. This operation requires the keys/sign permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// keyName - the name of the key. +// keyVersion - the version of the key. +// parameters - the parameters for the signing operation. +func (client BaseClient) Sign(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeySignParameters) (result KeyOperationResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "Sign", err.Error()) + } + + req, err := client.SignPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Sign", nil, "Failure preparing request") + return + } + + resp, err := client.SignSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Sign", resp, "Failure sending request") + return + } + + result, err = client.SignResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Sign", resp, "Failure responding to request") + } + + return +} + +// SignPreparer prepares the Sign request. +func (client BaseClient) SignPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeySignParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + "key-version": autorest.Encode("path", keyVersion), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/{key-version}/sign", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SignSender sends the Sign request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) SignSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// SignResponder handles the response to the Sign request. The method always +// closes the http.Response Body. +func (client BaseClient) SignResponder(resp *http.Response) (result KeyOperationResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UnwrapKey the UNWRAP operation supports decryption of a symmetric key using the target key encryption key. This +// operation is the reverse of the WRAP operation. The UNWRAP operation applies to asymmetric and symmetric keys stored +// in Azure Key Vault since it uses the private portion of the key. This operation requires the keys/unwrapKey +// permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// keyName - the name of the key. +// keyVersion - the version of the key. +// parameters - the parameters for the key operation. +func (client BaseClient) UnwrapKey(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (result KeyOperationResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "UnwrapKey", err.Error()) + } + + req, err := client.UnwrapKeyPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UnwrapKey", nil, "Failure preparing request") + return + } + + resp, err := client.UnwrapKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UnwrapKey", resp, "Failure sending request") + return + } + + result, err = client.UnwrapKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UnwrapKey", resp, "Failure responding to request") + } + + return +} + +// UnwrapKeyPreparer prepares the UnwrapKey request. +func (client BaseClient) UnwrapKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + "key-version": autorest.Encode("path", keyVersion), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/{key-version}/unwrapkey", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UnwrapKeySender sends the UnwrapKey request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) UnwrapKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UnwrapKeyResponder handles the response to the UnwrapKey request. The method always +// closes the http.Response Body. +func (client BaseClient) UnwrapKeyResponder(resp *http.Response) (result KeyOperationResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateCertificate the UpdateCertificate operation applies the specified update on the given certificate; the only +// elements updated are the certificate's attributes. This operation requires the certificates/update permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// certificateName - the name of the certificate in the given key vault. +// certificateVersion - the version of the certificate. +// parameters - the parameters for certificate update. +func (client BaseClient) UpdateCertificate(ctx context.Context, vaultBaseURL string, certificateName string, certificateVersion string, parameters CertificateUpdateParameters) (result CertificateBundle, err error) { + req, err := client.UpdateCertificatePreparer(ctx, vaultBaseURL, certificateName, certificateVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificate", resp, "Failure sending request") + return + } + + result, err = client.UpdateCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificate", resp, "Failure responding to request") + } + + return +} + +// UpdateCertificatePreparer prepares the UpdateCertificate request. +func (client BaseClient) UpdateCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string, certificateVersion string, parameters CertificateUpdateParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + "certificate-version": autorest.Encode("path", certificateVersion), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/{certificate-version}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateCertificateSender sends the UpdateCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) UpdateCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UpdateCertificateResponder handles the response to the UpdateCertificate request. The method always +// closes the http.Response Body. +func (client BaseClient) UpdateCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateCertificateIssuer the UpdateCertificateIssuer operation performs an update on the specified certificate issuer +// entity. This operation requires the certificates/setissuers permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// issuerName - the name of the issuer. +// parameter - certificate issuer update parameter. +func (client BaseClient) UpdateCertificateIssuer(ctx context.Context, vaultBaseURL string, issuerName string, parameter CertificateIssuerUpdateParameters) (result IssuerBundle, err error) { + req, err := client.UpdateCertificateIssuerPreparer(ctx, vaultBaseURL, issuerName, parameter) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificateIssuer", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateCertificateIssuerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificateIssuer", resp, "Failure sending request") + return + } + + result, err = client.UpdateCertificateIssuerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificateIssuer", resp, "Failure responding to request") + } + + return +} + +// UpdateCertificateIssuerPreparer prepares the UpdateCertificateIssuer request. +func (client BaseClient) UpdateCertificateIssuerPreparer(ctx context.Context, vaultBaseURL string, issuerName string, parameter CertificateIssuerUpdateParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "issuer-name": autorest.Encode("path", issuerName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/issuers/{issuer-name}", pathParameters), + autorest.WithJSON(parameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateCertificateIssuerSender sends the UpdateCertificateIssuer request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) UpdateCertificateIssuerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UpdateCertificateIssuerResponder handles the response to the UpdateCertificateIssuer request. The method always +// closes the http.Response Body. +func (client BaseClient) UpdateCertificateIssuerResponder(resp *http.Response) (result IssuerBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateCertificateOperation updates a certificate creation operation that is already in progress. This operation +// requires the certificates/update permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// certificateName - the name of the certificate. +// certificateOperation - the certificate operation response. +func (client BaseClient) UpdateCertificateOperation(ctx context.Context, vaultBaseURL string, certificateName string, certificateOperation CertificateOperationUpdateParameter) (result CertificateOperation, err error) { + req, err := client.UpdateCertificateOperationPreparer(ctx, vaultBaseURL, certificateName, certificateOperation) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificateOperation", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateCertificateOperationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificateOperation", resp, "Failure sending request") + return + } + + result, err = client.UpdateCertificateOperationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificateOperation", resp, "Failure responding to request") + } + + return +} + +// UpdateCertificateOperationPreparer prepares the UpdateCertificateOperation request. +func (client BaseClient) UpdateCertificateOperationPreparer(ctx context.Context, vaultBaseURL string, certificateName string, certificateOperation CertificateOperationUpdateParameter) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/pending", pathParameters), + autorest.WithJSON(certificateOperation), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateCertificateOperationSender sends the UpdateCertificateOperation request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) UpdateCertificateOperationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UpdateCertificateOperationResponder handles the response to the UpdateCertificateOperation request. The method always +// closes the http.Response Body. +func (client BaseClient) UpdateCertificateOperationResponder(resp *http.Response) (result CertificateOperation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateCertificatePolicy set specified members in the certificate policy. Leave others as null. This operation +// requires the certificates/update permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// certificateName - the name of the certificate in the given vault. +// certificatePolicy - the policy for the certificate. +func (client BaseClient) UpdateCertificatePolicy(ctx context.Context, vaultBaseURL string, certificateName string, certificatePolicy CertificatePolicy) (result CertificatePolicy, err error) { + req, err := client.UpdateCertificatePolicyPreparer(ctx, vaultBaseURL, certificateName, certificatePolicy) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificatePolicy", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateCertificatePolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificatePolicy", resp, "Failure sending request") + return + } + + result, err = client.UpdateCertificatePolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificatePolicy", resp, "Failure responding to request") + } + + return +} + +// UpdateCertificatePolicyPreparer prepares the UpdateCertificatePolicy request. +func (client BaseClient) UpdateCertificatePolicyPreparer(ctx context.Context, vaultBaseURL string, certificateName string, certificatePolicy CertificatePolicy) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/policy", pathParameters), + autorest.WithJSON(certificatePolicy), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateCertificatePolicySender sends the UpdateCertificatePolicy request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) UpdateCertificatePolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UpdateCertificatePolicyResponder handles the response to the UpdateCertificatePolicy request. The method always +// closes the http.Response Body. +func (client BaseClient) UpdateCertificatePolicyResponder(resp *http.Response) (result CertificatePolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateKey in order to perform this operation, the key must already exist in the Key Vault. Note: The cryptographic +// material of a key itself cannot be changed. This operation requires the keys/update permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// keyName - the name of key to update. +// keyVersion - the version of the key to update. +// parameters - the parameters of the key to update. +func (client BaseClient) UpdateKey(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyUpdateParameters) (result KeyBundle, err error) { + req, err := client.UpdateKeyPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateKey", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateKey", resp, "Failure sending request") + return + } + + result, err = client.UpdateKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateKey", resp, "Failure responding to request") + } + + return +} + +// UpdateKeyPreparer prepares the UpdateKey request. +func (client BaseClient) UpdateKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyUpdateParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + "key-version": autorest.Encode("path", keyVersion), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/{key-version}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateKeySender sends the UpdateKey request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) UpdateKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UpdateKeyResponder handles the response to the UpdateKey request. The method always +// closes the http.Response Body. +func (client BaseClient) UpdateKeyResponder(resp *http.Response) (result KeyBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSasDefinition updates the specified attributes associated with the given SAS definition. This operation +// requires the storage/setsas permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// storageAccountName - the name of the storage account. +// sasDefinitionName - the name of the SAS definition. +// parameters - the parameters to update a SAS definition. +func (client BaseClient) UpdateSasDefinition(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string, parameters SasDefinitionUpdateParameters) (result SasDefinitionBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: storageAccountName, + Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, + {TargetValue: sasDefinitionName, + Constraints: []validation.Constraint{{Target: "sasDefinitionName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "UpdateSasDefinition", err.Error()) + } + + req, err := client.UpdateSasDefinitionPreparer(ctx, vaultBaseURL, storageAccountName, sasDefinitionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateSasDefinition", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSasDefinitionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateSasDefinition", resp, "Failure sending request") + return + } + + result, err = client.UpdateSasDefinitionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateSasDefinition", resp, "Failure responding to request") + } + + return +} + +// UpdateSasDefinitionPreparer prepares the UpdateSasDefinition request. +func (client BaseClient) UpdateSasDefinitionPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string, parameters SasDefinitionUpdateParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "sas-definition-name": autorest.Encode("path", sasDefinitionName), + "storage-account-name": autorest.Encode("path", storageAccountName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/storage/{storage-account-name}/sas/{sas-definition-name}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSasDefinitionSender sends the UpdateSasDefinition request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) UpdateSasDefinitionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UpdateSasDefinitionResponder handles the response to the UpdateSasDefinition request. The method always +// closes the http.Response Body. +func (client BaseClient) UpdateSasDefinitionResponder(resp *http.Response) (result SasDefinitionBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSecret the UPDATE operation changes specified attributes of an existing stored secret. Attributes that are not +// specified in the request are left unchanged. The value of a secret itself cannot be changed. This operation requires +// the secrets/set permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// secretName - the name of the secret. +// secretVersion - the version of the secret. +// parameters - the parameters for update secret operation. +func (client BaseClient) UpdateSecret(ctx context.Context, vaultBaseURL string, secretName string, secretVersion string, parameters SecretUpdateParameters) (result SecretBundle, err error) { + req, err := client.UpdateSecretPreparer(ctx, vaultBaseURL, secretName, secretVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateSecret", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSecretSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateSecret", resp, "Failure sending request") + return + } + + result, err = client.UpdateSecretResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateSecret", resp, "Failure responding to request") + } + + return +} + +// UpdateSecretPreparer prepares the UpdateSecret request. +func (client BaseClient) UpdateSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string, secretVersion string, parameters SecretUpdateParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "secret-name": autorest.Encode("path", secretName), + "secret-version": autorest.Encode("path", secretVersion), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/secrets/{secret-name}/{secret-version}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSecretSender sends the UpdateSecret request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) UpdateSecretSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UpdateSecretResponder handles the response to the UpdateSecret request. The method always +// closes the http.Response Body. +func (client BaseClient) UpdateSecretResponder(resp *http.Response) (result SecretBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateStorageAccount updates the specified attributes associated with the given storage account. This operation +// requires the storage/set/update permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// storageAccountName - the name of the storage account. +// parameters - the parameters to update a storage account. +func (client BaseClient) UpdateStorageAccount(ctx context.Context, vaultBaseURL string, storageAccountName string, parameters StorageAccountUpdateParameters) (result StorageBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: storageAccountName, + Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "UpdateStorageAccount", err.Error()) + } + + req, err := client.UpdateStorageAccountPreparer(ctx, vaultBaseURL, storageAccountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateStorageAccount", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateStorageAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateStorageAccount", resp, "Failure sending request") + return + } + + result, err = client.UpdateStorageAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateStorageAccount", resp, "Failure responding to request") + } + + return +} + +// UpdateStorageAccountPreparer prepares the UpdateStorageAccount request. +func (client BaseClient) UpdateStorageAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, parameters StorageAccountUpdateParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "storage-account-name": autorest.Encode("path", storageAccountName), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/storage/{storage-account-name}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateStorageAccountSender sends the UpdateStorageAccount request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) UpdateStorageAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UpdateStorageAccountResponder handles the response to the UpdateStorageAccount request. The method always +// closes the http.Response Body. +func (client BaseClient) UpdateStorageAccountResponder(resp *http.Response) (result StorageBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Verify the VERIFY operation is applicable to symmetric keys stored in Azure Key Vault. VERIFY is not strictly +// necessary for asymmetric keys stored in Azure Key Vault since signature verification can be performed using the +// public portion of the key but this operation is supported as a convenience for callers that only have a +// key-reference and not the public portion of the key. This operation requires the keys/verify permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// keyName - the name of the key. +// keyVersion - the version of the key. +// parameters - the parameters for verify operations. +func (client BaseClient) Verify(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyVerifyParameters) (result KeyVerifyResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Digest", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Signature", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "Verify", err.Error()) + } + + req, err := client.VerifyPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Verify", nil, "Failure preparing request") + return + } + + resp, err := client.VerifySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Verify", resp, "Failure sending request") + return + } + + result, err = client.VerifyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Verify", resp, "Failure responding to request") + } + + return +} + +// VerifyPreparer prepares the Verify request. +func (client BaseClient) VerifyPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyVerifyParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + "key-version": autorest.Encode("path", keyVersion), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/{key-version}/verify", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// VerifySender sends the Verify request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) VerifySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// VerifyResponder handles the response to the Verify request. The method always +// closes the http.Response Body. +func (client BaseClient) VerifyResponder(resp *http.Response) (result KeyVerifyResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// WrapKey the WRAP operation supports encryption of a symmetric key using a key encryption key that has previously +// been stored in an Azure Key Vault. The WRAP operation is only strictly necessary for symmetric keys stored in Azure +// Key Vault since protection with an asymmetric key can be performed using the public portion of the key. This +// operation is supported for asymmetric keys as a convenience for callers that have a key-reference but do not have +// access to the public key material. This operation requires the keys/wrapKey permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// keyName - the name of the key. +// keyVersion - the version of the key. +// parameters - the parameters for wrap operation. +func (client BaseClient) WrapKey(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (result KeyOperationResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "WrapKey", err.Error()) + } + + req, err := client.WrapKeyPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "WrapKey", nil, "Failure preparing request") + return + } + + resp, err := client.WrapKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "WrapKey", resp, "Failure sending request") + return + } + + result, err = client.WrapKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "WrapKey", resp, "Failure responding to request") + } + + return +} + +// WrapKeyPreparer prepares the WrapKey request. +func (client BaseClient) WrapKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + "key-version": autorest.Encode("path", keyVersion), + } + + const APIVersion = "7.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/{key-version}/wrapkey", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// WrapKeySender sends the WrapKey request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) WrapKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// WrapKeyResponder handles the response to the WrapKey request. The method always +// closes the http.Response Body. +func (client BaseClient) WrapKeyResponder(resp *http.Response) (result KeyOperationResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/keyvault/v7.0/keyvault/models.go b/services/keyvault/v7.0/keyvault/models.go new file mode 100644 index 000000000000..34be838aecf4 --- /dev/null +++ b/services/keyvault/v7.0/keyvault/models.go @@ -0,0 +1,3125 @@ +package keyvault + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // AutoRenew ... + AutoRenew ActionType = "AutoRenew" + // EmailContacts ... + EmailContacts ActionType = "EmailContacts" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{AutoRenew, EmailContacts} +} + +// DeletionRecoveryLevel enumerates the values for deletion recovery level. +type DeletionRecoveryLevel string + +const ( + // Purgeable ... + Purgeable DeletionRecoveryLevel = "Purgeable" + // Recoverable ... + Recoverable DeletionRecoveryLevel = "Recoverable" + // RecoverableProtectedSubscription ... + RecoverableProtectedSubscription DeletionRecoveryLevel = "Recoverable+ProtectedSubscription" + // RecoverablePurgeable ... + RecoverablePurgeable DeletionRecoveryLevel = "Recoverable+Purgeable" +) + +// PossibleDeletionRecoveryLevelValues returns an array of possible values for the DeletionRecoveryLevel const type. +func PossibleDeletionRecoveryLevelValues() []DeletionRecoveryLevel { + return []DeletionRecoveryLevel{Purgeable, Recoverable, RecoverableProtectedSubscription, RecoverablePurgeable} +} + +// JSONWebKeyCurveName enumerates the values for json web key curve name. +type JSONWebKeyCurveName string + +const ( + // P256 The NIST P-256 elliptic curve, AKA SECG curve SECP256R1. + P256 JSONWebKeyCurveName = "P-256" + // P256K The SECG SECP256K1 elliptic curve. + P256K JSONWebKeyCurveName = "P-256K" + // P384 The NIST P-384 elliptic curve, AKA SECG curve SECP384R1. + P384 JSONWebKeyCurveName = "P-384" + // P521 The NIST P-521 elliptic curve, AKA SECG curve SECP521R1. + P521 JSONWebKeyCurveName = "P-521" +) + +// PossibleJSONWebKeyCurveNameValues returns an array of possible values for the JSONWebKeyCurveName const type. +func PossibleJSONWebKeyCurveNameValues() []JSONWebKeyCurveName { + return []JSONWebKeyCurveName{P256, P256K, P384, P521} +} + +// JSONWebKeyEncryptionAlgorithm enumerates the values for json web key encryption algorithm. +type JSONWebKeyEncryptionAlgorithm string + +const ( + // RSA15 ... + RSA15 JSONWebKeyEncryptionAlgorithm = "RSA1_5" + // RSAOAEP ... + RSAOAEP JSONWebKeyEncryptionAlgorithm = "RSA-OAEP" + // RSAOAEP256 ... + RSAOAEP256 JSONWebKeyEncryptionAlgorithm = "RSA-OAEP-256" +) + +// PossibleJSONWebKeyEncryptionAlgorithmValues returns an array of possible values for the JSONWebKeyEncryptionAlgorithm const type. +func PossibleJSONWebKeyEncryptionAlgorithmValues() []JSONWebKeyEncryptionAlgorithm { + return []JSONWebKeyEncryptionAlgorithm{RSA15, RSAOAEP, RSAOAEP256} +} + +// JSONWebKeyOperation enumerates the values for json web key operation. +type JSONWebKeyOperation string + +const ( + // Decrypt ... + Decrypt JSONWebKeyOperation = "decrypt" + // Encrypt ... + Encrypt JSONWebKeyOperation = "encrypt" + // Sign ... + Sign JSONWebKeyOperation = "sign" + // UnwrapKey ... + UnwrapKey JSONWebKeyOperation = "unwrapKey" + // Verify ... + Verify JSONWebKeyOperation = "verify" + // WrapKey ... + WrapKey JSONWebKeyOperation = "wrapKey" +) + +// PossibleJSONWebKeyOperationValues returns an array of possible values for the JSONWebKeyOperation const type. +func PossibleJSONWebKeyOperationValues() []JSONWebKeyOperation { + return []JSONWebKeyOperation{Decrypt, Encrypt, Sign, UnwrapKey, Verify, WrapKey} +} + +// JSONWebKeySignatureAlgorithm enumerates the values for json web key signature algorithm. +type JSONWebKeySignatureAlgorithm string + +const ( + // ES256 ECDSA using P-256 and SHA-256, as described in https://tools.ietf.org/html/rfc7518. + ES256 JSONWebKeySignatureAlgorithm = "ES256" + // ES256K ECDSA using P-256K and SHA-256, as described in https://tools.ietf.org/html/rfc7518 + ES256K JSONWebKeySignatureAlgorithm = "ES256K" + // ES384 ECDSA using P-384 and SHA-384, as described in https://tools.ietf.org/html/rfc7518 + ES384 JSONWebKeySignatureAlgorithm = "ES384" + // ES512 ECDSA using P-521 and SHA-512, as described in https://tools.ietf.org/html/rfc7518 + ES512 JSONWebKeySignatureAlgorithm = "ES512" + // PS256 RSASSA-PSS using SHA-256 and MGF1 with SHA-256, as described in + // https://tools.ietf.org/html/rfc7518 + PS256 JSONWebKeySignatureAlgorithm = "PS256" + // PS384 RSASSA-PSS using SHA-384 and MGF1 with SHA-384, as described in + // https://tools.ietf.org/html/rfc7518 + PS384 JSONWebKeySignatureAlgorithm = "PS384" + // PS512 RSASSA-PSS using SHA-512 and MGF1 with SHA-512, as described in + // https://tools.ietf.org/html/rfc7518 + PS512 JSONWebKeySignatureAlgorithm = "PS512" + // RS256 RSASSA-PKCS1-v1_5 using SHA-256, as described in https://tools.ietf.org/html/rfc7518 + RS256 JSONWebKeySignatureAlgorithm = "RS256" + // RS384 RSASSA-PKCS1-v1_5 using SHA-384, as described in https://tools.ietf.org/html/rfc7518 + RS384 JSONWebKeySignatureAlgorithm = "RS384" + // RS512 RSASSA-PKCS1-v1_5 using SHA-512, as described in https://tools.ietf.org/html/rfc7518 + RS512 JSONWebKeySignatureAlgorithm = "RS512" + // RSNULL Reserved + RSNULL JSONWebKeySignatureAlgorithm = "RSNULL" +) + +// PossibleJSONWebKeySignatureAlgorithmValues returns an array of possible values for the JSONWebKeySignatureAlgorithm const type. +func PossibleJSONWebKeySignatureAlgorithmValues() []JSONWebKeySignatureAlgorithm { + return []JSONWebKeySignatureAlgorithm{ES256, ES256K, ES384, ES512, PS256, PS384, PS512, RS256, RS384, RS512, RSNULL} +} + +// JSONWebKeyType enumerates the values for json web key type. +type JSONWebKeyType string + +const ( + // EC Elliptic Curve. + EC JSONWebKeyType = "EC" + // ECHSM Elliptic Curve with a private key which is not exportable from the HSM. + ECHSM JSONWebKeyType = "EC-HSM" + // Oct Octet sequence (used to represent symmetric keys) + Oct JSONWebKeyType = "oct" + // RSA RSA (https://tools.ietf.org/html/rfc3447) + RSA JSONWebKeyType = "RSA" + // RSAHSM RSA with a private key which is not exportable from the HSM. + RSAHSM JSONWebKeyType = "RSA-HSM" +) + +// PossibleJSONWebKeyTypeValues returns an array of possible values for the JSONWebKeyType const type. +func PossibleJSONWebKeyTypeValues() []JSONWebKeyType { + return []JSONWebKeyType{EC, ECHSM, Oct, RSA, RSAHSM} +} + +// KeyUsageType enumerates the values for key usage type. +type KeyUsageType string + +const ( + // CRLSign ... + CRLSign KeyUsageType = "cRLSign" + // DataEncipherment ... + DataEncipherment KeyUsageType = "dataEncipherment" + // DecipherOnly ... + DecipherOnly KeyUsageType = "decipherOnly" + // DigitalSignature ... + DigitalSignature KeyUsageType = "digitalSignature" + // EncipherOnly ... + EncipherOnly KeyUsageType = "encipherOnly" + // KeyAgreement ... + KeyAgreement KeyUsageType = "keyAgreement" + // KeyCertSign ... + KeyCertSign KeyUsageType = "keyCertSign" + // KeyEncipherment ... + KeyEncipherment KeyUsageType = "keyEncipherment" + // NonRepudiation ... + NonRepudiation KeyUsageType = "nonRepudiation" +) + +// PossibleKeyUsageTypeValues returns an array of possible values for the KeyUsageType const type. +func PossibleKeyUsageTypeValues() []KeyUsageType { + return []KeyUsageType{CRLSign, DataEncipherment, DecipherOnly, DigitalSignature, EncipherOnly, KeyAgreement, KeyCertSign, KeyEncipherment, NonRepudiation} +} + +// SasTokenType enumerates the values for sas token type. +type SasTokenType string + +const ( + // Account ... + Account SasTokenType = "account" + // Service ... + Service SasTokenType = "service" +) + +// PossibleSasTokenTypeValues returns an array of possible values for the SasTokenType const type. +func PossibleSasTokenTypeValues() []SasTokenType { + return []SasTokenType{Account, Service} +} + +// Action the action that will be executed. +type Action struct { + // ActionType - The type of the action. Possible values include: 'EmailContacts', 'AutoRenew' + ActionType ActionType `json:"action_type,omitempty"` +} + +// AdministratorDetails details of the organization administrator of the certificate issuer. +type AdministratorDetails struct { + // FirstName - First name. + FirstName *string `json:"first_name,omitempty"` + // LastName - Last name. + LastName *string `json:"last_name,omitempty"` + // EmailAddress - Email addresss. + EmailAddress *string `json:"email,omitempty"` + // Phone - Phone number. + Phone *string `json:"phone,omitempty"` +} + +// Attributes the object attributes managed by the KeyVault service. +type Attributes struct { + // Enabled - Determines whether the object is enabled. + Enabled *bool `json:"enabled,omitempty"` + // NotBefore - Not before date in UTC. + NotBefore *date.UnixTime `json:"nbf,omitempty"` + // Expires - Expiry date in UTC. + Expires *date.UnixTime `json:"exp,omitempty"` + // Created - Creation time in UTC. + Created *date.UnixTime `json:"created,omitempty"` + // Updated - Last updated time in UTC. + Updated *date.UnixTime `json:"updated,omitempty"` +} + +// BackupCertificateResult the backup certificate result, containing the backup blob. +type BackupCertificateResult struct { + autorest.Response `json:"-"` + // Value - The backup blob containing the backed up certificate. + Value *string `json:"value,omitempty"` +} + +// BackupKeyResult the backup key result, containing the backup blob. +type BackupKeyResult struct { + autorest.Response `json:"-"` + // Value - The backup blob containing the backed up key. + Value *string `json:"value,omitempty"` +} + +// BackupSecretResult the backup secret result, containing the backup blob. +type BackupSecretResult struct { + autorest.Response `json:"-"` + // Value - The backup blob containing the backed up secret. + Value *string `json:"value,omitempty"` +} + +// BackupStorageResult the backup storage result, containing the backup blob. +type BackupStorageResult struct { + autorest.Response `json:"-"` + // Value - The backup blob containing the backed up storage account. + Value *string `json:"value,omitempty"` +} + +// CertificateAttributes the certificate management attributes. +type CertificateAttributes struct { + // RecoveryLevel - Reflects the deletion recovery level currently in effect for certificates in the current vault. If it contains 'Purgeable', the certificate can be permanently deleted by a privileged user; otherwise, only the system can purge the certificate, at the end of the retention interval. Possible values include: 'Purgeable', 'RecoverablePurgeable', 'Recoverable', 'RecoverableProtectedSubscription' + RecoveryLevel DeletionRecoveryLevel `json:"recoveryLevel,omitempty"` + // Enabled - Determines whether the object is enabled. + Enabled *bool `json:"enabled,omitempty"` + // NotBefore - Not before date in UTC. + NotBefore *date.UnixTime `json:"nbf,omitempty"` + // Expires - Expiry date in UTC. + Expires *date.UnixTime `json:"exp,omitempty"` + // Created - Creation time in UTC. + Created *date.UnixTime `json:"created,omitempty"` + // Updated - Last updated time in UTC. + Updated *date.UnixTime `json:"updated,omitempty"` +} + +// CertificateBundle a certificate bundle consists of a certificate (X509) plus its attributes. +type CertificateBundle struct { + autorest.Response `json:"-"` + // ID - The certificate id. + ID *string `json:"id,omitempty"` + // Kid - The key id. + Kid *string `json:"kid,omitempty"` + // Sid - The secret id. + Sid *string `json:"sid,omitempty"` + // X509Thumbprint - Thumbprint of the certificate. + X509Thumbprint *string `json:"x5t,omitempty"` + // Policy - The management policy. + Policy *CertificatePolicy `json:"policy,omitempty"` + // Cer - CER contents of x509 certificate. + Cer *[]byte `json:"cer,omitempty"` + // ContentType - The content type of the secret. + ContentType *string `json:"contentType,omitempty"` + // Attributes - The certificate attributes. + Attributes *CertificateAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for CertificateBundle. +func (cb CertificateBundle) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cb.ID != nil { + objectMap["id"] = cb.ID + } + if cb.Kid != nil { + objectMap["kid"] = cb.Kid + } + if cb.Sid != nil { + objectMap["sid"] = cb.Sid + } + if cb.X509Thumbprint != nil { + objectMap["x5t"] = cb.X509Thumbprint + } + if cb.Policy != nil { + objectMap["policy"] = cb.Policy + } + if cb.Cer != nil { + objectMap["cer"] = cb.Cer + } + if cb.ContentType != nil { + objectMap["contentType"] = cb.ContentType + } + if cb.Attributes != nil { + objectMap["attributes"] = cb.Attributes + } + if cb.Tags != nil { + objectMap["tags"] = cb.Tags + } + return json.Marshal(objectMap) +} + +// CertificateCreateParameters the certificate create parameters. +type CertificateCreateParameters struct { + // CertificatePolicy - The management policy for the certificate. + CertificatePolicy *CertificatePolicy `json:"policy,omitempty"` + // CertificateAttributes - The attributes of the certificate (optional). + CertificateAttributes *CertificateAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for CertificateCreateParameters. +func (ccp CertificateCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ccp.CertificatePolicy != nil { + objectMap["policy"] = ccp.CertificatePolicy + } + if ccp.CertificateAttributes != nil { + objectMap["attributes"] = ccp.CertificateAttributes + } + if ccp.Tags != nil { + objectMap["tags"] = ccp.Tags + } + return json.Marshal(objectMap) +} + +// CertificateImportParameters the certificate import parameters. +type CertificateImportParameters struct { + // Base64EncodedCertificate - Base64 encoded representation of the certificate object to import. This certificate needs to contain the private key. + Base64EncodedCertificate *string `json:"value,omitempty"` + // Password - If the private key in base64EncodedCertificate is encrypted, the password used for encryption. + Password *string `json:"pwd,omitempty"` + // CertificatePolicy - The management policy for the certificate. + CertificatePolicy *CertificatePolicy `json:"policy,omitempty"` + // CertificateAttributes - The attributes of the certificate (optional). + CertificateAttributes *CertificateAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for CertificateImportParameters. +func (cip CertificateImportParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cip.Base64EncodedCertificate != nil { + objectMap["value"] = cip.Base64EncodedCertificate + } + if cip.Password != nil { + objectMap["pwd"] = cip.Password + } + if cip.CertificatePolicy != nil { + objectMap["policy"] = cip.CertificatePolicy + } + if cip.CertificateAttributes != nil { + objectMap["attributes"] = cip.CertificateAttributes + } + if cip.Tags != nil { + objectMap["tags"] = cip.Tags + } + return json.Marshal(objectMap) +} + +// CertificateIssuerItem the certificate issuer item containing certificate issuer metadata. +type CertificateIssuerItem struct { + // ID - Certificate Identifier. + ID *string `json:"id,omitempty"` + // Provider - The issuer provider. + Provider *string `json:"provider,omitempty"` +} + +// CertificateIssuerListResult the certificate issuer list result. +type CertificateIssuerListResult struct { + autorest.Response `json:"-"` + // Value - A response message containing a list of certificate issuers in the key vault along with a link to the next page of certificate issuers. + Value *[]CertificateIssuerItem `json:"value,omitempty"` + // NextLink - The URL to get the next set of certificate issuers. + NextLink *string `json:"nextLink,omitempty"` +} + +// CertificateIssuerListResultIterator provides access to a complete listing of CertificateIssuerItem values. +type CertificateIssuerListResultIterator struct { + i int + page CertificateIssuerListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CertificateIssuerListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CertificateIssuerListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CertificateIssuerListResultIterator) Response() CertificateIssuerListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CertificateIssuerListResultIterator) Value() CertificateIssuerItem { + if !iter.page.NotDone() { + return CertificateIssuerItem{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (cilr CertificateIssuerListResult) IsEmpty() bool { + return cilr.Value == nil || len(*cilr.Value) == 0 +} + +// certificateIssuerListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cilr CertificateIssuerListResult) certificateIssuerListResultPreparer() (*http.Request, error) { + if cilr.NextLink == nil || len(to.String(cilr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cilr.NextLink))) +} + +// CertificateIssuerListResultPage contains a page of CertificateIssuerItem values. +type CertificateIssuerListResultPage struct { + fn func(CertificateIssuerListResult) (CertificateIssuerListResult, error) + cilr CertificateIssuerListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CertificateIssuerListResultPage) Next() error { + next, err := page.fn(page.cilr) + if err != nil { + return err + } + page.cilr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CertificateIssuerListResultPage) NotDone() bool { + return !page.cilr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CertificateIssuerListResultPage) Response() CertificateIssuerListResult { + return page.cilr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CertificateIssuerListResultPage) Values() []CertificateIssuerItem { + if page.cilr.IsEmpty() { + return nil + } + return *page.cilr.Value +} + +// CertificateIssuerSetParameters the certificate issuer set parameters. +type CertificateIssuerSetParameters struct { + // Provider - The issuer provider. + Provider *string `json:"provider,omitempty"` + // Credentials - The credentials to be used for the issuer. + Credentials *IssuerCredentials `json:"credentials,omitempty"` + // OrganizationDetails - Details of the organization as provided to the issuer. + OrganizationDetails *OrganizationDetails `json:"org_details,omitempty"` + // Attributes - Attributes of the issuer object. + Attributes *IssuerAttributes `json:"attributes,omitempty"` +} + +// CertificateIssuerUpdateParameters the certificate issuer update parameters. +type CertificateIssuerUpdateParameters struct { + // Provider - The issuer provider. + Provider *string `json:"provider,omitempty"` + // Credentials - The credentials to be used for the issuer. + Credentials *IssuerCredentials `json:"credentials,omitempty"` + // OrganizationDetails - Details of the organization as provided to the issuer. + OrganizationDetails *OrganizationDetails `json:"org_details,omitempty"` + // Attributes - Attributes of the issuer object. + Attributes *IssuerAttributes `json:"attributes,omitempty"` +} + +// CertificateItem the certificate item containing certificate metadata. +type CertificateItem struct { + // ID - Certificate identifier. + ID *string `json:"id,omitempty"` + // Attributes - The certificate management attributes. + Attributes *CertificateAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` + // X509Thumbprint - Thumbprint of the certificate. + X509Thumbprint *string `json:"x5t,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateItem. +func (ci CertificateItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ci.ID != nil { + objectMap["id"] = ci.ID + } + if ci.Attributes != nil { + objectMap["attributes"] = ci.Attributes + } + if ci.Tags != nil { + objectMap["tags"] = ci.Tags + } + if ci.X509Thumbprint != nil { + objectMap["x5t"] = ci.X509Thumbprint + } + return json.Marshal(objectMap) +} + +// CertificateListResult the certificate list result. +type CertificateListResult struct { + autorest.Response `json:"-"` + // Value - A response message containing a list of certificates in the key vault along with a link to the next page of certificates. + Value *[]CertificateItem `json:"value,omitempty"` + // NextLink - The URL to get the next set of certificates. + NextLink *string `json:"nextLink,omitempty"` +} + +// CertificateListResultIterator provides access to a complete listing of CertificateItem values. +type CertificateListResultIterator struct { + i int + page CertificateListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CertificateListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CertificateListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CertificateListResultIterator) Response() CertificateListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CertificateListResultIterator) Value() CertificateItem { + if !iter.page.NotDone() { + return CertificateItem{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (clr CertificateListResult) IsEmpty() bool { + return clr.Value == nil || len(*clr.Value) == 0 +} + +// certificateListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (clr CertificateListResult) certificateListResultPreparer() (*http.Request, error) { + if clr.NextLink == nil || len(to.String(clr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(clr.NextLink))) +} + +// CertificateListResultPage contains a page of CertificateItem values. +type CertificateListResultPage struct { + fn func(CertificateListResult) (CertificateListResult, error) + clr CertificateListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CertificateListResultPage) Next() error { + next, err := page.fn(page.clr) + if err != nil { + return err + } + page.clr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CertificateListResultPage) NotDone() bool { + return !page.clr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CertificateListResultPage) Response() CertificateListResult { + return page.clr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CertificateListResultPage) Values() []CertificateItem { + if page.clr.IsEmpty() { + return nil + } + return *page.clr.Value +} + +// CertificateMergeParameters the certificate merge parameters +type CertificateMergeParameters struct { + // X509Certificates - The certificate or the certificate chain to merge. + X509Certificates *[][]byte `json:"x5c,omitempty"` + // CertificateAttributes - The attributes of the certificate (optional). + CertificateAttributes *CertificateAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for CertificateMergeParameters. +func (cmp CertificateMergeParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cmp.X509Certificates != nil { + objectMap["x5c"] = cmp.X509Certificates + } + if cmp.CertificateAttributes != nil { + objectMap["attributes"] = cmp.CertificateAttributes + } + if cmp.Tags != nil { + objectMap["tags"] = cmp.Tags + } + return json.Marshal(objectMap) +} + +// CertificateOperation a certificate operation is returned in case of asynchronous requests. +type CertificateOperation struct { + autorest.Response `json:"-"` + // ID - The certificate id. + ID *string `json:"id,omitempty"` + // IssuerParameters - Parameters for the issuer of the X509 component of a certificate. + IssuerParameters *IssuerParameters `json:"issuer,omitempty"` + // Csr - The certificate signing request (CSR) that is being used in the certificate operation. + Csr *[]byte `json:"csr,omitempty"` + // CancellationRequested - Indicates if cancellation was requested on the certificate operation. + CancellationRequested *bool `json:"cancellation_requested,omitempty"` + // Status - Status of the certificate operation. + Status *string `json:"status,omitempty"` + // StatusDetails - The status details of the certificate operation. + StatusDetails *string `json:"status_details,omitempty"` + // Error - Error encountered, if any, during the certificate operation. + Error *Error `json:"error,omitempty"` + // Target - Location which contains the result of the certificate operation. + Target *string `json:"target,omitempty"` + // RequestID - Identifier for the certificate operation. + RequestID *string `json:"request_id,omitempty"` +} + +// CertificateOperationUpdateParameter the certificate operation update parameters. +type CertificateOperationUpdateParameter struct { + // CancellationRequested - Indicates if cancellation was requested on the certificate operation. + CancellationRequested *bool `json:"cancellation_requested,omitempty"` +} + +// CertificatePolicy management policy for a certificate. +type CertificatePolicy struct { + autorest.Response `json:"-"` + // ID - The certificate id. + ID *string `json:"id,omitempty"` + // KeyProperties - Properties of the key backing a certificate. + KeyProperties *KeyProperties `json:"key_props,omitempty"` + // SecretProperties - Properties of the secret backing a certificate. + SecretProperties *SecretProperties `json:"secret_props,omitempty"` + // X509CertificateProperties - Properties of the X509 component of a certificate. + X509CertificateProperties *X509CertificateProperties `json:"x509_props,omitempty"` + // LifetimeActions - Actions that will be performed by Key Vault over the lifetime of a certificate. + LifetimeActions *[]LifetimeAction `json:"lifetime_actions,omitempty"` + // IssuerParameters - Parameters for the issuer of the X509 component of a certificate. + IssuerParameters *IssuerParameters `json:"issuer,omitempty"` + // Attributes - The certificate attributes. + Attributes *CertificateAttributes `json:"attributes,omitempty"` +} + +// CertificateRestoreParameters the certificate restore parameters. +type CertificateRestoreParameters struct { + // CertificateBundleBackup - The backup blob associated with a certificate bundle. + CertificateBundleBackup *string `json:"value,omitempty"` +} + +// CertificateUpdateParameters the certificate update parameters. +type CertificateUpdateParameters struct { + // CertificatePolicy - The management policy for the certificate. + CertificatePolicy *CertificatePolicy `json:"policy,omitempty"` + // CertificateAttributes - The attributes of the certificate (optional). + CertificateAttributes *CertificateAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for CertificateUpdateParameters. +func (cup CertificateUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cup.CertificatePolicy != nil { + objectMap["policy"] = cup.CertificatePolicy + } + if cup.CertificateAttributes != nil { + objectMap["attributes"] = cup.CertificateAttributes + } + if cup.Tags != nil { + objectMap["tags"] = cup.Tags + } + return json.Marshal(objectMap) +} + +// Contact the contact information for the vault certificates. +type Contact struct { + // EmailAddress - Email addresss. + EmailAddress *string `json:"email,omitempty"` + // Name - Name. + Name *string `json:"name,omitempty"` + // Phone - Phone number. + Phone *string `json:"phone,omitempty"` +} + +// Contacts the contacts for the vault certificates. +type Contacts struct { + autorest.Response `json:"-"` + // ID - Identifier for the contacts collection. + ID *string `json:"id,omitempty"` + // ContactList - The contact list for the vault certificates. + ContactList *[]Contact `json:"contacts,omitempty"` +} + +// DeletedCertificateBundle a Deleted Certificate consisting of its previous id, attributes and its tags, as well +// as information on when it will be purged. +type DeletedCertificateBundle struct { + autorest.Response `json:"-"` + // RecoveryID - The url of the recovery object, used to identify and recover the deleted certificate. + RecoveryID *string `json:"recoveryId,omitempty"` + // ScheduledPurgeDate - The time when the certificate is scheduled to be purged, in UTC + ScheduledPurgeDate *date.UnixTime `json:"scheduledPurgeDate,omitempty"` + // DeletedDate - The time when the certificate was deleted, in UTC + DeletedDate *date.UnixTime `json:"deletedDate,omitempty"` + // ID - The certificate id. + ID *string `json:"id,omitempty"` + // Kid - The key id. + Kid *string `json:"kid,omitempty"` + // Sid - The secret id. + Sid *string `json:"sid,omitempty"` + // X509Thumbprint - Thumbprint of the certificate. + X509Thumbprint *string `json:"x5t,omitempty"` + // Policy - The management policy. + Policy *CertificatePolicy `json:"policy,omitempty"` + // Cer - CER contents of x509 certificate. + Cer *[]byte `json:"cer,omitempty"` + // ContentType - The content type of the secret. + ContentType *string `json:"contentType,omitempty"` + // Attributes - The certificate attributes. + Attributes *CertificateAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for DeletedCertificateBundle. +func (dcb DeletedCertificateBundle) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcb.RecoveryID != nil { + objectMap["recoveryId"] = dcb.RecoveryID + } + if dcb.ScheduledPurgeDate != nil { + objectMap["scheduledPurgeDate"] = dcb.ScheduledPurgeDate + } + if dcb.DeletedDate != nil { + objectMap["deletedDate"] = dcb.DeletedDate + } + if dcb.ID != nil { + objectMap["id"] = dcb.ID + } + if dcb.Kid != nil { + objectMap["kid"] = dcb.Kid + } + if dcb.Sid != nil { + objectMap["sid"] = dcb.Sid + } + if dcb.X509Thumbprint != nil { + objectMap["x5t"] = dcb.X509Thumbprint + } + if dcb.Policy != nil { + objectMap["policy"] = dcb.Policy + } + if dcb.Cer != nil { + objectMap["cer"] = dcb.Cer + } + if dcb.ContentType != nil { + objectMap["contentType"] = dcb.ContentType + } + if dcb.Attributes != nil { + objectMap["attributes"] = dcb.Attributes + } + if dcb.Tags != nil { + objectMap["tags"] = dcb.Tags + } + return json.Marshal(objectMap) +} + +// DeletedCertificateItem the deleted certificate item containing metadata about the deleted certificate. +type DeletedCertificateItem struct { + // RecoveryID - The url of the recovery object, used to identify and recover the deleted certificate. + RecoveryID *string `json:"recoveryId,omitempty"` + // ScheduledPurgeDate - The time when the certificate is scheduled to be purged, in UTC + ScheduledPurgeDate *date.UnixTime `json:"scheduledPurgeDate,omitempty"` + // DeletedDate - The time when the certificate was deleted, in UTC + DeletedDate *date.UnixTime `json:"deletedDate,omitempty"` + // ID - Certificate identifier. + ID *string `json:"id,omitempty"` + // Attributes - The certificate management attributes. + Attributes *CertificateAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` + // X509Thumbprint - Thumbprint of the certificate. + X509Thumbprint *string `json:"x5t,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeletedCertificateItem. +func (dci DeletedCertificateItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dci.RecoveryID != nil { + objectMap["recoveryId"] = dci.RecoveryID + } + if dci.ScheduledPurgeDate != nil { + objectMap["scheduledPurgeDate"] = dci.ScheduledPurgeDate + } + if dci.DeletedDate != nil { + objectMap["deletedDate"] = dci.DeletedDate + } + if dci.ID != nil { + objectMap["id"] = dci.ID + } + if dci.Attributes != nil { + objectMap["attributes"] = dci.Attributes + } + if dci.Tags != nil { + objectMap["tags"] = dci.Tags + } + if dci.X509Thumbprint != nil { + objectMap["x5t"] = dci.X509Thumbprint + } + return json.Marshal(objectMap) +} + +// DeletedCertificateListResult a list of certificates that have been deleted in this vault. +type DeletedCertificateListResult struct { + autorest.Response `json:"-"` + // Value - A response message containing a list of deleted certificates in the vault along with a link to the next page of deleted certificates + Value *[]DeletedCertificateItem `json:"value,omitempty"` + // NextLink - The URL to get the next set of deleted certificates. + NextLink *string `json:"nextLink,omitempty"` +} + +// DeletedCertificateListResultIterator provides access to a complete listing of DeletedCertificateItem values. +type DeletedCertificateListResultIterator struct { + i int + page DeletedCertificateListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DeletedCertificateListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DeletedCertificateListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DeletedCertificateListResultIterator) Response() DeletedCertificateListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DeletedCertificateListResultIterator) Value() DeletedCertificateItem { + if !iter.page.NotDone() { + return DeletedCertificateItem{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (dclr DeletedCertificateListResult) IsEmpty() bool { + return dclr.Value == nil || len(*dclr.Value) == 0 +} + +// deletedCertificateListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dclr DeletedCertificateListResult) deletedCertificateListResultPreparer() (*http.Request, error) { + if dclr.NextLink == nil || len(to.String(dclr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dclr.NextLink))) +} + +// DeletedCertificateListResultPage contains a page of DeletedCertificateItem values. +type DeletedCertificateListResultPage struct { + fn func(DeletedCertificateListResult) (DeletedCertificateListResult, error) + dclr DeletedCertificateListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DeletedCertificateListResultPage) Next() error { + next, err := page.fn(page.dclr) + if err != nil { + return err + } + page.dclr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DeletedCertificateListResultPage) NotDone() bool { + return !page.dclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DeletedCertificateListResultPage) Response() DeletedCertificateListResult { + return page.dclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DeletedCertificateListResultPage) Values() []DeletedCertificateItem { + if page.dclr.IsEmpty() { + return nil + } + return *page.dclr.Value +} + +// DeletedKeyBundle a DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion info +type DeletedKeyBundle struct { + autorest.Response `json:"-"` + // RecoveryID - The url of the recovery object, used to identify and recover the deleted key. + RecoveryID *string `json:"recoveryId,omitempty"` + // ScheduledPurgeDate - The time when the key is scheduled to be purged, in UTC + ScheduledPurgeDate *date.UnixTime `json:"scheduledPurgeDate,omitempty"` + // DeletedDate - The time when the key was deleted, in UTC + DeletedDate *date.UnixTime `json:"deletedDate,omitempty"` + // Key - The Json web key. + Key *JSONWebKey `json:"key,omitempty"` + // Attributes - The key management attributes. + Attributes *KeyAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` + // Managed - 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"` +} + +// MarshalJSON is the custom marshaler for DeletedKeyBundle. +func (dkb DeletedKeyBundle) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dkb.RecoveryID != nil { + objectMap["recoveryId"] = dkb.RecoveryID + } + if dkb.ScheduledPurgeDate != nil { + objectMap["scheduledPurgeDate"] = dkb.ScheduledPurgeDate + } + if dkb.DeletedDate != nil { + objectMap["deletedDate"] = dkb.DeletedDate + } + if dkb.Key != nil { + objectMap["key"] = dkb.Key + } + if dkb.Attributes != nil { + objectMap["attributes"] = dkb.Attributes + } + if dkb.Tags != nil { + objectMap["tags"] = dkb.Tags + } + if dkb.Managed != nil { + objectMap["managed"] = dkb.Managed + } + return json.Marshal(objectMap) +} + +// DeletedKeyItem the deleted key item containing the deleted key metadata and information about deletion. +type DeletedKeyItem struct { + // RecoveryID - The url of the recovery object, used to identify and recover the deleted key. + RecoveryID *string `json:"recoveryId,omitempty"` + // ScheduledPurgeDate - The time when the key is scheduled to be purged, in UTC + ScheduledPurgeDate *date.UnixTime `json:"scheduledPurgeDate,omitempty"` + // DeletedDate - The time when the key was deleted, in UTC + DeletedDate *date.UnixTime `json:"deletedDate,omitempty"` + // Kid - Key identifier. + Kid *string `json:"kid,omitempty"` + // Attributes - The key management attributes. + Attributes *KeyAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` + // Managed - 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"` +} + +// MarshalJSON is the custom marshaler for DeletedKeyItem. +func (dki DeletedKeyItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dki.RecoveryID != nil { + objectMap["recoveryId"] = dki.RecoveryID + } + if dki.ScheduledPurgeDate != nil { + objectMap["scheduledPurgeDate"] = dki.ScheduledPurgeDate + } + if dki.DeletedDate != nil { + objectMap["deletedDate"] = dki.DeletedDate + } + if dki.Kid != nil { + objectMap["kid"] = dki.Kid + } + if dki.Attributes != nil { + objectMap["attributes"] = dki.Attributes + } + if dki.Tags != nil { + objectMap["tags"] = dki.Tags + } + if dki.Managed != nil { + objectMap["managed"] = dki.Managed + } + return json.Marshal(objectMap) +} + +// DeletedKeyListResult a list of keys that have been deleted in this vault. +type DeletedKeyListResult struct { + autorest.Response `json:"-"` + // Value - A response message containing a list of deleted keys in the vault along with a link to the next page of deleted keys + Value *[]DeletedKeyItem `json:"value,omitempty"` + // NextLink - The URL to get the next set of deleted keys. + NextLink *string `json:"nextLink,omitempty"` +} + +// DeletedKeyListResultIterator provides access to a complete listing of DeletedKeyItem values. +type DeletedKeyListResultIterator struct { + i int + page DeletedKeyListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DeletedKeyListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DeletedKeyListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DeletedKeyListResultIterator) Response() DeletedKeyListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DeletedKeyListResultIterator) Value() DeletedKeyItem { + if !iter.page.NotDone() { + return DeletedKeyItem{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (dklr DeletedKeyListResult) IsEmpty() bool { + return dklr.Value == nil || len(*dklr.Value) == 0 +} + +// deletedKeyListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dklr DeletedKeyListResult) deletedKeyListResultPreparer() (*http.Request, error) { + if dklr.NextLink == nil || len(to.String(dklr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dklr.NextLink))) +} + +// DeletedKeyListResultPage contains a page of DeletedKeyItem values. +type DeletedKeyListResultPage struct { + fn func(DeletedKeyListResult) (DeletedKeyListResult, error) + dklr DeletedKeyListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DeletedKeyListResultPage) Next() error { + next, err := page.fn(page.dklr) + if err != nil { + return err + } + page.dklr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DeletedKeyListResultPage) NotDone() bool { + return !page.dklr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DeletedKeyListResultPage) Response() DeletedKeyListResult { + return page.dklr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DeletedKeyListResultPage) Values() []DeletedKeyItem { + if page.dklr.IsEmpty() { + return nil + } + return *page.dklr.Value +} + +// DeletedSasDefinitionBundle a deleted SAS definition bundle consisting of its previous id, attributes and its +// tags, as well as information on when it will be purged. +type DeletedSasDefinitionBundle struct { + autorest.Response `json:"-"` + // RecoveryID - The url of the recovery object, used to identify and recover the deleted SAS definition. + RecoveryID *string `json:"recoveryId,omitempty"` + // ScheduledPurgeDate - The time when the SAS definition is scheduled to be purged, in UTC + ScheduledPurgeDate *date.UnixTime `json:"scheduledPurgeDate,omitempty"` + // DeletedDate - The time when the SAS definition was deleted, in UTC + DeletedDate *date.UnixTime `json:"deletedDate,omitempty"` + // ID - The SAS definition id. + ID *string `json:"id,omitempty"` + // SecretID - Storage account SAS definition secret id. + SecretID *string `json:"sid,omitempty"` + // TemplateURI - The SAS definition token template signed with an arbitrary key. Tokens created according to the SAS definition will have the same properties as the template. + TemplateURI *string `json:"templateUri,omitempty"` + // SasType - The type of SAS token the SAS definition will create. Possible values include: 'Account', 'Service' + SasType SasTokenType `json:"sasType,omitempty"` + // ValidityPeriod - The validity period of SAS tokens created according to the SAS definition. + ValidityPeriod *string `json:"validityPeriod,omitempty"` + // Attributes - The SAS definition attributes. + Attributes *SasDefinitionAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for DeletedSasDefinitionBundle. +func (dsdb DeletedSasDefinitionBundle) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dsdb.RecoveryID != nil { + objectMap["recoveryId"] = dsdb.RecoveryID + } + if dsdb.ScheduledPurgeDate != nil { + objectMap["scheduledPurgeDate"] = dsdb.ScheduledPurgeDate + } + if dsdb.DeletedDate != nil { + objectMap["deletedDate"] = dsdb.DeletedDate + } + if dsdb.ID != nil { + objectMap["id"] = dsdb.ID + } + if dsdb.SecretID != nil { + objectMap["sid"] = dsdb.SecretID + } + if dsdb.TemplateURI != nil { + objectMap["templateUri"] = dsdb.TemplateURI + } + if dsdb.SasType != "" { + objectMap["sasType"] = dsdb.SasType + } + if dsdb.ValidityPeriod != nil { + objectMap["validityPeriod"] = dsdb.ValidityPeriod + } + if dsdb.Attributes != nil { + objectMap["attributes"] = dsdb.Attributes + } + if dsdb.Tags != nil { + objectMap["tags"] = dsdb.Tags + } + return json.Marshal(objectMap) +} + +// DeletedSasDefinitionItem the deleted SAS definition item containing metadata about the deleted SAS definition. +type DeletedSasDefinitionItem struct { + // RecoveryID - The url of the recovery object, used to identify and recover the deleted SAS definition. + RecoveryID *string `json:"recoveryId,omitempty"` + // ScheduledPurgeDate - The time when the SAS definition is scheduled to be purged, in UTC + ScheduledPurgeDate *date.UnixTime `json:"scheduledPurgeDate,omitempty"` + // DeletedDate - The time when the SAS definition was deleted, in UTC + DeletedDate *date.UnixTime `json:"deletedDate,omitempty"` + // ID - The storage SAS identifier. + ID *string `json:"id,omitempty"` + // SecretID - The storage account SAS definition secret id. + SecretID *string `json:"sid,omitempty"` + // Attributes - The SAS definition management attributes. + Attributes *SasDefinitionAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for DeletedSasDefinitionItem. +func (dsdi DeletedSasDefinitionItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dsdi.RecoveryID != nil { + objectMap["recoveryId"] = dsdi.RecoveryID + } + if dsdi.ScheduledPurgeDate != nil { + objectMap["scheduledPurgeDate"] = dsdi.ScheduledPurgeDate + } + if dsdi.DeletedDate != nil { + objectMap["deletedDate"] = dsdi.DeletedDate + } + if dsdi.ID != nil { + objectMap["id"] = dsdi.ID + } + if dsdi.SecretID != nil { + objectMap["sid"] = dsdi.SecretID + } + if dsdi.Attributes != nil { + objectMap["attributes"] = dsdi.Attributes + } + if dsdi.Tags != nil { + objectMap["tags"] = dsdi.Tags + } + return json.Marshal(objectMap) +} + +// DeletedSasDefinitionListResult the deleted SAS definition list result +type DeletedSasDefinitionListResult struct { + autorest.Response `json:"-"` + // Value - A response message containing a list of the deleted SAS definitions in the vault along with a link to the next page of deleted sas definitions + Value *[]DeletedSasDefinitionItem `json:"value,omitempty"` + // NextLink - The URL to get the next set of deleted SAS definitions. + NextLink *string `json:"nextLink,omitempty"` +} + +// DeletedSasDefinitionListResultIterator provides access to a complete listing of DeletedSasDefinitionItem values. +type DeletedSasDefinitionListResultIterator struct { + i int + page DeletedSasDefinitionListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DeletedSasDefinitionListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DeletedSasDefinitionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DeletedSasDefinitionListResultIterator) Response() DeletedSasDefinitionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DeletedSasDefinitionListResultIterator) Value() DeletedSasDefinitionItem { + if !iter.page.NotDone() { + return DeletedSasDefinitionItem{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (dsdlr DeletedSasDefinitionListResult) IsEmpty() bool { + return dsdlr.Value == nil || len(*dsdlr.Value) == 0 +} + +// deletedSasDefinitionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dsdlr DeletedSasDefinitionListResult) deletedSasDefinitionListResultPreparer() (*http.Request, error) { + if dsdlr.NextLink == nil || len(to.String(dsdlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dsdlr.NextLink))) +} + +// DeletedSasDefinitionListResultPage contains a page of DeletedSasDefinitionItem values. +type DeletedSasDefinitionListResultPage struct { + fn func(DeletedSasDefinitionListResult) (DeletedSasDefinitionListResult, error) + dsdlr DeletedSasDefinitionListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DeletedSasDefinitionListResultPage) Next() error { + next, err := page.fn(page.dsdlr) + if err != nil { + return err + } + page.dsdlr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DeletedSasDefinitionListResultPage) NotDone() bool { + return !page.dsdlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DeletedSasDefinitionListResultPage) Response() DeletedSasDefinitionListResult { + return page.dsdlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DeletedSasDefinitionListResultPage) Values() []DeletedSasDefinitionItem { + if page.dsdlr.IsEmpty() { + return nil + } + return *page.dsdlr.Value +} + +// DeletedSecretBundle a Deleted Secret consisting of its previous id, attributes and its tags, as well as +// information on when it will be purged. +type DeletedSecretBundle struct { + autorest.Response `json:"-"` + // RecoveryID - The url of the recovery object, used to identify and recover the deleted secret. + RecoveryID *string `json:"recoveryId,omitempty"` + // ScheduledPurgeDate - The time when the secret is scheduled to be purged, in UTC + ScheduledPurgeDate *date.UnixTime `json:"scheduledPurgeDate,omitempty"` + // DeletedDate - The time when the secret was deleted, in UTC + DeletedDate *date.UnixTime `json:"deletedDate,omitempty"` + // Value - The secret value. + Value *string `json:"value,omitempty"` + // ID - The secret id. + ID *string `json:"id,omitempty"` + // ContentType - The content type of the secret. + ContentType *string `json:"contentType,omitempty"` + // Attributes - The secret management attributes. + Attributes *SecretAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` + // Kid - If this is a secret backing a KV certificate, then this field specifies the corresponding key backing the KV certificate. + Kid *string `json:"kid,omitempty"` + // Managed - True if the secret's lifetime is managed by key vault. If this is a secret backing a certificate, then managed will be true. + Managed *bool `json:"managed,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeletedSecretBundle. +func (dsb DeletedSecretBundle) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dsb.RecoveryID != nil { + objectMap["recoveryId"] = dsb.RecoveryID + } + if dsb.ScheduledPurgeDate != nil { + objectMap["scheduledPurgeDate"] = dsb.ScheduledPurgeDate + } + if dsb.DeletedDate != nil { + objectMap["deletedDate"] = dsb.DeletedDate + } + if dsb.Value != nil { + objectMap["value"] = dsb.Value + } + if dsb.ID != nil { + objectMap["id"] = dsb.ID + } + if dsb.ContentType != nil { + objectMap["contentType"] = dsb.ContentType + } + if dsb.Attributes != nil { + objectMap["attributes"] = dsb.Attributes + } + if dsb.Tags != nil { + objectMap["tags"] = dsb.Tags + } + if dsb.Kid != nil { + objectMap["kid"] = dsb.Kid + } + if dsb.Managed != nil { + objectMap["managed"] = dsb.Managed + } + return json.Marshal(objectMap) +} + +// DeletedSecretItem the deleted secret item containing metadata about the deleted secret. +type DeletedSecretItem struct { + // RecoveryID - The url of the recovery object, used to identify and recover the deleted secret. + RecoveryID *string `json:"recoveryId,omitempty"` + // ScheduledPurgeDate - The time when the secret is scheduled to be purged, in UTC + ScheduledPurgeDate *date.UnixTime `json:"scheduledPurgeDate,omitempty"` + // DeletedDate - The time when the secret was deleted, in UTC + DeletedDate *date.UnixTime `json:"deletedDate,omitempty"` + // ID - Secret identifier. + ID *string `json:"id,omitempty"` + // Attributes - The secret management attributes. + Attributes *SecretAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` + // ContentType - Type of the secret value such as a password. + ContentType *string `json:"contentType,omitempty"` + // Managed - True if the secret'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"` +} + +// MarshalJSON is the custom marshaler for DeletedSecretItem. +func (dsi DeletedSecretItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dsi.RecoveryID != nil { + objectMap["recoveryId"] = dsi.RecoveryID + } + if dsi.ScheduledPurgeDate != nil { + objectMap["scheduledPurgeDate"] = dsi.ScheduledPurgeDate + } + if dsi.DeletedDate != nil { + objectMap["deletedDate"] = dsi.DeletedDate + } + if dsi.ID != nil { + objectMap["id"] = dsi.ID + } + if dsi.Attributes != nil { + objectMap["attributes"] = dsi.Attributes + } + if dsi.Tags != nil { + objectMap["tags"] = dsi.Tags + } + if dsi.ContentType != nil { + objectMap["contentType"] = dsi.ContentType + } + if dsi.Managed != nil { + objectMap["managed"] = dsi.Managed + } + return json.Marshal(objectMap) +} + +// DeletedSecretListResult the deleted secret list result +type DeletedSecretListResult struct { + autorest.Response `json:"-"` + // Value - A response message containing a list of the deleted secrets in the vault along with a link to the next page of deleted secrets + Value *[]DeletedSecretItem `json:"value,omitempty"` + // NextLink - The URL to get the next set of deleted secrets. + NextLink *string `json:"nextLink,omitempty"` +} + +// DeletedSecretListResultIterator provides access to a complete listing of DeletedSecretItem values. +type DeletedSecretListResultIterator struct { + i int + page DeletedSecretListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DeletedSecretListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DeletedSecretListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DeletedSecretListResultIterator) Response() DeletedSecretListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DeletedSecretListResultIterator) Value() DeletedSecretItem { + if !iter.page.NotDone() { + return DeletedSecretItem{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (dslr DeletedSecretListResult) IsEmpty() bool { + return dslr.Value == nil || len(*dslr.Value) == 0 +} + +// deletedSecretListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dslr DeletedSecretListResult) deletedSecretListResultPreparer() (*http.Request, error) { + if dslr.NextLink == nil || len(to.String(dslr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dslr.NextLink))) +} + +// DeletedSecretListResultPage contains a page of DeletedSecretItem values. +type DeletedSecretListResultPage struct { + fn func(DeletedSecretListResult) (DeletedSecretListResult, error) + dslr DeletedSecretListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DeletedSecretListResultPage) Next() error { + next, err := page.fn(page.dslr) + if err != nil { + return err + } + page.dslr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DeletedSecretListResultPage) NotDone() bool { + return !page.dslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DeletedSecretListResultPage) Response() DeletedSecretListResult { + return page.dslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DeletedSecretListResultPage) Values() []DeletedSecretItem { + if page.dslr.IsEmpty() { + return nil + } + return *page.dslr.Value +} + +// DeletedStorageAccountItem the deleted storage account item containing metadata about the deleted storage +// account. +type DeletedStorageAccountItem struct { + // RecoveryID - The url of the recovery object, used to identify and recover the deleted storage account. + RecoveryID *string `json:"recoveryId,omitempty"` + // ScheduledPurgeDate - The time when the storage account is scheduled to be purged, in UTC + ScheduledPurgeDate *date.UnixTime `json:"scheduledPurgeDate,omitempty"` + // DeletedDate - The time when the storage account was deleted, in UTC + DeletedDate *date.UnixTime `json:"deletedDate,omitempty"` + // ID - Storage identifier. + ID *string `json:"id,omitempty"` + // ResourceID - Storage account resource Id. + ResourceID *string `json:"resourceId,omitempty"` + // Attributes - The storage account management attributes. + Attributes *StorageAccountAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for DeletedStorageAccountItem. +func (dsai DeletedStorageAccountItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dsai.RecoveryID != nil { + objectMap["recoveryId"] = dsai.RecoveryID + } + if dsai.ScheduledPurgeDate != nil { + objectMap["scheduledPurgeDate"] = dsai.ScheduledPurgeDate + } + if dsai.DeletedDate != nil { + objectMap["deletedDate"] = dsai.DeletedDate + } + if dsai.ID != nil { + objectMap["id"] = dsai.ID + } + if dsai.ResourceID != nil { + objectMap["resourceId"] = dsai.ResourceID + } + if dsai.Attributes != nil { + objectMap["attributes"] = dsai.Attributes + } + if dsai.Tags != nil { + objectMap["tags"] = dsai.Tags + } + return json.Marshal(objectMap) +} + +// DeletedStorageBundle a deleted storage account bundle consisting of its previous id, attributes and its tags, as +// well as information on when it will be purged. +type DeletedStorageBundle struct { + autorest.Response `json:"-"` + // RecoveryID - The url of the recovery object, used to identify and recover the deleted storage account. + RecoveryID *string `json:"recoveryId,omitempty"` + // ScheduledPurgeDate - The time when the storage account is scheduled to be purged, in UTC + ScheduledPurgeDate *date.UnixTime `json:"scheduledPurgeDate,omitempty"` + // DeletedDate - The time when the storage account was deleted, in UTC + DeletedDate *date.UnixTime `json:"deletedDate,omitempty"` + // ID - The storage account id. + ID *string `json:"id,omitempty"` + // ResourceID - The storage account resource id. + ResourceID *string `json:"resourceId,omitempty"` + // ActiveKeyName - The current active storage account key name. + ActiveKeyName *string `json:"activeKeyName,omitempty"` + // AutoRegenerateKey - whether keyvault should manage the storage account for the user. + AutoRegenerateKey *bool `json:"autoRegenerateKey,omitempty"` + // RegenerationPeriod - The key regeneration time duration specified in ISO-8601 format. + RegenerationPeriod *string `json:"regenerationPeriod,omitempty"` + // Attributes - The storage account attributes. + Attributes *StorageAccountAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for DeletedStorageBundle. +func (dsb DeletedStorageBundle) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dsb.RecoveryID != nil { + objectMap["recoveryId"] = dsb.RecoveryID + } + if dsb.ScheduledPurgeDate != nil { + objectMap["scheduledPurgeDate"] = dsb.ScheduledPurgeDate + } + if dsb.DeletedDate != nil { + objectMap["deletedDate"] = dsb.DeletedDate + } + if dsb.ID != nil { + objectMap["id"] = dsb.ID + } + if dsb.ResourceID != nil { + objectMap["resourceId"] = dsb.ResourceID + } + if dsb.ActiveKeyName != nil { + objectMap["activeKeyName"] = dsb.ActiveKeyName + } + if dsb.AutoRegenerateKey != nil { + objectMap["autoRegenerateKey"] = dsb.AutoRegenerateKey + } + if dsb.RegenerationPeriod != nil { + objectMap["regenerationPeriod"] = dsb.RegenerationPeriod + } + if dsb.Attributes != nil { + objectMap["attributes"] = dsb.Attributes + } + if dsb.Tags != nil { + objectMap["tags"] = dsb.Tags + } + return json.Marshal(objectMap) +} + +// DeletedStorageListResult the deleted storage account list result +type DeletedStorageListResult struct { + autorest.Response `json:"-"` + // Value - A response message containing a list of the deleted storage accounts in the vault along with a link to the next page of deleted storage accounts + Value *[]DeletedStorageAccountItem `json:"value,omitempty"` + // NextLink - The URL to get the next set of deleted storage accounts. + NextLink *string `json:"nextLink,omitempty"` +} + +// DeletedStorageListResultIterator provides access to a complete listing of DeletedStorageAccountItem values. +type DeletedStorageListResultIterator struct { + i int + page DeletedStorageListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DeletedStorageListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DeletedStorageListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DeletedStorageListResultIterator) Response() DeletedStorageListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DeletedStorageListResultIterator) Value() DeletedStorageAccountItem { + if !iter.page.NotDone() { + return DeletedStorageAccountItem{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (dslr DeletedStorageListResult) IsEmpty() bool { + return dslr.Value == nil || len(*dslr.Value) == 0 +} + +// deletedStorageListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dslr DeletedStorageListResult) deletedStorageListResultPreparer() (*http.Request, error) { + if dslr.NextLink == nil || len(to.String(dslr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dslr.NextLink))) +} + +// DeletedStorageListResultPage contains a page of DeletedStorageAccountItem values. +type DeletedStorageListResultPage struct { + fn func(DeletedStorageListResult) (DeletedStorageListResult, error) + dslr DeletedStorageListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DeletedStorageListResultPage) Next() error { + next, err := page.fn(page.dslr) + if err != nil { + return err + } + page.dslr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DeletedStorageListResultPage) NotDone() bool { + return !page.dslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DeletedStorageListResultPage) Response() DeletedStorageListResult { + return page.dslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DeletedStorageListResultPage) Values() []DeletedStorageAccountItem { + if page.dslr.IsEmpty() { + return nil + } + return *page.dslr.Value +} + +// Error the key vault server error. +type Error struct { + // Code - The error code. + Code *string `json:"code,omitempty"` + // Message - The error message. + Message *string `json:"message,omitempty"` + InnerError *Error `json:"innererror,omitempty"` +} + +// ErrorType the key vault error exception. +type ErrorType struct { + Error *Error `json:"error,omitempty"` +} + +// IssuerAttributes the attributes of an issuer managed by the Key Vault service. +type IssuerAttributes struct { + // Enabled - Determines whether the issuer is enabled. + Enabled *bool `json:"enabled,omitempty"` + // Created - Creation time in UTC. + Created *date.UnixTime `json:"created,omitempty"` + // Updated - Last updated time in UTC. + Updated *date.UnixTime `json:"updated,omitempty"` +} + +// IssuerBundle the issuer for Key Vault certificate. +type IssuerBundle struct { + autorest.Response `json:"-"` + // ID - Identifier for the issuer object. + ID *string `json:"id,omitempty"` + // Provider - The issuer provider. + Provider *string `json:"provider,omitempty"` + // Credentials - The credentials to be used for the issuer. + Credentials *IssuerCredentials `json:"credentials,omitempty"` + // OrganizationDetails - Details of the organization as provided to the issuer. + OrganizationDetails *OrganizationDetails `json:"org_details,omitempty"` + // Attributes - Attributes of the issuer object. + Attributes *IssuerAttributes `json:"attributes,omitempty"` +} + +// IssuerCredentials the credentials to be used for the certificate issuer. +type IssuerCredentials struct { + // AccountID - The user name/account name/account id. + AccountID *string `json:"account_id,omitempty"` + // Password - The password/secret/account key. + Password *string `json:"pwd,omitempty"` +} + +// IssuerParameters parameters for the issuer of the X509 component of a certificate. +type IssuerParameters struct { + // Name - Name of the referenced issuer object or reserved names; for example, 'Self' or 'Unknown'. + Name *string `json:"name,omitempty"` + // CertificateType - Type of certificate to be requested from the issuer provider. + CertificateType *string `json:"cty,omitempty"` + // CertificateTransparency - Indicates if the certificates generated under this policy should be published to certificate transparency logs. + CertificateTransparency *bool `json:"cert_transparency,omitempty"` +} + +// JSONWebKey as of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18 +type JSONWebKey struct { + // Kid - Key identifier. + Kid *string `json:"kid,omitempty"` + // Kty - JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Possible values include: 'EC', 'ECHSM', 'RSA', 'RSAHSM', 'Oct' + Kty JSONWebKeyType `json:"kty,omitempty"` + KeyOps *[]string `json:"key_ops,omitempty"` + // N - RSA modulus. + N *string `json:"n,omitempty"` + // E - RSA public exponent. + E *string `json:"e,omitempty"` + // D - RSA private exponent, or the D component of an EC private key. + D *string `json:"d,omitempty"` + // DP - RSA private key parameter. + DP *string `json:"dp,omitempty"` + // DQ - RSA private key parameter. + DQ *string `json:"dq,omitempty"` + // QI - RSA private key parameter. + QI *string `json:"qi,omitempty"` + // P - RSA secret prime. + P *string `json:"p,omitempty"` + // Q - RSA secret prime, with p < q. + Q *string `json:"q,omitempty"` + // K - Symmetric key. + K *string `json:"k,omitempty"` + // T - HSM Token, used with 'Bring Your Own Key'. + T *string `json:"key_hsm,omitempty"` + // Crv - Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values include: 'P256', 'P384', 'P521', 'P256K' + Crv JSONWebKeyCurveName `json:"crv,omitempty"` + // X - X component of an EC public key. + X *string `json:"x,omitempty"` + // Y - Y component of an EC public key. + Y *string `json:"y,omitempty"` +} + +// KeyAttributes the attributes of a key managed by the key vault service. +type KeyAttributes struct { + // RecoveryLevel - 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. Possible values include: 'Purgeable', 'RecoverablePurgeable', 'Recoverable', 'RecoverableProtectedSubscription' + RecoveryLevel DeletionRecoveryLevel `json:"recoveryLevel,omitempty"` + // Enabled - Determines whether the object is enabled. + Enabled *bool `json:"enabled,omitempty"` + // NotBefore - Not before date in UTC. + NotBefore *date.UnixTime `json:"nbf,omitempty"` + // Expires - Expiry date in UTC. + Expires *date.UnixTime `json:"exp,omitempty"` + // Created - Creation time in UTC. + Created *date.UnixTime `json:"created,omitempty"` + // Updated - Last updated time in UTC. + Updated *date.UnixTime `json:"updated,omitempty"` +} + +// KeyBundle a KeyBundle consisting of a WebKey plus its attributes. +type KeyBundle struct { + autorest.Response `json:"-"` + // Key - The Json web key. + Key *JSONWebKey `json:"key,omitempty"` + // Attributes - The key management attributes. + Attributes *KeyAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` + // Managed - 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"` +} + +// MarshalJSON is the custom marshaler for KeyBundle. +func (kb KeyBundle) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kb.Key != nil { + objectMap["key"] = kb.Key + } + if kb.Attributes != nil { + objectMap["attributes"] = kb.Attributes + } + if kb.Tags != nil { + objectMap["tags"] = kb.Tags + } + if kb.Managed != nil { + objectMap["managed"] = kb.Managed + } + return json.Marshal(objectMap) +} + +// KeyCreateParameters the key create parameters. +type KeyCreateParameters struct { + // Kty - The type of key to create. For valid values, see JsonWebKeyType. Possible values include: 'EC', 'ECHSM', 'RSA', 'RSAHSM', 'Oct' + Kty JSONWebKeyType `json:"kty,omitempty"` + // KeySize - The key size in bits. For example: 2048, 3072, or 4096 for RSA. + KeySize *int32 `json:"key_size,omitempty"` + KeyOps *[]JSONWebKeyOperation `json:"key_ops,omitempty"` + KeyAttributes *KeyAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` + // Curve - Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values include: 'P256', 'P384', 'P521', 'P256K' + Curve JSONWebKeyCurveName `json:"crv,omitempty"` +} + +// MarshalJSON is the custom marshaler for KeyCreateParameters. +func (kcp KeyCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kcp.Kty != "" { + objectMap["kty"] = kcp.Kty + } + if kcp.KeySize != nil { + objectMap["key_size"] = kcp.KeySize + } + if kcp.KeyOps != nil { + objectMap["key_ops"] = kcp.KeyOps + } + if kcp.KeyAttributes != nil { + objectMap["attributes"] = kcp.KeyAttributes + } + if kcp.Tags != nil { + objectMap["tags"] = kcp.Tags + } + if kcp.Curve != "" { + objectMap["crv"] = kcp.Curve + } + return json.Marshal(objectMap) +} + +// KeyImportParameters the key import parameters. +type KeyImportParameters struct { + // Hsm - Whether to import as a hardware key (HSM) or software key. + Hsm *bool `json:"Hsm,omitempty"` + // Key - The Json web key + Key *JSONWebKey `json:"key,omitempty"` + // KeyAttributes - The key management attributes. + KeyAttributes *KeyAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for KeyImportParameters. +func (kip KeyImportParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kip.Hsm != nil { + objectMap["Hsm"] = kip.Hsm + } + if kip.Key != nil { + objectMap["key"] = kip.Key + } + if kip.KeyAttributes != nil { + objectMap["attributes"] = kip.KeyAttributes + } + if kip.Tags != nil { + objectMap["tags"] = kip.Tags + } + return json.Marshal(objectMap) +} + +// KeyItem the key item containing key metadata. +type KeyItem struct { + // Kid - Key identifier. + Kid *string `json:"kid,omitempty"` + // Attributes - The key management attributes. + Attributes *KeyAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` + // Managed - 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"` +} + +// MarshalJSON is the custom marshaler for KeyItem. +func (ki KeyItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ki.Kid != nil { + objectMap["kid"] = ki.Kid + } + if ki.Attributes != nil { + objectMap["attributes"] = ki.Attributes + } + if ki.Tags != nil { + objectMap["tags"] = ki.Tags + } + if ki.Managed != nil { + objectMap["managed"] = ki.Managed + } + return json.Marshal(objectMap) +} + +// KeyListResult the key list result. +type KeyListResult struct { + autorest.Response `json:"-"` + // Value - A response message containing a list of keys in the key vault along with a link to the next page of keys. + Value *[]KeyItem `json:"value,omitempty"` + // NextLink - The URL to get the next set of keys. + NextLink *string `json:"nextLink,omitempty"` +} + +// KeyListResultIterator provides access to a complete listing of KeyItem values. +type KeyListResultIterator struct { + i int + page KeyListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *KeyListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter KeyListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter KeyListResultIterator) Response() KeyListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter KeyListResultIterator) Value() KeyItem { + if !iter.page.NotDone() { + return KeyItem{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (klr KeyListResult) IsEmpty() bool { + return klr.Value == nil || len(*klr.Value) == 0 +} + +// keyListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (klr KeyListResult) keyListResultPreparer() (*http.Request, error) { + if klr.NextLink == nil || len(to.String(klr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(klr.NextLink))) +} + +// KeyListResultPage contains a page of KeyItem values. +type KeyListResultPage struct { + fn func(KeyListResult) (KeyListResult, error) + klr KeyListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *KeyListResultPage) Next() error { + next, err := page.fn(page.klr) + if err != nil { + return err + } + page.klr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page KeyListResultPage) NotDone() bool { + return !page.klr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page KeyListResultPage) Response() KeyListResult { + return page.klr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page KeyListResultPage) Values() []KeyItem { + if page.klr.IsEmpty() { + return nil + } + return *page.klr.Value +} + +// KeyOperationResult the key operation result. +type KeyOperationResult struct { + autorest.Response `json:"-"` + // Kid - Key identifier + Kid *string `json:"kid,omitempty"` + Result *string `json:"value,omitempty"` +} + +// KeyOperationsParameters the key operations parameters. +type KeyOperationsParameters struct { + // Algorithm - algorithm identifier. Possible values include: 'RSAOAEP', 'RSAOAEP256', 'RSA15' + Algorithm JSONWebKeyEncryptionAlgorithm `json:"alg,omitempty"` + Value *string `json:"value,omitempty"` +} + +// KeyProperties properties of the key pair backing a certificate. +type KeyProperties struct { + // Exportable - Indicates if the private key can be exported. + Exportable *bool `json:"exportable,omitempty"` + // KeyType - The type of key pair to be used for the certificate. Possible values include: 'EC', 'ECHSM', 'RSA', 'RSAHSM', 'Oct' + KeyType JSONWebKeyType `json:"kty,omitempty"` + // KeySize - The key size in bits. For example: 2048, 3072, or 4096 for RSA. + KeySize *int32 `json:"key_size,omitempty"` + // ReuseKey - Indicates if the same key pair will be used on certificate renewal. + ReuseKey *bool `json:"reuse_key,omitempty"` + // Curve - Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values include: 'P256', 'P384', 'P521', 'P256K' + Curve JSONWebKeyCurveName `json:"crv,omitempty"` +} + +// KeyRestoreParameters the key restore parameters. +type KeyRestoreParameters struct { + // KeyBundleBackup - The backup blob associated with a key bundle. + KeyBundleBackup *string `json:"value,omitempty"` +} + +// KeySignParameters the key operations parameters. +type KeySignParameters struct { + // Algorithm - The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', 'ES256K' + Algorithm JSONWebKeySignatureAlgorithm `json:"alg,omitempty"` + Value *string `json:"value,omitempty"` +} + +// KeyUpdateParameters the key update parameters. +type KeyUpdateParameters struct { + // KeyOps - Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. + KeyOps *[]JSONWebKeyOperation `json:"key_ops,omitempty"` + KeyAttributes *KeyAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for KeyUpdateParameters. +func (kup KeyUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kup.KeyOps != nil { + objectMap["key_ops"] = kup.KeyOps + } + if kup.KeyAttributes != nil { + objectMap["attributes"] = kup.KeyAttributes + } + if kup.Tags != nil { + objectMap["tags"] = kup.Tags + } + return json.Marshal(objectMap) +} + +// KeyVerifyParameters the key verify parameters. +type KeyVerifyParameters struct { + // Algorithm - The signing/verification algorithm. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', 'ES256K' + Algorithm JSONWebKeySignatureAlgorithm `json:"alg,omitempty"` + // Digest - The digest used for signing. + Digest *string `json:"digest,omitempty"` + // Signature - The signature to be verified. + Signature *string `json:"value,omitempty"` +} + +// KeyVerifyResult the key verify result. +type KeyVerifyResult struct { + autorest.Response `json:"-"` + // Value - True if the signature is verified, otherwise false. + Value *bool `json:"value,omitempty"` +} + +// LifetimeAction action and its trigger that will be performed by Key Vault over the lifetime of a certificate. +type LifetimeAction struct { + // Trigger - The condition that will execute the action. + Trigger *Trigger `json:"trigger,omitempty"` + // Action - The action that will be executed. + Action *Action `json:"action,omitempty"` +} + +// OrganizationDetails details of the organization of the certificate issuer. +type OrganizationDetails struct { + // ID - Id of the organization. + ID *string `json:"id,omitempty"` + // AdminDetails - Details of the organization administrator. + AdminDetails *[]AdministratorDetails `json:"admin_details,omitempty"` +} + +// PendingCertificateSigningRequestResult the pending certificate signing request result. +type PendingCertificateSigningRequestResult struct { + // Value - The pending certificate signing request as Base64 encoded string. + Value *string `json:"value,omitempty"` +} + +// SasDefinitionAttributes the SAS definition management attributes. +type SasDefinitionAttributes struct { + // Enabled - the enabled state of the object. + Enabled *bool `json:"enabled,omitempty"` + // Created - Creation time in UTC. + Created *date.UnixTime `json:"created,omitempty"` + // Updated - Last updated time in UTC. + Updated *date.UnixTime `json:"updated,omitempty"` + // RecoveryLevel - Reflects the deletion recovery level currently in effect for SAS definitions in the current vault. If it contains 'Purgeable' the SAS definition can be permanently deleted by a privileged user; otherwise, only the system can purge the SAS definition, at the end of the retention interval. Possible values include: 'Purgeable', 'RecoverablePurgeable', 'Recoverable', 'RecoverableProtectedSubscription' + RecoveryLevel DeletionRecoveryLevel `json:"recoveryLevel,omitempty"` +} + +// SasDefinitionBundle a SAS definition bundle consists of key vault SAS definition details plus its attributes. +type SasDefinitionBundle struct { + autorest.Response `json:"-"` + // ID - The SAS definition id. + ID *string `json:"id,omitempty"` + // SecretID - Storage account SAS definition secret id. + SecretID *string `json:"sid,omitempty"` + // TemplateURI - The SAS definition token template signed with an arbitrary key. Tokens created according to the SAS definition will have the same properties as the template. + TemplateURI *string `json:"templateUri,omitempty"` + // SasType - The type of SAS token the SAS definition will create. Possible values include: 'Account', 'Service' + SasType SasTokenType `json:"sasType,omitempty"` + // ValidityPeriod - The validity period of SAS tokens created according to the SAS definition. + ValidityPeriod *string `json:"validityPeriod,omitempty"` + // Attributes - The SAS definition attributes. + Attributes *SasDefinitionAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for SasDefinitionBundle. +func (sdb SasDefinitionBundle) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sdb.ID != nil { + objectMap["id"] = sdb.ID + } + if sdb.SecretID != nil { + objectMap["sid"] = sdb.SecretID + } + if sdb.TemplateURI != nil { + objectMap["templateUri"] = sdb.TemplateURI + } + if sdb.SasType != "" { + objectMap["sasType"] = sdb.SasType + } + if sdb.ValidityPeriod != nil { + objectMap["validityPeriod"] = sdb.ValidityPeriod + } + if sdb.Attributes != nil { + objectMap["attributes"] = sdb.Attributes + } + if sdb.Tags != nil { + objectMap["tags"] = sdb.Tags + } + return json.Marshal(objectMap) +} + +// SasDefinitionCreateParameters the SAS definition create parameters. +type SasDefinitionCreateParameters struct { + // TemplateURI - The SAS definition token template signed with an arbitrary key. Tokens created according to the SAS definition will have the same properties as the template. + TemplateURI *string `json:"templateUri,omitempty"` + // SasType - The type of SAS token the SAS definition will create. Possible values include: 'Account', 'Service' + SasType SasTokenType `json:"sasType,omitempty"` + // ValidityPeriod - The validity period of SAS tokens created according to the SAS definition. + ValidityPeriod *string `json:"validityPeriod,omitempty"` + // SasDefinitionAttributes - The attributes of the SAS definition. + SasDefinitionAttributes *SasDefinitionAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for SasDefinitionCreateParameters. +func (sdcp SasDefinitionCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sdcp.TemplateURI != nil { + objectMap["templateUri"] = sdcp.TemplateURI + } + if sdcp.SasType != "" { + objectMap["sasType"] = sdcp.SasType + } + if sdcp.ValidityPeriod != nil { + objectMap["validityPeriod"] = sdcp.ValidityPeriod + } + if sdcp.SasDefinitionAttributes != nil { + objectMap["attributes"] = sdcp.SasDefinitionAttributes + } + if sdcp.Tags != nil { + objectMap["tags"] = sdcp.Tags + } + return json.Marshal(objectMap) +} + +// SasDefinitionItem the SAS definition item containing storage SAS definition metadata. +type SasDefinitionItem struct { + // ID - The storage SAS identifier. + ID *string `json:"id,omitempty"` + // SecretID - The storage account SAS definition secret id. + SecretID *string `json:"sid,omitempty"` + // Attributes - The SAS definition management attributes. + Attributes *SasDefinitionAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for SasDefinitionItem. +func (sdi SasDefinitionItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sdi.ID != nil { + objectMap["id"] = sdi.ID + } + if sdi.SecretID != nil { + objectMap["sid"] = sdi.SecretID + } + if sdi.Attributes != nil { + objectMap["attributes"] = sdi.Attributes + } + if sdi.Tags != nil { + objectMap["tags"] = sdi.Tags + } + return json.Marshal(objectMap) +} + +// SasDefinitionListResult the storage account SAS definition list result. +type SasDefinitionListResult struct { + autorest.Response `json:"-"` + // Value - A response message containing a list of SAS definitions along with a link to the next page of SAS definitions. + Value *[]SasDefinitionItem `json:"value,omitempty"` + // NextLink - The URL to get the next set of SAS defintions. + NextLink *string `json:"nextLink,omitempty"` +} + +// SasDefinitionListResultIterator provides access to a complete listing of SasDefinitionItem values. +type SasDefinitionListResultIterator struct { + i int + page SasDefinitionListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SasDefinitionListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SasDefinitionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SasDefinitionListResultIterator) Response() SasDefinitionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SasDefinitionListResultIterator) Value() SasDefinitionItem { + if !iter.page.NotDone() { + return SasDefinitionItem{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (sdlr SasDefinitionListResult) IsEmpty() bool { + return sdlr.Value == nil || len(*sdlr.Value) == 0 +} + +// sasDefinitionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sdlr SasDefinitionListResult) sasDefinitionListResultPreparer() (*http.Request, error) { + if sdlr.NextLink == nil || len(to.String(sdlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sdlr.NextLink))) +} + +// SasDefinitionListResultPage contains a page of SasDefinitionItem values. +type SasDefinitionListResultPage struct { + fn func(SasDefinitionListResult) (SasDefinitionListResult, error) + sdlr SasDefinitionListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SasDefinitionListResultPage) Next() error { + next, err := page.fn(page.sdlr) + if err != nil { + return err + } + page.sdlr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SasDefinitionListResultPage) NotDone() bool { + return !page.sdlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SasDefinitionListResultPage) Response() SasDefinitionListResult { + return page.sdlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SasDefinitionListResultPage) Values() []SasDefinitionItem { + if page.sdlr.IsEmpty() { + return nil + } + return *page.sdlr.Value +} + +// SasDefinitionUpdateParameters the SAS definition update parameters. +type SasDefinitionUpdateParameters struct { + // TemplateURI - The SAS definition token template signed with an arbitrary key. Tokens created according to the SAS definition will have the same properties as the template. + TemplateURI *string `json:"templateUri,omitempty"` + // SasType - The type of SAS token the SAS definition will create. Possible values include: 'Account', 'Service' + SasType SasTokenType `json:"sasType,omitempty"` + // ValidityPeriod - The validity period of SAS tokens created according to the SAS definition. + ValidityPeriod *string `json:"validityPeriod,omitempty"` + // SasDefinitionAttributes - The attributes of the SAS definition. + SasDefinitionAttributes *SasDefinitionAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for SasDefinitionUpdateParameters. +func (sdup SasDefinitionUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sdup.TemplateURI != nil { + objectMap["templateUri"] = sdup.TemplateURI + } + if sdup.SasType != "" { + objectMap["sasType"] = sdup.SasType + } + if sdup.ValidityPeriod != nil { + objectMap["validityPeriod"] = sdup.ValidityPeriod + } + if sdup.SasDefinitionAttributes != nil { + objectMap["attributes"] = sdup.SasDefinitionAttributes + } + if sdup.Tags != nil { + objectMap["tags"] = sdup.Tags + } + return json.Marshal(objectMap) +} + +// SecretAttributes the secret management attributes. +type SecretAttributes struct { + // RecoveryLevel - Reflects the deletion recovery level currently in effect for secrets in the current vault. If it contains 'Purgeable', the secret can be permanently deleted by a privileged user; otherwise, only the system can purge the secret, at the end of the retention interval. Possible values include: 'Purgeable', 'RecoverablePurgeable', 'Recoverable', 'RecoverableProtectedSubscription' + RecoveryLevel DeletionRecoveryLevel `json:"recoveryLevel,omitempty"` + // Enabled - Determines whether the object is enabled. + Enabled *bool `json:"enabled,omitempty"` + // NotBefore - Not before date in UTC. + NotBefore *date.UnixTime `json:"nbf,omitempty"` + // Expires - Expiry date in UTC. + Expires *date.UnixTime `json:"exp,omitempty"` + // Created - Creation time in UTC. + Created *date.UnixTime `json:"created,omitempty"` + // Updated - Last updated time in UTC. + Updated *date.UnixTime `json:"updated,omitempty"` +} + +// SecretBundle a secret consisting of a value, id and its attributes. +type SecretBundle struct { + autorest.Response `json:"-"` + // Value - The secret value. + Value *string `json:"value,omitempty"` + // ID - The secret id. + ID *string `json:"id,omitempty"` + // ContentType - The content type of the secret. + ContentType *string `json:"contentType,omitempty"` + // Attributes - The secret management attributes. + Attributes *SecretAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` + // Kid - If this is a secret backing a KV certificate, then this field specifies the corresponding key backing the KV certificate. + Kid *string `json:"kid,omitempty"` + // Managed - True if the secret's lifetime is managed by key vault. If this is a secret backing a certificate, then managed will be true. + Managed *bool `json:"managed,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecretBundle. +func (sb SecretBundle) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sb.Value != nil { + objectMap["value"] = sb.Value + } + if sb.ID != nil { + objectMap["id"] = sb.ID + } + if sb.ContentType != nil { + objectMap["contentType"] = sb.ContentType + } + if sb.Attributes != nil { + objectMap["attributes"] = sb.Attributes + } + if sb.Tags != nil { + objectMap["tags"] = sb.Tags + } + if sb.Kid != nil { + objectMap["kid"] = sb.Kid + } + if sb.Managed != nil { + objectMap["managed"] = sb.Managed + } + return json.Marshal(objectMap) +} + +// SecretItem the secret item containing secret metadata. +type SecretItem struct { + // ID - Secret identifier. + ID *string `json:"id,omitempty"` + // Attributes - The secret management attributes. + Attributes *SecretAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` + // ContentType - Type of the secret value such as a password. + ContentType *string `json:"contentType,omitempty"` + // Managed - True if the secret'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"` +} + +// MarshalJSON is the custom marshaler for SecretItem. +func (si SecretItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if si.ID != nil { + objectMap["id"] = si.ID + } + if si.Attributes != nil { + objectMap["attributes"] = si.Attributes + } + if si.Tags != nil { + objectMap["tags"] = si.Tags + } + if si.ContentType != nil { + objectMap["contentType"] = si.ContentType + } + if si.Managed != nil { + objectMap["managed"] = si.Managed + } + return json.Marshal(objectMap) +} + +// SecretListResult the secret list result. +type SecretListResult struct { + autorest.Response `json:"-"` + // Value - A response message containing a list of secrets in the key vault along with a link to the next page of secrets. + Value *[]SecretItem `json:"value,omitempty"` + // NextLink - The URL to get the next set of secrets. + NextLink *string `json:"nextLink,omitempty"` +} + +// SecretListResultIterator provides access to a complete listing of SecretItem values. +type SecretListResultIterator struct { + i int + page SecretListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SecretListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SecretListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SecretListResultIterator) Response() SecretListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SecretListResultIterator) Value() SecretItem { + if !iter.page.NotDone() { + return SecretItem{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (slr SecretListResult) IsEmpty() bool { + return slr.Value == nil || len(*slr.Value) == 0 +} + +// secretListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (slr SecretListResult) secretListResultPreparer() (*http.Request, error) { + if slr.NextLink == nil || len(to.String(slr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(slr.NextLink))) +} + +// SecretListResultPage contains a page of SecretItem values. +type SecretListResultPage struct { + fn func(SecretListResult) (SecretListResult, error) + slr SecretListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SecretListResultPage) Next() error { + next, err := page.fn(page.slr) + if err != nil { + return err + } + page.slr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SecretListResultPage) NotDone() bool { + return !page.slr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SecretListResultPage) Response() SecretListResult { + return page.slr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SecretListResultPage) Values() []SecretItem { + if page.slr.IsEmpty() { + return nil + } + return *page.slr.Value +} + +// SecretProperties properties of the key backing a certificate. +type SecretProperties struct { + // ContentType - The media type (MIME type). + ContentType *string `json:"contentType,omitempty"` +} + +// SecretRestoreParameters the secret restore parameters. +type SecretRestoreParameters struct { + // SecretBundleBackup - The backup blob associated with a secret bundle. + SecretBundleBackup *string `json:"value,omitempty"` +} + +// SecretSetParameters the secret set parameters. +type SecretSetParameters struct { + // Value - The value of the secret. + Value *string `json:"value,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` + // ContentType - Type of the secret value such as a password. + ContentType *string `json:"contentType,omitempty"` + // SecretAttributes - The secret management attributes. + SecretAttributes *SecretAttributes `json:"attributes,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecretSetParameters. +func (ssp SecretSetParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssp.Value != nil { + objectMap["value"] = ssp.Value + } + if ssp.Tags != nil { + objectMap["tags"] = ssp.Tags + } + if ssp.ContentType != nil { + objectMap["contentType"] = ssp.ContentType + } + if ssp.SecretAttributes != nil { + objectMap["attributes"] = ssp.SecretAttributes + } + return json.Marshal(objectMap) +} + +// SecretUpdateParameters the secret update parameters. +type SecretUpdateParameters struct { + // ContentType - Type of the secret value such as a password. + ContentType *string `json:"contentType,omitempty"` + // SecretAttributes - The secret management attributes. + SecretAttributes *SecretAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for SecretUpdateParameters. +func (sup SecretUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sup.ContentType != nil { + objectMap["contentType"] = sup.ContentType + } + if sup.SecretAttributes != nil { + objectMap["attributes"] = sup.SecretAttributes + } + if sup.Tags != nil { + objectMap["tags"] = sup.Tags + } + return json.Marshal(objectMap) +} + +// StorageAccountAttributes the storage account management attributes. +type StorageAccountAttributes struct { + // Enabled - the enabled state of the object. + Enabled *bool `json:"enabled,omitempty"` + // Created - Creation time in UTC. + Created *date.UnixTime `json:"created,omitempty"` + // Updated - Last updated time in UTC. + Updated *date.UnixTime `json:"updated,omitempty"` + // RecoveryLevel - Reflects the deletion recovery level currently in effect for storage accounts in the current vault. If it contains 'Purgeable' the storage account can be permanently deleted by a privileged user; otherwise, only the system can purge the storage account, at the end of the retention interval. Possible values include: 'Purgeable', 'RecoverablePurgeable', 'Recoverable', 'RecoverableProtectedSubscription' + RecoveryLevel DeletionRecoveryLevel `json:"recoveryLevel,omitempty"` +} + +// StorageAccountCreateParameters the storage account create parameters. +type StorageAccountCreateParameters struct { + // ResourceID - Storage account resource id. + ResourceID *string `json:"resourceId,omitempty"` + // ActiveKeyName - Current active storage account key name. + ActiveKeyName *string `json:"activeKeyName,omitempty"` + // AutoRegenerateKey - whether keyvault should manage the storage account for the user. + AutoRegenerateKey *bool `json:"autoRegenerateKey,omitempty"` + // RegenerationPeriod - The key regeneration time duration specified in ISO-8601 format. + RegenerationPeriod *string `json:"regenerationPeriod,omitempty"` + // StorageAccountAttributes - The attributes of the storage account. + StorageAccountAttributes *StorageAccountAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for StorageAccountCreateParameters. +func (sacp StorageAccountCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sacp.ResourceID != nil { + objectMap["resourceId"] = sacp.ResourceID + } + if sacp.ActiveKeyName != nil { + objectMap["activeKeyName"] = sacp.ActiveKeyName + } + if sacp.AutoRegenerateKey != nil { + objectMap["autoRegenerateKey"] = sacp.AutoRegenerateKey + } + if sacp.RegenerationPeriod != nil { + objectMap["regenerationPeriod"] = sacp.RegenerationPeriod + } + if sacp.StorageAccountAttributes != nil { + objectMap["attributes"] = sacp.StorageAccountAttributes + } + if sacp.Tags != nil { + objectMap["tags"] = sacp.Tags + } + return json.Marshal(objectMap) +} + +// StorageAccountItem the storage account item containing storage account metadata. +type StorageAccountItem struct { + // ID - Storage identifier. + ID *string `json:"id,omitempty"` + // ResourceID - Storage account resource Id. + ResourceID *string `json:"resourceId,omitempty"` + // Attributes - The storage account management attributes. + Attributes *StorageAccountAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for StorageAccountItem. +func (sai StorageAccountItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sai.ID != nil { + objectMap["id"] = sai.ID + } + if sai.ResourceID != nil { + objectMap["resourceId"] = sai.ResourceID + } + if sai.Attributes != nil { + objectMap["attributes"] = sai.Attributes + } + if sai.Tags != nil { + objectMap["tags"] = sai.Tags + } + return json.Marshal(objectMap) +} + +// StorageAccountRegenerteKeyParameters the storage account key regenerate parameters. +type StorageAccountRegenerteKeyParameters struct { + // KeyName - The storage account key name. + KeyName *string `json:"keyName,omitempty"` +} + +// StorageAccountUpdateParameters the storage account update parameters. +type StorageAccountUpdateParameters struct { + // ActiveKeyName - The current active storage account key name. + ActiveKeyName *string `json:"activeKeyName,omitempty"` + // AutoRegenerateKey - whether keyvault should manage the storage account for the user. + AutoRegenerateKey *bool `json:"autoRegenerateKey,omitempty"` + // RegenerationPeriod - The key regeneration time duration specified in ISO-8601 format. + RegenerationPeriod *string `json:"regenerationPeriod,omitempty"` + // StorageAccountAttributes - The attributes of the storage account. + StorageAccountAttributes *StorageAccountAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for StorageAccountUpdateParameters. +func (saup StorageAccountUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if saup.ActiveKeyName != nil { + objectMap["activeKeyName"] = saup.ActiveKeyName + } + if saup.AutoRegenerateKey != nil { + objectMap["autoRegenerateKey"] = saup.AutoRegenerateKey + } + if saup.RegenerationPeriod != nil { + objectMap["regenerationPeriod"] = saup.RegenerationPeriod + } + if saup.StorageAccountAttributes != nil { + objectMap["attributes"] = saup.StorageAccountAttributes + } + if saup.Tags != nil { + objectMap["tags"] = saup.Tags + } + return json.Marshal(objectMap) +} + +// StorageBundle a Storage account bundle consists of key vault storage account details plus its attributes. +type StorageBundle struct { + autorest.Response `json:"-"` + // ID - The storage account id. + ID *string `json:"id,omitempty"` + // ResourceID - The storage account resource id. + ResourceID *string `json:"resourceId,omitempty"` + // ActiveKeyName - The current active storage account key name. + ActiveKeyName *string `json:"activeKeyName,omitempty"` + // AutoRegenerateKey - whether keyvault should manage the storage account for the user. + AutoRegenerateKey *bool `json:"autoRegenerateKey,omitempty"` + // RegenerationPeriod - The key regeneration time duration specified in ISO-8601 format. + RegenerationPeriod *string `json:"regenerationPeriod,omitempty"` + // Attributes - The storage account attributes. + Attributes *StorageAccountAttributes `json:"attributes,omitempty"` + // Tags - Application specific metadata in the form of key-value pairs + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for StorageBundle. +func (sb StorageBundle) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sb.ID != nil { + objectMap["id"] = sb.ID + } + if sb.ResourceID != nil { + objectMap["resourceId"] = sb.ResourceID + } + if sb.ActiveKeyName != nil { + objectMap["activeKeyName"] = sb.ActiveKeyName + } + if sb.AutoRegenerateKey != nil { + objectMap["autoRegenerateKey"] = sb.AutoRegenerateKey + } + if sb.RegenerationPeriod != nil { + objectMap["regenerationPeriod"] = sb.RegenerationPeriod + } + if sb.Attributes != nil { + objectMap["attributes"] = sb.Attributes + } + if sb.Tags != nil { + objectMap["tags"] = sb.Tags + } + return json.Marshal(objectMap) +} + +// StorageListResult the storage accounts list result. +type StorageListResult struct { + autorest.Response `json:"-"` + // Value - A response message containing a list of storage accounts in the key vault along with a link to the next page of storage accounts. + Value *[]StorageAccountItem `json:"value,omitempty"` + // NextLink - The URL to get the next set of storage accounts. + NextLink *string `json:"nextLink,omitempty"` +} + +// StorageListResultIterator provides access to a complete listing of StorageAccountItem values. +type StorageListResultIterator struct { + i int + page StorageListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *StorageListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter StorageListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter StorageListResultIterator) Response() StorageListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter StorageListResultIterator) Value() StorageAccountItem { + if !iter.page.NotDone() { + return StorageAccountItem{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (slr StorageListResult) IsEmpty() bool { + return slr.Value == nil || len(*slr.Value) == 0 +} + +// storageListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (slr StorageListResult) storageListResultPreparer() (*http.Request, error) { + if slr.NextLink == nil || len(to.String(slr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(slr.NextLink))) +} + +// StorageListResultPage contains a page of StorageAccountItem values. +type StorageListResultPage struct { + fn func(StorageListResult) (StorageListResult, error) + slr StorageListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *StorageListResultPage) Next() error { + next, err := page.fn(page.slr) + if err != nil { + return err + } + page.slr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page StorageListResultPage) NotDone() bool { + return !page.slr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page StorageListResultPage) Response() StorageListResult { + return page.slr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page StorageListResultPage) Values() []StorageAccountItem { + if page.slr.IsEmpty() { + return nil + } + return *page.slr.Value +} + +// StorageRestoreParameters the secret restore parameters. +type StorageRestoreParameters struct { + // StorageBundleBackup - The backup blob associated with a storage account. + StorageBundleBackup *string `json:"value,omitempty"` +} + +// SubjectAlternativeNames the subject alternate names of a X509 object. +type SubjectAlternativeNames struct { + // Emails - Email addresses. + Emails *[]string `json:"emails,omitempty"` + // DNSNames - Domain names. + DNSNames *[]string `json:"dns_names,omitempty"` + // Upns - User principal names. + Upns *[]string `json:"upns,omitempty"` +} + +// Trigger a condition to be satisfied for an action to be executed. +type Trigger struct { + // LifetimePercentage - Percentage of lifetime at which to trigger. Value should be between 1 and 99. + LifetimePercentage *int32 `json:"lifetime_percentage,omitempty"` + // DaysBeforeExpiry - Days before expiry to attempt renewal. Value should be between 1 and validity_in_months multiplied by 27. If validity_in_months is 36, then value should be between 1 and 972 (36 * 27). + DaysBeforeExpiry *int32 `json:"days_before_expiry,omitempty"` +} + +// X509CertificateProperties properties of the X509 component of a certificate. +type X509CertificateProperties struct { + // Subject - The subject name. Should be a valid X509 distinguished Name. + Subject *string `json:"subject,omitempty"` + // Ekus - The enhanced key usage. + Ekus *[]string `json:"ekus,omitempty"` + // SubjectAlternativeNames - The subject alternative names. + SubjectAlternativeNames *SubjectAlternativeNames `json:"sans,omitempty"` + // KeyUsage - List of key usages. + KeyUsage *[]KeyUsageType `json:"key_usage,omitempty"` + // ValidityInMonths - The duration that the ceritifcate is valid in months. + ValidityInMonths *int32 `json:"validity_months,omitempty"` +} diff --git a/services/keyvault/v7.0/keyvault/version.go b/services/keyvault/v7.0/keyvault/version.go new file mode 100644 index 000000000000..2db61adc28d2 --- /dev/null +++ b/services/keyvault/v7.0/keyvault/version.go @@ -0,0 +1,30 @@ +package keyvault + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + version.Number + " keyvault/7.0" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/keyvault/v7.0/keyvault/client.go b/services/preview/keyvault/v7.0/keyvault/client.go index 592c83065a30..321cc21f3774 100644 --- a/services/preview/keyvault/v7.0/keyvault/client.go +++ b/services/preview/keyvault/v7.0/keyvault/client.go @@ -45,6 +45,76 @@ func NewWithoutDefaults() BaseClient { } } +// BackupCertificate requests that a backup of the specified certificate be downloaded to the client. All versions of +// the certificate will be downloaded. This operation requires the certificates/backup permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// certificateName - the name of the certificate. +func (client BaseClient) BackupCertificate(ctx context.Context, vaultBaseURL string, certificateName string) (result BackupCertificateResult, err error) { + req, err := client.BackupCertificatePreparer(ctx, vaultBaseURL, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.BackupCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupCertificate", resp, "Failure sending request") + return + } + + result, err = client.BackupCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupCertificate", resp, "Failure responding to request") + } + + return +} + +// BackupCertificatePreparer prepares the BackupCertificate request. +func (client BaseClient) BackupCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "7.0-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/backup", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// BackupCertificateSender sends the BackupCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) BackupCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// BackupCertificateResponder handles the response to the BackupCertificate request. The method always +// closes the http.Response Body. +func (client BaseClient) BackupCertificateResponder(resp *http.Response) (result BackupCertificateResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // BackupKey the Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this operation // does NOT return key material in a form that can be used outside the Azure Key Vault system, the returned key // material is either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The intent of this operation is @@ -1629,7 +1699,8 @@ func (client BaseClient) GetCertificatePolicyResponder(resp *http.Response) (res // vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. // maxresults - maximum number of results to return in a page. If not specified the service will return up to // 25 results. -func (client BaseClient) GetCertificates(ctx context.Context, vaultBaseURL string, maxresults *int32) (result CertificateListResultPage, err error) { +// includePending - specifies whether to include certificates which are not completely provisioned. +func (client BaseClient) GetCertificates(ctx context.Context, vaultBaseURL string, maxresults *int32, includePending *bool) (result CertificateListResultPage, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: maxresults, Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, @@ -1640,7 +1711,7 @@ func (client BaseClient) GetCertificates(ctx context.Context, vaultBaseURL strin } result.fn = client.getCertificatesNextResults - req, err := client.GetCertificatesPreparer(ctx, vaultBaseURL, maxresults) + req, err := client.GetCertificatesPreparer(ctx, vaultBaseURL, maxresults, includePending) if err != nil { err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificates", nil, "Failure preparing request") return @@ -1662,7 +1733,7 @@ func (client BaseClient) GetCertificates(ctx context.Context, vaultBaseURL strin } // GetCertificatesPreparer prepares the GetCertificates request. -func (client BaseClient) GetCertificatesPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) { +func (client BaseClient) GetCertificatesPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32, includePending *bool) (*http.Request, error) { urlParameters := map[string]interface{}{ "vaultBaseUrl": vaultBaseURL, } @@ -1674,6 +1745,9 @@ func (client BaseClient) GetCertificatesPreparer(ctx context.Context, vaultBaseU if maxresults != nil { queryParameters["maxresults"] = autorest.Encode("query", *maxresults) } + if includePending != nil { + queryParameters["includePending"] = autorest.Encode("query", *includePending) + } preparer := autorest.CreatePreparer( autorest.AsGet(), @@ -1725,8 +1799,8 @@ func (client BaseClient) getCertificatesNextResults(lastResults CertificateListR } // GetCertificatesComplete enumerates all values, automatically crossing page boundaries as required. -func (client BaseClient) GetCertificatesComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result CertificateListResultIterator, err error) { - result.page, err = client.GetCertificates(ctx, vaultBaseURL, maxresults) +func (client BaseClient) GetCertificatesComplete(ctx context.Context, vaultBaseURL string, maxresults *int32, includePending *bool) (result CertificateListResultIterator, err error) { + result.page, err = client.GetCertificates(ctx, vaultBaseURL, maxresults, includePending) return } @@ -1921,7 +1995,8 @@ func (client BaseClient) GetDeletedCertificateResponder(resp *http.Response) (re // vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. // maxresults - maximum number of results to return in a page. If not specified the service will return up to // 25 results. -func (client BaseClient) GetDeletedCertificates(ctx context.Context, vaultBaseURL string, maxresults *int32) (result DeletedCertificateListResultPage, err error) { +// includePending - specifies whether to include certificates which are not completely provisioned. +func (client BaseClient) GetDeletedCertificates(ctx context.Context, vaultBaseURL string, maxresults *int32, includePending *bool) (result DeletedCertificateListResultPage, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: maxresults, Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, @@ -1932,7 +2007,7 @@ func (client BaseClient) GetDeletedCertificates(ctx context.Context, vaultBaseUR } result.fn = client.getDeletedCertificatesNextResults - req, err := client.GetDeletedCertificatesPreparer(ctx, vaultBaseURL, maxresults) + req, err := client.GetDeletedCertificatesPreparer(ctx, vaultBaseURL, maxresults, includePending) if err != nil { err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedCertificates", nil, "Failure preparing request") return @@ -1954,7 +2029,7 @@ func (client BaseClient) GetDeletedCertificates(ctx context.Context, vaultBaseUR } // GetDeletedCertificatesPreparer prepares the GetDeletedCertificates request. -func (client BaseClient) GetDeletedCertificatesPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) { +func (client BaseClient) GetDeletedCertificatesPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32, includePending *bool) (*http.Request, error) { urlParameters := map[string]interface{}{ "vaultBaseUrl": vaultBaseURL, } @@ -1966,6 +2041,9 @@ func (client BaseClient) GetDeletedCertificatesPreparer(ctx context.Context, vau if maxresults != nil { queryParameters["maxresults"] = autorest.Encode("query", *maxresults) } + if includePending != nil { + queryParameters["includePending"] = autorest.Encode("query", *includePending) + } preparer := autorest.CreatePreparer( autorest.AsGet(), @@ -2017,8 +2095,8 @@ func (client BaseClient) getDeletedCertificatesNextResults(lastResults DeletedCe } // GetDeletedCertificatesComplete enumerates all values, automatically crossing page boundaries as required. -func (client BaseClient) GetDeletedCertificatesComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result DeletedCertificateListResultIterator, err error) { - result.page, err = client.GetDeletedCertificates(ctx, vaultBaseURL, maxresults) +func (client BaseClient) GetDeletedCertificatesComplete(ctx context.Context, vaultBaseURL string, maxresults *int32, includePending *bool) (result DeletedCertificateListResultIterator, err error) { + result.page, err = client.GetDeletedCertificates(ctx, vaultBaseURL, maxresults, includePending) return } @@ -4177,42 +4255,42 @@ func (client BaseClient) PurgeDeletedSecretResponder(resp *http.Response) (resul return } -// PurgeDeletedStorgeAccount the purge deleted storage account operation removes the secret permanently, without the +// PurgeDeletedStorageAccount the purge deleted storage account operation removes the secret permanently, without the // possibility of recovery. This operation can only be performed on a soft-delete enabled vault. This operation // requires the storage/purge permission. // Parameters: // vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. // storageAccountName - the name of the storage account. -func (client BaseClient) PurgeDeletedStorgeAccount(ctx context.Context, vaultBaseURL string, storageAccountName string) (result autorest.Response, err error) { +func (client BaseClient) PurgeDeletedStorageAccount(ctx context.Context, vaultBaseURL string, storageAccountName string) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: storageAccountName, Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("keyvault.BaseClient", "PurgeDeletedStorgeAccount", err.Error()) + return result, validation.NewError("keyvault.BaseClient", "PurgeDeletedStorageAccount", err.Error()) } - req, err := client.PurgeDeletedStorgeAccountPreparer(ctx, vaultBaseURL, storageAccountName) + req, err := client.PurgeDeletedStorageAccountPreparer(ctx, vaultBaseURL, storageAccountName) if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedStorgeAccount", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedStorageAccount", nil, "Failure preparing request") return } - resp, err := client.PurgeDeletedStorgeAccountSender(req) + resp, err := client.PurgeDeletedStorageAccountSender(req) if err != nil { result.Response = resp - err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedStorgeAccount", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedStorageAccount", resp, "Failure sending request") return } - result, err = client.PurgeDeletedStorgeAccountResponder(resp) + result, err = client.PurgeDeletedStorageAccountResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedStorgeAccount", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedStorageAccount", resp, "Failure responding to request") } return } -// PurgeDeletedStorgeAccountPreparer prepares the PurgeDeletedStorgeAccount request. -func (client BaseClient) PurgeDeletedStorgeAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string) (*http.Request, error) { +// PurgeDeletedStorageAccountPreparer prepares the PurgeDeletedStorageAccount request. +func (client BaseClient) PurgeDeletedStorageAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string) (*http.Request, error) { urlParameters := map[string]interface{}{ "vaultBaseUrl": vaultBaseURL, } @@ -4234,16 +4312,16 @@ func (client BaseClient) PurgeDeletedStorgeAccountPreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// PurgeDeletedStorgeAccountSender sends the PurgeDeletedStorgeAccount request. The method will close the +// PurgeDeletedStorageAccountSender sends the PurgeDeletedStorageAccount request. The method will close the // http.Response Body if it receives an error. -func (client BaseClient) PurgeDeletedStorgeAccountSender(req *http.Request) (*http.Response, error) { +func (client BaseClient) PurgeDeletedStorageAccountSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// PurgeDeletedStorgeAccountResponder handles the response to the PurgeDeletedStorgeAccount request. The method always +// PurgeDeletedStorageAccountResponder handles the response to the PurgeDeletedStorageAccount request. The method always // closes the http.Response Body. -func (client BaseClient) PurgeDeletedStorgeAccountResponder(resp *http.Response) (result autorest.Response, err error) { +func (client BaseClient) PurgeDeletedStorageAccountResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -4703,6 +4781,80 @@ func (client BaseClient) RegenerateStorageAccountKeyResponder(resp *http.Respons return } +// RestoreCertificate restores a backed up certificate, and all its versions, to a vault. This operation requires the +// certificates/restore permission. +// Parameters: +// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. +// parameters - the parameters to restore the certificate. +func (client BaseClient) RestoreCertificate(ctx context.Context, vaultBaseURL string, parameters CertificateRestoreParameters) (result CertificateBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.CertificateBundleBackup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.BaseClient", "RestoreCertificate", err.Error()) + } + + req, err := client.RestoreCertificatePreparer(ctx, vaultBaseURL, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.RestoreCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreCertificate", resp, "Failure sending request") + return + } + + result, err = client.RestoreCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreCertificate", resp, "Failure responding to request") + } + + return +} + +// RestoreCertificatePreparer prepares the RestoreCertificate request. +func (client BaseClient) RestoreCertificatePreparer(ctx context.Context, vaultBaseURL string, parameters CertificateRestoreParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "7.0-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/certificates/restore"), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestoreCertificateSender sends the RestoreCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) RestoreCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// RestoreCertificateResponder handles the response to the RestoreCertificate request. The method always +// closes the http.Response Body. +func (client BaseClient) RestoreCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // RestoreKey imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, // attributes and access control policies. The RESTORE operation may be used to import a previously backed up key. // Individual versions of a key cannot be restored. The key is restored in its entirety with the same key name as it diff --git a/services/preview/keyvault/v7.0/keyvault/models.go b/services/preview/keyvault/v7.0/keyvault/models.go index 19d37b0a5f19..e8e885195f25 100644 --- a/services/preview/keyvault/v7.0/keyvault/models.go +++ b/services/preview/keyvault/v7.0/keyvault/models.go @@ -63,19 +63,19 @@ func PossibleDeletionRecoveryLevelValues() []DeletionRecoveryLevel { type JSONWebKeyCurveName string const ( - // P256 ... + // P256 The NIST P-256 elliptic curve, AKA SECG curve SECP256R1. P256 JSONWebKeyCurveName = "P-256" - // P384 ... + // P256K The SECG SECP256K1 elliptic curve. + P256K JSONWebKeyCurveName = "P-256K" + // P384 The NIST P-384 elliptic curve, AKA SECG curve SECP384R1. P384 JSONWebKeyCurveName = "P-384" - // P521 ... + // P521 The NIST P-521 elliptic curve, AKA SECG curve SECP521R1. P521 JSONWebKeyCurveName = "P-521" - // SECP256K1 ... - SECP256K1 JSONWebKeyCurveName = "SECP256K1" ) // PossibleJSONWebKeyCurveNameValues returns an array of possible values for the JSONWebKeyCurveName const type. func PossibleJSONWebKeyCurveNameValues() []JSONWebKeyCurveName { - return []JSONWebKeyCurveName{P256, P384, P521, SECP256K1} + return []JSONWebKeyCurveName{P256, P256K, P384, P521} } // JSONWebKeyEncryptionAlgorithm enumerates the values for json web key encryption algorithm. @@ -122,48 +122,51 @@ func PossibleJSONWebKeyOperationValues() []JSONWebKeyOperation { type JSONWebKeySignatureAlgorithm string const ( - // ECDSA256 ... - ECDSA256 JSONWebKeySignatureAlgorithm = "ECDSA256" - // ES256 ... + // ES256 ECDSA using P-256 and SHA-256, as described in https://tools.ietf.org/html/rfc7518. ES256 JSONWebKeySignatureAlgorithm = "ES256" - // ES384 ... + // ES256K ECDSA using P-256K and SHA-256, as described in https://tools.ietf.org/html/rfc7518 + ES256K JSONWebKeySignatureAlgorithm = "ES256K" + // ES384 ECDSA using P-384 and SHA-384, as described in https://tools.ietf.org/html/rfc7518 ES384 JSONWebKeySignatureAlgorithm = "ES384" - // ES512 ... + // ES512 ECDSA using P-521 and SHA-512, as described in https://tools.ietf.org/html/rfc7518 ES512 JSONWebKeySignatureAlgorithm = "ES512" - // PS256 ... + // PS256 RSASSA-PSS using SHA-256 and MGF1 with SHA-256, as described in + // https://tools.ietf.org/html/rfc7518 PS256 JSONWebKeySignatureAlgorithm = "PS256" - // PS384 ... + // PS384 RSASSA-PSS using SHA-384 and MGF1 with SHA-384, as described in + // https://tools.ietf.org/html/rfc7518 PS384 JSONWebKeySignatureAlgorithm = "PS384" - // PS512 ... + // PS512 RSASSA-PSS using SHA-512 and MGF1 with SHA-512, as described in + // https://tools.ietf.org/html/rfc7518 PS512 JSONWebKeySignatureAlgorithm = "PS512" - // RS256 ... + // RS256 RSASSA-PKCS1-v1_5 using SHA-256, as described in https://tools.ietf.org/html/rfc7518 RS256 JSONWebKeySignatureAlgorithm = "RS256" - // RS384 ... + // RS384 RSASSA-PKCS1-v1_5 using SHA-384, as described in https://tools.ietf.org/html/rfc7518 RS384 JSONWebKeySignatureAlgorithm = "RS384" - // RS512 ... + // RS512 RSASSA-PKCS1-v1_5 using SHA-512, as described in https://tools.ietf.org/html/rfc7518 RS512 JSONWebKeySignatureAlgorithm = "RS512" - // RSNULL ... + // RSNULL Reserved RSNULL JSONWebKeySignatureAlgorithm = "RSNULL" ) // PossibleJSONWebKeySignatureAlgorithmValues returns an array of possible values for the JSONWebKeySignatureAlgorithm const type. func PossibleJSONWebKeySignatureAlgorithmValues() []JSONWebKeySignatureAlgorithm { - return []JSONWebKeySignatureAlgorithm{ECDSA256, ES256, ES384, ES512, PS256, PS384, PS512, RS256, RS384, RS512, RSNULL} + return []JSONWebKeySignatureAlgorithm{ES256, ES256K, ES384, ES512, PS256, PS384, PS512, RS256, RS384, RS512, RSNULL} } // JSONWebKeyType enumerates the values for json web key type. type JSONWebKeyType string const ( - // EC ... + // EC Elliptic Curve. EC JSONWebKeyType = "EC" - // ECHSM ... + // ECHSM Elliptic Curve with a private key which is not exportable from the HSM. ECHSM JSONWebKeyType = "EC-HSM" - // Oct ... + // Oct Octet sequence (used to represent symmetric keys) Oct JSONWebKeyType = "oct" - // RSA ... + // RSA RSA (https://tools.ietf.org/html/rfc3447) RSA JSONWebKeyType = "RSA" - // RSAHSM ... + // RSAHSM RSA with a private key which is not exportable from the HSM. RSAHSM JSONWebKeyType = "RSA-HSM" ) @@ -248,6 +251,13 @@ type Attributes struct { Updated *date.UnixTime `json:"updated,omitempty"` } +// BackupCertificateResult the backup certificate result, containing the backup blob. +type BackupCertificateResult struct { + autorest.Response `json:"-"` + // Value - The backup blob containing the backed up certificate. + Value *string `json:"value,omitempty"` +} + // BackupKeyResult the backup key result, containing the backup blob. type BackupKeyResult struct { autorest.Response `json:"-"` @@ -740,6 +750,12 @@ type CertificatePolicy struct { Attributes *CertificateAttributes `json:"attributes,omitempty"` } +// CertificateRestoreParameters the certificate restore parameters. +type CertificateRestoreParameters struct { + // CertificateBundleBackup - The backup blob associated with a certificate bundle. + CertificateBundleBackup *string `json:"value,omitempty"` +} + // CertificateUpdateParameters the certificate update parameters. type CertificateUpdateParameters struct { // CertificatePolicy - The management policy for the certificate. @@ -1882,13 +1898,15 @@ type IssuerParameters struct { Name *string `json:"name,omitempty"` // CertificateType - Type of certificate to be requested from the issuer provider. CertificateType *string `json:"cty,omitempty"` + // CertificateTransparency - Indicates if the certificates generated under this policy should be published to certificate transparency logs. + CertificateTransparency *bool `json:"cert_transparency,omitempty"` } // JSONWebKey as of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18 type JSONWebKey struct { // Kid - Key identifier. Kid *string `json:"kid,omitempty"` - // Kty - JsonWebKey key type (kty). Possible values include: 'EC', 'ECHSM', 'RSA', 'RSAHSM', 'Oct' + // Kty - JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Possible values include: 'EC', 'ECHSM', 'RSA', 'RSAHSM', 'Oct' Kty JSONWebKeyType `json:"kty,omitempty"` KeyOps *[]string `json:"key_ops,omitempty"` // N - RSA modulus. @@ -1911,7 +1929,7 @@ type JSONWebKey struct { K *string `json:"k,omitempty"` // T - HSM Token, used with 'Bring Your Own Key'. T *string `json:"key_hsm,omitempty"` - // Crv - Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values include: 'P256', 'P384', 'P521', 'SECP256K1' + // Crv - Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values include: 'P256', 'P384', 'P521', 'P256K' Crv JSONWebKeyCurveName `json:"crv,omitempty"` // X - X component of an EC public key. X *string `json:"x,omitempty"` @@ -1970,13 +1988,13 @@ func (kb KeyBundle) MarshalJSON() ([]byte, error) { type KeyCreateParameters struct { // Kty - The type of key to create. For valid values, see JsonWebKeyType. Possible values include: 'EC', 'ECHSM', 'RSA', 'RSAHSM', 'Oct' Kty JSONWebKeyType `json:"kty,omitempty"` - // KeySize - The key size in bytes. For example, 1024 or 2048. + // KeySize - The key size in bits. For example: 2048, 3072, or 4096 for RSA. KeySize *int32 `json:"key_size,omitempty"` KeyOps *[]JSONWebKeyOperation `json:"key_ops,omitempty"` KeyAttributes *KeyAttributes `json:"attributes,omitempty"` // Tags - Application specific metadata in the form of key-value pairs. Tags map[string]*string `json:"tags"` - // Curve - Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values include: 'P256', 'P384', 'P521', 'SECP256K1' + // Curve - Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values include: 'P256', 'P384', 'P521', 'P256K' Curve JSONWebKeyCurveName `json:"crv,omitempty"` } @@ -2185,12 +2203,14 @@ type KeyOperationsParameters struct { type KeyProperties struct { // Exportable - Indicates if the private key can be exported. Exportable *bool `json:"exportable,omitempty"` - // KeyType - The key type. - KeyType *string `json:"kty,omitempty"` - // KeySize - The key size in bytes. For example; 1024 or 2048. + // Kty - The type of key pair to be used for the certificate. Possible values include: 'EC', 'ECHSM', 'RSA', 'RSAHSM', 'Oct' + Kty JSONWebKeyType `json:"kty,omitempty"` + // KeySize - The key size in bits. For example: 2048, 3072, or 4096 for RSA. KeySize *int32 `json:"key_size,omitempty"` // ReuseKey - Indicates if the same key pair will be used on certificate renewal. ReuseKey *bool `json:"reuse_key,omitempty"` + // Curve - Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values include: 'P256', 'P384', 'P521', 'P256K' + Curve JSONWebKeyCurveName `json:"crv,omitempty"` } // KeyRestoreParameters the key restore parameters. @@ -2201,7 +2221,7 @@ type KeyRestoreParameters struct { // KeySignParameters the key operations parameters. type KeySignParameters struct { - // Algorithm - The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', 'ECDSA256' + // Algorithm - The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', 'ES256K' Algorithm JSONWebKeySignatureAlgorithm `json:"alg,omitempty"` Value *string `json:"value,omitempty"` } @@ -2232,7 +2252,7 @@ func (kup KeyUpdateParameters) MarshalJSON() ([]byte, error) { // KeyVerifyParameters the key verify parameters. type KeyVerifyParameters struct { - // Algorithm - The signing/verification algorithm. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', 'ECDSA256' + // Algorithm - The signing/verification algorithm. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', 'ES256K' Algorithm JSONWebKeySignatureAlgorithm `json:"alg,omitempty"` // Digest - The digest used for signing. Digest *string `json:"digest,omitempty"`