2024-10-01 10:44:47 +00:00
|
|
|
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
|
|
|
|
|
|
|
|
package disable_legacy_access
|
|
|
|
|
|
|
|
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/settings"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Slice with functions to override default command behavior.
|
|
|
|
// Functions can be added from the `init()` function in manually curated files in this directory.
|
|
|
|
var cmdOverrides []func(*cobra.Command)
|
|
|
|
|
|
|
|
func New() *cobra.Command {
|
|
|
|
cmd := &cobra.Command{
|
|
|
|
Use: "disable-legacy-access",
|
|
|
|
Short: `'Disabling legacy access' has the following impacts: 1.`,
|
|
|
|
Long: `'Disabling legacy access' has the following impacts:
|
|
|
|
|
|
|
|
1. Disables direct access to the Hive Metastore. However, you can still access
|
|
|
|
Hive Metastore through HMS Federation. 2. Disables Fallback Mode (docs link)
|
|
|
|
on any External Location access from the workspace. 3. Alters DBFS path access
|
|
|
|
to use External Location permissions in place of legacy credentials. 4.
|
|
|
|
Enforces Unity Catalog access on all path based access.`,
|
|
|
|
|
|
|
|
// This service is being previewed; hide from help output.
|
|
|
|
Hidden: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add methods
|
|
|
|
cmd.AddCommand(newDelete())
|
|
|
|
cmd.AddCommand(newGet())
|
|
|
|
cmd.AddCommand(newUpdate())
|
|
|
|
|
|
|
|
// Apply optional overrides to this command.
|
|
|
|
for _, fn := range cmdOverrides {
|
|
|
|
fn(cmd)
|
|
|
|
}
|
|
|
|
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
// start delete command
|
|
|
|
|
|
|
|
// Slice with functions to override default command behavior.
|
|
|
|
// Functions can be added from the `init()` function in manually curated files in this directory.
|
|
|
|
var deleteOverrides []func(
|
|
|
|
*cobra.Command,
|
|
|
|
*settings.DeleteDisableLegacyAccessRequest,
|
|
|
|
)
|
|
|
|
|
|
|
|
func newDelete() *cobra.Command {
|
|
|
|
cmd := &cobra.Command{}
|
|
|
|
|
|
|
|
var deleteReq settings.DeleteDisableLegacyAccessRequest
|
|
|
|
|
|
|
|
// TODO: short flags
|
|
|
|
|
|
|
|
cmd.Flags().StringVar(&deleteReq.Etag, "etag", deleteReq.Etag, `etag used for versioning.`)
|
|
|
|
|
|
|
|
cmd.Use = "delete"
|
|
|
|
cmd.Short = `Delete Legacy Access Disablement Status.`
|
|
|
|
cmd.Long = `Delete Legacy Access Disablement Status.
|
|
|
|
|
|
|
|
Deletes legacy access disablement status.`
|
|
|
|
|
|
|
|
cmd.Annotations = make(map[string]string)
|
|
|
|
|
|
|
|
cmd.Args = func(cmd *cobra.Command, args []string) error {
|
|
|
|
check := root.ExactArgs(0)
|
|
|
|
return check(cmd, args)
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd.PreRunE = root.MustWorkspaceClient
|
|
|
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
|
|
|
ctx := cmd.Context()
|
|
|
|
w := root.WorkspaceClient(ctx)
|
|
|
|
|
|
|
|
response, err := w.Settings.DisableLegacyAccess().Delete(ctx, deleteReq)
|
|
|
|
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`.
|
|
|
|
cmd.ValidArgsFunction = cobra.NoFileCompletions
|
|
|
|
|
|
|
|
// Apply optional overrides to this command.
|
|
|
|
for _, fn := range deleteOverrides {
|
|
|
|
fn(cmd, &deleteReq)
|
|
|
|
}
|
|
|
|
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
// start get command
|
|
|
|
|
|
|
|
// Slice with functions to override default command behavior.
|
|
|
|
// Functions can be added from the `init()` function in manually curated files in this directory.
|
|
|
|
var getOverrides []func(
|
|
|
|
*cobra.Command,
|
|
|
|
*settings.GetDisableLegacyAccessRequest,
|
|
|
|
)
|
|
|
|
|
|
|
|
func newGet() *cobra.Command {
|
|
|
|
cmd := &cobra.Command{}
|
|
|
|
|
|
|
|
var getReq settings.GetDisableLegacyAccessRequest
|
|
|
|
|
|
|
|
// TODO: short flags
|
|
|
|
|
|
|
|
cmd.Flags().StringVar(&getReq.Etag, "etag", getReq.Etag, `etag used for versioning.`)
|
|
|
|
|
|
|
|
cmd.Use = "get"
|
|
|
|
cmd.Short = `Retrieve Legacy Access Disablement Status.`
|
|
|
|
cmd.Long = `Retrieve Legacy Access Disablement Status.
|
|
|
|
|
|
|
|
Retrieves legacy access disablement Status.`
|
|
|
|
|
|
|
|
cmd.Annotations = make(map[string]string)
|
|
|
|
|
|
|
|
cmd.Args = func(cmd *cobra.Command, args []string) error {
|
|
|
|
check := root.ExactArgs(0)
|
|
|
|
return check(cmd, args)
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd.PreRunE = root.MustWorkspaceClient
|
|
|
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
|
|
|
ctx := cmd.Context()
|
|
|
|
w := root.WorkspaceClient(ctx)
|
|
|
|
|
|
|
|
response, err := w.Settings.DisableLegacyAccess().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`.
|
|
|
|
cmd.ValidArgsFunction = cobra.NoFileCompletions
|
|
|
|
|
|
|
|
// Apply optional overrides to this command.
|
|
|
|
for _, fn := range getOverrides {
|
|
|
|
fn(cmd, &getReq)
|
|
|
|
}
|
|
|
|
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
// start update command
|
|
|
|
|
|
|
|
// Slice with functions to override default command behavior.
|
|
|
|
// Functions can be added from the `init()` function in manually curated files in this directory.
|
|
|
|
var updateOverrides []func(
|
|
|
|
*cobra.Command,
|
|
|
|
*settings.UpdateDisableLegacyAccessRequest,
|
|
|
|
)
|
|
|
|
|
|
|
|
func newUpdate() *cobra.Command {
|
|
|
|
cmd := &cobra.Command{}
|
|
|
|
|
|
|
|
var updateReq settings.UpdateDisableLegacyAccessRequest
|
|
|
|
var updateJson flags.JsonFlag
|
|
|
|
|
|
|
|
// TODO: short flags
|
|
|
|
cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
|
|
|
|
|
|
|
cmd.Use = "update"
|
|
|
|
cmd.Short = `Update Legacy Access Disablement Status.`
|
|
|
|
cmd.Long = `Update Legacy Access Disablement Status.
|
|
|
|
|
|
|
|
Updates legacy access disablement status.`
|
|
|
|
|
|
|
|
cmd.Annotations = make(map[string]string)
|
|
|
|
|
|
|
|
cmd.PreRunE = root.MustWorkspaceClient
|
|
|
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
|
|
|
ctx := cmd.Context()
|
|
|
|
w := root.WorkspaceClient(ctx)
|
|
|
|
|
|
|
|
if cmd.Flags().Changed("json") {
|
2024-10-11 14:39:53 +00:00
|
|
|
diags := updateJson.Unmarshal(&updateReq)
|
|
|
|
if diags.HasError() {
|
|
|
|
return diags.Error()
|
|
|
|
}
|
|
|
|
if len(diags) > 0 {
|
|
|
|
err := cmdio.RenderDiagnosticsToErrorOut(ctx, diags)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2024-10-01 10:44:47 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")
|
|
|
|
}
|
|
|
|
|
|
|
|
response, err := w.Settings.DisableLegacyAccess().Update(ctx, updateReq)
|
|
|
|
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`.
|
|
|
|
cmd.ValidArgsFunction = cobra.NoFileCompletions
|
|
|
|
|
|
|
|
// Apply optional overrides to this command.
|
|
|
|
for _, fn := range updateOverrides {
|
|
|
|
fn(cmd, &updateReq)
|
|
|
|
}
|
|
|
|
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
// end service DisableLegacyAccess
|