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

Promote GKE Backup BackupPlan to GA #13359

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changelog/7009.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```release-note:new-resource
promoted `google_gke_backup_backup_plan` to ga (ga only)

```
4 changes: 4 additions & 0 deletions google/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ type Config struct {
FilestoreBasePath string
FirestoreBasePath string
GameServicesBasePath string
GKEBackupBasePath string
GKEHubBasePath string
HealthcareBasePath string
IAMBetaBasePath string
Expand Down Expand Up @@ -316,6 +317,7 @@ const EssentialContactsBasePathKey = "EssentialContacts"
const FilestoreBasePathKey = "Filestore"
const FirestoreBasePathKey = "Firestore"
const GameServicesBasePathKey = "GameServices"
const GKEBackupBasePathKey = "GKEBackup"
const GKEHubBasePathKey = "GKEHub"
const HealthcareBasePathKey = "Healthcare"
const IAMBetaBasePathKey = "IAMBeta"
Expand Down Expand Up @@ -410,6 +412,7 @@ var DefaultBasePaths = map[string]string{
FilestoreBasePathKey: "https://file.googleapis.com/v1/",
FirestoreBasePathKey: "https://firestore.googleapis.com/v1/",
GameServicesBasePathKey: "https://gameservices.googleapis.com/v1/",
GKEBackupBasePathKey: "https://gkebackup.googleapis.com/v1/",
GKEHubBasePathKey: "https://gkehub.googleapis.com/v1/",
HealthcareBasePathKey: "https://healthcare.googleapis.com/v1/",
IAMBetaBasePathKey: "https://iam.googleapis.com/v1/",
Expand Down Expand Up @@ -1266,6 +1269,7 @@ func ConfigureBasePaths(c *Config) {
c.FilestoreBasePath = DefaultBasePaths[FilestoreBasePathKey]
c.FirestoreBasePath = DefaultBasePaths[FirestoreBasePathKey]
c.GameServicesBasePath = DefaultBasePaths[GameServicesBasePathKey]
c.GKEBackupBasePath = DefaultBasePaths[GKEBackupBasePathKey]
c.GKEHubBasePath = DefaultBasePaths[GKEHubBasePathKey]
c.HealthcareBasePath = DefaultBasePaths[HealthcareBasePathKey]
c.IAMBetaBasePath = DefaultBasePaths[IAMBetaBasePathKey]
Expand Down
1 change: 1 addition & 0 deletions google/config_test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func configureTestBasePaths(c *Config, url string) {
c.FilestoreBasePath = url
c.FirestoreBasePath = url
c.GameServicesBasePath = url
c.GKEBackupBasePath = url
c.GKEHubBasePath = url
c.HealthcareBasePath = url
c.IAMBetaBasePath = url
Expand Down
75 changes: 75 additions & 0 deletions google/gke_backup_operation.go
Original file line number Diff line number Diff line change
@@ -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 GKEBackupOperationWaiter struct {
Config *Config
UserAgent string
Project string
CommonOperationWaiter
}

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

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

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

// nolint: deadcode,unused
func gKEBackupOperationWaitTimeWithResponse(config *Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
w, err := createGKEBackupWaiter(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 gKEBackupOperationWaitTime(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 := createGKEBackupWaiter(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 @@ -509,6 +509,14 @@ func Provider() *schema.Provider {
"GOOGLE_GAME_SERVICES_CUSTOM_ENDPOINT",
}, DefaultBasePaths[GameServicesBasePathKey]),
},
"gke_backup_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateCustomEndpoint,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
"GOOGLE_GKE_BACKUP_CUSTOM_ENDPOINT",
}, DefaultBasePaths[GKEBackupBasePathKey]),
},
"gke_hub_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -948,9 +956,9 @@ func Provider() *schema.Provider {
return provider
}

// Generated resources: 255
// Generated resources: 256
// Generated IAM resources: 159
// Total generated resources: 414
// Total generated resources: 415
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -1204,6 +1212,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_backup_backup_plan": resourceGKEBackupBackupPlan(),
"google_gke_hub_membership": resourceGKEHubMembership(),
"google_gke_hub_membership_iam_binding": ResourceIamBinding(GKEHubMembershipIamSchema, GKEHubMembershipIamUpdaterProducer, GKEHubMembershipIdParseFunc),
"google_gke_hub_membership_iam_member": ResourceIamMember(GKEHubMembershipIamSchema, GKEHubMembershipIamUpdaterProducer, GKEHubMembershipIdParseFunc),
Expand Down Expand Up @@ -1628,6 +1637,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.GKEBackupBasePath = d.Get("gke_backup_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)
Expand Down
Loading