forked from hashicorp/terraform-provider-google
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apigee organization (hashicorp#4317)
* Apigee organization * fix import, workaround beta test MM bug Signed-off-by: Modular Magician <[email protected]>
- Loading branch information
1 parent
ee8ce0f
commit 2f35690
Showing
9 changed files
with
1,084 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:new-resource | ||
apigee_organization | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.