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

Add support for Beyondcorp AppConnector resource #13011

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changelog/6801.txt
@@ -0,0 +1,6 @@
```release-note:new-resource
`google_beyondcorp_app_connector`
```
```release-note:new-resource
`google_beyondcorp_app_gateway`
```
75 changes: 75 additions & 0 deletions google/beyondcorp_operation.go
@@ -0,0 +1,75 @@
// ----------------------------------------------------------------------------
//
// *** AUTO GENERATED CODE *** Type: MMv1 ***
//
// ----------------------------------------------------------------------------
//
// This file is automatically generated by Magic Modules and manual
// changes will be clobbered when the file is regenerated.
//
// Please read more about how to change this file in
// .github/CONTRIBUTING.md.
//
// ----------------------------------------------------------------------------

package google

import (
"encoding/json"
"fmt"
"time"
)

type BeyondcorpOperationWaiter struct {
Config *Config
UserAgent string
Project string
CommonOperationWaiter
}

func (w *BeyondcorpOperationWaiter) QueryOp() (interface{}, error) {
if w == nil {
return nil, fmt.Errorf("Cannot query operation, it's unset or nil.")
}
// Returns the proper get.
url := fmt.Sprintf("%s%s", w.Config.BeyondcorpBasePath, w.CommonOperationWaiter.Op.Name)

return sendRequest(w.Config, "GET", w.Project, url, w.UserAgent, nil)
}

func createBeyondcorpWaiter(config *Config, op map[string]interface{}, project, activity, userAgent string) (*BeyondcorpOperationWaiter, error) {
w := &BeyondcorpOperationWaiter{
Config: config,
UserAgent: userAgent,
Project: project,
}
if err := w.CommonOperationWaiter.SetOp(op); err != nil {
return nil, err
}
return w, nil
}

// nolint: deadcode,unused
func beyondcorpOperationWaitTimeWithResponse(config *Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
w, err := createBeyondcorpWaiter(config, op, project, activity, userAgent)
if err != nil {
return err
}
if err := OperationWait(w, activity, timeout, config.PollInterval); err != nil {
return err
}
return json.Unmarshal([]byte(w.CommonOperationWaiter.Op.Response), response)
}

func beyondcorpOperationWaitTime(config *Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
if val, ok := op["name"]; !ok || val == "" {
// This was a synchronous call - there is no operation to wait for.
return nil
}
w, err := createBeyondcorpWaiter(config, op, project, activity, userAgent)
if err != nil {
// If w is nil, the op was synchronous.
return err
}
return OperationWait(w, activity, timeout, config.PollInterval)
}
4 changes: 4 additions & 0 deletions google/config.go
Expand Up @@ -177,6 +177,7 @@ type Config struct {
ApigeeBasePath string
AppEngineBasePath string
ArtifactRegistryBasePath string
BeyondcorpBasePath string
BigQueryBasePath string
BigqueryAnalyticsHubBasePath string
BigqueryConnectionBasePath string
Expand Down Expand Up @@ -274,6 +275,7 @@ const ActiveDirectoryBasePathKey = "ActiveDirectory"
const ApigeeBasePathKey = "Apigee"
const AppEngineBasePathKey = "AppEngine"
const ArtifactRegistryBasePathKey = "ArtifactRegistry"
const BeyondcorpBasePathKey = "Beyondcorp"
const BigQueryBasePathKey = "BigQuery"
const BigqueryAnalyticsHubBasePathKey = "BigqueryAnalyticsHub"
const BigqueryConnectionBasePathKey = "BigqueryConnection"
Expand Down Expand Up @@ -365,6 +367,7 @@ var DefaultBasePaths = map[string]string{
ApigeeBasePathKey: "https://apigee.googleapis.com/v1/",
AppEngineBasePathKey: "https://appengine.googleapis.com/v1/",
ArtifactRegistryBasePathKey: "https://artifactregistry.googleapis.com/v1/",
BeyondcorpBasePathKey: "https://beyondcorp.googleapis.com/v1/",
BigQueryBasePathKey: "https://bigquery.googleapis.com/bigquery/v2/",
BigqueryAnalyticsHubBasePathKey: "https://analyticshub.googleapis.com/v1/",
BigqueryConnectionBasePathKey: "https://bigqueryconnection.googleapis.com/v1/",
Expand Down Expand Up @@ -1218,6 +1221,7 @@ func ConfigureBasePaths(c *Config) {
c.ApigeeBasePath = DefaultBasePaths[ApigeeBasePathKey]
c.AppEngineBasePath = DefaultBasePaths[AppEngineBasePathKey]
c.ArtifactRegistryBasePath = DefaultBasePaths[ArtifactRegistryBasePathKey]
c.BeyondcorpBasePath = DefaultBasePaths[BeyondcorpBasePathKey]
c.BigQueryBasePath = DefaultBasePaths[BigQueryBasePathKey]
c.BigqueryAnalyticsHubBasePath = DefaultBasePaths[BigqueryAnalyticsHubBasePathKey]
c.BigqueryConnectionBasePath = DefaultBasePaths[BigqueryConnectionBasePathKey]
Expand Down
15 changes: 13 additions & 2 deletions google/provider.go
Expand Up @@ -197,6 +197,14 @@ func Provider() *schema.Provider {
"GOOGLE_ARTIFACT_REGISTRY_CUSTOM_ENDPOINT",
}, DefaultBasePaths[ArtifactRegistryBasePathKey]),
},
"beyondcorp_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateCustomEndpoint,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
"GOOGLE_BEYONDCORP_CUSTOM_ENDPOINT",
}, DefaultBasePaths[BeyondcorpBasePathKey]),
},
"big_query_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -917,9 +925,9 @@ func Provider() *schema.Provider {
return provider
}

// Generated resources: 246
// Generated resources: 248
// Generated IAM resources: 150
// Total generated resources: 396
// Total generated resources: 398
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -966,6 +974,8 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_artifact_registry_repository_iam_binding": ResourceIamBinding(ArtifactRegistryRepositoryIamSchema, ArtifactRegistryRepositoryIamUpdaterProducer, ArtifactRegistryRepositoryIdParseFunc),
"google_artifact_registry_repository_iam_member": ResourceIamMember(ArtifactRegistryRepositoryIamSchema, ArtifactRegistryRepositoryIamUpdaterProducer, ArtifactRegistryRepositoryIdParseFunc),
"google_artifact_registry_repository_iam_policy": ResourceIamPolicy(ArtifactRegistryRepositoryIamSchema, ArtifactRegistryRepositoryIamUpdaterProducer, ArtifactRegistryRepositoryIdParseFunc),
"google_beyondcorp_app_connector": resourceBeyondcorpAppConnector(),
"google_beyondcorp_app_gateway": resourceBeyondcorpAppGateway(),
"google_bigquery_dataset": resourceBigQueryDataset(),
"google_bigquery_dataset_access": resourceBigQueryDatasetAccess(),
"google_bigquery_job": resourceBigQueryJob(),
Expand Down Expand Up @@ -1541,6 +1551,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.ApigeeBasePath = d.Get("apigee_custom_endpoint").(string)
config.AppEngineBasePath = d.Get("app_engine_custom_endpoint").(string)
config.ArtifactRegistryBasePath = d.Get("artifact_registry_custom_endpoint").(string)
config.BeyondcorpBasePath = d.Get("beyondcorp_custom_endpoint").(string)
config.BigQueryBasePath = d.Get("big_query_custom_endpoint").(string)
config.BigqueryAnalyticsHubBasePath = d.Get("bigquery_analytics_hub_custom_endpoint").(string)
config.BigqueryConnectionBasePath = d.Get("bigquery_connection_custom_endpoint").(string)
Expand Down