Skip to content

Commit d2ea021

Browse files
promoting google_parallelstore_instance to ga (#12271) (#20337)
[upstream:171b7b6a7cab20139942409c2a2b1b9c8c1fdcb8] Signed-off-by: Modular Magician <[email protected]>
1 parent 9269826 commit d2ea021

15 files changed

+1288
-8
lines changed

.changelog/12271.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note: enhancement
2+
parallelstore: promoted `google_parallelstore_instance` to GA
3+
```

google/fwmodels/provider_model.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ type ProviderModel struct {
124124
OrgPolicyCustomEndpoint types.String `tfsdk:"org_policy_custom_endpoint"`
125125
OSConfigCustomEndpoint types.String `tfsdk:"os_config_custom_endpoint"`
126126
OSLoginCustomEndpoint types.String `tfsdk:"os_login_custom_endpoint"`
127+
ParallelstoreCustomEndpoint types.String `tfsdk:"parallelstore_custom_endpoint"`
127128
PrivatecaCustomEndpoint types.String `tfsdk:"privateca_custom_endpoint"`
128129
PrivilegedAccessManagerCustomEndpoint types.String `tfsdk:"privileged_access_manager_custom_endpoint"`
129130
PublicCACustomEndpoint types.String `tfsdk:"public_ca_custom_endpoint"`

google/fwprovider/framework_provider.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,12 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest,
712712
transport_tpg.CustomEndpointValidator(),
713713
},
714714
},
715+
"parallelstore_custom_endpoint": &schema.StringAttribute{
716+
Optional: true,
717+
Validators: []validator.String{
718+
transport_tpg.CustomEndpointValidator(),
719+
},
720+
},
715721
"privateca_custom_endpoint": &schema.StringAttribute{
716722
Optional: true,
717723
Validators: []validator.String{

google/fwtransport/framework_config.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ type FrameworkProviderConfig struct {
158158
OrgPolicyBasePath string
159159
OSConfigBasePath string
160160
OSLoginBasePath string
161+
ParallelstoreBasePath string
161162
PrivatecaBasePath string
162163
PrivilegedAccessManagerBasePath string
163164
PublicCABasePath string
@@ -323,6 +324,7 @@ func (p *FrameworkProviderConfig) LoadAndValidateFramework(ctx context.Context,
323324
p.OrgPolicyBasePath = data.OrgPolicyCustomEndpoint.ValueString()
324325
p.OSConfigBasePath = data.OSConfigCustomEndpoint.ValueString()
325326
p.OSLoginBasePath = data.OSLoginCustomEndpoint.ValueString()
327+
p.ParallelstoreBasePath = data.ParallelstoreCustomEndpoint.ValueString()
326328
p.PrivatecaBasePath = data.PrivatecaCustomEndpoint.ValueString()
327329
p.PrivilegedAccessManagerBasePath = data.PrivilegedAccessManagerCustomEndpoint.ValueString()
328330
p.PublicCABasePath = data.PublicCACustomEndpoint.ValueString()
@@ -1247,6 +1249,14 @@ func (p *FrameworkProviderConfig) HandleDefaults(ctx context.Context, data *fwmo
12471249
data.OSLoginCustomEndpoint = types.StringValue(customEndpoint.(string))
12481250
}
12491251
}
1252+
if data.ParallelstoreCustomEndpoint.IsNull() {
1253+
customEndpoint := transport_tpg.MultiEnvDefault([]string{
1254+
"GOOGLE_PARALLELSTORE_CUSTOM_ENDPOINT",
1255+
}, transport_tpg.DefaultBasePaths[transport_tpg.ParallelstoreBasePathKey])
1256+
if customEndpoint != nil {
1257+
data.ParallelstoreCustomEndpoint = types.StringValue(customEndpoint.(string))
1258+
}
1259+
}
12501260
if data.PrivatecaCustomEndpoint.IsNull() {
12511261
customEndpoint := transport_tpg.MultiEnvDefault([]string{
12521262
"GOOGLE_PRIVATECA_CUSTOM_ENDPOINT",

google/provider/provider.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,11 @@ func Provider() *schema.Provider {
615615
Optional: true,
616616
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
617617
},
618+
"parallelstore_custom_endpoint": {
619+
Type: schema.TypeString,
620+
Optional: true,
621+
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
622+
},
618623
"privateca_custom_endpoint": {
619624
Type: schema.TypeString,
620625
Optional: true,
@@ -1060,6 +1065,7 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
10601065
config.OrgPolicyBasePath = d.Get("org_policy_custom_endpoint").(string)
10611066
config.OSConfigBasePath = d.Get("os_config_custom_endpoint").(string)
10621067
config.OSLoginBasePath = d.Get("os_login_custom_endpoint").(string)
1068+
config.ParallelstoreBasePath = d.Get("parallelstore_custom_endpoint").(string)
10631069
config.PrivatecaBasePath = d.Get("privateca_custom_endpoint").(string)
10641070
config.PrivilegedAccessManagerBasePath = d.Get("privileged_access_manager_custom_endpoint").(string)
10651071
config.PublicCABasePath = d.Get("public_ca_custom_endpoint").(string)

google/provider/provider_mmv1_resources.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ import (
9797
"github.com/hashicorp/terraform-provider-google/google/services/orgpolicy"
9898
"github.com/hashicorp/terraform-provider-google/google/services/osconfig"
9999
"github.com/hashicorp/terraform-provider-google/google/services/oslogin"
100+
"github.com/hashicorp/terraform-provider-google/google/services/parallelstore"
100101
"github.com/hashicorp/terraform-provider-google/google/services/privateca"
101102
"github.com/hashicorp/terraform-provider-google/google/services/privilegedaccessmanager"
102103
"github.com/hashicorp/terraform-provider-google/google/services/publicca"
@@ -454,9 +455,9 @@ var handwrittenIAMDatasources = map[string]*schema.Resource{
454455
}
455456

456457
// Resources
457-
// Generated resources: 489
458+
// Generated resources: 490
458459
// Generated IAM resources: 261
459-
// Total generated resources: 750
460+
// Total generated resources: 751
460461
var generatedResources = map[string]*schema.Resource{
461462
"google_folder_access_approval_settings": accessapproval.ResourceAccessApprovalFolderSettings(),
462463
"google_organization_access_approval_settings": accessapproval.ResourceAccessApprovalOrganizationSettings(),
@@ -1041,6 +1042,7 @@ var generatedResources = map[string]*schema.Resource{
10411042
"google_org_policy_policy": orgpolicy.ResourceOrgPolicyPolicy(),
10421043
"google_os_config_patch_deployment": osconfig.ResourceOSConfigPatchDeployment(),
10431044
"google_os_login_ssh_public_key": oslogin.ResourceOSLoginSSHPublicKey(),
1045+
"google_parallelstore_instance": parallelstore.ResourceParallelstoreInstance(),
10441046
"google_privateca_ca_pool": privateca.ResourcePrivatecaCaPool(),
10451047
"google_privateca_ca_pool_iam_binding": tpgiamresource.ResourceIamBinding(privateca.PrivatecaCaPoolIamSchema, privateca.PrivatecaCaPoolIamUpdaterProducer, privateca.PrivatecaCaPoolIdParseFunc),
10461048
"google_privateca_ca_pool_iam_member": tpgiamresource.ResourceIamMember(privateca.PrivatecaCaPoolIamSchema, privateca.PrivatecaCaPoolIamUpdaterProducer, privateca.PrivatecaCaPoolIdParseFunc),
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: MPL-2.0
3+
4+
// ----------------------------------------------------------------------------
5+
//
6+
// *** AUTO GENERATED CODE *** Type: MMv1 ***
7+
//
8+
// ----------------------------------------------------------------------------
9+
//
10+
// This file is automatically generated by Magic Modules and manual
11+
// changes will be clobbered when the file is regenerated.
12+
//
13+
// Please read more about how to change this file in
14+
// .github/CONTRIBUTING.md.
15+
//
16+
// ----------------------------------------------------------------------------
17+
18+
package parallelstore
19+
20+
import (
21+
"encoding/json"
22+
"errors"
23+
"fmt"
24+
"time"
25+
26+
"github.com/hashicorp/terraform-provider-google/google/tpgresource"
27+
transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport"
28+
)
29+
30+
type ParallelstoreOperationWaiter struct {
31+
Config *transport_tpg.Config
32+
UserAgent string
33+
Project string
34+
tpgresource.CommonOperationWaiter
35+
}
36+
37+
func (w *ParallelstoreOperationWaiter) QueryOp() (interface{}, error) {
38+
if w == nil {
39+
return nil, fmt.Errorf("Cannot query operation, it's unset or nil.")
40+
}
41+
// Returns the proper get.
42+
url := fmt.Sprintf("%s%s", w.Config.ParallelstoreBasePath, w.CommonOperationWaiter.Op.Name)
43+
44+
return transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
45+
Config: w.Config,
46+
Method: "GET",
47+
Project: w.Project,
48+
RawURL: url,
49+
UserAgent: w.UserAgent,
50+
})
51+
}
52+
53+
func createParallelstoreWaiter(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string) (*ParallelstoreOperationWaiter, error) {
54+
w := &ParallelstoreOperationWaiter{
55+
Config: config,
56+
UserAgent: userAgent,
57+
Project: project,
58+
}
59+
if err := w.CommonOperationWaiter.SetOp(op); err != nil {
60+
return nil, err
61+
}
62+
return w, nil
63+
}
64+
65+
// nolint: deadcode,unused
66+
func ParallelstoreOperationWaitTimeWithResponse(config *transport_tpg.Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
67+
w, err := createParallelstoreWaiter(config, op, project, activity, userAgent)
68+
if err != nil {
69+
return err
70+
}
71+
if err := tpgresource.OperationWait(w, activity, timeout, config.PollInterval); err != nil {
72+
return err
73+
}
74+
rawResponse := []byte(w.CommonOperationWaiter.Op.Response)
75+
if len(rawResponse) == 0 {
76+
return errors.New("`resource` not set in operation response")
77+
}
78+
return json.Unmarshal(rawResponse, response)
79+
}
80+
81+
func ParallelstoreOperationWaitTime(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
82+
if val, ok := op["name"]; !ok || val == "" {
83+
// This was a synchronous call - there is no operation to wait for.
84+
return nil
85+
}
86+
w, err := createParallelstoreWaiter(config, op, project, activity, userAgent)
87+
if err != nil {
88+
// If w is nil, the op was synchronous.
89+
return err
90+
}
91+
return tpgresource.OperationWait(w, activity, timeout, config.PollInterval)
92+
}

0 commit comments

Comments
 (0)