Skip to content

Commit

Permalink
Add basepath generation (#4745)
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottSuarez authored May 6, 2021
1 parent f83e41d commit 10696c5
Show file tree
Hide file tree
Showing 11 changed files with 251 additions and 142 deletions.
10 changes: 6 additions & 4 deletions mmv1/third_party/terraform/utils/config.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,10 @@ type Config struct {
requestBatcherIam *RequestBatcher

// start DCL clients
clientDataprocDCL *dataprocDcl.Client
clientEventarcDCL *eventarcDcl.Client
// dataprocBasePath is implemented in mm
clientDataprocDCL *dataprocDcl.Client
EventarcBasePath string
clientEventarcDCL *eventarcDcl.Client
}

// Generated product base paths
Expand Down Expand Up @@ -190,8 +192,8 @@ func (c *Config) LoadAndValidate(ctx context.Context) error {
dclLoggerOptions := dcl.WithLogger(dclLogger{})
// each product needs it own client currently since basepath can only be specified at
// the config level.
c.clientDataprocDCL = dataprocDcl.NewClient(dcl.NewConfig(dclClientOptions, dclUserAgentOptions, dclLoggerOptions))
c.clientEventarcDCL = eventarcDcl.NewClient(dcl.NewConfig(dclClientOptions, dclUserAgentOptions, dclLoggerOptions))
c.clientDataprocDCL = dataprocDcl.NewClient(dcl.NewConfig(dclClientOptions, dclUserAgentOptions,dclLoggerOptions, dcl.WithBasePath(c.DataprocBasePath)))
c.clientEventarcDCL = eventarcDcl.NewClient(dcl.NewConfig(dclClientOptions, dclUserAgentOptions,dclLoggerOptions, dcl.WithBasePath(c.EventarcBasePath)))

return nil
}
Expand Down
4 changes: 1 addition & 3 deletions mmv1/third_party/terraform/utils/provider.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ func Provider() *schema.Provider {
BigtableAdminCustomEndpointEntryKey: BigtableAdminCustomEndpointEntry,

// dcl
DataprocEndpointEntryKey: DataprocEndpointEntry,
EventarcEndpointEntryKey: EventarcEndpointEntry,
},

Expand Down Expand Up @@ -573,8 +572,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.BigtableAdminBasePath = d.Get(BigtableAdminCustomEndpointEntryKey).(string)

// dcl
// config.clientDataprocDCL.Config.BasePath = d.Get(DataprocEndpointEntryKey).(string)
// config.clientEventarcDCL.Config.BasePath = d.Get(EventarcEndpointEntryKey).(string)
config.EventarcBasePath = d.Get(EventarcEndpointEntryKey).(string)

stopCtx, ok := schema.StopContext(ctx)
if !ok {
Expand Down
2 changes: 1 addition & 1 deletion tpgtools/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/GoogleCloudPlatform/magic-modules/tpgtools

go 1.13
go 1.16

require (
bitbucket.org/creachadair/stringset v0.0.9
Expand Down
8 changes: 5 additions & 3 deletions tpgtools/handwritten.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2021 Google LLC. All Rights Reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -30,6 +30,8 @@ func copyHandwrittenFiles(inPath string, outPath string) {
return
}

glog.Info("copying handwritten files")

_, err := os.Stat(outPath)
if os.IsNotExist(err) {
errDir := os.MkdirAll(outPath, 0755)
Expand Down
Loading

0 comments on commit 10696c5

Please sign in to comment.