Skip to content

Commit 7c02728

Browse files
add certificate manager back in (#6004) (#11685)
Signed-off-by: Modular Magician <[email protected]>
1 parent 038f9d0 commit 7c02728

15 files changed

+1922
-10
lines changed

.changelog/6004.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
```release-note:new-resource
2+
`google_certificate_manager_certificate`
3+
```
4+
```release-note:new-resource
5+
`google_certificate_manager_dns_authorization`
6+
```
+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// *** AUTO GENERATED CODE *** Type: MMv1 ***
4+
//
5+
// ----------------------------------------------------------------------------
6+
//
7+
// This file is automatically generated by Magic Modules and manual
8+
// changes will be clobbered when the file is regenerated.
9+
//
10+
// Please read more about how to change this file in
11+
// .github/CONTRIBUTING.md.
12+
//
13+
// ----------------------------------------------------------------------------
14+
package google
15+
16+
import (
17+
"fmt"
18+
"time"
19+
)
20+
21+
type CertificateManagerOperationWaiter struct {
22+
Config *Config
23+
UserAgent string
24+
Project string
25+
CommonOperationWaiter
26+
}
27+
28+
func (w *CertificateManagerOperationWaiter) QueryOp() (interface{}, error) {
29+
if w == nil {
30+
return nil, fmt.Errorf("Cannot query operation, it's unset or nil.")
31+
}
32+
// Returns the proper get.
33+
url := fmt.Sprintf("%s%s", w.Config.CertificateManagerBasePath, w.CommonOperationWaiter.Op.Name)
34+
35+
return sendRequest(w.Config, "GET", w.Project, url, w.UserAgent, nil)
36+
}
37+
38+
func createCertificateManagerWaiter(config *Config, op map[string]interface{}, project, activity, userAgent string) (*CertificateManagerOperationWaiter, error) {
39+
w := &CertificateManagerOperationWaiter{
40+
Config: config,
41+
UserAgent: userAgent,
42+
Project: project,
43+
}
44+
if err := w.CommonOperationWaiter.SetOp(op); err != nil {
45+
return nil, err
46+
}
47+
return w, nil
48+
}
49+
50+
func certificateManagerOperationWaitTime(config *Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
51+
if val, ok := op["name"]; !ok || val == "" {
52+
// This was a synchronous call - there is no operation to wait for.
53+
return nil
54+
}
55+
w, err := createCertificateManagerWaiter(config, op, project, activity, userAgent)
56+
if err != nil {
57+
// If w is nil, the op was synchronous.
58+
return err
59+
}
60+
return OperationWait(w, activity, timeout, config.PollInterval)
61+
}

google/config.go

+4
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ type Config struct {
171171
BigtableBasePath string
172172
BillingBasePath string
173173
BinaryAuthorizationBasePath string
174+
CertificateManagerBasePath string
174175
CloudAssetBasePath string
175176
CloudBuildBasePath string
176177
CloudFunctionsBasePath string
@@ -271,6 +272,7 @@ const BigqueryReservationBasePathKey = "BigqueryReservation"
271272
const BigtableBasePathKey = "Bigtable"
272273
const BillingBasePathKey = "Billing"
273274
const BinaryAuthorizationBasePathKey = "BinaryAuthorization"
275+
const CertificateManagerBasePathKey = "CertificateManager"
274276
const CloudAssetBasePathKey = "CloudAsset"
275277
const CloudBuildBasePathKey = "CloudBuild"
276278
const CloudFunctionsBasePathKey = "CloudFunctions"
@@ -353,6 +355,7 @@ var DefaultBasePaths = map[string]string{
353355
BigtableBasePathKey: "https://bigtableadmin.googleapis.com/v2/",
354356
BillingBasePathKey: "https://billingbudgets.googleapis.com/v1/",
355357
BinaryAuthorizationBasePathKey: "https://binaryauthorization.googleapis.com/v1/",
358+
CertificateManagerBasePathKey: "https://certificatemanager.googleapis.com/v1/",
356359
CloudAssetBasePathKey: "https://cloudasset.googleapis.com/v1/",
357360
CloudBuildBasePathKey: "https://cloudbuild.googleapis.com/v1/",
358361
CloudFunctionsBasePathKey: "https://cloudfunctions.googleapis.com/v1/",
@@ -1197,6 +1200,7 @@ func ConfigureBasePaths(c *Config) {
11971200
c.BigtableBasePath = DefaultBasePaths[BigtableBasePathKey]
11981201
c.BillingBasePath = DefaultBasePaths[BillingBasePathKey]
11991202
c.BinaryAuthorizationBasePath = DefaultBasePaths[BinaryAuthorizationBasePathKey]
1203+
c.CertificateManagerBasePath = DefaultBasePaths[CertificateManagerBasePathKey]
12001204
c.CloudAssetBasePath = DefaultBasePaths[CloudAssetBasePathKey]
12011205
c.CloudBuildBasePath = DefaultBasePaths[CloudBuildBasePathKey]
12021206
c.CloudFunctionsBasePath = DefaultBasePaths[CloudFunctionsBasePathKey]

google/provider.go

+13-2
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,14 @@ func Provider() *schema.Provider {
237237
"GOOGLE_BINARY_AUTHORIZATION_CUSTOM_ENDPOINT",
238238
}, DefaultBasePaths[BinaryAuthorizationBasePathKey]),
239239
},
240+
"certificate_manager_custom_endpoint": {
241+
Type: schema.TypeString,
242+
Optional: true,
243+
ValidateFunc: validateCustomEndpoint,
244+
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
245+
"GOOGLE_CERTIFICATE_MANAGER_CUSTOM_ENDPOINT",
246+
}, DefaultBasePaths[CertificateManagerBasePathKey]),
247+
},
240248
"cloud_asset_custom_endpoint": {
241249
Type: schema.TypeString,
242250
Optional: true,
@@ -831,9 +839,9 @@ func Provider() *schema.Provider {
831839
return provider
832840
}
833841

834-
// Generated resources: 217
842+
// Generated resources: 219
835843
// Generated IAM resources: 108
836-
// Total generated resources: 325
844+
// Total generated resources: 327
837845
func ResourceMap() map[string]*schema.Resource {
838846
resourceMap, _ := ResourceMapWithErrors()
839847
return resourceMap
@@ -891,6 +899,8 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
891899
"google_binary_authorization_attestor_iam_member": ResourceIamMember(BinaryAuthorizationAttestorIamSchema, BinaryAuthorizationAttestorIamUpdaterProducer, BinaryAuthorizationAttestorIdParseFunc),
892900
"google_binary_authorization_attestor_iam_policy": ResourceIamPolicy(BinaryAuthorizationAttestorIamSchema, BinaryAuthorizationAttestorIamUpdaterProducer, BinaryAuthorizationAttestorIdParseFunc),
893901
"google_binary_authorization_policy": resourceBinaryAuthorizationPolicy(),
902+
"google_certificate_manager_dns_authorization": resourceCertificateManagerDnsAuthorization(),
903+
"google_certificate_manager_certificate": resourceCertificateManagerCertificate(),
894904
"google_cloud_asset_project_feed": resourceCloudAssetProjectFeed(),
895905
"google_cloud_asset_folder_feed": resourceCloudAssetFolderFeed(),
896906
"google_cloud_asset_organization_feed": resourceCloudAssetOrganizationFeed(),
@@ -1423,6 +1433,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
14231433
config.BigtableBasePath = d.Get("bigtable_custom_endpoint").(string)
14241434
config.BillingBasePath = d.Get("billing_custom_endpoint").(string)
14251435
config.BinaryAuthorizationBasePath = d.Get("binary_authorization_custom_endpoint").(string)
1436+
config.CertificateManagerBasePath = d.Get("certificate_manager_custom_endpoint").(string)
14261437
config.CloudAssetBasePath = d.Get("cloud_asset_custom_endpoint").(string)
14271438
config.CloudBuildBasePath = d.Get("cloud_build_custom_endpoint").(string)
14281439
config.CloudFunctionsBasePath = d.Get("cloud_functions_custom_endpoint").(string)

0 commit comments

Comments
 (0)