Skip to content

Commit

Permalink
port media edge resources over from EAP provider (#4958) (#9540)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Jul 9, 2021
1 parent c841bbc commit a60eda5
Show file tree
Hide file tree
Showing 32 changed files with 8,555 additions and 14 deletions.
7 changes: 7 additions & 0 deletions .changelog/4958.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:new-resource
`google_certificate_manager_certificate`
`google_certificate_manager_dns_authorization`
`google_network_services_edge_cache_keyset`
`google_network_services_edge_cache_origin`
`google_network_services_edge_cache_service`
```
61 changes: 61 additions & 0 deletions google/certificate_manager_operation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// ----------------------------------------------------------------------------
//
// *** 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 (
"fmt"
"time"
)

type CertificateManagerOperationWaiter struct {
Config *Config
UserAgent string
Project string
CommonOperationWaiter
}

func (w *CertificateManagerOperationWaiter) 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://certificatemanager.googleapis.com/v1alpha2/%s", w.CommonOperationWaiter.Op.Name)

return sendRequest(w.Config, "GET", w.Project, url, w.UserAgent, nil)
}

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

func certificateManagerOperationWaitTime(config *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 := createCertificateManagerWaiter(config, op, project, activity, userAgent)
if err != nil {
// If w is nil, the op was synchronous.
return err
}
return OperationWait(w, activity, timeout, config.PollInterval)
}
8 changes: 8 additions & 0 deletions google/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ type Config struct {
BigtableBasePath string
BillingBasePath string
BinaryAuthorizationBasePath string
CertificateManagerBasePath string
CloudAssetBasePath string
CloudBuildBasePath string
CloudFunctionsBasePath string
Expand Down Expand Up @@ -121,6 +122,7 @@ type Config struct {
MLEngineBasePath string
MonitoringBasePath string
NetworkManagementBasePath string
NetworkServicesBasePath string
NotebooksBasePath string
OSConfigBasePath string
OSLoginBasePath string
Expand Down Expand Up @@ -180,6 +182,7 @@ const BigqueryReservationBasePathKey = "BigqueryReservation"
const BigtableBasePathKey = "Bigtable"
const BillingBasePathKey = "Billing"
const BinaryAuthorizationBasePathKey = "BinaryAuthorization"
const CertificateManagerBasePathKey = "CertificateManager"
const CloudAssetBasePathKey = "CloudAsset"
const CloudBuildBasePathKey = "CloudBuild"
const CloudFunctionsBasePathKey = "CloudFunctions"
Expand Down Expand Up @@ -210,6 +213,7 @@ const MemcacheBasePathKey = "Memcache"
const MLEngineBasePathKey = "MLEngine"
const MonitoringBasePathKey = "Monitoring"
const NetworkManagementBasePathKey = "NetworkManagement"
const NetworkServicesBasePathKey = "NetworkServices"
const NotebooksBasePathKey = "Notebooks"
const OSConfigBasePathKey = "OSConfig"
const OSLoginBasePathKey = "OSLogin"
Expand Down Expand Up @@ -260,6 +264,7 @@ var DefaultBasePaths = map[string]string{
BigtableBasePathKey: "https://bigtableadmin.googleapis.com/v2/",
BillingBasePathKey: "https://billingbudgets.googleapis.com/v1/",
BinaryAuthorizationBasePathKey: "https://binaryauthorization.googleapis.com/v1/",
CertificateManagerBasePathKey: "https://certificatemanager.googleapis.com/v1alpha2/",
CloudAssetBasePathKey: "https://cloudasset.googleapis.com/v1/",
CloudBuildBasePathKey: "https://cloudbuild.googleapis.com/v1/",
CloudFunctionsBasePathKey: "https://cloudfunctions.googleapis.com/v1/",
Expand Down Expand Up @@ -290,6 +295,7 @@ var DefaultBasePaths = map[string]string{
MLEngineBasePathKey: "https://ml.googleapis.com/v1/",
MonitoringBasePathKey: "https://monitoring.googleapis.com/",
NetworkManagementBasePathKey: "https://networkmanagement.googleapis.com/v1/",
NetworkServicesBasePathKey: "https://networkservices.googleapis.com/v1/",
NotebooksBasePathKey: "https://notebooks.googleapis.com/v1/",
OSConfigBasePathKey: "https://osconfig.googleapis.com/v1/",
OSLoginBasePathKey: "https://oslogin.googleapis.com/v1/",
Expand Down Expand Up @@ -1093,6 +1099,7 @@ func ConfigureBasePaths(c *Config) {
c.BigtableBasePath = DefaultBasePaths[BigtableBasePathKey]
c.BillingBasePath = DefaultBasePaths[BillingBasePathKey]
c.BinaryAuthorizationBasePath = DefaultBasePaths[BinaryAuthorizationBasePathKey]
c.CertificateManagerBasePath = DefaultBasePaths[CertificateManagerBasePathKey]
c.CloudAssetBasePath = DefaultBasePaths[CloudAssetBasePathKey]
c.CloudBuildBasePath = DefaultBasePaths[CloudBuildBasePathKey]
c.CloudFunctionsBasePath = DefaultBasePaths[CloudFunctionsBasePathKey]
Expand Down Expand Up @@ -1123,6 +1130,7 @@ func ConfigureBasePaths(c *Config) {
c.MLEngineBasePath = DefaultBasePaths[MLEngineBasePathKey]
c.MonitoringBasePath = DefaultBasePaths[MonitoringBasePathKey]
c.NetworkManagementBasePath = DefaultBasePaths[NetworkManagementBasePathKey]
c.NetworkServicesBasePath = DefaultBasePaths[NetworkServicesBasePathKey]
c.NotebooksBasePath = DefaultBasePaths[NotebooksBasePathKey]
c.OSConfigBasePath = DefaultBasePaths[OSConfigBasePathKey]
c.OSLoginBasePath = DefaultBasePaths[OSLoginBasePathKey]
Expand Down
61 changes: 61 additions & 0 deletions google/network_services_operation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// ----------------------------------------------------------------------------
//
// *** 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 (
"fmt"
"time"
)

type NetworkServicesOperationWaiter struct {
Config *Config
UserAgent string
Project string
CommonOperationWaiter
}

func (w *NetworkServicesOperationWaiter) 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://networkservices.googleapis.com/v1/%s", w.CommonOperationWaiter.Op.Name)

return sendRequest(w.Config, "GET", w.Project, url, w.UserAgent, nil)
}

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

func networkServicesOperationWaitTime(config *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 := createNetworkServicesWaiter(config, op, project, activity, userAgent)
if err != nil {
// If w is nil, the op was synchronous.
return err
}
return OperationWait(w, activity, timeout, config.PollInterval)
}
27 changes: 25 additions & 2 deletions google/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ func Provider() *schema.Provider {
"GOOGLE_BINARY_AUTHORIZATION_CUSTOM_ENDPOINT",
}, DefaultBasePaths[BinaryAuthorizationBasePathKey]),
},
"certificate_manager_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateCustomEndpoint,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
"GOOGLE_CERTIFICATE_MANAGER_CUSTOM_ENDPOINT",
}, DefaultBasePaths[CertificateManagerBasePathKey]),
},
"cloud_asset_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -467,6 +475,14 @@ func Provider() *schema.Provider {
"GOOGLE_NETWORK_MANAGEMENT_CUSTOM_ENDPOINT",
}, DefaultBasePaths[NetworkManagementBasePathKey]),
},
"network_services_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateCustomEndpoint,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
"GOOGLE_NETWORK_SERVICES_CUSTOM_ENDPOINT",
}, DefaultBasePaths[NetworkServicesBasePathKey]),
},
"notebooks_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -775,9 +791,9 @@ func Provider() *schema.Provider {
return provider
}

// Generated resources: 202
// Generated resources: 207
// Generated IAM resources: 90
// Total generated resources: 292
// Total generated resources: 297
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -828,6 +844,8 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_binary_authorization_attestor_iam_member": ResourceIamMember(BinaryAuthorizationAttestorIamSchema, BinaryAuthorizationAttestorIamUpdaterProducer, BinaryAuthorizationAttestorIdParseFunc),
"google_binary_authorization_attestor_iam_policy": ResourceIamPolicy(BinaryAuthorizationAttestorIamSchema, BinaryAuthorizationAttestorIamUpdaterProducer, BinaryAuthorizationAttestorIdParseFunc),
"google_binary_authorization_policy": resourceBinaryAuthorizationPolicy(),
"google_certificate_manager_dns_authorization": resourceCertificateManagerDnsAuthorization(),
"google_certificate_manager_certificate": resourceCertificateManagerCertificate(),
"google_cloud_asset_project_feed": resourceCloudAssetProjectFeed(),
"google_cloud_asset_folder_feed": resourceCloudAssetFolderFeed(),
"google_cloud_asset_organization_feed": resourceCloudAssetOrganizationFeed(),
Expand Down Expand Up @@ -1014,6 +1032,9 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_monitoring_uptime_check_config": resourceMonitoringUptimeCheckConfig(),
"google_monitoring_metric_descriptor": resourceMonitoringMetricDescriptor(),
"google_network_management_connectivity_test": resourceNetworkManagementConnectivityTest(),
"google_network_services_edge_cache_keyset": resourceNetworkServicesEdgeCacheKeyset(),
"google_network_services_edge_cache_origin": resourceNetworkServicesEdgeCacheOrigin(),
"google_network_services_edge_cache_service": resourceNetworkServicesEdgeCacheService(),
"google_notebooks_environment": resourceNotebooksEnvironment(),
"google_notebooks_instance": resourceNotebooksInstance(),
"google_notebooks_instance_iam_binding": ResourceIamBinding(NotebooksInstanceIamSchema, NotebooksInstanceIamUpdaterProducer, NotebooksInstanceIdParseFunc),
Expand Down Expand Up @@ -1297,6 +1318,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.BigtableBasePath = d.Get("bigtable_custom_endpoint").(string)
config.BillingBasePath = d.Get("billing_custom_endpoint").(string)
config.BinaryAuthorizationBasePath = d.Get("binary_authorization_custom_endpoint").(string)
config.CertificateManagerBasePath = d.Get("certificate_manager_custom_endpoint").(string)
config.CloudAssetBasePath = d.Get("cloud_asset_custom_endpoint").(string)
config.CloudBuildBasePath = d.Get("cloud_build_custom_endpoint").(string)
config.CloudFunctionsBasePath = d.Get("cloud_functions_custom_endpoint").(string)
Expand Down Expand Up @@ -1327,6 +1349,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
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.NetworkServicesBasePath = d.Get("network_services_custom_endpoint").(string)
config.NotebooksBasePath = d.Get("notebooks_custom_endpoint").(string)
config.OSConfigBasePath = d.Get("os_config_custom_endpoint").(string)
config.OSLoginBasePath = d.Get("os_login_custom_endpoint").(string)
Expand Down
Loading

0 comments on commit a60eda5

Please sign in to comment.