Skip to content

Commit

Permalink
Promote google_gke_hub_membership to GA (#4982) (#9616)
Browse files Browse the repository at this point in the history
* initial ga work

* promote the right resource

* remove description from ga

* deprecate description

Co-authored-by: upodroid <cy@borg.dev>
Signed-off-by: Modular Magician <magic-modules@google.com>

Co-authored-by: upodroid <cy@borg.dev>
  • Loading branch information
modular-magician and upodroid authored Jul 22, 2021
1 parent 79d0952 commit f1e08b4
Show file tree
Hide file tree
Showing 7 changed files with 773 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .changelog/4982.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
gkehub: promoted `google_gke_hub_membership` to GA
```
4 changes: 4 additions & 0 deletions google/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ type Config struct {
FilestoreBasePath string
FirestoreBasePath string
GameServicesBasePath string
GKEHubBasePath string
HealthcareBasePath string
IapBasePath string
IdentityPlatformBasePath string
Expand Down Expand Up @@ -202,6 +203,7 @@ const DNSBasePathKey = "DNS"
const FilestoreBasePathKey = "Filestore"
const FirestoreBasePathKey = "Firestore"
const GameServicesBasePathKey = "GameServices"
const GKEHubBasePathKey = "GKEHub"
const HealthcareBasePathKey = "Healthcare"
const IapBasePathKey = "Iap"
const IdentityPlatformBasePathKey = "IdentityPlatform"
Expand Down Expand Up @@ -283,6 +285,7 @@ var DefaultBasePaths = map[string]string{
FilestoreBasePathKey: "https://file.googleapis.com/v1/",
FirestoreBasePathKey: "https://firestore.googleapis.com/v1/",
GameServicesBasePathKey: "https://gameservices.googleapis.com/v1/",
GKEHubBasePathKey: "https://gkehub.googleapis.com/v1/",
HealthcareBasePathKey: "https://healthcare.googleapis.com/v1/",
IapBasePathKey: "https://iap.googleapis.com/v1/",
IdentityPlatformBasePathKey: "https://identitytoolkit.googleapis.com/v2/",
Expand Down Expand Up @@ -1117,6 +1120,7 @@ func ConfigureBasePaths(c *Config) {
c.FilestoreBasePath = DefaultBasePaths[FilestoreBasePathKey]
c.FirestoreBasePath = DefaultBasePaths[FirestoreBasePathKey]
c.GameServicesBasePath = DefaultBasePaths[GameServicesBasePathKey]
c.GKEHubBasePath = DefaultBasePaths[GKEHubBasePathKey]
c.HealthcareBasePath = DefaultBasePaths[HealthcareBasePathKey]
c.IapBasePath = DefaultBasePaths[IapBasePathKey]
c.IdentityPlatformBasePath = DefaultBasePaths[IdentityPlatformBasePathKey]
Expand Down
74 changes: 74 additions & 0 deletions google/gke_hub_operation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// ----------------------------------------------------------------------------
//
// *** 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/v1/%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) {
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 {
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 {
if val, ok := op["name"]; !ok || val == "" {
// This was a synchronous call - there is no operation to wait for.
return nil
}
w, err := createGKEHubWaiter(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)
}
14 changes: 12 additions & 2 deletions google/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,14 @@ func Provider() *schema.Provider {
"GOOGLE_GAME_SERVICES_CUSTOM_ENDPOINT",
}, DefaultBasePaths[GameServicesBasePathKey]),
},
"gke_hub_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateCustomEndpoint,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
"GOOGLE_GKE_HUB_CUSTOM_ENDPOINT",
}, DefaultBasePaths[GKEHubBasePathKey]),
},
"healthcare_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -783,9 +791,9 @@ func Provider() *schema.Provider {
return provider
}

// Generated resources: 208
// Generated resources: 209
// Generated IAM resources: 90
// Total generated resources: 298
// Total generated resources: 299
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -968,6 +976,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 @@ -1332,6 +1341,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.FilestoreBasePath = d.Get("filestore_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.IapBasePath = d.Get("iap_custom_endpoint").(string)
config.IdentityPlatformBasePath = d.Get("identity_platform_custom_endpoint").(string)
Expand Down
Loading

0 comments on commit f1e08b4

Please sign in to comment.