sharing

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 6 Imported by: 8

Documentation

Overview

These APIs allow you to manage Providers, Recipient Activation, Recipients, Shares, etc.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationType

type AuthenticationType string

The delta sharing authentication type.

const AuthenticationTypeDatabricks AuthenticationType = `DATABRICKS`
const AuthenticationTypeToken AuthenticationType = `TOKEN`

func (*AuthenticationType) Set

func (f *AuthenticationType) Set(v string) error

Set raw string value and validate it against allowed values

func (*AuthenticationType) String

func (f *AuthenticationType) String() string

String representation for fmt.Print

func (*AuthenticationType) Type

func (f *AuthenticationType) Type() string

Type always returns AuthenticationType to satisfy [pflag.Value] interface

type CreateProvider

type CreateProvider struct {
	// The delta sharing authentication type.
	AuthenticationType AuthenticationType `json:"authentication_type"`
	// Description about the provider.
	Comment string `json:"comment,omitempty"`
	// The name of the Provider.
	Name string `json:"name"`
	// This field is required when the __authentication_type__ is **TOKEN** or
	// not provided.
	RecipientProfileStr string `json:"recipient_profile_str,omitempty"`
}

type CreateRecipient

type CreateRecipient struct {
	// The delta sharing authentication type.
	AuthenticationType AuthenticationType `json:"authentication_type"`
	// Description about the recipient.
	Comment string `json:"comment,omitempty"`
	// The global Unity Catalog metastore id provided by the data recipient.
	// This field is required when the __authentication_type__ is
	// **DATABRICKS**. The identifier is of format
	// __cloud__:__region__:__metastore-uuid__.
	DataRecipientGlobalMetastoreId any `json:"data_recipient_global_metastore_id,omitempty"`
	// IP Access List
	IpAccessList *IpAccessList `json:"ip_access_list,omitempty"`
	// Name of Recipient.
	Name string `json:"name"`
	// Username of the recipient owner.
	Owner string `json:"owner,omitempty"`
	// Recipient properties as map of string key-value pairs.
	PropertiesKvpairs *SecurablePropertiesKvPairs `json:"properties_kvpairs,omitempty"`
	// The one-time sharing code provided by the data recipient. This field is
	// required when the __authentication_type__ is **DATABRICKS**.
	SharingCode string `json:"sharing_code,omitempty"`
}

type CreateShare

type CreateShare struct {
	// User-provided free-form text description.
	Comment string `json:"comment,omitempty"`
	// Name of the share.
	Name string `json:"name"`
}

type DeleteProviderRequest

type DeleteProviderRequest struct {
	// Name of the provider.
	Name string `json:"-" url:"-"`
}

Delete a provider

type DeleteRecipientRequest

type DeleteRecipientRequest struct {
	// Name of the recipient.
	Name string `json:"-" url:"-"`
}

Delete a share recipient

type DeleteShareRequest

type DeleteShareRequest struct {
	// The name of the share.
	Name string `json:"-" url:"-"`
}

Delete a share

type GetActivationUrlInfoRequest

type GetActivationUrlInfoRequest struct {
	// The one time activation url. It also accepts activation token.
	ActivationUrl string `json:"-" url:"-"`
}

Get a share activation URL

type GetProviderRequest

type GetProviderRequest struct {
	// Name of the provider.
	Name string `json:"-" url:"-"`
}

Get a provider

type GetRecipientRequest

type GetRecipientRequest struct {
	// Name of the recipient.
	Name string `json:"-" url:"-"`
}

Get a share recipient

type GetRecipientSharePermissionsResponse

type GetRecipientSharePermissionsResponse struct {
	// An array of data share permissions for a recipient.
	PermissionsOut []ShareToPrivilegeAssignment `json:"permissions_out,omitempty"`
}

type GetShareRequest

type GetShareRequest struct {
	// Query for data to include in the share.
	IncludeSharedData bool `json:"-" url:"include_shared_data,omitempty"`
	// The name of the share.
	Name string `json:"-" url:"-"`
}

Get a share

type IpAccessList

type IpAccessList struct {
	// Allowed IP Addresses in CIDR notation. Limit of 100.
	AllowedIpAddresses []string `json:"allowed_ip_addresses,omitempty"`
}

type ListProviderSharesResponse

type ListProviderSharesResponse struct {
	// An array of provider shares.
	Shares []ProviderShare `json:"shares,omitempty"`
}

type ListProvidersRequest

type ListProvidersRequest struct {
	// If not provided, all providers will be returned. If no providers exist
	// with this ID, no results will be returned.
	DataProviderGlobalMetastoreId string `json:"-" url:"data_provider_global_metastore_id,omitempty"`
}

List providers

type ListProvidersResponse

type ListProvidersResponse struct {
	// An array of provider information objects.
	Providers []ProviderInfo `json:"providers,omitempty"`
}

type ListRecipientsRequest

type ListRecipientsRequest struct {
	// If not provided, all recipients will be returned. If no recipients exist
	// with this ID, no results will be returned.
	DataRecipientGlobalMetastoreId string `json:"-" url:"data_recipient_global_metastore_id,omitempty"`
}

List share recipients

type ListRecipientsResponse

type ListRecipientsResponse struct {
	// An array of recipient information objects.
	Recipients []RecipientInfo `json:"recipients,omitempty"`
}

type ListSharesRequest

type ListSharesRequest struct {
	// Name of the provider in which to list shares.
	Name string `json:"-" url:"-"`
}

List shares by Provider

type ListSharesResponse

type ListSharesResponse struct {
	// An array of data share information objects.
	Shares []ShareInfo `json:"shares,omitempty"`
}

type Partition

type Partition struct {
	// An array of partition values.
	Values []PartitionValue `json:"values,omitempty"`
}

type PartitionValue

type PartitionValue struct {
	// The name of the partition column.
	Name string `json:"name,omitempty"`
	// The operator to apply for the value.
	Op PartitionValueOp `json:"op,omitempty"`
	// The key of a Delta Sharing recipient's property. For example
	// `databricks-account-id`. When this field is set, field `value` can not be
	// set.
	RecipientPropertyKey string `json:"recipient_property_key,omitempty"`
	// The value of the partition column. When this value is not set, it means
	// `null` value. When this field is set, field `recipient_property_key` can
	// not be set.
	Value string `json:"value,omitempty"`
}

type PartitionValueOp

type PartitionValueOp string

The operator to apply for the value.

const PartitionValueOpEqual PartitionValueOp = `EQUAL`
const PartitionValueOpLike PartitionValueOp = `LIKE`

func (*PartitionValueOp) Set

func (f *PartitionValueOp) Set(v string) error

Set raw string value and validate it against allowed values

func (*PartitionValueOp) String

func (f *PartitionValueOp) String() string

String representation for fmt.Print

func (*PartitionValueOp) Type

func (f *PartitionValueOp) Type() string

Type always returns PartitionValueOp to satisfy [pflag.Value] interface

type Privilege

type Privilege string
const PrivilegeAllPrivileges Privilege = `ALL_PRIVILEGES`
const PrivilegeCreate Privilege = `CREATE`
const PrivilegeCreateCatalog Privilege = `CREATE_CATALOG`
const PrivilegeCreateExternalLocation Privilege = `CREATE_EXTERNAL_LOCATION`
const PrivilegeCreateExternalTable Privilege = `CREATE_EXTERNAL_TABLE`
const PrivilegeCreateFunction Privilege = `CREATE_FUNCTION`
const PrivilegeCreateManagedStorage Privilege = `CREATE_MANAGED_STORAGE`
const PrivilegeCreateMaterializedView Privilege = `CREATE_MATERIALIZED_VIEW`
const PrivilegeCreateProvider Privilege = `CREATE_PROVIDER`
const PrivilegeCreateRecipient Privilege = `CREATE_RECIPIENT`
const PrivilegeCreateSchema Privilege = `CREATE_SCHEMA`
const PrivilegeCreateShare Privilege = `CREATE_SHARE`
const PrivilegeCreateStorageCredential Privilege = `CREATE_STORAGE_CREDENTIAL`
const PrivilegeCreateTable Privilege = `CREATE_TABLE`
const PrivilegeCreateView Privilege = `CREATE_VIEW`
const PrivilegeExecute Privilege = `EXECUTE`
const PrivilegeModify Privilege = `MODIFY`
const PrivilegeReadFiles Privilege = `READ_FILES`
const PrivilegeReadPrivateFiles Privilege = `READ_PRIVATE_FILES`
const PrivilegeRefresh Privilege = `REFRESH`
const PrivilegeSelect Privilege = `SELECT`
const PrivilegeSetSharePermission Privilege = `SET_SHARE_PERMISSION`
const PrivilegeUsage Privilege = `USAGE`
const PrivilegeUseCatalog Privilege = `USE_CATALOG`
const PrivilegeUseProvider Privilege = `USE_PROVIDER`
const PrivilegeUseRecipient Privilege = `USE_RECIPIENT`
const PrivilegeUseSchema Privilege = `USE_SCHEMA`
const PrivilegeUseShare Privilege = `USE_SHARE`
const PrivilegeWriteFiles Privilege = `WRITE_FILES`
const PrivilegeWritePrivateFiles Privilege = `WRITE_PRIVATE_FILES`

func (*Privilege) Set

func (f *Privilege) Set(v string) error

Set raw string value and validate it against allowed values

func (*Privilege) String

func (f *Privilege) String() string

String representation for fmt.Print

func (*Privilege) Type

func (f *Privilege) Type() string

Type always returns Privilege to satisfy [pflag.Value] interface

type PrivilegeAssignment

type PrivilegeAssignment struct {
	// The principal (user email address or group name).
	Principal string `json:"principal,omitempty"`
	// The privileges assigned to the principal.
	Privileges []Privilege `json:"privileges,omitempty"`
}

type ProviderInfo

type ProviderInfo struct {
	// The delta sharing authentication type.
	AuthenticationType AuthenticationType `json:"authentication_type,omitempty"`
	// Cloud vendor of the provider's UC metastore. This field is only present
	// when the __authentication_type__ is **DATABRICKS**.
	Cloud string `json:"cloud,omitempty"`
	// Description about the provider.
	Comment string `json:"comment,omitempty"`
	// Time at which this Provider was created, in epoch milliseconds.
	CreatedAt int64 `json:"created_at,omitempty"`
	// Username of Provider creator.
	CreatedBy string `json:"created_by,omitempty"`
	// The global UC metastore id of the data provider. This field is only
	// present when the __authentication_type__ is **DATABRICKS**. The
	// identifier is of format <cloud>:<region>:<metastore-uuid>.
	DataProviderGlobalMetastoreId string `json:"data_provider_global_metastore_id,omitempty"`
	// UUID of the provider's UC metastore. This field is only present when the
	// __authentication_type__ is **DATABRICKS**.
	MetastoreId string `json:"metastore_id,omitempty"`
	// The name of the Provider.
	Name string `json:"name,omitempty"`
	// Username of Provider owner.
	Owner string `json:"owner,omitempty"`
	// The recipient profile. This field is only present when the
	// authentication_type is `TOKEN`.
	RecipientProfile *RecipientProfile `json:"recipient_profile,omitempty"`
	// This field is only present when the authentication_type is `TOKEN` or not
	// provided.
	RecipientProfileStr string `json:"recipient_profile_str,omitempty"`
	// Cloud region of the provider's UC metastore. This field is only present
	// when the __authentication_type__ is **DATABRICKS**.
	Region string `json:"region,omitempty"`
	// Time at which this Provider was created, in epoch milliseconds.
	UpdatedAt int64 `json:"updated_at,omitempty"`
	// Username of user who last modified Share.
	UpdatedBy string `json:"updated_by,omitempty"`
}

type ProviderShare

type ProviderShare struct {
	// The name of the Provider Share.
	Name string `json:"name,omitempty"`
}

type ProvidersAPI

type ProvidersAPI struct {
	// contains filtered or unexported fields
}

Databricks Providers REST API

func NewProviders

func NewProviders(client *client.DatabricksClient) *ProvidersAPI

func (*ProvidersAPI) Create

func (a *ProvidersAPI) Create(ctx context.Context, request CreateProvider) (*ProviderInfo, error)

Create an auth provider.

Creates a new authentication provider minimally based on a name and authentication type. The caller must be an admin on the metastore.

Example (Providers)
ctx := context.Background()
w, err := databricks.NewWorkspaceClient()
if err != nil {
	panic(err)
}

publicShareRecipient := `{
        "shareCredentialsVersion":1,
        "bearerToken":"dapiabcdefghijklmonpqrstuvwxyz",
        "endpoint":"https://sharing.delta.io/delta-sharing/"
    }
`

created, err := w.Providers.Create(ctx, sharing.CreateProvider{
	Name:                fmt.Sprintf("sdk-%x", time.Now().UnixNano()),
	RecipientProfileStr: publicShareRecipient,
})
if err != nil {
	panic(err)
}
logger.Infof(ctx, "found %v", created)

// cleanup

err = w.Providers.DeleteByName(ctx, created.Name)
if err != nil {
	panic(err)
}
Output:

func (*ProvidersAPI) Delete

func (a *ProvidersAPI) Delete(ctx context.Context, request DeleteProviderRequest) error

Delete a provider.

Deletes an authentication provider, if the caller is a metastore admin or is the owner of the provider.

func (*ProvidersAPI) DeleteByName

func (a *ProvidersAPI) DeleteByName(ctx context.Context, name string) error

Delete a provider.

Deletes an authentication provider, if the caller is a metastore admin or is the owner of the provider.

func (*ProvidersAPI) Get

Get a provider.

Gets a specific authentication provider. The caller must supply the name of the provider, and must either be a metastore admin or the owner of the provider.

Example (Providers)
ctx := context.Background()
w, err := databricks.NewWorkspaceClient()
if err != nil {
	panic(err)
}

publicShareRecipient := `{
        "shareCredentialsVersion":1,
        "bearerToken":"dapiabcdefghijklmonpqrstuvwxyz",
        "endpoint":"https://sharing.delta.io/delta-sharing/"
    }
`

created, err := w.Providers.Create(ctx, sharing.CreateProvider{
	Name:                fmt.Sprintf("sdk-%x", time.Now().UnixNano()),
	RecipientProfileStr: publicShareRecipient,
})
if err != nil {
	panic(err)
}
logger.Infof(ctx, "found %v", created)

_, err = w.Providers.GetByName(ctx, created.Name)
if err != nil {
	panic(err)
}

// cleanup

err = w.Providers.DeleteByName(ctx, created.Name)
if err != nil {
	panic(err)
}
Output:

func (*ProvidersAPI) GetByName

func (a *ProvidersAPI) GetByName(ctx context.Context, name string) (*ProviderInfo, error)

Get a provider.

Gets a specific authentication provider. The caller must supply the name of the provider, and must either be a metastore admin or the owner of the provider.

func (*ProvidersAPI) Impl

func (a *ProvidersAPI) Impl() ProvidersService

Impl returns low-level Providers API implementation

func (*ProvidersAPI) ListAll

func (a *ProvidersAPI) ListAll(ctx context.Context, request ListProvidersRequest) ([]ProviderInfo, error)

List providers.

Gets an array of available authentication providers. The caller must either be a metastore admin or the owner of the providers. Providers not owned by the caller are not included in the response. There is no guarantee of a specific ordering of the elements in the array.

This method is generated by Databricks SDK Code Generator.

Example (Providers)
ctx := context.Background()
w, err := databricks.NewWorkspaceClient()
if err != nil {
	panic(err)
}

all, err := w.Providers.ListAll(ctx, sharing.ListProvidersRequest{})
if err != nil {
	panic(err)
}
logger.Infof(ctx, "found %v", all)
Output:

func (*ProvidersAPI) ListSharesAll added in v0.10.0

func (a *ProvidersAPI) ListSharesAll(ctx context.Context, request ListSharesRequest) ([]ProviderShare, error)

List shares by Provider.

Gets an array of a specified provider's shares within the metastore where:

* the caller is a metastore admin, or * the caller is the owner.

This method is generated by Databricks SDK Code Generator.

func (*ProvidersAPI) ListSharesByName

func (a *ProvidersAPI) ListSharesByName(ctx context.Context, name string) (*ListProviderSharesResponse, error)

List shares by Provider.

Gets an array of a specified provider's shares within the metastore where:

* the caller is a metastore admin, or * the caller is the owner.

func (*ProvidersAPI) ProviderInfoNameToMetastoreIdMap

func (a *ProvidersAPI) ProviderInfoNameToMetastoreIdMap(ctx context.Context, request ListProvidersRequest) (map[string]string, error)

ProviderInfoNameToMetastoreIdMap calls ProvidersAPI.ListAll and creates a map of results with ProviderInfo.Name as key and ProviderInfo.MetastoreId as value.

Returns an error if there's more than one ProviderInfo with the same .Name.

Note: All ProviderInfo instances are loaded into memory before creating a map.

This method is generated by Databricks SDK Code Generator.

func (*ProvidersAPI) Update

func (a *ProvidersAPI) Update(ctx context.Context, request UpdateProvider) (*ProviderInfo, error)

Update a provider.

Updates the information for an authentication provider, if the caller is a metastore admin or is the owner of the provider. If the update changes the provider name, the caller must be both a metastore admin and the owner of the provider.

Example (Providers)
ctx := context.Background()
w, err := databricks.NewWorkspaceClient()
if err != nil {
	panic(err)
}

publicShareRecipient := `{
        "shareCredentialsVersion":1,
        "bearerToken":"dapiabcdefghijklmonpqrstuvwxyz",
        "endpoint":"https://sharing.delta.io/delta-sharing/"
    }
`

created, err := w.Providers.Create(ctx, sharing.CreateProvider{
	Name:                fmt.Sprintf("sdk-%x", time.Now().UnixNano()),
	RecipientProfileStr: publicShareRecipient,
})
if err != nil {
	panic(err)
}
logger.Infof(ctx, "found %v", created)

_, err = w.Providers.Update(ctx, sharing.UpdateProvider{
	Name:    created.Name,
	Comment: "Comment for update",
})
if err != nil {
	panic(err)
}

// cleanup

err = w.Providers.DeleteByName(ctx, created.Name)
if err != nil {
	panic(err)
}
Output:

func (*ProvidersAPI) WithImpl

func (a *ProvidersAPI) WithImpl(impl ProvidersService) *ProvidersAPI

WithImpl could be used to override low-level API implementations for unit testing purposes with github.com/golang/mock or other mocking frameworks.

type ProvidersService

type ProvidersService interface {

	// Create an auth provider.
	//
	// Creates a new authentication provider minimally based on a name and
	// authentication type. The caller must be an admin on the metastore.
	Create(ctx context.Context, request CreateProvider) (*ProviderInfo, error)

	// Delete a provider.
	//
	// Deletes an authentication provider, if the caller is a metastore admin or
	// is the owner of the provider.
	Delete(ctx context.Context, request DeleteProviderRequest) error

	// Get a provider.
	//
	// Gets a specific authentication provider. The caller must supply the name
	// of the provider, and must either be a metastore admin or the owner of the
	// provider.
	Get(ctx context.Context, request GetProviderRequest) (*ProviderInfo, error)

	// List providers.
	//
	// Gets an array of available authentication providers. The caller must
	// either be a metastore admin or the owner of the providers. Providers not
	// owned by the caller are not included in the response. There is no
	// guarantee of a specific ordering of the elements in the array.
	//
	// Use ListAll() to get all ProviderInfo instances
	List(ctx context.Context, request ListProvidersRequest) (*ListProvidersResponse, error)

	// List shares by Provider.
	//
	// Gets an array of a specified provider's shares within the metastore
	// where:
	//
	// * the caller is a metastore admin, or * the caller is the owner.
	//
	// Use ListSharesAll() to get all ProviderShare instances
	ListShares(ctx context.Context, request ListSharesRequest) (*ListProviderSharesResponse, error)

	// Update a provider.
	//
	// Updates the information for an authentication provider, if the caller is
	// a metastore admin or is the owner of the provider. If the update changes
	// the provider name, the caller must be both a metastore admin and the
	// owner of the provider.
	Update(ctx context.Context, request UpdateProvider) (*ProviderInfo, error)
}

Databricks Providers REST API

type RecipientActivationAPI

type RecipientActivationAPI struct {
	// contains filtered or unexported fields
}

Databricks Recipient Activation REST API

func NewRecipientActivation

func NewRecipientActivation(client *client.DatabricksClient) *RecipientActivationAPI

func (*RecipientActivationAPI) GetActivationUrlInfo

func (a *RecipientActivationAPI) GetActivationUrlInfo(ctx context.Context, request GetActivationUrlInfoRequest) error

Get a share activation URL.

Gets an activation URL for a share.

func (*RecipientActivationAPI) GetActivationUrlInfoByActivationUrl

func (a *RecipientActivationAPI) GetActivationUrlInfoByActivationUrl(ctx context.Context, activationUrl string) error

Get a share activation URL.

Gets an activation URL for a share.

func (*RecipientActivationAPI) Impl

Impl returns low-level RecipientActivation API implementation

func (*RecipientActivationAPI) RetrieveToken

Get an access token.

Retrieve access token with an activation url. This is a public API without any authentication.

func (*RecipientActivationAPI) RetrieveTokenByActivationUrl

func (a *RecipientActivationAPI) RetrieveTokenByActivationUrl(ctx context.Context, activationUrl string) (*RetrieveTokenResponse, error)

Get an access token.

Retrieve access token with an activation url. This is a public API without any authentication.

func (*RecipientActivationAPI) WithImpl

WithImpl could be used to override low-level API implementations for unit testing purposes with github.com/golang/mock or other mocking frameworks.

type RecipientActivationService

type RecipientActivationService interface {

	// Get a share activation URL.
	//
	// Gets an activation URL for a share.
	GetActivationUrlInfo(ctx context.Context, request GetActivationUrlInfoRequest) error

	// Get an access token.
	//
	// Retrieve access token with an activation url. This is a public API
	// without any authentication.
	RetrieveToken(ctx context.Context, request RetrieveTokenRequest) (*RetrieveTokenResponse, error)
}

Databricks Recipient Activation REST API

type RecipientInfo

type RecipientInfo struct {
	// A boolean status field showing whether the Recipient's activation URL has
	// been exercised or not.
	Activated bool `json:"activated,omitempty"`
	// Full activation url to retrieve the access token. It will be empty if the
	// token is already retrieved.
	ActivationUrl string `json:"activation_url,omitempty"`
	// The delta sharing authentication type.
	AuthenticationType AuthenticationType `json:"authentication_type,omitempty"`
	// Cloud vendor of the recipient's Unity Catalog Metstore. This field is
	// only present when the __authentication_type__ is **DATABRICKS**`.
	Cloud string `json:"cloud,omitempty"`
	// Description about the recipient.
	Comment string `json:"comment,omitempty"`
	// Time at which this recipient was created, in epoch milliseconds.
	CreatedAt int64 `json:"created_at,omitempty"`
	// Username of recipient creator.
	CreatedBy string `json:"created_by,omitempty"`
	// The global Unity Catalog metastore id provided by the data recipient.
	// This field is only present when the __authentication_type__ is
	// **DATABRICKS**. The identifier is of format
	// __cloud__:__region__:__metastore-uuid__.
	DataRecipientGlobalMetastoreId any `json:"data_recipient_global_metastore_id,omitempty"`
	// IP Access List
	IpAccessList *IpAccessList `json:"ip_access_list,omitempty"`
	// Unique identifier of recipient's Unity Catalog metastore. This field is
	// only present when the __authentication_type__ is **DATABRICKS**
	MetastoreId string `json:"metastore_id,omitempty"`
	// Name of Recipient.
	Name string `json:"name,omitempty"`
	// Username of the recipient owner.
	Owner string `json:"owner,omitempty"`
	// Recipient properties as map of string key-value pairs.
	PropertiesKvpairs *SecurablePropertiesKvPairs `json:"properties_kvpairs,omitempty"`
	// Cloud region of the recipient's Unity Catalog Metstore. This field is
	// only present when the __authentication_type__ is **DATABRICKS**.
	Region string `json:"region,omitempty"`
	// The one-time sharing code provided by the data recipient. This field is
	// only present when the __authentication_type__ is **DATABRICKS**.
	SharingCode string `json:"sharing_code,omitempty"`
	// This field is only present when the __authentication_type__ is **TOKEN**.
	Tokens []RecipientTokenInfo `json:"tokens,omitempty"`
	// Time at which the recipient was updated, in epoch milliseconds.
	UpdatedAt int64 `json:"updated_at,omitempty"`
	// Username of recipient updater.
	UpdatedBy string `json:"updated_by,omitempty"`
}

type RecipientProfile

type RecipientProfile struct {
	// The token used to authorize the recipient.
	BearerToken string `json:"bearer_token,omitempty"`
	// The endpoint for the share to be used by the recipient.
	Endpoint string `json:"endpoint,omitempty"`
	// The version number of the recipient's credentials on a share.
	ShareCredentialsVersion int `json:"share_credentials_version,omitempty"`
}

type RecipientTokenInfo

type RecipientTokenInfo struct {
	// Full activation URL to retrieve the access token. It will be empty if the
	// token is already retrieved.
	ActivationUrl string `json:"activation_url,omitempty"`
	// Time at which this recipient Token was created, in epoch milliseconds.
	CreatedAt int64 `json:"created_at,omitempty"`
	// Username of recipient token creator.
	CreatedBy string `json:"created_by,omitempty"`
	// Expiration timestamp of the token in epoch milliseconds.
	ExpirationTime int64 `json:"expiration_time,omitempty"`
	// Unique ID of the recipient token.
	Id string `json:"id,omitempty"`
	// Time at which this recipient Token was updated, in epoch milliseconds.
	UpdatedAt int64 `json:"updated_at,omitempty"`
	// Username of recipient Token updater.
	UpdatedBy string `json:"updated_by,omitempty"`
}

type RecipientsAPI

type RecipientsAPI struct {
	// contains filtered or unexported fields
}

Databricks Recipients REST API

func NewRecipients

func NewRecipients(client *client.DatabricksClient) *RecipientsAPI

func (*RecipientsAPI) Create

func (a *RecipientsAPI) Create(ctx context.Context, request CreateRecipient) (*RecipientInfo, error)

Create a share recipient.

Creates a new recipient with the delta sharing authentication type in the metastore. The caller must be a metastore admin or has the **CREATE_RECIPIENT** privilege on the metastore.

Example (Recipients)
ctx := context.Background()
w, err := databricks.NewWorkspaceClient()
if err != nil {
	panic(err)
}

created, err := w.Recipients.Create(ctx, sharing.CreateRecipient{
	Name: fmt.Sprintf("sdk-%x", time.Now().UnixNano()),
})
if err != nil {
	panic(err)
}
logger.Infof(ctx, "found %v", created)

// cleanup

err = w.Recipients.DeleteByName(ctx, created.Name)
if err != nil {
	panic(err)
}
Output:

func (*RecipientsAPI) Delete

func (a *RecipientsAPI) Delete(ctx context.Context, request DeleteRecipientRequest) error

Delete a share recipient.

Deletes the specified recipient from the metastore. The caller must be the owner of the recipient.

func (*RecipientsAPI) DeleteByName

func (a *RecipientsAPI) DeleteByName(ctx context.Context, name string) error

Delete a share recipient.

Deletes the specified recipient from the metastore. The caller must be the owner of the recipient.

func (*RecipientsAPI) Get

Get a share recipient.

Gets a share recipient from the metastore if:

* the caller is the owner of the share recipient, or: * is a metastore admin

Example (Recipients)
ctx := context.Background()
w, err := databricks.NewWorkspaceClient()
if err != nil {
	panic(err)
}

created, err := w.Recipients.Create(ctx, sharing.CreateRecipient{
	Name: fmt.Sprintf("sdk-%x", time.Now().UnixNano()),
})
if err != nil {
	panic(err)
}
logger.Infof(ctx, "found %v", created)

_, err = w.Recipients.GetByName(ctx, created.Name)
if err != nil {
	panic(err)
}

// cleanup

err = w.Recipients.DeleteByName(ctx, created.Name)
if err != nil {
	panic(err)
}
Output:

func (*RecipientsAPI) GetByName

func (a *RecipientsAPI) GetByName(ctx context.Context, name string) (*RecipientInfo, error)

Get a share recipient.

Gets a share recipient from the metastore if:

* the caller is the owner of the share recipient, or: * is a metastore admin

func (*RecipientsAPI) Impl

func (a *RecipientsAPI) Impl() RecipientsService

Impl returns low-level Recipients API implementation

func (*RecipientsAPI) ListAll

func (a *RecipientsAPI) ListAll(ctx context.Context, request ListRecipientsRequest) ([]RecipientInfo, error)

List share recipients.

Gets an array of all share recipients within the current metastore where:

* the caller is a metastore admin, or * the caller is the owner. There is no guarantee of a specific ordering of the elements in the array.

This method is generated by Databricks SDK Code Generator.

Example (Recipients)
ctx := context.Background()
w, err := databricks.NewWorkspaceClient()
if err != nil {
	panic(err)
}

all, err := w.Recipients.ListAll(ctx, sharing.ListRecipientsRequest{})
if err != nil {
	panic(err)
}
logger.Infof(ctx, "found %v", all)
Output:

func (*RecipientsAPI) RecipientInfoNameToMetastoreIdMap

func (a *RecipientsAPI) RecipientInfoNameToMetastoreIdMap(ctx context.Context, request ListRecipientsRequest) (map[string]string, error)

RecipientInfoNameToMetastoreIdMap calls RecipientsAPI.ListAll and creates a map of results with RecipientInfo.Name as key and RecipientInfo.MetastoreId as value.

Returns an error if there's more than one RecipientInfo with the same .Name.

Note: All RecipientInfo instances are loaded into memory before creating a map.

This method is generated by Databricks SDK Code Generator.

func (*RecipientsAPI) RotateToken

func (a *RecipientsAPI) RotateToken(ctx context.Context, request RotateRecipientToken) (*RecipientInfo, error)

Rotate a token.

Refreshes the specified recipient's delta sharing authentication token with the provided token info. The caller must be the owner of the recipient.

Example (Recipients)
ctx := context.Background()
w, err := databricks.NewWorkspaceClient()
if err != nil {
	panic(err)
}

created, err := w.Recipients.Create(ctx, sharing.CreateRecipient{
	Name: fmt.Sprintf("sdk-%x", time.Now().UnixNano()),
})
if err != nil {
	panic(err)
}
logger.Infof(ctx, "found %v", created)

recipientInfo, err := w.Recipients.RotateToken(ctx, sharing.RotateRecipientToken{
	Name:                         created.Name,
	ExistingTokenExpireInSeconds: 0,
})
if err != nil {
	panic(err)
}
logger.Infof(ctx, "found %v", recipientInfo)

// cleanup

err = w.Recipients.DeleteByName(ctx, created.Name)
if err != nil {
	panic(err)
}
Output:

func (*RecipientsAPI) SharePermissions

Get recipient share permissions.

Gets the share permissions for the specified Recipient. The caller must be a metastore admin or the owner of the Recipient.

Example (Recipients)
ctx := context.Background()
w, err := databricks.NewWorkspaceClient()
if err != nil {
	panic(err)
}

created, err := w.Recipients.Create(ctx, sharing.CreateRecipient{
	Name: fmt.Sprintf("sdk-%x", time.Now().UnixNano()),
})
if err != nil {
	panic(err)
}
logger.Infof(ctx, "found %v", created)

sharePermissions, err := w.Recipients.SharePermissionsByName(ctx, created.Name)
if err != nil {
	panic(err)
}
logger.Infof(ctx, "found %v", sharePermissions)

// cleanup

err = w.Recipients.DeleteByName(ctx, created.Name)
if err != nil {
	panic(err)
}
Output:

func (*RecipientsAPI) SharePermissionsByName

func (a *RecipientsAPI) SharePermissionsByName(ctx context.Context, name string) (*GetRecipientSharePermissionsResponse, error)

Get recipient share permissions.

Gets the share permissions for the specified Recipient. The caller must be a metastore admin or the owner of the Recipient.

func (*RecipientsAPI) Update

func (a *RecipientsAPI) Update(ctx context.Context, request UpdateRecipient) error

Update a share recipient.

Updates an existing recipient in the metastore. The caller must be a metastore admin or the owner of the recipient. If the recipient name will be updated, the user must be both a metastore admin and the owner of the recipient.

Example (Recipients)
ctx := context.Background()
w, err := databricks.NewWorkspaceClient()
if err != nil {
	panic(err)
}

created, err := w.Recipients.Create(ctx, sharing.CreateRecipient{
	Name: fmt.Sprintf("sdk-%x", time.Now().UnixNano()),
})
if err != nil {
	panic(err)
}
logger.Infof(ctx, "found %v", created)

err = w.Recipients.Update(ctx, sharing.UpdateRecipient{
	Name:    created.Name,
	Comment: fmt.Sprintf("sdk-%x", time.Now().UnixNano()),
})
if err != nil {
	panic(err)
}

// cleanup

err = w.Recipients.DeleteByName(ctx, created.Name)
if err != nil {
	panic(err)
}
Output:

func (*RecipientsAPI) WithImpl

func (a *RecipientsAPI) WithImpl(impl RecipientsService) *RecipientsAPI

WithImpl could be used to override low-level API implementations for unit testing purposes with github.com/golang/mock or other mocking frameworks.

type RecipientsService

type RecipientsService interface {

	// Create a share recipient.
	//
	// Creates a new recipient with the delta sharing authentication type in the
	// metastore. The caller must be a metastore admin or has the
	// **CREATE_RECIPIENT** privilege on the metastore.
	Create(ctx context.Context, request CreateRecipient) (*RecipientInfo, error)

	// Delete a share recipient.
	//
	// Deletes the specified recipient from the metastore. The caller must be
	// the owner of the recipient.
	Delete(ctx context.Context, request DeleteRecipientRequest) error

	// Get a share recipient.
	//
	// Gets a share recipient from the metastore if:
	//
	// * the caller is the owner of the share recipient, or: * is a metastore
	// admin
	Get(ctx context.Context, request GetRecipientRequest) (*RecipientInfo, error)

	// List share recipients.
	//
	// Gets an array of all share recipients within the current metastore where:
	//
	// * the caller is a metastore admin, or * the caller is the owner. There is
	// no guarantee of a specific ordering of the elements in the array.
	//
	// Use ListAll() to get all RecipientInfo instances
	List(ctx context.Context, request ListRecipientsRequest) (*ListRecipientsResponse, error)

	// Rotate a token.
	//
	// Refreshes the specified recipient's delta sharing authentication token
	// with the provided token info. The caller must be the owner of the
	// recipient.
	RotateToken(ctx context.Context, request RotateRecipientToken) (*RecipientInfo, error)

	// Get recipient share permissions.
	//
	// Gets the share permissions for the specified Recipient. The caller must
	// be a metastore admin or the owner of the Recipient.
	SharePermissions(ctx context.Context, request SharePermissionsRequest) (*GetRecipientSharePermissionsResponse, error)

	// Update a share recipient.
	//
	// Updates an existing recipient in the metastore. The caller must be a
	// metastore admin or the owner of the recipient. If the recipient name will
	// be updated, the user must be both a metastore admin and the owner of the
	// recipient.
	Update(ctx context.Context, request UpdateRecipient) error
}

Databricks Recipients REST API

type RetrieveTokenRequest

type RetrieveTokenRequest struct {
	// The one time activation url. It also accepts activation token.
	ActivationUrl string `json:"-" url:"-"`
}

Get an access token

type RetrieveTokenResponse

type RetrieveTokenResponse struct {
	// The token used to authorize the recipient.
	BearerToken string `json:"bearerToken,omitempty"`
	// The endpoint for the share to be used by the recipient.
	Endpoint string `json:"endpoint,omitempty"`
	// Expiration timestamp of the token in epoch milliseconds.
	ExpirationTime string `json:"expirationTime,omitempty"`
	// These field names must follow the delta sharing protocol.
	ShareCredentialsVersion int `json:"shareCredentialsVersion,omitempty"`
}

type RotateRecipientToken

type RotateRecipientToken struct {
	// The expiration time of the bearer token in ISO 8601 format. This will set
	// the expiration_time of existing token only to a smaller timestamp, it
	// cannot extend the expiration_time. Use 0 to expire the existing token
	// immediately, negative number will return an error.
	ExistingTokenExpireInSeconds int64 `json:"existing_token_expire_in_seconds"`
	// The name of the recipient.
	Name string `json:"-" url:"-"`
}

type SecurablePropertiesKvPairs added in v0.9.0

type SecurablePropertiesKvPairs struct {
	// A map of key-value properties attached to the securable.
	Properties map[string]string `json:"properties"`
}

An object with __properties__ containing map of key-value properties attached to the securable.

type SecurablePropertiesMap added in v0.9.0

type SecurablePropertiesMap map[string]string

A map of key-value properties attached to the securable.

type ShareInfo

type ShareInfo struct {
	// User-provided free-form text description.
	Comment string `json:"comment,omitempty"`
	// Time at which this share was created, in epoch milliseconds.
	CreatedAt int64 `json:"created_at,omitempty"`
	// Username of share creator.
	CreatedBy string `json:"created_by,omitempty"`
	// Name of the share.
	Name string `json:"name,omitempty"`
	// A list of shared data objects within the share.
	Objects []SharedDataObject `json:"objects,omitempty"`
	// Username of current owner of share.
	Owner string `json:"owner,omitempty"`
	// Time at which this share was updated, in epoch milliseconds.
	UpdatedAt int64 `json:"updated_at,omitempty"`
	// Username of share updater.
	UpdatedBy string `json:"updated_by,omitempty"`
}

type SharePermissionsRequest

type SharePermissionsRequest struct {
	// The name of the Recipient.
	Name string `json:"-" url:"-"`
}

Get recipient share permissions

type ShareToPrivilegeAssignment

type ShareToPrivilegeAssignment struct {
	// The privileges assigned to the principal.
	PrivilegeAssignments []PrivilegeAssignment `json:"privilege_assignments,omitempty"`
	// The share name.
	ShareName string `json:"share_name,omitempty"`
}

type SharedDataObject

type SharedDataObject struct {
	// The time when this data object is added to the share, in epoch
	// milliseconds.
	AddedAt int64 `json:"added_at,omitempty"`
	// Username of the sharer.
	AddedBy string `json:"added_by,omitempty"`
	// Whether to enable cdf or indicate if cdf is enabled on the shared object.
	CdfEnabled bool `json:"cdf_enabled,omitempty"`
	// A user-provided comment when adding the data object to the share.
	// [Update:OPT]
	Comment string `json:"comment,omitempty"`
	// The type of the data object.
	DataObjectType string `json:"data_object_type,omitempty"`
	// A fully qualified name that uniquely identifies a data object.
	//
	// For example, a table's fully qualified name is in the format of
	// `<catalog>.<schema>.<table>`.
	Name string `json:"name"`
	// Array of partitions for the shared data.
	Partitions []Partition `json:"partitions,omitempty"`
	// A user-provided new name for the data object within the share. If this
	// new name is not provided, the object's original name will be used as the
	// `shared_as` name. The `shared_as` name must be unique within a share. For
	// tables, the new name must follow the format of `<schema>.<table>`.
	SharedAs string `json:"shared_as,omitempty"`
	// The start version associated with the object. This allows data providers
	// to control the lowest object version that is accessible by clients. If
	// specified, clients can query snapshots or changes for versions >=
	// start_version. If not specified, clients can only query starting from the
	// version of the object at the time it was added to the share.
	//
	// NOTE: The start_version should be <= the `current` version of the object.
	StartVersion int64 `json:"start_version,omitempty"`
	// One of: **ACTIVE**, **PERMISSION_DENIED**.
	Status SharedDataObjectStatus `json:"status,omitempty"`
}

type SharedDataObjectStatus

type SharedDataObjectStatus string

One of: **ACTIVE**, **PERMISSION_DENIED**.

const SharedDataObjectStatusActive SharedDataObjectStatus = `ACTIVE`
const SharedDataObjectStatusPermissionDenied SharedDataObjectStatus = `PERMISSION_DENIED`

func (*SharedDataObjectStatus) Set

Set raw string value and validate it against allowed values

func (*SharedDataObjectStatus) String

func (f *SharedDataObjectStatus) String() string

String representation for fmt.Print

func (*SharedDataObjectStatus) Type

func (f *SharedDataObjectStatus) Type() string

Type always returns SharedDataObjectStatus to satisfy [pflag.Value] interface

type SharedDataObjectUpdate

type SharedDataObjectUpdate struct {
	// One of: **ADD**, **REMOVE**, **UPDATE**.
	Action SharedDataObjectUpdateAction `json:"action,omitempty"`
	// The data object that is being added, removed, or updated.
	DataObject *SharedDataObject `json:"data_object,omitempty"`
}

type SharedDataObjectUpdateAction

type SharedDataObjectUpdateAction string

One of: **ADD**, **REMOVE**, **UPDATE**.

const SharedDataObjectUpdateActionAdd SharedDataObjectUpdateAction = `ADD`
const SharedDataObjectUpdateActionRemove SharedDataObjectUpdateAction = `REMOVE`
const SharedDataObjectUpdateActionUpdate SharedDataObjectUpdateAction = `UPDATE`

func (*SharedDataObjectUpdateAction) Set

Set raw string value and validate it against allowed values

func (*SharedDataObjectUpdateAction) String

String representation for fmt.Print

func (*SharedDataObjectUpdateAction) Type

Type always returns SharedDataObjectUpdateAction to satisfy [pflag.Value] interface

type SharesAPI

type SharesAPI struct {
	// contains filtered or unexported fields
}

Databricks Shares REST API

func NewShares

func NewShares(client *client.DatabricksClient) *SharesAPI

func (*SharesAPI) Create

func (a *SharesAPI) Create(ctx context.Context, request CreateShare) (*ShareInfo, error)

Create a share.

Creates a new share for data objects. Data objects can be added after creation with **update**. The caller must be a metastore admin or have the **CREATE_SHARE** privilege on the metastore.

Example (Shares)
ctx := context.Background()
w, err := databricks.NewWorkspaceClient()
if err != nil {
	panic(err)
}

createdShare, err := w.Shares.Create(ctx, sharing.CreateShare{
	Name: fmt.Sprintf("sdk-%x", time.Now().UnixNano()),
})
if err != nil {
	panic(err)
}
logger.Infof(ctx, "found %v", createdShare)

// cleanup

err = w.Shares.DeleteByName(ctx, createdShare.Name)
if err != nil {
	panic(err)
}
Output:

func (*SharesAPI) Delete

func (a *SharesAPI) Delete(ctx context.Context, request DeleteShareRequest) error

Delete a share.

Deletes a data object share from the metastore. The caller must be an owner of the share.

func (*SharesAPI) DeleteByName

func (a *SharesAPI) DeleteByName(ctx context.Context, name string) error

Delete a share.

Deletes a data object share from the metastore. The caller must be an owner of the share.

func (*SharesAPI) Get

func (a *SharesAPI) Get(ctx context.Context, request GetShareRequest) (*ShareInfo, error)

Get a share.

Gets a data object share from the metastore. The caller must be a metastore admin or the owner of the share.

Example (Shares)
ctx := context.Background()
w, err := databricks.NewWorkspaceClient()
if err != nil {
	panic(err)
}

createdShare, err := w.Shares.Create(ctx, sharing.CreateShare{
	Name: fmt.Sprintf("sdk-%x", time.Now().UnixNano()),
})
if err != nil {
	panic(err)
}
logger.Infof(ctx, "found %v", createdShare)

_, err = w.Shares.GetByName(ctx, createdShare.Name)
if err != nil {
	panic(err)
}

// cleanup

err = w.Shares.DeleteByName(ctx, createdShare.Name)
if err != nil {
	panic(err)
}
Output:

func (*SharesAPI) GetByName

func (a *SharesAPI) GetByName(ctx context.Context, name string) (*ShareInfo, error)

Get a share.

Gets a data object share from the metastore. The caller must be a metastore admin or the owner of the share.

func (*SharesAPI) Impl

func (a *SharesAPI) Impl() SharesService

Impl returns low-level Shares API implementation

func (*SharesAPI) ListAll

func (a *SharesAPI) ListAll(ctx context.Context) ([]ShareInfo, error)

List shares.

Gets an array of data object shares from the metastore. The caller must be a metastore admin or the owner of the share. There is no guarantee of a specific ordering of the elements in the array.

This method is generated by Databricks SDK Code Generator.

Example (Shares)
ctx := context.Background()
w, err := databricks.NewWorkspaceClient()
if err != nil {
	panic(err)
}

all, err := w.Shares.ListAll(ctx)
if err != nil {
	panic(err)
}
logger.Infof(ctx, "found %v", all)
Output:

func (*SharesAPI) SharePermissions

func (a *SharesAPI) SharePermissions(ctx context.Context, request SharePermissionsRequest) (*catalog.PermissionsList, error)

Get permissions.

Gets the permissions for a data share from the metastore. The caller must be a metastore admin or the owner of the share.

func (*SharesAPI) SharePermissionsByName

func (a *SharesAPI) SharePermissionsByName(ctx context.Context, name string) (*catalog.PermissionsList, error)

Get permissions.

Gets the permissions for a data share from the metastore. The caller must be a metastore admin or the owner of the share.

func (*SharesAPI) Update

func (a *SharesAPI) Update(ctx context.Context, request UpdateShare) (*ShareInfo, error)

Update a share.

Updates the share with the changes and data objects in the request. The caller must be the owner of the share or a metastore admin.

When the caller is a metastore admin, only the __owner__ field can be updated.

In the case that the share name is changed, **updateShare** requires that the caller is both the share owner and a metastore admin.

For each table that is added through this method, the share owner must also have **SELECT** privilege on the table. This privilege must be maintained indefinitely for recipients to be able to access the table. Typically, you should use a group as the share owner.

Table removals through **update** do not require additional privileges.

Example (Shares)
ctx := context.Background()
w, err := databricks.NewWorkspaceClient()
if err != nil {
	panic(err)
}

tableName := fmt.Sprintf("sdk-%x", time.Now().UnixNano())

createdCatalog, err := w.Catalogs.Create(ctx, catalog.CreateCatalog{
	Name: fmt.Sprintf("sdk-%x", time.Now().UnixNano()),
})
if err != nil {
	panic(err)
}
logger.Infof(ctx, "found %v", createdCatalog)

createdSchema, err := w.Schemas.Create(ctx, catalog.CreateSchema{
	Name:        fmt.Sprintf("sdk-%x", time.Now().UnixNano()),
	CatalogName: createdCatalog.Name,
})
if err != nil {
	panic(err)
}
logger.Infof(ctx, "found %v", createdSchema)

_, err = w.StatementExecution.ExecuteAndWait(ctx, sql.ExecuteStatementRequest{
	WarehouseId: os.Getenv("TEST_DEFAULT_WAREHOUSE_ID"),
	Catalog:     createdCatalog.Name,
	Schema:      createdSchema.Name,
	Statement:   fmt.Sprintf("CREATE TABLE %s AS SELECT 2+2 as four", tableName),
})
if err != nil {
	panic(err)
}

tableFullName := fmt.Sprintf("%s.%s.%s", createdCatalog.Name, createdSchema.Name, tableName)

createdShare, err := w.Shares.Create(ctx, sharing.CreateShare{
	Name: fmt.Sprintf("sdk-%x", time.Now().UnixNano()),
})
if err != nil {
	panic(err)
}
logger.Infof(ctx, "found %v", createdShare)

_, err = w.Shares.Update(ctx, sharing.UpdateShare{
	Name: createdShare.Name,
	Updates: []sharing.SharedDataObjectUpdate{sharing.SharedDataObjectUpdate{
		Action: sharing.SharedDataObjectUpdateActionAdd,
		DataObject: &sharing.SharedDataObject{
			Name:           tableFullName,
			DataObjectType: "TABLE",
		},
	}},
})
if err != nil {
	panic(err)
}

// cleanup

err = w.Schemas.DeleteByFullName(ctx, createdSchema.FullName)
if err != nil {
	panic(err)
}
err = w.Catalogs.Delete(ctx, catalog.DeleteCatalogRequest{
	Name:  createdCatalog.Name,
	Force: true,
})
if err != nil {
	panic(err)
}
err = w.Tables.DeleteByFullName(ctx, tableFullName)
if err != nil {
	panic(err)
}
err = w.Shares.DeleteByName(ctx, createdShare.Name)
if err != nil {
	panic(err)
}
Output:

func (*SharesAPI) UpdatePermissions

func (a *SharesAPI) UpdatePermissions(ctx context.Context, request UpdateSharePermissions) error

Update permissions.

Updates the permissions for a data share in the metastore. The caller must be a metastore admin or an owner of the share.

For new recipient grants, the user must also be the owner of the recipients. recipient revocations do not require additional privileges.

func (*SharesAPI) WithImpl

func (a *SharesAPI) WithImpl(impl SharesService) *SharesAPI

WithImpl could be used to override low-level API implementations for unit testing purposes with github.com/golang/mock or other mocking frameworks.

type SharesService

type SharesService interface {

	// Create a share.
	//
	// Creates a new share for data objects. Data objects can be added after
	// creation with **update**. The caller must be a metastore admin or have
	// the **CREATE_SHARE** privilege on the metastore.
	Create(ctx context.Context, request CreateShare) (*ShareInfo, error)

	// Delete a share.
	//
	// Deletes a data object share from the metastore. The caller must be an
	// owner of the share.
	Delete(ctx context.Context, request DeleteShareRequest) error

	// Get a share.
	//
	// Gets a data object share from the metastore. The caller must be a
	// metastore admin or the owner of the share.
	Get(ctx context.Context, request GetShareRequest) (*ShareInfo, error)

	// List shares.
	//
	// Gets an array of data object shares from the metastore. The caller must
	// be a metastore admin or the owner of the share. There is no guarantee of
	// a specific ordering of the elements in the array.
	//
	// Use ListAll() to get all ShareInfo instances
	List(ctx context.Context) (*ListSharesResponse, error)

	// Get permissions.
	//
	// Gets the permissions for a data share from the metastore. The caller must
	// be a metastore admin or the owner of the share.
	SharePermissions(ctx context.Context, request SharePermissionsRequest) (*catalog.PermissionsList, error)

	// Update a share.
	//
	// Updates the share with the changes and data objects in the request. The
	// caller must be the owner of the share or a metastore admin.
	//
	// When the caller is a metastore admin, only the __owner__ field can be
	// updated.
	//
	// In the case that the share name is changed, **updateShare** requires that
	// the caller is both the share owner and a metastore admin.
	//
	// For each table that is added through this method, the share owner must
	// also have **SELECT** privilege on the table. This privilege must be
	// maintained indefinitely for recipients to be able to access the table.
	// Typically, you should use a group as the share owner.
	//
	// Table removals through **update** do not require additional privileges.
	Update(ctx context.Context, request UpdateShare) (*ShareInfo, error)

	// Update permissions.
	//
	// Updates the permissions for a data share in the metastore. The caller
	// must be a metastore admin or an owner of the share.
	//
	// For new recipient grants, the user must also be the owner of the
	// recipients. recipient revocations do not require additional privileges.
	UpdatePermissions(ctx context.Context, request UpdateSharePermissions) error
}

Databricks Shares REST API

type UpdateProvider

type UpdateProvider struct {
	// Description about the provider.
	Comment string `json:"comment,omitempty"`
	// The name of the Provider.
	Name string `json:"name,omitempty" url:"-"`
	// Username of Provider owner.
	Owner string `json:"owner,omitempty"`
	// This field is required when the __authentication_type__ is **TOKEN** or
	// not provided.
	RecipientProfileStr string `json:"recipient_profile_str,omitempty"`
}

type UpdateRecipient

type UpdateRecipient struct {
	// Description about the recipient.
	Comment string `json:"comment,omitempty"`
	// IP Access List
	IpAccessList *IpAccessList `json:"ip_access_list,omitempty"`
	// Name of Recipient.
	Name string `json:"name,omitempty" url:"-"`
	// Username of the recipient owner.
	Owner string `json:"owner,omitempty"`
	// Recipient properties as map of string key-value pairs. When provided in
	// update request, the specified properties will override the existing
	// properties. To add and remove properties, one would need to perform a
	// read-modify-write.
	PropertiesKvpairs *SecurablePropertiesKvPairs `json:"properties_kvpairs,omitempty"`
}

type UpdateShare

type UpdateShare struct {
	// User-provided free-form text description.
	Comment string `json:"comment,omitempty"`
	// Name of the share.
	Name string `json:"name,omitempty" url:"-"`
	// Username of current owner of share.
	Owner string `json:"owner,omitempty"`
	// Array of shared data object updates.
	Updates []SharedDataObjectUpdate `json:"updates,omitempty"`
}

type UpdateSharePermissions

type UpdateSharePermissions struct {
	// Array of permission changes.
	Changes []catalog.PermissionsChange `json:"changes,omitempty"`
	// The name of the share.
	Name string `json:"-" url:"-"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL