From 31c0e81058f6747195085b52132e0be30f9c1cf7 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 4 Dec 2020 23:56:49 +0000 Subject: [PATCH] CodeGen from PR 11464 in Azure/azure-rest-api-specs Microsoft.key vault dp 7.3 preview (#11464) * Update Swagger for key rotation * Update api version * Fixed build error * Fixed model validation in keys * Fixed model validation error in certificates * Add new version 7.3-preview based on 7.2-preview * Fixed lint error * Update api version tag * Revert changes --- services/keyvault/v7.0/keyvault/CHANGELOG.md | 34 + services/keyvault/v7.0/keyvault/client.go | 129 ++-- services/keyvault/v7.0/keyvault/enums.go | 240 +++++++ services/keyvault/v7.0/keyvault/models.go | 671 +++++++++++-------- services/keyvault/v7.0/keyvault/version.go | 2 +- 5 files changed, 717 insertions(+), 359 deletions(-) create mode 100644 services/keyvault/v7.0/keyvault/CHANGELOG.md create mode 100644 services/keyvault/v7.0/keyvault/enums.go diff --git a/services/keyvault/v7.0/keyvault/CHANGELOG.md b/services/keyvault/v7.0/keyvault/CHANGELOG.md new file mode 100644 index 000000000000..580e42521a8d --- /dev/null +++ b/services/keyvault/v7.0/keyvault/CHANGELOG.md @@ -0,0 +1,34 @@ +Generated from https://github.com/Azure/azure-rest-api-specs/tree/3c764635e7d442b3e74caf593029fcd440b3ef82 + +Code generator @microsoft.azure/autorest.go@~2.1.161 + +## Breaking Changes + +- Function `NewDeletedSasDefinitionListResultPage` parameter(s) have been changed from `(func(context.Context, DeletedSasDefinitionListResult) (DeletedSasDefinitionListResult, error))` to `(DeletedSasDefinitionListResult, func(context.Context, DeletedSasDefinitionListResult) (DeletedSasDefinitionListResult, error))` +- Function `NewKeyListResultPage` parameter(s) have been changed from `(func(context.Context, KeyListResult) (KeyListResult, error))` to `(KeyListResult, func(context.Context, KeyListResult) (KeyListResult, error))` +- Function `NewCertificateIssuerListResultPage` parameter(s) have been changed from `(func(context.Context, CertificateIssuerListResult) (CertificateIssuerListResult, error))` to `(CertificateIssuerListResult, func(context.Context, CertificateIssuerListResult) (CertificateIssuerListResult, error))` +- Function `NewSasDefinitionListResultPage` parameter(s) have been changed from `(func(context.Context, SasDefinitionListResult) (SasDefinitionListResult, error))` to `(SasDefinitionListResult, func(context.Context, SasDefinitionListResult) (SasDefinitionListResult, error))` +- Function `NewDeletedStorageListResultPage` parameter(s) have been changed from `(func(context.Context, DeletedStorageListResult) (DeletedStorageListResult, error))` to `(DeletedStorageListResult, func(context.Context, DeletedStorageListResult) (DeletedStorageListResult, error))` +- Function `NewSecretListResultPage` parameter(s) have been changed from `(func(context.Context, SecretListResult) (SecretListResult, error))` to `(SecretListResult, func(context.Context, SecretListResult) (SecretListResult, error))` +- Function `NewDeletedCertificateListResultPage` parameter(s) have been changed from `(func(context.Context, DeletedCertificateListResult) (DeletedCertificateListResult, error))` to `(DeletedCertificateListResult, func(context.Context, DeletedCertificateListResult) (DeletedCertificateListResult, error))` +- Function `NewDeletedKeyListResultPage` parameter(s) have been changed from `(func(context.Context, DeletedKeyListResult) (DeletedKeyListResult, error))` to `(DeletedKeyListResult, func(context.Context, DeletedKeyListResult) (DeletedKeyListResult, error))` +- Function `NewDeletedSecretListResultPage` parameter(s) have been changed from `(func(context.Context, DeletedSecretListResult) (DeletedSecretListResult, error))` to `(DeletedSecretListResult, func(context.Context, DeletedSecretListResult) (DeletedSecretListResult, error))` +- Function `NewCertificateListResultPage` parameter(s) have been changed from `(func(context.Context, CertificateListResult) (CertificateListResult, error))` to `(CertificateListResult, func(context.Context, CertificateListResult) (CertificateListResult, error))` +- Function `NewStorageListResultPage` parameter(s) have been changed from `(func(context.Context, StorageListResult) (StorageListResult, error))` to `(StorageListResult, func(context.Context, StorageListResult) (StorageListResult, error))` + +## New Content + +- New const `CustomizedRecoverablePurgeable` +- New const `CustomizedRecoverableProtectedSubscription` +- New const `CustomizedRecoverable` +- New function `IssuerBundle.MarshalJSON() ([]byte, error)` +- New function `CertificatePolicy.MarshalJSON() ([]byte, error)` +- New function `IssuerAttributes.MarshalJSON() ([]byte, error)` +- New function `Attributes.MarshalJSON() ([]byte, error)` +- New function `SecretAttributes.MarshalJSON() ([]byte, error)` +- New function `SasDefinitionAttributes.MarshalJSON() ([]byte, error)` +- New function `CertificateOperation.MarshalJSON() ([]byte, error)` +- New function `CertificateAttributes.MarshalJSON() ([]byte, error)` +- New function `Contacts.MarshalJSON() ([]byte, error)` +- New function `KeyAttributes.MarshalJSON() ([]byte, error)` +- New function `StorageAccountAttributes.MarshalJSON() ([]byte, error)` diff --git a/services/keyvault/v7.0/keyvault/client.go b/services/keyvault/v7.0/keyvault/client.go index 390080f9d8b6..2b2fc0865218 100644 --- a/services/keyvault/v7.0/keyvault/client.go +++ b/services/keyvault/v7.0/keyvault/client.go @@ -117,7 +117,6 @@ func (client BaseClient) BackupCertificateSender(req *http.Request) (*http.Respo 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()) @@ -203,7 +202,6 @@ func (client BaseClient) BackupKeySender(req *http.Request) (*http.Response, err 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()) @@ -282,7 +280,6 @@ func (client BaseClient) BackupSecretSender(req *http.Request) (*http.Response, 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()) @@ -361,7 +358,6 @@ func (client BaseClient) BackupStorageAccountSender(req *http.Request) (*http.Re 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()) @@ -456,7 +452,6 @@ func (client BaseClient) CreateCertificateSender(req *http.Request) (*http.Respo 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()) @@ -544,7 +539,6 @@ func (client BaseClient) CreateKeySender(req *http.Request) (*http.Response, err 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()) @@ -637,7 +631,6 @@ func (client BaseClient) DecryptSender(req *http.Request) (*http.Response, error 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()) @@ -717,7 +710,6 @@ func (client BaseClient) DeleteCertificateSender(req *http.Request) (*http.Respo 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()) @@ -791,7 +783,6 @@ func (client BaseClient) DeleteCertificateContactsSender(req *http.Request) (*ht 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()) @@ -870,7 +861,6 @@ func (client BaseClient) DeleteCertificateIssuerSender(req *http.Request) (*http 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()) @@ -949,7 +939,6 @@ func (client BaseClient) DeleteCertificateOperationSender(req *http.Request) (*h 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()) @@ -1029,7 +1018,6 @@ func (client BaseClient) DeleteKeySender(req *http.Request) (*http.Response, err 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()) @@ -1118,7 +1106,6 @@ func (client BaseClient) DeleteSasDefinitionSender(req *http.Request) (*http.Res 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()) @@ -1197,7 +1184,6 @@ func (client BaseClient) DeleteSecretSender(req *http.Request) (*http.Response, 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()) @@ -1281,7 +1267,6 @@ func (client BaseClient) DeleteStorageAccountSender(req *http.Request) (*http.Re 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()) @@ -1376,7 +1361,6 @@ func (client BaseClient) EncryptSender(req *http.Request) (*http.Response, error 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()) @@ -1389,7 +1373,8 @@ func (client BaseClient) EncryptResponder(resp *http.Response) (result KeyOperat // 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. +// certificateVersion - the version of the certificate. This URI fragment is optional. If not specified, the +// latest version of the certificate is returned. func (client BaseClient) GetCertificate(ctx context.Context, vaultBaseURL string, certificateName string, certificateVersion string) (result CertificateBundle, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificate") @@ -1457,7 +1442,6 @@ func (client BaseClient) GetCertificateSender(req *http.Request) (*http.Response 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()) @@ -1531,7 +1515,6 @@ func (client BaseClient) GetCertificateContactsSender(req *http.Request) (*http. 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()) @@ -1610,7 +1593,6 @@ func (client BaseClient) GetCertificateIssuerSender(req *http.Request) (*http.Re 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()) @@ -1662,6 +1644,9 @@ func (client BaseClient) GetCertificateIssuers(ctx context.Context, vaultBaseURL if err != nil { err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateIssuers", resp, "Failure responding to request") } + if result.cilr.hasNextLink() && result.cilr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -1699,7 +1684,6 @@ func (client BaseClient) GetCertificateIssuersSender(req *http.Request) (*http.R 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()) @@ -1815,7 +1799,6 @@ func (client BaseClient) GetCertificateOperationSender(req *http.Request) (*http 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()) @@ -1894,7 +1877,6 @@ func (client BaseClient) GetCertificatePolicySender(req *http.Request) (*http.Re 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()) @@ -1947,6 +1929,9 @@ func (client BaseClient) GetCertificates(ctx context.Context, vaultBaseURL strin if err != nil { err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificates", resp, "Failure responding to request") } + if result.clr.hasNextLink() && result.clr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -1987,7 +1972,6 @@ func (client BaseClient) GetCertificatesSender(req *http.Request) (*http.Respons 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()) @@ -2077,6 +2061,9 @@ func (client BaseClient) GetCertificateVersions(ctx context.Context, vaultBaseUR if err != nil { err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateVersions", resp, "Failure responding to request") } + if result.clr.hasNextLink() && result.clr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -2118,7 +2105,6 @@ func (client BaseClient) GetCertificateVersionsSender(req *http.Request) (*http. 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()) @@ -2235,7 +2221,6 @@ func (client BaseClient) GetDeletedCertificateSender(req *http.Request) (*http.R 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()) @@ -2290,6 +2275,9 @@ func (client BaseClient) GetDeletedCertificates(ctx context.Context, vaultBaseUR if err != nil { err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedCertificates", resp, "Failure responding to request") } + if result.dclr.hasNextLink() && result.dclr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -2330,7 +2318,6 @@ func (client BaseClient) GetDeletedCertificatesSender(req *http.Request) (*http. 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()) @@ -2447,7 +2434,6 @@ func (client BaseClient) GetDeletedKeySender(req *http.Request) (*http.Response, 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()) @@ -2501,6 +2487,9 @@ func (client BaseClient) GetDeletedKeys(ctx context.Context, vaultBaseURL string if err != nil { err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedKeys", resp, "Failure responding to request") } + if result.dklr.hasNextLink() && result.dklr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -2538,7 +2527,6 @@ func (client BaseClient) GetDeletedKeysSender(req *http.Request) (*http.Response 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()) @@ -2664,7 +2652,6 @@ func (client BaseClient) GetDeletedSasDefinitionSender(req *http.Request) (*http 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()) @@ -2719,6 +2706,9 @@ func (client BaseClient) GetDeletedSasDefinitions(ctx context.Context, vaultBase if err != nil { err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSasDefinitions", resp, "Failure responding to request") } + if result.dsdlr.hasNextLink() && result.dsdlr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -2760,7 +2750,6 @@ func (client BaseClient) GetDeletedSasDefinitionsSender(req *http.Request) (*htt 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()) @@ -2876,7 +2865,6 @@ func (client BaseClient) GetDeletedSecretSender(req *http.Request) (*http.Respon 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()) @@ -2928,6 +2916,9 @@ func (client BaseClient) GetDeletedSecrets(ctx context.Context, vaultBaseURL str if err != nil { err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSecrets", resp, "Failure responding to request") } + if result.dslr.hasNextLink() && result.dslr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -2965,7 +2956,6 @@ func (client BaseClient) GetDeletedSecretsSender(req *http.Request) (*http.Respo 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()) @@ -3087,7 +3077,6 @@ func (client BaseClient) GetDeletedStorageAccountSender(req *http.Request) (*htt 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()) @@ -3139,6 +3128,9 @@ func (client BaseClient) GetDeletedStorageAccounts(ctx context.Context, vaultBas if err != nil { err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedStorageAccounts", resp, "Failure responding to request") } + if result.dslr.hasNextLink() && result.dslr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -3176,7 +3168,6 @@ func (client BaseClient) GetDeletedStorageAccountsSender(req *http.Request) (*ht 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()) @@ -3226,7 +3217,8 @@ func (client BaseClient) GetDeletedStorageAccountsComplete(ctx context.Context, // 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. +// keyVersion - adding the version parameter retrieves a specific version of a key. This URI fragment is +// optional. If not specified, the latest version of the key is returned. func (client BaseClient) GetKey(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string) (result KeyBundle, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetKey") @@ -3294,7 +3286,6 @@ func (client BaseClient) GetKeySender(req *http.Request) (*http.Response, error) 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()) @@ -3348,6 +3339,9 @@ func (client BaseClient) GetKeys(ctx context.Context, vaultBaseURL string, maxre if err != nil { err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKeys", resp, "Failure responding to request") } + if result.klr.hasNextLink() && result.klr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -3385,7 +3379,6 @@ func (client BaseClient) GetKeysSender(req *http.Request) (*http.Response, error 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()) @@ -3475,6 +3468,9 @@ func (client BaseClient) GetKeyVersions(ctx context.Context, vaultBaseURL string if err != nil { err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKeyVersions", resp, "Failure responding to request") } + if result.klr.hasNextLink() && result.klr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -3516,7 +3512,6 @@ func (client BaseClient) GetKeyVersionsSender(req *http.Request) (*http.Response 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()) @@ -3642,7 +3637,6 @@ func (client BaseClient) GetSasDefinitionSender(req *http.Request) (*http.Respon 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()) @@ -3697,6 +3691,9 @@ func (client BaseClient) GetSasDefinitions(ctx context.Context, vaultBaseURL str if err != nil { err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSasDefinitions", resp, "Failure responding to request") } + if result.sdlr.hasNextLink() && result.sdlr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -3738,7 +3735,6 @@ func (client BaseClient) GetSasDefinitionsSender(req *http.Request) (*http.Respo 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()) @@ -3788,7 +3784,8 @@ func (client BaseClient) GetSasDefinitionsComplete(ctx context.Context, vaultBas // Parameters: // vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. // secretName - the name of the secret. -// secretVersion - the version of the secret. +// secretVersion - the version of the secret. This URI fragment is optional. If not specified, the latest +// version of the secret is returned. func (client BaseClient) GetSecret(ctx context.Context, vaultBaseURL string, secretName string, secretVersion string) (result SecretBundle, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetSecret") @@ -3856,7 +3853,6 @@ func (client BaseClient) GetSecretSender(req *http.Request) (*http.Response, err 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()) @@ -3909,6 +3905,9 @@ func (client BaseClient) GetSecrets(ctx context.Context, vaultBaseURL string, ma if err != nil { err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecrets", resp, "Failure responding to request") } + if result.slr.hasNextLink() && result.slr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -3946,7 +3945,6 @@ func (client BaseClient) GetSecretsSender(req *http.Request) (*http.Response, er 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()) @@ -4036,6 +4034,9 @@ func (client BaseClient) GetSecretVersions(ctx context.Context, vaultBaseURL str if err != nil { err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecretVersions", resp, "Failure responding to request") } + if result.slr.hasNextLink() && result.slr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -4077,7 +4078,6 @@ func (client BaseClient) GetSecretVersionsSender(req *http.Request) (*http.Respo 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()) @@ -4199,7 +4199,6 @@ func (client BaseClient) GetStorageAccountSender(req *http.Request) (*http.Respo 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()) @@ -4251,6 +4250,9 @@ func (client BaseClient) GetStorageAccounts(ctx context.Context, vaultBaseURL st if err != nil { err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetStorageAccounts", resp, "Failure responding to request") } + if result.slr.hasNextLink() && result.slr.IsEmpty() { + err = result.NextWithContext(ctx) + } return } @@ -4288,7 +4290,6 @@ func (client BaseClient) GetStorageAccountsSender(req *http.Request) (*http.Resp 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()) @@ -4422,7 +4423,6 @@ func (client BaseClient) ImportCertificateSender(req *http.Request) (*http.Respo 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()) @@ -4513,7 +4513,6 @@ func (client BaseClient) ImportKeySender(req *http.Request) (*http.Response, err 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()) @@ -4601,7 +4600,6 @@ func (client BaseClient) MergeCertificateSender(req *http.Request) (*http.Respon 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()) @@ -4681,7 +4679,6 @@ func (client BaseClient) PurgeDeletedCertificateSender(req *http.Request) (*http 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 @@ -4760,7 +4757,6 @@ func (client BaseClient) PurgeDeletedKeySender(req *http.Request) (*http.Respons 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 @@ -4839,7 +4835,6 @@ func (client BaseClient) PurgeDeletedSecretSender(req *http.Request) (*http.Resp 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 @@ -4924,7 +4919,6 @@ func (client BaseClient) PurgeDeletedStorageAccountSender(req *http.Request) (*h 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 @@ -5003,7 +4997,6 @@ func (client BaseClient) RecoverDeletedCertificateSender(req *http.Request) (*ht 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()) @@ -5084,7 +5077,6 @@ func (client BaseClient) RecoverDeletedKeySender(req *http.Request) (*http.Respo 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()) @@ -5173,7 +5165,6 @@ func (client BaseClient) RecoverDeletedSasDefinitionSender(req *http.Request) (* 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()) @@ -5252,7 +5243,6 @@ func (client BaseClient) RecoverDeletedSecretSender(req *http.Request) (*http.Re 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()) @@ -5337,7 +5327,6 @@ func (client BaseClient) RecoverDeletedStorageAccountSender(req *http.Request) ( 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()) @@ -5427,7 +5416,6 @@ func (client BaseClient) RegenerateStorageAccountKeySender(req *http.Request) (* 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()) @@ -5510,7 +5498,6 @@ func (client BaseClient) RestoreCertificateSender(req *http.Request) (*http.Resp 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()) @@ -5600,7 +5587,6 @@ func (client BaseClient) RestoreKeySender(req *http.Request) (*http.Response, er 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()) @@ -5683,7 +5669,6 @@ func (client BaseClient) RestoreSecretSender(req *http.Request) (*http.Response, 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()) @@ -5766,7 +5751,6 @@ func (client BaseClient) RestoreStorageAccountSender(req *http.Request) (*http.R 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()) @@ -5844,7 +5828,6 @@ func (client BaseClient) SetCertificateContactsSender(req *http.Request) (*http. 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()) @@ -5932,7 +5915,6 @@ func (client BaseClient) SetCertificateIssuerSender(req *http.Request) (*http.Re 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()) @@ -6027,7 +6009,6 @@ func (client BaseClient) SetSasDefinitionSender(req *http.Request) (*http.Respon 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()) @@ -6117,7 +6098,6 @@ func (client BaseClient) SetSecretSender(req *http.Request) (*http.Response, err 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()) @@ -6208,7 +6188,6 @@ func (client BaseClient) SetStorageAccountSender(req *http.Request) (*http.Respo 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()) @@ -6298,7 +6277,6 @@ func (client BaseClient) SignSender(req *http.Request) (*http.Response, error) { 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()) @@ -6390,7 +6368,6 @@ func (client BaseClient) UnwrapKeySender(req *http.Request) (*http.Response, err 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()) @@ -6474,7 +6451,6 @@ func (client BaseClient) UpdateCertificateSender(req *http.Request) (*http.Respo 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()) @@ -6556,7 +6532,6 @@ func (client BaseClient) UpdateCertificateIssuerSender(req *http.Request) (*http 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()) @@ -6638,7 +6613,6 @@ func (client BaseClient) UpdateCertificateOperationSender(req *http.Request) (*h 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()) @@ -6721,7 +6695,6 @@ func (client BaseClient) UpdateCertificatePolicySender(req *http.Request) (*http 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()) @@ -6805,7 +6778,6 @@ func (client BaseClient) UpdateKeySender(req *http.Request) (*http.Response, err 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()) @@ -6897,7 +6869,6 @@ func (client BaseClient) UpdateSasDefinitionSender(req *http.Request) (*http.Res 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()) @@ -6982,7 +6953,6 @@ func (client BaseClient) UpdateSecretSender(req *http.Request) (*http.Response, 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()) @@ -7070,7 +7040,6 @@ func (client BaseClient) UpdateStorageAccountSender(req *http.Request) (*http.Re 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()) @@ -7163,7 +7132,6 @@ func (client BaseClient) VerifySender(req *http.Request) (*http.Response, error) 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()) @@ -7256,7 +7224,6 @@ func (client BaseClient) WrapKeySender(req *http.Request) (*http.Response, error 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()) diff --git a/services/keyvault/v7.0/keyvault/enums.go b/services/keyvault/v7.0/keyvault/enums.go new file mode 100644 index 000000000000..fbc94bc147b7 --- /dev/null +++ b/services/keyvault/v7.0/keyvault/enums.go @@ -0,0 +1,240 @@ +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. + +// 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 ( + // CustomizedRecoverable Denotes a vault state in which deletion is recoverable without the possibility for + // immediate and permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90).This level + // guarantees the recoverability of the deleted entity during the retention interval and while the + // subscription is still available. + CustomizedRecoverable DeletionRecoveryLevel = "CustomizedRecoverable" + // CustomizedRecoverableProtectedSubscription Denotes a vault and subscription state in which deletion is + // recoverable, immediate and permanent deletion (i.e. purge) is not permitted, and in which the + // subscription itself cannot be permanently canceled when 7<= SoftDeleteRetentionInDays < 90. This level + // guarantees the recoverability of the deleted entity during the retention interval, and also reflects the + // fact that the subscription itself cannot be cancelled. + CustomizedRecoverableProtectedSubscription DeletionRecoveryLevel = "CustomizedRecoverable+ProtectedSubscription" + // CustomizedRecoverablePurgeable Denotes a vault state in which deletion is recoverable, and which also + // permits immediate and permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90). This + // level guarantees the recoverability of the deleted entity during the retention interval, unless a Purge + // operation is requested, or the subscription is cancelled. + CustomizedRecoverablePurgeable DeletionRecoveryLevel = "CustomizedRecoverable+Purgeable" + // Purgeable Denotes a vault state in which deletion is an irreversible operation, without the possibility + // for recovery. This level corresponds to no protection being available against a Delete operation; the + // data is irretrievably lost upon accepting a Delete operation at the entity level or higher (vault, + // resource group, subscription etc.) + Purgeable DeletionRecoveryLevel = "Purgeable" + // Recoverable Denotes a vault state in which deletion is recoverable without the possibility for immediate + // and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity + // during the retention interval(90 days) and while the subscription is still available. System wil + // permanently delete it after 90 days, if not recovered + Recoverable DeletionRecoveryLevel = "Recoverable" + // RecoverableProtectedSubscription Denotes a vault and subscription state in which deletion is recoverable + // within retention interval (90 days), immediate and permanent deletion (i.e. purge) is not permitted, and + // in which the subscription itself cannot be permanently canceled. System wil permanently delete it after + // 90 days, if not recovered + RecoverableProtectedSubscription DeletionRecoveryLevel = "Recoverable+ProtectedSubscription" + // RecoverablePurgeable Denotes a vault state in which deletion is recoverable, and which also permits + // immediate and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted + // entity during the retention interval (90 days), unless a Purge operation is requested, or the + // subscription is cancelled. System wil permanently delete it after 90 days, if not recovered + RecoverablePurgeable DeletionRecoveryLevel = "Recoverable+Purgeable" +) + +// PossibleDeletionRecoveryLevelValues returns an array of possible values for the DeletionRecoveryLevel const type. +func PossibleDeletionRecoveryLevelValues() []DeletionRecoveryLevel { + return []DeletionRecoveryLevel{CustomizedRecoverable, CustomizedRecoverableProtectedSubscription, CustomizedRecoverablePurgeable, 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 Not supported in this version. 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} +} diff --git a/services/keyvault/v7.0/keyvault/models.go b/services/keyvault/v7.0/keyvault/models.go index a57e7269b15e..cb4f46bb428e 100644 --- a/services/keyvault/v7.0/keyvault/models.go +++ b/services/keyvault/v7.0/keyvault/models.go @@ -30,200 +30,6 @@ import ( // The package's fully qualified name. const fqdn = "github.com/Azure/azure-sdk-for-go/services/keyvault/v7.0/keyvault" -// 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' @@ -256,6 +62,21 @@ type Attributes struct { Updated *date.UnixTime `json:"updated,omitempty"` } +// MarshalJSON is the custom marshaler for Attributes. +func (a Attributes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.Enabled != nil { + objectMap["enabled"] = a.Enabled + } + if a.NotBefore != nil { + objectMap["nbf"] = a.NotBefore + } + if a.Expires != nil { + objectMap["exp"] = a.Expires + } + return json.Marshal(objectMap) +} + // BackupCertificateResult the backup certificate result, containing the backup blob. type BackupCertificateResult struct { autorest.Response `json:"-"` @@ -286,7 +107,7 @@ type BackupStorageResult struct { // CertificateAttributes the certificate management attributes. type CertificateAttributes struct { - // RecoveryLevel - READ-ONLY; 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 - READ-ONLY; 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', 'CustomizedRecoverablePurgeable', 'CustomizedRecoverable', 'CustomizedRecoverableProtectedSubscription' RecoveryLevel DeletionRecoveryLevel `json:"recoveryLevel,omitempty"` // Enabled - Determines whether the object is enabled. Enabled *bool `json:"enabled,omitempty"` @@ -300,6 +121,21 @@ type CertificateAttributes struct { Updated *date.UnixTime `json:"updated,omitempty"` } +// MarshalJSON is the custom marshaler for CertificateAttributes. +func (ca CertificateAttributes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ca.Enabled != nil { + objectMap["enabled"] = ca.Enabled + } + if ca.NotBefore != nil { + objectMap["nbf"] = ca.NotBefore + } + if ca.Expires != nil { + objectMap["exp"] = ca.Expires + } + return json.Marshal(objectMap) +} + // CertificateBundle a certificate bundle consists of a certificate (X509) plus its attributes. type CertificateBundle struct { autorest.Response `json:"-"` @@ -368,7 +204,7 @@ func (ccp CertificateCreateParameters) MarshalJSON() ([]byte, error) { // 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 - A PEM file or a base64-encoded PFX file. PEM files need 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"` @@ -487,10 +323,15 @@ func (cilr CertificateIssuerListResult) IsEmpty() bool { return cilr.Value == nil || len(*cilr.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (cilr CertificateIssuerListResult) hasNextLink() bool { + return cilr.NextLink != nil && len(*cilr.NextLink) != 0 +} + // certificateIssuerListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (cilr CertificateIssuerListResult) certificateIssuerListResultPreparer(ctx context.Context) (*http.Request, error) { - if cilr.NextLink == nil || len(to.String(cilr.NextLink)) < 1 { + if !cilr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -518,11 +359,16 @@ func (page *CertificateIssuerListResultPage) NextWithContext(ctx context.Context tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.cilr) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.cilr) + if err != nil { + return err + } + page.cilr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.cilr = next return nil } @@ -552,8 +398,11 @@ func (page CertificateIssuerListResultPage) Values() []CertificateIssuerItem { } // Creates a new instance of the CertificateIssuerListResultPage type. -func NewCertificateIssuerListResultPage(getNextPage func(context.Context, CertificateIssuerListResult) (CertificateIssuerListResult, error)) CertificateIssuerListResultPage { - return CertificateIssuerListResultPage{fn: getNextPage} +func NewCertificateIssuerListResultPage(cur CertificateIssuerListResult, getNextPage func(context.Context, CertificateIssuerListResult) (CertificateIssuerListResult, error)) CertificateIssuerListResultPage { + return CertificateIssuerListResultPage{ + fn: getNextPage, + cilr: cur, + } } // CertificateIssuerSetParameters the certificate issuer set parameters. @@ -687,10 +536,15 @@ func (clr CertificateListResult) IsEmpty() bool { return clr.Value == nil || len(*clr.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (clr CertificateListResult) hasNextLink() bool { + return clr.NextLink != nil && len(*clr.NextLink) != 0 +} + // certificateListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (clr CertificateListResult) certificateListResultPreparer(ctx context.Context) (*http.Request, error) { - if clr.NextLink == nil || len(to.String(clr.NextLink)) < 1 { + if !clr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -718,11 +572,16 @@ func (page *CertificateListResultPage) NextWithContext(ctx context.Context) (err tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.clr) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.clr) + if err != nil { + return err + } + page.clr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.clr = next return nil } @@ -752,8 +611,11 @@ func (page CertificateListResultPage) Values() []CertificateItem { } // Creates a new instance of the CertificateListResultPage type. -func NewCertificateListResultPage(getNextPage func(context.Context, CertificateListResult) (CertificateListResult, error)) CertificateListResultPage { - return CertificateListResultPage{fn: getNextPage} +func NewCertificateListResultPage(cur CertificateListResult, getNextPage func(context.Context, CertificateListResult) (CertificateListResult, error)) CertificateListResultPage { + return CertificateListResultPage{ + fn: getNextPage, + clr: cur, + } } // CertificateMergeParameters the certificate merge parameters @@ -804,6 +666,36 @@ type CertificateOperation struct { RequestID *string `json:"request_id,omitempty"` } +// MarshalJSON is the custom marshaler for CertificateOperation. +func (co CertificateOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if co.IssuerParameters != nil { + objectMap["issuer"] = co.IssuerParameters + } + if co.Csr != nil { + objectMap["csr"] = co.Csr + } + if co.CancellationRequested != nil { + objectMap["cancellation_requested"] = co.CancellationRequested + } + if co.Status != nil { + objectMap["status"] = co.Status + } + if co.StatusDetails != nil { + objectMap["status_details"] = co.StatusDetails + } + if co.Error != nil { + objectMap["error"] = co.Error + } + if co.Target != nil { + objectMap["target"] = co.Target + } + if co.RequestID != nil { + objectMap["request_id"] = co.RequestID + } + return json.Marshal(objectMap) +} + // CertificateOperationUpdateParameter the certificate operation update parameters. type CertificateOperationUpdateParameter struct { // CancellationRequested - Indicates if cancellation was requested on the certificate operation. @@ -829,6 +721,30 @@ type CertificatePolicy struct { Attributes *CertificateAttributes `json:"attributes,omitempty"` } +// MarshalJSON is the custom marshaler for CertificatePolicy. +func (cp CertificatePolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cp.KeyProperties != nil { + objectMap["key_props"] = cp.KeyProperties + } + if cp.SecretProperties != nil { + objectMap["secret_props"] = cp.SecretProperties + } + if cp.X509CertificateProperties != nil { + objectMap["x509_props"] = cp.X509CertificateProperties + } + if cp.LifetimeActions != nil { + objectMap["lifetime_actions"] = cp.LifetimeActions + } + if cp.IssuerParameters != nil { + objectMap["issuer"] = cp.IssuerParameters + } + if cp.Attributes != nil { + objectMap["attributes"] = cp.Attributes + } + return json.Marshal(objectMap) +} + // CertificateRestoreParameters the certificate restore parameters. type CertificateRestoreParameters struct { // CertificateBundleBackup - The backup blob associated with a certificate bundle. (a URL-encoded base64 string) @@ -879,6 +795,15 @@ type Contacts struct { ContactList *[]Contact `json:"contacts,omitempty"` } +// MarshalJSON is the custom marshaler for Contacts. +func (c Contacts) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if c.ContactList != nil { + objectMap["contacts"] = c.ContactList + } + return json.Marshal(objectMap) +} + // 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 { @@ -1047,10 +972,15 @@ func (dclr DeletedCertificateListResult) IsEmpty() bool { return dclr.Value == nil || len(*dclr.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (dclr DeletedCertificateListResult) hasNextLink() bool { + return dclr.NextLink != nil && len(*dclr.NextLink) != 0 +} + // deletedCertificateListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (dclr DeletedCertificateListResult) deletedCertificateListResultPreparer(ctx context.Context) (*http.Request, error) { - if dclr.NextLink == nil || len(to.String(dclr.NextLink)) < 1 { + if !dclr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -1078,11 +1008,16 @@ func (page *DeletedCertificateListResultPage) NextWithContext(ctx context.Contex tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.dclr) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.dclr) + if err != nil { + return err + } + page.dclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.dclr = next return nil } @@ -1112,8 +1047,11 @@ func (page DeletedCertificateListResultPage) Values() []DeletedCertificateItem { } // Creates a new instance of the DeletedCertificateListResultPage type. -func NewDeletedCertificateListResultPage(getNextPage func(context.Context, DeletedCertificateListResult) (DeletedCertificateListResult, error)) DeletedCertificateListResultPage { - return DeletedCertificateListResultPage{fn: getNextPage} +func NewDeletedCertificateListResultPage(cur DeletedCertificateListResult, getNextPage func(context.Context, DeletedCertificateListResult) (DeletedCertificateListResult, error)) DeletedCertificateListResultPage { + return DeletedCertificateListResultPage{ + fn: getNextPage, + dclr: cur, + } } // DeletedKeyBundle a DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion info @@ -1266,10 +1204,15 @@ func (dklr DeletedKeyListResult) IsEmpty() bool { return dklr.Value == nil || len(*dklr.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (dklr DeletedKeyListResult) hasNextLink() bool { + return dklr.NextLink != nil && len(*dklr.NextLink) != 0 +} + // deletedKeyListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (dklr DeletedKeyListResult) deletedKeyListResultPreparer(ctx context.Context) (*http.Request, error) { - if dklr.NextLink == nil || len(to.String(dklr.NextLink)) < 1 { + if !dklr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -1297,11 +1240,16 @@ func (page *DeletedKeyListResultPage) NextWithContext(ctx context.Context) (err tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.dklr) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.dklr) + if err != nil { + return err + } + page.dklr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.dklr = next return nil } @@ -1331,8 +1279,11 @@ func (page DeletedKeyListResultPage) Values() []DeletedKeyItem { } // Creates a new instance of the DeletedKeyListResultPage type. -func NewDeletedKeyListResultPage(getNextPage func(context.Context, DeletedKeyListResult) (DeletedKeyListResult, error)) DeletedKeyListResultPage { - return DeletedKeyListResultPage{fn: getNextPage} +func NewDeletedKeyListResultPage(cur DeletedKeyListResult, getNextPage func(context.Context, DeletedKeyListResult) (DeletedKeyListResult, error)) DeletedKeyListResultPage { + return DeletedKeyListResultPage{ + fn: getNextPage, + dklr: cur, + } } // DeletedSasDefinitionBundle a deleted SAS definition bundle consisting of its previous id, attributes and @@ -1476,10 +1427,15 @@ func (dsdlr DeletedSasDefinitionListResult) IsEmpty() bool { return dsdlr.Value == nil || len(*dsdlr.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (dsdlr DeletedSasDefinitionListResult) hasNextLink() bool { + return dsdlr.NextLink != nil && len(*dsdlr.NextLink) != 0 +} + // deletedSasDefinitionListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (dsdlr DeletedSasDefinitionListResult) deletedSasDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) { - if dsdlr.NextLink == nil || len(to.String(dsdlr.NextLink)) < 1 { + if !dsdlr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -1507,11 +1463,16 @@ func (page *DeletedSasDefinitionListResultPage) NextWithContext(ctx context.Cont tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.dsdlr) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.dsdlr) + if err != nil { + return err + } + page.dsdlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.dsdlr = next return nil } @@ -1541,8 +1502,11 @@ func (page DeletedSasDefinitionListResultPage) Values() []DeletedSasDefinitionIt } // Creates a new instance of the DeletedSasDefinitionListResultPage type. -func NewDeletedSasDefinitionListResultPage(getNextPage func(context.Context, DeletedSasDefinitionListResult) (DeletedSasDefinitionListResult, error)) DeletedSasDefinitionListResultPage { - return DeletedSasDefinitionListResultPage{fn: getNextPage} +func NewDeletedSasDefinitionListResultPage(cur DeletedSasDefinitionListResult, getNextPage func(context.Context, DeletedSasDefinitionListResult) (DeletedSasDefinitionListResult, error)) DeletedSasDefinitionListResultPage { + return DeletedSasDefinitionListResultPage{ + fn: getNextPage, + dsdlr: cur, + } } // DeletedSecretBundle a Deleted Secret consisting of its previous id, attributes and its tags, as well as @@ -1713,10 +1677,15 @@ func (dslr DeletedSecretListResult) IsEmpty() bool { return dslr.Value == nil || len(*dslr.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (dslr DeletedSecretListResult) hasNextLink() bool { + return dslr.NextLink != nil && len(*dslr.NextLink) != 0 +} + // deletedSecretListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (dslr DeletedSecretListResult) deletedSecretListResultPreparer(ctx context.Context) (*http.Request, error) { - if dslr.NextLink == nil || len(to.String(dslr.NextLink)) < 1 { + if !dslr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -1744,11 +1713,16 @@ func (page *DeletedSecretListResultPage) NextWithContext(ctx context.Context) (e tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.dslr) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.dslr) + if err != nil { + return err + } + page.dslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.dslr = next return nil } @@ -1778,8 +1752,11 @@ func (page DeletedSecretListResultPage) Values() []DeletedSecretItem { } // Creates a new instance of the DeletedSecretListResultPage type. -func NewDeletedSecretListResultPage(getNextPage func(context.Context, DeletedSecretListResult) (DeletedSecretListResult, error)) DeletedSecretListResultPage { - return DeletedSecretListResultPage{fn: getNextPage} +func NewDeletedSecretListResultPage(cur DeletedSecretListResult, getNextPage func(context.Context, DeletedSecretListResult) (DeletedSecretListResult, error)) DeletedSecretListResultPage { + return DeletedSecretListResultPage{ + fn: getNextPage, + dslr: cur, + } } // DeletedStorageAccountItem the deleted storage account item containing metadata about the deleted storage @@ -1923,10 +1900,15 @@ func (dslr DeletedStorageListResult) IsEmpty() bool { return dslr.Value == nil || len(*dslr.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (dslr DeletedStorageListResult) hasNextLink() bool { + return dslr.NextLink != nil && len(*dslr.NextLink) != 0 +} + // deletedStorageListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (dslr DeletedStorageListResult) deletedStorageListResultPreparer(ctx context.Context) (*http.Request, error) { - if dslr.NextLink == nil || len(to.String(dslr.NextLink)) < 1 { + if !dslr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -1954,11 +1936,16 @@ func (page *DeletedStorageListResultPage) NextWithContext(ctx context.Context) ( tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.dslr) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.dslr) + if err != nil { + return err + } + page.dslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.dslr = next return nil } @@ -1988,8 +1975,11 @@ func (page DeletedStorageListResultPage) Values() []DeletedStorageAccountItem { } // Creates a new instance of the DeletedStorageListResultPage type. -func NewDeletedStorageListResultPage(getNextPage func(context.Context, DeletedStorageListResult) (DeletedStorageListResult, error)) DeletedStorageListResultPage { - return DeletedStorageListResultPage{fn: getNextPage} +func NewDeletedStorageListResultPage(cur DeletedStorageListResult, getNextPage func(context.Context, DeletedStorageListResult) (DeletedStorageListResult, error)) DeletedStorageListResultPage { + return DeletedStorageListResultPage{ + fn: getNextPage, + dslr: cur, + } } // Error the key vault server error. @@ -2018,6 +2008,15 @@ type IssuerAttributes struct { Updated *date.UnixTime `json:"updated,omitempty"` } +// MarshalJSON is the custom marshaler for IssuerAttributes. +func (ia IssuerAttributes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ia.Enabled != nil { + objectMap["enabled"] = ia.Enabled + } + return json.Marshal(objectMap) +} + // IssuerBundle the issuer for Key Vault certificate. type IssuerBundle struct { autorest.Response `json:"-"` @@ -2033,6 +2032,24 @@ type IssuerBundle struct { Attributes *IssuerAttributes `json:"attributes,omitempty"` } +// MarshalJSON is the custom marshaler for IssuerBundle. +func (ib IssuerBundle) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ib.Provider != nil { + objectMap["provider"] = ib.Provider + } + if ib.Credentials != nil { + objectMap["credentials"] = ib.Credentials + } + if ib.OrganizationDetails != nil { + objectMap["org_details"] = ib.OrganizationDetails + } + if ib.Attributes != nil { + objectMap["attributes"] = ib.Attributes + } + return json.Marshal(objectMap) +} + // IssuerCredentials the credentials to be used for the certificate issuer. type IssuerCredentials struct { // AccountID - The user name/account name/account id. @@ -2088,7 +2105,7 @@ type JSONWebKey struct { // KeyAttributes the attributes of a key managed by the key vault service. type KeyAttributes struct { - // RecoveryLevel - READ-ONLY; Reflects the deletion recovery level currently in effect for keys in the current vault. If it contains 'Purgeable' the key can be permanently deleted by a privileged user; otherwise, only the system can purge the key, at the end of the retention interval. Possible values include: 'Purgeable', 'RecoverablePurgeable', 'Recoverable', 'RecoverableProtectedSubscription' + // RecoveryLevel - READ-ONLY; Reflects the deletion recovery level currently in effect for keys in the current vault. If it contains 'Purgeable' the key can be permanently deleted by a privileged user; otherwise, only the system can purge the key, at the end of the retention interval. Possible values include: 'Purgeable', 'RecoverablePurgeable', 'Recoverable', 'RecoverableProtectedSubscription', 'CustomizedRecoverablePurgeable', 'CustomizedRecoverable', 'CustomizedRecoverableProtectedSubscription' RecoveryLevel DeletionRecoveryLevel `json:"recoveryLevel,omitempty"` // Enabled - Determines whether the object is enabled. Enabled *bool `json:"enabled,omitempty"` @@ -2102,6 +2119,21 @@ type KeyAttributes struct { Updated *date.UnixTime `json:"updated,omitempty"` } +// MarshalJSON is the custom marshaler for KeyAttributes. +func (ka KeyAttributes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ka.Enabled != nil { + objectMap["enabled"] = ka.Enabled + } + if ka.NotBefore != nil { + objectMap["nbf"] = ka.NotBefore + } + if ka.Expires != nil { + objectMap["exp"] = ka.Expires + } + return json.Marshal(objectMap) +} + // KeyBundle a KeyBundle consisting of a WebKey plus its attributes. type KeyBundle struct { autorest.Response `json:"-"` @@ -2302,10 +2334,15 @@ func (klr KeyListResult) IsEmpty() bool { return klr.Value == nil || len(*klr.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (klr KeyListResult) hasNextLink() bool { + return klr.NextLink != nil && len(*klr.NextLink) != 0 +} + // keyListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (klr KeyListResult) keyListResultPreparer(ctx context.Context) (*http.Request, error) { - if klr.NextLink == nil || len(to.String(klr.NextLink)) < 1 { + if !klr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -2333,11 +2370,16 @@ func (page *KeyListResultPage) NextWithContext(ctx context.Context) (err error) tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.klr) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.klr) + if err != nil { + return err + } + page.klr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.klr = next return nil } @@ -2367,8 +2409,11 @@ func (page KeyListResultPage) Values() []KeyItem { } // Creates a new instance of the KeyListResultPage type. -func NewKeyListResultPage(getNextPage func(context.Context, KeyListResult) (KeyListResult, error)) KeyListResultPage { - return KeyListResultPage{fn: getNextPage} +func NewKeyListResultPage(cur KeyListResult, getNextPage func(context.Context, KeyListResult) (KeyListResult, error)) KeyListResultPage { + return KeyListResultPage{ + fn: getNextPage, + klr: cur, + } } // KeyOperationResult the key operation result. @@ -2488,10 +2533,19 @@ type SasDefinitionAttributes struct { Created *date.UnixTime `json:"created,omitempty"` // Updated - READ-ONLY; Last updated time in UTC. Updated *date.UnixTime `json:"updated,omitempty"` - // RecoveryLevel - READ-ONLY; 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 - READ-ONLY; 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', 'CustomizedRecoverablePurgeable', 'CustomizedRecoverable', 'CustomizedRecoverableProtectedSubscription' RecoveryLevel DeletionRecoveryLevel `json:"recoveryLevel,omitempty"` } +// MarshalJSON is the custom marshaler for SasDefinitionAttributes. +func (sda SasDefinitionAttributes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sda.Enabled != nil { + objectMap["enabled"] = sda.Enabled + } + return json.Marshal(objectMap) +} + // SasDefinitionBundle a SAS definition bundle consists of key vault SAS definition details plus its // attributes. type SasDefinitionBundle struct { @@ -2648,10 +2702,15 @@ func (sdlr SasDefinitionListResult) IsEmpty() bool { return sdlr.Value == nil || len(*sdlr.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (sdlr SasDefinitionListResult) hasNextLink() bool { + return sdlr.NextLink != nil && len(*sdlr.NextLink) != 0 +} + // sasDefinitionListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (sdlr SasDefinitionListResult) sasDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) { - if sdlr.NextLink == nil || len(to.String(sdlr.NextLink)) < 1 { + if !sdlr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -2679,11 +2738,16 @@ func (page *SasDefinitionListResultPage) NextWithContext(ctx context.Context) (e tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.sdlr) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.sdlr) + if err != nil { + return err + } + page.sdlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.sdlr = next return nil } @@ -2713,8 +2777,11 @@ func (page SasDefinitionListResultPage) Values() []SasDefinitionItem { } // Creates a new instance of the SasDefinitionListResultPage type. -func NewSasDefinitionListResultPage(getNextPage func(context.Context, SasDefinitionListResult) (SasDefinitionListResult, error)) SasDefinitionListResultPage { - return SasDefinitionListResultPage{fn: getNextPage} +func NewSasDefinitionListResultPage(cur SasDefinitionListResult, getNextPage func(context.Context, SasDefinitionListResult) (SasDefinitionListResult, error)) SasDefinitionListResultPage { + return SasDefinitionListResultPage{ + fn: getNextPage, + sdlr: cur, + } } // SasDefinitionUpdateParameters the SAS definition update parameters. @@ -2754,7 +2821,7 @@ func (sdup SasDefinitionUpdateParameters) MarshalJSON() ([]byte, error) { // SecretAttributes the secret management attributes. type SecretAttributes struct { - // RecoveryLevel - READ-ONLY; 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 - READ-ONLY; 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', 'CustomizedRecoverablePurgeable', 'CustomizedRecoverable', 'CustomizedRecoverableProtectedSubscription' RecoveryLevel DeletionRecoveryLevel `json:"recoveryLevel,omitempty"` // Enabled - Determines whether the object is enabled. Enabled *bool `json:"enabled,omitempty"` @@ -2768,6 +2835,21 @@ type SecretAttributes struct { Updated *date.UnixTime `json:"updated,omitempty"` } +// MarshalJSON is the custom marshaler for SecretAttributes. +func (sa SecretAttributes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sa.Enabled != nil { + objectMap["enabled"] = sa.Enabled + } + if sa.NotBefore != nil { + objectMap["nbf"] = sa.NotBefore + } + if sa.Expires != nil { + objectMap["exp"] = sa.Expires + } + return json.Marshal(objectMap) +} + // SecretBundle a secret consisting of a value, id and its attributes. type SecretBundle struct { autorest.Response `json:"-"` @@ -2917,10 +2999,15 @@ func (slr SecretListResult) IsEmpty() bool { return slr.Value == nil || len(*slr.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (slr SecretListResult) hasNextLink() bool { + return slr.NextLink != nil && len(*slr.NextLink) != 0 +} + // secretListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (slr SecretListResult) secretListResultPreparer(ctx context.Context) (*http.Request, error) { - if slr.NextLink == nil || len(to.String(slr.NextLink)) < 1 { + if !slr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -2948,11 +3035,16 @@ func (page *SecretListResultPage) NextWithContext(ctx context.Context) (err erro tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.slr) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.slr) + if err != nil { + return err + } + page.slr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.slr = next return nil } @@ -2982,8 +3074,11 @@ func (page SecretListResultPage) Values() []SecretItem { } // Creates a new instance of the SecretListResultPage type. -func NewSecretListResultPage(getNextPage func(context.Context, SecretListResult) (SecretListResult, error)) SecretListResultPage { - return SecretListResultPage{fn: getNextPage} +func NewSecretListResultPage(cur SecretListResult, getNextPage func(context.Context, SecretListResult) (SecretListResult, error)) SecretListResultPage { + return SecretListResultPage{ + fn: getNextPage, + slr: cur, + } } // SecretProperties properties of the key backing a certificate. @@ -3061,10 +3156,19 @@ type StorageAccountAttributes struct { Created *date.UnixTime `json:"created,omitempty"` // Updated - READ-ONLY; Last updated time in UTC. Updated *date.UnixTime `json:"updated,omitempty"` - // RecoveryLevel - READ-ONLY; 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 - READ-ONLY; 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', 'CustomizedRecoverablePurgeable', 'CustomizedRecoverable', 'CustomizedRecoverableProtectedSubscription' RecoveryLevel DeletionRecoveryLevel `json:"recoveryLevel,omitempty"` } +// MarshalJSON is the custom marshaler for StorageAccountAttributes. +func (saa StorageAccountAttributes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if saa.Enabled != nil { + objectMap["enabled"] = saa.Enabled + } + return json.Marshal(objectMap) +} + // StorageAccountCreateParameters the storage account create parameters. type StorageAccountCreateParameters struct { // ResourceID - Storage account resource id. @@ -3267,10 +3371,15 @@ func (slr StorageListResult) IsEmpty() bool { return slr.Value == nil || len(*slr.Value) == 0 } +// hasNextLink returns true if the NextLink is not empty. +func (slr StorageListResult) hasNextLink() bool { + return slr.NextLink != nil && len(*slr.NextLink) != 0 +} + // storageListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. func (slr StorageListResult) storageListResultPreparer(ctx context.Context) (*http.Request, error) { - if slr.NextLink == nil || len(to.String(slr.NextLink)) < 1 { + if !slr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), @@ -3298,11 +3407,16 @@ func (page *StorageListResultPage) NextWithContext(ctx context.Context) (err err tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.slr) - if err != nil { - return err + for { + next, err := page.fn(ctx, page.slr) + if err != nil { + return err + } + page.slr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } } - page.slr = next return nil } @@ -3332,8 +3446,11 @@ func (page StorageListResultPage) Values() []StorageAccountItem { } // Creates a new instance of the StorageListResultPage type. -func NewStorageListResultPage(getNextPage func(context.Context, StorageListResult) (StorageListResult, error)) StorageListResultPage { - return StorageListResultPage{fn: getNextPage} +func NewStorageListResultPage(cur StorageListResult, getNextPage func(context.Context, StorageListResult) (StorageListResult, error)) StorageListResultPage { + return StorageListResultPage{ + fn: getNextPage, + slr: cur, + } } // StorageRestoreParameters the secret restore parameters. diff --git a/services/keyvault/v7.0/keyvault/version.go b/services/keyvault/v7.0/keyvault/version.go index 2db61adc28d2..1f7f80692b01 100644 --- a/services/keyvault/v7.0/keyvault/version.go +++ b/services/keyvault/v7.0/keyvault/version.go @@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " keyvault/7.0" + return "Azure-SDK-For-Go/" + Version() + " keyvault/7.0" } // Version returns the semantic version (see http://semver.org) of the client.