Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network Connectivity Hub #10812

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/5574.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
`google_network_connectivity_hub`
```
1 change: 1 addition & 0 deletions google/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ type Config struct {
GkeHubBasePath string
ContainerAzureBasePath string
ContainerAwsBasePath string
NetworkConnectivityBasePath string
OrgPolicyBasePath string
RecaptchaEnterpriseBasePath string
// CloudBuild WorkerPool uses a different endpoint (v1beta1) than any other CloudBuild resources
Expand Down
3 changes: 3 additions & 0 deletions google/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ func Provider() *schema.Provider {
CloudResourceManagerEndpointEntryKey: CloudResourceManagerEndpointEntry,
EventarcEndpointEntryKey: EventarcEndpointEntry,
GkeHubFeatureCustomEndpointEntryKey: GkeHubFeatureCustomEndpointEntry,
NetworkConnectivityEndpointEntryKey: NetworkConnectivityEndpointEntry,
OrgPolicyEndpointEntryKey: OrgPolicyEndpointEntry,
PrivatecaCertificateTemplateEndpointEntryKey: PrivatecaCertificateTemplateCustomEndpointEntry,
RecaptchaEnterpriseEndpointEntryKey: RecaptchaEnterpriseEndpointEntry,
Expand Down Expand Up @@ -1212,6 +1213,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_compute_firewall_policy_rule": resourceComputeFirewallPolicyRule(),
"google_dataproc_workflow_template": resourceDataprocWorkflowTemplate(),
"google_eventarc_trigger": resourceEventarcTrigger(),
"google_network_connectivity_hub": resourceNetworkConnectivityHub(),
"google_org_policy_policy": resourceOrgPolicyPolicy(),
"google_os_config_os_policy_assignment": resourceOSConfigOSPolicyAssignment(),
"google_privateca_certificate_template": resourcePrivatecaCertificateTemplate(),
Expand Down Expand Up @@ -1453,6 +1455,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.CloudResourceManagerBasePath = d.Get(CloudResourceManagerEndpointEntryKey).(string)
config.EventarcBasePath = d.Get(EventarcEndpointEntryKey).(string)
config.GkeHubBasePath = d.Get(GkeHubFeatureCustomEndpointEntryKey).(string)
config.NetworkConnectivityBasePath = d.Get(NetworkConnectivityEndpointEntryKey).(string)
config.OrgPolicyBasePath = d.Get(OrgPolicyEndpointEntryKey).(string)
config.PrivatecaBasePath = d.Get(PrivatecaCertificateTemplateEndpointEntryKey).(string)
config.ContainerAwsBasePath = d.Get(ContainerAwsCustomEndpointEntryKey).(string)
Expand Down
24 changes: 24 additions & 0 deletions google/provider_dcl_client_creation.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
containerazure "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/containerazure"
dataproc "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/dataproc"
eventarc "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/eventarc"
networkconnectivity "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/networkconnectivity"
orgpolicy "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/orgpolicy"
osconfig "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/osconfig"
privateca "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/privateca"
Expand Down Expand Up @@ -217,6 +218,29 @@ func NewDCLEventarcClient(config *Config, userAgent, billingProject string, time
return eventarc.NewClient(dclConfig)
}

func NewDCLNetworkConnectivityClient(config *Config, userAgent, billingProject string, timeout time.Duration) *networkconnectivity.Client {
configOptions := []dcl.ConfigOption{
dcl.WithHTTPClient(config.client),
dcl.WithUserAgent(userAgent),
dcl.WithLogger(dclLogger{}),
dcl.WithBasePath(config.NetworkConnectivityBasePath),
}

if timeout != 0 {
configOptions = append(configOptions, dcl.WithTimeout(timeout))
}

if config.UserProjectOverride {
configOptions = append(configOptions, dcl.WithUserProjectOverride())
if billingProject != "" {
configOptions = append(configOptions, dcl.WithBillingProject(billingProject))
}
}

dclConfig := dcl.NewConfig(configOptions...)
return networkconnectivity.NewClient(dclConfig)
}

func NewDCLOrgPolicyClient(config *Config, userAgent, billingProject string, timeout time.Duration) *orgpolicy.Client {
configOptions := []dcl.ConfigOption{
dcl.WithHTTPClient(config.client),
Expand Down
12 changes: 12 additions & 0 deletions google/provider_dcl_endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ var EventarcEndpointEntry = &schema.Schema{
}, ""),
}

var NetworkConnectivityEndpointEntryKey = "network_connectivity_custom_endpoint"
var NetworkConnectivityEndpointEntry = &schema.Schema{
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
"GOOGLE_NETWORK_CONNECTIVITY_CUSTOM_ENDPOINT",
}, ""),
}

var OrgPolicyEndpointEntryKey = "org_policy_custom_endpoint"
var OrgPolicyEndpointEntry = &schema.Schema{
Type: schema.TypeString,
Expand Down Expand Up @@ -129,6 +138,7 @@ var RecaptchaEnterpriseEndpointEntry = &schema.Schema{
//ContainerAwsBasePath string
//ContainerAzureBasePath string
//EventarcBasePath string
//NetworkConnectivityBasePath string
//OrgPolicyBasePath string
//OSConfigBasePath string
//PrivatecaBasePath string
Expand All @@ -142,6 +152,7 @@ var RecaptchaEnterpriseEndpointEntry = &schema.Schema{
// ContainerAwsEndpointEntryKey: ContainerAwsEndpointEntry,
// ContainerAzureEndpointEntryKey: ContainerAzureEndpointEntry,
// EventarcEndpointEntryKey: EventarcEndpointEntry,
// NetworkConnectivityEndpointEntryKey: NetworkConnectivityEndpointEntry,
// OrgPolicyEndpointEntryKey: OrgPolicyEndpointEntry,
// OSConfigEndpointEntryKey: OSConfigEndpointEntry,
// PrivatecaEndpointEntryKey: PrivatecaEndpointEntry,
Expand All @@ -155,6 +166,7 @@ var RecaptchaEnterpriseEndpointEntry = &schema.Schema{
// config.ContainerAwsBasePath = d.Get(ContainerAwsEndpointEntryKey).(string)
// config.ContainerAzureBasePath = d.Get(ContainerAzureEndpointEntryKey).(string)
// config.EventarcBasePath = d.Get(EventarcEndpointEntryKey).(string)
// config.NetworkConnectivityBasePath = d.Get(NetworkConnectivityEndpointEntryKey).(string)
// config.OrgPolicyBasePath = d.Get(OrgPolicyEndpointEntryKey).(string)
// config.OSConfigBasePath = d.Get(OSConfigEndpointEntryKey).(string)
// config.PrivatecaBasePath = d.Get(PrivatecaEndpointEntryKey).(string)
Expand Down
Loading