Skip to content

Commit 53571ee

Browse files
updated storage_pool (#9229) (#16573)
[upstream:7a20c9cc77f933c0085225b00e59556e8ae3b57c] Signed-off-by: Modular Magician <[email protected]>
1 parent d9910e2 commit 53571ee

15 files changed

+1407
-2
lines changed

.changelog/9229.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:new-resource
2+
`google_netapp_storage_pool`
3+
```

.teamcity/components/generated/services.kt

+5
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,11 @@ var services = mapOf(
456456
"displayName" to "Monitoring",
457457
"path" to "./google/services/monitoring"
458458
),
459+
"netapp" to mapOf(
460+
"name" to "netapp",
461+
"displayName" to "Netapp",
462+
"path" to "./google/services/netapp"
463+
),
459464
"networkconnectivity" to mapOf(
460465
"name" to "networkconnectivity",
461466
"displayName" to "Networkconnectivity",

google/fwmodels/provider_model.go

+1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ type ProviderModel struct {
9999
MigrationCenterCustomEndpoint types.String `tfsdk:"migration_center_custom_endpoint"`
100100
MLEngineCustomEndpoint types.String `tfsdk:"ml_engine_custom_endpoint"`
101101
MonitoringCustomEndpoint types.String `tfsdk:"monitoring_custom_endpoint"`
102+
NetappCustomEndpoint types.String `tfsdk:"netapp_custom_endpoint"`
102103
NetworkConnectivityCustomEndpoint types.String `tfsdk:"network_connectivity_custom_endpoint"`
103104
NetworkManagementCustomEndpoint types.String `tfsdk:"network_management_custom_endpoint"`
104105
NetworkSecurityCustomEndpoint types.String `tfsdk:"network_security_custom_endpoint"`

google/fwprovider/framework_provider.go

+6
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,12 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest,
574574
transport_tpg.CustomEndpointValidator(),
575575
},
576576
},
577+
"netapp_custom_endpoint": &schema.StringAttribute{
578+
Optional: true,
579+
Validators: []validator.String{
580+
transport_tpg.CustomEndpointValidator(),
581+
},
582+
},
577583
"network_connectivity_custom_endpoint": &schema.StringAttribute{
578584
Optional: true,
579585
Validators: []validator.String{

google/fwtransport/framework_config.go

+10
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ type FrameworkProviderConfig struct {
124124
MigrationCenterBasePath string
125125
MLEngineBasePath string
126126
MonitoringBasePath string
127+
NetappBasePath string
127128
NetworkConnectivityBasePath string
128129
NetworkManagementBasePath string
129130
NetworkSecurityBasePath string
@@ -265,6 +266,7 @@ func (p *FrameworkProviderConfig) LoadAndValidateFramework(ctx context.Context,
265266
p.MigrationCenterBasePath = data.MigrationCenterCustomEndpoint.ValueString()
266267
p.MLEngineBasePath = data.MLEngineCustomEndpoint.ValueString()
267268
p.MonitoringBasePath = data.MonitoringCustomEndpoint.ValueString()
269+
p.NetappBasePath = data.NetappCustomEndpoint.ValueString()
268270
p.NetworkConnectivityBasePath = data.NetworkConnectivityCustomEndpoint.ValueString()
269271
p.NetworkManagementBasePath = data.NetworkManagementCustomEndpoint.ValueString()
270272
p.NetworkSecurityBasePath = data.NetworkSecurityCustomEndpoint.ValueString()
@@ -1005,6 +1007,14 @@ func (p *FrameworkProviderConfig) HandleDefaults(ctx context.Context, data *fwmo
10051007
data.MonitoringCustomEndpoint = types.StringValue(customEndpoint.(string))
10061008
}
10071009
}
1010+
if data.NetappCustomEndpoint.IsNull() {
1011+
customEndpoint := transport_tpg.MultiEnvDefault([]string{
1012+
"GOOGLE_NETAPP_CUSTOM_ENDPOINT",
1013+
}, transport_tpg.DefaultBasePaths[transport_tpg.NetappBasePathKey])
1014+
if customEndpoint != nil {
1015+
data.NetappCustomEndpoint = types.StringValue(customEndpoint.(string))
1016+
}
1017+
}
10081018
if data.NetworkConnectivityCustomEndpoint.IsNull() {
10091019
customEndpoint := transport_tpg.MultiEnvDefault([]string{
10101020
"GOOGLE_NETWORK_CONNECTIVITY_CUSTOM_ENDPOINT",

google/provider/provider.go

+6
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,11 @@ func Provider() *schema.Provider {
500500
Optional: true,
501501
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
502502
},
503+
"netapp_custom_endpoint": {
504+
Type: schema.TypeString,
505+
Optional: true,
506+
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
507+
},
503508
"network_connectivity_custom_endpoint": {
504509
Type: schema.TypeString,
505510
Optional: true,
@@ -918,6 +923,7 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
918923
config.MigrationCenterBasePath = d.Get("migration_center_custom_endpoint").(string)
919924
config.MLEngineBasePath = d.Get("ml_engine_custom_endpoint").(string)
920925
config.MonitoringBasePath = d.Get("monitoring_custom_endpoint").(string)
926+
config.NetappBasePath = d.Get("netapp_custom_endpoint").(string)
921927
config.NetworkConnectivityBasePath = d.Get("network_connectivity_custom_endpoint").(string)
922928
config.NetworkManagementBasePath = d.Get("network_management_custom_endpoint").(string)
923929
config.NetworkSecurityBasePath = d.Get("network_security_custom_endpoint").(string)

google/provider/provider_mmv1_resources.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ import (
7878
"github.com/hashicorp/terraform-provider-google/google/services/migrationcenter"
7979
"github.com/hashicorp/terraform-provider-google/google/services/mlengine"
8080
"github.com/hashicorp/terraform-provider-google/google/services/monitoring"
81+
"github.com/hashicorp/terraform-provider-google/google/services/netapp"
8182
"github.com/hashicorp/terraform-provider-google/google/services/networkconnectivity"
8283
"github.com/hashicorp/terraform-provider-google/google/services/networkmanagement"
8384
"github.com/hashicorp/terraform-provider-google/google/services/networksecurity"
@@ -353,9 +354,9 @@ var handwrittenIAMDatasources = map[string]*schema.Resource{
353354
}
354355

355356
// Resources
356-
// Generated resources: 340
357+
// Generated resources: 341
357358
// Generated IAM resources: 213
358-
// Total generated resources: 553
359+
// Total generated resources: 554
359360
var generatedResources = map[string]*schema.Resource{
360361
"google_folder_access_approval_settings": accessapproval.ResourceAccessApprovalFolderSettings(),
361362
"google_organization_access_approval_settings": accessapproval.ResourceAccessApprovalOrganizationSettings(),
@@ -786,6 +787,7 @@ var generatedResources = map[string]*schema.Resource{
786787
"google_monitoring_custom_service": monitoring.ResourceMonitoringService(),
787788
"google_monitoring_slo": monitoring.ResourceMonitoringSlo(),
788789
"google_monitoring_uptime_check_config": monitoring.ResourceMonitoringUptimeCheckConfig(),
790+
"google_netapp_storage_pool": netapp.ResourceNetappstoragePool(),
789791
"google_network_connectivity_policy_based_route": networkconnectivity.ResourceNetworkConnectivityPolicyBasedRoute(),
790792
"google_network_connectivity_service_connection_policy": networkconnectivity.ResourceNetworkConnectivityServiceConnectionPolicy(),
791793
"google_network_management_connectivity_test": networkmanagement.ResourceNetworkManagementConnectivityTest(),
+92
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 netapp
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 NetappOperationWaiter struct {
31+
Config *transport_tpg.Config
32+
UserAgent string
33+
Project string
34+
tpgresource.CommonOperationWaiter
35+
}
36+
37+
func (w *NetappOperationWaiter) 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.NetappBasePath, 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 createNetappWaiter(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string) (*NetappOperationWaiter, error) {
54+
w := &NetappOperationWaiter{
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 NetappOperationWaitTimeWithResponse(config *transport_tpg.Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
67+
w, err := createNetappWaiter(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 NetappOperationWaitTime(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 := createNetappWaiter(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)