Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Network and Subnet resources for edgenetwork #15891

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changelog/8905.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
```release-note:new-resource
edgenetwork : `google_edgenetwork_network`
```
```release-note:new-resource
edgenetwork : `google_edgenetwork_subnet`
```
5 changes: 5 additions & 0 deletions .teamcity/components/generated/services.kt
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ var services = mapOf(
"displayName" to "Documentaiwarehouse",
"path" to "./google/services/documentaiwarehouse"
),
"edgenetwork" to mapOf(
"name" to "edgenetwork",
"displayName" to "Edgenetwork",
"path" to "./google/services/edgenetwork"
),
"essentialcontacts" to mapOf(
"name" to "essentialcontacts",
"displayName" to "Essentialcontacts",
Expand Down
1 change: 1 addition & 0 deletions google/fwmodels/provider_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ type ProviderModel struct {
DNSCustomEndpoint types.String `tfsdk:"dns_custom_endpoint"`
DocumentAICustomEndpoint types.String `tfsdk:"document_ai_custom_endpoint"`
DocumentAIWarehouseCustomEndpoint types.String `tfsdk:"document_ai_warehouse_custom_endpoint"`
EdgenetworkCustomEndpoint types.String `tfsdk:"edgenetwork_custom_endpoint"`
EssentialContactsCustomEndpoint types.String `tfsdk:"essential_contacts_custom_endpoint"`
FilestoreCustomEndpoint types.String `tfsdk:"filestore_custom_endpoint"`
FirestoreCustomEndpoint types.String `tfsdk:"firestore_custom_endpoint"`
Expand Down
6 changes: 6 additions & 0 deletions google/fwprovider/framework_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,12 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest,
transport_tpg.CustomEndpointValidator(),
},
},
"edgenetwork_custom_endpoint": &schema.StringAttribute{
Optional: true,
Validators: []validator.String{
transport_tpg.CustomEndpointValidator(),
},
},
"essential_contacts_custom_endpoint": &schema.StringAttribute{
Optional: true,
Validators: []validator.String{
Expand Down
10 changes: 10 additions & 0 deletions google/fwtransport/framework_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ type FrameworkProviderConfig struct {
DNSBasePath string
DocumentAIBasePath string
DocumentAIWarehouseBasePath string
EdgenetworkBasePath string
EssentialContactsBasePath string
FilestoreBasePath string
FirestoreBasePath string
Expand Down Expand Up @@ -245,6 +246,7 @@ func (p *FrameworkProviderConfig) LoadAndValidateFramework(ctx context.Context,
p.DNSBasePath = data.DNSCustomEndpoint.ValueString()
p.DocumentAIBasePath = data.DocumentAICustomEndpoint.ValueString()
p.DocumentAIWarehouseBasePath = data.DocumentAIWarehouseCustomEndpoint.ValueString()
p.EdgenetworkBasePath = data.EdgenetworkCustomEndpoint.ValueString()
p.EssentialContactsBasePath = data.EssentialContactsCustomEndpoint.ValueString()
p.FilestoreBasePath = data.FilestoreCustomEndpoint.ValueString()
p.FirestoreBasePath = data.FirestoreCustomEndpoint.ValueString()
Expand Down Expand Up @@ -896,6 +898,14 @@ func (p *FrameworkProviderConfig) HandleDefaults(ctx context.Context, data *fwmo
data.DocumentAIWarehouseCustomEndpoint = types.StringValue(customEndpoint.(string))
}
}
if data.EdgenetworkCustomEndpoint.IsNull() {
customEndpoint := transport_tpg.MultiEnvDefault([]string{
"GOOGLE_EDGENETWORK_CUSTOM_ENDPOINT",
}, transport_tpg.DefaultBasePaths[transport_tpg.EdgenetworkBasePathKey])
if customEndpoint != nil {
data.EdgenetworkCustomEndpoint = types.StringValue(customEndpoint.(string))
}
}
if data.EssentialContactsCustomEndpoint.IsNull() {
customEndpoint := transport_tpg.MultiEnvDefault([]string{
"GOOGLE_ESSENTIAL_CONTACTS_CUSTOM_ENDPOINT",
Expand Down
13 changes: 11 additions & 2 deletions google/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import (
"github.com/hashicorp/terraform-provider-google/google/services/dns"
"github.com/hashicorp/terraform-provider-google/google/services/documentai"
"github.com/hashicorp/terraform-provider-google/google/services/documentaiwarehouse"
"github.com/hashicorp/terraform-provider-google/google/services/edgenetwork"
"github.com/hashicorp/terraform-provider-google/google/services/essentialcontacts"
"github.com/hashicorp/terraform-provider-google/google/services/filestore"
"github.com/hashicorp/terraform-provider-google/google/services/firestore"
Expand Down Expand Up @@ -479,6 +480,11 @@ func Provider() *schema.Provider {
Optional: true,
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
},
"edgenetwork_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
},
"essential_contacts_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -987,9 +993,9 @@ func DatasourceMapWithErrors() (map[string]*schema.Resource, error) {
})
}

// Generated resources: 323
// Generated resources: 325
// Generated IAM resources: 210
// Total generated resources: 533
// Total generated resources: 535
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -1311,6 +1317,8 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_document_ai_processor_default_version": documentai.ResourceDocumentAIProcessorDefaultVersion(),
"google_document_ai_warehouse_document_schema": documentaiwarehouse.ResourceDocumentAIWarehouseDocumentSchema(),
"google_document_ai_warehouse_location": documentaiwarehouse.ResourceDocumentAIWarehouseLocation(),
"google_edgenetwork_network": edgenetwork.ResourceEdgenetworkNetwork(),
"google_edgenetwork_subnet": edgenetwork.ResourceEdgenetworkSubnet(),
"google_essential_contacts_contact": essentialcontacts.ResourceEssentialContactsContact(),
"google_filestore_backup": filestore.ResourceFilestoreBackup(),
"google_filestore_instance": filestore.ResourceFilestoreInstance(),
Expand Down Expand Up @@ -1807,6 +1815,7 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.DNSBasePath = d.Get("dns_custom_endpoint").(string)
config.DocumentAIBasePath = d.Get("document_ai_custom_endpoint").(string)
config.DocumentAIWarehouseBasePath = d.Get("document_ai_warehouse_custom_endpoint").(string)
config.EdgenetworkBasePath = d.Get("edgenetwork_custom_endpoint").(string)
config.EssentialContactsBasePath = d.Get("essential_contacts_custom_endpoint").(string)
config.FilestoreBasePath = d.Get("filestore_custom_endpoint").(string)
config.FirestoreBasePath = d.Get("firestore_custom_endpoint").(string)
Expand Down
92 changes: 92 additions & 0 deletions google/services/edgenetwork/edgenetwork_operation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

// ----------------------------------------------------------------------------
//
// *** AUTO GENERATED CODE *** Type: MMv1 ***
//
// ----------------------------------------------------------------------------
//
// 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 edgenetwork

import (
"encoding/json"
"errors"
"fmt"
"time"

"github.com/hashicorp/terraform-provider-google/google/tpgresource"
transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport"
)

type EdgenetworkOperationWaiter struct {
Config *transport_tpg.Config
UserAgent string
Project string
tpgresource.CommonOperationWaiter
}

func (w *EdgenetworkOperationWaiter) 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("%s%s", w.Config.EdgenetworkBasePath, w.CommonOperationWaiter.Op.Name)

return transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
Config: w.Config,
Method: "GET",
Project: w.Project,
RawURL: url,
UserAgent: w.UserAgent,
})
}

func createEdgenetworkWaiter(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string) (*EdgenetworkOperationWaiter, error) {
w := &EdgenetworkOperationWaiter{
Config: config,
UserAgent: userAgent,
Project: project,
}
if err := w.CommonOperationWaiter.SetOp(op); err != nil {
return nil, err
}
return w, nil
}

// nolint: deadcode,unused
func EdgenetworkOperationWaitTimeWithResponse(config *transport_tpg.Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
w, err := createEdgenetworkWaiter(config, op, project, activity, userAgent)
if err != nil {
return err
}
if err := tpgresource.OperationWait(w, activity, timeout, config.PollInterval); err != nil {
return err
}
rawResponse := []byte(w.CommonOperationWaiter.Op.Response)
if len(rawResponse) == 0 {
return errors.New("`resource` not set in operation response")
}
return json.Unmarshal(rawResponse, response)
}

func EdgenetworkOperationWaitTime(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
if val, ok := op["name"]; !ok || val == "" {
// This was a synchronous call - there is no operation to wait for.
return nil
}
w, err := createEdgenetworkWaiter(config, op, project, activity, userAgent)
if err != nil {
// If w is nil, the op was synchronous.
return err
}
return tpgresource.OperationWait(w, activity, timeout, config.PollInterval)
}
Loading