mirror of https://github.com/databricks/cli.git
270 lines
7.4 KiB
Go
Executable File
270 lines
7.4 KiB
Go
Executable File
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
|
|
|
|
package custom_app_integration
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/databricks/cli/cmd/root"
|
|
"github.com/databricks/cli/libs/cmdio"
|
|
"github.com/databricks/cli/libs/flags"
|
|
"github.com/databricks/databricks-sdk-go/service/oauth2"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var Cmd = &cobra.Command{
|
|
Use: "custom-app-integration",
|
|
Short: `These APIs enable administrators to manage custom oauth app integrations, which is required for adding/using Custom OAuth App Integration like Tableau Cloud for Databricks in AWS cloud.`,
|
|
Long: `These APIs enable administrators to manage custom oauth app integrations,
|
|
which is required for adding/using Custom OAuth App Integration like Tableau
|
|
Cloud for Databricks in AWS cloud.
|
|
|
|
**Note:** You can only add/use the OAuth custom application integrations when
|
|
OAuth enrollment status is enabled. For more details see
|
|
:method:OAuthEnrollment/create`,
|
|
Annotations: map[string]string{
|
|
"package": "oauth2",
|
|
},
|
|
}
|
|
|
|
// start create command
|
|
|
|
var createReq oauth2.CreateCustomAppIntegration
|
|
var createJson flags.JsonFlag
|
|
|
|
func init() {
|
|
Cmd.AddCommand(createCmd)
|
|
// TODO: short flags
|
|
createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
|
|
|
createCmd.Flags().BoolVar(&createReq.Confidential, "confidential", createReq.Confidential, `indicates if an oauth client-secret should be generated.`)
|
|
// TODO: complex arg: token_access_policy
|
|
|
|
}
|
|
|
|
var createCmd = &cobra.Command{
|
|
Use: "create",
|
|
Short: `Create Custom OAuth App Integration.`,
|
|
Long: `Create Custom OAuth App Integration.
|
|
|
|
Create Custom OAuth App Integration.
|
|
|
|
You can retrieve the custom oauth app integration via
|
|
:method:CustomAppIntegration/get.`,
|
|
|
|
Annotations: map[string]string{},
|
|
PreRunE: root.MustAccountClient,
|
|
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
|
ctx := cmd.Context()
|
|
a := root.AccountClient(ctx)
|
|
if cmd.Flags().Changed("json") {
|
|
err = createJson.Unmarshal(&createReq)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
} else {
|
|
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")
|
|
}
|
|
|
|
response, err := a.CustomAppIntegration.Create(ctx, createReq)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return cmdio.Render(ctx, response)
|
|
},
|
|
// Disable completions since they are not applicable.
|
|
// Can be overridden by manual implementation in `override.go`.
|
|
ValidArgsFunction: cobra.NoFileCompletions,
|
|
}
|
|
|
|
// start delete command
|
|
|
|
var deleteReq oauth2.DeleteCustomAppIntegrationRequest
|
|
var deleteJson flags.JsonFlag
|
|
|
|
func init() {
|
|
Cmd.AddCommand(deleteCmd)
|
|
// TODO: short flags
|
|
deleteCmd.Flags().Var(&deleteJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
|
|
|
}
|
|
|
|
var deleteCmd = &cobra.Command{
|
|
Use: "delete INTEGRATION_ID",
|
|
Short: `Delete Custom OAuth App Integration.`,
|
|
Long: `Delete Custom OAuth App Integration.
|
|
|
|
Delete an existing Custom OAuth App Integration. You can retrieve the custom
|
|
oauth app integration via :method:CustomAppIntegration/get.`,
|
|
|
|
Annotations: map[string]string{},
|
|
Args: func(cmd *cobra.Command, args []string) error {
|
|
check := cobra.ExactArgs(1)
|
|
if cmd.Flags().Changed("json") {
|
|
check = cobra.ExactArgs(0)
|
|
}
|
|
return check(cmd, args)
|
|
},
|
|
PreRunE: root.MustAccountClient,
|
|
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
|
ctx := cmd.Context()
|
|
a := root.AccountClient(ctx)
|
|
if cmd.Flags().Changed("json") {
|
|
err = deleteJson.Unmarshal(&deleteReq)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
} else {
|
|
deleteReq.IntegrationId = args[0]
|
|
}
|
|
|
|
err = a.CustomAppIntegration.Delete(ctx, deleteReq)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
},
|
|
// Disable completions since they are not applicable.
|
|
// Can be overridden by manual implementation in `override.go`.
|
|
ValidArgsFunction: cobra.NoFileCompletions,
|
|
}
|
|
|
|
// start get command
|
|
|
|
var getReq oauth2.GetCustomAppIntegrationRequest
|
|
var getJson flags.JsonFlag
|
|
|
|
func init() {
|
|
Cmd.AddCommand(getCmd)
|
|
// TODO: short flags
|
|
getCmd.Flags().Var(&getJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
|
|
|
}
|
|
|
|
var getCmd = &cobra.Command{
|
|
Use: "get INTEGRATION_ID",
|
|
Short: `Get OAuth Custom App Integration.`,
|
|
Long: `Get OAuth Custom App Integration.
|
|
|
|
Gets the Custom OAuth App Integration for the given integration id.`,
|
|
|
|
Annotations: map[string]string{},
|
|
Args: func(cmd *cobra.Command, args []string) error {
|
|
check := cobra.ExactArgs(1)
|
|
if cmd.Flags().Changed("json") {
|
|
check = cobra.ExactArgs(0)
|
|
}
|
|
return check(cmd, args)
|
|
},
|
|
PreRunE: root.MustAccountClient,
|
|
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
|
ctx := cmd.Context()
|
|
a := root.AccountClient(ctx)
|
|
if cmd.Flags().Changed("json") {
|
|
err = getJson.Unmarshal(&getReq)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
} else {
|
|
getReq.IntegrationId = args[0]
|
|
}
|
|
|
|
response, err := a.CustomAppIntegration.Get(ctx, getReq)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return cmdio.Render(ctx, response)
|
|
},
|
|
// Disable completions since they are not applicable.
|
|
// Can be overridden by manual implementation in `override.go`.
|
|
ValidArgsFunction: cobra.NoFileCompletions,
|
|
}
|
|
|
|
// start list command
|
|
|
|
func init() {
|
|
Cmd.AddCommand(listCmd)
|
|
|
|
}
|
|
|
|
var listCmd = &cobra.Command{
|
|
Use: "list",
|
|
Short: `Get custom oauth app integrations.`,
|
|
Long: `Get custom oauth app integrations.
|
|
|
|
Get the list of custom oauth app integrations for the specified Databricks
|
|
account`,
|
|
|
|
Annotations: map[string]string{},
|
|
PreRunE: root.MustAccountClient,
|
|
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
|
ctx := cmd.Context()
|
|
a := root.AccountClient(ctx)
|
|
response, err := a.CustomAppIntegration.ListAll(ctx)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return cmdio.Render(ctx, response)
|
|
},
|
|
// Disable completions since they are not applicable.
|
|
// Can be overridden by manual implementation in `override.go`.
|
|
ValidArgsFunction: cobra.NoFileCompletions,
|
|
}
|
|
|
|
// start update command
|
|
|
|
var updateReq oauth2.UpdateCustomAppIntegration
|
|
var updateJson flags.JsonFlag
|
|
|
|
func init() {
|
|
Cmd.AddCommand(updateCmd)
|
|
// TODO: short flags
|
|
updateCmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
|
|
|
// TODO: array: redirect_urls
|
|
// TODO: complex arg: token_access_policy
|
|
|
|
}
|
|
|
|
var updateCmd = &cobra.Command{
|
|
Use: "update INTEGRATION_ID",
|
|
Short: `Updates Custom OAuth App Integration.`,
|
|
Long: `Updates Custom OAuth App Integration.
|
|
|
|
Updates an existing custom OAuth App Integration. You can retrieve the custom
|
|
oauth app integration via :method:CustomAppIntegration/get.`,
|
|
|
|
Annotations: map[string]string{},
|
|
Args: func(cmd *cobra.Command, args []string) error {
|
|
check := cobra.ExactArgs(1)
|
|
if cmd.Flags().Changed("json") {
|
|
check = cobra.ExactArgs(0)
|
|
}
|
|
return check(cmd, args)
|
|
},
|
|
PreRunE: root.MustAccountClient,
|
|
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
|
ctx := cmd.Context()
|
|
a := root.AccountClient(ctx)
|
|
if cmd.Flags().Changed("json") {
|
|
err = updateJson.Unmarshal(&updateReq)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
} else {
|
|
updateReq.IntegrationId = args[0]
|
|
}
|
|
|
|
err = a.CustomAppIntegration.Update(ctx, updateReq)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
},
|
|
// Disable completions since they are not applicable.
|
|
// Can be overridden by manual implementation in `override.go`.
|
|
ValidArgsFunction: cobra.NoFileCompletions,
|
|
}
|
|
|
|
// end service CustomAppIntegration
|