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

Adding support for google game services #1789

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
15 changes: 15 additions & 0 deletions .changelog/3160.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```release-note:new-resource
gameservices: Added new resource `google_game_services_realm`
```
```release-note:new-resource
gameservices: Added new resource `google_game_services_game_server_cluster`
```
```release-note:new-resource
gameservices: Added new resource `google_game_services_game_server_config`
```
```release-note:new-resource
gameservices: Added new resource `google_game_services_game_server_deployment`
```
```release-note:new-resource
gameservices: Added new resource `google_game_services_game_server_deployment_rollout`
```
3 changes: 3 additions & 0 deletions google-beta/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ type Config struct {
DNSBasePath string
FilestoreBasePath string
FirestoreBasePath string
GameServicesBasePath string
HealthcareBasePath string
IapBasePath string
IdentityPlatformBasePath string
Expand Down Expand Up @@ -240,6 +241,7 @@ var DialogflowDefaultBasePath = "https://dialogflow.googleapis.com/v2/"
var DNSDefaultBasePath = "https://www.googleapis.com/dns/v1beta2/"
var FilestoreDefaultBasePath = "https://file.googleapis.com/v1/"
var FirestoreDefaultBasePath = "https://firestore.googleapis.com/v1/"
var GameServicesDefaultBasePath = "https://gameservices.googleapis.com/v1beta/"
var HealthcareDefaultBasePath = "https://healthcare.googleapis.com/v1beta1/"
var IapDefaultBasePath = "https://iap.googleapis.com/v1/"
var IdentityPlatformDefaultBasePath = "https://identitytoolkit.googleapis.com/v2/"
Expand Down Expand Up @@ -743,6 +745,7 @@ func ConfigureBasePaths(c *Config) {
c.DNSBasePath = DNSDefaultBasePath
c.FilestoreBasePath = FilestoreDefaultBasePath
c.FirestoreBasePath = FirestoreDefaultBasePath
c.GameServicesBasePath = GameServicesDefaultBasePath
c.HealthcareBasePath = HealthcareDefaultBasePath
c.IapBasePath = IapDefaultBasePath
c.IdentityPlatformBasePath = IdentityPlatformDefaultBasePath
Expand Down
71 changes: 71 additions & 0 deletions google-beta/game_services_operation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// ----------------------------------------------------------------------------
//
// *** 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"
)

type GameServicesOperationWaiter struct {
Config *Config
Project string
CommonOperationWaiter
}

func (w *GameServicesOperationWaiter) 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://gameservices.googleapis.com/v1beta/%s", w.CommonOperationWaiter.Op.Name)
return sendRequest(w.Config, "GET", w.Project, url, nil)
}

func createGameServicesWaiter(config *Config, op map[string]interface{}, project, activity string) (*GameServicesOperationWaiter, error) {
if val, ok := op["name"]; !ok || val == "" {
// This was a synchronous call - there is no operation to wait for.
return nil, nil
}
w := &GameServicesOperationWaiter{
Config: config,
Project: project,
}
if err := w.CommonOperationWaiter.SetOp(op); err != nil {
return nil, err
}
return w, nil
}

// nolint: deadcode,unused
func gameServicesOperationWaitTimeWithResponse(config *Config, op map[string]interface{}, response *map[string]interface{}, project, activity string, timeoutMinutes int) error {
w, err := createGameServicesWaiter(config, op, project, activity)
if err != nil || w == nil {
// If w is nil, the op was synchronous.
return err
}
if err := OperationWait(w, activity, timeoutMinutes); err != nil {
return err
}
return json.Unmarshal([]byte(w.CommonOperationWaiter.Op.Response), response)
}

func gameServicesOperationWaitTime(config *Config, op map[string]interface{}, project, activity string, timeoutMinutes int) error {
w, err := createGameServicesWaiter(config, op, project, activity)
if err != nil || w == nil {
// If w is nil, the op was synchronous.
return err
}
return OperationWait(w, activity, timeoutMinutes)
}
18 changes: 16 additions & 2 deletions google-beta/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,14 @@ func Provider() terraform.ResourceProvider {
"GOOGLE_FIRESTORE_CUSTOM_ENDPOINT",
}, FirestoreDefaultBasePath),
},
"game_services_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateCustomEndpoint,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
"GOOGLE_GAME_SERVICES_CUSTOM_ENDPOINT",
}, GameServicesDefaultBasePath),
},
"healthcare_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -556,9 +564,9 @@ func Provider() terraform.ResourceProvider {
return provider
}

// Generated resources: 120
// Generated resources: 125
// Generated IAM resources: 54
// Total generated resources: 174
// Total generated resources: 179
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -664,6 +672,11 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_dns_policy": resourceDNSPolicy(),
"google_filestore_instance": resourceFilestoreInstance(),
"google_firestore_index": resourceFirestoreIndex(),
"google_game_services_realm": resourceGameServicesRealm(),
"google_game_services_game_server_cluster": resourceGameServicesGameServerCluster(),
"google_game_services_game_server_deployment": resourceGameServicesGameServerDeployment(),
"google_game_services_game_server_config": resourceGameServicesGameServerConfig(),
"google_game_services_game_server_deployment_rollout": resourceGameServicesGameServerDeploymentRollout(),
"google_healthcare_dataset": resourceHealthcareDataset(),
"google_healthcare_dicom_store": resourceHealthcareDicomStore(),
"google_healthcare_fhir_store": resourceHealthcareFhirStore(),
Expand Down Expand Up @@ -924,6 +937,7 @@ func providerConfigure(d *schema.ResourceData, p *schema.Provider, terraformVers
config.DNSBasePath = d.Get("dns_custom_endpoint").(string)
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.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