Skip to content

Commit 4228df6

Browse files
Cloud Domains Registration (#9772) (#6833)
[upstream:52434b30324b0b85d26383a7c433a027427da250] Signed-off-by: Modular Magician <[email protected]>
1 parent cd5d893 commit 4228df6

File tree

12 files changed

+2639
-2
lines changed

12 files changed

+2639
-2
lines changed

.changelog/9772.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:new-resource
2+
`google_clouddomains_registration`
3+
```

.teamcity/components/generated/services.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ var services = mapOf(
141141
"displayName" to "Clouddeploy",
142142
"path" to "./google-beta/services/clouddeploy"
143143
),
144+
"clouddomains" to mapOf(
145+
"name" to "clouddomains",
146+
"displayName" to "Clouddomains",
147+
"path" to "./google-beta/services/clouddomains"
148+
),
144149
"cloudfunctions" to mapOf(
145150
"name" to "cloudfunctions",
146151
"displayName" to "Cloudfunctions",

google-beta/fwmodels/provider_model.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ type ProviderModel struct {
5151
CloudBuildCustomEndpoint types.String `tfsdk:"cloud_build_custom_endpoint"`
5252
Cloudbuildv2CustomEndpoint types.String `tfsdk:"cloudbuildv2_custom_endpoint"`
5353
ClouddeployCustomEndpoint types.String `tfsdk:"clouddeploy_custom_endpoint"`
54+
ClouddomainsCustomEndpoint types.String `tfsdk:"clouddomains_custom_endpoint"`
5455
CloudFunctionsCustomEndpoint types.String `tfsdk:"cloud_functions_custom_endpoint"`
5556
Cloudfunctions2CustomEndpoint types.String `tfsdk:"cloudfunctions2_custom_endpoint"`
5657
CloudIdentityCustomEndpoint types.String `tfsdk:"cloud_identity_custom_endpoint"`

google-beta/fwprovider/framework_provider.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,12 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest,
287287
transport_tpg.CustomEndpointValidator(),
288288
},
289289
},
290+
"clouddomains_custom_endpoint": &schema.StringAttribute{
291+
Optional: true,
292+
Validators: []validator.String{
293+
transport_tpg.CustomEndpointValidator(),
294+
},
295+
},
290296
"cloud_functions_custom_endpoint": &schema.StringAttribute{
291297
Optional: true,
292298
Validators: []validator.String{

google-beta/fwtransport/framework_config.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ type FrameworkProviderConfig struct {
7676
CloudBuildBasePath string
7777
Cloudbuildv2BasePath string
7878
ClouddeployBasePath string
79+
ClouddomainsBasePath string
7980
CloudFunctionsBasePath string
8081
Cloudfunctions2BasePath string
8182
CloudIdentityBasePath string
@@ -235,6 +236,7 @@ func (p *FrameworkProviderConfig) LoadAndValidateFramework(ctx context.Context,
235236
p.CloudBuildBasePath = data.CloudBuildCustomEndpoint.ValueString()
236237
p.Cloudbuildv2BasePath = data.Cloudbuildv2CustomEndpoint.ValueString()
237238
p.ClouddeployBasePath = data.ClouddeployCustomEndpoint.ValueString()
239+
p.ClouddomainsBasePath = data.ClouddomainsCustomEndpoint.ValueString()
238240
p.CloudFunctionsBasePath = data.CloudFunctionsCustomEndpoint.ValueString()
239241
p.Cloudfunctions2BasePath = data.Cloudfunctions2CustomEndpoint.ValueString()
240242
p.CloudIdentityBasePath = data.CloudIdentityCustomEndpoint.ValueString()
@@ -657,6 +659,14 @@ func (p *FrameworkProviderConfig) HandleDefaults(ctx context.Context, data *fwmo
657659
data.ClouddeployCustomEndpoint = types.StringValue(customEndpoint.(string))
658660
}
659661
}
662+
if data.ClouddomainsCustomEndpoint.IsNull() {
663+
customEndpoint := transport_tpg.MultiEnvDefault([]string{
664+
"GOOGLE_CLOUDDOMAINS_CUSTOM_ENDPOINT",
665+
}, transport_tpg.DefaultBasePaths[transport_tpg.ClouddomainsBasePathKey])
666+
if customEndpoint != nil {
667+
data.ClouddomainsCustomEndpoint = types.StringValue(customEndpoint.(string))
668+
}
669+
}
660670
if data.CloudFunctionsCustomEndpoint.IsNull() {
661671
customEndpoint := transport_tpg.MultiEnvDefault([]string{
662672
"GOOGLE_CLOUD_FUNCTIONS_CUSTOM_ENDPOINT",

google-beta/provider/provider.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,11 @@ func Provider() *schema.Provider {
260260
Optional: true,
261261
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
262262
},
263+
"clouddomains_custom_endpoint": {
264+
Type: schema.TypeString,
265+
Optional: true,
266+
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
267+
},
263268
"cloud_functions_custom_endpoint": {
264269
Type: schema.TypeString,
265270
Optional: true,
@@ -961,6 +966,7 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
961966
config.CloudBuildBasePath = d.Get("cloud_build_custom_endpoint").(string)
962967
config.Cloudbuildv2BasePath = d.Get("cloudbuildv2_custom_endpoint").(string)
963968
config.ClouddeployBasePath = d.Get("clouddeploy_custom_endpoint").(string)
969+
config.ClouddomainsBasePath = d.Get("clouddomains_custom_endpoint").(string)
964970
config.CloudFunctionsBasePath = d.Get("cloud_functions_custom_endpoint").(string)
965971
config.Cloudfunctions2BasePath = d.Get("cloudfunctions2_custom_endpoint").(string)
966972
config.CloudIdentityBasePath = d.Get("cloud_identity_custom_endpoint").(string)

google-beta/provider/provider_mmv1_resources.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/cloudbuild"
3131
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/cloudbuildv2"
3232
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/clouddeploy"
33+
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/clouddomains"
3334
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/cloudfunctions"
3435
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/cloudfunctions2"
3536
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/cloudidentity"
@@ -421,9 +422,9 @@ var handwrittenIAMDatasources = map[string]*schema.Resource{
421422
}
422423

423424
// Resources
424-
// Generated resources: 417
425+
// Generated resources: 418
425426
// Generated IAM resources: 252
426-
// Total generated resources: 669
427+
// Total generated resources: 670
427428
var generatedResources = map[string]*schema.Resource{
428429
"google_folder_access_approval_settings": accessapproval.ResourceAccessApprovalFolderSettings(),
429430
"google_organization_access_approval_settings": accessapproval.ResourceAccessApprovalOrganizationSettings(),
@@ -548,6 +549,7 @@ var generatedResources = map[string]*schema.Resource{
548549
"google_cloudbuildv2_connection_iam_member": tpgiamresource.ResourceIamMember(cloudbuildv2.Cloudbuildv2ConnectionIamSchema, cloudbuildv2.Cloudbuildv2ConnectionIamUpdaterProducer, cloudbuildv2.Cloudbuildv2ConnectionIdParseFunc),
549550
"google_cloudbuildv2_connection_iam_policy": tpgiamresource.ResourceIamPolicy(cloudbuildv2.Cloudbuildv2ConnectionIamSchema, cloudbuildv2.Cloudbuildv2ConnectionIamUpdaterProducer, cloudbuildv2.Cloudbuildv2ConnectionIdParseFunc),
550551
"google_clouddeploy_automation": clouddeploy.ResourceClouddeployAutomation(),
552+
"google_clouddomains_registration": clouddomains.ResourceClouddomainsRegistration(),
551553
"google_cloudfunctions_function_iam_binding": tpgiamresource.ResourceIamBinding(cloudfunctions.CloudFunctionsCloudFunctionIamSchema, cloudfunctions.CloudFunctionsCloudFunctionIamUpdaterProducer, cloudfunctions.CloudFunctionsCloudFunctionIdParseFunc),
552554
"google_cloudfunctions_function_iam_member": tpgiamresource.ResourceIamMember(cloudfunctions.CloudFunctionsCloudFunctionIamSchema, cloudfunctions.CloudFunctionsCloudFunctionIamUpdaterProducer, cloudfunctions.CloudFunctionsCloudFunctionIdParseFunc),
553555
"google_cloudfunctions_function_iam_policy": tpgiamresource.ResourceIamPolicy(cloudfunctions.CloudFunctionsCloudFunctionIamSchema, cloudfunctions.CloudFunctionsCloudFunctionIamUpdaterProducer, cloudfunctions.CloudFunctionsCloudFunctionIdParseFunc),
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: MPL-2.0
3+
4+
// ----------------------------------------------------------------------------
5+
//
6+
// *** AUTO GENERATED CODE *** Type: MMv1 ***
7+
//
8+
// ----------------------------------------------------------------------------
9+
//
10+
// This file is automatically generated by Magic Modules and manual
11+
// changes will be clobbered when the file is regenerated.
12+
//
13+
// Please read more about how to change this file in
14+
// .github/CONTRIBUTING.md.
15+
//
16+
// ----------------------------------------------------------------------------
17+
18+
package clouddomains
19+
20+
import (
21+
"encoding/json"
22+
"errors"
23+
"fmt"
24+
"time"
25+
26+
"github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource"
27+
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
28+
)
29+
30+
type ClouddomainsOperationWaiter struct {
31+
Config *transport_tpg.Config
32+
UserAgent string
33+
Project string
34+
tpgresource.CommonOperationWaiter
35+
}
36+
37+
func (w *ClouddomainsOperationWaiter) QueryOp() (interface{}, error) {
38+
if w == nil {
39+
return nil, fmt.Errorf("Cannot query operation, it's unset or nil.")
40+
}
41+
// Returns the proper get.
42+
url := fmt.Sprintf("%s%s", w.Config.ClouddomainsBasePath, w.CommonOperationWaiter.Op.Name)
43+
44+
return transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
45+
Config: w.Config,
46+
Method: "GET",
47+
Project: w.Project,
48+
RawURL: url,
49+
UserAgent: w.UserAgent,
50+
})
51+
}
52+
53+
func createClouddomainsWaiter(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string) (*ClouddomainsOperationWaiter, error) {
54+
w := &ClouddomainsOperationWaiter{
55+
Config: config,
56+
UserAgent: userAgent,
57+
Project: project,
58+
}
59+
if err := w.CommonOperationWaiter.SetOp(op); err != nil {
60+
return nil, err
61+
}
62+
return w, nil
63+
}
64+
65+
// nolint: deadcode,unused
66+
func ClouddomainsOperationWaitTimeWithResponse(config *transport_tpg.Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
67+
w, err := createClouddomainsWaiter(config, op, project, activity, userAgent)
68+
if err != nil {
69+
return err
70+
}
71+
if err := tpgresource.OperationWait(w, activity, timeout, config.PollInterval); err != nil {
72+
return err
73+
}
74+
rawResponse := []byte(w.CommonOperationWaiter.Op.Response)
75+
if len(rawResponse) == 0 {
76+
return errors.New("`resource` not set in operation response")
77+
}
78+
return json.Unmarshal(rawResponse, response)
79+
}
80+
81+
func ClouddomainsOperationWaitTime(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
82+
if val, ok := op["name"]; !ok || val == "" {
83+
// This was a synchronous call - there is no operation to wait for.
84+
return nil
85+
}
86+
w, err := createClouddomainsWaiter(config, op, project, activity, userAgent)
87+
if err != nil {
88+
// If w is nil, the op was synchronous.
89+
return err
90+
}
91+
return tpgresource.OperationWait(w, activity, timeout, config.PollInterval)
92+
}

0 commit comments

Comments
 (0)