From 7cf46d88da2636e7c202fe5a6edcd91c2b6cd856 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 20 Apr 2021 15:27:42 -0700 Subject: [PATCH] Dataproc workflow template (#4693) (#687) * Update eventarc trigger yaml, markdown to allow setting transport * Update test, add handwritten utils * Update handwritten * Updating eventarc test * Updating trigger * Adding dataproc workflow * Updating expanders * Updates to prop, resource to handle refs * Add support for workflow in GA * fix merge issues * Add template markdown Signed-off-by: Modular Magician --- google/config.go | 3 +++ google/utils.go | 16 ++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/google/config.go b/google/config.go index 96ca0b297..c447168dc 100644 --- a/google/config.go +++ b/google/config.go @@ -14,6 +14,7 @@ import ( "google.golang.org/api/option" dcl "github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl" + dataprocDcl "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/dataproc" eventarcDcl "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/eventarc" "golang.org/x/oauth2" googleoauth "golang.org/x/oauth2/google" @@ -163,6 +164,7 @@ type Config struct { // start DCL clients dclConfig *dcl.Config + clientDataprocDCL *dataprocDcl.Client clientEventarcDCL *eventarcDcl.Client } @@ -284,6 +286,7 @@ func (c *Config) LoadAndValidate(ctx context.Context) error { // Start DCL client instantiation // TODO(slevenick): handle user agents c.dclConfig = dcl.NewConfig(dcl.WithHTTPClient(client), dcl.WithUserAgent(c.userAgent), dcl.WithLogger(dclLogger{})) + c.clientDataprocDCL = dataprocDcl.NewClient(c.dclConfig) c.clientEventarcDCL = eventarcDcl.NewClient(c.dclConfig) return nil diff --git a/google/utils.go b/google/utils.go index 2e913fd61..a80e9091b 100644 --- a/google/utils.go +++ b/google/utils.go @@ -482,14 +482,6 @@ func SnakeToPascalCase(s string) string { return strings.Join(split, "") } -func checkStringMap(v interface{}) map[string]string { - m, ok := v.(map[string]string) - if ok { - return m - } - return convertStringMap(v.(map[string]interface{})) -} - func multiEnvSearch(ks []string) string { for _, k := range ks { if v := os.Getenv(k); v != "" { @@ -498,3 +490,11 @@ func multiEnvSearch(ks []string) string { } return "" } + +func checkStringMap(v interface{}) map[string]string { + m, ok := v.(map[string]string) + if ok { + return m + } + return convertStringMap(v.(map[string]interface{})) +}