Skip to content

Commit

Permalink
add certificate manager back in (#6004) (#4301)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored May 11, 2022
1 parent 55e8248 commit f1976c9
Show file tree
Hide file tree
Showing 17 changed files with 1,926 additions and 14 deletions.
6 changes: 6 additions & 0 deletions .changelog/6004.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
```release-note:new-resource
`google_certificate_manager_certificate`
```
```release-note:new-resource
`google_certificate_manager_dns_authorization`
```
61 changes: 61 additions & 0 deletions google-beta/certificate_manager_operation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// ----------------------------------------------------------------------------
//
// *** 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 (
"fmt"
"time"
)

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

func (w *CertificateManagerOperationWaiter) 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.CertificateManagerBasePath, w.CommonOperationWaiter.Op.Name)

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

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

func certificateManagerOperationWaitTime(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 := createCertificateManagerWaiter(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-beta/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ type Config struct {
BigtableBasePath string
BillingBasePath string
BinaryAuthorizationBasePath string
CertificateManagerBasePath string
CloudAssetBasePath string
CloudBuildBasePath string
CloudFunctionsBasePath string
Expand Down Expand Up @@ -286,6 +287,7 @@ const BigqueryReservationBasePathKey = "BigqueryReservation"
const BigtableBasePathKey = "Bigtable"
const BillingBasePathKey = "Billing"
const BinaryAuthorizationBasePathKey = "BinaryAuthorization"
const CertificateManagerBasePathKey = "CertificateManager"
const CloudAssetBasePathKey = "CloudAsset"
const CloudBuildBasePathKey = "CloudBuild"
const CloudFunctionsBasePathKey = "CloudFunctions"
Expand Down Expand Up @@ -379,6 +381,7 @@ var DefaultBasePaths = map[string]string{
BigtableBasePathKey: "https://bigtableadmin.googleapis.com/v2/",
BillingBasePathKey: "https://billingbudgets.googleapis.com/v1/",
BinaryAuthorizationBasePathKey: "https://binaryauthorization.googleapis.com/v1/",
CertificateManagerBasePathKey: "https://certificatemanager.googleapis.com/v1/",
CloudAssetBasePathKey: "https://cloudasset.googleapis.com/v1/",
CloudBuildBasePathKey: "https://cloudbuild.googleapis.com/v1/",
CloudFunctionsBasePathKey: "https://cloudfunctions.googleapis.com/v1/",
Expand Down Expand Up @@ -1248,6 +1251,7 @@ func ConfigureBasePaths(c *Config) {
c.BigtableBasePath = DefaultBasePaths[BigtableBasePathKey]
c.BillingBasePath = DefaultBasePaths[BillingBasePathKey]
c.BinaryAuthorizationBasePath = DefaultBasePaths[BinaryAuthorizationBasePathKey]
c.CertificateManagerBasePath = DefaultBasePaths[CertificateManagerBasePathKey]
c.CloudAssetBasePath = DefaultBasePaths[CloudAssetBasePathKey]
c.CloudBuildBasePath = DefaultBasePaths[CloudBuildBasePathKey]
c.CloudFunctionsBasePath = DefaultBasePaths[CloudFunctionsBasePathKey]
Expand Down
15 changes: 13 additions & 2 deletions google-beta/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,14 @@ func Provider() *schema.Provider {
"GOOGLE_BINARY_AUTHORIZATION_CUSTOM_ENDPOINT",
}, DefaultBasePaths[BinaryAuthorizationBasePathKey]),
},
"certificate_manager_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateCustomEndpoint,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
"GOOGLE_CERTIFICATE_MANAGER_CUSTOM_ENDPOINT",
}, DefaultBasePaths[CertificateManagerBasePathKey]),
},
"cloud_asset_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -928,9 +936,9 @@ func Provider() *schema.Provider {
return provider
}

// Generated resources: 247
// Generated resources: 249
// Generated IAM resources: 138
// Total generated resources: 385
// Total generated resources: 387
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -1005,6 +1013,8 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_binary_authorization_attestor_iam_member": ResourceIamMember(BinaryAuthorizationAttestorIamSchema, BinaryAuthorizationAttestorIamUpdaterProducer, BinaryAuthorizationAttestorIdParseFunc),
"google_binary_authorization_attestor_iam_policy": ResourceIamPolicy(BinaryAuthorizationAttestorIamSchema, BinaryAuthorizationAttestorIamUpdaterProducer, BinaryAuthorizationAttestorIdParseFunc),
"google_binary_authorization_policy": resourceBinaryAuthorizationPolicy(),
"google_certificate_manager_dns_authorization": resourceCertificateManagerDnsAuthorization(),
"google_certificate_manager_certificate": resourceCertificateManagerCertificate(),
"google_cloud_asset_project_feed": resourceCloudAssetProjectFeed(),
"google_cloud_asset_folder_feed": resourceCloudAssetFolderFeed(),
"google_cloud_asset_organization_feed": resourceCloudAssetOrganizationFeed(),
Expand Down Expand Up @@ -1597,6 +1607,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.BigtableBasePath = d.Get("bigtable_custom_endpoint").(string)
config.BillingBasePath = d.Get("billing_custom_endpoint").(string)
config.BinaryAuthorizationBasePath = d.Get("binary_authorization_custom_endpoint").(string)
config.CertificateManagerBasePath = d.Get("certificate_manager_custom_endpoint").(string)
config.CloudAssetBasePath = d.Get("cloud_asset_custom_endpoint").(string)
config.CloudBuildBasePath = d.Get("cloud_build_custom_endpoint").(string)
config.CloudFunctionsBasePath = d.Get("cloud_functions_custom_endpoint").(string)
Expand Down
Loading

0 comments on commit f1976c9

Please sign in to comment.