Skip to content

Commit

Permalink
Gkehub Membership Resource [updated again] (hashicorp#4600) (hashicor…
Browse files Browse the repository at this point in the history
…p#3079)

* GKE Hub Membership resource.

* Update api.yaml

* Update to remove fields, add update capabilities

* Add issuer to test

* Add issuer, authority to test

* Add additional test

Co-authored-by: Nathan Mckinley <[email protected]>
Co-authored-by: Nathan McKinley <[email protected]>
Signed-off-by: Modular Magician <[email protected]>

Co-authored-by: Nathan Mckinley <[email protected]>
Co-authored-by: Nathan McKinley <[email protected]>
  • Loading branch information
3 people authored Mar 23, 2021
1 parent 4a50f93 commit 96d68ce
Show file tree
Hide file tree
Showing 8 changed files with 1,009 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/4600.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
`google_gke_hub_membership`
```
3 changes: 3 additions & 0 deletions google-beta/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ type Config struct {
FirebaseBasePath string
FirestoreBasePath string
GameServicesBasePath string
GKEHubBasePath string
HealthcareBasePath string
IAMBetaBasePath string
IapBasePath string
Expand Down Expand Up @@ -219,6 +220,7 @@ var FilestoreDefaultBasePath = "https://file.googleapis.com/v1beta1/"
var FirebaseDefaultBasePath = "https://firebase.googleapis.com/v1beta1/"
var FirestoreDefaultBasePath = "https://firestore.googleapis.com/v1/"
var GameServicesDefaultBasePath = "https://gameservices.googleapis.com/v1beta/"
var GKEHubDefaultBasePath = "https://gkehub.googleapis.com/v1beta1/"
var HealthcareDefaultBasePath = "https://healthcare.googleapis.com/v1beta1/"
var IAMBetaDefaultBasePath = "https://iam.googleapis.com/v1beta/"
var IapDefaultBasePath = "https://iap.googleapis.com/v1/"
Expand Down Expand Up @@ -1006,6 +1008,7 @@ func ConfigureBasePaths(c *Config) {
c.FirebaseBasePath = FirebaseDefaultBasePath
c.FirestoreBasePath = FirestoreDefaultBasePath
c.GameServicesBasePath = GameServicesDefaultBasePath
c.GKEHubBasePath = GKEHubDefaultBasePath
c.HealthcareBasePath = HealthcareDefaultBasePath
c.IAMBetaBasePath = IAMBetaDefaultBasePath
c.IapBasePath = IapDefaultBasePath
Expand Down
78 changes: 78 additions & 0 deletions google-beta/gke_hub_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 GKEHubOperationWaiter struct {
Config *Config
UserAgent string
Project string
CommonOperationWaiter
}

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

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

func createGKEHubWaiter(config *Config, op map[string]interface{}, project, activity, userAgent string) (*GKEHubOperationWaiter, 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 := &GKEHubOperationWaiter{
Config: config,
UserAgent: userAgent,
Project: project,
}
if err := w.CommonOperationWaiter.SetOp(op); err != nil {
return nil, err
}
return w, nil
}

// nolint: deadcode,unused
func gKEHubOperationWaitTimeWithResponse(config *Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
w, err := createGKEHubWaiter(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 gKEHubOperationWaitTime(config *Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
w, err := createGKEHubWaiter(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 @@ -439,6 +439,14 @@ func Provider() *schema.Provider {
"GOOGLE_GAME_SERVICES_CUSTOM_ENDPOINT",
}, GameServicesDefaultBasePath),
},
"gke_hub_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateCustomEndpoint,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
"GOOGLE_GKE_HUB_CUSTOM_ENDPOINT",
}, GKEHubDefaultBasePath),
},
"healthcare_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -835,9 +843,9 @@ func Provider() *schema.Provider {
return provider
}

// Generated resources: 215
// Generated resources: 216
// Generated IAM resources: 111
// Total generated resources: 326
// Total generated resources: 327
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -1049,6 +1057,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_game_services_game_server_deployment": resourceGameServicesGameServerDeployment(),
"google_game_services_game_server_config": resourceGameServicesGameServerConfig(),
"google_game_services_game_server_deployment_rollout": resourceGameServicesGameServerDeploymentRollout(),
"google_gke_hub_membership": resourceGKEHubMembership(),
"google_healthcare_dataset": resourceHealthcareDataset(),
"google_healthcare_dicom_store": resourceHealthcareDicomStore(),
"google_healthcare_fhir_store": resourceHealthcareFhirStore(),
Expand Down Expand Up @@ -1408,6 +1417,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.FirebaseBasePath = d.Get("firebase_custom_endpoint").(string)
config.FirestoreBasePath = d.Get("firestore_custom_endpoint").(string)
config.GameServicesBasePath = d.Get("game_services_custom_endpoint").(string)
config.GKEHubBasePath = d.Get("gke_hub_custom_endpoint").(string)
config.HealthcareBasePath = d.Get("healthcare_custom_endpoint").(string)
config.IAMBetaBasePath = d.Get("iam_beta_custom_endpoint").(string)
config.IapBasePath = d.Get("iap_custom_endpoint").(string)
Expand Down
Loading

0 comments on commit 96d68ce

Please sign in to comment.