Skip to content

Commit 56aa6e4

Browse files
Cloud Domains Registration (#9772) (#16947)
[upstream:52434b30324b0b85d26383a7c433a027427da250] Signed-off-by: Modular Magician <[email protected]>
1 parent eb3388c commit 56aa6e4

File tree

12 files changed

+2639
-2
lines changed

12 files changed

+2639
-2
lines changed

.changelog/9772.txt

+3
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

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

google/fwmodels/provider_model.go

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ type ProviderModel struct {
4949
CloudBuildCustomEndpoint types.String `tfsdk:"cloud_build_custom_endpoint"`
5050
Cloudbuildv2CustomEndpoint types.String `tfsdk:"cloudbuildv2_custom_endpoint"`
5151
ClouddeployCustomEndpoint types.String `tfsdk:"clouddeploy_custom_endpoint"`
52+
ClouddomainsCustomEndpoint types.String `tfsdk:"clouddomains_custom_endpoint"`
5253
CloudFunctionsCustomEndpoint types.String `tfsdk:"cloud_functions_custom_endpoint"`
5354
Cloudfunctions2CustomEndpoint types.String `tfsdk:"cloudfunctions2_custom_endpoint"`
5455
CloudIdentityCustomEndpoint types.String `tfsdk:"cloud_identity_custom_endpoint"`

google/fwprovider/framework_provider.go

+6
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,12 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest,
274274
transport_tpg.CustomEndpointValidator(),
275275
},
276276
},
277+
"clouddomains_custom_endpoint": &schema.StringAttribute{
278+
Optional: true,
279+
Validators: []validator.String{
280+
transport_tpg.CustomEndpointValidator(),
281+
},
282+
},
277283
"cloud_functions_custom_endpoint": &schema.StringAttribute{
278284
Optional: true,
279285
Validators: []validator.String{

google/fwtransport/framework_config.go

+10
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ type FrameworkProviderConfig struct {
7474
CloudBuildBasePath string
7575
Cloudbuildv2BasePath string
7676
ClouddeployBasePath string
77+
ClouddomainsBasePath string
7778
CloudFunctionsBasePath string
7879
Cloudfunctions2BasePath string
7980
CloudIdentityBasePath string
@@ -220,6 +221,7 @@ func (p *FrameworkProviderConfig) LoadAndValidateFramework(ctx context.Context,
220221
p.CloudBuildBasePath = data.CloudBuildCustomEndpoint.ValueString()
221222
p.Cloudbuildv2BasePath = data.Cloudbuildv2CustomEndpoint.ValueString()
222223
p.ClouddeployBasePath = data.ClouddeployCustomEndpoint.ValueString()
224+
p.ClouddomainsBasePath = data.ClouddomainsCustomEndpoint.ValueString()
223225
p.CloudFunctionsBasePath = data.CloudFunctionsCustomEndpoint.ValueString()
224226
p.Cloudfunctions2BasePath = data.Cloudfunctions2CustomEndpoint.ValueString()
225227
p.CloudIdentityBasePath = data.CloudIdentityCustomEndpoint.ValueString()
@@ -615,6 +617,14 @@ func (p *FrameworkProviderConfig) HandleDefaults(ctx context.Context, data *fwmo
615617
data.ClouddeployCustomEndpoint = types.StringValue(customEndpoint.(string))
616618
}
617619
}
620+
if data.ClouddomainsCustomEndpoint.IsNull() {
621+
customEndpoint := transport_tpg.MultiEnvDefault([]string{
622+
"GOOGLE_CLOUDDOMAINS_CUSTOM_ENDPOINT",
623+
}, transport_tpg.DefaultBasePaths[transport_tpg.ClouddomainsBasePathKey])
624+
if customEndpoint != nil {
625+
data.ClouddomainsCustomEndpoint = types.StringValue(customEndpoint.(string))
626+
}
627+
}
618628
if data.CloudFunctionsCustomEndpoint.IsNull() {
619629
customEndpoint := transport_tpg.MultiEnvDefault([]string{
620630
"GOOGLE_CLOUD_FUNCTIONS_CUSTOM_ENDPOINT",

google/provider/provider.go

+6
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ func Provider() *schema.Provider {
250250
Optional: true,
251251
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
252252
},
253+
"clouddomains_custom_endpoint": {
254+
Type: schema.TypeString,
255+
Optional: true,
256+
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
257+
},
253258
"cloud_functions_custom_endpoint": {
254259
Type: schema.TypeString,
255260
Optional: true,
@@ -893,6 +898,7 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
893898
config.CloudBuildBasePath = d.Get("cloud_build_custom_endpoint").(string)
894899
config.Cloudbuildv2BasePath = d.Get("cloudbuildv2_custom_endpoint").(string)
895900
config.ClouddeployBasePath = d.Get("clouddeploy_custom_endpoint").(string)
901+
config.ClouddomainsBasePath = d.Get("clouddomains_custom_endpoint").(string)
896902
config.CloudFunctionsBasePath = d.Get("cloud_functions_custom_endpoint").(string)
897903
config.Cloudfunctions2BasePath = d.Get("cloudfunctions2_custom_endpoint").(string)
898904
config.CloudIdentityBasePath = d.Get("cloud_identity_custom_endpoint").(string)

google/provider/provider_mmv1_resources.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"github.com/hashicorp/terraform-provider-google/google/services/cloudasset"
2828
"github.com/hashicorp/terraform-provider-google/google/services/cloudbuild"
2929
"github.com/hashicorp/terraform-provider-google/google/services/cloudbuildv2"
30+
"github.com/hashicorp/terraform-provider-google/google/services/clouddomains"
3031
"github.com/hashicorp/terraform-provider-google/google/services/cloudfunctions"
3132
"github.com/hashicorp/terraform-provider-google/google/services/cloudfunctions2"
3233
"github.com/hashicorp/terraform-provider-google/google/services/cloudidentity"
@@ -376,9 +377,9 @@ var handwrittenIAMDatasources = map[string]*schema.Resource{
376377
}
377378

378379
// Resources
379-
// Generated resources: 362
380+
// Generated resources: 363
380381
// Generated IAM resources: 219
381-
// Total generated resources: 581
382+
// Total generated resources: 582
382383
var generatedResources = map[string]*schema.Resource{
383384
"google_folder_access_approval_settings": accessapproval.ResourceAccessApprovalFolderSettings(),
384385
"google_organization_access_approval_settings": accessapproval.ResourceAccessApprovalOrganizationSettings(),
@@ -487,6 +488,7 @@ var generatedResources = map[string]*schema.Resource{
487488
"google_cloudbuildv2_connection_iam_binding": tpgiamresource.ResourceIamBinding(cloudbuildv2.Cloudbuildv2ConnectionIamSchema, cloudbuildv2.Cloudbuildv2ConnectionIamUpdaterProducer, cloudbuildv2.Cloudbuildv2ConnectionIdParseFunc),
488489
"google_cloudbuildv2_connection_iam_member": tpgiamresource.ResourceIamMember(cloudbuildv2.Cloudbuildv2ConnectionIamSchema, cloudbuildv2.Cloudbuildv2ConnectionIamUpdaterProducer, cloudbuildv2.Cloudbuildv2ConnectionIdParseFunc),
489490
"google_cloudbuildv2_connection_iam_policy": tpgiamresource.ResourceIamPolicy(cloudbuildv2.Cloudbuildv2ConnectionIamSchema, cloudbuildv2.Cloudbuildv2ConnectionIamUpdaterProducer, cloudbuildv2.Cloudbuildv2ConnectionIdParseFunc),
491+
"google_clouddomains_registration": clouddomains.ResourceClouddomainsRegistration(),
490492
"google_cloudfunctions_function_iam_binding": tpgiamresource.ResourceIamBinding(cloudfunctions.CloudFunctionsCloudFunctionIamSchema, cloudfunctions.CloudFunctionsCloudFunctionIamUpdaterProducer, cloudfunctions.CloudFunctionsCloudFunctionIdParseFunc),
491493
"google_cloudfunctions_function_iam_member": tpgiamresource.ResourceIamMember(cloudfunctions.CloudFunctionsCloudFunctionIamSchema, cloudfunctions.CloudFunctionsCloudFunctionIamUpdaterProducer, cloudfunctions.CloudFunctionsCloudFunctionIdParseFunc),
492494
"google_cloudfunctions_function_iam_policy": tpgiamresource.ResourceIamPolicy(cloudfunctions.CloudFunctionsCloudFunctionIamSchema, cloudfunctions.CloudFunctionsCloudFunctionIamUpdaterProducer, cloudfunctions.CloudFunctionsCloudFunctionIdParseFunc),
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/google/tpgresource"
27+
transport_tpg "github.com/hashicorp/terraform-provider-google/google/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)