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 new Resource Cloudids Endpoint #12744

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/6617.txt
@@ -0,0 +1,3 @@
```release-note:new-resource

```
31 changes: 22 additions & 9 deletions .github/BREAKING_CHANGES.md
@@ -1,3 +1,15 @@
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: breaking-change-detector ***
#
# ----------------------------------------------------------------------------
#
# This file is managed by Magic Modules (https:#github.com/GoogleCloudPlatform/magic-modules)
# Changes will need to be made to the breaking-change-detector within Magic Modules instead of here.
#
# ----------------------------------------------------------------------------
---

# Breaking Changes and Provider Development

Expand Down Expand Up @@ -27,22 +39,23 @@ go into the four categories and rules therein.


### Resource Inventory Level Breakages
Resource/datasource naming conventions and entry differences.

<h4 id="resource-map-resource-removal-or-rename"> Removing or Renaming an resource </h4>
* Resource/datasource naming conventions and entry differences.

* In terraform resources should be retained whenever possible. A removable of an resource will result in a configuration breakage wherever a dependency on that resource exists. Renaming or Removing a resources are functionally equivalent in terms of configuration breakages.
<h4 id="resource-map-resource-removal-or-rename"> Removing or Renaming an Resource </h4>
In terraform resources should be retained whenever possible. A removable of an resource will result in a configuration breakage wherever a dependency on that resource exists. Renaming or Removing a resources are functionally equivalent in terms of configuration breakages.

### Resource Level Breakages
Individual resource breakages like field entry removals or behavior within a resource.

<h4 id="resource-schema-field-removal-or-rename"> Removing or Renaming an field </h4>
* Individual resource breakages like field entry removals or behavior within a resource.

* In terraform fields should be retained whenever possible. A removable of an field will result in a configuration breakage wherever a dependency on that field exists. Renaming or Removing a field are functionally equivalent in terms of configuration breakages.
<h4 id="resource-schema-field-removal-or-rename"> Removing or Renaming an field </h4>
In terraform fields should be retained whenever possible. A removable of an field will result in a configuration breakage wherever a dependency on that field exists. Renaming or Removing a field are functionally equivalent in terms of configuration breakages.

### Field Level Breakages
Field level conventions like attribute changes and naming conventions.

<h4 id="field-optional-to-required"> Optional to Required Field </h4>
* Field level conventions like attribute changes and naming conventions.

<h4 id="field-optional-to-required"> Field becoming Required Field </h4>
A field cannot become required as existing terraform modules may not have this field defined. Thus breaking their modules in sequential plan or applies.

* A field cannot go from optional to required as existing terraform modules may not have this field defined. Thus breaking their modules in sequential plan or applies.
75 changes: 75 additions & 0 deletions google/cloud_ids_operation.go
@@ -0,0 +1,75 @@
// ----------------------------------------------------------------------------
//
// *** 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 (
"encoding/json"
"fmt"
"time"
)

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

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

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

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

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

func cloudIdsOperationWaitTime(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 := createCloudIdsWaiter(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/config.go
Expand Up @@ -190,6 +190,7 @@ type Config struct {
CloudFunctionsBasePath string
Cloudfunctions2BasePath string
CloudIdentityBasePath string
CloudIdsBasePath string
CloudIotBasePath string
CloudRunBasePath string
CloudSchedulerBasePath string
Expand Down Expand Up @@ -285,6 +286,7 @@ const CloudBuildBasePathKey = "CloudBuild"
const CloudFunctionsBasePathKey = "CloudFunctions"
const Cloudfunctions2BasePathKey = "Cloudfunctions2"
const CloudIdentityBasePathKey = "CloudIdentity"
const CloudIdsBasePathKey = "CloudIds"
const CloudIotBasePathKey = "CloudIot"
const CloudRunBasePathKey = "CloudRun"
const CloudSchedulerBasePathKey = "CloudScheduler"
Expand Down Expand Up @@ -374,6 +376,7 @@ var DefaultBasePaths = map[string]string{
CloudFunctionsBasePathKey: "https://cloudfunctions.googleapis.com/v1/",
Cloudfunctions2BasePathKey: "https://cloudfunctions.googleapis.com/v2/",
CloudIdentityBasePathKey: "https://cloudidentity.googleapis.com/v1/",
CloudIdsBasePathKey: "https://ids.googleapis.com/v1/",
CloudIotBasePathKey: "https://cloudiot.googleapis.com/v1/",
CloudRunBasePathKey: "https://{{location}}-run.googleapis.com/",
CloudSchedulerBasePathKey: "https://cloudscheduler.googleapis.com/v1/",
Expand Down Expand Up @@ -1225,6 +1228,7 @@ func ConfigureBasePaths(c *Config) {
c.CloudFunctionsBasePath = DefaultBasePaths[CloudFunctionsBasePathKey]
c.Cloudfunctions2BasePath = DefaultBasePaths[Cloudfunctions2BasePathKey]
c.CloudIdentityBasePath = DefaultBasePaths[CloudIdentityBasePathKey]
c.CloudIdsBasePath = DefaultBasePaths[CloudIdsBasePathKey]
c.CloudIotBasePath = DefaultBasePaths[CloudIotBasePathKey]
c.CloudRunBasePath = DefaultBasePaths[CloudRunBasePathKey]
c.CloudSchedulerBasePath = DefaultBasePaths[CloudSchedulerBasePathKey]
Expand Down
14 changes: 12 additions & 2 deletions google/provider.go
Expand Up @@ -301,6 +301,14 @@ func Provider() *schema.Provider {
"GOOGLE_CLOUD_IDENTITY_CUSTOM_ENDPOINT",
}, DefaultBasePaths[CloudIdentityBasePathKey]),
},
"cloud_ids_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateCustomEndpoint,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
"GOOGLE_CLOUD_IDS_CUSTOM_ENDPOINT",
}, DefaultBasePaths[CloudIdsBasePathKey]),
},
"cloud_iot_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -892,9 +900,9 @@ func Provider() *schema.Provider {
return provider
}

// Generated resources: 235
// Generated resources: 236
// Generated IAM resources: 138
// Total generated resources: 373
// Total generated resources: 374
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -978,6 +986,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_cloudfunctions2_function_iam_policy": ResourceIamPolicy(Cloudfunctions2functionIamSchema, Cloudfunctions2functionIamUpdaterProducer, Cloudfunctions2functionIdParseFunc),
"google_cloud_identity_group": resourceCloudIdentityGroup(),
"google_cloud_identity_group_membership": resourceCloudIdentityGroupMembership(),
"google_cloud_ids_endpoint": resourceCloudIdsEndpoint(),
"google_cloudiot_registry": resourceCloudIotDeviceRegistry(),
"google_cloudiot_registry_iam_binding": ResourceIamBinding(CloudIotDeviceRegistryIamSchema, CloudIotDeviceRegistryIamUpdaterProducer, CloudIotDeviceRegistryIdParseFunc),
"google_cloudiot_registry_iam_member": ResourceIamMember(CloudIotDeviceRegistryIamSchema, CloudIotDeviceRegistryIamUpdaterProducer, CloudIotDeviceRegistryIdParseFunc),
Expand Down Expand Up @@ -1509,6 +1518,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.CloudFunctionsBasePath = d.Get("cloud_functions_custom_endpoint").(string)
config.Cloudfunctions2BasePath = d.Get("cloudfunctions2_custom_endpoint").(string)
config.CloudIdentityBasePath = d.Get("cloud_identity_custom_endpoint").(string)
config.CloudIdsBasePath = d.Get("cloud_ids_custom_endpoint").(string)
config.CloudIotBasePath = d.Get("cloud_iot_custom_endpoint").(string)
config.CloudRunBasePath = d.Get("cloud_run_custom_endpoint").(string)
config.CloudSchedulerBasePath = d.Get("cloud_scheduler_custom_endpoint").(string)
Expand Down