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 Management ConnectivityTest resource #6529

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
3 changes: 3 additions & 0 deletions .changelog/3601.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
`google_network_management_connectivity_test`
```
3 changes: 3 additions & 0 deletions google/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ type Config struct {
LoggingBasePath string
MLEngineBasePath string
MonitoringBasePath string
NetworkManagementBasePath string
OSLoginBasePath string
PubsubBasePath string
RedisBasePath string
Expand Down Expand Up @@ -249,6 +250,7 @@ var KMSDefaultBasePath = "https://cloudkms.googleapis.com/v1/"
var LoggingDefaultBasePath = "https://logging.googleapis.com/v2/"
var MLEngineDefaultBasePath = "https://ml.googleapis.com/v1/"
var MonitoringDefaultBasePath = "https://monitoring.googleapis.com/"
var NetworkManagementDefaultBasePath = "https://networkmanagement.googleapis.com/v1/"
var OSLoginDefaultBasePath = "https://oslogin.googleapis.com/v1/"
var PubsubDefaultBasePath = "https://pubsub.googleapis.com/v1/"
var RedisDefaultBasePath = "https://redis.googleapis.com/v1/"
Expand Down Expand Up @@ -765,6 +767,7 @@ func ConfigureBasePaths(c *Config) {
c.LoggingBasePath = LoggingDefaultBasePath
c.MLEngineBasePath = MLEngineDefaultBasePath
c.MonitoringBasePath = MonitoringDefaultBasePath
c.NetworkManagementBasePath = NetworkManagementDefaultBasePath
c.OSLoginBasePath = OSLoginDefaultBasePath
c.PubsubBasePath = PubsubDefaultBasePath
c.RedisBasePath = RedisDefaultBasePath
Expand Down
72 changes: 72 additions & 0 deletions google/network_management_operation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// ----------------------------------------------------------------------------
//
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
//
// ----------------------------------------------------------------------------
//
// 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 google

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

type NetworkManagementOperationWaiter struct {
Config *Config
Project string
CommonOperationWaiter
}

func (w *NetworkManagementOperationWaiter) 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("https://networkmanagement.googleapis.com/v1/%s", w.CommonOperationWaiter.Op.Name)
return sendRequest(w.Config, "GET", w.Project, url, nil)
}

func createNetworkManagementWaiter(config *Config, op map[string]interface{}, project, activity string) (*NetworkManagementOperationWaiter, error) {
if val, ok := op["name"]; !ok || val == "" {
// This was a synchronous call - there is no operation to wait for.
return nil, nil
}
w := &NetworkManagementOperationWaiter{
Config: config,
Project: project,
}
if err := w.CommonOperationWaiter.SetOp(op); err != nil {
return nil, err
}
return w, nil
}

// nolint: deadcode,unused
func networkManagementOperationWaitTimeWithResponse(config *Config, op map[string]interface{}, response *map[string]interface{}, project, activity string, timeout time.Duration) error {
w, err := createNetworkManagementWaiter(config, op, project, activity)
if err != nil || w == nil {
// If w is nil, the op was synchronous.
return err
}
if err := OperationWait(w, activity, timeout, config.PollInterval); err != nil {
return err
}
return json.Unmarshal([]byte(w.CommonOperationWaiter.Op.Response), response)
}

func networkManagementOperationWaitTime(config *Config, op map[string]interface{}, project, activity string, timeout time.Duration) error {
w, err := createNetworkManagementWaiter(config, op, project, activity)
if err != nil || w == nil {
// If w is nil, the op was synchronous.
return err
}
return OperationWait(w, activity, timeout, config.PollInterval)
}
14 changes: 12 additions & 2 deletions google/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,14 @@ func Provider() terraform.ResourceProvider {
"GOOGLE_MONITORING_CUSTOM_ENDPOINT",
}, MonitoringDefaultBasePath),
},
"network_management_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateCustomEndpoint,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
"GOOGLE_NETWORK_MANAGEMENT_CUSTOM_ENDPOINT",
}, NetworkManagementDefaultBasePath),
},
"os_login_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -563,9 +571,9 @@ func Provider() terraform.ResourceProvider {
return provider
}

// Generated resources: 134
// Generated resources: 135
// Generated IAM resources: 57
// Total generated resources: 191
// Total generated resources: 192
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -728,6 +736,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_monitoring_custom_service": resourceMonitoringService(),
"google_monitoring_slo": resourceMonitoringSlo(),
"google_monitoring_uptime_check_config": resourceMonitoringUptimeCheckConfig(),
"google_network_management_connectivity_test": resourceNetworkManagementConnectivityTest(),
"google_os_login_ssh_public_key": resourceOSLoginSSHPublicKey(),
"google_pubsub_topic": resourcePubsubTopic(),
"google_pubsub_topic_iam_binding": ResourceIamBinding(PubsubTopicIamSchema, PubsubTopicIamUpdaterProducer, PubsubTopicIdParseFunc),
Expand Down Expand Up @@ -959,6 +968,7 @@ func providerConfigure(d *schema.ResourceData, p *schema.Provider, terraformVers
config.LoggingBasePath = d.Get("logging_custom_endpoint").(string)
config.MLEngineBasePath = d.Get("ml_engine_custom_endpoint").(string)
config.MonitoringBasePath = d.Get("monitoring_custom_endpoint").(string)
config.NetworkManagementBasePath = d.Get("network_management_custom_endpoint").(string)
config.OSLoginBasePath = d.Get("os_login_custom_endpoint").(string)
config.PubsubBasePath = d.Get("pubsub_custom_endpoint").(string)
config.RedisBasePath = d.Get("redis_custom_endpoint").(string)
Expand Down
Loading