diff --git a/internal/services/hsm/client/client.go b/internal/services/hsm/client/client.go index 13be95df60af..149cdeff6817 100644 --- a/internal/services/hsm/client/client.go +++ b/internal/services/hsm/client/client.go @@ -1,16 +1,16 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules" + "github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - DedicatedHsmClient *hardwaresecuritymodules.DedicatedHsmClient + DedicatedHsmClient *dedicatedhsms.DedicatedHsmsClient } func NewClient(o *common.ClientOptions) *Client { - dedicatedHsmClient := hardwaresecuritymodules.NewDedicatedHsmClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + dedicatedHsmClient := dedicatedhsms.NewDedicatedHsmsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&dedicatedHsmClient.Client, o.ResourceManagerAuthorizer) return &Client{ diff --git a/internal/services/hsm/dedicated_hardware_security_module_resource.go b/internal/services/hsm/dedicated_hardware_security_module_resource.go index 29dee70cbf9e..19c3be55a0f2 100644 --- a/internal/services/hsm/dedicated_hardware_security_module_resource.go +++ b/internal/services/hsm/dedicated_hardware_security_module_resource.go @@ -5,20 +5,17 @@ import ( "log" "time" - "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" - + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - - "github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" + "github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/validate" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/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" @@ -40,7 +37,7 @@ func resourceDedicatedHardwareSecurityModule() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DedicatedHardwareSecurityModuleID(id) + _, err := dedicatedhsms.ParseDedicatedHSMID(id) return err }), @@ -61,7 +58,7 @@ func resourceDedicatedHardwareSecurityModule() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(hardwaresecuritymodules.SafeNetLunaNetworkHSMA790), + string(dedicatedhsms.SkuNameSafeNetLunaNetworkHSMASevenNineZero), }, false), }, @@ -103,7 +100,7 @@ func resourceDedicatedHardwareSecurityModule() *pluginsdk.Resource { "zones": commonschema.ZonesMultipleOptionalForceNew(), - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -114,48 +111,44 @@ func resourceDedicatedHardwareSecurityModuleCreate(d *pluginsdk.ResourceData, me ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewDedicatedHardwareSecurityModuleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - existing, err := client.Get(ctx, id.ResourceGroup, id.DedicatedHSMName) + id := dedicatedhsms.NewDedicatedHSMID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + existing, err := client.DedicatedHsmGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_dedicated_hardware_security_module", id.ID()) } - parameters := hardwaresecuritymodules.DedicatedHsm{ - Location: utils.String(location.Normalize(d.Get("location").(string))), - DedicatedHsmProperties: &hardwaresecuritymodules.DedicatedHsmProperties{ + skuName := dedicatedhsms.SkuName(d.Get("sku_name").(string)) + parameters := dedicatedhsms.DedicatedHsm{ + Location: location.Normalize(d.Get("location").(string)), + Properties: dedicatedhsms.DedicatedHsmProperties{ NetworkProfile: expandDedicatedHsmNetworkProfile(d.Get("network_profile").([]interface{})), }, - Sku: &hardwaresecuritymodules.Sku{ - Name: hardwaresecuritymodules.Name(d.Get("sku_name").(string)), + Sku: dedicatedhsms.Sku{ + Name: &skuName, }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } if v, ok := d.GetOk("stamp_id"); ok { - parameters.DedicatedHsmProperties.StampID = utils.String(v.(string)) + parameters.Properties.StampId = utils.String(v.(string)) } if v, ok := d.GetOk("zones"); ok { - zones := zones.Expand(v.(*schema.Set).List()) + zones := zones.Expand(v.(*pluginsdk.Set).List()) if len(zones) > 0 { parameters.Zones = &zones } } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.DedicatedHSMName, parameters) - if err != nil { + if err := client.DedicatedHsmCreateOrUpdateThenPoll(ctx, id, parameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceDedicatedHardwareSecurityModuleRead(d, meta) } @@ -165,39 +158,48 @@ func resourceDedicatedHardwareSecurityModuleRead(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DedicatedHardwareSecurityModuleID(d.Id()) + id, err := dedicatedhsms.ParseDedicatedHSMID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.DedicatedHSMName) + resp, err := client.DedicatedHsmGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[INFO] Dedicated Hardware Security Module %q does not exist - removing from state", d.Id()) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s was not found - removing from state", *id) d.SetId("") return nil } - return fmt.Errorf("retrieving Dedicate Hardware Security Module %q (Resource Group %q): %+v", id.DedicatedHSMName, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.DedicatedHSMName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) - d.Set("zones", zones.Flatten(resp.Zones)) + d.Set("name", id.Name) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + d.Set("zones", zones.Flatten(model.Zones)) + + props := model.Properties - if props := resp.DedicatedHsmProperties; props != nil { if err := d.Set("network_profile", flattenDedicatedHsmNetworkProfile(props.NetworkProfile)); err != nil { return fmt.Errorf("setting network_profile: %+v", err) } - d.Set("stamp_id", props.StampID) - } + d.Set("stamp_id", props.StampId) + + skuName := "" + if model.Sku.Name != nil { + skuName = string(*model.Sku.Name) + } + d.Set("sku_name", skuName) - if sku := resp.Sku; sku != nil { - d.Set("sku_name", sku.Name) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceDedicatedHardwareSecurityModuleUpdate(d *pluginsdk.ResourceData, meta interface{}) error { @@ -205,23 +207,18 @@ func resourceDedicatedHardwareSecurityModuleUpdate(d *pluginsdk.ResourceData, me ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DedicatedHardwareSecurityModuleID(d.Id()) + id, err := dedicatedhsms.ParseDedicatedHSMID(d.Id()) if err != nil { return err } - parameters := hardwaresecuritymodules.DedicatedHsmPatchParameters{} + parameters := dedicatedhsms.DedicatedHsmPatchParameters{} if d.HasChange("tags") { parameters.Tags = tags.Expand(d.Get("tags").(map[string]interface{})) } - future, err := client.Update(ctx, id.ResourceGroup, id.DedicatedHSMName, parameters) - if err != nil { - return fmt.Errorf("updating Dedicate Hardware Security Module %q (Resource Group %q): %+v", id.DedicatedHSMName, id.ResourceGroup, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting on updating future for Dedicate Hardware Security Module %q (Resource Group %q): %+v", id.DedicatedHSMName, id.ResourceGroup, err) + if err := client.DedicatedHsmUpdateThenPoll(ctx, *id, parameters); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) } return resourceDedicatedHardwareSecurityModuleRead(d, meta) @@ -232,33 +229,28 @@ func resourceDedicatedHardwareSecurityModuleDelete(d *pluginsdk.ResourceData, me ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DedicatedHardwareSecurityModuleID(d.Id()) + id, err := dedicatedhsms.ParseDedicatedHSMID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.DedicatedHSMName) - if err != nil { - return fmt.Errorf("deleting Dedicated Hardware Security Module %q (Resource Group %q): %+v", id.DedicatedHSMName, id.ResourceGroup, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting on deleting future for Dedicated Hardware Security Module %q (Resource Group %q): %+v", id.DedicatedHSMName, id.ResourceGroup, err) + if err := client.DedicatedHsmDeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) } return nil } -func expandDedicatedHsmNetworkProfile(input []interface{}) *hardwaresecuritymodules.NetworkProfile { +func expandDedicatedHsmNetworkProfile(input []interface{}) *dedicatedhsms.NetworkProfile { if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) - result := hardwaresecuritymodules.NetworkProfile{ - Subnet: &hardwaresecuritymodules.APIEntityReference{ - ID: utils.String(v["subnet_id"].(string)), + result := dedicatedhsms.NetworkProfile{ + Subnet: &dedicatedhsms.ApiEntityReference{ + Id: utils.String(v["subnet_id"].(string)), }, NetworkInterfaces: expandDedicatedHsmNetworkInterfacePrivateIPAddresses(v["network_interface_private_ip_addresses"].(*pluginsdk.Set).List()), } @@ -266,30 +258,28 @@ func expandDedicatedHsmNetworkProfile(input []interface{}) *hardwaresecuritymodu return &result } -func expandDedicatedHsmNetworkInterfacePrivateIPAddresses(input []interface{}) *[]hardwaresecuritymodules.NetworkInterface { - results := make([]hardwaresecuritymodules.NetworkInterface, 0) +func expandDedicatedHsmNetworkInterfacePrivateIPAddresses(input []interface{}) *[]dedicatedhsms.NetworkInterface { + results := make([]dedicatedhsms.NetworkInterface, 0) for _, item := range input { if item != nil { - result := hardwaresecuritymodules.NetworkInterface{ - PrivateIPAddress: utils.String(item.(string)), - } - - results = append(results, result) + results = append(results, dedicatedhsms.NetworkInterface{ + PrivateIpAddress: utils.String(item.(string)), + }) } } return &results } -func flattenDedicatedHsmNetworkProfile(input *hardwaresecuritymodules.NetworkProfile) []interface{} { +func flattenDedicatedHsmNetworkProfile(input *dedicatedhsms.NetworkProfile) []interface{} { if input == nil { return make([]interface{}, 0) } var subnetId string - if input.Subnet != nil && input.Subnet.ID != nil { - subnetId = *input.Subnet.ID + if input.Subnet != nil && input.Subnet.Id != nil { + subnetId = *input.Subnet.Id } return []interface{}{ @@ -300,15 +290,15 @@ func flattenDedicatedHsmNetworkProfile(input *hardwaresecuritymodules.NetworkPro } } -func flattenDedicatedHsmNetworkInterfacePrivateIPAddresses(input *[]hardwaresecuritymodules.NetworkInterface) []interface{} { +func flattenDedicatedHsmNetworkInterfacePrivateIPAddresses(input *[]dedicatedhsms.NetworkInterface) []interface{} { results := make([]interface{}, 0) if input == nil { return results } for _, item := range *input { - if item.PrivateIPAddress != nil { - results = append(results, *item.PrivateIPAddress) + if item.PrivateIpAddress != nil { + results = append(results, *item.PrivateIpAddress) } } diff --git a/internal/services/hsm/dedicated_hardware_security_module_resource_test.go b/internal/services/hsm/dedicated_hardware_security_module_resource_test.go index 087f14cea4f1..39b07a5643be 100644 --- a/internal/services/hsm/dedicated_hardware_security_module_resource_test.go +++ b/internal/services/hsm/dedicated_hardware_security_module_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms" "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/hsm/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -102,17 +102,17 @@ resource "azurerm_dedicated_hardware_security_module" "import" { } func (DedicatedHardwareSecurityModuleResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DedicatedHardwareSecurityModuleID(state.ID) + id, err := dedicatedhsms.ParseDedicatedHSMID(state.ID) if err != nil { return nil, err } - resp, err := clients.HSM.DedicatedHsmClient.Get(ctx, id.ResourceGroup, id.DedicatedHSMName) + resp, err := clients.HSM.DedicatedHsmClient.DedicatedHsmGet(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Dedicated HardwareSecurityModule %q (resource group: %q): %+v", id.DedicatedHSMName, id.ResourceGroup, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.DedicatedHsmProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (DedicatedHardwareSecurityModuleResource) template(data acceptance.TestData) string { diff --git a/internal/services/hsm/parse/dedicated_hardware_security_module.go b/internal/services/hsm/parse/dedicated_hardware_security_module.go deleted file mode 100644 index 1cf41b84c5b6..000000000000 --- a/internal/services/hsm/parse/dedicated_hardware_security_module.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 DedicatedHardwareSecurityModuleId struct { - SubscriptionId string - ResourceGroup string - DedicatedHSMName string -} - -func NewDedicatedHardwareSecurityModuleID(subscriptionId, resourceGroup, dedicatedHSMName string) DedicatedHardwareSecurityModuleId { - return DedicatedHardwareSecurityModuleId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - DedicatedHSMName: dedicatedHSMName, - } -} - -func (id DedicatedHardwareSecurityModuleId) String() string { - segments := []string{ - fmt.Sprintf("Dedicated H S M Name %q", id.DedicatedHSMName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Dedicated Hardware Security Module", segmentsStr) -} - -func (id DedicatedHardwareSecurityModuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.DedicatedHSMName) -} - -// DedicatedHardwareSecurityModuleID parses a DedicatedHardwareSecurityModule ID into an DedicatedHardwareSecurityModuleId struct -func DedicatedHardwareSecurityModuleID(input string) (*DedicatedHardwareSecurityModuleId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DedicatedHardwareSecurityModuleId{ - 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.DedicatedHSMName, err = id.PopSegment("dedicatedHSMs"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/hsm/parse/dedicated_hardware_security_module_test.go b/internal/services/hsm/parse/dedicated_hardware_security_module_test.go deleted file mode 100644 index 7038fbfbf3f2..000000000000 --- a/internal/services/hsm/parse/dedicated_hardware_security_module_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 = DedicatedHardwareSecurityModuleId{} - -func TestDedicatedHardwareSecurityModuleIDFormatter(t *testing.T) { - actual := NewDedicatedHardwareSecurityModuleID("12345678-1234-9876-4563-123456789012", "group1", "hsm1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestDedicatedHardwareSecurityModuleID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *DedicatedHardwareSecurityModuleId - }{ - - { - // 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 DedicatedHSMName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.HardwareSecurityModules/", - Error: true, - }, - - { - // missing value for DedicatedHSMName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm1", - Expected: &DedicatedHardwareSecurityModuleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - DedicatedHSMName: "hsm1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.HARDWARESECURITYMODULES/DEDICATEDHSMS/HSM1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := DedicatedHardwareSecurityModuleID(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.DedicatedHSMName != v.Expected.DedicatedHSMName { - t.Fatalf("Expected %q but got %q for DedicatedHSMName", v.Expected.DedicatedHSMName, actual.DedicatedHSMName) - } - } -} diff --git a/internal/services/hsm/resourceids.go b/internal/services/hsm/resourceids.go deleted file mode 100644 index 378ff1bd5837..000000000000 --- a/internal/services/hsm/resourceids.go +++ /dev/null @@ -1,3 +0,0 @@ -package hsm - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DedicatedHardwareSecurityModule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm1 diff --git a/internal/services/hsm/validate/dedicated_hardware_security_module_id.go b/internal/services/hsm/validate/dedicated_hardware_security_module_id.go deleted file mode 100644 index 25a4435b45cb..000000000000 --- a/internal/services/hsm/validate/dedicated_hardware_security_module_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/hsm/parse" -) - -func DedicatedHardwareSecurityModuleID(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.DedicatedHardwareSecurityModuleID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/hsm/validate/dedicated_hardware_security_module_id_test.go b/internal/services/hsm/validate/dedicated_hardware_security_module_id_test.go deleted file mode 100644 index 23a7d6c5c14d..000000000000 --- a/internal/services/hsm/validate/dedicated_hardware_security_module_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 TestDedicatedHardwareSecurityModuleID(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 DedicatedHSMName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.HardwareSecurityModules/", - Valid: false, - }, - - { - // missing value for DedicatedHSMName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.HARDWARESECURITYMODULES/DEDICATEDHSMS/HSM1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := DedicatedHardwareSecurityModuleID(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/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/_meta.json deleted file mode 100644 index 3ce427e77cff..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/hardwaresecuritymodules/resource-manager/readme.md", - "tag": "package-2018-10", - "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-2018-10 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/hardwaresecuritymodules/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/client.go deleted file mode 100644 index 9306d4fd2f33..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/client.go +++ /dev/null @@ -1,42 +0,0 @@ -// Package hardwaresecuritymodules implements the Azure ARM Hardwaresecuritymodules service API version -// 2018-10-31-preview. -// -// The Azure management API provides a RESTful set of web services that interact with Azure Dedicated HSM RP. -package hardwaresecuritymodules - -// 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 ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Hardwaresecuritymodules - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Hardwaresecuritymodules. -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, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/dedicatedhsm.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/dedicatedhsm.go deleted file mode 100644 index 4af9b540c4df..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/dedicatedhsm.go +++ /dev/null @@ -1,604 +0,0 @@ -package hardwaresecuritymodules - -// 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/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DedicatedHsmClient is the the Azure management API provides a RESTful set of web services that interact with Azure -// Dedicated HSM RP. -type DedicatedHsmClient struct { - BaseClient -} - -// NewDedicatedHsmClient creates an instance of the DedicatedHsmClient client. -func NewDedicatedHsmClient(subscriptionID string) DedicatedHsmClient { - return NewDedicatedHsmClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDedicatedHsmClientWithBaseURI creates an instance of the DedicatedHsmClient 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 NewDedicatedHsmClientWithBaseURI(baseURI string, subscriptionID string) DedicatedHsmClient { - return DedicatedHsmClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update a dedicated HSM in the specified subscription. -// Parameters: -// resourceGroupName - the name of the Resource Group to which the resource belongs. -// name - name of the dedicated Hsm -// parameters - parameters to create or update the dedicated hsm -func (client DedicatedHsmClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, parameters DedicatedHsm) (result DedicatedHsmCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedHsmClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: name, - Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DedicatedHsmProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("hardwaresecuritymodules.DedicatedHsmClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, name, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DedicatedHsmClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, name string, parameters DedicatedHsm) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-10-31-preview" - 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.HardwareSecurityModules/dedicatedHSMs/{name}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DedicatedHsmClient) CreateOrUpdateSender(req *http.Request) (future DedicatedHsmCreateOrUpdateFuture, 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 DedicatedHsmClient) CreateOrUpdateResponder(resp *http.Response) (result DedicatedHsm, 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 the specified Azure Dedicated HSM. -// Parameters: -// resourceGroupName - the name of the Resource Group to which the dedicated HSM belongs. -// name - the name of the dedicated HSM to delete -func (client DedicatedHsmClient) Delete(ctx context.Context, resourceGroupName string, name string) (result DedicatedHsmDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedHsmClient.Delete") - 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.DeletePreparer(ctx, resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DedicatedHsmClient) DeletePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-10-31-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}", 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 DedicatedHsmClient) DeleteSender(req *http.Request) (future DedicatedHsmDeleteFuture, 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 -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DedicatedHsmClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified Azure dedicated HSM. -// Parameters: -// resourceGroupName - the name of the Resource Group to which the dedicated hsm belongs. -// name - the name of the dedicated HSM. -func (client DedicatedHsmClient) Get(ctx context.Context, resourceGroupName string, name string) (result DedicatedHsm, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedHsmClient.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, name) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DedicatedHsmClient) GetPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-10-31-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}", 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 DedicatedHsmClient) 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 DedicatedHsmClient) GetResponder(resp *http.Response) (result DedicatedHsm, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup the List operation gets information about the dedicated hsms associated with the subscription -// and within the specified resource group. -// Parameters: -// resourceGroupName - the name of the Resource Group to which the dedicated HSM belongs. -// top - maximum number of results to return. -func (client DedicatedHsmClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, top *int32) (result DedicatedHsmListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedHsmClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.dhlr.Response.Response != nil { - sc = result.dhlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.dhlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.dhlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.dhlr.hasNextLink() && result.dhlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DedicatedHsmClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-10-31-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs", 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 DedicatedHsmClient) 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 DedicatedHsmClient) ListByResourceGroupResponder(resp *http.Response) (result DedicatedHsmListResult, 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 DedicatedHsmClient) listByResourceGroupNextResults(ctx context.Context, lastResults DedicatedHsmListResult) (result DedicatedHsmListResult, err error) { - req, err := lastResults.dedicatedHsmListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "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, "hardwaresecuritymodules.DedicatedHsmClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client DedicatedHsmClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, top *int32) (result DedicatedHsmListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedHsmClient.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, top) - return -} - -// ListBySubscription the List operation gets information about the dedicated HSMs associated with the subscription. -// Parameters: -// top - maximum number of results to return. -func (client DedicatedHsmClient) ListBySubscription(ctx context.Context, top *int32) (result DedicatedHsmListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedHsmClient.ListBySubscription") - defer func() { - sc := -1 - if result.dhlr.Response.Response != nil { - sc = result.dhlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, top) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.dhlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.dhlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.dhlr.hasNextLink() && result.dhlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client DedicatedHsmClient) ListBySubscriptionPreparer(ctx context.Context, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-10-31-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client DedicatedHsmClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client DedicatedHsmClient) ListBySubscriptionResponder(resp *http.Response) (result DedicatedHsmListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client DedicatedHsmClient) listBySubscriptionNextResults(ctx context.Context, lastResults DedicatedHsmListResult) (result DedicatedHsmListResult, err error) { - req, err := lastResults.dedicatedHsmListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client DedicatedHsmClient) ListBySubscriptionComplete(ctx context.Context, top *int32) (result DedicatedHsmListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedHsmClient.ListBySubscription") - 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.ListBySubscription(ctx, top) - return -} - -// Update update a dedicated HSM in the specified subscription. -// Parameters: -// resourceGroupName - the name of the Resource Group to which the server belongs. -// name - name of the dedicated HSM -// parameters - parameters to patch the dedicated HSM -func (client DedicatedHsmClient) Update(ctx context.Context, resourceGroupName string, name string, parameters DedicatedHsmPatchParameters) (result DedicatedHsmUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedHsmClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: name, - Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("hardwaresecuritymodules.DedicatedHsmClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, name, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DedicatedHsmClient) UpdatePreparer(ctx context.Context, resourceGroupName string, name string, parameters DedicatedHsmPatchParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-10-31-preview" - 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.HardwareSecurityModules/dedicatedHSMs/{name}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client DedicatedHsmClient) UpdateSender(req *http.Request) (future DedicatedHsmUpdateFuture, 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 DedicatedHsmClient) UpdateResponder(resp *http.Response) (result DedicatedHsm, 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/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/enums.go deleted file mode 100644 index e94da87ef164..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/enums.go +++ /dev/null @@ -1,45 +0,0 @@ -package hardwaresecuritymodules - -// 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. - -// JSONWebKeyType enumerates the values for json web key type. -type JSONWebKeyType string - -const ( - // Allocating A device is currently being allocated for the dedicated HSM resource. - Allocating JSONWebKeyType = "Allocating" - // CheckingQuota Validating the subscription has sufficient quota to allocate a dedicated HSM device. - CheckingQuota JSONWebKeyType = "CheckingQuota" - // Connecting The dedicated HSM is being connected to the virtual network. - Connecting JSONWebKeyType = "Connecting" - // Deleting The dedicated HSM is currently being deleted. - Deleting JSONWebKeyType = "Deleting" - // Failed Provisioning of the dedicated HSM has failed. - Failed JSONWebKeyType = "Failed" - // Provisioning The dedicated HSM is currently being provisioned. - Provisioning JSONWebKeyType = "Provisioning" - // Succeeded The dedicated HSM has been full provisioned. - Succeeded JSONWebKeyType = "Succeeded" -) - -// PossibleJSONWebKeyTypeValues returns an array of possible values for the JSONWebKeyType const type. -func PossibleJSONWebKeyTypeValues() []JSONWebKeyType { - return []JSONWebKeyType{Allocating, CheckingQuota, Connecting, Deleting, Failed, Provisioning, Succeeded} -} - -// Name enumerates the values for name. -type Name string - -const ( - // SafeNetLunaNetworkHSMA790 ... - SafeNetLunaNetworkHSMA790 Name = "SafeNet Luna Network HSM A790" -) - -// PossibleNameValues returns an array of possible values for the Name const type. -func PossibleNameValues() []Name { - return []Name{SafeNetLunaNetworkHSMA790} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/models.go deleted file mode 100644 index 8b7566537e76..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/models.go +++ /dev/null @@ -1,620 +0,0 @@ -package hardwaresecuritymodules - -// 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/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/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules" - -// APIEntityReference the API entity reference. -type APIEntityReference struct { - // ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - ID *string `json:"id,omitempty"` -} - -// DedicatedHsm resource information with extended details. -type DedicatedHsm struct { - autorest.Response `json:"-"` - // DedicatedHsmProperties - Properties of the dedicated HSM - *DedicatedHsmProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The Azure Resource Manager resource ID for the dedicated HSM. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the dedicated HSM. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The resource type of the dedicated HSM. - Type *string `json:"type,omitempty"` - // Location - The supported Azure location where the dedicated HSM should be created. - Location *string `json:"location,omitempty"` - // Sku - SKU details - Sku *Sku `json:"sku,omitempty"` - // Zones - The Dedicated Hsm zones. - Zones *[]string `json:"zones,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DedicatedHsm. -func (dh DedicatedHsm) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dh.DedicatedHsmProperties != nil { - objectMap["properties"] = dh.DedicatedHsmProperties - } - if dh.Location != nil { - objectMap["location"] = dh.Location - } - if dh.Sku != nil { - objectMap["sku"] = dh.Sku - } - if dh.Zones != nil { - objectMap["zones"] = dh.Zones - } - if dh.Tags != nil { - objectMap["tags"] = dh.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DedicatedHsm struct. -func (dh *DedicatedHsm) 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 dedicatedHsmProperties DedicatedHsmProperties - err = json.Unmarshal(*v, &dedicatedHsmProperties) - if err != nil { - return err - } - dh.DedicatedHsmProperties = &dedicatedHsmProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dh.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dh.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dh.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dh.Location = &location - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - dh.Sku = &sku - } - case "zones": - if v != nil { - var zones []string - err = json.Unmarshal(*v, &zones) - if err != nil { - return err - } - dh.Zones = &zones - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dh.Tags = tags - } - } - } - - return nil -} - -// DedicatedHsmCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DedicatedHsmCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DedicatedHsmClient) (DedicatedHsm, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DedicatedHsmCreateOrUpdateFuture) 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 DedicatedHsmCreateOrUpdateFuture.Result. -func (future *DedicatedHsmCreateOrUpdateFuture) result(client DedicatedHsmClient) (dh DedicatedHsm, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dh.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("hardwaresecuritymodules.DedicatedHsmCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dh.Response.Response, err = future.GetResult(sender); err == nil && dh.Response.Response.StatusCode != http.StatusNoContent { - dh, err = client.CreateOrUpdateResponder(dh.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmCreateOrUpdateFuture", "Result", dh.Response.Response, "Failure responding to request") - } - } - return -} - -// DedicatedHsmDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DedicatedHsmDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DedicatedHsmClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DedicatedHsmDeleteFuture) 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 DedicatedHsmDeleteFuture.Result. -func (future *DedicatedHsmDeleteFuture) result(client DedicatedHsmClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("hardwaresecuritymodules.DedicatedHsmDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DedicatedHsmError the error exception. -type DedicatedHsmError struct { - // Error - READ-ONLY - Error *Error `json:"error,omitempty"` -} - -// MarshalJSON is the custom marshaler for DedicatedHsmError. -func (dhe DedicatedHsmError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DedicatedHsmListResult list of dedicated HSMs -type DedicatedHsmListResult struct { - autorest.Response `json:"-"` - // Value - The list of dedicated HSMs. - Value *[]DedicatedHsm `json:"value,omitempty"` - // NextLink - The URL to get the next set of dedicated hsms. - NextLink *string `json:"nextLink,omitempty"` -} - -// DedicatedHsmListResultIterator provides access to a complete listing of DedicatedHsm values. -type DedicatedHsmListResultIterator struct { - i int - page DedicatedHsmListResultPage -} - -// 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 *DedicatedHsmListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedHsmListResultIterator.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 *DedicatedHsmListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DedicatedHsmListResultIterator) 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 DedicatedHsmListResultIterator) Response() DedicatedHsmListResult { - 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 DedicatedHsmListResultIterator) Value() DedicatedHsm { - if !iter.page.NotDone() { - return DedicatedHsm{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DedicatedHsmListResultIterator type. -func NewDedicatedHsmListResultIterator(page DedicatedHsmListResultPage) DedicatedHsmListResultIterator { - return DedicatedHsmListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dhlr DedicatedHsmListResult) IsEmpty() bool { - return dhlr.Value == nil || len(*dhlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dhlr DedicatedHsmListResult) hasNextLink() bool { - return dhlr.NextLink != nil && len(*dhlr.NextLink) != 0 -} - -// dedicatedHsmListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dhlr DedicatedHsmListResult) dedicatedHsmListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dhlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dhlr.NextLink))) -} - -// DedicatedHsmListResultPage contains a page of DedicatedHsm values. -type DedicatedHsmListResultPage struct { - fn func(context.Context, DedicatedHsmListResult) (DedicatedHsmListResult, error) - dhlr DedicatedHsmListResult -} - -// 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 *DedicatedHsmListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedHsmListResultPage.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.dhlr) - if err != nil { - return err - } - page.dhlr = 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 *DedicatedHsmListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DedicatedHsmListResultPage) NotDone() bool { - return !page.dhlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DedicatedHsmListResultPage) Response() DedicatedHsmListResult { - return page.dhlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DedicatedHsmListResultPage) Values() []DedicatedHsm { - if page.dhlr.IsEmpty() { - return nil - } - return *page.dhlr.Value -} - -// Creates a new instance of the DedicatedHsmListResultPage type. -func NewDedicatedHsmListResultPage(cur DedicatedHsmListResult, getNextPage func(context.Context, DedicatedHsmListResult) (DedicatedHsmListResult, error)) DedicatedHsmListResultPage { - return DedicatedHsmListResultPage{ - fn: getNextPage, - dhlr: cur, - } -} - -// DedicatedHsmOperation REST API operation -type DedicatedHsmOperation struct { - // Name - The name of the Dedicated HSM Resource Provider Operation. - Name *string `json:"name,omitempty"` - // IsDataAction - READ-ONLY; Gets or sets a value indicating whether it is a data plane action - IsDataAction *string `json:"isDataAction,omitempty"` - Display *DedicatedHsmOperationDisplay `json:"display,omitempty"` -} - -// MarshalJSON is the custom marshaler for DedicatedHsmOperation. -func (dho DedicatedHsmOperation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dho.Name != nil { - objectMap["name"] = dho.Name - } - if dho.Display != nil { - objectMap["display"] = dho.Display - } - return json.Marshal(objectMap) -} - -// DedicatedHsmOperationDisplay ... -type DedicatedHsmOperationDisplay struct { - // Provider - The Resource Provider of the operation - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` - // Description - The object that represents the operation. - Description *string `json:"description,omitempty"` -} - -// DedicatedHsmOperationListResult result of the request to list Dedicated HSM Provider operations. It -// contains a list of operations. -type DedicatedHsmOperationListResult struct { - autorest.Response `json:"-"` - // Value - List of Dedicated HSM Resource Provider operations. - Value *[]DedicatedHsmOperation `json:"value,omitempty"` -} - -// DedicatedHsmPatchParameters patchable properties of the dedicated HSM -type DedicatedHsmPatchParameters struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DedicatedHsmPatchParameters. -func (dhpp DedicatedHsmPatchParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dhpp.Tags != nil { - objectMap["tags"] = dhpp.Tags - } - return json.Marshal(objectMap) -} - -// DedicatedHsmProperties properties of the dedicated hsm -type DedicatedHsmProperties struct { - // NetworkProfile - Specifies the network interfaces of the dedicated hsm. - NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` - // StampID - This field will be used when RP does not support Availability zones. - StampID *string `json:"stampId,omitempty"` - // StatusMessage - READ-ONLY; Resource Status Message. - StatusMessage *string `json:"statusMessage,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state. Possible values include: 'Succeeded', 'Provisioning', 'Allocating', 'Connecting', 'Failed', 'CheckingQuota', 'Deleting' - ProvisioningState JSONWebKeyType `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for DedicatedHsmProperties. -func (dhp DedicatedHsmProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dhp.NetworkProfile != nil { - objectMap["networkProfile"] = dhp.NetworkProfile - } - if dhp.StampID != nil { - objectMap["stampId"] = dhp.StampID - } - return json.Marshal(objectMap) -} - -// DedicatedHsmUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DedicatedHsmUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DedicatedHsmClient) (DedicatedHsm, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DedicatedHsmUpdateFuture) 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 DedicatedHsmUpdateFuture.Result. -func (future *DedicatedHsmUpdateFuture) result(client DedicatedHsmClient) (dh DedicatedHsm, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dh.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("hardwaresecuritymodules.DedicatedHsmUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dh.Response.Response, err = future.GetResult(sender); err == nil && dh.Response.Response.StatusCode != http.StatusNoContent { - dh, err = client.UpdateResponder(dh.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmUpdateFuture", "Result", dh.Response.Response, "Failure responding to request") - } - } - return -} - -// Error the key vault server error. -type Error struct { - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` - // InnerError - READ-ONLY - InnerError *Error `json:"innererror,omitempty"` -} - -// MarshalJSON is the custom marshaler for Error. -func (e Error) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NetworkInterface the network interface definition. -type NetworkInterface struct { - // ID - READ-ONLY; The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - ID *string `json:"id,omitempty"` - // PrivateIPAddress - Private Ip address of the interface - PrivateIPAddress *string `json:"privateIpAddress,omitempty"` -} - -// MarshalJSON is the custom marshaler for NetworkInterface. -func (ni NetworkInterface) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ni.PrivateIPAddress != nil { - objectMap["privateIpAddress"] = ni.PrivateIPAddress - } - return json.Marshal(objectMap) -} - -// NetworkProfile ... -type NetworkProfile struct { - // Subnet - Specifies the identifier of the subnet. - Subnet *APIEntityReference `json:"subnet,omitempty"` - // NetworkInterfaces - Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. - NetworkInterfaces *[]NetworkInterface `json:"networkInterfaces,omitempty"` -} - -// Resource dedicated HSM resource -type Resource struct { - // ID - READ-ONLY; The Azure Resource Manager resource ID for the dedicated HSM. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the dedicated HSM. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The resource type of the dedicated HSM. - Type *string `json:"type,omitempty"` - // Location - The supported Azure location where the dedicated HSM should be created. - Location *string `json:"location,omitempty"` - // Sku - SKU details - Sku *Sku `json:"sku,omitempty"` - // Zones - The Dedicated Hsm zones. - Zones *[]string `json:"zones,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Sku != nil { - objectMap["sku"] = r.Sku - } - if r.Zones != nil { - objectMap["zones"] = r.Zones - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// ResourceListResult list of dedicated HSM resources. -type ResourceListResult struct { - // Value - The list of dedicated HSM resources. - Value *[]Resource `json:"value,omitempty"` - // NextLink - The URL to get the next set of dedicated HSM resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// Sku ... -type Sku struct { - // Name - SKU of the dedicated HSM. Possible values include: 'SafeNetLunaNetworkHSMA790' - Name Name `json:"name,omitempty"` -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/operations.go deleted file mode 100644 index 195428eb9e4a..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/operations.go +++ /dev/null @@ -1,99 +0,0 @@ -package hardwaresecuritymodules - -// 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 the Azure management API provides a RESTful set of web services that interact with Azure -// Dedicated HSM RP. -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 get a list of Dedicated HSM operations. -func (client OperationsClient) List(ctx context.Context) (result DedicatedHsmOperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.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) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2018-10-31-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.HardwareSecurityModules/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 DedicatedHsmOperationListResult, 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/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/version.go deleted file mode 100644 index 38e8ad9f4339..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package hardwaresecuritymodules - -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() + " hardwaresecuritymodules/2018-10-31-preview" -} - -// 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/hardwaresecuritymodules/2021-11-30/dedicatedhsms/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/README.md new file mode 100644 index 000000000000..7e827e21b258 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/README.md @@ -0,0 +1,133 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms` Documentation + +The `dedicatedhsms` SDK allows for interaction with the Azure Resource Manager Service `hardwaresecuritymodules` (API Version `2021-11-30`). + +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/hardwaresecuritymodules/2021-11-30/dedicatedhsms" +``` + + +### Client Initialization + +```go +client := dedicatedhsms.NewDedicatedHsmsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DedicatedHsmsClient.DedicatedHsmCreateOrUpdate` + +```go +ctx := context.TODO() +id := dedicatedhsms.NewDedicatedHSMID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nameValue") + +payload := dedicatedhsms.DedicatedHsm{ + // ... +} + + +if err := client.DedicatedHsmCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DedicatedHsmsClient.DedicatedHsmDelete` + +```go +ctx := context.TODO() +id := dedicatedhsms.NewDedicatedHSMID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nameValue") + +if err := client.DedicatedHsmDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DedicatedHsmsClient.DedicatedHsmGet` + +```go +ctx := context.TODO() +id := dedicatedhsms.NewDedicatedHSMID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nameValue") + +read, err := client.DedicatedHsmGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DedicatedHsmsClient.DedicatedHsmListByResourceGroup` + +```go +ctx := context.TODO() +id := dedicatedhsms.NewResourceGroupID() + +// alternatively `client.DedicatedHsmListByResourceGroup(ctx, id, dedicatedhsms.DefaultDedicatedHsmListByResourceGroupOperationOptions())` can be used to do batched pagination +items, err := client.DedicatedHsmListByResourceGroupComplete(ctx, id, dedicatedhsms.DefaultDedicatedHsmListByResourceGroupOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DedicatedHsmsClient.DedicatedHsmListBySubscription` + +```go +ctx := context.TODO() +id := dedicatedhsms.NewSubscriptionID() + +// alternatively `client.DedicatedHsmListBySubscription(ctx, id, dedicatedhsms.DefaultDedicatedHsmListBySubscriptionOperationOptions())` can be used to do batched pagination +items, err := client.DedicatedHsmListBySubscriptionComplete(ctx, id, dedicatedhsms.DefaultDedicatedHsmListBySubscriptionOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DedicatedHsmsClient.DedicatedHsmListOutboundNetworkDependenciesEndpoints` + +```go +ctx := context.TODO() +id := dedicatedhsms.NewDedicatedHSMID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nameValue") + +// alternatively `client.DedicatedHsmListOutboundNetworkDependenciesEndpoints(ctx, id)` can be used to do batched pagination +items, err := client.DedicatedHsmListOutboundNetworkDependenciesEndpointsComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DedicatedHsmsClient.DedicatedHsmUpdate` + +```go +ctx := context.TODO() +id := dedicatedhsms.NewDedicatedHSMID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nameValue") + +payload := dedicatedhsms.DedicatedHsmPatchParameters{ + // ... +} + + +if err := client.DedicatedHsmUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/client.go new file mode 100644 index 000000000000..186b5df4b1af --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/client.go @@ -0,0 +1,18 @@ +package dedicatedhsms + +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 DedicatedHsmsClient struct { + Client autorest.Client + baseUri string +} + +func NewDedicatedHsmsClientWithBaseURI(endpoint string) DedicatedHsmsClient { + return DedicatedHsmsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/constants.go new file mode 100644 index 000000000000..f81a04d3248b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/constants.go @@ -0,0 +1,92 @@ +package dedicatedhsms + +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 JsonWebKeyType string + +const ( + JsonWebKeyTypeAllocating JsonWebKeyType = "Allocating" + JsonWebKeyTypeCheckingQuota JsonWebKeyType = "CheckingQuota" + JsonWebKeyTypeConnecting JsonWebKeyType = "Connecting" + JsonWebKeyTypeDeleting JsonWebKeyType = "Deleting" + JsonWebKeyTypeFailed JsonWebKeyType = "Failed" + JsonWebKeyTypeProvisioning JsonWebKeyType = "Provisioning" + JsonWebKeyTypeSucceeded JsonWebKeyType = "Succeeded" +) + +func PossibleValuesForJsonWebKeyType() []string { + return []string{ + string(JsonWebKeyTypeAllocating), + string(JsonWebKeyTypeCheckingQuota), + string(JsonWebKeyTypeConnecting), + string(JsonWebKeyTypeDeleting), + string(JsonWebKeyTypeFailed), + string(JsonWebKeyTypeProvisioning), + string(JsonWebKeyTypeSucceeded), + } +} + +func parseJsonWebKeyType(input string) (*JsonWebKeyType, error) { + vals := map[string]JsonWebKeyType{ + "allocating": JsonWebKeyTypeAllocating, + "checkingquota": JsonWebKeyTypeCheckingQuota, + "connecting": JsonWebKeyTypeConnecting, + "deleting": JsonWebKeyTypeDeleting, + "failed": JsonWebKeyTypeFailed, + "provisioning": JsonWebKeyTypeProvisioning, + "succeeded": JsonWebKeyTypeSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := JsonWebKeyType(input) + return &out, nil +} + +type SkuName string + +const ( + SkuNamePayShieldOneZeroKLMKOneCPSSixZero SkuName = "payShield10K_LMK1_CPS60" + SkuNamePayShieldOneZeroKLMKOneCPSTwoFiveZero SkuName = "payShield10K_LMK1_CPS250" + SkuNamePayShieldOneZeroKLMKOneCPSTwoFiveZeroZero SkuName = "payShield10K_LMK1_CPS2500" + SkuNamePayShieldOneZeroKLMKTwoCPSSixZero SkuName = "payShield10K_LMK2_CPS60" + SkuNamePayShieldOneZeroKLMKTwoCPSTwoFiveZero SkuName = "payShield10K_LMK2_CPS250" + SkuNamePayShieldOneZeroKLMKTwoCPSTwoFiveZeroZero SkuName = "payShield10K_LMK2_CPS2500" + SkuNameSafeNetLunaNetworkHSMASevenNineZero SkuName = "SafeNet Luna Network HSM A790" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNamePayShieldOneZeroKLMKOneCPSSixZero), + string(SkuNamePayShieldOneZeroKLMKOneCPSTwoFiveZero), + string(SkuNamePayShieldOneZeroKLMKOneCPSTwoFiveZeroZero), + string(SkuNamePayShieldOneZeroKLMKTwoCPSSixZero), + string(SkuNamePayShieldOneZeroKLMKTwoCPSTwoFiveZero), + string(SkuNamePayShieldOneZeroKLMKTwoCPSTwoFiveZeroZero), + string(SkuNameSafeNetLunaNetworkHSMASevenNineZero), + } +} + +func parseSkuName(input string) (*SkuName, error) { + vals := map[string]SkuName{ + "payshield10k_lmk1_cps60": SkuNamePayShieldOneZeroKLMKOneCPSSixZero, + "payshield10k_lmk1_cps250": SkuNamePayShieldOneZeroKLMKOneCPSTwoFiveZero, + "payshield10k_lmk1_cps2500": SkuNamePayShieldOneZeroKLMKOneCPSTwoFiveZeroZero, + "payshield10k_lmk2_cps60": SkuNamePayShieldOneZeroKLMKTwoCPSSixZero, + "payshield10k_lmk2_cps250": SkuNamePayShieldOneZeroKLMKTwoCPSTwoFiveZero, + "payshield10k_lmk2_cps2500": SkuNamePayShieldOneZeroKLMKTwoCPSTwoFiveZeroZero, + "safenet luna network hsm a790": SkuNameSafeNetLunaNetworkHSMASevenNineZero, + } + 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 +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/id_dedicatedhsm.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/id_dedicatedhsm.go new file mode 100644 index 000000000000..04dc52c63568 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/id_dedicatedhsm.go @@ -0,0 +1,124 @@ +package dedicatedhsms + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DedicatedHSMId{} + +// DedicatedHSMId is a struct representing the Resource ID for a Dedicated H S M +type DedicatedHSMId struct { + SubscriptionId string + ResourceGroupName string + Name string +} + +// NewDedicatedHSMID returns a new DedicatedHSMId struct +func NewDedicatedHSMID(subscriptionId string, resourceGroupName string, name string) DedicatedHSMId { + return DedicatedHSMId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + Name: name, + } +} + +// ParseDedicatedHSMID parses 'input' into a DedicatedHSMId +func ParseDedicatedHSMID(input string) (*DedicatedHSMId, error) { + parser := resourceids.NewParserFromResourceIdType(DedicatedHSMId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DedicatedHSMId{} + + 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.Name, ok = parsed.Parsed["name"]; !ok { + return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDedicatedHSMIDInsensitively parses 'input' case-insensitively into a DedicatedHSMId +// note: this method should only be used for API response data and not user input +func ParseDedicatedHSMIDInsensitively(input string) (*DedicatedHSMId, error) { + parser := resourceids.NewParserFromResourceIdType(DedicatedHSMId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DedicatedHSMId{} + + 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.Name, ok = parsed.Parsed["name"]; !ok { + return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDedicatedHSMID checks that 'input' can be parsed as a Dedicated H S M ID +func ValidateDedicatedHSMID(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 := ParseDedicatedHSMID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Dedicated H S M ID +func (id DedicatedHSMId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.Name) +} + +// Segments returns a slice of Resource ID Segments which comprise this Dedicated H S M ID +func (id DedicatedHSMId) 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("staticMicrosoftHardwareSecurityModules", "Microsoft.HardwareSecurityModules", "Microsoft.HardwareSecurityModules"), + resourceids.StaticSegment("staticDedicatedHSMs", "dedicatedHSMs", "dedicatedHSMs"), + resourceids.UserSpecifiedSegment("name", "nameValue"), + } +} + +// String returns a human-readable description of this Dedicated H S M ID +func (id DedicatedHSMId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Name: %q", id.Name), + } + return fmt.Sprintf("Dedicated H S M (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmcreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmcreateorupdate_autorest.go new file mode 100644 index 000000000000..e5ccb166ebf8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmcreateorupdate_autorest.go @@ -0,0 +1,79 @@ +package dedicatedhsms + +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 DedicatedHsmCreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// DedicatedHsmCreateOrUpdate ... +func (c DedicatedHsmsClient) DedicatedHsmCreateOrUpdate(ctx context.Context, id DedicatedHSMId, input DedicatedHsm) (result DedicatedHsmCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForDedicatedHsmCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmCreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForDedicatedHsmCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DedicatedHsmCreateOrUpdateThenPoll performs DedicatedHsmCreateOrUpdate then polls until it's completed +func (c DedicatedHsmsClient) DedicatedHsmCreateOrUpdateThenPoll(ctx context.Context, id DedicatedHSMId, input DedicatedHsm) error { + result, err := c.DedicatedHsmCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DedicatedHsmCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after DedicatedHsmCreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForDedicatedHsmCreateOrUpdate prepares the DedicatedHsmCreateOrUpdate request. +func (c DedicatedHsmsClient) preparerForDedicatedHsmCreateOrUpdate(ctx context.Context, id DedicatedHSMId, input DedicatedHsm) (*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)) +} + +// senderForDedicatedHsmCreateOrUpdate sends the DedicatedHsmCreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c DedicatedHsmsClient) senderForDedicatedHsmCreateOrUpdate(ctx context.Context, req *http.Request) (future DedicatedHsmCreateOrUpdateOperationResponse, 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/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmdelete_autorest.go new file mode 100644 index 000000000000..3df0fbb55454 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmdelete_autorest.go @@ -0,0 +1,78 @@ +package dedicatedhsms + +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 DedicatedHsmDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// DedicatedHsmDelete ... +func (c DedicatedHsmsClient) DedicatedHsmDelete(ctx context.Context, id DedicatedHSMId) (result DedicatedHsmDeleteOperationResponse, err error) { + req, err := c.preparerForDedicatedHsmDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDedicatedHsmDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DedicatedHsmDeleteThenPoll performs DedicatedHsmDelete then polls until it's completed +func (c DedicatedHsmsClient) DedicatedHsmDeleteThenPoll(ctx context.Context, id DedicatedHSMId) error { + result, err := c.DedicatedHsmDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing DedicatedHsmDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after DedicatedHsmDelete: %+v", err) + } + + return nil +} + +// preparerForDedicatedHsmDelete prepares the DedicatedHsmDelete request. +func (c DedicatedHsmsClient) preparerForDedicatedHsmDelete(ctx context.Context, id DedicatedHSMId) (*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)) +} + +// senderForDedicatedHsmDelete sends the DedicatedHsmDelete request. The method will close the +// http.Response Body if it receives an error. +func (c DedicatedHsmsClient) senderForDedicatedHsmDelete(ctx context.Context, req *http.Request) (future DedicatedHsmDeleteOperationResponse, 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/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmget_autorest.go new file mode 100644 index 000000000000..893f50dff68d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmget_autorest.go @@ -0,0 +1,67 @@ +package dedicatedhsms + +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 DedicatedHsmGetOperationResponse struct { + HttpResponse *http.Response + Model *DedicatedHsm +} + +// DedicatedHsmGet ... +func (c DedicatedHsmsClient) DedicatedHsmGet(ctx context.Context, id DedicatedHSMId) (result DedicatedHsmGetOperationResponse, err error) { + req, err := c.preparerForDedicatedHsmGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDedicatedHsmGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDedicatedHsmGet prepares the DedicatedHsmGet request. +func (c DedicatedHsmsClient) preparerForDedicatedHsmGet(ctx context.Context, id DedicatedHSMId) (*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)) +} + +// responderForDedicatedHsmGet handles the response to the DedicatedHsmGet request. The method always +// closes the http.Response Body. +func (c DedicatedHsmsClient) responderForDedicatedHsmGet(resp *http.Response) (result DedicatedHsmGetOperationResponse, 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/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbyresourcegroup_autorest.go new file mode 100644 index 000000000000..515f178362f3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbyresourcegroup_autorest.go @@ -0,0 +1,216 @@ +package dedicatedhsms + +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 DedicatedHsmListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]DedicatedHsm + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (DedicatedHsmListByResourceGroupOperationResponse, error) +} + +type DedicatedHsmListByResourceGroupCompleteResult struct { + Items []DedicatedHsm +} + +func (r DedicatedHsmListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r DedicatedHsmListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp DedicatedHsmListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type DedicatedHsmListByResourceGroupOperationOptions struct { + Top *int64 +} + +func DefaultDedicatedHsmListByResourceGroupOperationOptions() DedicatedHsmListByResourceGroupOperationOptions { + return DedicatedHsmListByResourceGroupOperationOptions{} +} + +func (o DedicatedHsmListByResourceGroupOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o DedicatedHsmListByResourceGroupOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// DedicatedHsmListByResourceGroup ... +func (c DedicatedHsmsClient) DedicatedHsmListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options DedicatedHsmListByResourceGroupOperationOptions) (resp DedicatedHsmListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForDedicatedHsmListByResourceGroup(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForDedicatedHsmListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// DedicatedHsmListByResourceGroupComplete retrieves all of the results into a single object +func (c DedicatedHsmsClient) DedicatedHsmListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options DedicatedHsmListByResourceGroupOperationOptions) (DedicatedHsmListByResourceGroupCompleteResult, error) { + return c.DedicatedHsmListByResourceGroupCompleteMatchingPredicate(ctx, id, options, DedicatedHsmOperationPredicate{}) +} + +// DedicatedHsmListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DedicatedHsmsClient) DedicatedHsmListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options DedicatedHsmListByResourceGroupOperationOptions, predicate DedicatedHsmOperationPredicate) (resp DedicatedHsmListByResourceGroupCompleteResult, err error) { + items := make([]DedicatedHsm, 0) + + page, err := c.DedicatedHsmListByResourceGroup(ctx, id, options) + 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 := DedicatedHsmListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForDedicatedHsmListByResourceGroup prepares the DedicatedHsmListByResourceGroup request. +func (c DedicatedHsmsClient) preparerForDedicatedHsmListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options DedicatedHsmListByResourceGroupOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForDedicatedHsmListByResourceGroupWithNextLink prepares the DedicatedHsmListByResourceGroup request with the given nextLink token. +func (c DedicatedHsmsClient) preparerForDedicatedHsmListByResourceGroupWithNextLink(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)) +} + +// responderForDedicatedHsmListByResourceGroup handles the response to the DedicatedHsmListByResourceGroup request. The method always +// closes the http.Response Body. +func (c DedicatedHsmsClient) responderForDedicatedHsmListByResourceGroup(resp *http.Response) (result DedicatedHsmListByResourceGroupOperationResponse, err error) { + type page struct { + Values []DedicatedHsm `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 DedicatedHsmListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForDedicatedHsmListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDedicatedHsmListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbysubscription_autorest.go new file mode 100644 index 000000000000..bc8ef5408e64 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbysubscription_autorest.go @@ -0,0 +1,216 @@ +package dedicatedhsms + +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 DedicatedHsmListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]DedicatedHsm + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (DedicatedHsmListBySubscriptionOperationResponse, error) +} + +type DedicatedHsmListBySubscriptionCompleteResult struct { + Items []DedicatedHsm +} + +func (r DedicatedHsmListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r DedicatedHsmListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp DedicatedHsmListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type DedicatedHsmListBySubscriptionOperationOptions struct { + Top *int64 +} + +func DefaultDedicatedHsmListBySubscriptionOperationOptions() DedicatedHsmListBySubscriptionOperationOptions { + return DedicatedHsmListBySubscriptionOperationOptions{} +} + +func (o DedicatedHsmListBySubscriptionOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o DedicatedHsmListBySubscriptionOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// DedicatedHsmListBySubscription ... +func (c DedicatedHsmsClient) DedicatedHsmListBySubscription(ctx context.Context, id commonids.SubscriptionId, options DedicatedHsmListBySubscriptionOperationOptions) (resp DedicatedHsmListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForDedicatedHsmListBySubscription(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForDedicatedHsmListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// DedicatedHsmListBySubscriptionComplete retrieves all of the results into a single object +func (c DedicatedHsmsClient) DedicatedHsmListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options DedicatedHsmListBySubscriptionOperationOptions) (DedicatedHsmListBySubscriptionCompleteResult, error) { + return c.DedicatedHsmListBySubscriptionCompleteMatchingPredicate(ctx, id, options, DedicatedHsmOperationPredicate{}) +} + +// DedicatedHsmListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DedicatedHsmsClient) DedicatedHsmListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options DedicatedHsmListBySubscriptionOperationOptions, predicate DedicatedHsmOperationPredicate) (resp DedicatedHsmListBySubscriptionCompleteResult, err error) { + items := make([]DedicatedHsm, 0) + + page, err := c.DedicatedHsmListBySubscription(ctx, id, options) + 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 := DedicatedHsmListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForDedicatedHsmListBySubscription prepares the DedicatedHsmListBySubscription request. +func (c DedicatedHsmsClient) preparerForDedicatedHsmListBySubscription(ctx context.Context, id commonids.SubscriptionId, options DedicatedHsmListBySubscriptionOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForDedicatedHsmListBySubscriptionWithNextLink prepares the DedicatedHsmListBySubscription request with the given nextLink token. +func (c DedicatedHsmsClient) preparerForDedicatedHsmListBySubscriptionWithNextLink(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)) +} + +// responderForDedicatedHsmListBySubscription handles the response to the DedicatedHsmListBySubscription request. The method always +// closes the http.Response Body. +func (c DedicatedHsmsClient) responderForDedicatedHsmListBySubscription(resp *http.Response) (result DedicatedHsmListBySubscriptionOperationResponse, err error) { + type page struct { + Values []DedicatedHsm `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 DedicatedHsmListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForDedicatedHsmListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDedicatedHsmListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistoutboundnetworkdependenciesendpoints_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistoutboundnetworkdependenciesendpoints_autorest.go new file mode 100644 index 000000000000..a938efbddd13 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistoutboundnetworkdependenciesendpoints_autorest.go @@ -0,0 +1,186 @@ +package dedicatedhsms + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "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 DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse struct { + HttpResponse *http.Response + Model *[]OutboundEnvironmentEndpoint + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse, error) +} + +type DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteResult struct { + Items []OutboundEnvironmentEndpoint +} + +func (r DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse) LoadMore(ctx context.Context) (resp DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// DedicatedHsmListOutboundNetworkDependenciesEndpoints ... +func (c DedicatedHsmsClient) DedicatedHsmListOutboundNetworkDependenciesEndpoints(ctx context.Context, id DedicatedHSMId) (resp DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { + req, err := c.preparerForDedicatedHsmListOutboundNetworkDependenciesEndpoints(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListOutboundNetworkDependenciesEndpoints", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForDedicatedHsmListOutboundNetworkDependenciesEndpoints(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListOutboundNetworkDependenciesEndpoints", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// DedicatedHsmListOutboundNetworkDependenciesEndpointsComplete retrieves all of the results into a single object +func (c DedicatedHsmsClient) DedicatedHsmListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, id DedicatedHSMId) (DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteResult, error) { + return c.DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx, id, OutboundEnvironmentEndpointOperationPredicate{}) +} + +// DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DedicatedHsmsClient) DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx context.Context, id DedicatedHSMId, predicate OutboundEnvironmentEndpointOperationPredicate) (resp DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteResult, err error) { + items := make([]OutboundEnvironmentEndpoint, 0) + + page, err := c.DedicatedHsmListOutboundNetworkDependenciesEndpoints(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 := DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForDedicatedHsmListOutboundNetworkDependenciesEndpoints prepares the DedicatedHsmListOutboundNetworkDependenciesEndpoints request. +func (c DedicatedHsmsClient) preparerForDedicatedHsmListOutboundNetworkDependenciesEndpoints(ctx context.Context, id DedicatedHSMId) (*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/outboundNetworkDependenciesEndpoints", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForDedicatedHsmListOutboundNetworkDependenciesEndpointsWithNextLink prepares the DedicatedHsmListOutboundNetworkDependenciesEndpoints request with the given nextLink token. +func (c DedicatedHsmsClient) preparerForDedicatedHsmListOutboundNetworkDependenciesEndpointsWithNextLink(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)) +} + +// responderForDedicatedHsmListOutboundNetworkDependenciesEndpoints handles the response to the DedicatedHsmListOutboundNetworkDependenciesEndpoints request. The method always +// closes the http.Response Body. +func (c DedicatedHsmsClient) responderForDedicatedHsmListOutboundNetworkDependenciesEndpoints(resp *http.Response) (result DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { + type page struct { + Values []OutboundEnvironmentEndpoint `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 DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { + req, err := c.preparerForDedicatedHsmListOutboundNetworkDependenciesEndpointsWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListOutboundNetworkDependenciesEndpoints", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDedicatedHsmListOutboundNetworkDependenciesEndpoints(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListOutboundNetworkDependenciesEndpoints", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmupdate_autorest.go new file mode 100644 index 000000000000..da7dcc6070dd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmupdate_autorest.go @@ -0,0 +1,79 @@ +package dedicatedhsms + +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 DedicatedHsmUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// DedicatedHsmUpdate ... +func (c DedicatedHsmsClient) DedicatedHsmUpdate(ctx context.Context, id DedicatedHSMId, input DedicatedHsmPatchParameters) (result DedicatedHsmUpdateOperationResponse, err error) { + req, err := c.preparerForDedicatedHsmUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForDedicatedHsmUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DedicatedHsmUpdateThenPoll performs DedicatedHsmUpdate then polls until it's completed +func (c DedicatedHsmsClient) DedicatedHsmUpdateThenPoll(ctx context.Context, id DedicatedHSMId, input DedicatedHsmPatchParameters) error { + result, err := c.DedicatedHsmUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DedicatedHsmUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after DedicatedHsmUpdate: %+v", err) + } + + return nil +} + +// preparerForDedicatedHsmUpdate prepares the DedicatedHsmUpdate request. +func (c DedicatedHsmsClient) preparerForDedicatedHsmUpdate(ctx context.Context, id DedicatedHSMId, input DedicatedHsmPatchParameters) (*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)) +} + +// senderForDedicatedHsmUpdate sends the DedicatedHsmUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c DedicatedHsmsClient) senderForDedicatedHsmUpdate(ctx context.Context, req *http.Request) (future DedicatedHsmUpdateOperationResponse, 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/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_apientityreference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_apientityreference.go new file mode 100644 index 000000000000..8ad37fa56d2b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_apientityreference.go @@ -0,0 +1,8 @@ +package dedicatedhsms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiEntityReference struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_dedicatedhsm.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_dedicatedhsm.go new file mode 100644 index 000000000000..2d8a463e1f76 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_dedicatedhsm.go @@ -0,0 +1,20 @@ +package dedicatedhsms + +import ( + "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 DedicatedHsm struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties DedicatedHsmProperties `json:"properties"` + Sku Sku `json:"sku"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *[]string `json:"zones,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_dedicatedhsmpatchparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_dedicatedhsmpatchparameters.go new file mode 100644 index 000000000000..86d8d0a762b2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_dedicatedhsmpatchparameters.go @@ -0,0 +1,8 @@ +package dedicatedhsms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHsmPatchParameters struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_dedicatedhsmproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_dedicatedhsmproperties.go new file mode 100644 index 000000000000..089c6740f27e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_dedicatedhsmproperties.go @@ -0,0 +1,12 @@ +package dedicatedhsms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHsmProperties struct { + ManagementNetworkProfile *NetworkProfile `json:"managementNetworkProfile,omitempty"` + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + ProvisioningState *JsonWebKeyType `json:"provisioningState,omitempty"` + StampId *string `json:"stampId,omitempty"` + StatusMessage *string `json:"statusMessage,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_endpointdependency.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_endpointdependency.go new file mode 100644 index 000000000000..8d0101e5200e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_endpointdependency.go @@ -0,0 +1,9 @@ +package dedicatedhsms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointDependency struct { + DomainName *string `json:"domainName,omitempty"` + EndpointDetails *[]EndpointDetail `json:"endpointDetails,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_endpointdetail.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_endpointdetail.go new file mode 100644 index 000000000000..1adfec36904e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_endpointdetail.go @@ -0,0 +1,11 @@ +package dedicatedhsms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointDetail struct { + Description *string `json:"description,omitempty"` + IpAddress *string `json:"ipAddress,omitempty"` + Port *int64 `json:"port,omitempty"` + Protocol *string `json:"protocol,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_networkinterface.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_networkinterface.go new file mode 100644 index 000000000000..86848ff683e2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_networkinterface.go @@ -0,0 +1,9 @@ +package dedicatedhsms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkInterface struct { + Id *string `json:"id,omitempty"` + PrivateIpAddress *string `json:"privateIpAddress,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_networkprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_networkprofile.go new file mode 100644 index 000000000000..ad833cee5f1b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_networkprofile.go @@ -0,0 +1,9 @@ +package dedicatedhsms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkProfile struct { + NetworkInterfaces *[]NetworkInterface `json:"networkInterfaces,omitempty"` + Subnet *ApiEntityReference `json:"subnet,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_outboundenvironmentendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_outboundenvironmentendpoint.go new file mode 100644 index 000000000000..2da670f790a3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_outboundenvironmentendpoint.go @@ -0,0 +1,9 @@ +package dedicatedhsms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OutboundEnvironmentEndpoint struct { + Category *string `json:"category,omitempty"` + Endpoints *[]EndpointDependency `json:"endpoints,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_sku.go new file mode 100644 index 000000000000..5ca103935da9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_sku.go @@ -0,0 +1,8 @@ +package dedicatedhsms + +// 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 { + Name *SkuName `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/predicates.go new file mode 100644 index 000000000000..8ecbb2e796f2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/predicates.go @@ -0,0 +1,42 @@ +package dedicatedhsms + +type DedicatedHsmOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p DedicatedHsmOperationPredicate) Matches(input DedicatedHsm) bool { + + 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 +} + +type OutboundEnvironmentEndpointOperationPredicate struct { + Category *string +} + +func (p OutboundEnvironmentEndpointOperationPredicate) Matches(input OutboundEnvironmentEndpoint) bool { + + if p.Category != nil && (input.Category == nil && *p.Category != *input.Category) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/version.go new file mode 100644 index 000000000000..1dfbb967b27e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/version.go @@ -0,0 +1,12 @@ +package dedicatedhsms + +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-11-30" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/dedicatedhsms/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 5e8793fa1bb5..a7e83b28c587 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -62,7 +62,6 @@ github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-0 github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2021-08-01-preview/containerregistry github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders -github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-07-01-preview/insights github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-09-01-preview/insights github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement @@ -226,6 +225,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09 github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules +github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentity