Skip to content

Commit 7be0b1c

Browse files
Add new resource WorkforcePool (#6719) (#4818)
* added workforce pool * fixed bugs * renamed the product and fixed an error message * updated version setting * changed to provider-beta * updated id validator * updated parent field * fixed bugs Signed-off-by: Modular Magician <[email protected]> Signed-off-by: Modular Magician <[email protected]>
1 parent 0eef5b8 commit 7be0b1c

10 files changed

+1118
-2
lines changed

.changelog/6719.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:new-resource
2+
`google_iam_workforce_pool`
3+
```

google-beta/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ type Config struct {
224224
HealthcareBasePath string
225225
IAM2BasePath string
226226
IAMBetaBasePath string
227+
IAMWorkforcePoolBasePath string
227228
IapBasePath string
228229
IdentityPlatformBasePath string
229230
KMSBasePath string
@@ -331,6 +332,7 @@ const GKEHubBasePathKey = "GKEHub"
331332
const HealthcareBasePathKey = "Healthcare"
332333
const IAM2BasePathKey = "IAM2"
333334
const IAMBetaBasePathKey = "IAMBeta"
335+
const IAMWorkforcePoolBasePathKey = "IAMWorkforcePool"
334336
const IapBasePathKey = "Iap"
335337
const IdentityPlatformBasePathKey = "IdentityPlatform"
336338
const KMSBasePathKey = "KMS"
@@ -432,6 +434,7 @@ var DefaultBasePaths = map[string]string{
432434
HealthcareBasePathKey: "https://healthcare.googleapis.com/v1beta1/",
433435
IAM2BasePathKey: "https://iam.googleapis.com/v2beta/",
434436
IAMBetaBasePathKey: "https://iam.googleapis.com/v1beta/",
437+
IAMWorkforcePoolBasePathKey: "https://iam.googleapis.com/v1/",
435438
IapBasePathKey: "https://iap.googleapis.com/v1/",
436439
IdentityPlatformBasePathKey: "https://identitytoolkit.googleapis.com/v2/",
437440
KMSBasePathKey: "https://cloudkms.googleapis.com/v1/",
@@ -1309,6 +1312,7 @@ func ConfigureBasePaths(c *Config) {
13091312
c.HealthcareBasePath = DefaultBasePaths[HealthcareBasePathKey]
13101313
c.IAM2BasePath = DefaultBasePaths[IAM2BasePathKey]
13111314
c.IAMBetaBasePath = DefaultBasePaths[IAMBetaBasePathKey]
1315+
c.IAMWorkforcePoolBasePath = DefaultBasePaths[IAMWorkforcePoolBasePathKey]
13121316
c.IapBasePath = DefaultBasePaths[IapBasePathKey]
13131317
c.IdentityPlatformBasePath = DefaultBasePaths[IdentityPlatformBasePathKey]
13141318
c.KMSBasePath = DefaultBasePaths[KMSBasePathKey]
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// *** AUTO GENERATED CODE *** Type: MMv1 ***
4+
//
5+
// ----------------------------------------------------------------------------
6+
//
7+
// This file is automatically generated by Magic Modules and manual
8+
// changes will be clobbered when the file is regenerated.
9+
//
10+
// Please read more about how to change this file in
11+
// .github/CONTRIBUTING.md.
12+
//
13+
// ----------------------------------------------------------------------------
14+
15+
package google
16+
17+
import (
18+
"fmt"
19+
"time"
20+
)
21+
22+
type IAMWorkforcePoolOperationWaiter struct {
23+
Config *Config
24+
UserAgent string
25+
CommonOperationWaiter
26+
}
27+
28+
func (w *IAMWorkforcePoolOperationWaiter) QueryOp() (interface{}, error) {
29+
if w == nil {
30+
return nil, fmt.Errorf("Cannot query operation, it's unset or nil.")
31+
}
32+
// Returns the proper get.
33+
url := fmt.Sprintf("%s%s", w.Config.IAMWorkforcePoolBasePath, w.CommonOperationWaiter.Op.Name)
34+
35+
return sendRequest(w.Config, "GET", "", url, w.UserAgent, nil)
36+
}
37+
38+
func createIAMWorkforcePoolWaiter(config *Config, op map[string]interface{}, activity, userAgent string) (*IAMWorkforcePoolOperationWaiter, error) {
39+
w := &IAMWorkforcePoolOperationWaiter{
40+
Config: config,
41+
UserAgent: userAgent,
42+
}
43+
if err := w.CommonOperationWaiter.SetOp(op); err != nil {
44+
return nil, err
45+
}
46+
return w, nil
47+
}
48+
49+
func iAMWorkforcePoolOperationWaitTime(config *Config, op map[string]interface{}, activity, userAgent string, timeout time.Duration) error {
50+
if val, ok := op["name"]; !ok || val == "" {
51+
// This was a synchronous call - there is no operation to wait for.
52+
return nil
53+
}
54+
w, err := createIAMWorkforcePoolWaiter(config, op, activity, userAgent)
55+
if err != nil {
56+
// If w is nil, the op was synchronous.
57+
return err
58+
}
59+
return OperationWait(w, activity, timeout, config.PollInterval)
60+
}

google-beta/provider.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,14 @@ func Provider() *schema.Provider {
565565
"GOOGLE_IAM_BETA_CUSTOM_ENDPOINT",
566566
}, DefaultBasePaths[IAMBetaBasePathKey]),
567567
},
568+
"iam_workforce_pool_custom_endpoint": {
569+
Type: schema.TypeString,
570+
Optional: true,
571+
ValidateFunc: validateCustomEndpoint,
572+
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
573+
"GOOGLE_IAM_WORKFORCE_POOL_CUSTOM_ENDPOINT",
574+
}, DefaultBasePaths[IAMWorkforcePoolBasePathKey]),
575+
},
568576
"iap_custom_endpoint": {
569577
Type: schema.TypeString,
570578
Optional: true,
@@ -998,9 +1006,9 @@ func Provider() *schema.Provider {
9981006
return provider
9991007
}
10001008

1001-
// Generated resources: 274
1009+
// Generated resources: 275
10021010
// Generated IAM resources: 180
1003-
// Total generated resources: 454
1011+
// Total generated resources: 455
10041012
func ResourceMap() map[string]*schema.Resource {
10051013
resourceMap, _ := ResourceMapWithErrors()
10061014
return resourceMap
@@ -1313,6 +1321,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
13131321
"google_iam_deny_policy": resourceIAM2DenyPolicy(),
13141322
"google_iam_workload_identity_pool": resourceIAMBetaWorkloadIdentityPool(),
13151323
"google_iam_workload_identity_pool_provider": resourceIAMBetaWorkloadIdentityPoolProvider(),
1324+
"google_iam_workforce_pool": resourceIAMWorkforcePoolWorkforcePool(),
13161325
"google_iap_web_iam_binding": ResourceIamBinding(IapWebIamSchema, IapWebIamUpdaterProducer, IapWebIdParseFunc),
13171326
"google_iap_web_iam_member": ResourceIamMember(IapWebIamSchema, IapWebIamUpdaterProducer, IapWebIdParseFunc),
13181327
"google_iap_web_iam_policy": ResourceIamPolicy(IapWebIamSchema, IapWebIamUpdaterProducer, IapWebIdParseFunc),
@@ -1743,6 +1752,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
17431752
config.HealthcareBasePath = d.Get("healthcare_custom_endpoint").(string)
17441753
config.IAM2BasePath = d.Get("iam2_custom_endpoint").(string)
17451754
config.IAMBetaBasePath = d.Get("iam_beta_custom_endpoint").(string)
1755+
config.IAMWorkforcePoolBasePath = d.Get("iam_workforce_pool_custom_endpoint").(string)
17461756
config.IapBasePath = d.Get("iap_custom_endpoint").(string)
17471757
config.IdentityPlatformBasePath = d.Get("identity_platform_custom_endpoint").(string)
17481758
config.KMSBasePath = d.Get("kms_custom_endpoint").(string)

0 commit comments

Comments
 (0)