Skip to content

Commit 96d68ce

Browse files
Gkehub Membership Resource [updated again] (#4600) (#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]>
1 parent 4a50f93 commit 96d68ce

File tree

8 files changed

+1009
-2
lines changed

8 files changed

+1009
-2
lines changed

.changelog/4600.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:new-resource
2+
`google_gke_hub_membership`
3+
```

google-beta/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ type Config struct {
122122
FirebaseBasePath string
123123
FirestoreBasePath string
124124
GameServicesBasePath string
125+
GKEHubBasePath string
125126
HealthcareBasePath string
126127
IAMBetaBasePath string
127128
IapBasePath string
@@ -219,6 +220,7 @@ var FilestoreDefaultBasePath = "https://file.googleapis.com/v1beta1/"
219220
var FirebaseDefaultBasePath = "https://firebase.googleapis.com/v1beta1/"
220221
var FirestoreDefaultBasePath = "https://firestore.googleapis.com/v1/"
221222
var GameServicesDefaultBasePath = "https://gameservices.googleapis.com/v1beta/"
223+
var GKEHubDefaultBasePath = "https://gkehub.googleapis.com/v1beta1/"
222224
var HealthcareDefaultBasePath = "https://healthcare.googleapis.com/v1beta1/"
223225
var IAMBetaDefaultBasePath = "https://iam.googleapis.com/v1beta/"
224226
var IapDefaultBasePath = "https://iap.googleapis.com/v1/"
@@ -1006,6 +1008,7 @@ func ConfigureBasePaths(c *Config) {
10061008
c.FirebaseBasePath = FirebaseDefaultBasePath
10071009
c.FirestoreBasePath = FirestoreDefaultBasePath
10081010
c.GameServicesBasePath = GameServicesDefaultBasePath
1011+
c.GKEHubBasePath = GKEHubDefaultBasePath
10091012
c.HealthcareBasePath = HealthcareDefaultBasePath
10101013
c.IAMBetaBasePath = IAMBetaDefaultBasePath
10111014
c.IapBasePath = IapDefaultBasePath

google-beta/gke_hub_operation.go

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
4+
//
5+
// ----------------------------------------------------------------------------
6+
//
7+
// This file is automatically generated by Magic Modules and manual
8+
// changes will be clobbered when the file is regenerated.
9+
//
10+
// Please read more about how to change this file in
11+
// .github/CONTRIBUTING.md.
12+
//
13+
// ----------------------------------------------------------------------------
14+
package google
15+
16+
import (
17+
"encoding/json"
18+
"fmt"
19+
"time"
20+
)
21+
22+
type GKEHubOperationWaiter struct {
23+
Config *Config
24+
UserAgent string
25+
Project string
26+
CommonOperationWaiter
27+
}
28+
29+
func (w *GKEHubOperationWaiter) QueryOp() (interface{}, error) {
30+
if w == nil {
31+
return nil, fmt.Errorf("Cannot query operation, it's unset or nil.")
32+
}
33+
// Returns the proper get.
34+
url := fmt.Sprintf("https://gkehub.googleapis.com/v1beta1/%s", w.CommonOperationWaiter.Op.Name)
35+
36+
return sendRequest(w.Config, "GET", w.Project, url, w.UserAgent, nil)
37+
}
38+
39+
func createGKEHubWaiter(config *Config, op map[string]interface{}, project, activity, userAgent string) (*GKEHubOperationWaiter, error) {
40+
if val, ok := op["name"]; !ok || val == "" {
41+
// An operation could also be indicated with a "metadata" field.
42+
if _, ok := op["metadata"]; !ok {
43+
// This was a synchronous call - there is no operation to wait for.
44+
return nil, nil
45+
}
46+
}
47+
w := &GKEHubOperationWaiter{
48+
Config: config,
49+
UserAgent: userAgent,
50+
Project: project,
51+
}
52+
if err := w.CommonOperationWaiter.SetOp(op); err != nil {
53+
return nil, err
54+
}
55+
return w, nil
56+
}
57+
58+
// nolint: deadcode,unused
59+
func gKEHubOperationWaitTimeWithResponse(config *Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
60+
w, err := createGKEHubWaiter(config, op, project, activity, userAgent)
61+
if err != nil || w == nil {
62+
// If w is nil, the op was synchronous.
63+
return err
64+
}
65+
if err := OperationWait(w, activity, timeout, config.PollInterval); err != nil {
66+
return err
67+
}
68+
return json.Unmarshal([]byte(w.CommonOperationWaiter.Op.Response), response)
69+
}
70+
71+
func gKEHubOperationWaitTime(config *Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
72+
w, err := createGKEHubWaiter(config, op, project, activity, userAgent)
73+
if err != nil || w == nil {
74+
// If w is nil, the op was synchronous.
75+
return err
76+
}
77+
return OperationWait(w, activity, timeout, config.PollInterval)
78+
}

google-beta/provider.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,14 @@ func Provider() *schema.Provider {
439439
"GOOGLE_GAME_SERVICES_CUSTOM_ENDPOINT",
440440
}, GameServicesDefaultBasePath),
441441
},
442+
"gke_hub_custom_endpoint": {
443+
Type: schema.TypeString,
444+
Optional: true,
445+
ValidateFunc: validateCustomEndpoint,
446+
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
447+
"GOOGLE_GKE_HUB_CUSTOM_ENDPOINT",
448+
}, GKEHubDefaultBasePath),
449+
},
442450
"healthcare_custom_endpoint": {
443451
Type: schema.TypeString,
444452
Optional: true,
@@ -835,9 +843,9 @@ func Provider() *schema.Provider {
835843
return provider
836844
}
837845

838-
// Generated resources: 215
846+
// Generated resources: 216
839847
// Generated IAM resources: 111
840-
// Total generated resources: 326
848+
// Total generated resources: 327
841849
func ResourceMap() map[string]*schema.Resource {
842850
resourceMap, _ := ResourceMapWithErrors()
843851
return resourceMap
@@ -1049,6 +1057,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
10491057
"google_game_services_game_server_deployment": resourceGameServicesGameServerDeployment(),
10501058
"google_game_services_game_server_config": resourceGameServicesGameServerConfig(),
10511059
"google_game_services_game_server_deployment_rollout": resourceGameServicesGameServerDeploymentRollout(),
1060+
"google_gke_hub_membership": resourceGKEHubMembership(),
10521061
"google_healthcare_dataset": resourceHealthcareDataset(),
10531062
"google_healthcare_dicom_store": resourceHealthcareDicomStore(),
10541063
"google_healthcare_fhir_store": resourceHealthcareFhirStore(),
@@ -1408,6 +1417,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
14081417
config.FirebaseBasePath = d.Get("firebase_custom_endpoint").(string)
14091418
config.FirestoreBasePath = d.Get("firestore_custom_endpoint").(string)
14101419
config.GameServicesBasePath = d.Get("game_services_custom_endpoint").(string)
1420+
config.GKEHubBasePath = d.Get("gke_hub_custom_endpoint").(string)
14111421
config.HealthcareBasePath = d.Get("healthcare_custom_endpoint").(string)
14121422
config.IAMBetaBasePath = d.Get("iam_beta_custom_endpoint").(string)
14131423
config.IapBasePath = d.Get("iap_custom_endpoint").(string)

0 commit comments

Comments
 (0)