From 7c4d7a74c19e96d81b82cfe2fb9be6bbd65bfd49 Mon Sep 17 00:00:00 2001 From: ziyeqf <51212351+ziyeqf@users.noreply.github.com> Date: Tue, 17 Jan 2023 23:45:33 +0800 Subject: [PATCH] depencies: `azurerm_recovery_services_vault` - swap SDK to `go-azure-sdk` (#19551) --- go.mod | 2 +- go.sum | 4 +- .../recoveryservices/client/client.go | 18 +- .../services/recoveryservices/parse/vault.go | 69 - .../recoveryservices/parse/vault_test.go | 112 - .../recovery_services_vault_data_source.go | 33 +- .../recovery_services_vault_resource.go | 379 ++-- .../recovery_services_vault_resource_test.go | 8 +- .../recoveryservices/validate/vault_id.go | 23 - .../validate/vault_id_test.go | 76 - .../2021-08-01/recoveryservices/CHANGELOG.md | 2 - .../2021-08-01/recoveryservices/_meta.json | 11 - .../2021-08-01/recoveryservices/client.go | 201 -- .../mgmt/2021-08-01/recoveryservices/enums.go | 255 --- .../2021-08-01/recoveryservices/models.go | 1802 ----------------- .../2021-08-01/recoveryservices/operations.go | 140 -- .../recoveryservices/privatelinkresources.go | 227 --- .../recoveryservices/recoveryservices.go | 110 - .../recoveryservices/registeredidentities.go | 109 - .../recoveryservices/replicationusages.go | 108 - .../2021-08-01/recoveryservices/usages.go | 107 - .../recoveryservices/vaultcertificates.go | 113 -- .../recoveryservices/vaultextendedinfo.go | 266 --- .../2021-08-01/recoveryservices/vaults.go | 575 ------ .../2021-08-01/recoveryservices/version.go | 19 - .../2021-08-01/vaults/README.md | 120 ++ .../2021-08-01/vaults/client.go | 18 + .../2021-08-01/vaults/constants.go | 272 +++ .../2021-08-01/vaults/id_vault.go | 124 ++ .../vaults/method_createorupdate_autorest.go | 79 + .../vaults/method_delete_autorest.go | 66 + .../2021-08-01/vaults/method_get_autorest.go | 68 + .../method_listbyresourcegroup_autorest.go | 187 ++ .../method_listbysubscriptionid_autorest.go | 187 ++ .../vaults/method_update_autorest.go | 79 + .../2021-08-01/vaults/model_cmkkekidentity.go | 9 + .../vaults/model_cmkkeyvaultproperties.go | 8 + .../2021-08-01/vaults/model_patchvault.go | 20 + .../vaults/model_privateendpoint.go | 8 + .../vaults/model_privateendpointconnection.go | 10 + ...rivateendpointconnectionvaultproperties.go | 12 + ...model_privatelinkserviceconnectionstate.go | 10 + .../2021-08-01/vaults/model_sku.go | 12 + .../2021-08-01/vaults/model_upgradedetails.go | 58 + .../2021-08-01/vaults/model_vault.go | 22 + .../vaults/model_vaultproperties.go | 15 + .../vaults/model_vaultpropertiesencryption.go | 10 + .../model_vaultpropertiesmovedetails.go | 42 + .../2021-08-01/vaults/predicates.go | 34 + .../2021-08-01/vaults/version.go | 12 + .../README.md | 78 + .../client.go | 18 + .../constants.go | 136 ++ .../id_vault.go | 124 ++ .../method_get_autorest.go | 69 + .../method_patch_autorest.go | 68 + .../method_update_autorest.go | 70 + .../model_backupresourceconfig.go | 13 + .../model_backupresourceconfigresource.go | 14 + .../version.go | 12 + .../backupresourcevaultconfigs/README.md | 78 + .../backupresourcevaultconfigs/client.go | 18 + .../backupresourcevaultconfigs/constants.go | 136 ++ .../backupresourcevaultconfigs/id_vault.go | 124 ++ .../method_get_autorest.go | 69 + .../method_put_autorest.go | 70 + .../method_update_autorest.go | 70 + .../model_backupresourcevaultconfig.go | 14 + ...model_backupresourcevaultconfigresource.go | 14 + .../backupresourcevaultconfigs/version.go | 12 + vendor/modules.txt | 6 +- 71 files changed, 2936 insertions(+), 4528 deletions(-) delete mode 100644 internal/services/recoveryservices/parse/vault.go delete mode 100644 internal/services/recoveryservices/parse/vault_test.go delete mode 100644 internal/services/recoveryservices/validate/vault_id.go delete mode 100644 internal/services/recoveryservices/validate/vault_id_test.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/CHANGELOG.md delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/_meta.json delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/client.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/enums.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/models.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/operations.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/privatelinkresources.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/recoveryservices.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/registeredidentities.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/replicationusages.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/usages.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/vaultcertificates.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/vaultextendedinfo.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/vaults.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/id_vault.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_listbyresourcegroup_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_listbysubscriptionid_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_update_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_cmkkekidentity.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_cmkkeyvaultproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_patchvault.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_privateendpoint.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_privateendpointconnection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_privateendpointconnectionvaultproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_privatelinkserviceconnectionstate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_sku.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_upgradedetails.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_vault.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_vaultproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_vaultpropertiesencryption.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_vaultpropertiesmovedetails.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/id_vault.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/method_patch_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/method_update_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/model_backupresourceconfig.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/model_backupresourceconfigresource.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/id_vault.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/method_put_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/method_update_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/model_backupresourcevaultconfig.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/model_backupresourcevaultconfigresource.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/version.go diff --git a/go.mod b/go.mod index c1087c899f5c..d4fdd040dcce 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/google/go-cmp v0.5.9 github.com/google/uuid v1.1.2 github.com/hashicorp/go-azure-helpers v0.47.0 - github.com/hashicorp/go-azure-sdk v0.20230105.1121404 + github.com/hashicorp/go-azure-sdk v0.20230109.1102005 github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-uuid v1.0.3 github.com/hashicorp/go-version v1.6.0 diff --git a/go.sum b/go.sum index ba948e7cc947..297fa6e6cb1d 100644 --- a/go.sum +++ b/go.sum @@ -207,8 +207,8 @@ github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg= github.com/hashicorp/go-azure-helpers v0.47.0 h1:E90ZN2hqMtzI+tfGWCnNtyLZYG4csoKSs+hWZZ8ywSM= github.com/hashicorp/go-azure-helpers v0.47.0/go.mod h1:WiJNl0fD6PoM/MYuGTZ8yuzIaXQR3m2H2g6+EJ8nSwc= -github.com/hashicorp/go-azure-sdk v0.20230105.1121404 h1:Tvzo98JY2y+cQxvjS+9S0MqyKZedQOhR1grM4PYSwzY= -github.com/hashicorp/go-azure-sdk v0.20230105.1121404/go.mod h1:BEjoURzcFwd+K3MqkbOt9jArIIrsqpBQ2Gz6DdemFIs= +github.com/hashicorp/go-azure-sdk v0.20230109.1102005 h1:KF/PNtpxygBi6mpc57BHyaETXsvzXrIqWf7OBWCoTHE= +github.com/hashicorp/go-azure-sdk v0.20230109.1102005/go.mod h1:BEjoURzcFwd+K3MqkbOt9jArIIrsqpBQ2Gz6DdemFIs= github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= diff --git a/internal/services/recoveryservices/client/client.go b/internal/services/recoveryservices/client/client.go index b87b989cf9a6..be1c1df586df 100644 --- a/internal/services/recoveryservices/client/client.go +++ b/internal/services/recoveryservices/client/client.go @@ -1,8 +1,10 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices" // nolint: staticcheck - "github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-12-01/backup" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-12-01/backup" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies" @@ -21,9 +23,9 @@ type Client struct { ProtectionContainerOperationResultsClient *backup.ProtectionContainerOperationResultsClient BackupProtectionContainersClient *backup.ProtectionContainersClient BackupOperationStatusesClient *backup.OperationStatusesClient - VaultsClient *recoveryservices.VaultsClient - VaultsConfigsClient *backup.ResourceVaultConfigsClient // Not sure why this is in backup, but https://github.com/Azure/azure-sdk-for-go/issues/7279 - StorageConfigsClient *backup.ResourceStorageConfigsNonCRRClient + VaultsClient *vaults.VaultsClient + VaultsConfigsClient *backupresourcevaultconfigs.BackupResourceVaultConfigsClient + StorageConfigsClient *backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient FabricClient *replicationfabrics.ReplicationFabricsClient ProtectionContainerClient *replicationprotectioncontainers.ReplicationProtectionContainersClient ReplicationPoliciesClient *replicationpolicies.ReplicationPoliciesClient @@ -34,13 +36,13 @@ type Client struct { } func NewClient(o *common.ClientOptions) *Client { - vaultConfigsClient := backup.NewResourceVaultConfigsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + vaultConfigsClient := backupresourcevaultconfigs.NewBackupResourceVaultConfigsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&vaultConfigsClient.Client, o.ResourceManagerAuthorizer) - storageConfigsClient := backup.NewResourceStorageConfigsNonCRRClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + storageConfigsClient := backupresourcestorageconfigsnoncrr.NewBackupResourceStorageConfigsNonCRRClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&storageConfigsClient.Client, o.ResourceManagerAuthorizer) - vaultsClient := recoveryservices.NewVaultsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + vaultsClient := vaults.NewVaultsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&vaultsClient.Client, o.ResourceManagerAuthorizer) protectableItemsClient := backup.NewProtectableItemsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) diff --git a/internal/services/recoveryservices/parse/vault.go b/internal/services/recoveryservices/parse/vault.go deleted file mode 100644 index e9a436b37685..000000000000 --- a/internal/services/recoveryservices/parse/vault.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type VaultId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewVaultID(subscriptionId, resourceGroup, name string) VaultId { - return VaultId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id VaultId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Vault", segmentsStr) -} - -func (id VaultId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// VaultID parses a Vault ID into an VaultId struct -func VaultID(input string) (*VaultId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := VaultId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("vaults"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/recoveryservices/parse/vault_test.go b/internal/services/recoveryservices/parse/vault_test.go deleted file mode 100644 index 69a4bf1c9b17..000000000000 --- a/internal/services/recoveryservices/parse/vault_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = VaultId{} - -func TestVaultIDFormatter(t *testing.T) { - actual := NewVaultID("12345678-1234-9876-4563-123456789012", "group1", "vault1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.RecoveryServices/vaults/vault1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestVaultID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VaultId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.RecoveryServices/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.RecoveryServices/vaults/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.RecoveryServices/vaults/vault1", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - Name: "vault1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.RECOVERYSERVICES/VAULTS/VAULT1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := VaultID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/recoveryservices/recovery_services_vault_data_source.go b/internal/services/recoveryservices/recovery_services_vault_data_source.go index 12e95579cd96..819e01326689 100644 --- a/internal/services/recoveryservices/recovery_services_vault_data_source.go +++ b/internal/services/recoveryservices/recovery_services_vault_data_source.go @@ -4,14 +4,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceRecoveryServicesVault() *pluginsdk.Resource { @@ -32,7 +32,7 @@ func dataSourceRecoveryServicesVault() *pluginsdk.Resource { "location": commonschema.LocationComputed(), - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), "sku": { Type: pluginsdk.TypeString, @@ -48,26 +48,31 @@ func dataSourceRecoveryServicesVaultRead(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewVaultID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - vault, err := client.Get(ctx, id.ResourceGroup, id.Name) + id := vaults.NewVaultID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(vault.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } + if resp.Model == nil { + return fmt.Errorf("retrieving %s: `model` was nil", id) + } + model := resp.Model + d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", azure.NormalizeLocation(*vault.Location)) + d.Set("name", id.VaultName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("location", location.Normalize(model.Location)) skuName := "" - if vault.Sku != nil { - skuName = string(vault.Sku.Name) + if model.Sku != nil { + skuName = string(model.Sku.Name) } d.Set("sku", skuName) - return tags.FlattenAndSet(d, vault.Tags) + return tags.FlattenAndSet(d, model.Tags) } diff --git a/internal/services/recoveryservices/recovery_services_vault_resource.go b/internal/services/recoveryservices/recovery_services_vault_resource.go index a7cc72f776b3..ad44649d815a 100644 --- a/internal/services/recoveryservices/recovery_services_vault_resource.go +++ b/internal/services/recoveryservices/recovery_services_vault_resource.go @@ -7,17 +7,18 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices" // nolint: staticcheck - "github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-12-01/backup" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" keyvaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -32,12 +33,12 @@ func resourceRecoveryServicesVault() *pluginsdk.Resource { Delete: resourceRecoveryServicesVaultDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.VaultID(id) + _, err := vaults.ParseVaultID(id) return err }), Timeouts: &pluginsdk.ResourceTimeout{ - Create: pluginsdk.DefaultTimeout(60 * time.Minute), + Create: pluginsdk.DefaultTimeout(120 * time.Minute), Read: pluginsdk.DefaultTimeout(5 * time.Minute), Update: pluginsdk.DefaultTimeout(60 * time.Minute), Delete: pluginsdk.DefaultTimeout(30 * time.Minute), @@ -93,25 +94,25 @@ func resourceRecoveryServicesVault() *pluginsdk.Resource { // TODO: the API for this also supports UserAssigned & SystemAssigned, UserAssigned "identity": commonschema.SystemAssignedIdentityOptional(), - "tags": tags.Schema(), + "tags": commonschema.Tags(), "sku": { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(recoveryservices.SkuNameRS0), - string(recoveryservices.SkuNameStandard), + string(vaults.SkuNameRSZero), + string(vaults.SkuNameStandard), }, false), }, "storage_mode_type": { Type: pluginsdk.TypeString, Optional: true, - Default: backup.StorageTypeGeoRedundant, + Default: backupresourcestorageconfigsnoncrr.StorageTypeGeoRedundant, ValidateFunc: validation.StringInSlice([]string{ - string(backup.StorageTypeGeoRedundant), - string(backup.StorageTypeLocallyRedundant), - string(backup.StorageTypeZoneRedundant), + string(backupresourcestorageconfigsnoncrr.StorageTypeGeoRedundant), + string(backupresourcestorageconfigsnoncrr.StorageTypeLocallyRedundant), + string(backupresourcestorageconfigsnoncrr.StorageTypeZoneRedundant), }, false), }, @@ -138,13 +139,23 @@ func resourceRecoveryServicesVaultCreate(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewVaultID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := vaults.NewVaultID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + storageId := backupresourcestorageconfigsnoncrr.VaultId{ + SubscriptionId: id.SubscriptionId, + ResourceGroupName: id.ResourceGroupName, + VaultName: id.VaultName, + } + cfgId := backupresourcevaultconfigs.VaultId{ + SubscriptionId: id.SubscriptionId, + ResourceGroupName: id.ResourceGroupName, + VaultName: id.VaultName, + } storageMode := d.Get("storage_mode_type").(string) crossRegionRestore := d.Get("cross_region_restore_enabled").(bool) - if crossRegionRestore && storageMode != string(backup.StorageTypeGeoRedundant) { - return fmt.Errorf("cannot enable cross region restore when storage mode type is not %s. %s", string(backup.StorageTypeGeoRedundant), id.String()) + if crossRegionRestore && storageMode != string(backupresourcestorageconfigsnoncrr.StorageTypeGeoRedundant) { + return fmt.Errorf("cannot enable cross region restore when storage mode type is not %s. %s", string(backupresourcestorageconfigsnoncrr.StorageTypeGeoRedundant), id.String()) } location := d.Get("location").(string) @@ -152,14 +163,14 @@ func resourceRecoveryServicesVaultCreate(d *pluginsdk.ResourceData, meta interfa log.Printf("[DEBUG] Creating Recovery Service %s", id.String()) - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing Recovery Service %s: %+v", id.String(), err) } } - if existing.ID != nil && *existing.ID != "" { - return tf.ImportAsExistsError("azurerm_recovery_services_vault", *existing.ID) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_recovery_services_vault", id.ID()) } expandedIdentity, err := expandVaultIdentity(d.Get("identity").([]interface{})) @@ -167,41 +178,36 @@ func resourceRecoveryServicesVaultCreate(d *pluginsdk.ResourceData, meta interfa return fmt.Errorf("expanding `identity`: %+v", err) } sku := d.Get("sku").(string) - vault := recoveryservices.Vault{ - Location: utils.String(location), + vault := vaults.Vault{ + Location: location, Tags: tags.Expand(t), Identity: expandedIdentity, - Sku: &recoveryservices.Sku{ - Name: recoveryservices.SkuName(sku), + Sku: &vaults.Sku{ + Name: vaults.SkuName(sku), }, - Properties: &recoveryservices.VaultProperties{}, + Properties: &vaults.VaultProperties{}, } - if recoveryservices.SkuName(sku) == recoveryservices.SkuNameRS0 { + if vaults.SkuName(sku) == vaults.SkuNameRSZero { vault.Sku.Tier = utils.String("Standard") } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, vault) + err = client.CreateOrUpdateThenPoll(ctx, id, vault) if err != nil { - return fmt.Errorf("creating Recovery Service %s: %+v", id.String(), err) - } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %q: %+v", id, err) + return fmt.Errorf("creating %s: %+v", id.String(), err) } - storageCfg := backup.ResourceConfigResource{ - Properties: &backup.ResourceConfig{ - StorageModelType: backup.StorageType(d.Get("storage_mode_type").(string)), + storageType := backupresourcestorageconfigsnoncrr.StorageType(d.Get("storage_mode_type").(string)) + storageCfg := backupresourcestorageconfigsnoncrr.BackupResourceConfigResource{ + Properties: &backupresourcestorageconfigsnoncrr.BackupResourceConfig{ + StorageModelType: &storageType, CrossRegionRestoreFlag: utils.Bool(d.Get("cross_region_restore_enabled").(bool)), }, } err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *pluginsdk.RetryError { - if resp, err := storageCfgsClient.Update(ctx, id.Name, id.ResourceGroup, storageCfg); err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return pluginsdk.RetryableError(fmt.Errorf("updating Recovery Service Storage Cfg %s: %+v", id.String(), err)) - } - if utils.ResponseWasBadRequest(resp.Response) { + if resp, err := storageCfgsClient.Update(ctx, storageId, storageCfg); err != nil { + if response.WasNotFound(resp.HttpResponse) { return pluginsdk.RetryableError(fmt.Errorf("updating Recovery Service Storage Cfg %s: %+v", id.String(), err)) } @@ -215,14 +221,17 @@ func resourceRecoveryServicesVaultCreate(d *pluginsdk.ResourceData, meta interfa // storage type is not updated instantaneously, so we wait until storage type is correct err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *pluginsdk.RetryError { - if resp, err := storageCfgsClient.Get(ctx, id.Name, id.ResourceGroup); err == nil { - if resp.Properties == nil { + if resp, err := storageCfgsClient.Get(ctx, storageId); err == nil { + if resp.Model == nil { + return pluginsdk.NonRetryableError(fmt.Errorf("updating %s Storage Config: `model` was nil", id)) + } + if resp.Model.Properties == nil { return pluginsdk.NonRetryableError(fmt.Errorf("updating %s Storage Config: `properties` was nil", id)) } - if resp.Properties.StorageType != storageCfg.Properties.StorageModelType { + if *resp.Model.Properties.StorageType != *storageCfg.Properties.StorageModelType { return pluginsdk.RetryableError(fmt.Errorf("updating Storage Config: %+v", err)) } - if *resp.Properties.CrossRegionRestoreFlag != *storageCfg.Properties.CrossRegionRestoreFlag { + if *resp.Model.Properties.CrossRegionRestoreFlag != *storageCfg.Properties.CrossRegionRestoreFlag { return pluginsdk.RetryableError(fmt.Errorf("updating Storage Config: %+v", err)) } } else { @@ -237,39 +246,39 @@ func resourceRecoveryServicesVaultCreate(d *pluginsdk.ResourceData, meta interfa // recovery vault's encryption config cannot be set while creation, so a standalone update is required. if _, ok := d.GetOk("encryption"); ok { - updateFuture, err := client.Update(ctx, id.ResourceGroup, id.Name, recoveryservices.PatchVault{ - Properties: &recoveryservices.VaultProperties{ + err = client.UpdateThenPoll(ctx, id, vaults.PatchVault{ + Properties: &vaults.VaultProperties{ Encryption: expandEncryption(d), }, }) if err != nil { return fmt.Errorf("updating Recovery Service Encryption %s: %+v, but recovery vault was created, a manually import might be required", id.String(), err) } - if err = updateFuture.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for update encryption of %s: %+v, but recovery vault was created, a manually import might be required", id.String(), err) - } } // an update on the vault will reset the vault config to default, so we handle it at last. - cfg := backup.ResourceVaultConfigResource{ - Properties: &backup.ResourceVaultConfig{ - EnhancedSecurityState: backup.EnhancedSecurityStateEnabled, // always enabled + enhancedSecurityState := backupresourcevaultconfigs.EnhancedSecurityStateEnabled + cfg := backupresourcevaultconfigs.BackupResourceVaultConfigResource{ + Properties: &backupresourcevaultconfigs.BackupResourceVaultConfig{ + EnhancedSecurityState: &enhancedSecurityState, // always enabled }, } var StateRefreshPendingStrings []string var StateRefreshTargetStrings []string if sd := d.Get("soft_delete_enabled").(bool); sd { - cfg.Properties.SoftDeleteFeatureState = backup.SoftDeleteFeatureStateEnabled - StateRefreshPendingStrings = []string{string(backup.SoftDeleteFeatureStateDisabled)} - StateRefreshTargetStrings = []string{string(backup.SoftDeleteFeatureStateEnabled)} + state := backupresourcevaultconfigs.SoftDeleteFeatureStateEnabled + cfg.Properties.SoftDeleteFeatureState = &state + StateRefreshPendingStrings = []string{string(backupresourcevaultconfigs.SoftDeleteFeatureStateDisabled)} + StateRefreshTargetStrings = []string{string(backupresourcevaultconfigs.SoftDeleteFeatureStateEnabled)} } else { - cfg.Properties.SoftDeleteFeatureState = backup.SoftDeleteFeatureStateDisabled - StateRefreshPendingStrings = []string{string(backup.SoftDeleteFeatureStateEnabled)} - StateRefreshTargetStrings = []string{string(backup.SoftDeleteFeatureStateDisabled)} + state := backupresourcevaultconfigs.SoftDeleteFeatureStateDisabled + cfg.Properties.SoftDeleteFeatureState = &state + StateRefreshPendingStrings = []string{string(backupresourcevaultconfigs.SoftDeleteFeatureStateEnabled)} + StateRefreshTargetStrings = []string{string(backupresourcevaultconfigs.SoftDeleteFeatureStateDisabled)} } - _, err = cfgsClient.Update(ctx, id.Name, id.ResourceGroup, cfg) + _, err = cfgsClient.Update(ctx, cfgId, cfg) if err != nil { return err } @@ -280,7 +289,7 @@ func resourceRecoveryServicesVaultCreate(d *pluginsdk.ResourceData, meta interfa Target: StateRefreshTargetStrings, MinTimeout: 30 * time.Second, ContinuousTargetOccurence: 3, - Refresh: resourceRecoveryServicesVaultSoftDeleteRefreshFunc(ctx, cfgsClient, id), + Refresh: resourceRecoveryServicesVaultSoftDeleteRefreshFunc(ctx, cfgsClient, cfgId), } stateConf.Timeout = d.Timeout(pluginsdk.TimeoutCreate) @@ -301,33 +310,46 @@ func resourceRecoveryServicesVaultUpdate(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewVaultID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := vaults.NewVaultID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + storageId := backupresourcestorageconfigsnoncrr.VaultId{ + SubscriptionId: id.SubscriptionId, + ResourceGroupName: id.ResourceGroupName, + VaultName: id.VaultName, + } + cfgId := backupresourcevaultconfigs.VaultId{ + SubscriptionId: id.SubscriptionId, + ResourceGroupName: id.ResourceGroupName, + VaultName: id.VaultName, + } encryption := expandEncryption(d) - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { return fmt.Errorf("checking for presence of existing Recovery Service %s: %+v", id.String(), err) } - if existing.Properties != nil && existing.Properties.Encryption != nil { - if encryption == nil { - return fmt.Errorf("once encryption with your own key has been enabled it's not possible to disable it") - } - if encryption.InfrastructureEncryption != existing.Properties.Encryption.InfrastructureEncryption { - return fmt.Errorf("once `infrastructure_encryption_enabled` has been set it's not possible to change it") - } - if d.HasChange("sku") { - // Once encryption has been enabled, calling `CreateOrUpdate` without it is not allowed. - // But `sku` can only be updated by `CreateOrUpdate` and the support for `encryption` in `CreateOrUpdate` is still under preview (https://docs.microsoft.com/azure/backup/encryption-at-rest-with-cmk?tabs=portal#enable-encryption-using-customer-managed-keys-at-vault-creation-in-preview). - // TODO remove this restriction and add `encryption` to below `sku` update block when `encryption` in `CreateOrUpdate` is GA - return fmt.Errorf("`sku` cannot be changed when encryption with your own key has been enabled") + if existing.Model != nil && existing.Model.Properties != nil { + prop := existing.Model.Properties + if prop.Encryption != nil { + if encryption == nil { + return fmt.Errorf("once encryption with your own key has been enabled it's not possible to disable it") + } + if *encryption.InfrastructureEncryption != *prop.Encryption.InfrastructureEncryption { + return fmt.Errorf("once `infrastructure_encryption_enabled` has been set it's not possible to change it") + } + if d.HasChange("sku") { + // Once encryption has been enabled, calling `CreateOrUpdate` without it is not allowed. + // But `sku` can only be updated by `CreateOrUpdate` and the support for `encryption` in `CreateOrUpdate` is still under preview (https://docs.microsoft.com/azure/backup/encryption-at-rest-with-cmk?tabs=portal#enable-encryption-using-customer-managed-keys-at-vault-creation-in-preview). + // TODO remove this restriction and add `encryption` to below `sku` update block when `encryption` in `CreateOrUpdate` is GA + return fmt.Errorf("`sku` cannot be changed when encryption with your own key has been enabled") + } } } storageMode := d.Get("storage_mode_type").(string) crossRegionRestore := d.Get("cross_region_restore_enabled").(bool) - if crossRegionRestore && storageMode != string(backup.StorageTypeGeoRedundant) { - return fmt.Errorf("cannot enable cross region restore when storage mode type is not %s. %s", string(backup.StorageTypeGeoRedundant), id.String()) + if crossRegionRestore && storageMode != string(backupresourcestorageconfigsnoncrr.StorageTypeGeoRedundant) { + return fmt.Errorf("cannot enable cross region restore when storage mode type is not %s. %s", string(backupresourcestorageconfigsnoncrr.StorageTypeGeoRedundant), id.String()) } expandedIdentity, err := expandVaultIdentity(d.Get("identity").([]interface{})) @@ -335,26 +357,28 @@ func resourceRecoveryServicesVaultUpdate(d *pluginsdk.ResourceData, meta interfa return fmt.Errorf("expanding `identity`: %+v", err) } - cfg := backup.ResourceVaultConfigResource{ - Properties: &backup.ResourceVaultConfig{ - EnhancedSecurityState: backup.EnhancedSecurityStateEnabled, // always enabled + enhanchedSecurityState := backupresourcevaultconfigs.EnhancedSecurityStateEnabled + cfg := backupresourcevaultconfigs.BackupResourceVaultConfigResource{ + Properties: &backupresourcevaultconfigs.BackupResourceVaultConfig{ + EnhancedSecurityState: &enhanchedSecurityState, // always enabled }, } if d.HasChanges("storage_mode_type", "cross_region_restore_enabled") { - storageCfg := backup.ResourceConfigResource{ - Properties: &backup.ResourceConfig{ - StorageModelType: backup.StorageType(storageMode), + storageType := backupresourcestorageconfigsnoncrr.StorageType(storageMode) + storageCfg := backupresourcestorageconfigsnoncrr.BackupResourceConfigResource{ + Properties: &backupresourcestorageconfigsnoncrr.BackupResourceConfig{ + StorageModelType: &storageType, CrossRegionRestoreFlag: utils.Bool(crossRegionRestore), }, } err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutUpdate), func() *pluginsdk.RetryError { - if resp, err := storageCfgsClient.Update(ctx, id.Name, id.ResourceGroup, storageCfg); err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if resp, err := storageCfgsClient.Update(ctx, storageId, storageCfg); err != nil { + if response.WasNotFound(resp.HttpResponse) { return pluginsdk.RetryableError(fmt.Errorf("updating Recovery Service Storage Cfg %s: %+v", id.String(), err)) } - if utils.ResponseWasBadRequest(resp.Response) { + if response.WasBadRequest(resp.HttpResponse) { return pluginsdk.RetryableError(fmt.Errorf("updating Recovery Service Storage Cfg %s: %+v", id.String(), err)) } @@ -368,14 +392,17 @@ func resourceRecoveryServicesVaultUpdate(d *pluginsdk.ResourceData, meta interfa // storage type is not updated instantaneously, so we wait until storage type is correct err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutUpdate), func() *pluginsdk.RetryError { - if resp, err := storageCfgsClient.Get(ctx, id.Name, id.ResourceGroup); err == nil { - if resp.Properties == nil { + if resp, err := storageCfgsClient.Get(ctx, storageId); err == nil { + if resp.Model == nil { + return pluginsdk.NonRetryableError(fmt.Errorf("updating %s Storage Config: `model` was nil", id)) + } + if resp.Model.Properties == nil { return pluginsdk.NonRetryableError(fmt.Errorf("updating %s Storage Config: `properties` was nil", id)) } - if resp.Properties.StorageType != storageCfg.Properties.StorageModelType { + if *resp.Model.Properties.StorageType != *storageCfg.Properties.StorageModelType { return pluginsdk.RetryableError(fmt.Errorf("updating Storage Config: %+v", err)) } - if *resp.Properties.CrossRegionRestoreFlag != *storageCfg.Properties.CrossRegionRestoreFlag { + if *resp.Model.Properties.CrossRegionRestoreFlag != *storageCfg.Properties.CrossRegionRestoreFlag { return pluginsdk.RetryableError(fmt.Errorf("updating Storage Config: %+v", err)) } } else { @@ -392,29 +419,26 @@ func resourceRecoveryServicesVaultUpdate(d *pluginsdk.ResourceData, meta interfa // `sku` can only be updated by `CreateOrUpdate` but not `Update`, so use `CreateOrUpdate` with required and unchangeable properties if d.HasChange("sku") { sku := d.Get("sku").(string) - vault := recoveryservices.Vault{ - Location: utils.String(d.Get("location").(string)), + vault := vaults.Vault{ + Location: d.Get("location").(string), Identity: expandedIdentity, - Sku: &recoveryservices.Sku{ - Name: recoveryservices.SkuName(sku), + Sku: &vaults.Sku{ + Name: vaults.SkuName(sku), }, - Properties: &recoveryservices.VaultProperties{}, + Properties: &vaults.VaultProperties{}, } - if recoveryservices.SkuName(sku) == recoveryservices.SkuNameRS0 { + if vaults.SkuName(sku) == vaults.SkuNameRSZero { vault.Sku.Tier = utils.String("Standard") } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, vault) + err = client.CreateOrUpdateThenPoll(ctx, id, vault) if err != nil { return fmt.Errorf("updating Recovery Service %s: %+v", id.String(), err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for update of %q: %+v", id, err) - } } - vault := recoveryservices.PatchVault{} + vault := vaults.PatchVault{} if d.HasChange("identity") { vault.Identity = expandedIdentity @@ -422,7 +446,7 @@ func resourceRecoveryServicesVaultUpdate(d *pluginsdk.ResourceData, meta interfa if d.HasChange("encryption") { if vault.Properties == nil { - vault.Properties = &recoveryservices.VaultProperties{} + vault.Properties = &vaults.VaultProperties{} } vault.Properties.Encryption = encryption @@ -432,28 +456,27 @@ func resourceRecoveryServicesVaultUpdate(d *pluginsdk.ResourceData, meta interfa vault.Tags = tags.Expand(d.Get("tags").(map[string]interface{})) } - updateFuture, err := client.Update(ctx, id.ResourceGroup, id.Name, vault) + err = client.UpdateThenPoll(ctx, id, vault) if err != nil { - return fmt.Errorf("updating Recovery Service Encryption %s: %+v", id, err) - } - if err = updateFuture.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for update encryption of %s: %+v", id, err) + return fmt.Errorf("updating %s: %+v", id, err) } // an update on vault will cause the vault config reset to default, so whether the config has change or not, it needs to be updated. var StateRefreshPendingStrings []string var StateRefreshTargetStrings []string if sd := d.Get("soft_delete_enabled").(bool); sd { - cfg.Properties.SoftDeleteFeatureState = backup.SoftDeleteFeatureStateEnabled - StateRefreshPendingStrings = []string{string(backup.SoftDeleteFeatureStateDisabled)} - StateRefreshTargetStrings = []string{string(backup.SoftDeleteFeatureStateEnabled)} + state := backupresourcevaultconfigs.SoftDeleteFeatureStateEnabled + cfg.Properties.SoftDeleteFeatureState = &state + StateRefreshPendingStrings = []string{string(backupresourcevaultconfigs.SoftDeleteFeatureStateDisabled)} + StateRefreshTargetStrings = []string{string(backupresourcevaultconfigs.SoftDeleteFeatureStateEnabled)} } else { - cfg.Properties.SoftDeleteFeatureState = backup.SoftDeleteFeatureStateDisabled - StateRefreshPendingStrings = []string{string(backup.SoftDeleteFeatureStateEnabled)} - StateRefreshTargetStrings = []string{string(backup.SoftDeleteFeatureStateDisabled)} + state := backupresourcevaultconfigs.SoftDeleteFeatureStateDisabled + cfg.Properties.SoftDeleteFeatureState = &state + StateRefreshPendingStrings = []string{string(backupresourcevaultconfigs.SoftDeleteFeatureStateEnabled)} + StateRefreshTargetStrings = []string{string(backupresourcevaultconfigs.SoftDeleteFeatureStateDisabled)} } - _, err = cfgsClient.Update(ctx, id.Name, id.ResourceGroup, cfg) + _, err = cfgsClient.Update(ctx, cfgId, cfg) if err != nil { return err } @@ -465,7 +488,7 @@ func resourceRecoveryServicesVaultUpdate(d *pluginsdk.ResourceData, meta interfa Target: StateRefreshTargetStrings, MinTimeout: 30 * time.Second, ContinuousTargetOccurence: 3, - Refresh: resourceRecoveryServicesVaultSoftDeleteRefreshFunc(ctx, cfgsClient, id), + Refresh: resourceRecoveryServicesVaultSoftDeleteRefreshFunc(ctx, cfgsClient, cfgId), } stateConf.Timeout = d.Timeout(pluginsdk.TimeoutUpdate) @@ -485,16 +508,26 @@ func resourceRecoveryServicesVaultRead(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.VaultID(d.Id()) + id, err := vaults.ParseVaultID(d.Id()) if err != nil { return err } + storageId := backupresourcestorageconfigsnoncrr.VaultId{ + SubscriptionId: id.SubscriptionId, + ResourceGroupName: id.ResourceGroupName, + VaultName: id.VaultName, + } + cfgId := backupresourcevaultconfigs.VaultId{ + SubscriptionId: id.SubscriptionId, + ResourceGroupName: id.ResourceGroupName, + VaultName: id.VaultName, + } log.Printf("[DEBUG] Reading Recovery Service %s", id.String()) - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } @@ -502,45 +535,53 @@ func resourceRecoveryServicesVaultRead(d *pluginsdk.ResourceData, meta interface return fmt.Errorf("making Read request on Recovery Service %s: %+v", id.String(), err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) + if resp.Model == nil { + return fmt.Errorf("recovery Service Vault response %q : model is nil", id.ID()) } + model := resp.Model - if sku := resp.Sku; sku != nil { + d.Set("name", id.VaultName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("location", location.Normalize(model.Location)) + + if sku := model.Sku; sku != nil { d.Set("sku", string(sku.Name)) } - cfg, err := cfgsClient.Get(ctx, id.Name, id.ResourceGroup) + cfg, err := cfgsClient.Get(ctx, cfgId) if err != nil { return fmt.Errorf("reading Recovery Service Vault Cfg %s: %+v", id.String(), err) } - if props := cfg.Properties; props != nil { - d.Set("soft_delete_enabled", props.SoftDeleteFeatureState == backup.SoftDeleteFeatureStateEnabled) + if cfg.Model != nil && cfg.Model.Properties != nil && cfg.Model.Properties.SoftDeleteFeatureState != nil { + d.Set("soft_delete_enabled", *cfg.Model.Properties.SoftDeleteFeatureState == backupresourcevaultconfigs.SoftDeleteFeatureStateEnabled) } - storageCfg, err := storageCfgsClient.Get(ctx, id.Name, id.ResourceGroup) + storageCfg, err := storageCfgsClient.Get(ctx, storageId) if err != nil { return fmt.Errorf("reading Recovery Service storage Cfg %s: %+v", id.String(), err) } - if props := storageCfg.Properties; props != nil { - d.Set("storage_mode_type", string(props.StorageModelType)) + if storageCfg.Model != nil && storageCfg.Model.Properties != nil { + props := storageCfg.Model.Properties + d.Set("storage_mode_type", props.StorageModelType) d.Set("cross_region_restore_enabled", props.CrossRegionRestoreFlag) } - if err := d.Set("identity", flattenVaultIdentity(resp.Identity)); err != nil { + flattenIdentity := flattenVaultIdentity(model.Identity) + if err != nil { + return fmt.Errorf("flattening `identity`: %+v", err) + } + if err := d.Set("identity", flattenIdentity); err != nil { return fmt.Errorf("setting `identity`: %+v", err) } - encryption := flattenVaultEncryption(resp) + encryption := flattenVaultEncryption(*model) if encryption != nil { d.Set("encryption", []interface{}{encryption}) } - return tags.FlattenAndSet(d, resp.Tags) + return tags.FlattenAndSet(d, model.Tags) } func resourceRecoveryServicesVaultDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -548,53 +589,46 @@ func resourceRecoveryServicesVaultDelete(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.VaultID(d.Id()) + id, err := vaults.ParseVaultID(d.Id()) if err != nil { return err } log.Printf("[DEBUG] Deleting Recovery Service %s", id.String()) - resp, err := client.Delete(ctx, id.ResourceGroup, id.Name) + _, err = client.Delete(ctx, *id) if err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("issuing delete request for Recovery Service %s: %+v", id.String(), err) - } + return fmt.Errorf("deleting %s: %+v", id.String(), err) } return nil } -func expandVaultIdentity(input []interface{}) (*recoveryservices.IdentityData, error) { +func expandVaultIdentity(input []interface{}) (*identity.SystemAndUserAssignedMap, error) { expanded, err := identity.ExpandSystemAssigned(input) if err != nil { return nil, err } - return &recoveryservices.IdentityData{ - Type: recoveryservices.ResourceIdentityType(string(expanded.Type)), + identityIds := make(map[string]identity.UserAssignedIdentityDetails, 0) + return &identity.SystemAndUserAssignedMap{ + Type: expanded.Type, + PrincipalId: expanded.PrincipalId, + TenantId: expanded.TenantId, + IdentityIds: identityIds, }, nil } -func flattenVaultIdentity(input *recoveryservices.IdentityData) []interface{} { - var transition *identity.SystemAssigned - - if input != nil { - transition = &identity.SystemAssigned{ - Type: identity.Type(string(input.Type)), - } - if input.PrincipalID != nil { - transition.PrincipalId = *input.PrincipalID - } - if input.TenantID != nil { - transition.TenantId = *input.TenantID - } +func flattenVaultIdentity(input *identity.SystemAndUserAssignedMap) []interface{} { + systemAssignedIdentity := &identity.SystemAssigned{ + Type: input.Type, + PrincipalId: input.PrincipalId, + TenantId: input.TenantId, } - - return identity.FlattenSystemAssigned(transition) + return identity.FlattenSystemAssigned(systemAssignedIdentity) } -func expandEncryption(d *pluginsdk.ResourceData) *recoveryservices.VaultPropertiesEncryption { +func expandEncryption(d *pluginsdk.ResourceData) *vaults.VaultPropertiesEncryption { encryptionRaw := d.Get("encryption") if encryptionRaw == nil { return nil @@ -606,28 +640,28 @@ func expandEncryption(d *pluginsdk.ResourceData) *recoveryservices.VaultProperti encryptionMap := settings[0].(map[string]interface{}) keyUri := encryptionMap["key_id"].(string) enabledInfraEncryption := encryptionMap["infrastructure_encryption_enabled"].(bool) - infraEncryptionState := recoveryservices.InfrastructureEncryptionStateEnabled + infraEncryptionState := vaults.InfrastructureEncryptionStateEnabled if !enabledInfraEncryption { - infraEncryptionState = recoveryservices.InfrastructureEncryptionStateDisabled + infraEncryptionState = vaults.InfrastructureEncryptionStateDisabled } - encryption := &recoveryservices.VaultPropertiesEncryption{ - KeyVaultProperties: &recoveryservices.CmkKeyVaultProperties{ - KeyURI: utils.String(keyUri), + encryption := &vaults.VaultPropertiesEncryption{ + KeyVaultProperties: &vaults.CmkKeyVaultProperties{ + KeyUri: utils.String(keyUri), }, - KekIdentity: &recoveryservices.CmkKekIdentity{ + KekIdentity: &vaults.CmkKekIdentity{ UseSystemAssignedIdentity: utils.Bool(encryptionMap["use_system_assigned_identity"].(bool)), }, - InfrastructureEncryption: infraEncryptionState, + InfrastructureEncryption: &infraEncryptionState, } return encryption } -func flattenVaultEncryption(resp recoveryservices.Vault) interface{} { - if resp.Properties == nil || resp.Properties.Encryption == nil { +func flattenVaultEncryption(model vaults.Vault) interface{} { + if model.Properties == nil || model.Properties.Encryption == nil { return nil } - encryption := resp.Properties.Encryption - if encryption.KeyVaultProperties == nil || encryption.KeyVaultProperties.KeyURI == nil { + encryption := model.Properties.Encryption + if encryption.KeyVaultProperties == nil || encryption.KeyVaultProperties.KeyUri == nil { return nil } if encryption.KekIdentity == nil || encryption.KekIdentity.UseSystemAssignedIdentity == nil { @@ -635,15 +669,15 @@ func flattenVaultEncryption(resp recoveryservices.Vault) interface{} { } encryptionMap := make(map[string]interface{}) - encryptionMap["key_id"] = encryption.KeyVaultProperties.KeyURI + encryptionMap["key_id"] = encryption.KeyVaultProperties.KeyUri encryptionMap["use_system_assigned_identity"] = *encryption.KekIdentity.UseSystemAssignedIdentity - encryptionMap["infrastructure_encryption_enabled"] = encryption.InfrastructureEncryption == recoveryservices.InfrastructureEncryptionStateEnabled + encryptionMap["infrastructure_encryption_enabled"] = *encryption.InfrastructureEncryption == vaults.InfrastructureEncryptionStateEnabled return encryptionMap } -func resourceRecoveryServicesVaultSoftDeleteRefreshFunc(ctx context.Context, cfgsClient *backup.ResourceVaultConfigsClient, id parse.VaultId) pluginsdk.StateRefreshFunc { +func resourceRecoveryServicesVaultSoftDeleteRefreshFunc(ctx context.Context, cfgsClient *backupresourcevaultconfigs.BackupResourceVaultConfigsClient, id backupresourcevaultconfigs.VaultId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - resp, err := cfgsClient.Get(ctx, id.Name, id.ResourceGroup) + resp, err := cfgsClient.Get(ctx, id) if err != nil { if strings.Contains(err.Error(), "ResourceNotYetSynced") { return resp, "syncing", nil @@ -651,9 +685,10 @@ func resourceRecoveryServicesVaultSoftDeleteRefreshFunc(ctx context.Context, cfg return resp, "error", fmt.Errorf("refreshing Recovery Service Vault Cfg %s: %+v", id.String(), err) } - if resp.Properties != nil { - return resp, string(resp.Properties.SoftDeleteFeatureState), nil + if resp.Model != nil && resp.Model.Properties != nil && resp.Model.Properties.SoftDeleteFeatureState != nil { + return resp.Model, string(*resp.Model.Properties.SoftDeleteFeatureState), nil } + return resp, "error", fmt.Errorf("refreshing Recovery Service Vault Cfg %s: Properties is nil", id.String()) } } diff --git a/internal/services/recoveryservices/recovery_services_vault_resource_test.go b/internal/services/recoveryservices/recovery_services_vault_resource_test.go index 12f8f102f0a1..22150486918d 100644 --- a/internal/services/recoveryservices/recovery_services_vault_resource_test.go +++ b/internal/services/recoveryservices/recovery_services_vault_resource_test.go @@ -6,10 +6,10 @@ import ( "regexp" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -291,17 +291,17 @@ func TestAccRecoveryServicesVault_updateSkuWithExistingEncryption(t *testing.T) } func (t RecoveryServicesVaultResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.VaultID(state.ID) + id, err := vaults.ParseVaultID(state.ID) if err != nil { return nil, err } - resp, err := clients.RecoveryServices.VaultsClient.Get(ctx, id.ResourceGroup, id.Name) + resp, err := clients.RecoveryServices.VaultsClient.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("reading Recovery Service (%s): %+v", id.String(), err) } - return utils.Bool(resp.ID != nil), nil + return utils.Bool(resp.Model != nil), nil } func TestAccRecoveryServicesVault_encryptionWithKeyVaultKey(t *testing.T) { diff --git a/internal/services/recoveryservices/validate/vault_id.go b/internal/services/recoveryservices/validate/vault_id.go deleted file mode 100644 index 8ce3572918d3..000000000000 --- a/internal/services/recoveryservices/validate/vault_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/parse" -) - -func VaultID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.VaultID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/recoveryservices/validate/vault_id_test.go b/internal/services/recoveryservices/validate/vault_id_test.go deleted file mode 100644 index 80c32f0ffb17..000000000000 --- a/internal/services/recoveryservices/validate/vault_id_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestVaultID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.RecoveryServices/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.RecoveryServices/vaults/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.RecoveryServices/vaults/vault1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.RECOVERYSERVICES/VAULTS/VAULT1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := VaultID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/_meta.json deleted file mode 100644 index a89b8d770067..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "d600759c3516b61a7c353bc8682bccbab85a6f65", - "readme": "/_/azure-rest-api-specs/specification/recoveryservices/resource-manager/readme.md", - "tag": "package-2021-08", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-08 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/recoveryservices/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/client.go deleted file mode 100644 index 08436a677ed5..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/client.go +++ /dev/null @@ -1,201 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservices](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservices). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package recoveryservices implements the Azure ARM Recoveryservices service API version 2021-08-01. -// -// Recovery Services Client -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -const ( - // DefaultBaseURI is the default URI used for the service Recoveryservices - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Recoveryservices. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} - -// GetOperationResult gets the operation result for a resource. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -func (client BaseClient) GetOperationResult(ctx context.Context, resourceGroupName string, vaultName string, operationID string) (result Vault, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetOperationResult") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetOperationResultPreparer(ctx, resourceGroupName, vaultName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.BaseClient", "GetOperationResult", nil, "Failure preparing request") - return - } - - resp, err := client.GetOperationResultSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.BaseClient", "GetOperationResult", resp, "Failure sending request") - return - } - - result, err = client.GetOperationResultResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.BaseClient", "GetOperationResult", resp, "Failure responding to request") - return - } - - return -} - -// GetOperationResultPreparer prepares the GetOperationResult request. -func (client BaseClient) GetOperationResultPreparer(ctx context.Context, resourceGroupName string, vaultName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/operationResults/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetOperationResultSender sends the GetOperationResult request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetOperationResultSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetOperationResultResponder handles the response to the GetOperationResult request. The method always -// closes the http.Response Body. -func (client BaseClient) GetOperationResultResponder(resp *http.Response) (result Vault, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetOperationStatus gets the operation status for a resource. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -func (client BaseClient) GetOperationStatus(ctx context.Context, resourceGroupName string, vaultName string, operationID string) (result OperationResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetOperationStatus") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetOperationStatusPreparer(ctx, resourceGroupName, vaultName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.BaseClient", "GetOperationStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetOperationStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.BaseClient", "GetOperationStatus", resp, "Failure sending request") - return - } - - result, err = client.GetOperationStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.BaseClient", "GetOperationStatus", resp, "Failure responding to request") - return - } - - return -} - -// GetOperationStatusPreparer prepares the GetOperationStatus request. -func (client BaseClient) GetOperationStatusPreparer(ctx context.Context, resourceGroupName string, vaultName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/operationStatus/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetOperationStatusSender sends the GetOperationStatus request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetOperationStatusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetOperationStatusResponder handles the response to the GetOperationStatus request. The method always -// closes the http.Response Body. -func (client BaseClient) GetOperationStatusResponder(resp *http.Response) (result OperationResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/enums.go deleted file mode 100644 index b17c9c68a6be..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/enums.go +++ /dev/null @@ -1,255 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AuthType enumerates the values for auth type. -type AuthType string - -const ( - // AuthTypeAAD ... - AuthTypeAAD AuthType = "AAD" - // AuthTypeAccessControlService ... - AuthTypeAccessControlService AuthType = "AccessControlService" - // AuthTypeACS ... - AuthTypeACS AuthType = "ACS" - // AuthTypeAzureActiveDirectory ... - AuthTypeAzureActiveDirectory AuthType = "AzureActiveDirectory" - // AuthTypeInvalid ... - AuthTypeInvalid AuthType = "Invalid" -) - -// PossibleAuthTypeValues returns an array of possible values for the AuthType const type. -func PossibleAuthTypeValues() []AuthType { - return []AuthType{AuthTypeAAD, AuthTypeAccessControlService, AuthTypeACS, AuthTypeAzureActiveDirectory, AuthTypeInvalid} -} - -// AuthTypeBasicResourceCertificateDetails enumerates the values for auth type basic resource certificate -// details. -type AuthTypeBasicResourceCertificateDetails string - -const ( - // AuthTypeBasicResourceCertificateDetailsAuthTypeAccessControlService ... - AuthTypeBasicResourceCertificateDetailsAuthTypeAccessControlService AuthTypeBasicResourceCertificateDetails = "AccessControlService" - // AuthTypeBasicResourceCertificateDetailsAuthTypeAzureActiveDirectory ... - AuthTypeBasicResourceCertificateDetailsAuthTypeAzureActiveDirectory AuthTypeBasicResourceCertificateDetails = "AzureActiveDirectory" - // AuthTypeBasicResourceCertificateDetailsAuthTypeResourceCertificateDetails ... - AuthTypeBasicResourceCertificateDetailsAuthTypeResourceCertificateDetails AuthTypeBasicResourceCertificateDetails = "ResourceCertificateDetails" -) - -// PossibleAuthTypeBasicResourceCertificateDetailsValues returns an array of possible values for the AuthTypeBasicResourceCertificateDetails const type. -func PossibleAuthTypeBasicResourceCertificateDetailsValues() []AuthTypeBasicResourceCertificateDetails { - return []AuthTypeBasicResourceCertificateDetails{AuthTypeBasicResourceCertificateDetailsAuthTypeAccessControlService, AuthTypeBasicResourceCertificateDetailsAuthTypeAzureActiveDirectory, AuthTypeBasicResourceCertificateDetailsAuthTypeResourceCertificateDetails} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// InfrastructureEncryptionState enumerates the values for infrastructure encryption state. -type InfrastructureEncryptionState string - -const ( - // InfrastructureEncryptionStateDisabled ... - InfrastructureEncryptionStateDisabled InfrastructureEncryptionState = "Disabled" - // InfrastructureEncryptionStateEnabled ... - InfrastructureEncryptionStateEnabled InfrastructureEncryptionState = "Enabled" -) - -// PossibleInfrastructureEncryptionStateValues returns an array of possible values for the InfrastructureEncryptionState const type. -func PossibleInfrastructureEncryptionStateValues() []InfrastructureEncryptionState { - return []InfrastructureEncryptionState{InfrastructureEncryptionStateDisabled, InfrastructureEncryptionStateEnabled} -} - -// PrivateEndpointConnectionStatus enumerates the values for private endpoint connection status. -type PrivateEndpointConnectionStatus string - -const ( - // PrivateEndpointConnectionStatusApproved ... - PrivateEndpointConnectionStatusApproved PrivateEndpointConnectionStatus = "Approved" - // PrivateEndpointConnectionStatusDisconnected ... - PrivateEndpointConnectionStatusDisconnected PrivateEndpointConnectionStatus = "Disconnected" - // PrivateEndpointConnectionStatusPending ... - PrivateEndpointConnectionStatusPending PrivateEndpointConnectionStatus = "Pending" - // PrivateEndpointConnectionStatusRejected ... - PrivateEndpointConnectionStatusRejected PrivateEndpointConnectionStatus = "Rejected" -) - -// PossiblePrivateEndpointConnectionStatusValues returns an array of possible values for the PrivateEndpointConnectionStatus const type. -func PossiblePrivateEndpointConnectionStatusValues() []PrivateEndpointConnectionStatus { - return []PrivateEndpointConnectionStatus{PrivateEndpointConnectionStatusApproved, PrivateEndpointConnectionStatusDisconnected, PrivateEndpointConnectionStatusPending, PrivateEndpointConnectionStatusRejected} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateDeleting ... - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStatePending ... - ProvisioningStatePending ProvisioningState = "Pending" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStatePending, ProvisioningStateSucceeded} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // ResourceIdentityTypeNone ... - ResourceIdentityTypeNone ResourceIdentityType = "None" - // ResourceIdentityTypeSystemAssigned ... - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - // ResourceIdentityTypeSystemAssignedUserAssigned ... - ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" - // ResourceIdentityTypeUserAssigned ... - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, ResourceIdentityTypeUserAssigned} -} - -// ResourceMoveState enumerates the values for resource move state. -type ResourceMoveState string - -const ( - // ResourceMoveStateCommitFailed ... - ResourceMoveStateCommitFailed ResourceMoveState = "CommitFailed" - // ResourceMoveStateCommitTimedout ... - ResourceMoveStateCommitTimedout ResourceMoveState = "CommitTimedout" - // ResourceMoveStateCriticalFailure ... - ResourceMoveStateCriticalFailure ResourceMoveState = "CriticalFailure" - // ResourceMoveStateFailure ... - ResourceMoveStateFailure ResourceMoveState = "Failure" - // ResourceMoveStateInProgress ... - ResourceMoveStateInProgress ResourceMoveState = "InProgress" - // ResourceMoveStateMoveSucceeded ... - ResourceMoveStateMoveSucceeded ResourceMoveState = "MoveSucceeded" - // ResourceMoveStatePartialSuccess ... - ResourceMoveStatePartialSuccess ResourceMoveState = "PartialSuccess" - // ResourceMoveStatePrepareFailed ... - ResourceMoveStatePrepareFailed ResourceMoveState = "PrepareFailed" - // ResourceMoveStatePrepareTimedout ... - ResourceMoveStatePrepareTimedout ResourceMoveState = "PrepareTimedout" - // ResourceMoveStateUnknown ... - ResourceMoveStateUnknown ResourceMoveState = "Unknown" -) - -// PossibleResourceMoveStateValues returns an array of possible values for the ResourceMoveState const type. -func PossibleResourceMoveStateValues() []ResourceMoveState { - return []ResourceMoveState{ResourceMoveStateCommitFailed, ResourceMoveStateCommitTimedout, ResourceMoveStateCriticalFailure, ResourceMoveStateFailure, ResourceMoveStateInProgress, ResourceMoveStateMoveSucceeded, ResourceMoveStatePartialSuccess, ResourceMoveStatePrepareFailed, ResourceMoveStatePrepareTimedout, ResourceMoveStateUnknown} -} - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // SkuNameRS0 ... - SkuNameRS0 SkuName = "RS0" - // SkuNameStandard ... - SkuNameStandard SkuName = "Standard" -) - -// PossibleSkuNameValues returns an array of possible values for the SkuName const type. -func PossibleSkuNameValues() []SkuName { - return []SkuName{SkuNameRS0, SkuNameStandard} -} - -// TriggerType enumerates the values for trigger type. -type TriggerType string - -const ( - // TriggerTypeForcedUpgrade ... - TriggerTypeForcedUpgrade TriggerType = "ForcedUpgrade" - // TriggerTypeUserTriggered ... - TriggerTypeUserTriggered TriggerType = "UserTriggered" -) - -// PossibleTriggerTypeValues returns an array of possible values for the TriggerType const type. -func PossibleTriggerTypeValues() []TriggerType { - return []TriggerType{TriggerTypeForcedUpgrade, TriggerTypeUserTriggered} -} - -// UsagesUnit enumerates the values for usages unit. -type UsagesUnit string - -const ( - // UsagesUnitBytes ... - UsagesUnitBytes UsagesUnit = "Bytes" - // UsagesUnitBytesPerSecond ... - UsagesUnitBytesPerSecond UsagesUnit = "BytesPerSecond" - // UsagesUnitCount ... - UsagesUnitCount UsagesUnit = "Count" - // UsagesUnitCountPerSecond ... - UsagesUnitCountPerSecond UsagesUnit = "CountPerSecond" - // UsagesUnitPercent ... - UsagesUnitPercent UsagesUnit = "Percent" - // UsagesUnitSeconds ... - UsagesUnitSeconds UsagesUnit = "Seconds" -) - -// PossibleUsagesUnitValues returns an array of possible values for the UsagesUnit const type. -func PossibleUsagesUnitValues() []UsagesUnit { - return []UsagesUnit{UsagesUnitBytes, UsagesUnitBytesPerSecond, UsagesUnitCount, UsagesUnitCountPerSecond, UsagesUnitPercent, UsagesUnitSeconds} -} - -// VaultPrivateEndpointState enumerates the values for vault private endpoint state. -type VaultPrivateEndpointState string - -const ( - // VaultPrivateEndpointStateEnabled ... - VaultPrivateEndpointStateEnabled VaultPrivateEndpointState = "Enabled" - // VaultPrivateEndpointStateNone ... - VaultPrivateEndpointStateNone VaultPrivateEndpointState = "None" -) - -// PossibleVaultPrivateEndpointStateValues returns an array of possible values for the VaultPrivateEndpointState const type. -func PossibleVaultPrivateEndpointStateValues() []VaultPrivateEndpointState { - return []VaultPrivateEndpointState{VaultPrivateEndpointStateEnabled, VaultPrivateEndpointStateNone} -} - -// VaultUpgradeState enumerates the values for vault upgrade state. -type VaultUpgradeState string - -const ( - // VaultUpgradeStateFailed ... - VaultUpgradeStateFailed VaultUpgradeState = "Failed" - // VaultUpgradeStateInProgress ... - VaultUpgradeStateInProgress VaultUpgradeState = "InProgress" - // VaultUpgradeStateUnknown ... - VaultUpgradeStateUnknown VaultUpgradeState = "Unknown" - // VaultUpgradeStateUpgraded ... - VaultUpgradeStateUpgraded VaultUpgradeState = "Upgraded" -) - -// PossibleVaultUpgradeStateValues returns an array of possible values for the VaultUpgradeState const type. -func PossibleVaultUpgradeStateValues() []VaultUpgradeState { - return []VaultUpgradeState{VaultUpgradeStateFailed, VaultUpgradeStateInProgress, VaultUpgradeStateUnknown, VaultUpgradeStateUpgraded} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/models.go deleted file mode 100644 index 62b30f59d924..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/models.go +++ /dev/null @@ -1,1802 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices" - -// CertificateRequest details of the certificate to be uploaded to the vault. -type CertificateRequest struct { - Properties *RawCertificateData `json:"properties,omitempty"` -} - -// CheckNameAvailabilityParameters resource Name availability input parameters - Resource type and resource -// name -type CheckNameAvailabilityParameters struct { - // Type - Describes the Resource type: Microsoft.RecoveryServices/Vaults - Type *string `json:"type,omitempty"` - // Name - Resource name for which availability needs to be checked - Name *string `json:"name,omitempty"` -} - -// CheckNameAvailabilityResult response for check name availability API. Resource provider will set -// availability as true | false. -type CheckNameAvailabilityResult struct { - autorest.Response `json:"-"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason *string `json:"reason,omitempty"` - Message *string `json:"message,omitempty"` -} - -// ClientDiscoveryDisplay localized display information of an operation. -type ClientDiscoveryDisplay struct { - // Provider - Name of the provider for display purposes - Provider *string `json:"provider,omitempty"` - // Resource - ResourceType for which this Operation can be performed. - Resource *string `json:"resource,omitempty"` - // Operation - Operations Name itself. - Operation *string `json:"operation,omitempty"` - // Description - Description of the operation having details of what operation is about. - Description *string `json:"description,omitempty"` -} - -// ClientDiscoveryForLogSpecification class to represent shoebox log specification in json client -// discovery. -type ClientDiscoveryForLogSpecification struct { - // Name - Name of the log. - Name *string `json:"name,omitempty"` - // DisplayName - Localized display name - DisplayName *string `json:"displayName,omitempty"` - // BlobDuration - Blobs created in customer storage account per hour - BlobDuration *string `json:"blobDuration,omitempty"` -} - -// ClientDiscoveryForProperties class to represent shoebox properties in json client discovery. -type ClientDiscoveryForProperties struct { - // ServiceSpecification - Operation properties. - ServiceSpecification *ClientDiscoveryForServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// ClientDiscoveryForServiceSpecification class to represent shoebox service specification in json client -// discovery. -type ClientDiscoveryForServiceSpecification struct { - // LogSpecifications - List of log specifications of this operation. - LogSpecifications *[]ClientDiscoveryForLogSpecification `json:"logSpecifications,omitempty"` -} - -// ClientDiscoveryResponse operations List response which contains list of available APIs. -type ClientDiscoveryResponse struct { - autorest.Response `json:"-"` - // Value - List of available operations. - Value *[]ClientDiscoveryValueForSingleAPI `json:"value,omitempty"` - // NextLink - Link to the next chunk of the response - NextLink *string `json:"nextLink,omitempty"` -} - -// ClientDiscoveryResponseIterator provides access to a complete listing of -// ClientDiscoveryValueForSingleAPI values. -type ClientDiscoveryResponseIterator struct { - i int - page ClientDiscoveryResponsePage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ClientDiscoveryResponseIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClientDiscoveryResponseIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ClientDiscoveryResponseIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ClientDiscoveryResponseIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ClientDiscoveryResponseIterator) Response() ClientDiscoveryResponse { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ClientDiscoveryResponseIterator) Value() ClientDiscoveryValueForSingleAPI { - if !iter.page.NotDone() { - return ClientDiscoveryValueForSingleAPI{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ClientDiscoveryResponseIterator type. -func NewClientDiscoveryResponseIterator(page ClientDiscoveryResponsePage) ClientDiscoveryResponseIterator { - return ClientDiscoveryResponseIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cdr ClientDiscoveryResponse) IsEmpty() bool { - return cdr.Value == nil || len(*cdr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cdr ClientDiscoveryResponse) hasNextLink() bool { - return cdr.NextLink != nil && len(*cdr.NextLink) != 0 -} - -// clientDiscoveryResponsePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cdr ClientDiscoveryResponse) clientDiscoveryResponsePreparer(ctx context.Context) (*http.Request, error) { - if !cdr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cdr.NextLink))) -} - -// ClientDiscoveryResponsePage contains a page of ClientDiscoveryValueForSingleAPI values. -type ClientDiscoveryResponsePage struct { - fn func(context.Context, ClientDiscoveryResponse) (ClientDiscoveryResponse, error) - cdr ClientDiscoveryResponse -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ClientDiscoveryResponsePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClientDiscoveryResponsePage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.cdr) - if err != nil { - return err - } - page.cdr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ClientDiscoveryResponsePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ClientDiscoveryResponsePage) NotDone() bool { - return !page.cdr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ClientDiscoveryResponsePage) Response() ClientDiscoveryResponse { - return page.cdr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ClientDiscoveryResponsePage) Values() []ClientDiscoveryValueForSingleAPI { - if page.cdr.IsEmpty() { - return nil - } - return *page.cdr.Value -} - -// Creates a new instance of the ClientDiscoveryResponsePage type. -func NewClientDiscoveryResponsePage(cur ClientDiscoveryResponse, getNextPage func(context.Context, ClientDiscoveryResponse) (ClientDiscoveryResponse, error)) ClientDiscoveryResponsePage { - return ClientDiscoveryResponsePage{ - fn: getNextPage, - cdr: cur, - } -} - -// ClientDiscoveryValueForSingleAPI available operation details. -type ClientDiscoveryValueForSingleAPI struct { - // Name - Name of the Operation. - Name *string `json:"name,omitempty"` - // Display - Contains the localized display information for this particular operation - Display *ClientDiscoveryDisplay `json:"display,omitempty"` - // Origin - The intended executor of the operation;governs the display of the operation in the RBAC UX and the audit logs UX - Origin *string `json:"origin,omitempty"` - // Properties - ShoeBox properties for the given operation. - Properties *ClientDiscoveryForProperties `json:"properties,omitempty"` -} - -// CloudError an error response from Azure Backup. -type CloudError struct { - Error *Error `json:"error,omitempty"` -} - -// CmkKekIdentity the details of the identity used for CMK -type CmkKekIdentity struct { - // UseSystemAssignedIdentity - Indicate that system assigned identity should be used. Mutually exclusive with 'userAssignedIdentity' field - UseSystemAssignedIdentity *bool `json:"useSystemAssignedIdentity,omitempty"` - // UserAssignedIdentity - The user assigned identity to be used to grant permissions in case the type of identity used is UserAssigned - UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` -} - -// CmkKeyVaultProperties the properties of the Key Vault which hosts CMK -type CmkKeyVaultProperties struct { - // KeyURI - The key uri of the Customer Managed Key - KeyURI *string `json:"keyUri,omitempty"` -} - -// Error the resource management error response. -type Error struct { - // AdditionalInfo - READ-ONLY; The error additional info. - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Details - READ-ONLY; The error details. - Details *[]Error `json:"details,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; The error target. - Target *string `json:"target,omitempty"` -} - -// MarshalJSON is the custom marshaler for Error. -func (e Error) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorAdditionalInfo the resource management error additional info. -type ErrorAdditionalInfo struct { - // Info - READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty"` - // Type - READ-ONLY; The additional info type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. -func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IdentityData identity for the resource. -type IdentityData struct { - // PrincipalID - READ-ONLY; The principal ID of resource identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty"` - // Type - The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identities. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeNone', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned' - Type ResourceIdentityType `json:"type,omitempty"` - // UserAssignedIdentities - The list of user-assigned identities associated with the resource. The user-assigned identity dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - UserAssignedIdentities map[string]*UserIdentity `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for IdentityData. -func (ID IdentityData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ID.Type != "" { - objectMap["type"] = ID.Type - } - if ID.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = ID.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// JobsSummary summary of the replication job data for this vault. -type JobsSummary struct { - // FailedJobs - Count of failed jobs. - FailedJobs *int32 `json:"failedJobs,omitempty"` - // SuspendedJobs - Count of suspended jobs. - SuspendedJobs *int32 `json:"suspendedJobs,omitempty"` - // InProgressJobs - Count of in-progress jobs. - InProgressJobs *int32 `json:"inProgressJobs,omitempty"` -} - -// MonitoringSummary summary of the replication monitoring data for this vault. -type MonitoringSummary struct { - // UnHealthyVMCount - Count of unhealthy VMs. - UnHealthyVMCount *int32 `json:"unHealthyVmCount,omitempty"` - // UnHealthyProviderCount - Count of unhealthy replication providers. - UnHealthyProviderCount *int32 `json:"unHealthyProviderCount,omitempty"` - // EventsCount - Count of all critical warnings. - EventsCount *int32 `json:"eventsCount,omitempty"` - // DeprecatedProviderCount - Count of all deprecated recovery service providers. - DeprecatedProviderCount *int32 `json:"deprecatedProviderCount,omitempty"` - // SupportedProviderCount - Count of all the supported recovery service providers. - SupportedProviderCount *int32 `json:"supportedProviderCount,omitempty"` - // UnsupportedProviderCount - Count of all the unsupported recovery service providers. - UnsupportedProviderCount *int32 `json:"unsupportedProviderCount,omitempty"` -} - -// NameInfo the name of usage. -type NameInfo struct { - // Value - Value of usage. - Value *string `json:"value,omitempty"` - // LocalizedValue - Localized value of usage. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// OperationResource operation Resource -type OperationResource struct { - autorest.Response `json:"-"` - // EndTime - End time of the operation - EndTime *date.Time `json:"endTime,omitempty"` - // Error - Required if status == failed or status == canceled. This is the OData v4 error format, used by the RPC and will go into the v2.2 Azure REST API guidelines. - Error *Error `json:"error,omitempty"` - // ID - It should match what is used to GET the operation result - ID *string `json:"id,omitempty"` - // Name - It must match the last segment of the "id" field, and will typically be a GUID / system generated value - Name *string `json:"name,omitempty"` - // Status - The status of the operation. (InProgress/Success/Failed/Cancelled) - Status *string `json:"status,omitempty"` - // StartTime - Start time of the operation - StartTime *date.Time `json:"startTime,omitempty"` -} - -// PatchTrackedResource tracked resource with location. -type PatchTrackedResource struct { - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - // Etag - Optional ETag. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for PatchTrackedResource. -func (ptr PatchTrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ptr.Location != nil { - objectMap["location"] = ptr.Location - } - if ptr.Tags != nil { - objectMap["tags"] = ptr.Tags - } - if ptr.Etag != nil { - objectMap["etag"] = ptr.Etag - } - return json.Marshal(objectMap) -} - -// PatchVault patch Resource information, as returned by the resource provider. -type PatchVault struct { - Properties *VaultProperties `json:"properties,omitempty"` - Sku *Sku `json:"sku,omitempty"` - Identity *IdentityData `json:"identity,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - // Etag - Optional ETag. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for PatchVault. -func (pv PatchVault) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pv.Properties != nil { - objectMap["properties"] = pv.Properties - } - if pv.Sku != nil { - objectMap["sku"] = pv.Sku - } - if pv.Identity != nil { - objectMap["identity"] = pv.Identity - } - if pv.Location != nil { - objectMap["location"] = pv.Location - } - if pv.Tags != nil { - objectMap["tags"] = pv.Tags - } - if pv.Etag != nil { - objectMap["etag"] = pv.Etag - } - return json.Marshal(objectMap) -} - -// PrivateEndpoint the Private Endpoint network resource that is linked to the Private Endpoint connection. -type PrivateEndpoint struct { - // ID - READ-ONLY; Gets or sets id. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpoint. -func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnection private Endpoint Connection Response Properties. -type PrivateEndpointConnection struct { - // ProvisioningState - READ-ONLY; Gets or sets provisioning state of the private endpoint connection. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateDeleting', 'ProvisioningStateFailed', 'ProvisioningStatePending' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpoint != nil { - objectMap["privateEndpoint"] = pec.PrivateEndpoint - } - if pec.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = pec.PrivateLinkServiceConnectionState - } - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionVaultProperties information to be stored in Vault properties as an element of -// privateEndpointConnections List. -type PrivateEndpointConnectionVaultProperties struct { - // ID - READ-ONLY; Format of id subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.[Service]/{resource}/{resourceName}/privateEndpointConnections/{connectionName}. - ID *string `json:"id,omitempty"` - Properties *PrivateEndpointConnection `json:"properties,omitempty"` - // Name - READ-ONLY; The name of the private Endpoint Connection - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type, which will be of the format, Microsoft.RecoveryServices/vaults/privateEndpointConnections - Type *string `json:"type,omitempty"` - // Location - READ-ONLY; The location of the private Endpoint connection - Location *string `json:"location,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionVaultProperties. -func (pecvp PrivateEndpointConnectionVaultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pecvp.Properties != nil { - objectMap["properties"] = pecvp.Properties - } - return json.Marshal(objectMap) -} - -// PrivateLinkResource information of the private link resource. -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // PrivateLinkResourceProperties - Resource properties - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; e.g. Microsoft.RecoveryServices/vaults/privateLinkResources - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plr.PrivateLinkResourceProperties != nil { - objectMap["properties"] = plr.PrivateLinkResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. -func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateLinkResourceProperties PrivateLinkResourceProperties - err = json.Unmarshal(*v, &privateLinkResourceProperties) - if err != nil { - return err - } - plr.PrivateLinkResourceProperties = &privateLinkResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - plr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - plr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plr.Type = &typeVar - } - } - } - - return nil -} - -// PrivateLinkResourceProperties properties of the private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; e.g. f9ad6492-33d4-4690-9999-6bfd52a0d081 (Backup) or f9ad6492-33d4-4690-9999-6bfd52a0d082 (SiteRecovery) - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; [backup-ecs1, backup-prot1, backup-prot1b, backup-prot1c, backup-id1] - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - READ-ONLY; The private link resource Private link DNS zone name. - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkResources class which represent the stamps associated with the vault. -type PrivateLinkResources struct { - autorest.Response `json:"-"` - // Value - A collection of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - Link to the next chunk of the response - NextLink *string `json:"nextLink,omitempty"` -} - -// PrivateLinkResourcesIterator provides access to a complete listing of PrivateLinkResource values. -type PrivateLinkResourcesIterator struct { - i int - page PrivateLinkResourcesPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PrivateLinkResourcesIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PrivateLinkResourcesIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkResourcesIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PrivateLinkResourcesIterator) Response() PrivateLinkResources { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PrivateLinkResourcesIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkResourcesIterator type. -func NewPrivateLinkResourcesIterator(page PrivateLinkResourcesPage) PrivateLinkResourcesIterator { - return PrivateLinkResourcesIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plr PrivateLinkResources) IsEmpty() bool { - return plr.Value == nil || len(*plr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plr PrivateLinkResources) hasNextLink() bool { - return plr.NextLink != nil && len(*plr.NextLink) != 0 -} - -// privateLinkResourcesPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plr PrivateLinkResources) privateLinkResourcesPreparer(ctx context.Context) (*http.Request, error) { - if !plr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plr.NextLink))) -} - -// PrivateLinkResourcesPage contains a page of PrivateLinkResource values. -type PrivateLinkResourcesPage struct { - fn func(context.Context, PrivateLinkResources) (PrivateLinkResources, error) - plr PrivateLinkResources -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PrivateLinkResourcesPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.plr) - if err != nil { - return err - } - page.plr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PrivateLinkResourcesPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkResourcesPage) NotDone() bool { - return !page.plr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkResourcesPage) Response() PrivateLinkResources { - return page.plr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkResourcesPage) Values() []PrivateLinkResource { - if page.plr.IsEmpty() { - return nil - } - return *page.plr.Value -} - -// Creates a new instance of the PrivateLinkResourcesPage type. -func NewPrivateLinkResourcesPage(cur PrivateLinkResources, getNextPage func(context.Context, PrivateLinkResources) (PrivateLinkResources, error)) PrivateLinkResourcesPage { - return PrivateLinkResourcesPage{ - fn: getNextPage, - plr: cur, - } -} - -// PrivateLinkServiceConnectionState gets or sets private link service connection state. -type PrivateLinkServiceConnectionState struct { - // Status - READ-ONLY; Gets or sets the status. Possible values include: 'PrivateEndpointConnectionStatusPending', 'PrivateEndpointConnectionStatusApproved', 'PrivateEndpointConnectionStatusRejected', 'PrivateEndpointConnectionStatusDisconnected' - Status PrivateEndpointConnectionStatus `json:"status,omitempty"` - // Description - READ-ONLY; Gets or sets description. - Description *string `json:"description,omitempty"` - // ActionsRequired - READ-ONLY; Gets or sets actions required. - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionState. -func (plscs PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RawCertificateData raw certificate data. -type RawCertificateData struct { - // AuthType - Specifies the authentication type. Possible values include: 'AuthTypeInvalid', 'AuthTypeACS', 'AuthTypeAAD', 'AuthTypeAccessControlService', 'AuthTypeAzureActiveDirectory' - AuthType AuthType `json:"authType,omitempty"` - // Certificate - The base64 encoded certificate raw data string - Certificate *[]byte `json:"certificate,omitempty"` -} - -// ReplicationUsage replication usages of a vault. -type ReplicationUsage struct { - // MonitoringSummary - Summary of the replication monitoring data for this vault. - MonitoringSummary *MonitoringSummary `json:"monitoringSummary,omitempty"` - // JobsSummary - Summary of the replication jobs data for this vault. - JobsSummary *JobsSummary `json:"jobsSummary,omitempty"` - // ProtectedItemCount - Number of replication protected items for this vault. - ProtectedItemCount *int32 `json:"protectedItemCount,omitempty"` - // RecoveryPlanCount - Number of replication recovery plans for this vault. - RecoveryPlanCount *int32 `json:"recoveryPlanCount,omitempty"` - // RegisteredServersCount - Number of servers registered to this vault. - RegisteredServersCount *int32 `json:"registeredServersCount,omitempty"` - // RecoveryServicesProviderAuthType - The authentication type of recovery service providers in the vault. - RecoveryServicesProviderAuthType *int32 `json:"recoveryServicesProviderAuthType,omitempty"` -} - -// ReplicationUsageList replication usages for vault. -type ReplicationUsageList struct { - autorest.Response `json:"-"` - // Value - The list of replication usages for the given vault. - Value *[]ReplicationUsage `json:"value,omitempty"` -} - -// Resource ARM Resource. -type Resource struct { - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - // Etag - Optional ETag. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Etag != nil { - objectMap["etag"] = r.Etag - } - return json.Marshal(objectMap) -} - -// ResourceCertificateAndAadDetails certificate details representing the Vault credentials for AAD. -type ResourceCertificateAndAadDetails struct { - // AadAuthority - AAD tenant authority. - AadAuthority *string `json:"aadAuthority,omitempty"` - // AadTenantID - AAD tenant Id. - AadTenantID *string `json:"aadTenantId,omitempty"` - // ServicePrincipalClientID - AAD service principal clientId. - ServicePrincipalClientID *string `json:"servicePrincipalClientId,omitempty"` - // ServicePrincipalObjectID - AAD service principal ObjectId. - ServicePrincipalObjectID *string `json:"servicePrincipalObjectId,omitempty"` - // AzureManagementEndpointAudience - Azure Management Endpoint Audience. - AzureManagementEndpointAudience *string `json:"azureManagementEndpointAudience,omitempty"` - // ServiceResourceID - Service Resource Id. - ServiceResourceID *string `json:"serviceResourceId,omitempty"` - // Certificate - The base64 encoded certificate raw data string. - Certificate *[]byte `json:"certificate,omitempty"` - // FriendlyName - Certificate friendly name. - FriendlyName *string `json:"friendlyName,omitempty"` - // Issuer - Certificate issuer. - Issuer *string `json:"issuer,omitempty"` - // ResourceID - Resource ID of the vault. - ResourceID *int64 `json:"resourceId,omitempty"` - // Subject - Certificate Subject Name. - Subject *string `json:"subject,omitempty"` - // Thumbprint - Certificate thumbprint. - Thumbprint *string `json:"thumbprint,omitempty"` - // ValidFrom - Certificate Validity start Date time. - ValidFrom *date.Time `json:"validFrom,omitempty"` - // ValidTo - Certificate Validity End Date time. - ValidTo *date.Time `json:"validTo,omitempty"` - // AuthType - Possible values include: 'AuthTypeBasicResourceCertificateDetailsAuthTypeResourceCertificateDetails', 'AuthTypeBasicResourceCertificateDetailsAuthTypeAzureActiveDirectory', 'AuthTypeBasicResourceCertificateDetailsAuthTypeAccessControlService' - AuthType AuthTypeBasicResourceCertificateDetails `json:"authType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceCertificateAndAadDetails. -func (rcaad ResourceCertificateAndAadDetails) MarshalJSON() ([]byte, error) { - rcaad.AuthType = AuthTypeBasicResourceCertificateDetailsAuthTypeAzureActiveDirectory - objectMap := make(map[string]interface{}) - if rcaad.AadAuthority != nil { - objectMap["aadAuthority"] = rcaad.AadAuthority - } - if rcaad.AadTenantID != nil { - objectMap["aadTenantId"] = rcaad.AadTenantID - } - if rcaad.ServicePrincipalClientID != nil { - objectMap["servicePrincipalClientId"] = rcaad.ServicePrincipalClientID - } - if rcaad.ServicePrincipalObjectID != nil { - objectMap["servicePrincipalObjectId"] = rcaad.ServicePrincipalObjectID - } - if rcaad.AzureManagementEndpointAudience != nil { - objectMap["azureManagementEndpointAudience"] = rcaad.AzureManagementEndpointAudience - } - if rcaad.ServiceResourceID != nil { - objectMap["serviceResourceId"] = rcaad.ServiceResourceID - } - if rcaad.Certificate != nil { - objectMap["certificate"] = rcaad.Certificate - } - if rcaad.FriendlyName != nil { - objectMap["friendlyName"] = rcaad.FriendlyName - } - if rcaad.Issuer != nil { - objectMap["issuer"] = rcaad.Issuer - } - if rcaad.ResourceID != nil { - objectMap["resourceId"] = rcaad.ResourceID - } - if rcaad.Subject != nil { - objectMap["subject"] = rcaad.Subject - } - if rcaad.Thumbprint != nil { - objectMap["thumbprint"] = rcaad.Thumbprint - } - if rcaad.ValidFrom != nil { - objectMap["validFrom"] = rcaad.ValidFrom - } - if rcaad.ValidTo != nil { - objectMap["validTo"] = rcaad.ValidTo - } - if rcaad.AuthType != "" { - objectMap["authType"] = rcaad.AuthType - } - return json.Marshal(objectMap) -} - -// AsResourceCertificateAndAadDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateAndAadDetails. -func (rcaad ResourceCertificateAndAadDetails) AsResourceCertificateAndAadDetails() (*ResourceCertificateAndAadDetails, bool) { - return &rcaad, true -} - -// AsResourceCertificateAndAcsDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateAndAadDetails. -func (rcaad ResourceCertificateAndAadDetails) AsResourceCertificateAndAcsDetails() (*ResourceCertificateAndAcsDetails, bool) { - return nil, false -} - -// AsResourceCertificateDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateAndAadDetails. -func (rcaad ResourceCertificateAndAadDetails) AsResourceCertificateDetails() (*ResourceCertificateDetails, bool) { - return nil, false -} - -// AsBasicResourceCertificateDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateAndAadDetails. -func (rcaad ResourceCertificateAndAadDetails) AsBasicResourceCertificateDetails() (BasicResourceCertificateDetails, bool) { - return &rcaad, true -} - -// ResourceCertificateAndAcsDetails certificate details representing the Vault credentials for ACS. -type ResourceCertificateAndAcsDetails struct { - // GlobalAcsNamespace - ACS namespace name - tenant for our service. - GlobalAcsNamespace *string `json:"globalAcsNamespace,omitempty"` - // GlobalAcsHostName - Acs mgmt host name to connect to. - GlobalAcsHostName *string `json:"globalAcsHostName,omitempty"` - // GlobalAcsRPRealm - Global ACS namespace RP realm. - GlobalAcsRPRealm *string `json:"globalAcsRPRealm,omitempty"` - // Certificate - The base64 encoded certificate raw data string. - Certificate *[]byte `json:"certificate,omitempty"` - // FriendlyName - Certificate friendly name. - FriendlyName *string `json:"friendlyName,omitempty"` - // Issuer - Certificate issuer. - Issuer *string `json:"issuer,omitempty"` - // ResourceID - Resource ID of the vault. - ResourceID *int64 `json:"resourceId,omitempty"` - // Subject - Certificate Subject Name. - Subject *string `json:"subject,omitempty"` - // Thumbprint - Certificate thumbprint. - Thumbprint *string `json:"thumbprint,omitempty"` - // ValidFrom - Certificate Validity start Date time. - ValidFrom *date.Time `json:"validFrom,omitempty"` - // ValidTo - Certificate Validity End Date time. - ValidTo *date.Time `json:"validTo,omitempty"` - // AuthType - Possible values include: 'AuthTypeBasicResourceCertificateDetailsAuthTypeResourceCertificateDetails', 'AuthTypeBasicResourceCertificateDetailsAuthTypeAzureActiveDirectory', 'AuthTypeBasicResourceCertificateDetailsAuthTypeAccessControlService' - AuthType AuthTypeBasicResourceCertificateDetails `json:"authType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceCertificateAndAcsDetails. -func (rcaad ResourceCertificateAndAcsDetails) MarshalJSON() ([]byte, error) { - rcaad.AuthType = AuthTypeBasicResourceCertificateDetailsAuthTypeAccessControlService - objectMap := make(map[string]interface{}) - if rcaad.GlobalAcsNamespace != nil { - objectMap["globalAcsNamespace"] = rcaad.GlobalAcsNamespace - } - if rcaad.GlobalAcsHostName != nil { - objectMap["globalAcsHostName"] = rcaad.GlobalAcsHostName - } - if rcaad.GlobalAcsRPRealm != nil { - objectMap["globalAcsRPRealm"] = rcaad.GlobalAcsRPRealm - } - if rcaad.Certificate != nil { - objectMap["certificate"] = rcaad.Certificate - } - if rcaad.FriendlyName != nil { - objectMap["friendlyName"] = rcaad.FriendlyName - } - if rcaad.Issuer != nil { - objectMap["issuer"] = rcaad.Issuer - } - if rcaad.ResourceID != nil { - objectMap["resourceId"] = rcaad.ResourceID - } - if rcaad.Subject != nil { - objectMap["subject"] = rcaad.Subject - } - if rcaad.Thumbprint != nil { - objectMap["thumbprint"] = rcaad.Thumbprint - } - if rcaad.ValidFrom != nil { - objectMap["validFrom"] = rcaad.ValidFrom - } - if rcaad.ValidTo != nil { - objectMap["validTo"] = rcaad.ValidTo - } - if rcaad.AuthType != "" { - objectMap["authType"] = rcaad.AuthType - } - return json.Marshal(objectMap) -} - -// AsResourceCertificateAndAadDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateAndAcsDetails. -func (rcaad ResourceCertificateAndAcsDetails) AsResourceCertificateAndAadDetails() (*ResourceCertificateAndAadDetails, bool) { - return nil, false -} - -// AsResourceCertificateAndAcsDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateAndAcsDetails. -func (rcaad ResourceCertificateAndAcsDetails) AsResourceCertificateAndAcsDetails() (*ResourceCertificateAndAcsDetails, bool) { - return &rcaad, true -} - -// AsResourceCertificateDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateAndAcsDetails. -func (rcaad ResourceCertificateAndAcsDetails) AsResourceCertificateDetails() (*ResourceCertificateDetails, bool) { - return nil, false -} - -// AsBasicResourceCertificateDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateAndAcsDetails. -func (rcaad ResourceCertificateAndAcsDetails) AsBasicResourceCertificateDetails() (BasicResourceCertificateDetails, bool) { - return &rcaad, true -} - -// BasicResourceCertificateDetails certificate details representing the Vault credentials. -type BasicResourceCertificateDetails interface { - AsResourceCertificateAndAadDetails() (*ResourceCertificateAndAadDetails, bool) - AsResourceCertificateAndAcsDetails() (*ResourceCertificateAndAcsDetails, bool) - AsResourceCertificateDetails() (*ResourceCertificateDetails, bool) -} - -// ResourceCertificateDetails certificate details representing the Vault credentials. -type ResourceCertificateDetails struct { - // Certificate - The base64 encoded certificate raw data string. - Certificate *[]byte `json:"certificate,omitempty"` - // FriendlyName - Certificate friendly name. - FriendlyName *string `json:"friendlyName,omitempty"` - // Issuer - Certificate issuer. - Issuer *string `json:"issuer,omitempty"` - // ResourceID - Resource ID of the vault. - ResourceID *int64 `json:"resourceId,omitempty"` - // Subject - Certificate Subject Name. - Subject *string `json:"subject,omitempty"` - // Thumbprint - Certificate thumbprint. - Thumbprint *string `json:"thumbprint,omitempty"` - // ValidFrom - Certificate Validity start Date time. - ValidFrom *date.Time `json:"validFrom,omitempty"` - // ValidTo - Certificate Validity End Date time. - ValidTo *date.Time `json:"validTo,omitempty"` - // AuthType - Possible values include: 'AuthTypeBasicResourceCertificateDetailsAuthTypeResourceCertificateDetails', 'AuthTypeBasicResourceCertificateDetailsAuthTypeAzureActiveDirectory', 'AuthTypeBasicResourceCertificateDetailsAuthTypeAccessControlService' - AuthType AuthTypeBasicResourceCertificateDetails `json:"authType,omitempty"` -} - -func unmarshalBasicResourceCertificateDetails(body []byte) (BasicResourceCertificateDetails, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["authType"] { - case string(AuthTypeBasicResourceCertificateDetailsAuthTypeAzureActiveDirectory): - var rcaad ResourceCertificateAndAadDetails - err := json.Unmarshal(body, &rcaad) - return rcaad, err - case string(AuthTypeBasicResourceCertificateDetailsAuthTypeAccessControlService): - var rcaad ResourceCertificateAndAcsDetails - err := json.Unmarshal(body, &rcaad) - return rcaad, err - default: - var rcd ResourceCertificateDetails - err := json.Unmarshal(body, &rcd) - return rcd, err - } -} -func unmarshalBasicResourceCertificateDetailsArray(body []byte) ([]BasicResourceCertificateDetails, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rcdArray := make([]BasicResourceCertificateDetails, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rcd, err := unmarshalBasicResourceCertificateDetails(*rawMessage) - if err != nil { - return nil, err - } - rcdArray[index] = rcd - } - return rcdArray, nil -} - -// MarshalJSON is the custom marshaler for ResourceCertificateDetails. -func (rcd ResourceCertificateDetails) MarshalJSON() ([]byte, error) { - rcd.AuthType = AuthTypeBasicResourceCertificateDetailsAuthTypeResourceCertificateDetails - objectMap := make(map[string]interface{}) - if rcd.Certificate != nil { - objectMap["certificate"] = rcd.Certificate - } - if rcd.FriendlyName != nil { - objectMap["friendlyName"] = rcd.FriendlyName - } - if rcd.Issuer != nil { - objectMap["issuer"] = rcd.Issuer - } - if rcd.ResourceID != nil { - objectMap["resourceId"] = rcd.ResourceID - } - if rcd.Subject != nil { - objectMap["subject"] = rcd.Subject - } - if rcd.Thumbprint != nil { - objectMap["thumbprint"] = rcd.Thumbprint - } - if rcd.ValidFrom != nil { - objectMap["validFrom"] = rcd.ValidFrom - } - if rcd.ValidTo != nil { - objectMap["validTo"] = rcd.ValidTo - } - if rcd.AuthType != "" { - objectMap["authType"] = rcd.AuthType - } - return json.Marshal(objectMap) -} - -// AsResourceCertificateAndAadDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateDetails. -func (rcd ResourceCertificateDetails) AsResourceCertificateAndAadDetails() (*ResourceCertificateAndAadDetails, bool) { - return nil, false -} - -// AsResourceCertificateAndAcsDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateDetails. -func (rcd ResourceCertificateDetails) AsResourceCertificateAndAcsDetails() (*ResourceCertificateAndAcsDetails, bool) { - return nil, false -} - -// AsResourceCertificateDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateDetails. -func (rcd ResourceCertificateDetails) AsResourceCertificateDetails() (*ResourceCertificateDetails, bool) { - return &rcd, true -} - -// AsBasicResourceCertificateDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateDetails. -func (rcd ResourceCertificateDetails) AsBasicResourceCertificateDetails() (BasicResourceCertificateDetails, bool) { - return &rcd, true -} - -// Sku identifies the unique system identifier for each Azure resource. -type Sku struct { - // Name - The Sku name. Possible values include: 'SkuNameStandard', 'SkuNameRS0' - Name SkuName `json:"name,omitempty"` - // Tier - The Sku tier. - Tier *string `json:"tier,omitempty"` - // Family - The sku family - Family *string `json:"family,omitempty"` - // Size - The sku size - Size *string `json:"size,omitempty"` - // Capacity - The sku capacity - Capacity *string `json:"capacity,omitempty"` -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The type of identity that last modified the resource. - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// TrackedResource tracked resource with location. -type TrackedResource struct { - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - // Etag - Optional ETag. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Location != nil { - objectMap["location"] = tr.Location - } - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Etag != nil { - objectMap["etag"] = tr.Etag - } - return json.Marshal(objectMap) -} - -// UpgradeDetails details for upgrading vault. -type UpgradeDetails struct { - // OperationID - READ-ONLY; ID of the vault upgrade operation. - OperationID *string `json:"operationId,omitempty"` - // StartTimeUtc - READ-ONLY; UTC time at which the upgrade operation has started. - StartTimeUtc *date.Time `json:"startTimeUtc,omitempty"` - // LastUpdatedTimeUtc - READ-ONLY; UTC time at which the upgrade operation status was last updated. - LastUpdatedTimeUtc *date.Time `json:"lastUpdatedTimeUtc,omitempty"` - // EndTimeUtc - READ-ONLY; UTC time at which the upgrade operation has ended. - EndTimeUtc *date.Time `json:"endTimeUtc,omitempty"` - // Status - READ-ONLY; Status of the vault upgrade operation. Possible values include: 'VaultUpgradeStateUnknown', 'VaultUpgradeStateInProgress', 'VaultUpgradeStateUpgraded', 'VaultUpgradeStateFailed' - Status VaultUpgradeState `json:"status,omitempty"` - // Message - READ-ONLY; Message to the user containing information about the upgrade operation. - Message *string `json:"message,omitempty"` - // TriggerType - READ-ONLY; The way the vault upgrade was triggered. Possible values include: 'TriggerTypeUserTriggered', 'TriggerTypeForcedUpgrade' - TriggerType TriggerType `json:"triggerType,omitempty"` - // UpgradedResourceID - READ-ONLY; Resource ID of the upgraded vault. - UpgradedResourceID *string `json:"upgradedResourceId,omitempty"` - // PreviousResourceID - READ-ONLY; Resource ID of the vault before the upgrade. - PreviousResourceID *string `json:"previousResourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for UpgradeDetails. -func (ud UpgradeDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// UserIdentity a resource identity that is managed by the user of the service. -type UserIdentity struct { - // PrincipalID - READ-ONLY; The principal ID of the user-assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - READ-ONLY; The client ID of the user-assigned identity. - ClientID *string `json:"clientId,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserIdentity. -func (UI UserIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Vault resource information, as returned by the resource provider. -type Vault struct { - autorest.Response `json:"-"` - Identity *IdentityData `json:"identity,omitempty"` - Properties *VaultProperties `json:"properties,omitempty"` - Sku *Sku `json:"sku,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - // Etag - Optional ETag. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for Vault. -func (vVar Vault) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vVar.Identity != nil { - objectMap["identity"] = vVar.Identity - } - if vVar.Properties != nil { - objectMap["properties"] = vVar.Properties - } - if vVar.Sku != nil { - objectMap["sku"] = vVar.Sku - } - if vVar.SystemData != nil { - objectMap["systemData"] = vVar.SystemData - } - if vVar.Location != nil { - objectMap["location"] = vVar.Location - } - if vVar.Tags != nil { - objectMap["tags"] = vVar.Tags - } - if vVar.Etag != nil { - objectMap["etag"] = vVar.Etag - } - return json.Marshal(objectMap) -} - -// VaultCertificateResponse certificate corresponding to a vault that can be used by clients to register -// themselves with the vault. -type VaultCertificateResponse struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - Properties BasicResourceCertificateDetails `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for VaultCertificateResponse. -func (vcr VaultCertificateResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["properties"] = vcr.Properties - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VaultCertificateResponse struct. -func (vcr *VaultCertificateResponse) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vcr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vcr.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vcr.ID = &ID - } - case "properties": - if v != nil { - properties, err := unmarshalBasicResourceCertificateDetails(*v) - if err != nil { - return err - } - vcr.Properties = properties - } - } - } - - return nil -} - -// VaultExtendedInfo vault extended information. -type VaultExtendedInfo struct { - // IntegrityKey - Integrity key. - IntegrityKey *string `json:"integrityKey,omitempty"` - // EncryptionKey - Encryption key. - EncryptionKey *string `json:"encryptionKey,omitempty"` - // EncryptionKeyThumbprint - Encryption key thumbprint. - EncryptionKeyThumbprint *string `json:"encryptionKeyThumbprint,omitempty"` - // Algorithm - Algorithm for Vault ExtendedInfo - Algorithm *string `json:"algorithm,omitempty"` -} - -// VaultExtendedInfoResource vault extended information. -type VaultExtendedInfoResource struct { - autorest.Response `json:"-"` - *VaultExtendedInfo `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - // Etag - Optional ETag. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for VaultExtendedInfoResource. -func (veir VaultExtendedInfoResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if veir.VaultExtendedInfo != nil { - objectMap["properties"] = veir.VaultExtendedInfo - } - if veir.Etag != nil { - objectMap["etag"] = veir.Etag - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VaultExtendedInfoResource struct. -func (veir *VaultExtendedInfoResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var vaultExtendedInfo VaultExtendedInfo - err = json.Unmarshal(*v, &vaultExtendedInfo) - if err != nil { - return err - } - veir.VaultExtendedInfo = &vaultExtendedInfo - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - veir.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - veir.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - veir.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - veir.Etag = &etag - } - } - } - - return nil -} - -// VaultList the response model for a list of Vaults. -type VaultList struct { - autorest.Response `json:"-"` - Value *[]Vault `json:"value,omitempty"` - // NextLink - READ-ONLY - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for VaultList. -func (vl VaultList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vl.Value != nil { - objectMap["value"] = vl.Value - } - return json.Marshal(objectMap) -} - -// VaultListIterator provides access to a complete listing of Vault values. -type VaultListIterator struct { - i int - page VaultListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VaultListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *VaultListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VaultListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VaultListIterator) Response() VaultList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VaultListIterator) Value() Vault { - if !iter.page.NotDone() { - return Vault{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VaultListIterator type. -func NewVaultListIterator(page VaultListPage) VaultListIterator { - return VaultListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vl VaultList) IsEmpty() bool { - return vl.Value == nil || len(*vl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vl VaultList) hasNextLink() bool { - return vl.NextLink != nil && len(*vl.NextLink) != 0 -} - -// vaultListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vl VaultList) vaultListPreparer(ctx context.Context) (*http.Request, error) { - if !vl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vl.NextLink))) -} - -// VaultListPage contains a page of Vault values. -type VaultListPage struct { - fn func(context.Context, VaultList) (VaultList, error) - vl VaultList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VaultListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.vl) - if err != nil { - return err - } - page.vl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *VaultListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VaultListPage) NotDone() bool { - return !page.vl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VaultListPage) Response() VaultList { - return page.vl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VaultListPage) Values() []Vault { - if page.vl.IsEmpty() { - return nil - } - return *page.vl.Value -} - -// Creates a new instance of the VaultListPage type. -func NewVaultListPage(cur VaultList, getNextPage func(context.Context, VaultList) (VaultList, error)) VaultListPage { - return VaultListPage{ - fn: getNextPage, - vl: cur, - } -} - -// VaultProperties properties of the vault. -type VaultProperties struct { - // ProvisioningState - READ-ONLY; Provisioning State. - ProvisioningState *string `json:"provisioningState,omitempty"` - UpgradeDetails *UpgradeDetails `json:"upgradeDetails,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of private endpoint connection. - PrivateEndpointConnections *[]PrivateEndpointConnectionVaultProperties `json:"privateEndpointConnections,omitempty"` - // PrivateEndpointStateForBackup - READ-ONLY; Private endpoint state for backup. Possible values include: 'VaultPrivateEndpointStateNone', 'VaultPrivateEndpointStateEnabled' - PrivateEndpointStateForBackup VaultPrivateEndpointState `json:"privateEndpointStateForBackup,omitempty"` - // PrivateEndpointStateForSiteRecovery - READ-ONLY; Private endpoint state for site recovery. Possible values include: 'VaultPrivateEndpointStateNone', 'VaultPrivateEndpointStateEnabled' - PrivateEndpointStateForSiteRecovery VaultPrivateEndpointState `json:"privateEndpointStateForSiteRecovery,omitempty"` - // Encryption - Customer Managed Key details of the resource. - Encryption *VaultPropertiesEncryption `json:"encryption,omitempty"` - // MoveDetails - The details of the latest move operation performed on the Azure Resource - MoveDetails *VaultPropertiesMoveDetails `json:"moveDetails,omitempty"` - // MoveState - READ-ONLY; The State of the Resource after the move operation. Possible values include: 'ResourceMoveStateUnknown', 'ResourceMoveStateInProgress', 'ResourceMoveStatePrepareFailed', 'ResourceMoveStateCommitFailed', 'ResourceMoveStatePrepareTimedout', 'ResourceMoveStateCommitTimedout', 'ResourceMoveStateMoveSucceeded', 'ResourceMoveStateFailure', 'ResourceMoveStateCriticalFailure', 'ResourceMoveStatePartialSuccess' - MoveState ResourceMoveState `json:"moveState,omitempty"` -} - -// MarshalJSON is the custom marshaler for VaultProperties. -func (vp VaultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vp.UpgradeDetails != nil { - objectMap["upgradeDetails"] = vp.UpgradeDetails - } - if vp.Encryption != nil { - objectMap["encryption"] = vp.Encryption - } - if vp.MoveDetails != nil { - objectMap["moveDetails"] = vp.MoveDetails - } - return json.Marshal(objectMap) -} - -// VaultPropertiesEncryption customer Managed Key details of the resource. -type VaultPropertiesEncryption struct { - KeyVaultProperties *CmkKeyVaultProperties `json:"keyVaultProperties,omitempty"` - KekIdentity *CmkKekIdentity `json:"kekIdentity,omitempty"` - // InfrastructureEncryption - Enabling/Disabling the Double Encryption state. Possible values include: 'InfrastructureEncryptionStateEnabled', 'InfrastructureEncryptionStateDisabled' - InfrastructureEncryption InfrastructureEncryptionState `json:"infrastructureEncryption,omitempty"` -} - -// VaultPropertiesMoveDetails the details of the latest move operation performed on the Azure Resource -type VaultPropertiesMoveDetails struct { - // OperationID - READ-ONLY; OperationId of the Resource Move Operation - OperationID *string `json:"operationId,omitempty"` - // StartTimeUtc - READ-ONLY; Start Time of the Resource Move Operation - StartTimeUtc *date.Time `json:"startTimeUtc,omitempty"` - // CompletionTimeUtc - READ-ONLY; End Time of the Resource Move Operation - CompletionTimeUtc *date.Time `json:"completionTimeUtc,omitempty"` - // SourceResourceID - READ-ONLY; Source Resource of the Resource Move Operation - SourceResourceID *string `json:"sourceResourceId,omitempty"` - // TargetResourceID - READ-ONLY; Target Resource of the Resource Move Operation - TargetResourceID *string `json:"targetResourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for VaultPropertiesMoveDetails. -func (vpD VaultPropertiesMoveDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VaultsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VaultsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VaultsClient) (Vault, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VaultsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VaultsCreateOrUpdateFuture.Result. -func (future *VaultsCreateOrUpdateFuture) result(client VaultsClient) (vVar Vault, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vVar.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("recoveryservices.VaultsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vVar.Response.Response, err = future.GetResult(sender); err == nil && vVar.Response.Response.StatusCode != http.StatusNoContent { - vVar, err = client.CreateOrUpdateResponder(vVar.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsCreateOrUpdateFuture", "Result", vVar.Response.Response, "Failure responding to request") - } - } - return -} - -// VaultsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type VaultsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VaultsClient) (Vault, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VaultsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VaultsUpdateFuture.Result. -func (future *VaultsUpdateFuture) result(client VaultsClient) (vVar Vault, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vVar.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("recoveryservices.VaultsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vVar.Response.Response, err = future.GetResult(sender); err == nil && vVar.Response.Response.StatusCode != http.StatusNoContent { - vVar, err = client.UpdateResponder(vVar.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsUpdateFuture", "Result", vVar.Response.Response, "Failure responding to request") - } - } - return -} - -// VaultUsage usages of a vault. -type VaultUsage struct { - // Unit - Unit of the usage. Possible values include: 'UsagesUnitCount', 'UsagesUnitBytes', 'UsagesUnitSeconds', 'UsagesUnitPercent', 'UsagesUnitCountPerSecond', 'UsagesUnitBytesPerSecond' - Unit UsagesUnit `json:"unit,omitempty"` - // QuotaPeriod - Quota period of usage. - QuotaPeriod *string `json:"quotaPeriod,omitempty"` - // NextResetTime - Next reset time of usage. - NextResetTime *date.Time `json:"nextResetTime,omitempty"` - // CurrentValue - Current value of usage. - CurrentValue *int64 `json:"currentValue,omitempty"` - // Limit - Limit of usage. - Limit *int64 `json:"limit,omitempty"` - // Name - Name of usage. - Name *NameInfo `json:"name,omitempty"` -} - -// VaultUsageList usage for vault. -type VaultUsageList struct { - autorest.Response `json:"-"` - // Value - The list of usages for the given vault. - Value *[]VaultUsage `json:"value,omitempty"` -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/operations.go deleted file mode 100644 index e6394ba058d5..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the recovery Services Client -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List returns the list of available operations. -func (client OperationsClient) List(ctx context.Context) (result ClientDiscoveryResponsePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.cdr.Response.Response != nil { - sc = result.cdr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.cdr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.cdr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.cdr.hasNextLink() && result.cdr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.RecoveryServices/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result ClientDiscoveryResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults ClientDiscoveryResponse) (result ClientDiscoveryResponse, err error) { - req, err := lastResults.clientDiscoveryResponsePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result ClientDiscoveryResponseIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/privatelinkresources.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/privatelinkresources.go deleted file mode 100644 index d550a9495608..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/privatelinkresources.go +++ /dev/null @@ -1,227 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateLinkResourcesClient is the recovery Services Client -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get sends the get request. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, vaultName string, privateLinkResourceName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, vaultName, privateLinkResourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, vaultName string, privateLinkResourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateLinkResourceName": autorest.Encode("path", privateLinkResourceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateLinkResources/{privateLinkResourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) GetResponder(resp *http.Response) (result PrivateLinkResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List sends the list request. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -func (client PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, vaultName string) (result PrivateLinkResourcesPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") - defer func() { - sc := -1 - if result.plr.Response.Response != nil { - sc = result.plr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, vaultName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.PrivateLinkResourcesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.plr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.PrivateLinkResourcesClient", "List", resp, "Failure sending request") - return - } - - result.plr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.PrivateLinkResourcesClient", "List", resp, "Failure responding to request") - return - } - if result.plr.hasNextLink() && result.plr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListResponder(resp *http.Response) (result PrivateLinkResources, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client PrivateLinkResourcesClient) listNextResults(ctx context.Context, lastResults PrivateLinkResources) (result PrivateLinkResources, err error) { - req, err := lastResults.privateLinkResourcesPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "recoveryservices.PrivateLinkResourcesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "recoveryservices.PrivateLinkResourcesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.PrivateLinkResourcesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkResourcesClient) ListComplete(ctx context.Context, resourceGroupName string, vaultName string) (result PrivateLinkResourcesIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, vaultName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/recoveryservices.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/recoveryservices.go deleted file mode 100644 index 113cdedcb770..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/recoveryservices.go +++ /dev/null @@ -1,110 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// Client is the recovery Services Client -type Client struct { - BaseClient -} - -// NewClient creates an instance of the Client client. -func NewClient(subscriptionID string) Client { - return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClientWithBaseURI creates an instance of the Client client using a custom endpoint. Use this when interacting -// with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { - return Client{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability sends the check name availability request. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// location - location of the resource -// input - contains information about Resource type and Resource name -func (client Client) CheckNameAvailability(ctx context.Context, resourceGroupName string, location string, input CheckNameAvailabilityParameters) (result CheckNameAvailabilityResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.CheckNameAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CheckNameAvailabilityPreparer(ctx, resourceGroupName, location, input) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.Client", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.Client", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.Client", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client Client) CheckNameAvailabilityPreparer(ctx context.Context, resourceGroupName string, location string, input CheckNameAvailabilityParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/locations/{location}/checkNameAvailability", pathParameters), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client Client) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client Client) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/registeredidentities.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/registeredidentities.go deleted file mode 100644 index fe095a037739..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/registeredidentities.go +++ /dev/null @@ -1,109 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// RegisteredIdentitiesClient is the recovery Services Client -type RegisteredIdentitiesClient struct { - BaseClient -} - -// NewRegisteredIdentitiesClient creates an instance of the RegisteredIdentitiesClient client. -func NewRegisteredIdentitiesClient(subscriptionID string) RegisteredIdentitiesClient { - return NewRegisteredIdentitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRegisteredIdentitiesClientWithBaseURI creates an instance of the RegisteredIdentitiesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewRegisteredIdentitiesClientWithBaseURI(baseURI string, subscriptionID string) RegisteredIdentitiesClient { - return RegisteredIdentitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete unregisters the given container from your Recovery Services vault. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -// identityName - name of the protection container to unregister. -func (client RegisteredIdentitiesClient) Delete(ctx context.Context, resourceGroupName string, vaultName string, identityName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegisteredIdentitiesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, vaultName, identityName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.RegisteredIdentitiesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "recoveryservices.RegisteredIdentitiesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.RegisteredIdentitiesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RegisteredIdentitiesClient) DeletePreparer(ctx context.Context, resourceGroupName string, vaultName string, identityName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityName": autorest.Encode("path", identityName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/registeredIdentities/{identityName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RegisteredIdentitiesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RegisteredIdentitiesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/replicationusages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/replicationusages.go deleted file mode 100644 index d016b0fb9d54..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/replicationusages.go +++ /dev/null @@ -1,108 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ReplicationUsagesClient is the recovery Services Client -type ReplicationUsagesClient struct { - BaseClient -} - -// NewReplicationUsagesClient creates an instance of the ReplicationUsagesClient client. -func NewReplicationUsagesClient(subscriptionID string) ReplicationUsagesClient { - return NewReplicationUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewReplicationUsagesClientWithBaseURI creates an instance of the ReplicationUsagesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewReplicationUsagesClientWithBaseURI(baseURI string, subscriptionID string) ReplicationUsagesClient { - return ReplicationUsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List fetches the replication usages of the vault. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -func (client ReplicationUsagesClient) List(ctx context.Context, resourceGroupName string, vaultName string) (result ReplicationUsageList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationUsagesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, vaultName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.ReplicationUsagesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.ReplicationUsagesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.ReplicationUsagesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ReplicationUsagesClient) ListPreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/replicationUsages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ReplicationUsagesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ReplicationUsagesClient) ListResponder(resp *http.Response) (result ReplicationUsageList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/usages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/usages.go deleted file mode 100644 index 8d0bcde28eb5..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/usages.go +++ /dev/null @@ -1,107 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// UsagesClient is the recovery Services Client -type UsagesClient struct { - BaseClient -} - -// NewUsagesClient creates an instance of the UsagesClient client. -func NewUsagesClient(subscriptionID string) UsagesClient { - return NewUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUsagesClientWithBaseURI creates an instance of the UsagesClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesClient { - return UsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByVaults fetches the usages of the vault. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -func (client UsagesClient) ListByVaults(ctx context.Context, resourceGroupName string, vaultName string) (result VaultUsageList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.ListByVaults") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByVaultsPreparer(ctx, resourceGroupName, vaultName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.UsagesClient", "ListByVaults", nil, "Failure preparing request") - return - } - - resp, err := client.ListByVaultsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.UsagesClient", "ListByVaults", resp, "Failure sending request") - return - } - - result, err = client.ListByVaultsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.UsagesClient", "ListByVaults", resp, "Failure responding to request") - return - } - - return -} - -// ListByVaultsPreparer prepares the ListByVaults request. -func (client UsagesClient) ListByVaultsPreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByVaultsSender sends the ListByVaults request. The method will close the -// http.Response Body if it receives an error. -func (client UsagesClient) ListByVaultsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByVaultsResponder handles the response to the ListByVaults request. The method always -// closes the http.Response Body. -func (client UsagesClient) ListByVaultsResponder(resp *http.Response) (result VaultUsageList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/vaultcertificates.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/vaultcertificates.go deleted file mode 100644 index ccb7419f50a1..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/vaultcertificates.go +++ /dev/null @@ -1,113 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// VaultCertificatesClient is the recovery Services Client -type VaultCertificatesClient struct { - BaseClient -} - -// NewVaultCertificatesClient creates an instance of the VaultCertificatesClient client. -func NewVaultCertificatesClient(subscriptionID string) VaultCertificatesClient { - return NewVaultCertificatesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVaultCertificatesClientWithBaseURI creates an instance of the VaultCertificatesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewVaultCertificatesClientWithBaseURI(baseURI string, subscriptionID string) VaultCertificatesClient { - return VaultCertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create uploads a certificate for a resource. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -// certificateName - certificate friendly name. -// certificateRequest - input parameters for uploading the vault certificate. -func (client VaultCertificatesClient) Create(ctx context.Context, resourceGroupName string, vaultName string, certificateName string, certificateRequest CertificateRequest) (result VaultCertificateResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultCertificatesClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreatePreparer(ctx, resourceGroupName, vaultName, certificateName, certificateRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultCertificatesClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultCertificatesClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultCertificatesClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client VaultCertificatesClient) CreatePreparer(ctx context.Context, resourceGroupName string, vaultName string, certificateName string, certificateRequest CertificateRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/certificates/{certificateName}", pathParameters), - autorest.WithJSON(certificateRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client VaultCertificatesClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client VaultCertificatesClient) CreateResponder(resp *http.Response) (result VaultCertificateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/vaultextendedinfo.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/vaultextendedinfo.go deleted file mode 100644 index 3a5daa3e82b4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/vaultextendedinfo.go +++ /dev/null @@ -1,266 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// VaultExtendedInfoClient is the recovery Services Client -type VaultExtendedInfoClient struct { - BaseClient -} - -// NewVaultExtendedInfoClient creates an instance of the VaultExtendedInfoClient client. -func NewVaultExtendedInfoClient(subscriptionID string) VaultExtendedInfoClient { - return NewVaultExtendedInfoClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVaultExtendedInfoClientWithBaseURI creates an instance of the VaultExtendedInfoClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewVaultExtendedInfoClientWithBaseURI(baseURI string, subscriptionID string) VaultExtendedInfoClient { - return VaultExtendedInfoClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create vault extended info. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -// resourceResourceExtendedInfoDetails - details of ResourceExtendedInfo -func (client VaultExtendedInfoClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, resourceResourceExtendedInfoDetails VaultExtendedInfoResource) (result VaultExtendedInfoResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultExtendedInfoClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, vaultName, resourceResourceExtendedInfoDetails) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VaultExtendedInfoClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, vaultName string, resourceResourceExtendedInfoDetails VaultExtendedInfoResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo", pathParameters), - autorest.WithJSON(resourceResourceExtendedInfoDetails), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VaultExtendedInfoClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VaultExtendedInfoClient) CreateOrUpdateResponder(resp *http.Response) (result VaultExtendedInfoResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get the vault extended info. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -func (client VaultExtendedInfoClient) Get(ctx context.Context, resourceGroupName string, vaultName string) (result VaultExtendedInfoResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultExtendedInfoClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, vaultName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VaultExtendedInfoClient) GetPreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VaultExtendedInfoClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VaultExtendedInfoClient) GetResponder(resp *http.Response) (result VaultExtendedInfoResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update vault extended info. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -// resourceResourceExtendedInfoDetails - details of ResourceExtendedInfo -func (client VaultExtendedInfoClient) Update(ctx context.Context, resourceGroupName string, vaultName string, resourceResourceExtendedInfoDetails VaultExtendedInfoResource) (result VaultExtendedInfoResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultExtendedInfoClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, vaultName, resourceResourceExtendedInfoDetails) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client VaultExtendedInfoClient) UpdatePreparer(ctx context.Context, resourceGroupName string, vaultName string, resourceResourceExtendedInfoDetails VaultExtendedInfoResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo", pathParameters), - autorest.WithJSON(resourceResourceExtendedInfoDetails), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client VaultExtendedInfoClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client VaultExtendedInfoClient) UpdateResponder(resp *http.Response) (result VaultExtendedInfoResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/vaults.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/vaults.go deleted file mode 100644 index 839f9a9df309..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/vaults.go +++ /dev/null @@ -1,575 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// VaultsClient is the recovery Services Client -type VaultsClient struct { - BaseClient -} - -// NewVaultsClient creates an instance of the VaultsClient client. -func NewVaultsClient(subscriptionID string) VaultsClient { - return NewVaultsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVaultsClientWithBaseURI creates an instance of the VaultsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewVaultsClientWithBaseURI(baseURI string, subscriptionID string) VaultsClient { - return VaultsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a Recovery Services vault. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -// vault - recovery Services Vault to be created. -func (client VaultsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, vault Vault) (result VaultsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, vaultName, vault) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VaultsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, vaultName string, vault Vault) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}", pathParameters), - autorest.WithJSON(vault), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) CreateOrUpdateSender(req *http.Request) (future VaultsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VaultsClient) CreateOrUpdateResponder(resp *http.Response) (result Vault, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a vault. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -func (client VaultsClient) Delete(ctx context.Context, resourceGroupName string, vaultName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, vaultName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VaultsClient) DeletePreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VaultsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get the Vault details. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -func (client VaultsClient) Get(ctx context.Context, resourceGroupName string, vaultName string) (result Vault, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, vaultName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VaultsClient) GetPreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VaultsClient) GetResponder(resp *http.Response) (result Vault, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup retrieve a list of Vaults. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -func (client VaultsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result VaultListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.vl.Response.Response != nil { - sc = result.vl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.vl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.vl, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.vl.hasNextLink() && result.vl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client VaultsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client VaultsClient) ListByResourceGroupResponder(resp *http.Response) (result VaultList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client VaultsClient) listByResourceGroupNextResults(ctx context.Context, lastResults VaultList) (result VaultList, err error) { - req, err := lastResults.vaultListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client VaultsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result VaultListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListBySubscriptionID fetches all the resources of the specified type in the subscription. -func (client VaultsClient) ListBySubscriptionID(ctx context.Context) (result VaultListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.ListBySubscriptionID") - defer func() { - sc := -1 - if result.vl.Response.Response != nil { - sc = result.vl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionIDNextResults - req, err := client.ListBySubscriptionIDPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.vl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result.vl, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListBySubscriptionID", resp, "Failure responding to request") - return - } - if result.vl.hasNextLink() && result.vl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client VaultsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/vaults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client VaultsClient) ListBySubscriptionIDResponder(resp *http.Response) (result VaultList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionIDNextResults retrieves the next set of results, if any. -func (client VaultsClient) listBySubscriptionIDNextResults(ctx context.Context, lastResults VaultList) (result VaultList, err error) { - req, err := lastResults.vaultListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "listBySubscriptionIDNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "listBySubscriptionIDNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "listBySubscriptionIDNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionIDComplete enumerates all values, automatically crossing page boundaries as required. -func (client VaultsClient) ListBySubscriptionIDComplete(ctx context.Context) (result VaultListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.ListBySubscriptionID") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscriptionID(ctx) - return -} - -// Update updates the vault. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -// vault - recovery Services Vault to be created. -func (client VaultsClient) Update(ctx context.Context, resourceGroupName string, vaultName string, vault PatchVault) (result VaultsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, vaultName, vault) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client VaultsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, vaultName string, vault PatchVault) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}", pathParameters), - autorest.WithJSON(vault), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) UpdateSender(req *http.Request) (future VaultsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client VaultsClient) UpdateResponder(resp *http.Response) (result Vault, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/version.go deleted file mode 100644 index 91a651916f34..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package recoveryservices - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " recoveryservices/2021-08-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/README.md new file mode 100644 index 000000000000..6441bcde3a58 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/README.md @@ -0,0 +1,120 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults` Documentation + +The `vaults` SDK allows for interaction with the Azure Resource Manager Service `recoveryservices` (API Version `2021-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults" +``` + + +### Client Initialization + +```go +client := vaults.NewVaultsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VaultsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := vaults.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +payload := vaults.Vault{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VaultsClient.Delete` + +```go +ctx := context.TODO() +id := vaults.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VaultsClient.Get` + +```go +ctx := context.TODO() +id := vaults.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VaultsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := vaults.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VaultsClient.ListBySubscriptionId` + +```go +ctx := context.TODO() +id := vaults.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscriptionId(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionIdComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VaultsClient.Update` + +```go +ctx := context.TODO() +id := vaults.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +payload := vaults.PatchVault{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/client.go new file mode 100644 index 000000000000..6cad2ef703e6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/client.go @@ -0,0 +1,18 @@ +package vaults + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultsClient struct { + Client autorest.Client + baseUri string +} + +func NewVaultsClientWithBaseURI(endpoint string) VaultsClient { + return VaultsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/constants.go new file mode 100644 index 000000000000..fba2fc15efa2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/constants.go @@ -0,0 +1,272 @@ +package vaults + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InfrastructureEncryptionState string + +const ( + InfrastructureEncryptionStateDisabled InfrastructureEncryptionState = "Disabled" + InfrastructureEncryptionStateEnabled InfrastructureEncryptionState = "Enabled" +) + +func PossibleValuesForInfrastructureEncryptionState() []string { + return []string{ + string(InfrastructureEncryptionStateDisabled), + string(InfrastructureEncryptionStateEnabled), + } +} + +func parseInfrastructureEncryptionState(input string) (*InfrastructureEncryptionState, error) { + vals := map[string]InfrastructureEncryptionState{ + "disabled": InfrastructureEncryptionStateDisabled, + "enabled": InfrastructureEncryptionStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InfrastructureEncryptionState(input) + return &out, nil +} + +type PrivateEndpointConnectionStatus string + +const ( + PrivateEndpointConnectionStatusApproved PrivateEndpointConnectionStatus = "Approved" + PrivateEndpointConnectionStatusDisconnected PrivateEndpointConnectionStatus = "Disconnected" + PrivateEndpointConnectionStatusPending PrivateEndpointConnectionStatus = "Pending" + PrivateEndpointConnectionStatusRejected PrivateEndpointConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateEndpointConnectionStatus() []string { + return []string{ + string(PrivateEndpointConnectionStatusApproved), + string(PrivateEndpointConnectionStatusDisconnected), + string(PrivateEndpointConnectionStatusPending), + string(PrivateEndpointConnectionStatusRejected), + } +} + +func parsePrivateEndpointConnectionStatus(input string) (*PrivateEndpointConnectionStatus, error) { + vals := map[string]PrivateEndpointConnectionStatus{ + "approved": PrivateEndpointConnectionStatusApproved, + "disconnected": PrivateEndpointConnectionStatusDisconnected, + "pending": PrivateEndpointConnectionStatusPending, + "rejected": PrivateEndpointConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionStatus(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStatePending ProvisioningState = "Pending" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStatePending), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "pending": ProvisioningStatePending, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type ResourceMoveState string + +const ( + ResourceMoveStateCommitFailed ResourceMoveState = "CommitFailed" + ResourceMoveStateCommitTimedout ResourceMoveState = "CommitTimedout" + ResourceMoveStateCriticalFailure ResourceMoveState = "CriticalFailure" + ResourceMoveStateFailure ResourceMoveState = "Failure" + ResourceMoveStateInProgress ResourceMoveState = "InProgress" + ResourceMoveStateMoveSucceeded ResourceMoveState = "MoveSucceeded" + ResourceMoveStatePartialSuccess ResourceMoveState = "PartialSuccess" + ResourceMoveStatePrepareFailed ResourceMoveState = "PrepareFailed" + ResourceMoveStatePrepareTimedout ResourceMoveState = "PrepareTimedout" + ResourceMoveStateUnknown ResourceMoveState = "Unknown" +) + +func PossibleValuesForResourceMoveState() []string { + return []string{ + string(ResourceMoveStateCommitFailed), + string(ResourceMoveStateCommitTimedout), + string(ResourceMoveStateCriticalFailure), + string(ResourceMoveStateFailure), + string(ResourceMoveStateInProgress), + string(ResourceMoveStateMoveSucceeded), + string(ResourceMoveStatePartialSuccess), + string(ResourceMoveStatePrepareFailed), + string(ResourceMoveStatePrepareTimedout), + string(ResourceMoveStateUnknown), + } +} + +func parseResourceMoveState(input string) (*ResourceMoveState, error) { + vals := map[string]ResourceMoveState{ + "commitfailed": ResourceMoveStateCommitFailed, + "committimedout": ResourceMoveStateCommitTimedout, + "criticalfailure": ResourceMoveStateCriticalFailure, + "failure": ResourceMoveStateFailure, + "inprogress": ResourceMoveStateInProgress, + "movesucceeded": ResourceMoveStateMoveSucceeded, + "partialsuccess": ResourceMoveStatePartialSuccess, + "preparefailed": ResourceMoveStatePrepareFailed, + "preparetimedout": ResourceMoveStatePrepareTimedout, + "unknown": ResourceMoveStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceMoveState(input) + return &out, nil +} + +type SkuName string + +const ( + SkuNameRSZero SkuName = "RS0" + SkuNameStandard SkuName = "Standard" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNameRSZero), + string(SkuNameStandard), + } +} + +func parseSkuName(input string) (*SkuName, error) { + vals := map[string]SkuName{ + "rs0": SkuNameRSZero, + "standard": SkuNameStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuName(input) + return &out, nil +} + +type TriggerType string + +const ( + TriggerTypeForcedUpgrade TriggerType = "ForcedUpgrade" + TriggerTypeUserTriggered TriggerType = "UserTriggered" +) + +func PossibleValuesForTriggerType() []string { + return []string{ + string(TriggerTypeForcedUpgrade), + string(TriggerTypeUserTriggered), + } +} + +func parseTriggerType(input string) (*TriggerType, error) { + vals := map[string]TriggerType{ + "forcedupgrade": TriggerTypeForcedUpgrade, + "usertriggered": TriggerTypeUserTriggered, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TriggerType(input) + return &out, nil +} + +type VaultPrivateEndpointState string + +const ( + VaultPrivateEndpointStateEnabled VaultPrivateEndpointState = "Enabled" + VaultPrivateEndpointStateNone VaultPrivateEndpointState = "None" +) + +func PossibleValuesForVaultPrivateEndpointState() []string { + return []string{ + string(VaultPrivateEndpointStateEnabled), + string(VaultPrivateEndpointStateNone), + } +} + +func parseVaultPrivateEndpointState(input string) (*VaultPrivateEndpointState, error) { + vals := map[string]VaultPrivateEndpointState{ + "enabled": VaultPrivateEndpointStateEnabled, + "none": VaultPrivateEndpointStateNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VaultPrivateEndpointState(input) + return &out, nil +} + +type VaultUpgradeState string + +const ( + VaultUpgradeStateFailed VaultUpgradeState = "Failed" + VaultUpgradeStateInProgress VaultUpgradeState = "InProgress" + VaultUpgradeStateUnknown VaultUpgradeState = "Unknown" + VaultUpgradeStateUpgraded VaultUpgradeState = "Upgraded" +) + +func PossibleValuesForVaultUpgradeState() []string { + return []string{ + string(VaultUpgradeStateFailed), + string(VaultUpgradeStateInProgress), + string(VaultUpgradeStateUnknown), + string(VaultUpgradeStateUpgraded), + } +} + +func parseVaultUpgradeState(input string) (*VaultUpgradeState, error) { + vals := map[string]VaultUpgradeState{ + "failed": VaultUpgradeStateFailed, + "inprogress": VaultUpgradeStateInProgress, + "unknown": VaultUpgradeStateUnknown, + "upgraded": VaultUpgradeStateUpgraded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VaultUpgradeState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/id_vault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/id_vault.go new file mode 100644 index 000000000000..714e20b17610 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/id_vault.go @@ -0,0 +1,124 @@ +package vaults + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VaultId{} + +// VaultId is a struct representing the Resource ID for a Vault +type VaultId struct { + SubscriptionId string + ResourceGroupName string + VaultName string +} + +// NewVaultID returns a new VaultId struct +func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { + return VaultId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + } +} + +// ParseVaultID parses 'input' into a VaultId +func ParseVaultID(input string) (*VaultId, error) { + parser := resourceids.NewParserFromResourceIdType(VaultId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VaultId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVaultIDInsensitively parses 'input' case-insensitively into a VaultId +// note: this method should only be used for API response data and not user input +func ParseVaultIDInsensitively(input string) (*VaultId, error) { + parser := resourceids.NewParserFromResourceIdType(VaultId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VaultId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVaultID checks that 'input' can be parsed as a Vault ID +func ValidateVaultID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVaultID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Vault ID +func (id VaultId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Vault ID +func (id VaultId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), + resourceids.StaticSegment("staticVaults", "vaults", "vaults"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), + } +} + +// String returns a human-readable description of this Vault ID +func (id VaultId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + } + return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_createorupdate_autorest.go new file mode 100644 index 000000000000..42bbf10be068 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package vaults + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c VaultsClient) CreateOrUpdate(ctx context.Context, id VaultId, input Vault) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c VaultsClient) CreateOrUpdateThenPoll(ctx context.Context, id VaultId, input Vault) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c VaultsClient) preparerForCreateOrUpdate(ctx context.Context, id VaultId, input Vault) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c VaultsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_delete_autorest.go new file mode 100644 index 000000000000..33485eecc957 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_delete_autorest.go @@ -0,0 +1,66 @@ +package vaults + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c VaultsClient) Delete(ctx context.Context, id VaultId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c VaultsClient) preparerForDelete(ctx context.Context, id VaultId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c VaultsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_get_autorest.go new file mode 100644 index 000000000000..da5616345a97 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_get_autorest.go @@ -0,0 +1,68 @@ +package vaults + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Vault +} + +// Get ... +func (c VaultsClient) Get(ctx context.Context, id VaultId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c VaultsClient) preparerForGet(ctx context.Context, id VaultId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c VaultsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..10f71d7015a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package vaults + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Vault + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []Vault +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c VaultsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c VaultsClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.RecoveryServices/vaults", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c VaultsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c VaultsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Vault `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c VaultsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, VaultOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c VaultsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate VaultOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]Vault, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_listbysubscriptionid_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_listbysubscriptionid_autorest.go new file mode 100644 index 000000000000..755f0d1e0c3b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_listbysubscriptionid_autorest.go @@ -0,0 +1,187 @@ +package vaults + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionIdOperationResponse struct { + HttpResponse *http.Response + Model *[]Vault + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionIdOperationResponse, error) +} + +type ListBySubscriptionIdCompleteResult struct { + Items []Vault +} + +func (r ListBySubscriptionIdOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionIdOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionIdOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscriptionId ... +func (c VaultsClient) ListBySubscriptionId(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionIdOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionId(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListBySubscriptionId", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListBySubscriptionId", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscriptionId(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListBySubscriptionId", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscriptionId prepares the ListBySubscriptionId request. +func (c VaultsClient) preparerForListBySubscriptionId(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.RecoveryServices/vaults", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionIdWithNextLink prepares the ListBySubscriptionId request with the given nextLink token. +func (c VaultsClient) preparerForListBySubscriptionIdWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscriptionId handles the response to the ListBySubscriptionId request. The method always +// closes the http.Response Body. +func (c VaultsClient) responderForListBySubscriptionId(resp *http.Response) (result ListBySubscriptionIdOperationResponse, err error) { + type page struct { + Values []Vault `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionIdOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionIdWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListBySubscriptionId", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListBySubscriptionId", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscriptionId(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListBySubscriptionId", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionIdComplete retrieves all of the results into a single object +func (c VaultsClient) ListBySubscriptionIdComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionIdCompleteResult, error) { + return c.ListBySubscriptionIdCompleteMatchingPredicate(ctx, id, VaultOperationPredicate{}) +} + +// ListBySubscriptionIdCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c VaultsClient) ListBySubscriptionIdCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate VaultOperationPredicate) (resp ListBySubscriptionIdCompleteResult, err error) { + items := make([]Vault, 0) + + page, err := c.ListBySubscriptionId(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionIdCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_update_autorest.go new file mode 100644 index 000000000000..dee931ead0a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/method_update_autorest.go @@ -0,0 +1,79 @@ +package vaults + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c VaultsClient) Update(ctx context.Context, id VaultId, input PatchVault) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c VaultsClient) UpdateThenPoll(ctx context.Context, id VaultId, input PatchVault) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c VaultsClient) preparerForUpdate(ctx context.Context, id VaultId, input PatchVault) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c VaultsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_cmkkekidentity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_cmkkekidentity.go new file mode 100644 index 000000000000..1e5e7be3d2db --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_cmkkekidentity.go @@ -0,0 +1,9 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CmkKekIdentity struct { + UseSystemAssignedIdentity *bool `json:"useSystemAssignedIdentity,omitempty"` + UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_cmkkeyvaultproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_cmkkeyvaultproperties.go new file mode 100644 index 000000000000..c53f530b9f5a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_cmkkeyvaultproperties.go @@ -0,0 +1,8 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CmkKeyVaultProperties struct { + KeyUri *string `json:"keyUri,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_patchvault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_patchvault.go new file mode 100644 index 000000000000..5ffc9615bc50 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_patchvault.go @@ -0,0 +1,20 @@ +package vaults + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchVault struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VaultProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_privateendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_privateendpoint.go new file mode 100644 index 000000000000..64ce35a3d983 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_privateendpoint.go @@ -0,0 +1,8 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_privateendpointconnection.go new file mode 100644 index 000000000000..3d4ff869e79f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_privateendpointconnection.go @@ -0,0 +1,10 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_privateendpointconnectionvaultproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_privateendpointconnectionvaultproperties.go new file mode 100644 index 000000000000..5758db1bfa35 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_privateendpointconnectionvaultproperties.go @@ -0,0 +1,12 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionVaultProperties struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnection `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_privatelinkserviceconnectionstate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_privatelinkserviceconnectionstate.go new file mode 100644 index 000000000000..b07724e0e27c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status *PrivateEndpointConnectionStatus `json:"status,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_sku.go new file mode 100644 index 000000000000..d89e1340ee62 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_sku.go @@ -0,0 +1,12 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *string `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name SkuName `json:"name"` + Size *string `json:"size,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_upgradedetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_upgradedetails.go new file mode 100644 index 000000000000..f5e021983ab9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_upgradedetails.go @@ -0,0 +1,58 @@ +package vaults + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpgradeDetails struct { + EndTimeUtc *string `json:"endTimeUtc,omitempty"` + LastUpdatedTimeUtc *string `json:"lastUpdatedTimeUtc,omitempty"` + Message *string `json:"message,omitempty"` + OperationId *string `json:"operationId,omitempty"` + PreviousResourceId *string `json:"previousResourceId,omitempty"` + StartTimeUtc *string `json:"startTimeUtc,omitempty"` + Status *VaultUpgradeState `json:"status,omitempty"` + TriggerType *TriggerType `json:"triggerType,omitempty"` + UpgradedResourceId *string `json:"upgradedResourceId,omitempty"` +} + +func (o *UpgradeDetails) GetEndTimeUtcAsTime() (*time.Time, error) { + if o.EndTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpgradeDetails) SetEndTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTimeUtc = &formatted +} + +func (o *UpgradeDetails) GetLastUpdatedTimeUtcAsTime() (*time.Time, error) { + if o.LastUpdatedTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastUpdatedTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpgradeDetails) SetLastUpdatedTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastUpdatedTimeUtc = &formatted +} + +func (o *UpgradeDetails) GetStartTimeUtcAsTime() (*time.Time, error) { + if o.StartTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpgradeDetails) SetStartTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTimeUtc = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_vault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_vault.go new file mode 100644 index 000000000000..dc5d7d049c16 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_vault.go @@ -0,0 +1,22 @@ +package vaults + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Vault struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *VaultProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_vaultproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_vaultproperties.go new file mode 100644 index 000000000000..3c0a0cce5846 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_vaultproperties.go @@ -0,0 +1,15 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultProperties struct { + Encryption *VaultPropertiesEncryption `json:"encryption,omitempty"` + MoveDetails *VaultPropertiesMoveDetails `json:"moveDetails,omitempty"` + MoveState *ResourceMoveState `json:"moveState,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnectionVaultProperties `json:"privateEndpointConnections,omitempty"` + PrivateEndpointStateForBackup *VaultPrivateEndpointState `json:"privateEndpointStateForBackup,omitempty"` + PrivateEndpointStateForSiteRecovery *VaultPrivateEndpointState `json:"privateEndpointStateForSiteRecovery,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UpgradeDetails *UpgradeDetails `json:"upgradeDetails,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_vaultpropertiesencryption.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_vaultpropertiesencryption.go new file mode 100644 index 000000000000..05c6effec1de --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_vaultpropertiesencryption.go @@ -0,0 +1,10 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultPropertiesEncryption struct { + InfrastructureEncryption *InfrastructureEncryptionState `json:"infrastructureEncryption,omitempty"` + KekIdentity *CmkKekIdentity `json:"kekIdentity,omitempty"` + KeyVaultProperties *CmkKeyVaultProperties `json:"keyVaultProperties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_vaultpropertiesmovedetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_vaultpropertiesmovedetails.go new file mode 100644 index 000000000000..b65be5a06695 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/model_vaultpropertiesmovedetails.go @@ -0,0 +1,42 @@ +package vaults + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultPropertiesMoveDetails struct { + CompletionTimeUtc *string `json:"completionTimeUtc,omitempty"` + OperationId *string `json:"operationId,omitempty"` + SourceResourceId *string `json:"sourceResourceId,omitempty"` + StartTimeUtc *string `json:"startTimeUtc,omitempty"` + TargetResourceId *string `json:"targetResourceId,omitempty"` +} + +func (o *VaultPropertiesMoveDetails) GetCompletionTimeUtcAsTime() (*time.Time, error) { + if o.CompletionTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CompletionTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *VaultPropertiesMoveDetails) SetCompletionTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CompletionTimeUtc = &formatted +} + +func (o *VaultPropertiesMoveDetails) GetStartTimeUtcAsTime() (*time.Time, error) { + if o.StartTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *VaultPropertiesMoveDetails) SetStartTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTimeUtc = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/predicates.go new file mode 100644 index 000000000000..baf3a35d92e2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/predicates.go @@ -0,0 +1,34 @@ +package vaults + +type VaultOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p VaultOperationPredicate) Matches(input Vault) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/version.go new file mode 100644 index 000000000000..3a857c8c9f49 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults/version.go @@ -0,0 +1,12 @@ +package vaults + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/vaults/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/README.md new file mode 100644 index 000000000000..f67c60f7bef1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/README.md @@ -0,0 +1,78 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr` Documentation + +The `backupresourcestorageconfigsnoncrr` SDK allows for interaction with the Azure Resource Manager Service `recoveryservicesbackup` (API Version `2021-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr" +``` + + +### Client Initialization + +```go +client := backupresourcestorageconfigsnoncrr.NewBackupResourceStorageConfigsNonCRRClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `BackupResourceStorageConfigsNonCRRClient.Get` + +```go +ctx := context.TODO() +id := backupresourcestorageconfigsnoncrr.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackupResourceStorageConfigsNonCRRClient.Patch` + +```go +ctx := context.TODO() +id := backupresourcestorageconfigsnoncrr.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +payload := backupresourcestorageconfigsnoncrr.BackupResourceConfigResource{ + // ... +} + + +read, err := client.Patch(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackupResourceStorageConfigsNonCRRClient.Update` + +```go +ctx := context.TODO() +id := backupresourcestorageconfigsnoncrr.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +payload := backupresourcestorageconfigsnoncrr.BackupResourceConfigResource{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/client.go new file mode 100644 index 000000000000..88d28c49c499 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/client.go @@ -0,0 +1,18 @@ +package backupresourcestorageconfigsnoncrr + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupResourceStorageConfigsNonCRRClient struct { + Client autorest.Client + baseUri string +} + +func NewBackupResourceStorageConfigsNonCRRClientWithBaseURI(endpoint string) BackupResourceStorageConfigsNonCRRClient { + return BackupResourceStorageConfigsNonCRRClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/constants.go new file mode 100644 index 000000000000..6ae51ba9c4a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/constants.go @@ -0,0 +1,136 @@ +package backupresourcestorageconfigsnoncrr + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedupState string + +const ( + DedupStateDisabled DedupState = "Disabled" + DedupStateEnabled DedupState = "Enabled" + DedupStateInvalid DedupState = "Invalid" +) + +func PossibleValuesForDedupState() []string { + return []string{ + string(DedupStateDisabled), + string(DedupStateEnabled), + string(DedupStateInvalid), + } +} + +func parseDedupState(input string) (*DedupState, error) { + vals := map[string]DedupState{ + "disabled": DedupStateDisabled, + "enabled": DedupStateEnabled, + "invalid": DedupStateInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DedupState(input) + return &out, nil +} + +type StorageType string + +const ( + StorageTypeGeoRedundant StorageType = "GeoRedundant" + StorageTypeInvalid StorageType = "Invalid" + StorageTypeLocallyRedundant StorageType = "LocallyRedundant" + StorageTypeReadAccessGeoZoneRedundant StorageType = "ReadAccessGeoZoneRedundant" + StorageTypeZoneRedundant StorageType = "ZoneRedundant" +) + +func PossibleValuesForStorageType() []string { + return []string{ + string(StorageTypeGeoRedundant), + string(StorageTypeInvalid), + string(StorageTypeLocallyRedundant), + string(StorageTypeReadAccessGeoZoneRedundant), + string(StorageTypeZoneRedundant), + } +} + +func parseStorageType(input string) (*StorageType, error) { + vals := map[string]StorageType{ + "georedundant": StorageTypeGeoRedundant, + "invalid": StorageTypeInvalid, + "locallyredundant": StorageTypeLocallyRedundant, + "readaccessgeozoneredundant": StorageTypeReadAccessGeoZoneRedundant, + "zoneredundant": StorageTypeZoneRedundant, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageType(input) + return &out, nil +} + +type StorageTypeState string + +const ( + StorageTypeStateInvalid StorageTypeState = "Invalid" + StorageTypeStateLocked StorageTypeState = "Locked" + StorageTypeStateUnlocked StorageTypeState = "Unlocked" +) + +func PossibleValuesForStorageTypeState() []string { + return []string{ + string(StorageTypeStateInvalid), + string(StorageTypeStateLocked), + string(StorageTypeStateUnlocked), + } +} + +func parseStorageTypeState(input string) (*StorageTypeState, error) { + vals := map[string]StorageTypeState{ + "invalid": StorageTypeStateInvalid, + "locked": StorageTypeStateLocked, + "unlocked": StorageTypeStateUnlocked, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageTypeState(input) + return &out, nil +} + +type XcoolState string + +const ( + XcoolStateDisabled XcoolState = "Disabled" + XcoolStateEnabled XcoolState = "Enabled" + XcoolStateInvalid XcoolState = "Invalid" +) + +func PossibleValuesForXcoolState() []string { + return []string{ + string(XcoolStateDisabled), + string(XcoolStateEnabled), + string(XcoolStateInvalid), + } +} + +func parseXcoolState(input string) (*XcoolState, error) { + vals := map[string]XcoolState{ + "disabled": XcoolStateDisabled, + "enabled": XcoolStateEnabled, + "invalid": XcoolStateInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := XcoolState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/id_vault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/id_vault.go new file mode 100644 index 000000000000..ae72db572866 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/id_vault.go @@ -0,0 +1,124 @@ +package backupresourcestorageconfigsnoncrr + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VaultId{} + +// VaultId is a struct representing the Resource ID for a Vault +type VaultId struct { + SubscriptionId string + ResourceGroupName string + VaultName string +} + +// NewVaultID returns a new VaultId struct +func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { + return VaultId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + } +} + +// ParseVaultID parses 'input' into a VaultId +func ParseVaultID(input string) (*VaultId, error) { + parser := resourceids.NewParserFromResourceIdType(VaultId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VaultId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVaultIDInsensitively parses 'input' case-insensitively into a VaultId +// note: this method should only be used for API response data and not user input +func ParseVaultIDInsensitively(input string) (*VaultId, error) { + parser := resourceids.NewParserFromResourceIdType(VaultId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VaultId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVaultID checks that 'input' can be parsed as a Vault ID +func ValidateVaultID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVaultID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Vault ID +func (id VaultId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Vault ID +func (id VaultId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), + resourceids.StaticSegment("staticVaults", "vaults", "vaults"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), + } +} + +// String returns a human-readable description of this Vault ID +func (id VaultId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + } + return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/method_get_autorest.go new file mode 100644 index 000000000000..dfa7631d81e4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/method_get_autorest.go @@ -0,0 +1,69 @@ +package backupresourcestorageconfigsnoncrr + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *BackupResourceConfigResource +} + +// Get ... +func (c BackupResourceStorageConfigsNonCRRClient) Get(ctx context.Context, id VaultId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c BackupResourceStorageConfigsNonCRRClient) preparerForGet(ctx context.Context, id VaultId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/backupStorageConfig/vaultStorageConfig", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c BackupResourceStorageConfigsNonCRRClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/method_patch_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/method_patch_autorest.go new file mode 100644 index 000000000000..06e35a3cb44d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/method_patch_autorest.go @@ -0,0 +1,68 @@ +package backupresourcestorageconfigsnoncrr + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchOperationResponse struct { + HttpResponse *http.Response +} + +// Patch ... +func (c BackupResourceStorageConfigsNonCRRClient) Patch(ctx context.Context, id VaultId, input BackupResourceConfigResource) (result PatchOperationResponse, err error) { + req, err := c.preparerForPatch(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "Patch", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "Patch", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPatch(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "Patch", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForPatch prepares the Patch request. +func (c BackupResourceStorageConfigsNonCRRClient) preparerForPatch(ctx context.Context, id VaultId, input BackupResourceConfigResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/backupStorageConfig/vaultStorageConfig", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForPatch handles the response to the Patch request. The method always +// closes the http.Response Body. +func (c BackupResourceStorageConfigsNonCRRClient) responderForPatch(resp *http.Response) (result PatchOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/method_update_autorest.go new file mode 100644 index 000000000000..13a010ee69d8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/method_update_autorest.go @@ -0,0 +1,70 @@ +package backupresourcestorageconfigsnoncrr + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *BackupResourceConfigResource +} + +// Update ... +func (c BackupResourceStorageConfigsNonCRRClient) Update(ctx context.Context, id VaultId, input BackupResourceConfigResource) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c BackupResourceStorageConfigsNonCRRClient) preparerForUpdate(ctx context.Context, id VaultId, input BackupResourceConfigResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/backupStorageConfig/vaultStorageConfig", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c BackupResourceStorageConfigsNonCRRClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/model_backupresourceconfig.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/model_backupresourceconfig.go new file mode 100644 index 000000000000..69f226c0dcf6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/model_backupresourceconfig.go @@ -0,0 +1,13 @@ +package backupresourcestorageconfigsnoncrr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupResourceConfig struct { + CrossRegionRestoreFlag *bool `json:"crossRegionRestoreFlag,omitempty"` + DedupState *DedupState `json:"dedupState,omitempty"` + StorageModelType *StorageType `json:"storageModelType,omitempty"` + StorageType *StorageType `json:"storageType,omitempty"` + StorageTypeState *StorageTypeState `json:"storageTypeState,omitempty"` + XcoolState *XcoolState `json:"xcoolState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/model_backupresourceconfigresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/model_backupresourceconfigresource.go new file mode 100644 index 000000000000..8fc2680cafb2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/model_backupresourceconfigresource.go @@ -0,0 +1,14 @@ +package backupresourcestorageconfigsnoncrr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupResourceConfigResource struct { + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *BackupResourceConfig `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/version.go new file mode 100644 index 000000000000..d3b59b078109 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/version.go @@ -0,0 +1,12 @@ +package backupresourcestorageconfigsnoncrr + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/backupresourcestorageconfigsnoncrr/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/README.md new file mode 100644 index 000000000000..612482be5b68 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/README.md @@ -0,0 +1,78 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs` Documentation + +The `backupresourcevaultconfigs` SDK allows for interaction with the Azure Resource Manager Service `recoveryservicesbackup` (API Version `2021-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs" +``` + + +### Client Initialization + +```go +client := backupresourcevaultconfigs.NewBackupResourceVaultConfigsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `BackupResourceVaultConfigsClient.Get` + +```go +ctx := context.TODO() +id := backupresourcevaultconfigs.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackupResourceVaultConfigsClient.Put` + +```go +ctx := context.TODO() +id := backupresourcevaultconfigs.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +payload := backupresourcevaultconfigs.BackupResourceVaultConfigResource{ + // ... +} + + +read, err := client.Put(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackupResourceVaultConfigsClient.Update` + +```go +ctx := context.TODO() +id := backupresourcevaultconfigs.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +payload := backupresourcevaultconfigs.BackupResourceVaultConfigResource{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/client.go new file mode 100644 index 000000000000..b56d05bcc6b1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/client.go @@ -0,0 +1,18 @@ +package backupresourcevaultconfigs + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupResourceVaultConfigsClient struct { + Client autorest.Client + baseUri string +} + +func NewBackupResourceVaultConfigsClientWithBaseURI(endpoint string) BackupResourceVaultConfigsClient { + return BackupResourceVaultConfigsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/constants.go new file mode 100644 index 000000000000..95d3b28e3f0b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/constants.go @@ -0,0 +1,136 @@ +package backupresourcevaultconfigs + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnhancedSecurityState string + +const ( + EnhancedSecurityStateDisabled EnhancedSecurityState = "Disabled" + EnhancedSecurityStateEnabled EnhancedSecurityState = "Enabled" + EnhancedSecurityStateInvalid EnhancedSecurityState = "Invalid" +) + +func PossibleValuesForEnhancedSecurityState() []string { + return []string{ + string(EnhancedSecurityStateDisabled), + string(EnhancedSecurityStateEnabled), + string(EnhancedSecurityStateInvalid), + } +} + +func parseEnhancedSecurityState(input string) (*EnhancedSecurityState, error) { + vals := map[string]EnhancedSecurityState{ + "disabled": EnhancedSecurityStateDisabled, + "enabled": EnhancedSecurityStateEnabled, + "invalid": EnhancedSecurityStateInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EnhancedSecurityState(input) + return &out, nil +} + +type SoftDeleteFeatureState string + +const ( + SoftDeleteFeatureStateDisabled SoftDeleteFeatureState = "Disabled" + SoftDeleteFeatureStateEnabled SoftDeleteFeatureState = "Enabled" + SoftDeleteFeatureStateInvalid SoftDeleteFeatureState = "Invalid" +) + +func PossibleValuesForSoftDeleteFeatureState() []string { + return []string{ + string(SoftDeleteFeatureStateDisabled), + string(SoftDeleteFeatureStateEnabled), + string(SoftDeleteFeatureStateInvalid), + } +} + +func parseSoftDeleteFeatureState(input string) (*SoftDeleteFeatureState, error) { + vals := map[string]SoftDeleteFeatureState{ + "disabled": SoftDeleteFeatureStateDisabled, + "enabled": SoftDeleteFeatureStateEnabled, + "invalid": SoftDeleteFeatureStateInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SoftDeleteFeatureState(input) + return &out, nil +} + +type StorageType string + +const ( + StorageTypeGeoRedundant StorageType = "GeoRedundant" + StorageTypeInvalid StorageType = "Invalid" + StorageTypeLocallyRedundant StorageType = "LocallyRedundant" + StorageTypeReadAccessGeoZoneRedundant StorageType = "ReadAccessGeoZoneRedundant" + StorageTypeZoneRedundant StorageType = "ZoneRedundant" +) + +func PossibleValuesForStorageType() []string { + return []string{ + string(StorageTypeGeoRedundant), + string(StorageTypeInvalid), + string(StorageTypeLocallyRedundant), + string(StorageTypeReadAccessGeoZoneRedundant), + string(StorageTypeZoneRedundant), + } +} + +func parseStorageType(input string) (*StorageType, error) { + vals := map[string]StorageType{ + "georedundant": StorageTypeGeoRedundant, + "invalid": StorageTypeInvalid, + "locallyredundant": StorageTypeLocallyRedundant, + "readaccessgeozoneredundant": StorageTypeReadAccessGeoZoneRedundant, + "zoneredundant": StorageTypeZoneRedundant, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageType(input) + return &out, nil +} + +type StorageTypeState string + +const ( + StorageTypeStateInvalid StorageTypeState = "Invalid" + StorageTypeStateLocked StorageTypeState = "Locked" + StorageTypeStateUnlocked StorageTypeState = "Unlocked" +) + +func PossibleValuesForStorageTypeState() []string { + return []string{ + string(StorageTypeStateInvalid), + string(StorageTypeStateLocked), + string(StorageTypeStateUnlocked), + } +} + +func parseStorageTypeState(input string) (*StorageTypeState, error) { + vals := map[string]StorageTypeState{ + "invalid": StorageTypeStateInvalid, + "locked": StorageTypeStateLocked, + "unlocked": StorageTypeStateUnlocked, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageTypeState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/id_vault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/id_vault.go new file mode 100644 index 000000000000..c731debb713b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/id_vault.go @@ -0,0 +1,124 @@ +package backupresourcevaultconfigs + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VaultId{} + +// VaultId is a struct representing the Resource ID for a Vault +type VaultId struct { + SubscriptionId string + ResourceGroupName string + VaultName string +} + +// NewVaultID returns a new VaultId struct +func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { + return VaultId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + } +} + +// ParseVaultID parses 'input' into a VaultId +func ParseVaultID(input string) (*VaultId, error) { + parser := resourceids.NewParserFromResourceIdType(VaultId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VaultId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVaultIDInsensitively parses 'input' case-insensitively into a VaultId +// note: this method should only be used for API response data and not user input +func ParseVaultIDInsensitively(input string) (*VaultId, error) { + parser := resourceids.NewParserFromResourceIdType(VaultId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VaultId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVaultID checks that 'input' can be parsed as a Vault ID +func ValidateVaultID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVaultID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Vault ID +func (id VaultId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Vault ID +func (id VaultId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), + resourceids.StaticSegment("staticVaults", "vaults", "vaults"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), + } +} + +// String returns a human-readable description of this Vault ID +func (id VaultId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + } + return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/method_get_autorest.go new file mode 100644 index 000000000000..709a6190da77 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/method_get_autorest.go @@ -0,0 +1,69 @@ +package backupresourcevaultconfigs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *BackupResourceVaultConfigResource +} + +// Get ... +func (c BackupResourceVaultConfigsClient) Get(ctx context.Context, id VaultId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcevaultconfigs.BackupResourceVaultConfigsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcevaultconfigs.BackupResourceVaultConfigsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcevaultconfigs.BackupResourceVaultConfigsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c BackupResourceVaultConfigsClient) preparerForGet(ctx context.Context, id VaultId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/backupconfig/vaultconfig", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c BackupResourceVaultConfigsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/method_put_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/method_put_autorest.go new file mode 100644 index 000000000000..d7874fa3e4fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/method_put_autorest.go @@ -0,0 +1,70 @@ +package backupresourcevaultconfigs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PutOperationResponse struct { + HttpResponse *http.Response + Model *BackupResourceVaultConfigResource +} + +// Put ... +func (c BackupResourceVaultConfigsClient) Put(ctx context.Context, id VaultId, input BackupResourceVaultConfigResource) (result PutOperationResponse, err error) { + req, err := c.preparerForPut(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcevaultconfigs.BackupResourceVaultConfigsClient", "Put", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcevaultconfigs.BackupResourceVaultConfigsClient", "Put", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPut(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcevaultconfigs.BackupResourceVaultConfigsClient", "Put", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForPut prepares the Put request. +func (c BackupResourceVaultConfigsClient) preparerForPut(ctx context.Context, id VaultId, input BackupResourceVaultConfigResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/backupconfig/vaultconfig", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForPut handles the response to the Put request. The method always +// closes the http.Response Body. +func (c BackupResourceVaultConfigsClient) responderForPut(resp *http.Response) (result PutOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/method_update_autorest.go new file mode 100644 index 000000000000..834657e34774 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/method_update_autorest.go @@ -0,0 +1,70 @@ +package backupresourcevaultconfigs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *BackupResourceVaultConfigResource +} + +// Update ... +func (c BackupResourceVaultConfigsClient) Update(ctx context.Context, id VaultId, input BackupResourceVaultConfigResource) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcevaultconfigs.BackupResourceVaultConfigsClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcevaultconfigs.BackupResourceVaultConfigsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcevaultconfigs.BackupResourceVaultConfigsClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c BackupResourceVaultConfigsClient) preparerForUpdate(ctx context.Context, id VaultId, input BackupResourceVaultConfigResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/backupconfig/vaultconfig", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c BackupResourceVaultConfigsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/model_backupresourcevaultconfig.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/model_backupresourcevaultconfig.go new file mode 100644 index 000000000000..1e68a54676ef --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/model_backupresourcevaultconfig.go @@ -0,0 +1,14 @@ +package backupresourcevaultconfigs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupResourceVaultConfig struct { + EnhancedSecurityState *EnhancedSecurityState `json:"enhancedSecurityState,omitempty"` + IsSoftDeleteFeatureStateEditable *bool `json:"isSoftDeleteFeatureStateEditable,omitempty"` + ResourceGuardOperationRequests *[]string `json:"resourceGuardOperationRequests,omitempty"` + SoftDeleteFeatureState *SoftDeleteFeatureState `json:"softDeleteFeatureState,omitempty"` + StorageModelType *StorageType `json:"storageModelType,omitempty"` + StorageType *StorageType `json:"storageType,omitempty"` + StorageTypeState *StorageTypeState `json:"storageTypeState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/model_backupresourcevaultconfigresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/model_backupresourcevaultconfigresource.go new file mode 100644 index 000000000000..9957131bbd66 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/model_backupresourcevaultconfigresource.go @@ -0,0 +1,14 @@ +package backupresourcevaultconfigs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupResourceVaultConfigResource struct { + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *BackupResourceVaultConfig `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/version.go new file mode 100644 index 000000000000..803e2b990a7a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/version.go @@ -0,0 +1,12 @@ +package backupresourcevaultconfigs + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/backupresourcevaultconfigs/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 103c417868a9..21126626814e 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -54,7 +54,6 @@ github.com/Azure/azure-sdk-for-go/services/preview/synapse/2019-06-01-preview/ma github.com/Azure/azure-sdk-for-go/services/preview/synapse/2020-08-01-preview/accesscontrol github.com/Azure/azure-sdk-for-go/services/preview/synapse/mgmt/v2.0/synapse github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2018-07-10/siterecovery -github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-12-01/backup github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise @@ -176,7 +175,7 @@ github.com/hashicorp/go-azure-helpers/resourcemanager/zones github.com/hashicorp/go-azure-helpers/resourceproviders github.com/hashicorp/go-azure-helpers/sender github.com/hashicorp/go-azure-helpers/storage -# github.com/hashicorp/go-azure-sdk v0.20230105.1121404 +# github.com/hashicorp/go-azure-sdk v0.20230109.1102005 ## explicit; go 1.18 github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview @@ -395,6 +394,9 @@ github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/private github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account +github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2021-08-01/vaults +github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr +github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies