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

Apigee organization #2856

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
3 changes: 3 additions & 0 deletions .changelog/4317.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
apigee_organization
```
76 changes: 76 additions & 0 deletions google-beta/apigee_operation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// ----------------------------------------------------------------------------
//
// *** 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 ApigeeOperationWaiter struct {
Config *Config
UserAgent string
CommonOperationWaiter
}

func (w *ApigeeOperationWaiter) 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://apigee.googleapis.com/v1/%s", w.CommonOperationWaiter.Op.Name)

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

func createApigeeWaiter(config *Config, op map[string]interface{}, activity, userAgent string) (*ApigeeOperationWaiter, error) {
if val, ok := op["name"]; !ok || val == "" {
// An operation could also be indicated with a "metadata" field.
if _, ok := op["metadata"]; !ok {
// This was a synchronous call - there is no operation to wait for.
return nil, nil
}
}
w := &ApigeeOperationWaiter{
Config: config,
UserAgent: userAgent,
}
if err := w.CommonOperationWaiter.SetOp(op); err != nil {
return nil, err
}
return w, nil
}

// nolint: deadcode,unused
func apigeeOperationWaitTimeWithResponse(config *Config, op map[string]interface{}, response *map[string]interface{}, activity, userAgent string, timeout time.Duration) error {
w, err := createApigeeWaiter(config, op, activity, userAgent)
if err != nil || w == nil {
// If w is nil, the op was synchronous.
return err
}
if err := OperationWait(w, activity, timeout, config.PollInterval); err != nil {
return err
}
return json.Unmarshal([]byte(w.CommonOperationWaiter.Op.Response), response)
}

func apigeeOperationWaitTime(config *Config, op map[string]interface{}, activity, userAgent string, timeout time.Duration) error {
w, err := createApigeeWaiter(config, op, activity, userAgent)
if err != nil || w == nil {
// If w is nil, the op was synchronous.
return err
}
return OperationWait(w, activity, timeout, config.PollInterval)
}
3 changes: 3 additions & 0 deletions google-beta/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ type Config struct {
AccessContextManagerBasePath string
ActiveDirectoryBasePath string
ApiGatewayBasePath string
ApigeeBasePath string
AppEngineBasePath string
ArtifactRegistryBasePath string
BigQueryBasePath string
Expand Down Expand Up @@ -174,6 +175,7 @@ var AccessApprovalDefaultBasePath = "https://accessapproval.googleapis.com/v1/"
var AccessContextManagerDefaultBasePath = "https://accesscontextmanager.googleapis.com/v1/"
var ActiveDirectoryDefaultBasePath = "https://managedidentities.googleapis.com/v1/"
var ApiGatewayDefaultBasePath = "https://apigateway.googleapis.com/v1beta/"
var ApigeeDefaultBasePath = "https://apigee.googleapis.com/v1/"
var AppEngineDefaultBasePath = "https://appengine.googleapis.com/v1/"
var ArtifactRegistryDefaultBasePath = "https://artifactregistry.googleapis.com/v1beta1/"
var BigQueryDefaultBasePath = "https://bigquery.googleapis.com/bigquery/v2/"
Expand Down Expand Up @@ -971,6 +973,7 @@ func ConfigureBasePaths(c *Config) {
c.AccessContextManagerBasePath = AccessContextManagerDefaultBasePath
c.ActiveDirectoryBasePath = ActiveDirectoryDefaultBasePath
c.ApiGatewayBasePath = ApiGatewayDefaultBasePath
c.ApigeeBasePath = ApigeeDefaultBasePath
c.AppEngineBasePath = AppEngineDefaultBasePath
c.ArtifactRegistryBasePath = ArtifactRegistryDefaultBasePath
c.BigQueryBasePath = BigQueryDefaultBasePath
Expand Down
14 changes: 12 additions & 2 deletions google-beta/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,14 @@ func Provider() *schema.Provider {
"GOOGLE_API_GATEWAY_CUSTOM_ENDPOINT",
}, ApiGatewayDefaultBasePath),
},
"apigee_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateCustomEndpoint,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
"GOOGLE_APIGEE_CUSTOM_ENDPOINT",
}, ApigeeDefaultBasePath),
},
"app_engine_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -781,9 +789,9 @@ func Provider() *schema.Provider {
return provider
}

// Generated resources: 205
// Generated resources: 206
// Generated IAM resources: 105
// Total generated resources: 310
// Total generated resources: 311
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -817,6 +825,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_api_gateway_gateway_iam_binding": ResourceIamBinding(ApiGatewayGatewayIamSchema, ApiGatewayGatewayIamUpdaterProducer, ApiGatewayGatewayIdParseFunc),
"google_api_gateway_gateway_iam_member": ResourceIamMember(ApiGatewayGatewayIamSchema, ApiGatewayGatewayIamUpdaterProducer, ApiGatewayGatewayIdParseFunc),
"google_api_gateway_gateway_iam_policy": ResourceIamPolicy(ApiGatewayGatewayIamSchema, ApiGatewayGatewayIamUpdaterProducer, ApiGatewayGatewayIdParseFunc),
"google_apigee_organization": resourceApigeeOrganization(),
"google_app_engine_domain_mapping": resourceAppEngineDomainMapping(),
"google_app_engine_firewall_rule": resourceAppEngineFirewallRule(),
"google_app_engine_standard_app_version": resourceAppEngineStandardAppVersion(),
Expand Down Expand Up @@ -1295,6 +1304,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.AccessContextManagerBasePath = d.Get("access_context_manager_custom_endpoint").(string)
config.ActiveDirectoryBasePath = d.Get("active_directory_custom_endpoint").(string)
config.ApiGatewayBasePath = d.Get("api_gateway_custom_endpoint").(string)
config.ApigeeBasePath = d.Get("apigee_custom_endpoint").(string)
config.AppEngineBasePath = d.Get("app_engine_custom_endpoint").(string)
config.ArtifactRegistryBasePath = d.Get("artifact_registry_custom_endpoint").(string)
config.BigQueryBasePath = d.Get("big_query_custom_endpoint").(string)
Expand Down
Loading