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 Certificate Authority Resource (Certificate Authority Service) #2877

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/4382.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
`google_privateca_certificate_authority`
```
3 changes: 3 additions & 0 deletions google-beta/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ type Config struct {
NotebooksBasePath string
OSConfigBasePath string
OSLoginBasePath string
PrivatecaBasePath string
PubsubBasePath string
PubsubLiteBasePath string
RedisBasePath string
Expand Down Expand Up @@ -220,6 +221,7 @@ var NetworkManagementDefaultBasePath = "https://networkmanagement.googleapis.com
var NotebooksDefaultBasePath = "https://notebooks.googleapis.com/v1beta1/"
var OSConfigDefaultBasePath = "https://osconfig.googleapis.com/v1beta/"
var OSLoginDefaultBasePath = "https://oslogin.googleapis.com/v1/"
var PrivatecaDefaultBasePath = "https://privateca.googleapis.com/v1beta1/"
var PubsubDefaultBasePath = "https://pubsub.googleapis.com/v1/"
var PubsubLiteDefaultBasePath = "https://{{region}}-pubsublite.googleapis.com/v1/admin/"
var RedisDefaultBasePath = "https://redis.googleapis.com/v1beta1/"
Expand Down Expand Up @@ -1020,6 +1022,7 @@ func ConfigureBasePaths(c *Config) {
c.NotebooksBasePath = NotebooksDefaultBasePath
c.OSConfigBasePath = OSConfigDefaultBasePath
c.OSLoginBasePath = OSLoginDefaultBasePath
c.PrivatecaBasePath = PrivatecaDefaultBasePath
c.PubsubBasePath = PubsubDefaultBasePath
c.PubsubLiteBasePath = PubsubLiteDefaultBasePath
c.RedisBasePath = RedisDefaultBasePath
Expand Down
78 changes: 78 additions & 0 deletions google-beta/privateca_operation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// ----------------------------------------------------------------------------
//
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
//
// ----------------------------------------------------------------------------
//
// 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 PrivatecaOperationWaiter struct {
Config *Config
UserAgent string
Project string
CommonOperationWaiter
}

func (w *PrivatecaOperationWaiter) 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("https://privateca.googleapis.com/v1beta1/%s", w.CommonOperationWaiter.Op.Name)

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

func createPrivatecaWaiter(config *Config, op map[string]interface{}, project, activity, userAgent string) (*PrivatecaOperationWaiter, error) {
if val, ok := op["name"]; !ok || val == "" {
// An operation could also be indicated with a "metadata" field.
if _, ok := op["metadata"]; !ok {
// This was a synchronous call - there is no operation to wait for.
return nil, nil
}
}
w := &PrivatecaOperationWaiter{
Config: config,
UserAgent: userAgent,
Project: project,
}
if err := w.CommonOperationWaiter.SetOp(op); err != nil {
return nil, err
}
return w, nil
}

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

func privatecaOperationWaitTime(config *Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
w, err := createPrivatecaWaiter(config, op, project, activity, userAgent)
if err != nil || w == nil {
// If w is nil, the op was synchronous.
return err
}
return OperationWait(w, activity, timeout, config.PollInterval)
}
14 changes: 12 additions & 2 deletions google-beta/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,14 @@ func Provider() *schema.Provider {
"GOOGLE_OS_LOGIN_CUSTOM_ENDPOINT",
}, OSLoginDefaultBasePath),
},
"privateca_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateCustomEndpoint,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
"GOOGLE_PRIVATECA_CUSTOM_ENDPOINT",
}, PrivatecaDefaultBasePath),
},
"pubsub_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -790,9 +798,9 @@ func Provider() *schema.Provider {
return provider
}

// Generated resources: 206
// Generated resources: 207
// Generated IAM resources: 105
// Total generated resources: 311
// Total generated resources: 312
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -1063,6 +1071,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_os_config_patch_deployment": resourceOSConfigPatchDeployment(),
"google_os_config_guest_policies": resourceOSConfigGuestPolicies(),
"google_os_login_ssh_public_key": resourceOSLoginSSHPublicKey(),
"google_privateca_certificate_authority": resourcePrivatecaCertificateAuthority(),
"google_pubsub_topic": resourcePubsubTopic(),
"google_pubsub_topic_iam_binding": ResourceIamBinding(PubsubTopicIamSchema, PubsubTopicIamUpdaterProducer, PubsubTopicIdParseFunc),
"google_pubsub_topic_iam_member": ResourceIamMember(PubsubTopicIamSchema, PubsubTopicIamUpdaterProducer, PubsubTopicIdParseFunc),
Expand Down Expand Up @@ -1350,6 +1359,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.NotebooksBasePath = d.Get("notebooks_custom_endpoint").(string)
config.OSConfigBasePath = d.Get("os_config_custom_endpoint").(string)
config.OSLoginBasePath = d.Get("os_login_custom_endpoint").(string)
config.PrivatecaBasePath = d.Get("privateca_custom_endpoint").(string)
config.PubsubBasePath = d.Get("pubsub_custom_endpoint").(string)
config.PubsubLiteBasePath = d.Get("pubsub_lite_custom_endpoint").(string)
config.RedisBasePath = d.Get("redis_custom_endpoint").(string)
Expand Down
Loading