From 6c56df89c17a90ab50331a7f0eaf2214fce3fcaf Mon Sep 17 00:00:00 2001 From: Owen Farrell Date: Thu, 23 Sep 2021 11:08:39 -0400 Subject: [PATCH 1/8] Update log statements to use struct String() function Signed-off-by: Owen Farrell --- ...napse_managed_private_endpoint_resource.go | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/internal/services/synapse/synapse_managed_private_endpoint_resource.go b/internal/services/synapse/synapse_managed_private_endpoint_resource.go index 7f4d0ffda099..fce595dabfb3 100644 --- a/internal/services/synapse/synapse_managed_private_endpoint_resource.go +++ b/internal/services/synapse/synapse_managed_private_endpoint_resource.go @@ -81,14 +81,14 @@ func resourceSynapseManagedPrivateEndpointCreate(d *pluginsdk.ResourceData, meta workspace, err := workspaceClient.Get(ctx, workspaceId.ResourceGroup, workspaceId.Name) if err != nil { - return fmt.Errorf("retrieving Synapse workspace %q (Resource Group %q): %+v", workspaceId.Name, workspaceId.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *workspaceId, err) } if workspace.WorkspaceProperties == nil || workspace.WorkspaceProperties.ManagedVirtualNetwork == nil { - return fmt.Errorf("empty or nil `ManagedVirtualNetwork` for Synapse workspace %q (Resource Group %q): %+v", workspaceId.Name, workspaceId.ResourceGroup, err) + return fmt.Errorf("empty or nil `ManagedVirtualNetwork` for %s: %+v", *workspaceId, err) } - virtualNetworkName := *workspace.WorkspaceProperties.ManagedVirtualNetwork - id := parse.NewManagedPrivateEndpointID(workspaceId.SubscriptionId, workspaceId.ResourceGroup, workspaceId.Name, virtualNetworkName, d.Get("name").(string)) + id := parse.NewManagedPrivateEndpointID(workspaceId.SubscriptionId, workspaceId.ResourceGroup, workspaceId.Name, *workspace.WorkspaceProperties.ManagedVirtualNetwork, d.Get("name").(string)) + client, err := synapseClient.ManagedPrivateEndpointsClient(workspaceId.Name, environment.SynapseEndpointSuffix) if err != nil { return fmt.Errorf("building Client for %s: %+v", id, err) @@ -98,7 +98,7 @@ func resourceSynapseManagedPrivateEndpointCreate(d *pluginsdk.ResourceData, meta existing, err := client.Get(ctx, id.ManagedVirtualNetworkName, id.Name) if err != nil { if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + return fmt.Errorf("checking for presence of %s: %+v", id, err) } } if !utils.ResponseWasNotFound(existing.Response) { @@ -111,10 +111,15 @@ func resourceSynapseManagedPrivateEndpointCreate(d *pluginsdk.ResourceData, meta GroupID: utils.String(d.Get("subresource_name").(string)), }, } - if _, err := client.Create(ctx, id.ManagedVirtualNetworkName, id.Name, managedPrivateEndpoint); err != nil { + resp, err := client.Create(ctx, id.ManagedVirtualNetworkName, id.Name, managedPrivateEndpoint) + if err != nil { return fmt.Errorf("creating %s: %+v", id, err) } + if resp.ID == nil || *resp.ID == "" { + return fmt.Errorf("empty or nil ID returned for %s", id) + } + d.SetId(id.ID()) return resourceSynapseManagedPrivateEndpointRead(d, meta) } @@ -145,8 +150,8 @@ func resourceSynapseManagedPrivateEndpointRead(d *pluginsdk.ResourceData, meta i return fmt.Errorf("retrieving %s: %+v", *id, err) } - workspaceId := parse.NewWorkspaceID(id.SubscriptionId, id.ResourceGroup, id.WorkspaceName).ID() - d.Set("synapse_workspace_id", workspaceId) + workspaceId := parse.NewWorkspaceID(id.SubscriptionId, id.ResourceGroup, id.WorkspaceName) + d.Set("synapse_workspace_id", workspaceId.ID()) d.Set("name", id.Name) if props := resp.Properties; props != nil { From cd2f09d59f93b3716074486a7b8634e114e527a1 Mon Sep 17 00:00:00 2001 From: Owen Farrell Date: Thu, 23 Sep 2021 12:20:30 -0400 Subject: [PATCH 2/8] Use indexed verbs in format strings Signed-off-by: Owen Farrell --- ..._managed_private_endpoint_resource_test.go | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/services/synapse/synapse_managed_private_endpoint_resource_test.go b/internal/services/synapse/synapse_managed_private_endpoint_resource_test.go index 571bb9c9dcc5..0f8a9d3eb8ee 100644 --- a/internal/services/synapse/synapse_managed_private_endpoint_resource_test.go +++ b/internal/services/synapse/synapse_managed_private_endpoint_resource_test.go @@ -61,7 +61,7 @@ func (r SynapseManagedPrivateEndpointResource) Exists(ctx context.Context, clien if utils.ResponseWasNotFound(resp.Response) { return utils.Bool(false), nil } - return nil, fmt.Errorf("retrieving Synapse Managed Private Endpoints (Workspace %q / Resource Group %q): %+v", id.WorkspaceName, id.ResourceGroup, err) + return nil, fmt.Errorf("retrieving %s: %+v", id, err) } return utils.Bool(true), nil @@ -70,10 +70,10 @@ func (r SynapseManagedPrivateEndpointResource) Exists(ctx context.Context, clien func (r SynapseManagedPrivateEndpointResource) basic(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(` - %s +%[1]s resource "azurerm_synapse_managed_private_endpoint" "test" { - name = "acctestEndpoint%d" + name = "acctestEndpoint%[2]d" synapse_workspace_id = azurerm_synapse_workspace.test.id target_resource_id = azurerm_storage_account.test_endpoint.id subresource_name = "blob" @@ -86,7 +86,7 @@ resource "azurerm_synapse_managed_private_endpoint" "test" { func (r SynapseManagedPrivateEndpointResource) requiresImport(data acceptance.TestData) string { config := r.basic(data) return fmt.Sprintf(` - %s +%[1]s resource "azurerm_synapse_managed_private_endpoint" "import" { name = azurerm_synapse_managed_private_endpoint.test.name @@ -104,12 +104,12 @@ provider "azurerm" { } resource "azurerm_resource_group" "test" { - name = "acctestRG-synapse-%d" - location = "%s" + name = "acctestRG-synapse-%[1]d" + location = "%[2]s" } resource "azurerm_storage_account" "test" { - name = "acctestacc%s" + name = "acctestacc%[3]s" resource_group_name = azurerm_resource_group.test.name location = azurerm_resource_group.test.location account_kind = "BlobStorage" @@ -118,7 +118,7 @@ resource "azurerm_storage_account" "test" { } resource "azurerm_storage_account" "test_endpoint" { - name = "acctestacce%s" + name = "acctestacce%[3]s" resource_group_name = azurerm_resource_group.test.name location = azurerm_resource_group.test.location account_kind = "BlobStorage" @@ -127,12 +127,12 @@ resource "azurerm_storage_account" "test_endpoint" { } resource "azurerm_storage_data_lake_gen2_filesystem" "test" { - name = "acctest-%d" + name = "acctest-%[1]d" storage_account_id = azurerm_storage_account.test.id } resource "azurerm_synapse_workspace" "test" { - name = "acctestsw%d" + name = "acctestsw%[1]d" resource_group_name = azurerm_resource_group.test.name location = azurerm_resource_group.test.location storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id @@ -150,5 +150,5 @@ resource "azurerm_synapse_firewall_rule" "test" { start_ip_address = "0.0.0.0" end_ip_address = "255.255.255.255" } -`, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomString, data.RandomInteger, data.RandomInteger) +`, data.RandomInteger, data.Locations.Primary, data.RandomString) } From 882c83c1d304c54fd60b6f687228ebdee70e445d Mon Sep 17 00:00:00 2001 From: Owen Farrell Date: Mon, 27 Sep 2021 13:23:17 -0400 Subject: [PATCH 3/8] Wait for managed private endpoint provisioning state when creating resource Signed-off-by: Owen Farrell --- ...napse_managed_private_endpoint_resource.go | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/internal/services/synapse/synapse_managed_private_endpoint_resource.go b/internal/services/synapse/synapse_managed_private_endpoint_resource.go index fce595dabfb3..eb1717289be2 100644 --- a/internal/services/synapse/synapse_managed_private_endpoint_resource.go +++ b/internal/services/synapse/synapse_managed_private_endpoint_resource.go @@ -1,11 +1,13 @@ package synapse import ( + "context" "fmt" "log" "time" "github.com/Azure/azure-sdk-for-go/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork" + "github.com/Azure/azure-sdk-for-go/services/synapse/mgmt/2021-03-01/synapse" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -120,6 +122,19 @@ func resourceSynapseManagedPrivateEndpointCreate(d *pluginsdk.ResourceData, meta return fmt.Errorf("empty or nil ID returned for %s", id) } + timeout, _ := ctx.Deadline() + + stateConf := &pluginsdk.StateChangeConf{ + Pending: []string{string(synapse.ProvisioningStateProvisioning)}, + Target: []string{string(synapse.ProvisioningStateSucceeded)}, + Refresh: managedPrivateEndpointProvisioningStateRefreshFunc(ctx, client, id), + MinTimeout: 1 * time.Minute, + Timeout: time.Until(timeout), + } + if _, err = stateConf.WaitForStateContext(ctx); err != nil { + return fmt.Errorf("waiting for provisioning state of %s: %+v", id, err) + } + d.SetId(id.ID()) return resourceSynapseManagedPrivateEndpointRead(d, meta) } @@ -183,3 +198,18 @@ func resourceSynapseManagedPrivateEndpointDelete(d *pluginsdk.ResourceData, meta return nil } + +func managedPrivateEndpointProvisioningStateRefreshFunc(ctx context.Context, client *managedvirtualnetwork.ManagedPrivateEndpointsClient, id parse.ManagedPrivateEndpointId) pluginsdk.StateRefreshFunc { + return func() (interface{}, string, error) { + resp, err := client.Get(ctx, id.ManagedVirtualNetworkName, id.Name) + if err != nil { + return nil, "", fmt.Errorf("polling for %s: %+v", id, err) + } + + if resp.Properties == nil || resp.Properties.ProvisioningState == nil { + return resp, "", fmt.Errorf("nil ProvisioningState returned for %s", id) + } + + return resp, *resp.Properties.ProvisioningState, nil + } +} From dff940b5b31af60d6a4d8d7acc0117ef33bfb9eb Mon Sep 17 00:00:00 2001 From: Owen Farrell Date: Mon, 27 Sep 2021 20:34:23 -0400 Subject: [PATCH 4/8] Update log statements to use struct String() function Signed-off-by: Owen Farrell --- .../synapse/synapse_firewall_rule_resource.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/internal/services/synapse/synapse_firewall_rule_resource.go b/internal/services/synapse/synapse_firewall_rule_resource.go index eae2c9f4a7eb..0ca1d34320d8 100644 --- a/internal/services/synapse/synapse_firewall_rule_resource.go +++ b/internal/services/synapse/synapse_firewall_rule_resource.go @@ -80,7 +80,7 @@ func resourceSynapseFirewallRuleCreateUpdate(d *pluginsdk.ResourceData, meta int existing, err := client.Get(ctx, id.ResourceGroup, id.WorkspaceName, id.Name) if err != nil { if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + return fmt.Errorf("checking for presence of %s: %+v", id, err) } } @@ -101,7 +101,12 @@ func resourceSynapseFirewallRuleCreateUpdate(d *pluginsdk.ResourceData, meta int return fmt.Errorf("creating/updating %s: %+v", id, err) } if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting on creation/update of %s: %+v", id, err) + return fmt.Errorf("waiting for creation/update of %s: %+v", id, err) + } + + _, err = client.Get(ctx, id.ResourceGroup, id.WorkspaceName, id.Name) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", id, err) } d.SetId(id.ID()) @@ -126,7 +131,7 @@ func resourceSynapseFirewallRuleRead(d *pluginsdk.ResourceData, meta interface{} return nil } - return fmt.Errorf("reading Synapse Firewall Rule %q (Workspace %q / Resource Group %q): %+v", id.Name, id.WorkspaceName, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } workspaceId := parse.NewWorkspaceID(id.SubscriptionId, id.ResourceGroup, id.WorkspaceName).ID() From c723bfe190845a3b1fa508cb2b29646ee7fe1ea0 Mon Sep 17 00:00:00 2001 From: Owen Farrell Date: Mon, 27 Sep 2021 20:29:44 -0400 Subject: [PATCH 5/8] Use indexed verbs in format strings Signed-off-by: Owen Farrell --- .../synapse_firewall_rule_resource_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/services/synapse/synapse_firewall_rule_resource_test.go b/internal/services/synapse/synapse_firewall_rule_resource_test.go index 675b039853c6..df7ba1681029 100644 --- a/internal/services/synapse/synapse_firewall_rule_resource_test.go +++ b/internal/services/synapse/synapse_firewall_rule_resource_test.go @@ -78,7 +78,7 @@ func (r SynapseFirewallRuleResource) Exists(ctx context.Context, client *clients if utils.ResponseWasNotFound(resp.Response) { return utils.Bool(false), nil } - return nil, fmt.Errorf("retrieving Synapse Firewall Rule %q (Workspace %q / Resource Group %q): %+v", id.Name, id.WorkspaceName, id.ResourceGroup, err) + return nil, fmt.Errorf("retrieving %s: %+v", id, err) } return utils.Bool(true), nil @@ -87,10 +87,10 @@ func (r SynapseFirewallRuleResource) Exists(ctx context.Context, client *clients func (r SynapseFirewallRuleResource) basic(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(` -%s +%[1]s resource "azurerm_synapse_firewall_rule" "test" { - name = "FirewallRule%d" + name = "FirewallRule%[2]d" synapse_workspace_id = azurerm_synapse_workspace.test.id start_ip_address = "0.0.0.0" end_ip_address = "255.255.255.255" @@ -101,7 +101,7 @@ resource "azurerm_synapse_firewall_rule" "test" { func (r SynapseFirewallRuleResource) requiresImport(data acceptance.TestData) string { config := r.basic(data) return fmt.Sprintf(` -%s +%[1]s resource "azurerm_synapse_firewall_rule" "import" { name = azurerm_synapse_firewall_rule.test.name @@ -115,10 +115,10 @@ resource "azurerm_synapse_firewall_rule" "import" { func (r SynapseFirewallRuleResource) withUpdates(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(` -%s +%[1]s resource "azurerm_synapse_firewall_rule" "test" { - name = "FirewallRule%d" + name = "FirewallRule%[2]d" synapse_workspace_id = azurerm_synapse_workspace.test.id start_ip_address = "10.0.17.62" end_ip_address = "10.0.17.62" @@ -133,12 +133,12 @@ provider "azurerm" { } resource "azurerm_resource_group" "test" { - name = "acctestRG-synapse-%d" - location = "%s" + name = "acctestRG-synapse-%[1]d" + location = "%[2]s" } resource "azurerm_storage_account" "test" { - name = "acctestacc%s" + name = "acctestacc%[3]s" resource_group_name = azurerm_resource_group.test.name location = azurerm_resource_group.test.location account_kind = "BlobStorage" @@ -147,12 +147,12 @@ resource "azurerm_storage_account" "test" { } resource "azurerm_storage_data_lake_gen2_filesystem" "test" { - name = "acctest-%d" + name = "acctest-%[1]d" storage_account_id = azurerm_storage_account.test.id } resource "azurerm_synapse_workspace" "test" { - name = "acctestsw%d" + name = "acctestsw%[1]d" resource_group_name = azurerm_resource_group.test.name location = azurerm_resource_group.test.location storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id @@ -162,5 +162,5 @@ resource "azurerm_synapse_workspace" "test" { type = "SystemAssigned" } } -`, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomInteger, data.RandomInteger) +`, data.RandomInteger, data.Locations.Primary, data.RandomString) } From 8feffa5388ac4c52dda2ddf3e5b5faf7a97b356b Mon Sep 17 00:00:00 2001 From: Owen Farrell Date: Mon, 27 Sep 2021 17:00:46 -0400 Subject: [PATCH 6/8] Wait for firewall rule provisioning state when creating or updating resource Signed-off-by: Owen Farrell --- .../synapse/synapse_firewall_rule_resource.go | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/internal/services/synapse/synapse_firewall_rule_resource.go b/internal/services/synapse/synapse_firewall_rule_resource.go index 0ca1d34320d8..9d76e63c73aa 100644 --- a/internal/services/synapse/synapse_firewall_rule_resource.go +++ b/internal/services/synapse/synapse_firewall_rule_resource.go @@ -1,6 +1,7 @@ package synapse import ( + "context" "fmt" "log" "time" @@ -104,9 +105,17 @@ func resourceSynapseFirewallRuleCreateUpdate(d *pluginsdk.ResourceData, meta int return fmt.Errorf("waiting for creation/update of %s: %+v", id, err) } - _, err = client.Get(ctx, id.ResourceGroup, id.WorkspaceName, id.Name) - if err != nil { - return fmt.Errorf("retrieving %s: %+v", id, err) + timeout, _ := ctx.Deadline() + + stateConf := &pluginsdk.StateChangeConf{ + Pending: []string{string(synapse.ProvisioningStateProvisioning)}, + Target: []string{string(synapse.ProvisioningStateSucceeded)}, + Refresh: firewallRuleProvisioningStateRefreshFunc(ctx, client, id), + MinTimeout: 1 * time.Minute, + Timeout: time.Until(timeout), + } + if _, err = stateConf.WaitForStateContext(ctx); err != nil { + return fmt.Errorf("waiting for provisioning state of %s: %+v", id, err) } d.SetId(id.ID()) @@ -167,3 +176,18 @@ func resourceSynapseFirewallRuleDelete(d *pluginsdk.ResourceData, meta interface return nil } + +func firewallRuleProvisioningStateRefreshFunc(ctx context.Context, client *synapse.IPFirewallRulesClient, id parse.FirewallRuleId) pluginsdk.StateRefreshFunc { + return func() (interface{}, string, error) { + resp, err := client.Get(ctx, id.ResourceGroup, id.WorkspaceName, id.Name) + if err != nil { + return nil, "", fmt.Errorf("polling for %s: %+v", id, err) + } + + if resp.IPFirewallRuleProperties == nil { + return resp, "", fmt.Errorf("nil IPFirewallRuleProperties returned for %s", id) + } + + return resp, string(resp.IPFirewallRuleProperties.ProvisioningState), nil + } +} From 46f211daafad49f869966e0f6b3917b1769712c4 Mon Sep 17 00:00:00 2001 From: Owen Farrell Date: Tue, 28 Sep 2021 09:04:33 -0400 Subject: [PATCH 7/8] Apply suggestions from code review Co-authored-by: Tom Harvey Signed-off-by: Owen Farrell --- .../synapse/synapse_firewall_rule_resource.go | 11 ++++++----- .../synapse/synapse_firewall_rule_resource_test.go | 2 +- .../synapse_managed_private_endpoint_resource.go | 10 +++++----- .../synapse_managed_private_endpoint_resource_test.go | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/internal/services/synapse/synapse_firewall_rule_resource.go b/internal/services/synapse/synapse_firewall_rule_resource.go index 9d76e63c73aa..8578be4bcb04 100644 --- a/internal/services/synapse/synapse_firewall_rule_resource.go +++ b/internal/services/synapse/synapse_firewall_rule_resource.go @@ -108,11 +108,12 @@ func resourceSynapseFirewallRuleCreateUpdate(d *pluginsdk.ResourceData, meta int timeout, _ := ctx.Deadline() stateConf := &pluginsdk.StateChangeConf{ - Pending: []string{string(synapse.ProvisioningStateProvisioning)}, - Target: []string{string(synapse.ProvisioningStateSucceeded)}, - Refresh: firewallRuleProvisioningStateRefreshFunc(ctx, client, id), - MinTimeout: 1 * time.Minute, - Timeout: time.Until(timeout), + Pending: []string{string(synapse.ProvisioningStateProvisioning)}, + Target: []string{string(synapse.ProvisioningStateSucceeded)}, + Refresh: firewallRuleProvisioningStateRefreshFunc(ctx, client, id), + Delay: 1 * time.Minute, + Timeout: time.Until(timeout), + PollInterval: 15 * time.Second, } if _, err = stateConf.WaitForStateContext(ctx); err != nil { return fmt.Errorf("waiting for provisioning state of %s: %+v", id, err) diff --git a/internal/services/synapse/synapse_firewall_rule_resource_test.go b/internal/services/synapse/synapse_firewall_rule_resource_test.go index df7ba1681029..90e59b536d6f 100644 --- a/internal/services/synapse/synapse_firewall_rule_resource_test.go +++ b/internal/services/synapse/synapse_firewall_rule_resource_test.go @@ -78,7 +78,7 @@ func (r SynapseFirewallRuleResource) Exists(ctx context.Context, client *clients if utils.ResponseWasNotFound(resp.Response) { return utils.Bool(false), nil } - return nil, fmt.Errorf("retrieving %s: %+v", id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } return utils.Bool(true), nil diff --git a/internal/services/synapse/synapse_managed_private_endpoint_resource.go b/internal/services/synapse/synapse_managed_private_endpoint_resource.go index eb1717289be2..9817729e4bf5 100644 --- a/internal/services/synapse/synapse_managed_private_endpoint_resource.go +++ b/internal/services/synapse/synapse_managed_private_endpoint_resource.go @@ -125,11 +125,11 @@ func resourceSynapseManagedPrivateEndpointCreate(d *pluginsdk.ResourceData, meta timeout, _ := ctx.Deadline() stateConf := &pluginsdk.StateChangeConf{ - Pending: []string{string(synapse.ProvisioningStateProvisioning)}, - Target: []string{string(synapse.ProvisioningStateSucceeded)}, - Refresh: managedPrivateEndpointProvisioningStateRefreshFunc(ctx, client, id), - MinTimeout: 1 * time.Minute, - Timeout: time.Until(timeout), + Pending: []string{string(synapse.ProvisioningStateProvisioning)}, + Target: []string{string(synapse.ProvisioningStateSucceeded)}, + Refresh: managedPrivateEndpointProvisioningStateRefreshFunc(ctx, client, id), + Timeout: time.Until(timeout), + PollInterval: 15 * time.Second, } if _, err = stateConf.WaitForStateContext(ctx); err != nil { return fmt.Errorf("waiting for provisioning state of %s: %+v", id, err) diff --git a/internal/services/synapse/synapse_managed_private_endpoint_resource_test.go b/internal/services/synapse/synapse_managed_private_endpoint_resource_test.go index 0f8a9d3eb8ee..0fa388d5d4c6 100644 --- a/internal/services/synapse/synapse_managed_private_endpoint_resource_test.go +++ b/internal/services/synapse/synapse_managed_private_endpoint_resource_test.go @@ -61,7 +61,7 @@ func (r SynapseManagedPrivateEndpointResource) Exists(ctx context.Context, clien if utils.ResponseWasNotFound(resp.Response) { return utils.Bool(false), nil } - return nil, fmt.Errorf("retrieving %s: %+v", id, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } return utils.Bool(true), nil From 5d8605406144eb42bb9852e0b50d54644841b0ff Mon Sep 17 00:00:00 2001 From: Owen Farrell Date: Sat, 30 Apr 2022 21:50:02 -0400 Subject: [PATCH 8/8] Support auto-approval of Synapse managed private endpoints Signed-off-by: Owen Farrell --- internal/services/cognitive/client/client.go | 10 +- internal/services/cosmos/client/client.go | 5 + internal/services/keyvault/client/client.go | 21 +- .../parse/private_endpoint_connection.go | 75 ++ .../parse/private_endpoint_connection_test.go | 128 ++++ internal/services/keyvault/resourceids.go | 1 + .../private_endpoint_connection_id.go | 23 + .../private_endpoint_connection_id_test.go | 88 +++ internal/services/mariadb/client/client.go | 26 +- internal/services/monitor/client/client.go | 5 + internal/services/mysql/client/client.go | 5 + internal/services/postgres/client/client.go | 6 + internal/services/purview/client/client.go | 10 +- internal/services/search/client/client.go | 6 + internal/services/sql/client/client.go | 5 + internal/services/storage/client/client.go | 61 +- internal/services/synapse/client/client.go | 5 + ...napse_managed_private_endpoint_resource.go | 657 +++++++++++++++++- ..._managed_private_endpoint_resource_test.go | 510 +++++++++++++- .../privateendpointconnections/README.md | 81 +++ .../privateendpointconnections/client.go | 18 + .../privateendpointconnections/constants.go | 71 ++ .../privateendpointconnections/id_account.go | 124 ++++ .../id_privateendpointconnection.go | 137 ++++ .../method_createorupdate_autorest.go | 79 +++ .../method_delete_autorest.go | 78 +++ .../method_get_autorest.go | 68 ++ .../method_list_autorest.go | 69 ++ .../model_privateendpoint.go | 8 + .../model_privateendpointconnection.go | 18 + ...del_privateendpointconnectionlistresult.go | 8 + ...del_privateendpointconnectionproperties.go | 11 + ...model_privatelinkserviceconnectionstate.go | 10 + .../privateendpointconnections/version.go | 12 + .../privateendpointconnections/README.md | 99 +++ .../privateendpointconnections/client.go | 18 + .../id_privateendpointconnection.go | 137 ++++ .../privateendpointconnections/id_server.go | 124 ++++ .../method_createorupdate_autorest.go | 79 +++ .../method_delete_autorest.go | 78 +++ .../method_get_autorest.go | 68 ++ .../method_listbyserver_autorest.go | 186 +++++ .../method_updatetags_autorest.go | 79 +++ .../model_privateendpointconnection.go | 11 + ...del_privateendpointconnectionproperties.go | 10 + .../model_privateendpointproperty.go | 8 + ...ivatelinkserviceconnectionstateproperty.go | 10 + .../model_tagsobject.go | 8 + .../privateendpointconnections/predicates.go | 24 + .../privateendpointconnections/version.go | 12 + .../privateendpointconnections/README.md | 99 +++ .../privateendpointconnections/client.go | 18 + .../id_privateendpointconnection.go | 137 ++++ .../privateendpointconnections/id_server.go | 124 ++++ .../method_createorupdate_autorest.go | 79 +++ .../method_delete_autorest.go | 78 +++ .../method_get_autorest.go | 68 ++ .../method_listbyserver_autorest.go | 186 +++++ .../method_updatetags_autorest.go | 79 +++ .../model_privateendpointconnection.go | 11 + ...del_privateendpointconnectionproperties.go | 10 + .../model_privateendpointproperty.go | 8 + ...ivatelinkserviceconnectionstateproperty.go | 10 + .../model_tagsobject.go | 8 + .../privateendpointconnections/predicates.go | 24 + .../privateendpointconnections/version.go | 12 + .../privateendpointconnection/README.md | 82 +++ .../privateendpointconnection/client.go | 18 + .../privateendpointconnection/constants.go | 43 ++ .../privateendpointconnection/id_account.go | 124 ++++ .../id_privateendpointconnection.go | 137 ++++ .../method_createorupdate_autorest.go | 79 +++ .../method_delete_autorest.go | 78 +++ .../method_get_autorest.go | 68 ++ .../method_listbyaccount_autorest.go | 186 +++++ .../model_privateendpoint.go | 8 + .../model_privateendpointconnection.go | 11 + ...del_privateendpointconnectionproperties.go | 10 + ...model_privatelinkserviceconnectionstate.go | 10 + .../privateendpointconnection/predicates.go | 24 + .../privateendpointconnection/version.go | 12 + .../privateendpointconnections/README.md | 90 +++ .../privateendpointconnections/client.go | 18 + .../privateendpointconnections/constants.go | 40 ++ .../id_privateendpointconnection.go | 137 ++++ .../id_searchservice.go | 124 ++++ .../method_delete_autorest.go | 97 +++ .../method_get_autorest.go | 97 +++ .../method_listbyservice_autorest.go | 215 ++++++ .../method_update_autorest.go | 98 +++ .../model_privateendpointconnection.go | 11 + ...del_privateendpointconnectionproperties.go | 9 + ...ointconnectionpropertiesprivateendpoint.go | 8 + ...ertiesprivatelinkserviceconnectionstate.go | 10 + .../privateendpointconnections/predicates.go | 24 + .../privateendpointconnections/version.go | 12 + vendor/modules.txt | 5 + ...pse_managed_private_endpoint.html.markdown | 4 + 98 files changed, 6170 insertions(+), 60 deletions(-) create mode 100644 internal/services/keyvault/parse/private_endpoint_connection.go create mode 100644 internal/services/keyvault/parse/private_endpoint_connection_test.go create mode 100644 internal/services/keyvault/validate/private_endpoint_connection_id.go create mode 100644 internal/services/keyvault/validate/private_endpoint_connection_id_test.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/id_account.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/id_privateendpointconnection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/model_privateendpoint.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/model_privateendpointconnection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/model_privateendpointconnectionlistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/model_privateendpointconnectionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/model_privatelinkserviceconnectionstate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/id_privateendpointconnection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/id_server.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/method_listbyserver_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/method_updatetags_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/model_privateendpointconnection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/model_privateendpointconnectionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/model_privateendpointproperty.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/model_privatelinkserviceconnectionstateproperty.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/model_tagsobject.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/id_privateendpointconnection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/id_server.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/method_listbyserver_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/method_updatetags_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/model_privateendpointconnection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/model_privateendpointconnectionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/model_privateendpointproperty.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/model_privatelinkserviceconnectionstateproperty.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/model_tagsobject.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/id_account.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/id_privateendpointconnection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/method_listbyaccount_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/model_privateendpoint.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/model_privateendpointconnection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/model_privateendpointconnectionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/model_privatelinkserviceconnectionstate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/id_privateendpointconnection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/id_searchservice.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/method_listbyservice_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/method_update_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/model_privateendpointconnection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/model_privateendpointconnectionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/model_privateendpointconnectionpropertiesprivateendpoint.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/model_privateendpointconnectionpropertiesprivatelinkserviceconnectionstate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/version.go diff --git a/internal/services/cognitive/client/client.go b/internal/services/cognitive/client/client.go index df1f15570556..196ebb88dbff 100644 --- a/internal/services/cognitive/client/client.go +++ b/internal/services/cognitive/client/client.go @@ -2,18 +2,24 @@ package client import ( "github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts" + "github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - AccountsClient *cognitiveservicesaccounts.CognitiveServicesAccountsClient + AccountsClient *cognitiveservicesaccounts.CognitiveServicesAccountsClient + PrivateEndpointConnectionsClient *privateendpointconnections.PrivateEndpointConnectionsClient } func NewClient(o *common.ClientOptions) *Client { accountsClient := cognitiveservicesaccounts.NewCognitiveServicesAccountsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&accountsClient.Client, o.ResourceManagerAuthorizer) + privateEndpointConnectionsClient := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&privateEndpointConnectionsClient.Client, o.ResourceManagerAuthorizer) + return &Client{ - AccountsClient: &accountsClient, + AccountsClient: &accountsClient, + PrivateEndpointConnectionsClient: &privateEndpointConnectionsClient, } } diff --git a/internal/services/cosmos/client/client.go b/internal/services/cosmos/client/client.go index 7496eadd0079..4618d6b975d0 100644 --- a/internal/services/cosmos/client/client.go +++ b/internal/services/cosmos/client/client.go @@ -15,6 +15,7 @@ type Client struct { GremlinClient *documentdb.GremlinResourcesClient MongoDbClient *documentdb.MongoDBResourcesClient NotebookWorkspaceClient *documentdb.NotebookWorkspacesClient + PrivateEndpointConnectionClient *documentdb.PrivateEndpointConnectionsClient RestorableDatabaseAccountsClient *documentdb.RestorableDatabaseAccountsClient SqlDedicatedGatewayClient *sqldedicatedgateway.SqlDedicatedGatewayClient SqlClient *documentdb.SQLResourcesClient @@ -44,6 +45,9 @@ func NewClient(o *common.ClientOptions) *Client { notebookWorkspaceClient := documentdb.NewNotebookWorkspacesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(¬ebookWorkspaceClient.Client, o.ResourceManagerAuthorizer) + privateEndpointConnectionClient := documentdb.NewPrivateEndpointConnectionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&privateEndpointConnectionClient.Client, o.ResourceManagerAuthorizer) + restorableDatabaseAccountsClient := documentdb.NewRestorableDatabaseAccountsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&restorableDatabaseAccountsClient.Client, o.ResourceManagerAuthorizer) @@ -67,6 +71,7 @@ func NewClient(o *common.ClientOptions) *Client { GremlinClient: &gremlinClient, MongoDbClient: &mongoDbClient, NotebookWorkspaceClient: ¬ebookWorkspaceClient, + PrivateEndpointConnectionClient: &privateEndpointConnectionClient, RestorableDatabaseAccountsClient: &restorableDatabaseAccountsClient, SqlDedicatedGatewayClient: &sqlDedicatedGatewayClient, SqlClient: &sqlClient, diff --git a/internal/services/keyvault/client/client.go b/internal/services/keyvault/client/client.go index c6ae1f2bceb2..67661cf1081a 100644 --- a/internal/services/keyvault/client/client.go +++ b/internal/services/keyvault/client/client.go @@ -7,10 +7,11 @@ import ( ) type Client struct { - ManagedHsmClient *keyvault.ManagedHsmsClient - ManagementClient *keyvaultmgmt.BaseClient - VaultsClient *keyvault.VaultsClient - options *common.ClientOptions + ManagedHsmClient *keyvault.ManagedHsmsClient + ManagementClient *keyvaultmgmt.BaseClient + PrivateEndpointConnectionsClient *keyvault.PrivateEndpointConnectionsClient + VaultsClient *keyvault.VaultsClient + options *common.ClientOptions } func NewClient(o *common.ClientOptions) *Client { @@ -20,14 +21,18 @@ func NewClient(o *common.ClientOptions) *Client { managementClient := keyvaultmgmt.New() o.ConfigureClient(&managementClient.Client, o.KeyVaultAuthorizer) + privateEndpointConnectionsClient := keyvault.NewPrivateEndpointConnectionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&privateEndpointConnectionsClient.Client, o.ResourceManagerAuthorizer) + vaultsClient := keyvault.NewVaultsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&vaultsClient.Client, o.ResourceManagerAuthorizer) return &Client{ - ManagedHsmClient: &managedHsmClient, - ManagementClient: &managementClient, - VaultsClient: &vaultsClient, - options: o, + ManagedHsmClient: &managedHsmClient, + ManagementClient: &managementClient, + PrivateEndpointConnectionsClient: &privateEndpointConnectionsClient, + VaultsClient: &vaultsClient, + options: o, } } diff --git a/internal/services/keyvault/parse/private_endpoint_connection.go b/internal/services/keyvault/parse/private_endpoint_connection.go new file mode 100644 index 000000000000..45cf0e090658 --- /dev/null +++ b/internal/services/keyvault/parse/private_endpoint_connection.go @@ -0,0 +1,75 @@ +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 PrivateEndpointConnectionId struct { + SubscriptionId string + ResourceGroup string + VaultName string + Name string +} + +func NewPrivateEndpointConnectionID(subscriptionId, resourceGroup, vaultName, name string) PrivateEndpointConnectionId { + return PrivateEndpointConnectionId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + VaultName: vaultName, + Name: name, + } +} + +func (id PrivateEndpointConnectionId) String() string { + segments := []string{ + fmt.Sprintf("Name %q", id.Name), + fmt.Sprintf("Vault Name %q", id.VaultName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Private Endpoint Connection", segmentsStr) +} + +func (id PrivateEndpointConnectionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.KeyVault/vaults/%s/privateEndpointConnections/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.VaultName, id.Name) +} + +// PrivateEndpointConnectionID parses a PrivateEndpointConnection ID into an PrivateEndpointConnectionId struct +func PrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := PrivateEndpointConnectionId{ + 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.VaultName, err = id.PopSegment("vaults"); err != nil { + return nil, err + } + if resourceId.Name, err = id.PopSegment("privateEndpointConnections"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/internal/services/keyvault/parse/private_endpoint_connection_test.go b/internal/services/keyvault/parse/private_endpoint_connection_test.go new file mode 100644 index 000000000000..74a346233478 --- /dev/null +++ b/internal/services/keyvault/parse/private_endpoint_connection_test.go @@ -0,0 +1,128 @@ +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 = PrivateEndpointConnectionId{} + +func TestPrivateEndpointConnectionIDFormatter(t *testing.T) { + actual := NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "resGroup1", "vault1", "privateEndpointConnection1").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.KeyVault/vaults/vault1/privateEndpointConnections/privateEndpointConnection1" + if actual != expected { + t.Fatalf("Expected %q but got %q", expected, actual) + } +} + +func TestPrivateEndpointConnectionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PrivateEndpointConnectionId + }{ + + { + // 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 VaultName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.KeyVault/", + Error: true, + }, + + { + // missing value for VaultName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.KeyVault/vaults/", + Error: true, + }, + + { + // missing Name + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.KeyVault/vaults/vault1/", + Error: true, + }, + + { + // missing value for Name + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.KeyVault/vaults/vault1/privateEndpointConnections/", + Error: true, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.KeyVault/vaults/vault1/privateEndpointConnections/privateEndpointConnection1", + Expected: &PrivateEndpointConnectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resGroup1", + VaultName: "vault1", + Name: "privateEndpointConnection1", + }, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.KEYVAULT/VAULTS/VAULT1/PRIVATEENDPOINTCONNECTIONS/PRIVATEENDPOINTCONNECTION1", + Error: true, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := PrivateEndpointConnectionID(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.VaultName != v.Expected.VaultName { + t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) + } + if actual.Name != v.Expected.Name { + t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) + } + } +} diff --git a/internal/services/keyvault/resourceids.go b/internal/services/keyvault/resourceids.go index b0d859a4cbb8..57f47242b166 100644 --- a/internal/services/keyvault/resourceids.go +++ b/internal/services/keyvault/resourceids.go @@ -2,6 +2,7 @@ package keyvault //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Vault -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.KeyVault/vaults/vault1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ManagedHSM -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.KeyVault/managedHSMs/hsm1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=PrivateEndpointConnection -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.KeyVault/vaults/vault1/privateEndpointConnections/privateEndpointConnection1 // KeyVault Access Policies are Terraform specific, but can be either an Object ID or an Application ID //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AccessPolicyApplication -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.KeyVault/vaults/vault1/objectId/object1/applicationId/application1 diff --git a/internal/services/keyvault/validate/private_endpoint_connection_id.go b/internal/services/keyvault/validate/private_endpoint_connection_id.go new file mode 100644 index 000000000000..f162f14df8b8 --- /dev/null +++ b/internal/services/keyvault/validate/private_endpoint_connection_id.go @@ -0,0 +1,23 @@ +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/keyvault/parse" +) + +func PrivateEndpointConnectionID(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.PrivateEndpointConnectionID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/internal/services/keyvault/validate/private_endpoint_connection_id_test.go b/internal/services/keyvault/validate/private_endpoint_connection_id_test.go new file mode 100644 index 000000000000..9ad4ba38dd61 --- /dev/null +++ b/internal/services/keyvault/validate/private_endpoint_connection_id_test.go @@ -0,0 +1,88 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import "testing" + +func TestPrivateEndpointConnectionID(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 VaultName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.KeyVault/", + Valid: false, + }, + + { + // missing value for VaultName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.KeyVault/vaults/", + Valid: false, + }, + + { + // missing Name + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.KeyVault/vaults/vault1/", + Valid: false, + }, + + { + // missing value for Name + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.KeyVault/vaults/vault1/privateEndpointConnections/", + Valid: false, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.KeyVault/vaults/vault1/privateEndpointConnections/privateEndpointConnection1", + Valid: true, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.KEYVAULT/VAULTS/VAULT1/PRIVATEENDPOINTCONNECTIONS/PRIVATEENDPOINTCONNECTION1", + Valid: false, + }, + } + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := PrivateEndpointConnectionID(tc.Input, "test") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t", tc.Valid, valid) + } + } +} diff --git a/internal/services/mariadb/client/client.go b/internal/services/mariadb/client/client.go index deba55b33098..f35643e02eb0 100644 --- a/internal/services/mariadb/client/client.go +++ b/internal/services/mariadb/client/client.go @@ -4,17 +4,19 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations" "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases" "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules" + "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections" "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers" "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - ConfigurationsClient *configurations.ConfigurationsClient - DatabasesClient *databases.DatabasesClient - FirewallRulesClient *firewallrules.FirewallRulesClient - ServersClient *servers.ServersClient - VirtualNetworkRulesClient *virtualnetworkrules.VirtualNetworkRulesClient + ConfigurationsClient *configurations.ConfigurationsClient + DatabasesClient *databases.DatabasesClient + FirewallRulesClient *firewallrules.FirewallRulesClient + PrivateEndpointConnectionClient *privateendpointconnections.PrivateEndpointConnectionsClient + ServersClient *servers.ServersClient + VirtualNetworkRulesClient *virtualnetworkrules.VirtualNetworkRulesClient } func NewClient(o *common.ClientOptions) *Client { @@ -27,6 +29,9 @@ func NewClient(o *common.ClientOptions) *Client { FirewallRulesClient := firewallrules.NewFirewallRulesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&FirewallRulesClient.Client, o.ResourceManagerAuthorizer) + PrivateEndpointConnectionClient := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&PrivateEndpointConnectionClient.Client, o.ResourceManagerAuthorizer) + ServersClient := servers.NewServersClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&ServersClient.Client, o.ResourceManagerAuthorizer) @@ -34,10 +39,11 @@ func NewClient(o *common.ClientOptions) *Client { o.ConfigureClient(&VirtualNetworkRulesClient.Client, o.ResourceManagerAuthorizer) return &Client{ - ConfigurationsClient: &configurationsClient, - DatabasesClient: &DatabasesClient, - FirewallRulesClient: &FirewallRulesClient, - ServersClient: &ServersClient, - VirtualNetworkRulesClient: &VirtualNetworkRulesClient, + ConfigurationsClient: &configurationsClient, + DatabasesClient: &DatabasesClient, + FirewallRulesClient: &FirewallRulesClient, + PrivateEndpointConnectionClient: &PrivateEndpointConnectionClient, + ServersClient: &ServersClient, + VirtualNetworkRulesClient: &VirtualNetworkRulesClient, } } diff --git a/internal/services/monitor/client/client.go b/internal/services/monitor/client/client.go index 5a85cdfa1d89..27e872f17bd2 100644 --- a/internal/services/monitor/client/client.go +++ b/internal/services/monitor/client/client.go @@ -37,6 +37,7 @@ type Client struct { DiagnosticSettingsCategoryClient *diagnosticCategoryClient.DiagnosticSettingsCategoriesClient LogProfilesClient *classic.LogProfilesClient MetricAlertsClient *classic.MetricAlertsClient + PrivateEndpointConnectionsClient *classic.PrivateEndpointConnectionsClient PrivateLinkScopesClient *classic.PrivateLinkScopesClient PrivateLinkScopedResourcesClient *classic.PrivateLinkScopedResourcesClient ScheduledQueryRulesClient *classic.ScheduledQueryRulesClient @@ -86,6 +87,9 @@ func NewClient(o *common.ClientOptions) *Client { MetricAlertsClient := classic.NewMetricAlertsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&MetricAlertsClient.Client, o.ResourceManagerAuthorizer) + PrivateEndpointConnectionsClient := classic.NewPrivateEndpointConnectionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&PrivateEndpointConnectionsClient.Client, o.ResourceManagerAuthorizer) + PrivateLinkScopesClient := classic.NewPrivateLinkScopesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&PrivateLinkScopesClient.Client, o.ResourceManagerAuthorizer) @@ -113,6 +117,7 @@ func NewClient(o *common.ClientOptions) *Client { DiagnosticSettingsCategoryClient: &DiagnosticSettingsCategoryClient, LogProfilesClient: &LogProfilesClient, MetricAlertsClient: &MetricAlertsClient, + PrivateEndpointConnectionsClient: &PrivateEndpointConnectionsClient, PrivateLinkScopesClient: &PrivateLinkScopesClient, PrivateLinkScopedResourcesClient: &PrivateLinkScopedResourcesClient, ScheduledQueryRulesClient: &ScheduledQueryRulesClient, diff --git a/internal/services/mysql/client/client.go b/internal/services/mysql/client/client.go index 8df03ed9ec0f..f350e290be8b 100644 --- a/internal/services/mysql/client/client.go +++ b/internal/services/mysql/client/client.go @@ -14,6 +14,7 @@ type Client struct { FlexibleServerConfigurationsClient *mysqlflexibleservers.ConfigurationsClient FlexibleServerClient *mysqlflexibleservers.ServersClient FlexibleServerFirewallRulesClient *mysqlflexibleservers.FirewallRulesClient + PrivateEndpointConnectionClient *mysql.PrivateEndpointConnectionsClient ServersClient *mysql.ServersClient ServerKeysClient *mysql.ServerKeysClient ServerSecurityAlertPoliciesClient *mysql.ServerSecurityAlertPoliciesClient @@ -43,6 +44,9 @@ func NewClient(o *common.ClientOptions) *Client { flexibleServerConfigurationsClient := mysqlflexibleservers.NewConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&flexibleServerConfigurationsClient.Client, o.ResourceManagerAuthorizer) + privateEndpointConnectionClient := mysql.NewPrivateEndpointConnectionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&privateEndpointConnectionClient.Client, o.ResourceManagerAuthorizer) + ServersClient := mysql.NewServersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&ServersClient.Client, o.ResourceManagerAuthorizer) @@ -66,6 +70,7 @@ func NewClient(o *common.ClientOptions) *Client { FlexibleServerClient: &flexibleServerClient, FlexibleServerFirewallRulesClient: &flexibleServerFirewallRulesClient, FlexibleServerConfigurationsClient: &flexibleServerConfigurationsClient, + PrivateEndpointConnectionClient: &privateEndpointConnectionClient, ServersClient: &ServersClient, ServerKeysClient: &ServerKeysClient, ServerSecurityAlertPoliciesClient: &serverSecurityAlertPoliciesClient, diff --git a/internal/services/postgres/client/client.go b/internal/services/postgres/client/client.go index c90a0be97a1b..b03f608ad9e1 100644 --- a/internal/services/postgres/client/client.go +++ b/internal/services/postgres/client/client.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers" "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies" "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections" "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys" flexibleserverconfigurations "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations" flexibleserverdatabases "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases" @@ -26,6 +27,7 @@ type Client struct { FlexibleServersConfigurationsClient *flexibleserverconfigurations.ConfigurationsClient FlexibleServerFirewallRuleClient *flexibleserverfirewallrules.FirewallRulesClient FlexibleServerDatabaseClient *flexibleserverdatabases.DatabasesClient + PrivateEndpointConnectionClient *privateendpointconnections.PrivateEndpointConnectionsClient ServersClient *servers.ServersClient ServerRestartClient *serverrestart.ServerRestartClient ServerKeysClient *serverkeys.ServerKeysClient @@ -45,6 +47,9 @@ func NewClient(o *common.ClientOptions) *Client { firewallRulesClient := firewallrules.NewFirewallRulesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&firewallRulesClient.Client, o.ResourceManagerAuthorizer) + privateEndpointConnectionClient := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&privateEndpointConnectionClient.Client, o.ResourceManagerAuthorizer) + serversClient := servers.NewServersClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&serversClient.Client, o.ResourceManagerAuthorizer) @@ -87,6 +92,7 @@ func NewClient(o *common.ClientOptions) *Client { ServerRestartClient: &restartServerClient, FlexibleServerFirewallRuleClient: &flexibleServerFirewallRuleClient, FlexibleServerDatabaseClient: &flexibleServerDatabaseClient, + PrivateEndpointConnectionClient: &privateEndpointConnectionClient, ServersClient: &serversClient, ServerKeysClient: &serverKeysClient, ServerSecurityAlertPoliciesClient: &serverSecurityAlertPoliciesClient, diff --git a/internal/services/purview/client/client.go b/internal/services/purview/client/client.go index 34b1964caae5..a9ead98a86d8 100644 --- a/internal/services/purview/client/client.go +++ b/internal/services/purview/client/client.go @@ -2,18 +2,24 @@ package client import ( "github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account" + "github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - AccountsClient *account.AccountClient + AccountsClient *account.AccountClient + PrivateEndpointConnectionsClient *privateendpointconnection.PrivateEndpointConnectionClient } func NewClient(o *common.ClientOptions) *Client { accountsClient := account.NewAccountClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&accountsClient.Client, o.ResourceManagerAuthorizer) + privateEndpointConnectionsClient := privateendpointconnection.NewPrivateEndpointConnectionClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&privateEndpointConnectionsClient.Client, o.ResourceManagerAuthorizer) + return &Client{ - AccountsClient: &accountsClient, + AccountsClient: &accountsClient, + PrivateEndpointConnectionsClient: &privateEndpointConnectionsClient, } } diff --git a/internal/services/search/client/client.go b/internal/services/search/client/client.go index 324f7a2ea1ce..53e68b04ef9e 100644 --- a/internal/services/search/client/client.go +++ b/internal/services/search/client/client.go @@ -2,6 +2,7 @@ package client import ( "github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys" + "github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections" "github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys" "github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services" "github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-08-01/sharedprivatelinkresources" @@ -10,6 +11,7 @@ import ( type Client struct { AdminKeysClient *adminkeys.AdminKeysClient + PrivateEndpointConnectionsClient *privateendpointconnections.PrivateEndpointConnectionsClient QueryKeysClient *querykeys.QueryKeysClient ServicesClient *services.ServicesClient SearchSharedPrivateLinkResourceClient *sharedprivatelinkresources.SharedPrivateLinkResourcesClient @@ -19,6 +21,9 @@ func NewClient(o *common.ClientOptions) *Client { adminKeysClient := adminkeys.NewAdminKeysClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&adminKeysClient.Client, o.ResourceManagerAuthorizer) + privateEndpointConnectionsClient := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&privateEndpointConnectionsClient.Client, o.ResourceManagerAuthorizer) + queryKeysClient := querykeys.NewQueryKeysClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&queryKeysClient.Client, o.ResourceManagerAuthorizer) @@ -30,6 +35,7 @@ func NewClient(o *common.ClientOptions) *Client { return &Client{ AdminKeysClient: &adminKeysClient, + PrivateEndpointConnectionsClient: &privateEndpointConnectionsClient, QueryKeysClient: &queryKeysClient, ServicesClient: &servicesClient, SearchSharedPrivateLinkResourceClient: &searchSharedPrivateLinkResourceClient, diff --git a/internal/services/sql/client/client.go b/internal/services/sql/client/client.go index 67c0344d4bdf..209e0ed251de 100644 --- a/internal/services/sql/client/client.go +++ b/internal/services/sql/client/client.go @@ -19,6 +19,7 @@ type Client struct { ManagedInstanceAdministratorsClient *sqlv5.ManagedInstanceAdministratorsClient ManagedInstanceAzureADOnlyAuthenticationsClient *sqlv5.ManagedInstanceAzureADOnlyAuthenticationsClient ManagedDatabasesClient *msi.ManagedDatabasesClient + PrivateEndpointConnectionsClient *msi.PrivateEndpointConnectionsClient ServersClient *sql.ServersClient ServerExtendedBlobAuditingPoliciesClient *sql.ExtendedServerBlobAuditingPoliciesClient ServerConnectionPoliciesClient *sql.ServerConnectionPoliciesClient @@ -63,6 +64,9 @@ func NewClient(o *common.ClientOptions) *Client { managedDatabasesClient := msi.NewManagedDatabasesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&managedDatabasesClient.Client, o.ResourceManagerAuthorizer) + privateEndpointConnectionsClient := msi.NewPrivateEndpointConnectionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&privateEndpointConnectionsClient.Client, o.ResourceManagerAuthorizer) + serversClient := sql.NewServersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&serversClient.Client, o.ResourceManagerAuthorizer) @@ -96,6 +100,7 @@ func NewClient(o *common.ClientOptions) *Client { ManagedInstanceAdministratorsClient: &managedInstanceAdministratorsClient, ManagedInstanceAzureADOnlyAuthenticationsClient: &managedInstanceAzureADOnlyAuthenticationsClient, ManagedDatabasesClient: &managedDatabasesClient, + PrivateEndpointConnectionsClient: &privateEndpointConnectionsClient, ServersClient: &serversClient, ServerAzureADAdministratorsClient: &serverAzureADAdministratorsClient, ServerAzureADOnlyAuthenticationsClient: &serverAzureADOnlyAuthenticationsClient, diff --git a/internal/services/storage/client/client.go b/internal/services/storage/client/client.go index 3f6dc1991646..575ff5df5b8f 100644 --- a/internal/services/storage/client/client.go +++ b/internal/services/storage/client/client.go @@ -25,20 +25,21 @@ import ( ) type Client struct { - AccountsClient *storage.AccountsClient - FileSystemsClient *filesystems.Client - ADLSGen2PathsClient *paths.Client - ManagementPoliciesClient *storage.ManagementPoliciesClient - BlobServicesClient *storage.BlobServicesClient - BlobInventoryPoliciesClient *storage.BlobInventoryPoliciesClient - CloudEndpointsClient *storagesync.CloudEndpointsClient - EncryptionScopesClient *storage.EncryptionScopesClient - Environment azure.Environment - FileServicesClient *storage.FileServicesClient - ObjectReplicationClient *objectreplicationpolicies.ObjectReplicationPoliciesClient - SyncServiceClient *storagesync.ServicesClient - SyncGroupsClient *storagesync.SyncGroupsClient - SubscriptionId string + AccountsClient *storage.AccountsClient + FileSystemsClient *filesystems.Client + ADLSGen2PathsClient *paths.Client + ManagementPoliciesClient *storage.ManagementPoliciesClient + BlobServicesClient *storage.BlobServicesClient + BlobInventoryPoliciesClient *storage.BlobInventoryPoliciesClient + CloudEndpointsClient *storagesync.CloudEndpointsClient + EncryptionScopesClient *storage.EncryptionScopesClient + Environment azure.Environment + FileServicesClient *storage.FileServicesClient + ObjectReplicationClient *objectreplicationpolicies.ObjectReplicationPoliciesClient + PrivateEndpointConnectionClient *storage.PrivateEndpointConnectionsClient + SyncServiceClient *storagesync.ServicesClient + SyncGroupsClient *storagesync.SyncGroupsClient + SubscriptionId string resourceManagerAuthorizer autorest.Authorizer storageAdAuth *autorest.Authorizer @@ -75,6 +76,9 @@ func NewClient(options *common.ClientOptions) *Client { objectReplicationPolicyClient := objectreplicationpolicies.NewObjectReplicationPoliciesClientWithBaseURI(options.ResourceManagerEndpoint) options.ConfigureClient(&objectReplicationPolicyClient.Client, options.ResourceManagerAuthorizer) + privateEndpointConnectionClient := storage.NewPrivateEndpointConnectionsClientWithBaseURI(options.ResourceManagerEndpoint, options.SubscriptionId) + options.ConfigureClient(&privateEndpointConnectionClient.Client, options.ResourceManagerAuthorizer) + syncServiceClient := storagesync.NewServicesClientWithBaseURI(options.ResourceManagerEndpoint, options.SubscriptionId) options.ConfigureClient(&syncServiceClient.Client, options.ResourceManagerAuthorizer) @@ -84,20 +88,21 @@ func NewClient(options *common.ClientOptions) *Client { // TODO: switch Storage Containers to using the storage.BlobContainersClient // (which should fix #2977) when the storage clients have been moved in here client := Client{ - AccountsClient: &accountsClient, - FileSystemsClient: &fileSystemsClient, - ADLSGen2PathsClient: &adlsGen2PathsClient, - ManagementPoliciesClient: &managementPoliciesClient, - BlobServicesClient: &blobServicesClient, - BlobInventoryPoliciesClient: &blobInventoryPoliciesClient, - CloudEndpointsClient: &cloudEndpointsClient, - EncryptionScopesClient: &encryptionScopesClient, - Environment: options.Environment, - FileServicesClient: &fileServicesClient, - ObjectReplicationClient: &objectReplicationPolicyClient, - SubscriptionId: options.SubscriptionId, - SyncServiceClient: &syncServiceClient, - SyncGroupsClient: &syncGroupsClient, + AccountsClient: &accountsClient, + FileSystemsClient: &fileSystemsClient, + ADLSGen2PathsClient: &adlsGen2PathsClient, + ManagementPoliciesClient: &managementPoliciesClient, + BlobServicesClient: &blobServicesClient, + BlobInventoryPoliciesClient: &blobInventoryPoliciesClient, + CloudEndpointsClient: &cloudEndpointsClient, + EncryptionScopesClient: &encryptionScopesClient, + Environment: options.Environment, + FileServicesClient: &fileServicesClient, + ObjectReplicationClient: &objectReplicationPolicyClient, + PrivateEndpointConnectionClient: &privateEndpointConnectionClient, + SubscriptionId: options.SubscriptionId, + SyncServiceClient: &syncServiceClient, + SyncGroupsClient: &syncGroupsClient, resourceManagerAuthorizer: options.ResourceManagerAuthorizer, } diff --git a/internal/services/synapse/client/client.go b/internal/services/synapse/client/client.go index 811f24a35c10..6aaf72e4c2f3 100644 --- a/internal/services/synapse/client/client.go +++ b/internal/services/synapse/client/client.go @@ -16,6 +16,7 @@ type Client struct { IntegrationRuntimeAuthKeysClient *synapse.IntegrationRuntimeAuthKeysClient IntegrationRuntimesClient *synapse.IntegrationRuntimesClient KeysClient *synapse.KeysClient + PrivateEndpointConnectionClient *synapse.PrivateEndpointConnectionsClient PrivateLinkHubsClient *synapse.PrivateLinkHubsClient SparkPoolClient *synapse.BigDataPoolsClient SqlPoolClient *synapse.SQLPoolsClient @@ -50,6 +51,9 @@ func NewClient(o *common.ClientOptions) *Client { keysClient := synapse.NewKeysClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&keysClient.Client, o.ResourceManagerAuthorizer) + privateEndpointConnectionClient := synapse.NewPrivateEndpointConnectionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&privateEndpointConnectionClient.Client, o.ResourceManagerAuthorizer) + privateLinkHubsClient := synapse.NewPrivateLinkHubsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&privateLinkHubsClient.Client, o.ResourceManagerAuthorizer) @@ -107,6 +111,7 @@ func NewClient(o *common.ClientOptions) *Client { IntegrationRuntimeAuthKeysClient: &integrationRuntimeAuthKeysClient, IntegrationRuntimesClient: &integrationRuntimesClient, KeysClient: &keysClient, + PrivateEndpointConnectionClient: &privateEndpointConnectionClient, PrivateLinkHubsClient: &privateLinkHubsClient, SparkPoolClient: &sparkPoolClient, SqlPoolClient: &sqlPoolClient, diff --git a/internal/services/synapse/synapse_managed_private_endpoint_resource.go b/internal/services/synapse/synapse_managed_private_endpoint_resource.go index 9817729e4bf5..da6b9d41c156 100644 --- a/internal/services/synapse/synapse_managed_private_endpoint_resource.go +++ b/internal/services/synapse/synapse_managed_private_endpoint_resource.go @@ -6,12 +6,30 @@ import ( "log" "time" + "github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2021-10-15/documentdb" + "github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2021-10-01/keyvault" + "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql" + "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2018-06-01-preview/sql" "github.com/Azure/azure-sdk-for-go/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork" + "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage" "github.com/Azure/azure-sdk-for-go/services/synapse/mgmt/2021-03-01/synapse" + cognitive "github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections" + mariadb "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections" + mariadbServers "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers" + postgresqlServers "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers" + postgresql "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections" + purview "github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection" + search "github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + cosmosParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/parse" + keyvaultParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" + mysqlParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" + networkParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" + sqlParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/parse" + storageParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -20,6 +38,8 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/utils" ) +const approvalDescription = "Auto-approved by Terraform" + func resourceSynapseManagedPrivateEndpoint() *pluginsdk.Resource { return &pluginsdk.Resource{ Create: resourceSynapseManagedPrivateEndpointCreate, @@ -65,6 +85,13 @@ func resourceSynapseManagedPrivateEndpoint() *pluginsdk.Resource { ForceNew: true, ValidateFunc: networkValidate.PrivateLinkSubResourceName, }, + + "is_manual_connection": { + Type: pluginsdk.TypeBool, + Optional: true, + Computed: true, + ForceNew: true, + }, }, } } @@ -81,6 +108,12 @@ func resourceSynapseManagedPrivateEndpointCreate(d *pluginsdk.ResourceData, meta return err } + targetResourceIdRaw := d.Get("target_resource_id").(string) + targetResourceId, err := azure.ParseAzureResourceID(targetResourceIdRaw) + if err != nil { + return err + } + workspace, err := workspaceClient.Get(ctx, workspaceId.ResourceGroup, workspaceId.Name) if err != nil { return fmt.Errorf("retrieving %s: %+v", *workspaceId, err) @@ -109,7 +142,7 @@ func resourceSynapseManagedPrivateEndpointCreate(d *pluginsdk.ResourceData, meta managedPrivateEndpoint := managedvirtualnetwork.ManagedPrivateEndpoint{ Properties: &managedvirtualnetwork.ManagedPrivateEndpointProperties{ - PrivateLinkResourceID: utils.String(d.Get("target_resource_id").(string)), + PrivateLinkResourceID: utils.String(targetResourceIdRaw), GroupID: utils.String(d.Get("subresource_name").(string)), }, } @@ -135,6 +168,46 @@ func resourceSynapseManagedPrivateEndpointCreate(d *pluginsdk.ResourceData, meta return fmt.Errorf("waiting for provisioning state of %s: %+v", id, err) } + isManualConnection, ok := d.GetOk("is_manual_connection") + if ok && !isManualConnection.(bool) { + privateEndpointName := fmt.Sprintf("%s.%s", id.WorkspaceName, id.Name) + + autoApprovalFunctionMap := map[string]func(ctx context.Context, meta interface{}, id parse.ManagedPrivateEndpointId, resourceId, privateEndpointName string) error{ + "Microsoft.CognitiveServices": approveManagedPrivateEndpointForCognitive, + "Microsoft.DBforMariaDB": approveManagedPrivateEndpointForMariaDB, + "Microsoft.DBforMySQL": approveManagedPrivateEndpointForMySQL, + "Microsoft.DBforPostgreSQL": approveManagedPrivateEndpointForPostgreSQL, + "Microsoft.DocumentDB": approveManagedPrivateEndpointForCosmos, + "Microsoft.KeyVault": approveManagedPrivateEndpointForKeyVault, + "Microsoft.Purview": approveManagedPrivateEndpointForPurview, + "Microsoft.Search": approveManagedPrivateEndpointForSearch, + "Microsoft.Sql": approveManagedPrivateEndpointForSQL, + "Microsoft.Storage": approveManagedPrivateEndpointForStorage, + "Microsoft.Synapse": approveManagedPrivateEndpointForSynapse, + } + + autoApprovalFunction, ok := autoApprovalFunctionMap[targetResourceId.Provider] + if !ok { + return fmt.Errorf("auto-approving %s: `%s` is not a supported provider", id, targetResourceId.Provider) + } + + err = autoApprovalFunction(ctx, meta, id, targetResourceIdRaw, privateEndpointName) + if err != nil { + return err + } + + stateConf := &pluginsdk.StateChangeConf{ + Pending: []string{"Pending"}, + Target: []string{"Approved"}, + Refresh: managedPrivateEndpointConnectionStateStatusRefreshFunc(ctx, client, id), + Timeout: time.Until(timeout), + PollInterval: 15 * time.Second, + } + if _, err = stateConf.WaitForStateContext(ctx); err != nil { + return fmt.Errorf("waiting for connection state status of %s: %+v", id, err) + } + } + d.SetId(id.ID()) return resourceSynapseManagedPrivateEndpointRead(d, meta) } @@ -173,6 +246,10 @@ func resourceSynapseManagedPrivateEndpointRead(d *pluginsdk.ResourceData, meta i d.Set("target_resource_id", props.PrivateLinkResourceID) d.Set("subresource_name", props.GroupID) } + + isManualConnection, ok := d.GetOk("is_manual_connection") + d.Set("is_manual_connection", !ok || isManualConnection.(bool)) + return nil } @@ -213,3 +290,581 @@ func managedPrivateEndpointProvisioningStateRefreshFunc(ctx context.Context, cli return resp, *resp.Properties.ProvisioningState, nil } } + +func managedPrivateEndpointConnectionStateStatusRefreshFunc(ctx context.Context, client *managedvirtualnetwork.ManagedPrivateEndpointsClient, id parse.ManagedPrivateEndpointId) pluginsdk.StateRefreshFunc { + return func() (interface{}, string, error) { + resp, err := client.Get(ctx, id.ManagedVirtualNetworkName, id.Name) + if err != nil { + return nil, "", fmt.Errorf("polling for %s: %+v", id, err) + } + + if resp.Properties == nil || resp.Properties.ConnectionState == nil || resp.Properties.ConnectionState.Status == nil { + return resp, "", fmt.Errorf("nil Status returned for connection state of %s", id) + } + + return resp, *resp.Properties.ConnectionState.Status, nil + } +} + +func approveManagedPrivateEndpointForCognitive(ctx context.Context, meta interface{}, id parse.ManagedPrivateEndpointId, resourceId, privateEndpointName string) error { + client := meta.(*clients.Client).Cognitive.PrivateEndpointConnectionsClient + + targetResourceId, err := cognitive.ParseAccountID(resourceId) + if err != nil { + return err + } + + result, err := client.List(ctx, *targetResourceId) + if err != nil { + return err + } + + var privateEndpointConnectionId *string + for _, val := range *result.Model.Value { + if val.Properties == nil || val.Properties.PrivateEndpoint == nil || val.Properties.PrivateEndpoint.Id == nil { + continue + } + privateEndpointId, err := networkParse.PrivateEndpointID(*val.Properties.PrivateEndpoint.Id) + if err != nil { + continue + } + if privateEndpointName == privateEndpointId.Name { + privateEndpointConnectionId = val.Id + break + } + } + if privateEndpointConnectionId == nil { + return fmt.Errorf("finding private endpoint connection ID for %s: %+v", id, err) + } + + parsedPrivateEndpointConnectionId, err := cognitive.ParsePrivateEndpointConnectionID(*privateEndpointConnectionId) + if err != nil { + return err + } + + approvedStatus := cognitive.PrivateEndpointServiceConnectionStatusApproved + input := cognitive.PrivateEndpointConnection{ + Properties: &cognitive.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: cognitive.PrivateLinkServiceConnectionState{ + Status: &approvedStatus, + Description: utils.String(approvalDescription), + }, + }, + } + err = client.CreateOrUpdateThenPoll(ctx, *parsedPrivateEndpointConnectionId, input) + if err != nil { + return fmt.Errorf("approving %s: %+v", id, err) + } + + return nil +} + +func approveManagedPrivateEndpointForCosmos(ctx context.Context, meta interface{}, id parse.ManagedPrivateEndpointId, resourceId, privateEndpointName string) error { + client := meta.(*clients.Client).Cosmos.PrivateEndpointConnectionClient + + targetResourceId, err := cosmosParse.DatabaseAccountID(resourceId) + if err != nil { + return err + } + + result, err := client.ListByDatabaseAccount(ctx, targetResourceId.ResourceGroup, targetResourceId.Name) + if err != nil { + return err + } + + var privateEndpointConnectionName *string + for _, val := range *result.Value { + if val.PrivateEndpoint == nil || val.PrivateEndpoint.ID == nil { + continue + } + privateEndpointId, err := networkParse.PrivateEndpointID(*val.PrivateEndpoint.ID) + if err != nil { + continue + } + if privateEndpointName == privateEndpointId.Name { + privateEndpointConnectionName = val.Name + break + } + } + if privateEndpointConnectionName == nil { + return fmt.Errorf("finding private endpoint connection name for %s: %+v", id, err) + } + + parameters := documentdb.PrivateEndpointConnection{ + PrivateEndpointConnectionProperties: &documentdb.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &documentdb.PrivateLinkServiceConnectionStateProperty{ + Status: utils.String("Approved"), + Description: utils.String(approvalDescription), + }, + }, + } + future, err := client.CreateOrUpdate(ctx, targetResourceId.ResourceGroup, targetResourceId.Name, *privateEndpointConnectionName, parameters) + if err != nil { + return fmt.Errorf("approving %s: %+v", id, err) + } + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for approval of %s: %+v", id, err) + } + + return nil +} + +func approveManagedPrivateEndpointForKeyVault(ctx context.Context, meta interface{}, id parse.ManagedPrivateEndpointId, resourceId, privateEndpointName string) error { + client := meta.(*clients.Client).KeyVault.PrivateEndpointConnectionsClient + vaultsClient := meta.(*clients.Client).KeyVault.VaultsClient + + targetResourceId, err := keyvaultParse.VaultID(resourceId) + if err != nil { + return err + } + + targetResource, err := vaultsClient.Get(ctx, targetResourceId.ResourceGroup, targetResourceId.Name) + if err != nil { + return err + } + + var privateEndpointConnectionId *string + for _, val := range *targetResource.Properties.PrivateEndpointConnections { + if val.PrivateEndpoint == nil || val.PrivateEndpoint.ID == nil { + continue + } + privateEndpointId, err := networkParse.PrivateEndpointID(*val.PrivateEndpoint.ID) + if err != nil { + continue + } + + if privateEndpointName == privateEndpointId.Name { + privateEndpointConnectionId = val.ID + break + } + } + if privateEndpointConnectionId == nil { + return fmt.Errorf("finding private endpoint connection ID for %s: %+v", id, err) + } + + parsedPrivateEndpointConnectionId, err := keyvaultParse.PrivateEndpointConnectionID(*privateEndpointConnectionId) + if err != nil { + return err + } + + parameters := keyvault.PrivateEndpointConnection{ + PrivateEndpointConnectionProperties: &keyvault.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &keyvault.PrivateLinkServiceConnectionState{ + Status: keyvault.PrivateEndpointServiceConnectionStatusApproved, + Description: utils.String(approvalDescription), + }, + }, + } + _, err = client.Put(ctx, targetResourceId.ResourceGroup, targetResourceId.Name, parsedPrivateEndpointConnectionId.Name, parameters) + if err != nil { + return fmt.Errorf("approving %s: %+v", id, err) + } + + return nil +} + +func approveManagedPrivateEndpointForPurview(ctx context.Context, meta interface{}, id parse.ManagedPrivateEndpointId, resourceId, privateEndpointName string) error { + client := meta.(*clients.Client).Purview.PrivateEndpointConnectionsClient + + targetResourceId, err := purview.ParseAccountID(resourceId) + if err != nil { + return err + } + + result, err := client.ListByAccount(ctx, *targetResourceId) + if err != nil { + return err + } + + var privateEndpointConnectionId *string + for _, val := range *result.Model { + if val.Properties == nil || val.Properties.PrivateEndpoint == nil || val.Properties.PrivateEndpoint.Id == nil { + continue + } + privateEndpointId, err := networkParse.PrivateEndpointID(*val.Properties.PrivateEndpoint.Id) + if err != nil { + continue + } + if privateEndpointName == privateEndpointId.Name { + privateEndpointConnectionId = val.Id + break + } + } + if privateEndpointConnectionId == nil { + return fmt.Errorf("finding private endpoint connection ID for %s: %+v", id, err) + } + + parsedPrivateEndpointConnectionId, err := purview.ParsePrivateEndpointConnectionID(*privateEndpointConnectionId) + if err != nil { + return err + } + + approvedStatus := purview.StatusApproved + input := purview.PrivateEndpointConnection{ + Properties: &purview.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &purview.PrivateLinkServiceConnectionState{ + Status: &approvedStatus, + Description: utils.String(approvalDescription), + }, + }, + } + err = client.CreateOrUpdateThenPoll(ctx, *parsedPrivateEndpointConnectionId, input) + if err != nil { + return fmt.Errorf("approving %s: %+v", id, err) + } + + return nil +} + +func approveManagedPrivateEndpointForMariaDB(ctx context.Context, meta interface{}, id parse.ManagedPrivateEndpointId, resourceId, privateEndpointName string) error { + client := meta.(*clients.Client).MariaDB.PrivateEndpointConnectionClient + + targetResourceId, err := mariadb.ParseServerID(resourceId) + if err != nil { + return err + } + + result, err := client.ListByServer(ctx, *targetResourceId) + if err != nil { + return err + } + + var privateEndpointConnectionId *string + for _, val := range *result.Model { + if val.Properties == nil || val.Properties.PrivateEndpoint == nil || val.Properties.PrivateEndpoint.Id == nil { + continue + } + privateEndpointId, err := networkParse.PrivateEndpointID(*val.Properties.PrivateEndpoint.Id) + if err != nil { + continue + } + if privateEndpointName == privateEndpointId.Name { + privateEndpointConnectionId = val.Id + break + } + } + if privateEndpointConnectionId == nil { + return fmt.Errorf("finding private endpoint connection ID for %s: %+v", id, err) + } + + parsedPrivateEndpointConnectionId, err := mariadb.ParsePrivateEndpointConnectionID(*privateEndpointConnectionId) + if err != nil { + return err + } + + input := mariadb.PrivateEndpointConnection{ + Properties: &mariadb.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &mariadb.PrivateLinkServiceConnectionStateProperty{ + Status: string(mariadbServers.PrivateLinkServiceConnectionStateStatusApproved), + Description: approvalDescription, + }, + }, + } + err = client.CreateOrUpdateThenPoll(ctx, *parsedPrivateEndpointConnectionId, input) + if err != nil { + return fmt.Errorf("approving %s: %+v", id, err) + } + return nil +} + +func approveManagedPrivateEndpointForMySQL(ctx context.Context, meta interface{}, id parse.ManagedPrivateEndpointId, resourceId, privateEndpointName string) error { + client := meta.(*clients.Client).MySQL.PrivateEndpointConnectionClient + + targetResourceId, err := mysqlParse.ServerID(resourceId) + if err != nil { + return err + } + + result, err := client.ListByServer(ctx, targetResourceId.ResourceGroup, targetResourceId.Name) + if err != nil { + return err + } + + var privateEndpointConnectionName *string + for _, val := range result.Values() { + if val.PrivateEndpoint == nil || val.PrivateEndpoint.ID == nil { + continue + } + privateEndpointId, err := networkParse.PrivateEndpointID(*val.PrivateEndpoint.ID) + if err != nil { + continue + } + if privateEndpointName == privateEndpointId.Name { + privateEndpointConnectionName = val.Name + break + } + } + if privateEndpointConnectionName == nil { + return fmt.Errorf("finding private endpoint connection name for %s: %+v", id, err) + } + + parameters := mysql.PrivateEndpointConnection{ + PrivateEndpointConnectionProperties: &mysql.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &mysql.PrivateLinkServiceConnectionStateProperty{ + Status: utils.String(string(mysql.Approved)), + Description: utils.String(approvalDescription), + }, + }, + } + future, err := client.CreateOrUpdate(ctx, targetResourceId.ResourceGroup, targetResourceId.Name, *privateEndpointConnectionName, parameters) + if err != nil { + return fmt.Errorf("approving %s: %+v", id, err) + } + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for approval of %s: %+v", id, err) + } + + return nil +} + +func approveManagedPrivateEndpointForPostgreSQL(ctx context.Context, meta interface{}, id parse.ManagedPrivateEndpointId, resourceId, privateEndpointName string) error { + client := meta.(*clients.Client).Postgres.PrivateEndpointConnectionClient + + targetResourceId, err := postgresql.ParseServerID(resourceId) + if err != nil { + return err + } + + result, err := client.ListByServer(ctx, *targetResourceId) + if err != nil { + return err + } + + var privateEndpointConnectionId *string + for _, val := range *result.Model { + if val.Properties == nil || val.Properties.PrivateEndpoint == nil || val.Properties.PrivateEndpoint.Id == nil { + continue + } + privateEndpointId, err := networkParse.PrivateEndpointID(*val.Properties.PrivateEndpoint.Id) + if err != nil { + continue + } + if privateEndpointName == privateEndpointId.Name { + privateEndpointConnectionId = val.Id + break + } + } + if privateEndpointConnectionId == nil { + return fmt.Errorf("finding private endpoint connection ID for %s: %+v", id, err) + } + + parsedPrivateEndpointConnectionId, err := postgresql.ParsePrivateEndpointConnectionID(*privateEndpointConnectionId) + if err != nil { + return err + } + + input := postgresql.PrivateEndpointConnection{ + Properties: &postgresql.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &postgresql.PrivateLinkServiceConnectionStateProperty{ + Status: string(postgresqlServers.PrivateLinkServiceConnectionStateStatusApproved), + Description: approvalDescription, + }, + }, + } + err = client.CreateOrUpdateThenPoll(ctx, *parsedPrivateEndpointConnectionId, input) + if err != nil { + return fmt.Errorf("approving %s: %+v", id, err) + } + + return nil +} + +func approveManagedPrivateEndpointForSearch(ctx context.Context, meta interface{}, id parse.ManagedPrivateEndpointId, resourceId, privateEndpointName string) error { + client := meta.(*clients.Client).Search.PrivateEndpointConnectionsClient + + targetResourceId, err := search.ParseSearchServiceID(resourceId) + if err != nil { + return err + } + + result, err := client.ListByService(ctx, *targetResourceId, search.DefaultListByServiceOperationOptions()) + if err != nil { + return err + } + + var privateEndpointConnectionId *string + for _, val := range *result.Model { + if val.Properties == nil || val.Properties.PrivateEndpoint == nil || val.Properties.PrivateEndpoint.Id == nil { + continue + } + privateEndpointId, err := networkParse.PrivateEndpointID(*val.Properties.PrivateEndpoint.Id) + if err != nil { + continue + } + if privateEndpointName == privateEndpointId.Name { + privateEndpointConnectionId = val.Id + break + } + } + if privateEndpointConnectionId == nil { + return fmt.Errorf("finding private endpoint connection ID for %s: %+v", id, err) + } + + parsedPrivateEndpointConnectionId, err := search.ParsePrivateEndpointConnectionID(*privateEndpointConnectionId) + if err != nil { + return err + } + + approvedStatus := search.PrivateLinkServiceConnectionStatusApproved + privateEndpointConnection := search.PrivateEndpointConnection{ + Properties: &search.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &search.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState{ + Status: &approvedStatus, + Description: utils.String(approvalDescription), + }, + }, + } + _, err = client.Update(ctx, *parsedPrivateEndpointConnectionId, privateEndpointConnection, search.DefaultUpdateOperationOptions()) + if err != nil { + return fmt.Errorf("approving %s: %+v", id, err) + } + + return nil +} + +func approveManagedPrivateEndpointForSQL(ctx context.Context, meta interface{}, id parse.ManagedPrivateEndpointId, resourceId, privateEndpointName string) error { + client := meta.(*clients.Client).Sql.PrivateEndpointConnectionsClient + + targetResourceId, err := sqlParse.ServerID(resourceId) + if err != nil { + return err + } + + result, err := client.ListByServer(ctx, targetResourceId.ResourceGroup, targetResourceId.Name) + if err != nil { + return err + } + + var privateEndpointConnectionName *string + for _, val := range result.Values() { + if val.PrivateEndpoint == nil || val.PrivateEndpoint.ID == nil { + continue + } + privateEndpointId, err := networkParse.PrivateEndpointID(*val.PrivateEndpoint.ID) + if err != nil { + continue + } + if privateEndpointName == privateEndpointId.Name { + privateEndpointConnectionName = val.Name + break + } + } + if privateEndpointConnectionName == nil { + return fmt.Errorf("finding private endpoint connection name for %s: %+v", id, err) + } + + parameters := sql.PrivateEndpointConnection{ + PrivateEndpointConnectionProperties: &sql.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &sql.PrivateLinkServiceConnectionStateProperty{ + Status: utils.String("Approved"), + Description: utils.String(approvalDescription), + }, + }, + } + future, err := client.CreateOrUpdate(ctx, targetResourceId.ResourceGroup, targetResourceId.Name, *privateEndpointConnectionName, parameters) + if err != nil { + return fmt.Errorf("approving %s: %+v", id, err) + } + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for approval of %s: %+v", id, err) + } + + return nil +} + +func approveManagedPrivateEndpointForStorage(ctx context.Context, meta interface{}, id parse.ManagedPrivateEndpointId, resourceId, privateEndpointName string) error { + client := meta.(*clients.Client).Storage.PrivateEndpointConnectionClient + + targetResourceId, err := storageParse.StorageAccountID(resourceId) + if err != nil { + return err + } + + result, err := client.List(ctx, targetResourceId.ResourceGroup, targetResourceId.Name) + if err != nil { + return err + } + + var privateEndpointConnectionName *string + for _, val := range *result.Value { + if val.PrivateEndpoint == nil || val.PrivateEndpoint.ID == nil { + continue + } + privateEndpointId, err := networkParse.PrivateEndpointID(*val.PrivateEndpoint.ID) + if err != nil { + continue + } + if privateEndpointName == privateEndpointId.Name { + privateEndpointConnectionName = val.Name + break + } + } + if privateEndpointConnectionName == nil { + return fmt.Errorf("finding private endpoint connection name for %s: %+v", id, err) + } + + properties := storage.PrivateEndpointConnection{ + PrivateEndpointConnectionProperties: &storage.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &storage.PrivateLinkServiceConnectionState{ + Status: storage.PrivateEndpointServiceConnectionStatusApproved, + Description: utils.String(approvalDescription), + }, + }, + } + _, err = client.Put(ctx, targetResourceId.ResourceGroup, targetResourceId.Name, *privateEndpointConnectionName, properties) + if err != nil { + return fmt.Errorf("approving %s: %+v", id, err) + } + + return nil +} + +func approveManagedPrivateEndpointForSynapse(ctx context.Context, meta interface{}, id parse.ManagedPrivateEndpointId, resourceId, privateEndpointName string) error { + client := meta.(*clients.Client).Synapse.PrivateEndpointConnectionClient + + targetResourceId, err := parse.WorkspaceID(resourceId) + if err != nil { + return err + } + + result, err := client.List(ctx, targetResourceId.ResourceGroup, targetResourceId.Name) + if err != nil { + return err + } + + var privateEndpointConnectionName *string + for _, val := range result.Values() { + if val.PrivateEndpoint == nil || val.PrivateEndpoint.ID == nil { + continue + } + privateEndpointId, err := networkParse.PrivateEndpointID(*val.PrivateEndpoint.ID) + if err != nil { + continue + } + if privateEndpointName == privateEndpointId.Name { + privateEndpointConnectionName = val.Name + break + } + } + if privateEndpointConnectionName == nil { + return fmt.Errorf("finding private endpoint connection name for %s: %+v", id, err) + } + + request := synapse.PrivateEndpointConnection{ + PrivateEndpointConnectionProperties: &synapse.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &synapse.PrivateLinkServiceConnectionState{ + Status: utils.String("Approved"), + Description: utils.String(approvalDescription), + }, + }, + } + future, err := client.Create(ctx, request, targetResourceId.ResourceGroup, targetResourceId.Name, *privateEndpointConnectionName) + if err != nil { + return fmt.Errorf("approving %s: %+v", id, err) + } + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for approval of %s: %+v", id, err) + } + + return nil +} diff --git a/internal/services/synapse/synapse_managed_private_endpoint_resource_test.go b/internal/services/synapse/synapse_managed_private_endpoint_resource_test.go index 0fa388d5d4c6..c1fd46380b43 100644 --- a/internal/services/synapse/synapse_managed_private_endpoint_resource_test.go +++ b/internal/services/synapse/synapse_managed_private_endpoint_resource_test.go @@ -45,6 +45,171 @@ func TestAccSynapseManagedPrivateEndpoint_requiresImport(t *testing.T) { }) } +func TestAccSynapseManagedPrivateEndpoint_autoApproveCognitive(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_synapse_managed_private_endpoint", "test") + r := SynapseManagedPrivateEndpointResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.autoApproveCognitive(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSynapseManagedPrivateEndpoint_autoApproveCosmos(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_synapse_managed_private_endpoint", "test") + r := SynapseManagedPrivateEndpointResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.autoApproveCosmos(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSynapseManagedPrivateEndpoint_autoApproveKeyVault(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_synapse_managed_private_endpoint", "test") + r := SynapseManagedPrivateEndpointResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.autoApproveKeyVault(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSynapseManagedPrivateEndpoint_autoApproveMariaDB(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_synapse_managed_private_endpoint", "test") + r := SynapseManagedPrivateEndpointResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.autoApproveMariaDB(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSynapseManagedPrivateEndpoint_autoApproveMySQL(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_synapse_managed_private_endpoint", "test") + r := SynapseManagedPrivateEndpointResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.autoApproveMySQL(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSynapseManagedPrivateEndpoint_autoApprovePostgreSQL(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_synapse_managed_private_endpoint", "test") + r := SynapseManagedPrivateEndpointResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.autoApprovePostgreSQL(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSynapseManagedPrivateEndpoint_autoApprovePurview(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_synapse_managed_private_endpoint", "test") + r := SynapseManagedPrivateEndpointResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.autoApprovePurview(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSynapseManagedPrivateEndpoint_autoApproveSQL(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_synapse_managed_private_endpoint", "test") + r := SynapseManagedPrivateEndpointResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.autoApproveSQL(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSynapseManagedPrivateEndpoint_autoApproveSearch(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_synapse_managed_private_endpoint", "test") + r := SynapseManagedPrivateEndpointResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.autoApproveSearch(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSynapseManagedPrivateEndpoint_autoApproveStorage(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_synapse_managed_private_endpoint", "test") + r := SynapseManagedPrivateEndpointResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.autoApproveStorage(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSynapseManagedPrivateEndpoint_autoApproveSynapse(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_synapse_managed_private_endpoint", "test") + r := SynapseManagedPrivateEndpointResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.autoApproveSynapse(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + func (r SynapseManagedPrivateEndpointResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.ManagedPrivateEndpointID(state.ID) if err != nil { @@ -63,6 +228,9 @@ func (r SynapseManagedPrivateEndpointResource) Exists(ctx context.Context, clien } return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } + if state.Attributes["is_manual_connection"] == "false" && *resp.Properties.ConnectionState.Status != "Approved" { + return utils.Bool(false), nil + } return utils.Bool(true), nil } @@ -72,6 +240,15 @@ func (r SynapseManagedPrivateEndpointResource) basic(data acceptance.TestData) s return fmt.Sprintf(` %[1]s +resource "azurerm_storage_account" "test_endpoint" { + name = "acctestacce%[3]s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + account_kind = "BlobStorage" + account_tier = "Standard" + account_replication_type = "LRS" +} + resource "azurerm_synapse_managed_private_endpoint" "test" { name = "acctestEndpoint%[2]d" synapse_workspace_id = azurerm_synapse_workspace.test.id @@ -80,9 +257,333 @@ resource "azurerm_synapse_managed_private_endpoint" "test" { depends_on = [azurerm_synapse_firewall_rule.test] } +`, template, data.RandomInteger, data.RandomString) +} + +func (r SynapseManagedPrivateEndpointResource) autoApproveCognitive(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%[1]s + +resource "azurerm_cognitive_account" "test" { + name = "acctestcogacc-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + kind = "Face" + sku_name = "F0" + custom_subdomain_name = "acctestcogacc-%[2]d" + + public_network_access_enabled = false + + network_acls { + default_action = "Deny" + } +} + +resource "azurerm_synapse_managed_private_endpoint" "test" { + name = "acctestEndpoint%[2]d" + synapse_workspace_id = azurerm_synapse_workspace.test.id + target_resource_id = azurerm_cognitive_account.test.id + subresource_name = "account" + is_manual_connection = false + + depends_on = [azurerm_synapse_firewall_rule.test] +} `, template, data.RandomInteger) } +func (r SynapseManagedPrivateEndpointResource) autoApproveCosmos(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%[1]s + +resource "azurerm_cosmosdb_account" "test" { + name = "acctest-ca-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + offer_type = "Standard" + kind = "GlobalDocumentDB" + + consistency_policy { + consistency_level = "Eventual" + } + + geo_location { + location = azurerm_resource_group.test.location + failover_priority = 0 + } +} + +resource "azurerm_synapse_managed_private_endpoint" "test" { + name = "acctestEndpoint%[2]d" + synapse_workspace_id = azurerm_synapse_workspace.test.id + target_resource_id = azurerm_cosmosdb_account.test.id + subresource_name = "sql" + is_manual_connection = false + + depends_on = [azurerm_synapse_firewall_rule.test] +} +`, template, data.RandomInteger) +} + +func (r SynapseManagedPrivateEndpointResource) autoApproveKeyVault(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%[1]s + +data "azurerm_client_config" "current" {} + +resource "azurerm_key_vault" "test" { + name = "acctestkv%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + tenant_id = data.azurerm_client_config.current.tenant_id + sku_name = "standard" + purge_protection_enabled = true +} + +resource "azurerm_synapse_managed_private_endpoint" "test" { + name = "acctestEndpoint%[2]d" + synapse_workspace_id = azurerm_synapse_workspace.test.id + target_resource_id = azurerm_key_vault.test.id + subresource_name = "vault" + is_manual_connection = false + + depends_on = [azurerm_synapse_firewall_rule.test] +} +`, template, data.RandomInteger) +} + +func (r SynapseManagedPrivateEndpointResource) autoApproveMariaDB(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%[1]s + +resource "azurerm_mariadb_server" "test" { + name = "acctestmariadbsvr-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku_name = "GP_Gen5_2" + version = "10.3" + + public_network_access_enabled = false + + administrator_login = "acctestun" + administrator_login_password = "H@Sh1CoR3!" + ssl_enforcement_enabled = true + storage_mb = 51200 +} + +resource "azurerm_synapse_managed_private_endpoint" "test" { + name = "acctestEndpoint%[2]d" + synapse_workspace_id = azurerm_synapse_workspace.test.id + target_resource_id = azurerm_mariadb_server.test.id + subresource_name = "mariadbServer" + is_manual_connection = false + + depends_on = [azurerm_synapse_firewall_rule.test] +} +`, template, data.RandomInteger) +} + +func (r SynapseManagedPrivateEndpointResource) autoApproveMySQL(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%[1]s + +resource "azurerm_mysql_server" "test" { + name = "acctestmysqlsvr-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku_name = "GP_Gen5_2" + administrator_login = "acctestun" + administrator_login_password = "H@Sh1CoR3!" + ssl_enforcement_enabled = true + ssl_minimal_tls_version_enforced = "TLS1_1" + storage_mb = 51200 + version = "5.7" +} + +resource "azurerm_synapse_managed_private_endpoint" "test" { + name = "acctestEndpoint%[2]d" + synapse_workspace_id = azurerm_synapse_workspace.test.id + target_resource_id = azurerm_mysql_server.test.id + subresource_name = "mysqlServer" + is_manual_connection = false + + depends_on = [azurerm_synapse_firewall_rule.test] +} +`, template, data.RandomInteger) +} + +func (r SynapseManagedPrivateEndpointResource) autoApprovePostgreSQL(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%[1]s + +resource "azurerm_postgresql_server" "test" { + name = "acctest-psql-server-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku_name = "GP_Gen5_2" + version = "9.5" + + public_network_access_enabled = false + + administrator_login = "acctestun" + administrator_login_password = "H@Sh1CoR3!" + ssl_enforcement_enabled = true + storage_mb = 51200 +} + +resource "azurerm_synapse_managed_private_endpoint" "test" { + name = "acctestEndpoint%[2]d" + synapse_workspace_id = azurerm_synapse_workspace.test.id + target_resource_id = azurerm_postgresql_server.test.id + subresource_name = "postgresqlServer" + is_manual_connection = false + + depends_on = [azurerm_synapse_firewall_rule.test] +} +`, template, data.RandomInteger) +} + +func (r SynapseManagedPrivateEndpointResource) autoApprovePurview(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%[1]s + +resource "azurerm_purview_account" "test" { + name = "acctestsw%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location +} + +resource "azurerm_synapse_managed_private_endpoint" "test" { + name = "acctestEndpoint%[2]d" + synapse_workspace_id = azurerm_synapse_workspace.test.id + target_resource_id = azurerm_purview_account.test.id + subresource_name = "portal" + is_manual_connection = false + + depends_on = [azurerm_synapse_firewall_rule.test] +} +`, template, data.RandomInteger) +} + +func (r SynapseManagedPrivateEndpointResource) autoApproveSearch(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%[1]s + +resource "azurerm_search_service" "test" { + name = "acctestsearchservice%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + sku = "standard" + + public_network_access_enabled = false + + tags = { + environment = "staging" + } +} + +resource "azurerm_synapse_managed_private_endpoint" "test" { + name = "acctestEndpoint%[2]d" + synapse_workspace_id = azurerm_synapse_workspace.test.id + target_resource_id = azurerm_search_service.test.id + subresource_name = "searchService" + is_manual_connection = false + + depends_on = [azurerm_synapse_firewall_rule.test] +} +`, template, data.RandomInteger) +} + +func (r SynapseManagedPrivateEndpointResource) autoApproveSQL(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%[1]s + +resource "azurerm_sql_server" "test" { + name = "acctestsqlserver%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + version = "12.0" + administrator_login = "mradministrator" + administrator_login_password = "thisIsDog11" +} + +resource "azurerm_synapse_managed_private_endpoint" "test" { + name = "acctestEndpoint%[2]d" + synapse_workspace_id = azurerm_synapse_workspace.test.id + target_resource_id = azurerm_sql_server.test.id + subresource_name = "SQLServer" + is_manual_connection = false + + depends_on = [azurerm_synapse_firewall_rule.test] +} +`, template, data.RandomInteger) +} + +func (r SynapseManagedPrivateEndpointResource) autoApproveStorage(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%[1]s + +resource "azurerm_storage_account" "test_endpoint" { + name = "acctestacce%[3]s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + account_kind = "BlobStorage" + account_tier = "Standard" + account_replication_type = "LRS" +} + +resource "azurerm_synapse_managed_private_endpoint" "test" { + name = "acctestEndpoint%[2]d" + synapse_workspace_id = azurerm_synapse_workspace.test.id + target_resource_id = azurerm_storage_account.test_endpoint.id + subresource_name = "blob" + is_manual_connection = false + + depends_on = [azurerm_synapse_firewall_rule.test] +} +`, template, data.RandomInteger, data.RandomString) +} + +func (r SynapseManagedPrivateEndpointResource) autoApproveSynapse(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%[1]s + +resource "azurerm_storage_data_lake_gen2_filesystem" "test_endpoint" { + name = "accteste-%[2]d" + storage_account_id = azurerm_storage_account.test.id +} + +resource "azurerm_synapse_workspace" "test_endpoint" { + name = "acctestswe%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test_endpoint.id + sql_administrator_login = "sqladminuser" + sql_administrator_login_password = "H@Sh1CoR3!" +} + +resource "azurerm_synapse_managed_private_endpoint" "test" { + name = "acctestEndpoint%[2]d" + synapse_workspace_id = azurerm_synapse_workspace.test.id + target_resource_id = azurerm_synapse_workspace.test_endpoint.id + subresource_name = "sqlOnDemand" + is_manual_connection = false + + depends_on = [azurerm_synapse_firewall_rule.test] +} +`, template, data.RandomInteger, data.RandomString) +} + func (r SynapseManagedPrivateEndpointResource) requiresImport(data acceptance.TestData) string { config := r.basic(data) return fmt.Sprintf(` @@ -117,15 +618,6 @@ resource "azurerm_storage_account" "test" { account_replication_type = "LRS" } -resource "azurerm_storage_account" "test_endpoint" { - name = "acctestacce%[3]s" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - account_kind = "BlobStorage" - account_tier = "Standard" - account_replication_type = "LRS" -} - resource "azurerm_storage_data_lake_gen2_filesystem" "test" { name = "acctest-%[1]d" storage_account_id = azurerm_storage_account.test.id diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/README.md new file mode 100644 index 000000000000..fc9d782559b8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/README.md @@ -0,0 +1,81 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections` Documentation + +The `privateendpointconnections` SDK allows for interaction with the Azure Resource Manager Service `cognitive` (API Version `2021-04-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/cognitive/2021-04-30/privateendpointconnections" +``` + + +### Client Initialization + +```go +client := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "privateEndpointConnectionValue") + +payload := privateendpointconnections.PrivateEndpointConnection{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Delete` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "privateEndpointConnectionValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Get` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "privateEndpointConnectionValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.List` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/client.go new file mode 100644 index 000000000000..1de584406fe4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/client.go @@ -0,0 +1,18 @@ +package privateendpointconnections + +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 PrivateEndpointConnectionsClient struct { + Client autorest.Client + baseUri string +} + +func NewPrivateEndpointConnectionsClientWithBaseURI(endpoint string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/constants.go new file mode 100644 index 000000000000..b6aed9e880a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/constants.go @@ -0,0 +1,71 @@ +package privateendpointconnections + +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 PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { + return []string{ + string(PrivateEndpointConnectionProvisioningStateCreating), + string(PrivateEndpointConnectionProvisioningStateDeleting), + string(PrivateEndpointConnectionProvisioningStateFailed), + string(PrivateEndpointConnectionProvisioningStateSucceeded), + } +} + +func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { + vals := map[string]PrivateEndpointConnectionProvisioningState{ + "creating": PrivateEndpointConnectionProvisioningStateCreating, + "deleting": PrivateEndpointConnectionProvisioningStateDeleting, + "failed": PrivateEndpointConnectionProvisioningStateFailed, + "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionProvisioningState(input) + return &out, nil +} + +type PrivateEndpointServiceConnectionStatus string + +const ( + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateEndpointServiceConnectionStatus() []string { + return []string{ + string(PrivateEndpointServiceConnectionStatusApproved), + string(PrivateEndpointServiceConnectionStatusPending), + string(PrivateEndpointServiceConnectionStatusRejected), + } +} + +func parsePrivateEndpointServiceConnectionStatus(input string) (*PrivateEndpointServiceConnectionStatus, error) { + vals := map[string]PrivateEndpointServiceConnectionStatus{ + "approved": PrivateEndpointServiceConnectionStatusApproved, + "pending": PrivateEndpointServiceConnectionStatusPending, + "rejected": PrivateEndpointServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointServiceConnectionStatus(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/id_account.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/id_account.go new file mode 100644 index 000000000000..254270ceb4bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/id_account.go @@ -0,0 +1,124 @@ +package privateendpointconnections + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = AccountId{} + +// AccountId is a struct representing the Resource ID for a Account +type AccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewAccountID returns a new AccountId struct +func NewAccountID(subscriptionId string, resourceGroupName string, accountName string) AccountId { + return AccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseAccountID parses 'input' into a AccountId +func ParseAccountID(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(AccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AccountId{} + + 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseAccountIDInsensitively parses 'input' case-insensitively into a AccountId +// note: this method should only be used for API response data and not user input +func ParseAccountIDInsensitively(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(AccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AccountId{} + + 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateAccountID checks that 'input' can be parsed as a Account ID +func ValidateAccountID(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 := ParseAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Account ID +func (id AccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.CognitiveServices/accounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Account ID +func (id AccountId) 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("staticMicrosoftCognitiveServices", "Microsoft.CognitiveServices", "Microsoft.CognitiveServices"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + } +} + +// String returns a human-readable description of this Account ID +func (id AccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/id_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/id_privateendpointconnection.go new file mode 100644 index 000000000000..6e71b93704fc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/id_privateendpointconnection.go @@ -0,0 +1,137 @@ +package privateendpointconnections + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = PrivateEndpointConnectionId{} + +// PrivateEndpointConnectionId is a struct representing the Resource ID for a Private Endpoint Connection +type PrivateEndpointConnectionId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + PrivateEndpointConnectionName string +} + +// NewPrivateEndpointConnectionID returns a new PrivateEndpointConnectionId struct +func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, accountName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { + return PrivateEndpointConnectionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + PrivateEndpointConnectionName: privateEndpointConnectionName, + } +} + +// ParsePrivateEndpointConnectionID parses 'input' into a PrivateEndpointConnectionId +func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrivateEndpointConnectionId{} + + 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { + return nil, fmt.Errorf("the segment 'privateEndpointConnectionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParsePrivateEndpointConnectionIDInsensitively parses 'input' case-insensitively into a PrivateEndpointConnectionId +// note: this method should only be used for API response data and not user input +func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrivateEndpointConnectionId{} + + 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { + return nil, fmt.Errorf("the segment 'privateEndpointConnectionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID +func ValidatePrivateEndpointConnectionID(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 := ParsePrivateEndpointConnectionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.CognitiveServices/accounts/%s/privateEndpointConnections/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PrivateEndpointConnectionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) 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("staticMicrosoftCognitiveServices", "Microsoft.CognitiveServices", "Microsoft.CognitiveServices"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticPrivateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), + resourceids.UserSpecifiedSegment("privateEndpointConnectionName", "privateEndpointConnectionValue"), + } +} + +// String returns a human-readable description of this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Private Endpoint Connection Name: %q", id.PrivateEndpointConnectionName), + } + return fmt.Sprintf("Private Endpoint Connection (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/method_createorupdate_autorest.go new file mode 100644 index 000000000000..08aac1fbfa75 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c PrivateEndpointConnectionsClient) CreateOrUpdateThenPoll(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c PrivateEndpointConnectionsClient) preparerForCreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateEndpointConnectionsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/method_delete_autorest.go new file mode 100644 index 000000000000..ef4fd3d8e664 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/method_delete_autorest.go @@ -0,0 +1,78 @@ +package privateendpointconnections + +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 DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c PrivateEndpointConnectionsClient) Delete(ctx context.Context, id PrivateEndpointConnectionId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c PrivateEndpointConnectionsClient) DeleteThenPoll(ctx context.Context, id PrivateEndpointConnectionId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c PrivateEndpointConnectionsClient) preparerForDelete(ctx context.Context, id PrivateEndpointConnectionId) (*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)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateEndpointConnectionsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, 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/cognitive/2021-04-30/privateendpointconnections/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/method_get_autorest.go new file mode 100644 index 000000000000..44bbdcb8f0bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/method_get_autorest.go @@ -0,0 +1,68 @@ +package privateendpointconnections + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *PrivateEndpointConnection +} + +// Get ... +func (c PrivateEndpointConnectionsClient) Get(ctx context.Context, id PrivateEndpointConnectionId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c PrivateEndpointConnectionsClient) preparerForGet(ctx context.Context, id PrivateEndpointConnectionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c PrivateEndpointConnectionsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/method_list_autorest.go new file mode 100644 index 000000000000..db05c4df6077 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/method_list_autorest.go @@ -0,0 +1,69 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *PrivateEndpointConnectionListResult +} + +// List ... +func (c PrivateEndpointConnectionsClient) List(ctx context.Context, id AccountId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c PrivateEndpointConnectionsClient) preparerForList(ctx context.Context, id AccountId) (*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/privateEndpointConnections", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c PrivateEndpointConnectionsClient) responderForList(resp *http.Response) (result ListOperationResponse, 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/cognitive/2021-04-30/privateendpointconnections/model_privateendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/model_privateendpoint.go new file mode 100644 index 000000000000..1bc8cf2a97c3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/model_privateendpoint.go @@ -0,0 +1,8 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/model_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/model_privateendpointconnection.go new file mode 100644 index 000000000000..647e922db00b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/model_privateendpointconnection.go @@ -0,0 +1,18 @@ +package privateendpointconnections + +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 PrivateEndpointConnection struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/model_privateendpointconnectionlistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/model_privateendpointconnectionlistresult.go new file mode 100644 index 000000000000..92a9ecb105a6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/model_privateendpointconnectionlistresult.go @@ -0,0 +1,8 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionListResult struct { + Value *[]PrivateEndpointConnection `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/model_privateendpointconnectionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/model_privateendpointconnectionproperties.go new file mode 100644 index 000000000000..fb540c904b66 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/model_privateendpointconnectionproperties.go @@ -0,0 +1,11 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + GroupIds *[]string `json:"groupIds,omitempty"` + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` + ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/model_privatelinkserviceconnectionstate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/model_privatelinkserviceconnectionstate.go new file mode 100644 index 000000000000..ec3f7a9f24cb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/version.go new file mode 100644 index 000000000000..e41817d05b8f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections/version.go @@ -0,0 +1,12 @@ +package privateendpointconnections + +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-04-30" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/privateendpointconnections/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/README.md new file mode 100644 index 000000000000..731f8bfb4ee7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections` Documentation + +The `privateendpointconnections` SDK allows for interaction with the Azure Resource Manager Service `mariadb` (API Version `2018-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections" +``` + + +### Client Initialization + +```go +client := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "privateEndpointConnectionValue") + +payload := privateendpointconnections.PrivateEndpointConnection{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Delete` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "privateEndpointConnectionValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Get` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "privateEndpointConnectionValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.ListByServer` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +// alternatively `client.ListByServer(ctx, id)` can be used to do batched pagination +items, err := client.ListByServerComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.UpdateTags` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "privateEndpointConnectionValue") + +payload := privateendpointconnections.TagsObject{ + // ... +} + + +if err := client.UpdateTagsThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/client.go new file mode 100644 index 000000000000..1de584406fe4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/client.go @@ -0,0 +1,18 @@ +package privateendpointconnections + +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 PrivateEndpointConnectionsClient struct { + Client autorest.Client + baseUri string +} + +func NewPrivateEndpointConnectionsClientWithBaseURI(endpoint string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/id_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/id_privateendpointconnection.go new file mode 100644 index 000000000000..1c619c16a6bd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/id_privateendpointconnection.go @@ -0,0 +1,137 @@ +package privateendpointconnections + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = PrivateEndpointConnectionId{} + +// PrivateEndpointConnectionId is a struct representing the Resource ID for a Private Endpoint Connection +type PrivateEndpointConnectionId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + PrivateEndpointConnectionName string +} + +// NewPrivateEndpointConnectionID returns a new PrivateEndpointConnectionId struct +func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, serverName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { + return PrivateEndpointConnectionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + PrivateEndpointConnectionName: privateEndpointConnectionName, + } +} + +// ParsePrivateEndpointConnectionID parses 'input' into a PrivateEndpointConnectionId +func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrivateEndpointConnectionId{} + + 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.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { + return nil, fmt.Errorf("the segment 'privateEndpointConnectionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParsePrivateEndpointConnectionIDInsensitively parses 'input' case-insensitively into a PrivateEndpointConnectionId +// note: this method should only be used for API response data and not user input +func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrivateEndpointConnectionId{} + + 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.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { + return nil, fmt.Errorf("the segment 'privateEndpointConnectionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID +func ValidatePrivateEndpointConnectionID(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 := ParsePrivateEndpointConnectionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMariaDB/servers/%s/privateEndpointConnections/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.PrivateEndpointConnectionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) 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("staticMicrosoftDBforMariaDB", "Microsoft.DBforMariaDB", "Microsoft.DBforMariaDB"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.StaticSegment("staticPrivateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), + resourceids.UserSpecifiedSegment("privateEndpointConnectionName", "privateEndpointConnectionValue"), + } +} + +// String returns a human-readable description of this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Private Endpoint Connection Name: %q", id.PrivateEndpointConnectionName), + } + return fmt.Sprintf("Private Endpoint Connection (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/id_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/id_server.go new file mode 100644 index 000000000000..11f0d4ab6e66 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/id_server.go @@ -0,0 +1,124 @@ +package privateendpointconnections + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + 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.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + 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.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(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 := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMariaDB/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) 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("staticMicrosoftDBforMariaDB", "Microsoft.DBforMariaDB", "Microsoft.DBforMariaDB"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/method_createorupdate_autorest.go new file mode 100644 index 000000000000..08aac1fbfa75 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c PrivateEndpointConnectionsClient) CreateOrUpdateThenPoll(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c PrivateEndpointConnectionsClient) preparerForCreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateEndpointConnectionsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/method_delete_autorest.go new file mode 100644 index 000000000000..ef4fd3d8e664 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/method_delete_autorest.go @@ -0,0 +1,78 @@ +package privateendpointconnections + +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 DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c PrivateEndpointConnectionsClient) Delete(ctx context.Context, id PrivateEndpointConnectionId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c PrivateEndpointConnectionsClient) DeleteThenPoll(ctx context.Context, id PrivateEndpointConnectionId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c PrivateEndpointConnectionsClient) preparerForDelete(ctx context.Context, id PrivateEndpointConnectionId) (*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)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateEndpointConnectionsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, 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/mariadb/2018-06-01/privateendpointconnections/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/method_get_autorest.go new file mode 100644 index 000000000000..44bbdcb8f0bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/method_get_autorest.go @@ -0,0 +1,68 @@ +package privateendpointconnections + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *PrivateEndpointConnection +} + +// Get ... +func (c PrivateEndpointConnectionsClient) Get(ctx context.Context, id PrivateEndpointConnectionId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c PrivateEndpointConnectionsClient) preparerForGet(ctx context.Context, id PrivateEndpointConnectionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c PrivateEndpointConnectionsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/method_listbyserver_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/method_listbyserver_autorest.go new file mode 100644 index 000000000000..f433b0ce48d5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/method_listbyserver_autorest.go @@ -0,0 +1,186 @@ +package privateendpointconnections + +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 ListByServerOperationResponse struct { + HttpResponse *http.Response + Model *[]PrivateEndpointConnection + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByServerOperationResponse, error) +} + +type ListByServerCompleteResult struct { + Items []PrivateEndpointConnection +} + +func (r ListByServerOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByServerOperationResponse) LoadMore(ctx context.Context) (resp ListByServerOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByServer ... +func (c PrivateEndpointConnectionsClient) ListByServer(ctx context.Context, id ServerId) (resp ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServer(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByServer", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByServer(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByServer", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByServer prepares the ListByServer request. +func (c PrivateEndpointConnectionsClient) preparerForListByServer(ctx context.Context, id ServerId) (*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/privateEndpointConnections", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByServerWithNextLink prepares the ListByServer request with the given nextLink token. +func (c PrivateEndpointConnectionsClient) preparerForListByServerWithNextLink(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)) +} + +// responderForListByServer handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (c PrivateEndpointConnectionsClient) responderForListByServer(resp *http.Response) (result ListByServerOperationResponse, err error) { + type page struct { + Values []PrivateEndpointConnection `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 ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServerWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByServer", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByServer", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByServer(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByServer", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByServerComplete retrieves all of the results into a single object +func (c PrivateEndpointConnectionsClient) ListByServerComplete(ctx context.Context, id ServerId) (ListByServerCompleteResult, error) { + return c.ListByServerCompleteMatchingPredicate(ctx, id, PrivateEndpointConnectionOperationPredicate{}) +} + +// ListByServerCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c PrivateEndpointConnectionsClient) ListByServerCompleteMatchingPredicate(ctx context.Context, id ServerId, predicate PrivateEndpointConnectionOperationPredicate) (resp ListByServerCompleteResult, err error) { + items := make([]PrivateEndpointConnection, 0) + + page, err := c.ListByServer(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 := ListByServerCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/method_updatetags_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/method_updatetags_autorest.go new file mode 100644 index 000000000000..a7dae77a0ec2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/method_updatetags_autorest.go @@ -0,0 +1,79 @@ +package privateendpointconnections + +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 UpdateTagsOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// UpdateTags ... +func (c PrivateEndpointConnectionsClient) UpdateTags(ctx context.Context, id PrivateEndpointConnectionId, input TagsObject) (result UpdateTagsOperationResponse, err error) { + req, err := c.preparerForUpdateTags(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdateTags(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "UpdateTags", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateTagsThenPoll performs UpdateTags then polls until it's completed +func (c PrivateEndpointConnectionsClient) UpdateTagsThenPoll(ctx context.Context, id PrivateEndpointConnectionId, input TagsObject) error { + result, err := c.UpdateTags(ctx, id, input) + if err != nil { + return fmt.Errorf("performing UpdateTags: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after UpdateTags: %+v", err) + } + + return nil +} + +// preparerForUpdateTags prepares the UpdateTags request. +func (c PrivateEndpointConnectionsClient) preparerForUpdateTags(ctx context.Context, id PrivateEndpointConnectionId, input TagsObject) (*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)) +} + +// senderForUpdateTags sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateEndpointConnectionsClient) senderForUpdateTags(ctx context.Context, req *http.Request) (future UpdateTagsOperationResponse, 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/mariadb/2018-06-01/privateendpointconnections/model_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/model_privateendpointconnection.go new file mode 100644 index 000000000000..fde7f4db0fc0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/model_privateendpointconnection.go @@ -0,0 +1,11 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/model_privateendpointconnectionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/model_privateendpointconnectionproperties.go new file mode 100644 index 000000000000..247d0bc10a27 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/model_privateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/model_privateendpointproperty.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/model_privateendpointproperty.go new file mode 100644 index 000000000000..b0b0ff184829 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/model_privateendpointproperty.go @@ -0,0 +1,8 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointProperty struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/model_privatelinkserviceconnectionstateproperty.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/model_privatelinkserviceconnectionstateproperty.go new file mode 100644 index 000000000000..ba250769d7a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/model_privatelinkserviceconnectionstateproperty.go @@ -0,0 +1,10 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionStateProperty struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description string `json:"description"` + Status string `json:"status"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/model_tagsobject.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/model_tagsobject.go new file mode 100644 index 000000000000..4425621d21ae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/model_tagsobject.go @@ -0,0 +1,8 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagsObject struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/predicates.go new file mode 100644 index 000000000000..1e847cf7d766 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/predicates.go @@ -0,0 +1,24 @@ +package privateendpointconnections + +type PrivateEndpointConnectionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p PrivateEndpointConnectionOperationPredicate) Matches(input PrivateEndpointConnection) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/version.go new file mode 100644 index 000000000000..9b9844f0ad69 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections/version.go @@ -0,0 +1,12 @@ +package privateendpointconnections + +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 = "2018-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/privateendpointconnections/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/README.md new file mode 100644 index 000000000000..55eaa56133fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections` Documentation + +The `privateendpointconnections` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2018-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections" +``` + + +### Client Initialization + +```go +client := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "privateEndpointConnectionValue") + +payload := privateendpointconnections.PrivateEndpointConnection{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Delete` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "privateEndpointConnectionValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Get` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "privateEndpointConnectionValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.ListByServer` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +// alternatively `client.ListByServer(ctx, id)` can be used to do batched pagination +items, err := client.ListByServerComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.UpdateTags` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "privateEndpointConnectionValue") + +payload := privateendpointconnections.TagsObject{ + // ... +} + + +if err := client.UpdateTagsThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/client.go new file mode 100644 index 000000000000..1de584406fe4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/client.go @@ -0,0 +1,18 @@ +package privateendpointconnections + +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 PrivateEndpointConnectionsClient struct { + Client autorest.Client + baseUri string +} + +func NewPrivateEndpointConnectionsClientWithBaseURI(endpoint string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/id_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/id_privateendpointconnection.go new file mode 100644 index 000000000000..d6dfcbbd43d4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/id_privateendpointconnection.go @@ -0,0 +1,137 @@ +package privateendpointconnections + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = PrivateEndpointConnectionId{} + +// PrivateEndpointConnectionId is a struct representing the Resource ID for a Private Endpoint Connection +type PrivateEndpointConnectionId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + PrivateEndpointConnectionName string +} + +// NewPrivateEndpointConnectionID returns a new PrivateEndpointConnectionId struct +func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, serverName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { + return PrivateEndpointConnectionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + PrivateEndpointConnectionName: privateEndpointConnectionName, + } +} + +// ParsePrivateEndpointConnectionID parses 'input' into a PrivateEndpointConnectionId +func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrivateEndpointConnectionId{} + + 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.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { + return nil, fmt.Errorf("the segment 'privateEndpointConnectionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParsePrivateEndpointConnectionIDInsensitively parses 'input' case-insensitively into a PrivateEndpointConnectionId +// note: this method should only be used for API response data and not user input +func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrivateEndpointConnectionId{} + + 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.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { + return nil, fmt.Errorf("the segment 'privateEndpointConnectionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID +func ValidatePrivateEndpointConnectionID(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 := ParsePrivateEndpointConnectionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s/privateEndpointConnections/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.PrivateEndpointConnectionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) 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("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.StaticSegment("staticPrivateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), + resourceids.UserSpecifiedSegment("privateEndpointConnectionName", "privateEndpointConnectionValue"), + } +} + +// String returns a human-readable description of this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Private Endpoint Connection Name: %q", id.PrivateEndpointConnectionName), + } + return fmt.Sprintf("Private Endpoint Connection (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/id_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/id_server.go new file mode 100644 index 000000000000..691bbe1d0230 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/id_server.go @@ -0,0 +1,124 @@ +package privateendpointconnections + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + 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.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + 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.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(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 := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) 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("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/method_createorupdate_autorest.go new file mode 100644 index 000000000000..08aac1fbfa75 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c PrivateEndpointConnectionsClient) CreateOrUpdateThenPoll(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c PrivateEndpointConnectionsClient) preparerForCreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateEndpointConnectionsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/method_delete_autorest.go new file mode 100644 index 000000000000..ef4fd3d8e664 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/method_delete_autorest.go @@ -0,0 +1,78 @@ +package privateendpointconnections + +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 DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c PrivateEndpointConnectionsClient) Delete(ctx context.Context, id PrivateEndpointConnectionId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c PrivateEndpointConnectionsClient) DeleteThenPoll(ctx context.Context, id PrivateEndpointConnectionId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c PrivateEndpointConnectionsClient) preparerForDelete(ctx context.Context, id PrivateEndpointConnectionId) (*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)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateEndpointConnectionsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, 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/postgresql/2018-06-01/privateendpointconnections/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/method_get_autorest.go new file mode 100644 index 000000000000..44bbdcb8f0bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/method_get_autorest.go @@ -0,0 +1,68 @@ +package privateendpointconnections + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *PrivateEndpointConnection +} + +// Get ... +func (c PrivateEndpointConnectionsClient) Get(ctx context.Context, id PrivateEndpointConnectionId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c PrivateEndpointConnectionsClient) preparerForGet(ctx context.Context, id PrivateEndpointConnectionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c PrivateEndpointConnectionsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/method_listbyserver_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/method_listbyserver_autorest.go new file mode 100644 index 000000000000..f433b0ce48d5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/method_listbyserver_autorest.go @@ -0,0 +1,186 @@ +package privateendpointconnections + +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 ListByServerOperationResponse struct { + HttpResponse *http.Response + Model *[]PrivateEndpointConnection + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByServerOperationResponse, error) +} + +type ListByServerCompleteResult struct { + Items []PrivateEndpointConnection +} + +func (r ListByServerOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByServerOperationResponse) LoadMore(ctx context.Context) (resp ListByServerOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByServer ... +func (c PrivateEndpointConnectionsClient) ListByServer(ctx context.Context, id ServerId) (resp ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServer(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByServer", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByServer(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByServer", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByServer prepares the ListByServer request. +func (c PrivateEndpointConnectionsClient) preparerForListByServer(ctx context.Context, id ServerId) (*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/privateEndpointConnections", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByServerWithNextLink prepares the ListByServer request with the given nextLink token. +func (c PrivateEndpointConnectionsClient) preparerForListByServerWithNextLink(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)) +} + +// responderForListByServer handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (c PrivateEndpointConnectionsClient) responderForListByServer(resp *http.Response) (result ListByServerOperationResponse, err error) { + type page struct { + Values []PrivateEndpointConnection `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 ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServerWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByServer", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByServer", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByServer(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByServer", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByServerComplete retrieves all of the results into a single object +func (c PrivateEndpointConnectionsClient) ListByServerComplete(ctx context.Context, id ServerId) (ListByServerCompleteResult, error) { + return c.ListByServerCompleteMatchingPredicate(ctx, id, PrivateEndpointConnectionOperationPredicate{}) +} + +// ListByServerCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c PrivateEndpointConnectionsClient) ListByServerCompleteMatchingPredicate(ctx context.Context, id ServerId, predicate PrivateEndpointConnectionOperationPredicate) (resp ListByServerCompleteResult, err error) { + items := make([]PrivateEndpointConnection, 0) + + page, err := c.ListByServer(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 := ListByServerCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/method_updatetags_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/method_updatetags_autorest.go new file mode 100644 index 000000000000..a7dae77a0ec2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/method_updatetags_autorest.go @@ -0,0 +1,79 @@ +package privateendpointconnections + +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 UpdateTagsOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// UpdateTags ... +func (c PrivateEndpointConnectionsClient) UpdateTags(ctx context.Context, id PrivateEndpointConnectionId, input TagsObject) (result UpdateTagsOperationResponse, err error) { + req, err := c.preparerForUpdateTags(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdateTags(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "UpdateTags", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateTagsThenPoll performs UpdateTags then polls until it's completed +func (c PrivateEndpointConnectionsClient) UpdateTagsThenPoll(ctx context.Context, id PrivateEndpointConnectionId, input TagsObject) error { + result, err := c.UpdateTags(ctx, id, input) + if err != nil { + return fmt.Errorf("performing UpdateTags: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after UpdateTags: %+v", err) + } + + return nil +} + +// preparerForUpdateTags prepares the UpdateTags request. +func (c PrivateEndpointConnectionsClient) preparerForUpdateTags(ctx context.Context, id PrivateEndpointConnectionId, input TagsObject) (*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)) +} + +// senderForUpdateTags sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateEndpointConnectionsClient) senderForUpdateTags(ctx context.Context, req *http.Request) (future UpdateTagsOperationResponse, 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/postgresql/2018-06-01/privateendpointconnections/model_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/model_privateendpointconnection.go new file mode 100644 index 000000000000..fde7f4db0fc0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/model_privateendpointconnection.go @@ -0,0 +1,11 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/model_privateendpointconnectionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/model_privateendpointconnectionproperties.go new file mode 100644 index 000000000000..247d0bc10a27 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/model_privateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/model_privateendpointproperty.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/model_privateendpointproperty.go new file mode 100644 index 000000000000..b0b0ff184829 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/model_privateendpointproperty.go @@ -0,0 +1,8 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointProperty struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/model_privatelinkserviceconnectionstateproperty.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/model_privatelinkserviceconnectionstateproperty.go new file mode 100644 index 000000000000..ba250769d7a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/model_privatelinkserviceconnectionstateproperty.go @@ -0,0 +1,10 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionStateProperty struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description string `json:"description"` + Status string `json:"status"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/model_tagsobject.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/model_tagsobject.go new file mode 100644 index 000000000000..4425621d21ae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/model_tagsobject.go @@ -0,0 +1,8 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagsObject struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/predicates.go new file mode 100644 index 000000000000..1e847cf7d766 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/predicates.go @@ -0,0 +1,24 @@ +package privateendpointconnections + +type PrivateEndpointConnectionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p PrivateEndpointConnectionOperationPredicate) Matches(input PrivateEndpointConnection) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/version.go new file mode 100644 index 000000000000..9b9844f0ad69 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections/version.go @@ -0,0 +1,12 @@ +package privateendpointconnections + +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 = "2018-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/privateendpointconnections/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/README.md new file mode 100644 index 000000000000..1cfea677cec6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection` Documentation + +The `privateendpointconnection` SDK allows for interaction with the Azure Resource Manager Service `purview` (API Version `2021-07-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection" +``` + + +### Client Initialization + +```go +client := privateendpointconnection.NewPrivateEndpointConnectionClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PrivateEndpointConnectionClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := privateendpointconnection.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "privateEndpointConnectionValue") + +payload := privateendpointconnection.PrivateEndpointConnection{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `PrivateEndpointConnectionClient.Delete` + +```go +ctx := context.TODO() +id := privateendpointconnection.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "privateEndpointConnectionValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `PrivateEndpointConnectionClient.Get` + +```go +ctx := context.TODO() +id := privateendpointconnection.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "privateEndpointConnectionValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PrivateEndpointConnectionClient.ListByAccount` + +```go +ctx := context.TODO() +id := privateendpointconnection.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +// alternatively `client.ListByAccount(ctx, id)` can be used to do batched pagination +items, err := client.ListByAccountComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/client.go new file mode 100644 index 000000000000..6acd77b913c3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/client.go @@ -0,0 +1,18 @@ +package privateendpointconnection + +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 PrivateEndpointConnectionClient struct { + Client autorest.Client + baseUri string +} + +func NewPrivateEndpointConnectionClientWithBaseURI(endpoint string) PrivateEndpointConnectionClient { + return PrivateEndpointConnectionClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/constants.go new file mode 100644 index 000000000000..8770979fb06c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/constants.go @@ -0,0 +1,43 @@ +package privateendpointconnection + +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 Status string + +const ( + StatusApproved Status = "Approved" + StatusDisconnected Status = "Disconnected" + StatusPending Status = "Pending" + StatusRejected Status = "Rejected" + StatusUnknown Status = "Unknown" +) + +func PossibleValuesForStatus() []string { + return []string{ + string(StatusApproved), + string(StatusDisconnected), + string(StatusPending), + string(StatusRejected), + string(StatusUnknown), + } +} + +func parseStatus(input string) (*Status, error) { + vals := map[string]Status{ + "approved": StatusApproved, + "disconnected": StatusDisconnected, + "pending": StatusPending, + "rejected": StatusRejected, + "unknown": StatusUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Status(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/id_account.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/id_account.go new file mode 100644 index 000000000000..b8c5a5b0193e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/id_account.go @@ -0,0 +1,124 @@ +package privateendpointconnection + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = AccountId{} + +// AccountId is a struct representing the Resource ID for a Account +type AccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewAccountID returns a new AccountId struct +func NewAccountID(subscriptionId string, resourceGroupName string, accountName string) AccountId { + return AccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseAccountID parses 'input' into a AccountId +func ParseAccountID(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(AccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AccountId{} + + 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseAccountIDInsensitively parses 'input' case-insensitively into a AccountId +// note: this method should only be used for API response data and not user input +func ParseAccountIDInsensitively(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(AccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AccountId{} + + 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateAccountID checks that 'input' can be parsed as a Account ID +func ValidateAccountID(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 := ParseAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Account ID +func (id AccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Purview/accounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Account ID +func (id AccountId) 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("staticMicrosoftPurview", "Microsoft.Purview", "Microsoft.Purview"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + } +} + +// String returns a human-readable description of this Account ID +func (id AccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/id_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/id_privateendpointconnection.go new file mode 100644 index 000000000000..16408efbdec8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/id_privateendpointconnection.go @@ -0,0 +1,137 @@ +package privateendpointconnection + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = PrivateEndpointConnectionId{} + +// PrivateEndpointConnectionId is a struct representing the Resource ID for a Private Endpoint Connection +type PrivateEndpointConnectionId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + PrivateEndpointConnectionName string +} + +// NewPrivateEndpointConnectionID returns a new PrivateEndpointConnectionId struct +func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, accountName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { + return PrivateEndpointConnectionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + PrivateEndpointConnectionName: privateEndpointConnectionName, + } +} + +// ParsePrivateEndpointConnectionID parses 'input' into a PrivateEndpointConnectionId +func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrivateEndpointConnectionId{} + + 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { + return nil, fmt.Errorf("the segment 'privateEndpointConnectionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParsePrivateEndpointConnectionIDInsensitively parses 'input' case-insensitively into a PrivateEndpointConnectionId +// note: this method should only be used for API response data and not user input +func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrivateEndpointConnectionId{} + + 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { + return nil, fmt.Errorf("the segment 'privateEndpointConnectionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID +func ValidatePrivateEndpointConnectionID(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 := ParsePrivateEndpointConnectionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Purview/accounts/%s/privateEndpointConnections/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PrivateEndpointConnectionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) 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("staticMicrosoftPurview", "Microsoft.Purview", "Microsoft.Purview"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticPrivateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), + resourceids.UserSpecifiedSegment("privateEndpointConnectionName", "privateEndpointConnectionValue"), + } +} + +// String returns a human-readable description of this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Private Endpoint Connection Name: %q", id.PrivateEndpointConnectionName), + } + return fmt.Sprintf("Private Endpoint Connection (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/method_createorupdate_autorest.go new file mode 100644 index 000000000000..abf3a7f285dc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package privateendpointconnection + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c PrivateEndpointConnectionClient) CreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnection.PrivateEndpointConnectionClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnection.PrivateEndpointConnectionClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c PrivateEndpointConnectionClient) CreateOrUpdateThenPoll(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c PrivateEndpointConnectionClient) preparerForCreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateEndpointConnectionClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/method_delete_autorest.go new file mode 100644 index 000000000000..7e8532d71b79 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/method_delete_autorest.go @@ -0,0 +1,78 @@ +package privateendpointconnection + +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 DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c PrivateEndpointConnectionClient) Delete(ctx context.Context, id PrivateEndpointConnectionId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnection.PrivateEndpointConnectionClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnection.PrivateEndpointConnectionClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c PrivateEndpointConnectionClient) DeleteThenPoll(ctx context.Context, id PrivateEndpointConnectionId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c PrivateEndpointConnectionClient) preparerForDelete(ctx context.Context, id PrivateEndpointConnectionId) (*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)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateEndpointConnectionClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, 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/purview/2021-07-01/privateendpointconnection/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/method_get_autorest.go new file mode 100644 index 000000000000..51fcf2168f77 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/method_get_autorest.go @@ -0,0 +1,68 @@ +package privateendpointconnection + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *PrivateEndpointConnection +} + +// Get ... +func (c PrivateEndpointConnectionClient) Get(ctx context.Context, id PrivateEndpointConnectionId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnection.PrivateEndpointConnectionClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnection.PrivateEndpointConnectionClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnection.PrivateEndpointConnectionClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c PrivateEndpointConnectionClient) preparerForGet(ctx context.Context, id PrivateEndpointConnectionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c PrivateEndpointConnectionClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/method_listbyaccount_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/method_listbyaccount_autorest.go new file mode 100644 index 000000000000..b92bf6f64785 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/method_listbyaccount_autorest.go @@ -0,0 +1,186 @@ +package privateendpointconnection + +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 ListByAccountOperationResponse struct { + HttpResponse *http.Response + Model *[]PrivateEndpointConnection + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByAccountOperationResponse, error) +} + +type ListByAccountCompleteResult struct { + Items []PrivateEndpointConnection +} + +func (r ListByAccountOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByAccountOperationResponse) LoadMore(ctx context.Context) (resp ListByAccountOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByAccount ... +func (c PrivateEndpointConnectionClient) ListByAccount(ctx context.Context, id AccountId) (resp ListByAccountOperationResponse, err error) { + req, err := c.preparerForListByAccount(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnection.PrivateEndpointConnectionClient", "ListByAccount", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnection.PrivateEndpointConnectionClient", "ListByAccount", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByAccount(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnection.PrivateEndpointConnectionClient", "ListByAccount", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByAccount prepares the ListByAccount request. +func (c PrivateEndpointConnectionClient) preparerForListByAccount(ctx context.Context, id AccountId) (*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/privateEndpointConnections", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByAccountWithNextLink prepares the ListByAccount request with the given nextLink token. +func (c PrivateEndpointConnectionClient) preparerForListByAccountWithNextLink(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)) +} + +// responderForListByAccount handles the response to the ListByAccount request. The method always +// closes the http.Response Body. +func (c PrivateEndpointConnectionClient) responderForListByAccount(resp *http.Response) (result ListByAccountOperationResponse, err error) { + type page struct { + Values []PrivateEndpointConnection `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 ListByAccountOperationResponse, err error) { + req, err := c.preparerForListByAccountWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnection.PrivateEndpointConnectionClient", "ListByAccount", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnection.PrivateEndpointConnectionClient", "ListByAccount", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByAccount(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnection.PrivateEndpointConnectionClient", "ListByAccount", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByAccountComplete retrieves all of the results into a single object +func (c PrivateEndpointConnectionClient) ListByAccountComplete(ctx context.Context, id AccountId) (ListByAccountCompleteResult, error) { + return c.ListByAccountCompleteMatchingPredicate(ctx, id, PrivateEndpointConnectionOperationPredicate{}) +} + +// ListByAccountCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c PrivateEndpointConnectionClient) ListByAccountCompleteMatchingPredicate(ctx context.Context, id AccountId, predicate PrivateEndpointConnectionOperationPredicate) (resp ListByAccountCompleteResult, err error) { + items := make([]PrivateEndpointConnection, 0) + + page, err := c.ListByAccount(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 := ListByAccountCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/model_privateendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/model_privateendpoint.go new file mode 100644 index 000000000000..36d044c72d1c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/model_privateendpoint.go @@ -0,0 +1,8 @@ +package privateendpointconnection + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/model_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/model_privateendpointconnection.go new file mode 100644 index 000000000000..7fb860b2d423 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/model_privateendpointconnection.go @@ -0,0 +1,11 @@ +package privateendpointconnection + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/model_privateendpointconnectionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/model_privateendpointconnectionproperties.go new file mode 100644 index 000000000000..a18f3f42875f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/model_privateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package privateendpointconnection + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/model_privatelinkserviceconnectionstate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/model_privatelinkserviceconnectionstate.go new file mode 100644 index 000000000000..5b963a7c3be4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package privateendpointconnection + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status *Status `json:"status,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/predicates.go new file mode 100644 index 000000000000..c056b72ccc8a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/predicates.go @@ -0,0 +1,24 @@ +package privateendpointconnection + +type PrivateEndpointConnectionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p PrivateEndpointConnectionOperationPredicate) Matches(input PrivateEndpointConnection) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/version.go new file mode 100644 index 000000000000..85b4b20f0805 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection/version.go @@ -0,0 +1,12 @@ +package privateendpointconnection + +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-07-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/privateendpointconnection/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/README.md new file mode 100644 index 000000000000..9cb8e2162d70 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/README.md @@ -0,0 +1,90 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections` Documentation + +The `privateendpointconnections` SDK allows for interaction with the Azure Resource Manager Service `search` (API Version `2020-03-13`). + +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/search/2020-03-13/privateendpointconnections" +``` + + +### Client Initialization + +```go +client := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Delete` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "searchServiceValue", "privateEndpointConnectionValue") + +read, err := client.Delete(ctx, id, privateendpointconnections.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Get` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "searchServiceValue", "privateEndpointConnectionValue") + +read, err := client.Get(ctx, id, privateendpointconnections.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.ListByService` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewSearchServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "searchServiceValue") + +// alternatively `client.ListByService(ctx, id, privateendpointconnections.DefaultListByServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListByServiceComplete(ctx, id, privateendpointconnections.DefaultListByServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Update` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "searchServiceValue", "privateEndpointConnectionValue") + +payload := privateendpointconnections.PrivateEndpointConnection{ + // ... +} + + +read, err := client.Update(ctx, id, payload, privateendpointconnections.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/client.go new file mode 100644 index 000000000000..1de584406fe4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/client.go @@ -0,0 +1,18 @@ +package privateendpointconnections + +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 PrivateEndpointConnectionsClient struct { + Client autorest.Client + baseUri string +} + +func NewPrivateEndpointConnectionsClientWithBaseURI(endpoint string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/constants.go new file mode 100644 index 000000000000..772d1217989c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/constants.go @@ -0,0 +1,40 @@ +package privateendpointconnections + +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 PrivateLinkServiceConnectionStatus string + +const ( + PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" + PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" + PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" + PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateLinkServiceConnectionStatus() []string { + return []string{ + string(PrivateLinkServiceConnectionStatusApproved), + string(PrivateLinkServiceConnectionStatusDisconnected), + string(PrivateLinkServiceConnectionStatusPending), + string(PrivateLinkServiceConnectionStatusRejected), + } +} + +func parsePrivateLinkServiceConnectionStatus(input string) (*PrivateLinkServiceConnectionStatus, error) { + vals := map[string]PrivateLinkServiceConnectionStatus{ + "approved": PrivateLinkServiceConnectionStatusApproved, + "disconnected": PrivateLinkServiceConnectionStatusDisconnected, + "pending": PrivateLinkServiceConnectionStatusPending, + "rejected": PrivateLinkServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkServiceConnectionStatus(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/id_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/id_privateendpointconnection.go new file mode 100644 index 000000000000..ad067c5946da --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/id_privateendpointconnection.go @@ -0,0 +1,137 @@ +package privateendpointconnections + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = PrivateEndpointConnectionId{} + +// PrivateEndpointConnectionId is a struct representing the Resource ID for a Private Endpoint Connection +type PrivateEndpointConnectionId struct { + SubscriptionId string + ResourceGroupName string + SearchServiceName string + PrivateEndpointConnectionName string +} + +// NewPrivateEndpointConnectionID returns a new PrivateEndpointConnectionId struct +func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, searchServiceName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { + return PrivateEndpointConnectionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SearchServiceName: searchServiceName, + PrivateEndpointConnectionName: privateEndpointConnectionName, + } +} + +// ParsePrivateEndpointConnectionID parses 'input' into a PrivateEndpointConnectionId +func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrivateEndpointConnectionId{} + + 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'searchServiceName' was not found in the resource id %q", input) + } + + if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { + return nil, fmt.Errorf("the segment 'privateEndpointConnectionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParsePrivateEndpointConnectionIDInsensitively parses 'input' case-insensitively into a PrivateEndpointConnectionId +// note: this method should only be used for API response data and not user input +func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrivateEndpointConnectionId{} + + 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'searchServiceName' was not found in the resource id %q", input) + } + + if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { + return nil, fmt.Errorf("the segment 'privateEndpointConnectionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID +func ValidatePrivateEndpointConnectionID(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 := ParsePrivateEndpointConnectionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Search/searchServices/%s/privateEndpointConnections/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SearchServiceName, id.PrivateEndpointConnectionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) 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("staticMicrosoftSearch", "Microsoft.Search", "Microsoft.Search"), + resourceids.StaticSegment("staticSearchServices", "searchServices", "searchServices"), + resourceids.UserSpecifiedSegment("searchServiceName", "searchServiceValue"), + resourceids.StaticSegment("staticPrivateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), + resourceids.UserSpecifiedSegment("privateEndpointConnectionName", "privateEndpointConnectionValue"), + } +} + +// String returns a human-readable description of this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Search Service Name: %q", id.SearchServiceName), + fmt.Sprintf("Private Endpoint Connection Name: %q", id.PrivateEndpointConnectionName), + } + return fmt.Sprintf("Private Endpoint Connection (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/id_searchservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/id_searchservice.go new file mode 100644 index 000000000000..c20574faed62 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/id_searchservice.go @@ -0,0 +1,124 @@ +package privateendpointconnections + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SearchServiceId{} + +// SearchServiceId is a struct representing the Resource ID for a Search Service +type SearchServiceId struct { + SubscriptionId string + ResourceGroupName string + SearchServiceName string +} + +// NewSearchServiceID returns a new SearchServiceId struct +func NewSearchServiceID(subscriptionId string, resourceGroupName string, searchServiceName string) SearchServiceId { + return SearchServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SearchServiceName: searchServiceName, + } +} + +// ParseSearchServiceID parses 'input' into a SearchServiceId +func ParseSearchServiceID(input string) (*SearchServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(SearchServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SearchServiceId{} + + 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'searchServiceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSearchServiceIDInsensitively parses 'input' case-insensitively into a SearchServiceId +// note: this method should only be used for API response data and not user input +func ParseSearchServiceIDInsensitively(input string) (*SearchServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(SearchServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SearchServiceId{} + + 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'searchServiceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSearchServiceID checks that 'input' can be parsed as a Search Service ID +func ValidateSearchServiceID(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 := ParseSearchServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Search Service ID +func (id SearchServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Search/searchServices/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SearchServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Search Service ID +func (id SearchServiceId) 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("staticMicrosoftSearch", "Microsoft.Search", "Microsoft.Search"), + resourceids.StaticSegment("staticSearchServices", "searchServices", "searchServices"), + resourceids.UserSpecifiedSegment("searchServiceName", "searchServiceValue"), + } +} + +// String returns a human-readable description of this Search Service ID +func (id SearchServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Search Service Name: %q", id.SearchServiceName), + } + return fmt.Sprintf("Search Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/method_delete_autorest.go new file mode 100644 index 000000000000..3ed6ff5ef38c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/method_delete_autorest.go @@ -0,0 +1,97 @@ +package privateendpointconnections + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + Model *PrivateEndpointConnection +} + +type DeleteOperationOptions struct { + XMsClientRequestId *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.XMsClientRequestId != nil { + out["x-ms-client-request-id"] = *o.XMsClientRequestId + } + + return out +} + +func (o DeleteOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Delete ... +func (c PrivateEndpointConnectionsClient) Delete(ctx context.Context, id PrivateEndpointConnectionId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c PrivateEndpointConnectionsClient) preparerForDelete(ctx context.Context, id PrivateEndpointConnectionId, options DeleteOperationOptions) (*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.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c PrivateEndpointConnectionsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, 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/search/2020-03-13/privateendpointconnections/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/method_get_autorest.go new file mode 100644 index 000000000000..9fb94d223e63 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/method_get_autorest.go @@ -0,0 +1,97 @@ +package privateendpointconnections + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *PrivateEndpointConnection +} + +type GetOperationOptions struct { + XMsClientRequestId *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.XMsClientRequestId != nil { + out["x-ms-client-request-id"] = *o.XMsClientRequestId + } + + return out +} + +func (o GetOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Get ... +func (c PrivateEndpointConnectionsClient) Get(ctx context.Context, id PrivateEndpointConnectionId, options GetOperationOptions) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c PrivateEndpointConnectionsClient) preparerForGet(ctx context.Context, id PrivateEndpointConnectionId, options GetOperationOptions) (*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(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c PrivateEndpointConnectionsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/method_listbyservice_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/method_listbyservice_autorest.go new file mode 100644 index 000000000000..4a85663a47ab --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/method_listbyservice_autorest.go @@ -0,0 +1,215 @@ +package privateendpointconnections + +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 ListByServiceOperationResponse struct { + HttpResponse *http.Response + Model *[]PrivateEndpointConnection + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) +} + +type ListByServiceCompleteResult struct { + Items []PrivateEndpointConnection +} + +func (r ListByServiceOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByServiceOperationOptions struct { + XMsClientRequestId *string +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.XMsClientRequestId != nil { + out["x-ms-client-request-id"] = *o.XMsClientRequestId + } + + return out +} + +func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// ListByService ... +func (c PrivateEndpointConnectionsClient) ListByService(ctx context.Context, id SearchServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { + req, err := c.preparerForListByService(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByService", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByService", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByService(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByService", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByService prepares the ListByService request. +func (c PrivateEndpointConnectionsClient) preparerForListByService(ctx context.Context, id SearchServiceId, options ListByServiceOperationOptions) (*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/privateEndpointConnections", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. +func (c PrivateEndpointConnectionsClient) preparerForListByServiceWithNextLink(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)) +} + +// responderForListByService handles the response to the ListByService request. The method always +// closes the http.Response Body. +func (c PrivateEndpointConnectionsClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { + type page struct { + Values []PrivateEndpointConnection `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 ListByServiceOperationResponse, err error) { + req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByService", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByService", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByService(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByService", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByServiceComplete retrieves all of the results into a single object +func (c PrivateEndpointConnectionsClient) ListByServiceComplete(ctx context.Context, id SearchServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, PrivateEndpointConnectionOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c PrivateEndpointConnectionsClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id SearchServiceId, options ListByServiceOperationOptions, predicate PrivateEndpointConnectionOperationPredicate) (resp ListByServiceCompleteResult, err error) { + items := make([]PrivateEndpointConnection, 0) + + page, err := c.ListByService(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 := ListByServiceCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/method_update_autorest.go new file mode 100644 index 000000000000..f1f94dff5a4e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/method_update_autorest.go @@ -0,0 +1,98 @@ +package privateendpointconnections + +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 UpdateOperationResponse struct { + HttpResponse *http.Response + Model *PrivateEndpointConnection +} + +type UpdateOperationOptions struct { + XMsClientRequestId *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.XMsClientRequestId != nil { + out["x-ms-client-request-id"] = *o.XMsClientRequestId + } + + return out +} + +func (o UpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Update ... +func (c PrivateEndpointConnectionsClient) Update(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c PrivateEndpointConnectionsClient) preparerForUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection, options UpdateOperationOptions) (*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.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c PrivateEndpointConnectionsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/model_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/model_privateendpointconnection.go new file mode 100644 index 000000000000..fde7f4db0fc0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/model_privateendpointconnection.go @@ -0,0 +1,11 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/model_privateendpointconnectionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/model_privateendpointconnectionproperties.go new file mode 100644 index 000000000000..0bff074bb00e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/model_privateendpointconnectionproperties.go @@ -0,0 +1,9 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpointConnectionPropertiesPrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/model_privateendpointconnectionpropertiesprivateendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/model_privateendpointconnectionpropertiesprivateendpoint.go new file mode 100644 index 000000000000..f4bbf6f4340b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/model_privateendpointconnectionpropertiesprivateendpoint.go @@ -0,0 +1,8 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionPropertiesPrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/model_privateendpointconnectionpropertiesprivatelinkserviceconnectionstate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/model_privateendpointconnectionpropertiesprivatelinkserviceconnectionstate.go new file mode 100644 index 000000000000..b3208efc0df0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/model_privateendpointconnectionpropertiesprivatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status *PrivateLinkServiceConnectionStatus `json:"status,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/predicates.go new file mode 100644 index 000000000000..1e847cf7d766 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/predicates.go @@ -0,0 +1,24 @@ +package privateendpointconnections + +type PrivateEndpointConnectionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p PrivateEndpointConnectionOperationPredicate) Matches(input PrivateEndpointConnection) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/version.go new file mode 100644 index 000000000000..473966ef92da --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections/version.go @@ -0,0 +1,12 @@ +package privateendpointconnections + +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 = "2020-03-13" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/privateendpointconnections/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index b76d6c904dcf..f2b69611e8da 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -198,6 +198,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/hybridr github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/hybridrunbookworkergroup github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts +github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/privateendpointconnections github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups @@ -267,6 +268,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules +github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/privateendpointconnections github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource @@ -304,6 +306,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servera github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases @@ -315,11 +318,13 @@ github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/private github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account +github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys +github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/privateendpointconnections github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-08-01/sharedprivatelinkresources diff --git a/website/docs/r/synapse_managed_private_endpoint.html.markdown b/website/docs/r/synapse_managed_private_endpoint.html.markdown index 1d837b55f0e0..bb8365f008e8 100644 --- a/website/docs/r/synapse_managed_private_endpoint.html.markdown +++ b/website/docs/r/synapse_managed_private_endpoint.html.markdown @@ -89,6 +89,10 @@ The following arguments are supported: -> **NOTE:** Possible values are listed in [documentation](https://docs.microsoft.com/azure/private-link/private-endpoint-overview#dns-configuration). +* `is_manual_connection` - (Optional) When `false`, Terraform will automatically approve the private endpoint associated with the target resource. Changing this forces a new resource to be created. Defaults to `true`. + +-> **NOTE:** Not all providers support automated approval of managed private endpoints. Additionally, target resources must be configured to support the creation of private endpoints. For example: `Microsoft.Cognitive` resources must define a custom subdomain name, `Microsoft.DBforMariaDB`, `Microsoft.DBforMySQL`, and `Microsoft.DBforPostgreSQL` resources must use a `GeneralPurpose` or `MemoryOptimized` tier SKU. + ## Attributes Reference The following attributes are exported: