-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
- Loading branch information
1 parent
7c6f446
commit 225cc91
Showing
11 changed files
with
1,049 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 | ||
`google_iam_workload_identity_pool` | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// *** 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 ( | ||
"fmt" | ||
"time" | ||
) | ||
|
||
type IAMBetaOperationWaiter struct { | ||
Config *Config | ||
UserAgent string | ||
Project string | ||
CommonOperationWaiter | ||
} | ||
|
||
func (w *IAMBetaOperationWaiter) 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://iam.googleapis.com/v1beta/%s", w.CommonOperationWaiter.Op.Name) | ||
|
||
return sendRequest(w.Config, "GET", w.Project, url, w.UserAgent, nil) | ||
} | ||
|
||
func createIAMBetaWaiter(config *Config, op map[string]interface{}, project, activity, userAgent string) (*IAMBetaOperationWaiter, error) { | ||
if val, ok := op["name"]; !ok || val == "" { | ||
// This was a synchronous call - there is no operation to wait for. | ||
return nil, nil | ||
} | ||
w := &IAMBetaOperationWaiter{ | ||
Config: config, | ||
UserAgent: userAgent, | ||
Project: project, | ||
} | ||
if err := w.CommonOperationWaiter.SetOp(op); err != nil { | ||
return nil, err | ||
} | ||
return w, nil | ||
} | ||
|
||
func iAMBetaOperationWaitTime(config *Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error { | ||
w, err := createIAMBetaWaiter(config, op, project, 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
31 changes: 31 additions & 0 deletions
31
google-beta/resource_iam_beta-workload_identity_pool_id_test.go
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,31 @@ | ||
package google | ||
|
||
import ( | ||
"strings" | ||
"testing" | ||
) | ||
|
||
func TestValidateIAMBetaWorkloadIdentityPoolId(t *testing.T) { | ||
x := []StringValidationTestCase{ | ||
// No errors | ||
{TestName: "basic", Value: "foobar"}, | ||
{TestName: "with numbers", Value: "foobar123"}, | ||
{TestName: "short", Value: "foos"}, | ||
{TestName: "long", Value: "12345678901234567890123456789012"}, | ||
{TestName: "has a hyphen", Value: "foo-bar"}, | ||
|
||
// With errors | ||
{TestName: "empty", Value: "", ExpectError: true}, | ||
{TestName: "starts with a gcp-", Value: "gcp-foobar", ExpectError: true}, | ||
{TestName: "with uppercase", Value: "fooBar", ExpectError: true}, | ||
{TestName: "has an slash", Value: "foo/bar", ExpectError: true}, | ||
{TestName: "has an backslash", Value: "foo\bar", ExpectError: true}, | ||
{TestName: "too short", Value: "foo", ExpectError: true}, | ||
{TestName: "too long", Value: strings.Repeat("f", 33), ExpectError: true}, | ||
} | ||
|
||
es := testStringValidationCases(x, validateWorkloadIdentityPoolId) | ||
if len(es) > 0 { | ||
t.Errorf("Failed to validate WorkloadIdentityPool names: %v", es) | ||
} | ||
} |
Oops, something went wrong.