From 9008bfa68813f2ee252220616f69078a9e8280b3 Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 19 Aug 2019 14:45:32 -0700 Subject: [PATCH] move ConfigureBasePaths to config.go (#1050) Signed-off-by: Modular Magician --- google-beta/config.go | 61 +++++++++++++++++++++++++++++++++++++++++ google-beta/provider.go | 61 ----------------------------------------- 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/google-beta/config.go b/google-beta/config.go index 6c4cef025a6..6a86156b21c 100644 --- a/google-beta/config.go +++ b/google-beta/config.go @@ -684,3 +684,64 @@ func (c *Config) getTokenSource(clientScopes []string) (oauth2.TokenSource, erro func removeBasePathVersion(url string) string { return regexp.MustCompile(`/[^/]+/$`).ReplaceAllString(url, "/") } + +// For a consumer of config.go that isn't a full fledged provider and doesn't +// have its own endpoint mechanism such as sweepers, init {{service}}BasePath +// values to a default. After using this, you should call config.LoadAndValidate. +func ConfigureBasePaths(c *Config) { + // Generated Products + c.AccessContextManagerBasePath = AccessContextManagerDefaultBasePath + c.AppEngineBasePath = AppEngineDefaultBasePath + c.BigqueryDataTransferBasePath = BigqueryDataTransferDefaultBasePath + c.BigtableBasePath = BigtableDefaultBasePath + c.BinaryAuthorizationBasePath = BinaryAuthorizationDefaultBasePath + c.CloudBuildBasePath = CloudBuildDefaultBasePath + c.CloudRunBasePath = CloudRunDefaultBasePath + c.CloudSchedulerBasePath = CloudSchedulerDefaultBasePath + c.ComputeBasePath = ComputeDefaultBasePath + c.ContainerAnalysisBasePath = ContainerAnalysisDefaultBasePath + c.DnsBasePath = DnsDefaultBasePath + c.FilestoreBasePath = FilestoreDefaultBasePath + c.FirestoreBasePath = FirestoreDefaultBasePath + c.HealthcareBasePath = HealthcareDefaultBasePath + c.KmsBasePath = KmsDefaultBasePath + c.LoggingBasePath = LoggingDefaultBasePath + c.MLEngineBasePath = MLEngineDefaultBasePath + c.MonitoringBasePath = MonitoringDefaultBasePath + c.PubsubBasePath = PubsubDefaultBasePath + c.RedisBasePath = RedisDefaultBasePath + c.ResourceManagerBasePath = ResourceManagerDefaultBasePath + c.SecurityCenterBasePath = SecurityCenterDefaultBasePath + c.SecurityScannerBasePath = SecurityScannerDefaultBasePath + c.SourceRepoBasePath = SourceRepoDefaultBasePath + c.SpannerBasePath = SpannerDefaultBasePath + c.SqlBasePath = SqlDefaultBasePath + c.StorageBasePath = StorageDefaultBasePath + c.TpuBasePath = TpuDefaultBasePath + c.VpcAccessBasePath = VpcAccessDefaultBasePath + + // Handwritten Products / Versioned / Atypical Entries + // start beta-only products + c.IAPBasePath = IAPDefaultBasePath + // end beta-only products + c.CloudBillingBasePath = CloudBillingDefaultBasePath + c.ComposerBasePath = ComposerDefaultBasePath + c.ComputeBetaBasePath = ComputeBetaDefaultBasePath + c.ContainerBasePath = ContainerDefaultBasePath + c.ContainerBetaBasePath = ContainerBetaDefaultBasePath + c.DataprocBasePath = DataprocDefaultBasePath + c.DataflowBasePath = DataflowDefaultBasePath + c.DnsBetaBasePath = DnsBetaDefaultBasePath + c.IamCredentialsBasePath = IamCredentialsDefaultBasePath + c.ResourceManagerV2Beta1BasePath = ResourceManagerV2Beta1DefaultBasePath + c.RuntimeconfigBasePath = RuntimeconfigDefaultBasePath + c.IAMBasePath = IAMDefaultBasePath + c.ServiceManagementBasePath = ServiceManagementDefaultBasePath + c.ServiceNetworkingBasePath = ServiceNetworkingDefaultBasePath + c.ServiceUsageBasePath = ServiceUsageDefaultBasePath + c.BigQueryBasePath = BigQueryDefaultBasePath + c.CloudFunctionsBasePath = CloudFunctionsDefaultBasePath + c.CloudIoTBasePath = CloudIoTDefaultBasePath + c.StorageTransferBasePath = StorageTransferDefaultBasePath + c.BigtableAdminBasePath = BigtableAdminDefaultBasePath +} diff --git a/google-beta/provider.go b/google-beta/provider.go index 86b41bbf1ea..ef932622a25 100644 --- a/google-beta/provider.go +++ b/google-beta/provider.go @@ -756,67 +756,6 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) { return &config, nil } -// For a consumer of config.go that isn't a full fledged provider and doesn't -// have its own endpoint mechanism such as sweepers, init {{service}}BasePath -// values to a default. After using this, you should call config.LoadAndValidate. -func ConfigureBasePaths(c *Config) { - // Generated Products - c.AccessContextManagerBasePath = AccessContextManagerDefaultBasePath - c.AppEngineBasePath = AppEngineDefaultBasePath - c.BigqueryDataTransferBasePath = BigqueryDataTransferDefaultBasePath - c.BigtableBasePath = BigtableDefaultBasePath - c.BinaryAuthorizationBasePath = BinaryAuthorizationDefaultBasePath - c.CloudBuildBasePath = CloudBuildDefaultBasePath - c.CloudRunBasePath = CloudRunDefaultBasePath - c.CloudSchedulerBasePath = CloudSchedulerDefaultBasePath - c.ComputeBasePath = ComputeDefaultBasePath - c.ContainerAnalysisBasePath = ContainerAnalysisDefaultBasePath - c.DnsBasePath = DnsDefaultBasePath - c.FilestoreBasePath = FilestoreDefaultBasePath - c.FirestoreBasePath = FirestoreDefaultBasePath - c.HealthcareBasePath = HealthcareDefaultBasePath - c.KmsBasePath = KmsDefaultBasePath - c.LoggingBasePath = LoggingDefaultBasePath - c.MLEngineBasePath = MLEngineDefaultBasePath - c.MonitoringBasePath = MonitoringDefaultBasePath - c.PubsubBasePath = PubsubDefaultBasePath - c.RedisBasePath = RedisDefaultBasePath - c.ResourceManagerBasePath = ResourceManagerDefaultBasePath - c.SecurityCenterBasePath = SecurityCenterDefaultBasePath - c.SecurityScannerBasePath = SecurityScannerDefaultBasePath - c.SourceRepoBasePath = SourceRepoDefaultBasePath - c.SpannerBasePath = SpannerDefaultBasePath - c.SqlBasePath = SqlDefaultBasePath - c.StorageBasePath = StorageDefaultBasePath - c.TpuBasePath = TpuDefaultBasePath - c.VpcAccessBasePath = VpcAccessDefaultBasePath - - // Handwritten Products / Versioned / Atypical Entries - // start beta-only products - c.IAPBasePath = IAPDefaultBasePath - // end beta-only products - c.CloudBillingBasePath = CloudBillingDefaultBasePath - c.ComposerBasePath = ComposerDefaultBasePath - c.ComputeBetaBasePath = ComputeBetaDefaultBasePath - c.ContainerBasePath = ContainerDefaultBasePath - c.ContainerBetaBasePath = ContainerBetaDefaultBasePath - c.DataprocBasePath = DataprocDefaultBasePath - c.DataflowBasePath = DataflowDefaultBasePath - c.DnsBetaBasePath = DnsBetaDefaultBasePath - c.IamCredentialsBasePath = IamCredentialsDefaultBasePath - c.ResourceManagerV2Beta1BasePath = ResourceManagerV2Beta1DefaultBasePath - c.RuntimeconfigBasePath = RuntimeconfigDefaultBasePath - c.IAMBasePath = IAMDefaultBasePath - c.ServiceManagementBasePath = ServiceManagementDefaultBasePath - c.ServiceNetworkingBasePath = ServiceNetworkingDefaultBasePath - c.ServiceUsageBasePath = ServiceUsageDefaultBasePath - c.BigQueryBasePath = BigQueryDefaultBasePath - c.CloudFunctionsBasePath = CloudFunctionsDefaultBasePath - c.CloudIoTBasePath = CloudIoTDefaultBasePath - c.StorageTransferBasePath = StorageTransferDefaultBasePath - c.BigtableAdminBasePath = BigtableAdminDefaultBasePath -} - func validateCredentials(v interface{}, k string) (warnings []string, errors []error) { if v == nil || v.(string) == "" { return