From 74a2f40f54c1e18ab7925ce37ab3b1a75b5fe2f9 Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Tue, 20 Jun 2023 10:49:23 +0200 Subject: [PATCH] removed x-databricks-cli-json-only from scim --- cmd/account/groups/groups.go | 9 ++++++++- cmd/account/service-principals/service-principals.go | 10 +++++++++- cmd/account/users/users.go | 12 +++++++++++- cmd/workspace/groups/groups.go | 9 ++++++++- .../service-principals/service-principals.go | 10 +++++++++- cmd/workspace/users/users.go | 12 +++++++++++- 6 files changed, 56 insertions(+), 6 deletions(-) diff --git a/cmd/account/groups/groups.go b/cmd/account/groups/groups.go index b2149b84..58d8d9d1 100755 --- a/cmd/account/groups/groups.go +++ b/cmd/account/groups/groups.go @@ -37,6 +37,14 @@ func init() { // TODO: short flags createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`) + createCmd.Flags().StringVar(&createReq.DisplayName, "display-name", createReq.DisplayName, `String that represents a human-readable group name.`) + // TODO: array: entitlements + createCmd.Flags().StringVar(&createReq.ExternalId, "external-id", createReq.ExternalId, ``) + // TODO: array: groups + createCmd.Flags().StringVar(&createReq.Id, "id", createReq.Id, `Databricks group ID.`) + // TODO: array: members + // TODO: array: roles + } var createCmd = &cobra.Command{ @@ -65,7 +73,6 @@ var createCmd = &cobra.Command{ return err } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") } response, err := a.Groups.Create(ctx, createReq) diff --git a/cmd/account/service-principals/service-principals.go b/cmd/account/service-principals/service-principals.go index 31008f5d..df969b5e 100755 --- a/cmd/account/service-principals/service-principals.go +++ b/cmd/account/service-principals/service-principals.go @@ -36,6 +36,15 @@ func init() { // TODO: short flags createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`) + createCmd.Flags().BoolVar(&createReq.Active, "active", createReq.Active, `If this user is active.`) + createCmd.Flags().StringVar(&createReq.ApplicationId, "application-id", createReq.ApplicationId, `UUID relating to the service principal.`) + createCmd.Flags().StringVar(&createReq.DisplayName, "display-name", createReq.DisplayName, `String that represents a concatenation of given and family names.`) + // TODO: array: entitlements + createCmd.Flags().StringVar(&createReq.ExternalId, "external-id", createReq.ExternalId, ``) + // TODO: array: groups + createCmd.Flags().StringVar(&createReq.Id, "id", createReq.Id, `Databricks service principal ID.`) + // TODO: array: roles + } var createCmd = &cobra.Command{ @@ -63,7 +72,6 @@ var createCmd = &cobra.Command{ return err } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") } response, err := a.ServicePrincipals.Create(ctx, createReq) diff --git a/cmd/account/users/users.go b/cmd/account/users/users.go index d4efe50d..981f143e 100755 --- a/cmd/account/users/users.go +++ b/cmd/account/users/users.go @@ -41,6 +41,17 @@ func init() { // TODO: short flags createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`) + createCmd.Flags().BoolVar(&createReq.Active, "active", createReq.Active, `If this user is active.`) + createCmd.Flags().StringVar(&createReq.DisplayName, "display-name", createReq.DisplayName, `String that represents a concatenation of given and family names.`) + // TODO: array: emails + // TODO: array: entitlements + createCmd.Flags().StringVar(&createReq.ExternalId, "external-id", createReq.ExternalId, ``) + // TODO: array: groups + createCmd.Flags().StringVar(&createReq.Id, "id", createReq.Id, `Databricks user ID.`) + // TODO: complex arg: name + // TODO: array: roles + createCmd.Flags().StringVar(&createReq.UserName, "user-name", createReq.UserName, `Email address of the Databricks user.`) + } var createCmd = &cobra.Command{ @@ -69,7 +80,6 @@ var createCmd = &cobra.Command{ return err } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") } response, err := a.Users.Create(ctx, createReq) diff --git a/cmd/workspace/groups/groups.go b/cmd/workspace/groups/groups.go index d738de54..d8c76b8a 100755 --- a/cmd/workspace/groups/groups.go +++ b/cmd/workspace/groups/groups.go @@ -37,6 +37,14 @@ func init() { // TODO: short flags createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`) + createCmd.Flags().StringVar(&createReq.DisplayName, "display-name", createReq.DisplayName, `String that represents a human-readable group name.`) + // TODO: array: entitlements + createCmd.Flags().StringVar(&createReq.ExternalId, "external-id", createReq.ExternalId, ``) + // TODO: array: groups + createCmd.Flags().StringVar(&createReq.Id, "id", createReq.Id, `Databricks group ID.`) + // TODO: array: members + // TODO: array: roles + } var createCmd = &cobra.Command{ @@ -65,7 +73,6 @@ var createCmd = &cobra.Command{ return err } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") } response, err := w.Groups.Create(ctx, createReq) diff --git a/cmd/workspace/service-principals/service-principals.go b/cmd/workspace/service-principals/service-principals.go index 0e7d3255..71760a55 100755 --- a/cmd/workspace/service-principals/service-principals.go +++ b/cmd/workspace/service-principals/service-principals.go @@ -36,6 +36,15 @@ func init() { // TODO: short flags createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`) + createCmd.Flags().BoolVar(&createReq.Active, "active", createReq.Active, `If this user is active.`) + createCmd.Flags().StringVar(&createReq.ApplicationId, "application-id", createReq.ApplicationId, `UUID relating to the service principal.`) + createCmd.Flags().StringVar(&createReq.DisplayName, "display-name", createReq.DisplayName, `String that represents a concatenation of given and family names.`) + // TODO: array: entitlements + createCmd.Flags().StringVar(&createReq.ExternalId, "external-id", createReq.ExternalId, ``) + // TODO: array: groups + createCmd.Flags().StringVar(&createReq.Id, "id", createReq.Id, `Databricks service principal ID.`) + // TODO: array: roles + } var createCmd = &cobra.Command{ @@ -63,7 +72,6 @@ var createCmd = &cobra.Command{ return err } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") } response, err := w.ServicePrincipals.Create(ctx, createReq) diff --git a/cmd/workspace/users/users.go b/cmd/workspace/users/users.go index 359a4001..0a2ced7b 100755 --- a/cmd/workspace/users/users.go +++ b/cmd/workspace/users/users.go @@ -41,6 +41,17 @@ func init() { // TODO: short flags createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`) + createCmd.Flags().BoolVar(&createReq.Active, "active", createReq.Active, `If this user is active.`) + createCmd.Flags().StringVar(&createReq.DisplayName, "display-name", createReq.DisplayName, `String that represents a concatenation of given and family names.`) + // TODO: array: emails + // TODO: array: entitlements + createCmd.Flags().StringVar(&createReq.ExternalId, "external-id", createReq.ExternalId, ``) + // TODO: array: groups + createCmd.Flags().StringVar(&createReq.Id, "id", createReq.Id, `Databricks user ID.`) + // TODO: complex arg: name + // TODO: array: roles + createCmd.Flags().StringVar(&createReq.UserName, "user-name", createReq.UserName, `Email address of the Databricks user.`) + } var createCmd = &cobra.Command{ @@ -69,7 +80,6 @@ var createCmd = &cobra.Command{ return err } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") } response, err := w.Users.Create(ctx, createReq)