Skip to content

Commit c1d1701

Browse files
Feat: Add google_oracle_database_cloud_exadata_infrastructure resource (#11879) (#8371)
[upstream:577cf5d47b998e9a936d76147d38b987aca39128] Signed-off-by: Modular Magician <[email protected]>
1 parent dd1892b commit c1d1701

13 files changed

+2470
-2
lines changed

Diff for: .changelog/11879.txt

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

Diff for: google-beta/fwmodels/provider_model.go

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ type ProviderModel struct {
126126
NetworkSecurityCustomEndpoint types.String `tfsdk:"network_security_custom_endpoint"`
127127
NetworkServicesCustomEndpoint types.String `tfsdk:"network_services_custom_endpoint"`
128128
NotebooksCustomEndpoint types.String `tfsdk:"notebooks_custom_endpoint"`
129+
OracleDatabaseCustomEndpoint types.String `tfsdk:"oracle_database_custom_endpoint"`
129130
OrgPolicyCustomEndpoint types.String `tfsdk:"org_policy_custom_endpoint"`
130131
OSConfigCustomEndpoint types.String `tfsdk:"os_config_custom_endpoint"`
131132
OSLoginCustomEndpoint types.String `tfsdk:"os_login_custom_endpoint"`

Diff for: google-beta/fwprovider/framework_provider.go

+6
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,12 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest,
734734
transport_tpg.CustomEndpointValidator(),
735735
},
736736
},
737+
"oracle_database_custom_endpoint": &schema.StringAttribute{
738+
Optional: true,
739+
Validators: []validator.String{
740+
transport_tpg.CustomEndpointValidator(),
741+
},
742+
},
737743
"org_policy_custom_endpoint": &schema.StringAttribute{
738744
Optional: true,
739745
Validators: []validator.String{

Diff for: google-beta/fwtransport/framework_config.go

+10
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ type FrameworkProviderConfig struct {
161161
NetworkSecurityBasePath string
162162
NetworkServicesBasePath string
163163
NotebooksBasePath string
164+
OracleDatabaseBasePath string
164165
OrgPolicyBasePath string
165166
OSConfigBasePath string
166167
OSLoginBasePath string
@@ -338,6 +339,7 @@ func (p *FrameworkProviderConfig) LoadAndValidateFramework(ctx context.Context,
338339
p.NetworkSecurityBasePath = data.NetworkSecurityCustomEndpoint.ValueString()
339340
p.NetworkServicesBasePath = data.NetworkServicesCustomEndpoint.ValueString()
340341
p.NotebooksBasePath = data.NotebooksCustomEndpoint.ValueString()
342+
p.OracleDatabaseBasePath = data.OracleDatabaseCustomEndpoint.ValueString()
341343
p.OrgPolicyBasePath = data.OrgPolicyCustomEndpoint.ValueString()
342344
p.OSConfigBasePath = data.OSConfigCustomEndpoint.ValueString()
343345
p.OSLoginBasePath = data.OSLoginCustomEndpoint.ValueString()
@@ -1301,6 +1303,14 @@ func (p *FrameworkProviderConfig) HandleDefaults(ctx context.Context, data *fwmo
13011303
data.NotebooksCustomEndpoint = types.StringValue(customEndpoint.(string))
13021304
}
13031305
}
1306+
if data.OracleDatabaseCustomEndpoint.IsNull() {
1307+
customEndpoint := transport_tpg.MultiEnvDefault([]string{
1308+
"GOOGLE_ORACLE_DATABASE_CUSTOM_ENDPOINT",
1309+
}, transport_tpg.DefaultBasePaths[transport_tpg.OracleDatabaseBasePathKey])
1310+
if customEndpoint != nil {
1311+
data.OracleDatabaseCustomEndpoint = types.StringValue(customEndpoint.(string))
1312+
}
1313+
}
13041314
if data.OrgPolicyCustomEndpoint.IsNull() {
13051315
customEndpoint := transport_tpg.MultiEnvDefault([]string{
13061316
"GOOGLE_ORG_POLICY_CUSTOM_ENDPOINT",

Diff for: google-beta/provider/provider.go

+6
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,11 @@ func Provider() *schema.Provider {
635635
Optional: true,
636636
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
637637
},
638+
"oracle_database_custom_endpoint": {
639+
Type: schema.TypeString,
640+
Optional: true,
641+
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
642+
},
638643
"org_policy_custom_endpoint": {
639644
Type: schema.TypeString,
640645
Optional: true,
@@ -1125,6 +1130,7 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
11251130
config.NetworkSecurityBasePath = d.Get("network_security_custom_endpoint").(string)
11261131
config.NetworkServicesBasePath = d.Get("network_services_custom_endpoint").(string)
11271132
config.NotebooksBasePath = d.Get("notebooks_custom_endpoint").(string)
1133+
config.OracleDatabaseBasePath = d.Get("oracle_database_custom_endpoint").(string)
11281134
config.OrgPolicyBasePath = d.Get("org_policy_custom_endpoint").(string)
11291135
config.OSConfigBasePath = d.Get("os_config_custom_endpoint").(string)
11301136
config.OSLoginBasePath = d.Get("os_login_custom_endpoint").(string)

Diff for: google-beta/provider/provider_mmv1_resources.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ import (
102102
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/networksecurity"
103103
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/networkservices"
104104
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/notebooks"
105+
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/oracledatabase"
105106
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/orgpolicy"
106107
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/osconfig"
107108
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/oslogin"
@@ -486,9 +487,9 @@ var handwrittenIAMDatasources = map[string]*schema.Resource{
486487
}
487488

488489
// Resources
489-
// Generated resources: 532
490+
// Generated resources: 533
490491
// Generated IAM resources: 291
491-
// Total generated resources: 823
492+
// Total generated resources: 824
492493
var generatedResources = map[string]*schema.Resource{
493494
"google_folder_access_approval_settings": accessapproval.ResourceAccessApprovalFolderSettings(),
494495
"google_organization_access_approval_settings": accessapproval.ResourceAccessApprovalOrganizationSettings(),
@@ -1126,6 +1127,7 @@ var generatedResources = map[string]*schema.Resource{
11261127
"google_notebooks_runtime_iam_binding": tpgiamresource.ResourceIamBinding(notebooks.NotebooksRuntimeIamSchema, notebooks.NotebooksRuntimeIamUpdaterProducer, notebooks.NotebooksRuntimeIdParseFunc),
11271128
"google_notebooks_runtime_iam_member": tpgiamresource.ResourceIamMember(notebooks.NotebooksRuntimeIamSchema, notebooks.NotebooksRuntimeIamUpdaterProducer, notebooks.NotebooksRuntimeIdParseFunc),
11281129
"google_notebooks_runtime_iam_policy": tpgiamresource.ResourceIamPolicy(notebooks.NotebooksRuntimeIamSchema, notebooks.NotebooksRuntimeIamUpdaterProducer, notebooks.NotebooksRuntimeIdParseFunc),
1130+
"google_oracle_database_cloud_exadata_infrastructure": oracledatabase.ResourceOracleDatabaseCloudExadataInfrastructure(),
11291131
"google_org_policy_custom_constraint": orgpolicy.ResourceOrgPolicyCustomConstraint(),
11301132
"google_org_policy_policy": orgpolicy.ResourceOrgPolicyPolicy(),
11311133
"google_os_config_guest_policies": osconfig.ResourceOSConfigGuestPolicies(),
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 oracledatabase
19+
20+
import (
21+
"encoding/json"
22+
"errors"
23+
"fmt"
24+
"time"
25+
26+
"github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource"
27+
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
28+
)
29+
30+
type OracleDatabaseOperationWaiter struct {
31+
Config *transport_tpg.Config
32+
UserAgent string
33+
Project string
34+
tpgresource.CommonOperationWaiter
35+
}
36+
37+
func (w *OracleDatabaseOperationWaiter) 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.OracleDatabaseBasePath, 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 createOracleDatabaseWaiter(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string) (*OracleDatabaseOperationWaiter, error) {
54+
w := &OracleDatabaseOperationWaiter{
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 OracleDatabaseOperationWaitTimeWithResponse(config *transport_tpg.Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
67+
w, err := createOracleDatabaseWaiter(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 OracleDatabaseOperationWaitTime(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 := createOracleDatabaseWaiter(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)