Skip to content

Commit 3339c72

Browse files
Promote GKE Backup BackupPlan to GA (#7009) (#13359)
Fixes #13195 Signed-off-by: Modular Magician <[email protected]> Signed-off-by: Modular Magician <[email protected]>
1 parent f5c58e5 commit 3339c72

9 files changed

+1671
-14
lines changed

.changelog/7009.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
```release-note:new-resource
2+
promoted `google_gke_backup_backup_plan` to ga (ga only)
3+
4+
```

google/config.go

+4
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ type Config struct {
216216
FilestoreBasePath string
217217
FirestoreBasePath string
218218
GameServicesBasePath string
219+
GKEBackupBasePath string
219220
GKEHubBasePath string
220221
HealthcareBasePath string
221222
IAMBetaBasePath string
@@ -316,6 +317,7 @@ const EssentialContactsBasePathKey = "EssentialContacts"
316317
const FilestoreBasePathKey = "Filestore"
317318
const FirestoreBasePathKey = "Firestore"
318319
const GameServicesBasePathKey = "GameServices"
320+
const GKEBackupBasePathKey = "GKEBackup"
319321
const GKEHubBasePathKey = "GKEHub"
320322
const HealthcareBasePathKey = "Healthcare"
321323
const IAMBetaBasePathKey = "IAMBeta"
@@ -410,6 +412,7 @@ var DefaultBasePaths = map[string]string{
410412
FilestoreBasePathKey: "https://file.googleapis.com/v1/",
411413
FirestoreBasePathKey: "https://firestore.googleapis.com/v1/",
412414
GameServicesBasePathKey: "https://gameservices.googleapis.com/v1/",
415+
GKEBackupBasePathKey: "https://gkebackup.googleapis.com/v1/",
413416
GKEHubBasePathKey: "https://gkehub.googleapis.com/v1/",
414417
HealthcareBasePathKey: "https://healthcare.googleapis.com/v1/",
415418
IAMBetaBasePathKey: "https://iam.googleapis.com/v1/",
@@ -1266,6 +1269,7 @@ func ConfigureBasePaths(c *Config) {
12661269
c.FilestoreBasePath = DefaultBasePaths[FilestoreBasePathKey]
12671270
c.FirestoreBasePath = DefaultBasePaths[FirestoreBasePathKey]
12681271
c.GameServicesBasePath = DefaultBasePaths[GameServicesBasePathKey]
1272+
c.GKEBackupBasePath = DefaultBasePaths[GKEBackupBasePathKey]
12691273
c.GKEHubBasePath = DefaultBasePaths[GKEHubBasePathKey]
12701274
c.HealthcareBasePath = DefaultBasePaths[HealthcareBasePathKey]
12711275
c.IAMBetaBasePath = DefaultBasePaths[IAMBetaBasePathKey]

google/config_test_utils.go

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ func configureTestBasePaths(c *Config, url string) {
6363
c.FilestoreBasePath = url
6464
c.FirestoreBasePath = url
6565
c.GameServicesBasePath = url
66+
c.GKEBackupBasePath = url
6667
c.GKEHubBasePath = url
6768
c.HealthcareBasePath = url
6869
c.IAMBetaBasePath = url

google/gke_backup_operation.go

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// *** AUTO GENERATED CODE *** Type: MMv1 ***
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+
15+
package google
16+
17+
import (
18+
"encoding/json"
19+
"fmt"
20+
"time"
21+
)
22+
23+
type GKEBackupOperationWaiter struct {
24+
Config *Config
25+
UserAgent string
26+
Project string
27+
CommonOperationWaiter
28+
}
29+
30+
func (w *GKEBackupOperationWaiter) QueryOp() (interface{}, error) {
31+
if w == nil {
32+
return nil, fmt.Errorf("Cannot query operation, it's unset or nil.")
33+
}
34+
// Returns the proper get.
35+
url := fmt.Sprintf("%s%s", w.Config.GKEBackupBasePath, w.CommonOperationWaiter.Op.Name)
36+
37+
return sendRequest(w.Config, "GET", w.Project, url, w.UserAgent, nil)
38+
}
39+
40+
func createGKEBackupWaiter(config *Config, op map[string]interface{}, project, activity, userAgent string) (*GKEBackupOperationWaiter, error) {
41+
w := &GKEBackupOperationWaiter{
42+
Config: config,
43+
UserAgent: userAgent,
44+
Project: project,
45+
}
46+
if err := w.CommonOperationWaiter.SetOp(op); err != nil {
47+
return nil, err
48+
}
49+
return w, nil
50+
}
51+
52+
// nolint: deadcode,unused
53+
func gKEBackupOperationWaitTimeWithResponse(config *Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
54+
w, err := createGKEBackupWaiter(config, op, project, activity, userAgent)
55+
if err != nil {
56+
return err
57+
}
58+
if err := OperationWait(w, activity, timeout, config.PollInterval); err != nil {
59+
return err
60+
}
61+
return json.Unmarshal([]byte(w.CommonOperationWaiter.Op.Response), response)
62+
}
63+
64+
func gKEBackupOperationWaitTime(config *Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
65+
if val, ok := op["name"]; !ok || val == "" {
66+
// This was a synchronous call - there is no operation to wait for.
67+
return nil
68+
}
69+
w, err := createGKEBackupWaiter(config, op, project, activity, userAgent)
70+
if err != nil {
71+
// If w is nil, the op was synchronous.
72+
return err
73+
}
74+
return OperationWait(w, activity, timeout, config.PollInterval)
75+
}

google/provider.go

+12-2
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,14 @@ func Provider() *schema.Provider {
509509
"GOOGLE_GAME_SERVICES_CUSTOM_ENDPOINT",
510510
}, DefaultBasePaths[GameServicesBasePathKey]),
511511
},
512+
"gke_backup_custom_endpoint": {
513+
Type: schema.TypeString,
514+
Optional: true,
515+
ValidateFunc: validateCustomEndpoint,
516+
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
517+
"GOOGLE_GKE_BACKUP_CUSTOM_ENDPOINT",
518+
}, DefaultBasePaths[GKEBackupBasePathKey]),
519+
},
512520
"gke_hub_custom_endpoint": {
513521
Type: schema.TypeString,
514522
Optional: true,
@@ -948,9 +956,9 @@ func Provider() *schema.Provider {
948956
return provider
949957
}
950958

951-
// Generated resources: 255
959+
// Generated resources: 256
952960
// Generated IAM resources: 159
953-
// Total generated resources: 414
961+
// Total generated resources: 415
954962
func ResourceMap() map[string]*schema.Resource {
955963
resourceMap, _ := ResourceMapWithErrors()
956964
return resourceMap
@@ -1204,6 +1212,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
12041212
"google_game_services_game_server_deployment": resourceGameServicesGameServerDeployment(),
12051213
"google_game_services_game_server_config": resourceGameServicesGameServerConfig(),
12061214
"google_game_services_game_server_deployment_rollout": resourceGameServicesGameServerDeploymentRollout(),
1215+
"google_gke_backup_backup_plan": resourceGKEBackupBackupPlan(),
12071216
"google_gke_hub_membership": resourceGKEHubMembership(),
12081217
"google_gke_hub_membership_iam_binding": ResourceIamBinding(GKEHubMembershipIamSchema, GKEHubMembershipIamUpdaterProducer, GKEHubMembershipIdParseFunc),
12091218
"google_gke_hub_membership_iam_member": ResourceIamMember(GKEHubMembershipIamSchema, GKEHubMembershipIamUpdaterProducer, GKEHubMembershipIdParseFunc),
@@ -1628,6 +1637,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
16281637
config.FilestoreBasePath = d.Get("filestore_custom_endpoint").(string)
16291638
config.FirestoreBasePath = d.Get("firestore_custom_endpoint").(string)
16301639
config.GameServicesBasePath = d.Get("game_services_custom_endpoint").(string)
1640+
config.GKEBackupBasePath = d.Get("gke_backup_custom_endpoint").(string)
16311641
config.GKEHubBasePath = d.Get("gke_hub_custom_endpoint").(string)
16321642
config.HealthcareBasePath = d.Get("healthcare_custom_endpoint").(string)
16331643
config.IAMBetaBasePath = d.Get("iam_beta_custom_endpoint").(string)

0 commit comments

Comments
 (0)