Bump OpenAPI specification & Go SDK Version (#624)

## Changes
Bump the OpenAPI specification and Go SDK version to the latest version.

## Tests
<!-- How is this tested? -->
This commit is contained in:
Miles Yucht 2023-08-01 14:33:19 +02:00 committed by GitHub
parent 5a6177127f
commit bb415ce6bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 310 additions and 42 deletions

View File

@ -1 +1 @@
0a1949ba96f71680dad30e06973eaae85b1307bb
7b57ba3a53f4de3d049b6a24391fe5474212daf8

1
.gitattributes vendored
View File

@ -10,6 +10,7 @@ cmd/account/ip-access-lists/ip-access-lists.go linguist-generated=true
cmd/account/log-delivery/log-delivery.go linguist-generated=true
cmd/account/metastore-assignments/metastore-assignments.go linguist-generated=true
cmd/account/metastores/metastores.go linguist-generated=true
cmd/account/network-policy/network-policy.go linguist-generated=true
cmd/account/networks/networks.go linguist-generated=true
cmd/account/o-auth-enrollment/o-auth-enrollment.go linguist-generated=true
cmd/account/private-access/private-access.go linguist-generated=true

2
cmd/account/cmd.go generated
View File

@ -16,6 +16,7 @@ import (
log_delivery "github.com/databricks/cli/cmd/account/log-delivery"
account_metastore_assignments "github.com/databricks/cli/cmd/account/metastore-assignments"
account_metastores "github.com/databricks/cli/cmd/account/metastores"
account_network_policy "github.com/databricks/cli/cmd/account/network-policy"
networks "github.com/databricks/cli/cmd/account/networks"
o_auth_enrollment "github.com/databricks/cli/cmd/account/o-auth-enrollment"
private_access "github.com/databricks/cli/cmd/account/private-access"
@ -48,6 +49,7 @@ func New() *cobra.Command {
cmd.AddCommand(log_delivery.New())
cmd.AddCommand(account_metastore_assignments.New())
cmd.AddCommand(account_metastores.New())
cmd.AddCommand(account_network_policy.New())
cmd.AddCommand(networks.New())
cmd.AddCommand(o_auth_enrollment.New())
cmd.AddCommand(private_access.New())

View File

@ -59,8 +59,7 @@ func newCreate() *cobra.Command {
cmd.Short = `Assigns a workspace to a metastore.`
cmd.Long = `Assigns a workspace to a metastore.
Creates an assignment to a metastore for a workspace Please add a header
X-Databricks-Account-Console-API-Version: 2.0 to access this API.`
Creates an assignment to a metastore for a workspace`
cmd.Annotations = make(map[string]string)
@ -86,11 +85,11 @@ func newCreate() *cobra.Command {
}
createReq.MetastoreId = args[1]
response, err := a.MetastoreAssignments.Create(ctx, createReq)
err = a.MetastoreAssignments.Create(ctx, createReq)
if err != nil {
return err
}
return cmdio.Render(ctx, response)
return nil
}
// Disable completions since they are not applicable.
@ -132,8 +131,7 @@ func newDelete() *cobra.Command {
cmd.Long = `Delete a metastore assignment.
Deletes a metastore assignment to a workspace, leaving the workspace with no
metastore. Please add a header X-Databricks-Account-Console-API-Version: 2.0
to access this API.`
metastore.`
cmd.Annotations = make(map[string]string)
@ -201,8 +199,7 @@ func newGet() *cobra.Command {
Gets the metastore assignment, if any, for the workspace specified by ID. If
the workspace is assigned a metastore, the mappig will be returned. If no
metastore is assigned to the workspace, the assignment will not be found and a
404 returned. Please add a header X-Databricks-Account-Console-API-Version:
2.0 to access this API.`
404 returned.`
cmd.Annotations = make(map[string]string)
@ -267,8 +264,7 @@ func newList() *cobra.Command {
cmd.Long = `Get all workspaces assigned to a metastore.
Gets a list of all Databricks workspace IDs that have been assigned to given
metastore. Please add a header X-Databricks-Account-Console-API-Version: 2.0
to access this API`
metastore.`
cmd.Annotations = make(map[string]string)
@ -334,8 +330,7 @@ func newUpdate() *cobra.Command {
cmd.Long = `Updates a metastore assignment to a workspaces.
Updates an assignment to a metastore for a workspace. Currently, only the
default catalog may be updated. Please add a header
X-Databricks-Account-Console-API-Version: 2.0 to access this API.`
default catalog may be updated.`
cmd.Annotations = make(map[string]string)

View File

@ -58,8 +58,7 @@ func newCreate() *cobra.Command {
cmd.Short = `Create metastore.`
cmd.Long = `Create metastore.
Creates a Unity Catalog metastore. Please add a header
X-Databricks-Account-Console-API-Version: 2.0 to access this API.`
Creates a Unity Catalog metastore.`
cmd.Annotations = make(map[string]string)
@ -131,8 +130,7 @@ func newDelete() *cobra.Command {
cmd.Short = `Delete a metastore.`
cmd.Long = `Delete a metastore.
Deletes a Unity Catalog metastore for an account, both specified by ID. Please
add a header X-Databricks-Account-Console-API-Version: 2.0 to access this API.`
Deletes a Unity Catalog metastore for an account, both specified by ID.`
cmd.Annotations = make(map[string]string)
@ -193,8 +191,7 @@ func newGet() *cobra.Command {
cmd.Short = `Get a metastore.`
cmd.Long = `Get a metastore.
Gets a Unity Catalog metastore from an account, both specified by ID. Please
add a header X-Databricks-Account-Console-API-Version: 2.0 to access this API.`
Gets a Unity Catalog metastore from an account, both specified by ID.`
cmd.Annotations = make(map[string]string)
@ -250,9 +247,7 @@ func newList() *cobra.Command {
cmd.Short = `Get all metastores associated with an account.`
cmd.Long = `Get all metastores associated with an account.
Gets all Unity Catalog metastores associated with an account specified by ID.
Please add a header X-Databricks-Account-Console-API-Version: 2.0 to access
this API.`
Gets all Unity Catalog metastores associated with an account specified by ID.`
cmd.Annotations = make(map[string]string)
@ -309,8 +304,7 @@ func newUpdate() *cobra.Command {
cmd.Short = `Update a metastore.`
cmd.Long = `Update a metastore.
Updates an existing Unity Catalog metastore. Please add a header
X-Databricks-Account-Console-API-Version: 2.0 to access this API.`
Updates an existing Unity Catalog metastore.`
cmd.Annotations = make(map[string]string)

243
cmd/account/network-policy/network-policy.go generated Executable file
View File

@ -0,0 +1,243 @@
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package network_policy
import (
"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: "network-policy",
Short: `Network policy is a set of rules that defines what can be accessed from your Databricks network.`,
Long: `Network policy is a set of rules that defines what can be accessed from your
Databricks network. E.g.: You can choose to block your SQL UDF to access
internet from your Databricks serverless clusters.
There is only one instance of this setting per account. Since this setting has
a default value, this setting is present on all accounts even though it's
never set on a given account. Deletion reverts the value of the setting back
to the default value.`,
GroupID: "settings",
Annotations: map[string]string{
"package": "settings",
},
// This service is being previewed; hide from help output.
Hidden: true,
}
// Apply optional overrides to this command.
for _, fn := range cmdOverrides {
fn(cmd)
}
return cmd
}
// start delete-account-network-policy 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 deleteAccountNetworkPolicyOverrides []func(
*cobra.Command,
*settings.DeleteAccountNetworkPolicyRequest,
)
func newDeleteAccountNetworkPolicy() *cobra.Command {
cmd := &cobra.Command{}
var deleteAccountNetworkPolicyReq settings.DeleteAccountNetworkPolicyRequest
// TODO: short flags
cmd.Use = "delete-account-network-policy ETAG"
cmd.Short = `Delete Account Network Policy.`
cmd.Long = `Delete Account Network Policy.
Reverts back all the account network policies back to default.`
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1)
return check(cmd, args)
}
cmd.PreRunE = root.MustAccountClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
a := root.AccountClient(ctx)
deleteAccountNetworkPolicyReq.Etag = args[0]
response, err := a.NetworkPolicy.DeleteAccountNetworkPolicy(ctx, deleteAccountNetworkPolicyReq)
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 deleteAccountNetworkPolicyOverrides {
fn(cmd, &deleteAccountNetworkPolicyReq)
}
return cmd
}
func init() {
cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) {
cmd.AddCommand(newDeleteAccountNetworkPolicy())
})
}
// start read-account-network-policy 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 readAccountNetworkPolicyOverrides []func(
*cobra.Command,
*settings.ReadAccountNetworkPolicyRequest,
)
func newReadAccountNetworkPolicy() *cobra.Command {
cmd := &cobra.Command{}
var readAccountNetworkPolicyReq settings.ReadAccountNetworkPolicyRequest
// TODO: short flags
cmd.Use = "read-account-network-policy ETAG"
cmd.Short = `Get Account Network Policy.`
cmd.Long = `Get Account Network Policy.
Gets the value of Account level Network Policy.`
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1)
return check(cmd, args)
}
cmd.PreRunE = root.MustAccountClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
a := root.AccountClient(ctx)
readAccountNetworkPolicyReq.Etag = args[0]
response, err := a.NetworkPolicy.ReadAccountNetworkPolicy(ctx, readAccountNetworkPolicyReq)
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 readAccountNetworkPolicyOverrides {
fn(cmd, &readAccountNetworkPolicyReq)
}
return cmd
}
func init() {
cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) {
cmd.AddCommand(newReadAccountNetworkPolicy())
})
}
// start update-account-network-policy 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 updateAccountNetworkPolicyOverrides []func(
*cobra.Command,
*settings.UpdateAccountNetworkPolicyRequest,
)
func newUpdateAccountNetworkPolicy() *cobra.Command {
cmd := &cobra.Command{}
var updateAccountNetworkPolicyReq settings.UpdateAccountNetworkPolicyRequest
var updateAccountNetworkPolicyJson flags.JsonFlag
// TODO: short flags
cmd.Flags().Var(&updateAccountNetworkPolicyJson, "json", `either inline JSON string or @path/to/file.json with request body`)
cmd.Flags().BoolVar(&updateAccountNetworkPolicyReq.AllowMissing, "allow-missing", updateAccountNetworkPolicyReq.AllowMissing, `This should always be set to true for Settings RPCs.`)
// TODO: complex arg: setting
cmd.Use = "update-account-network-policy"
cmd.Short = `Update Account Network Policy.`
cmd.Long = `Update Account Network Policy.
Updates the policy content of Account level Network Policy.`
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0)
if cmd.Flags().Changed("json") {
check = cobra.ExactArgs(0)
}
return check(cmd, args)
}
cmd.PreRunE = root.MustAccountClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
a := root.AccountClient(ctx)
if cmd.Flags().Changed("json") {
err = updateAccountNetworkPolicyJson.Unmarshal(&updateAccountNetworkPolicyReq)
if err != nil {
return err
}
} else {
}
response, err := a.NetworkPolicy.UpdateAccountNetworkPolicy(ctx, updateAccountNetworkPolicyReq)
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 updateAccountNetworkPolicyOverrides {
fn(cmd, &updateAccountNetworkPolicyReq)
}
return cmd
}
func init() {
cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) {
cmd.AddCommand(newUpdateAccountNetworkPolicy())
})
}
// end service AccountNetworkPolicy

View File

@ -59,6 +59,7 @@ func newCreate() *cobra.Command {
cmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`)
cmd.Flags().StringVar(&createReq.Comment, "comment", createReq.Comment, `User-provided free-form text description.`)
cmd.Flags().StringVar(&createReq.ConnectionName, "connection-name", createReq.ConnectionName, `The name of the connection to an external data source.`)
// TODO: map via StringToStringVar: properties
cmd.Flags().StringVar(&createReq.ProviderName, "provider-name", createReq.ProviderName, `The name of delta sharing provider.`)
cmd.Flags().StringVar(&createReq.ShareName, "share-name", createReq.ShareName, `The name of the share under the share provider.`)

View File

@ -35,9 +35,6 @@ func New() *cobra.Command {
Annotations: map[string]string{
"package": "catalog",
},
// This service is being previewed; hide from help output.
Hidden: true,
}
// Apply optional overrides to this command.

View File

@ -63,7 +63,9 @@ func newCreate() *cobra.Command {
// TODO: short flags
cmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`)
cmd.Flags().StringVar(&createReq.AccessPoint, "access-point", createReq.AccessPoint, `The AWS access point to use when accesing s3 for this external location.`)
cmd.Flags().StringVar(&createReq.Comment, "comment", createReq.Comment, `User-provided free-form text description.`)
// TODO: complex arg: encryption_details
cmd.Flags().BoolVar(&createReq.ReadOnly, "read-only", createReq.ReadOnly, `Indicates whether the external location is read-only.`)
cmd.Flags().BoolVar(&createReq.SkipValidation, "skip-validation", createReq.SkipValidation, `Skips validation of the storage credential associated with the external location.`)
@ -322,8 +324,10 @@ func newUpdate() *cobra.Command {
// TODO: short flags
cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`)
cmd.Flags().StringVar(&updateReq.AccessPoint, "access-point", updateReq.AccessPoint, `The AWS access point to use when accesing s3 for this external location.`)
cmd.Flags().StringVar(&updateReq.Comment, "comment", updateReq.Comment, `User-provided free-form text description.`)
cmd.Flags().StringVar(&updateReq.CredentialName, "credential-name", updateReq.CredentialName, `Name of the storage credential used with this location.`)
// TODO: complex arg: encryption_details
cmd.Flags().BoolVar(&updateReq.Force, "force", updateReq.Force, `Force update even if changing url invalidates dependent external tables or mounts.`)
cmd.Flags().StringVar(&updateReq.Name, "name", updateReq.Name, `Name of the external location.`)
cmd.Flags().StringVar(&updateReq.Owner, "owner", updateReq.Owner, `The owner of the external location.`)

View File

@ -19,8 +19,10 @@ var cmdOverrides []func(*cobra.Command)
func New() *cobra.Command {
cmd := &cobra.Command{
Use: "providers",
Short: `Databricks Providers REST API.`,
Long: `Databricks Providers REST API`,
Short: `A data provider is an object representing the organization in the real world who shares the data.`,
Long: `A data provider is an object representing the organization in the real world
who shares the data. A provider contains shares which further contain the
shared data.`,
GroupID: "sharing",
Annotations: map[string]string{
"package": "sharing",

View File

@ -16,8 +16,17 @@ var cmdOverrides []func(*cobra.Command)
func New() *cobra.Command {
cmd := &cobra.Command{
Use: "recipient-activation",
Short: `Databricks Recipient Activation REST API.`,
Long: `Databricks Recipient Activation REST API`,
Short: `The Recipient Activation API is only applicable in the open sharing model where the recipient object has the authentication type of TOKEN.`,
Long: `The Recipient Activation API is only applicable in the open sharing model
where the recipient object has the authentication type of TOKEN. The data
recipient follows the activation link shared by the data provider to download
the credential file that includes the access token. The recipient will then
use the credential file to establish a secure connection with the provider to
receive the shared data.
Note that you can download the credential file only once. Recipients should
treat the downloaded credential as a secret and must not share it outside of
their organization.`,
GroupID: "sharing",
Annotations: map[string]string{
"package": "sharing",

View File

@ -19,8 +19,24 @@ var cmdOverrides []func(*cobra.Command)
func New() *cobra.Command {
cmd := &cobra.Command{
Use: "recipients",
Short: `Databricks Recipients REST API.`,
Long: `Databricks Recipients REST API`,
Short: `A recipient is an object you create using :method:recipients/create to represent an organization which you want to allow access shares.`,
Long: `A recipient is an object you create using :method:recipients/create to
represent an organization which you want to allow access shares. The way how
sharing works differs depending on whether or not your recipient has access to
a Databricks workspace that is enabled for Unity Catalog:
- For recipients with access to a Databricks workspace that is enabled for
Unity Catalog, you can create a recipient object along with a unique sharing
identifier you get from the recipient. The sharing identifier is the key
identifier that enables the secure connection. This sharing mode is called
**Databricks-to-Databricks sharing**.
- For recipients without access to a Databricks workspace that is enabled for
Unity Catalog, when you create a recipient object, Databricks generates an
activation link you can send to the recipient. The recipient follows the
activation link to download the credential file, and then uses the credential
file to establish a secure connection to receive the shared data. This sharing
mode is called **open sharing**.`,
GroupID: "sharing",
Annotations: map[string]string{
"package": "sharing",

View File

@ -17,8 +17,12 @@ var cmdOverrides []func(*cobra.Command)
func New() *cobra.Command {
cmd := &cobra.Command{
Use: "shares",
Short: `Databricks Shares REST API.`,
Long: `Databricks Shares REST API`,
Short: `A share is a container instantiated with :method:shares/create.`,
Long: `A share is a container instantiated with :method:shares/create. Once created
you can iteratively register a collection of existing data assets defined
within the metastore using :method:shares/update. You can register data assets
under their original name, qualified by their original schema, or provide
alternate exposed names.`,
GroupID: "sharing",
Annotations: map[string]string{
"package": "sharing",

2
go.mod
View File

@ -4,7 +4,7 @@ go 1.18
require (
github.com/briandowns/spinner v1.23.0 // Apache 2.0
github.com/databricks/databricks-sdk-go v0.13.0 // Apache 2.0
github.com/databricks/databricks-sdk-go v0.14.1 // Apache 2.0
github.com/fatih/color v1.15.0 // MIT
github.com/ghodss/yaml v1.0.0 // MIT + NOTICE
github.com/google/uuid v1.3.0 // BSD-3-Clause

4
go.sum
View File

@ -34,8 +34,8 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH
github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/databricks/databricks-sdk-go v0.13.0 h1:Npi4laUUmcOPDPdJf2ZMGFUtybpf4LK6n5NQY56Ya2Q=
github.com/databricks/databricks-sdk-go v0.13.0/go.mod h1:0iuEtPIoD6oqw7OuFbPskhlEryt2FPH+Ies1UYiiDy8=
github.com/databricks/databricks-sdk-go v0.14.1 h1:s9x18c2i6XbJxem6zKdTrrwEUXQX/Nzn0iVM+qGlRus=
github.com/databricks/databricks-sdk-go v0.14.1/go.mod h1:0iuEtPIoD6oqw7OuFbPskhlEryt2FPH+Ies1UYiiDy8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=