Skip to content

Commit

Permalink
move ConfigureBasePaths to config.go
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
yukinying authored and modular-magician committed Aug 19, 2019
1 parent 744febe commit 0ef0d7e
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 57 deletions.
53 changes: 53 additions & 0 deletions google/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -648,3 +648,56 @@ 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.CloudSchedulerBasePath = CloudSchedulerDefaultBasePath
c.ComputeBasePath = ComputeDefaultBasePath
c.DnsBasePath = DnsDefaultBasePath
c.FilestoreBasePath = FilestoreDefaultBasePath
c.FirestoreBasePath = FirestoreDefaultBasePath
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.SourceRepoBasePath = SourceRepoDefaultBasePath
c.SpannerBasePath = SpannerDefaultBasePath
c.SqlBasePath = SqlDefaultBasePath
c.StorageBasePath = StorageDefaultBasePath
c.TpuBasePath = TpuDefaultBasePath

// Handwritten Products / Versioned / Atypical Entries
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
}
57 changes: 2 additions & 55 deletions google/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,9 @@ func Provider() terraform.ResourceProvider {
}
}

// Generated resources: 70
// Generated resources: 71
// Generated IAM resources: 6
// Total generated resources: 76
// Total generated resources: 77
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -678,59 +678,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.CloudSchedulerBasePath = CloudSchedulerDefaultBasePath
c.ComputeBasePath = ComputeDefaultBasePath
c.DnsBasePath = DnsDefaultBasePath
c.FilestoreBasePath = FilestoreDefaultBasePath
c.FirestoreBasePath = FirestoreDefaultBasePath
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.SourceRepoBasePath = SourceRepoDefaultBasePath
c.SpannerBasePath = SpannerDefaultBasePath
c.SqlBasePath = SqlDefaultBasePath
c.StorageBasePath = StorageDefaultBasePath
c.TpuBasePath = TpuDefaultBasePath

// Handwritten Products / Versioned / Atypical Entries
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
Expand Down
4 changes: 2 additions & 2 deletions website/google.erb
Original file line number Diff line number Diff line change
Expand Up @@ -758,8 +758,8 @@
<li<%= sidebar_current("docs-google-ml") %>>
<a href="#">Google ML Engine Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-google-ml-engine-model") %>>
<a href="/docs/providers/google/r/ml_engine_model.html">google_ml_engine_model</a>
<li<%= sidebar_current("docs-google-mlengine-model-x") %>>
<a href="/docs/providers/google/r/mlengine_model.html">google_mlengine_model</a>
</li>
</ul>
</li>
Expand Down

0 comments on commit 0ef0d7e

Please sign in to comment.