Documentation
¶
Overview ¶
These APIs allow you to manage Providers, Recipient Activation, Recipients, Shares, etc.
Index ¶
- type AuthenticationType
- type CreateProvider
- type CreateRecipient
- type CreateShare
- type DeleteProviderRequest
- type DeleteRecipientRequest
- type DeleteShareRequest
- type GetActivationUrlInfoRequest
- type GetProviderRequest
- type GetRecipientRequest
- type GetRecipientSharePermissionsResponse
- type GetShareRequest
- type IpAccessList
- type ListProviderSharesResponse
- type ListProvidersRequest
- type ListProvidersResponse
- type ListRecipientsRequest
- type ListRecipientsResponse
- type ListSharesRequest
- type ListSharesResponse
- type Partition
- type PartitionValue
- type PartitionValueOp
- type Privilege
- type PrivilegeAssignment
- type ProviderInfo
- type ProviderShare
- type ProvidersAPI
- func (a *ProvidersAPI) Create(ctx context.Context, request CreateProvider) (*ProviderInfo, error)
- func (a *ProvidersAPI) Delete(ctx context.Context, request DeleteProviderRequest) error
- func (a *ProvidersAPI) DeleteByName(ctx context.Context, name string) error
- func (a *ProvidersAPI) Get(ctx context.Context, request GetProviderRequest) (*ProviderInfo, error)
- func (a *ProvidersAPI) GetByName(ctx context.Context, name string) (*ProviderInfo, error)
- func (a *ProvidersAPI) Impl() ProvidersService
- func (a *ProvidersAPI) ListAll(ctx context.Context, request ListProvidersRequest) ([]ProviderInfo, error)
- func (a *ProvidersAPI) ListShares(ctx context.Context, request ListSharesRequest) (*ListProviderSharesResponse, error)
- func (a *ProvidersAPI) ListSharesByName(ctx context.Context, name string) (*ListProviderSharesResponse, error)
- func (a *ProvidersAPI) ProviderInfoNameToMetastoreIdMap(ctx context.Context, request ListProvidersRequest) (map[string]string, error)
- func (a *ProvidersAPI) Update(ctx context.Context, request UpdateProvider) (*ProviderInfo, error)
- func (a *ProvidersAPI) WithImpl(impl ProvidersService) *ProvidersAPI
- type ProvidersService
- type RecipientActivationAPI
- func (a *RecipientActivationAPI) GetActivationUrlInfo(ctx context.Context, request GetActivationUrlInfoRequest) error
- func (a *RecipientActivationAPI) GetActivationUrlInfoByActivationUrl(ctx context.Context, activationUrl string) error
- func (a *RecipientActivationAPI) Impl() RecipientActivationService
- func (a *RecipientActivationAPI) RetrieveToken(ctx context.Context, request RetrieveTokenRequest) (*RetrieveTokenResponse, error)
- func (a *RecipientActivationAPI) RetrieveTokenByActivationUrl(ctx context.Context, activationUrl string) (*RetrieveTokenResponse, error)
- func (a *RecipientActivationAPI) WithImpl(impl RecipientActivationService) *RecipientActivationAPI
- type RecipientActivationService
- type RecipientInfo
- type RecipientProfile
- type RecipientTokenInfo
- type RecipientsAPI
- func (a *RecipientsAPI) Create(ctx context.Context, request CreateRecipient) (*RecipientInfo, error)
- func (a *RecipientsAPI) Delete(ctx context.Context, request DeleteRecipientRequest) error
- func (a *RecipientsAPI) DeleteByName(ctx context.Context, name string) error
- func (a *RecipientsAPI) Get(ctx context.Context, request GetRecipientRequest) (*RecipientInfo, error)
- func (a *RecipientsAPI) GetByName(ctx context.Context, name string) (*RecipientInfo, error)
- func (a *RecipientsAPI) Impl() RecipientsService
- func (a *RecipientsAPI) ListAll(ctx context.Context, request ListRecipientsRequest) ([]RecipientInfo, error)
- func (a *RecipientsAPI) RecipientInfoNameToMetastoreIdMap(ctx context.Context, request ListRecipientsRequest) (map[string]string, error)
- func (a *RecipientsAPI) RotateToken(ctx context.Context, request RotateRecipientToken) (*RecipientInfo, error)
- func (a *RecipientsAPI) SharePermissions(ctx context.Context, request SharePermissionsRequest) (*GetRecipientSharePermissionsResponse, error)
- func (a *RecipientsAPI) SharePermissionsByName(ctx context.Context, name string) (*GetRecipientSharePermissionsResponse, error)
- func (a *RecipientsAPI) Update(ctx context.Context, request UpdateRecipient) error
- func (a *RecipientsAPI) WithImpl(impl RecipientsService) *RecipientsAPI
- type RecipientsService
- type RetrieveTokenRequest
- type RetrieveTokenResponse
- type RotateRecipientToken
- type SecurablePropertiesKvPairs
- type SecurablePropertiesMap
- type ShareInfo
- type SharePermissionsRequest
- type ShareToPrivilegeAssignment
- type SharedDataObject
- type SharedDataObjectStatus
- type SharedDataObjectUpdate
- type SharedDataObjectUpdateAction
- type SharesAPI
- func (a *SharesAPI) Create(ctx context.Context, request CreateShare) (*ShareInfo, error)
- func (a *SharesAPI) Delete(ctx context.Context, request DeleteShareRequest) error
- func (a *SharesAPI) DeleteByName(ctx context.Context, name string) error
- func (a *SharesAPI) Get(ctx context.Context, request GetShareRequest) (*ShareInfo, error)
- func (a *SharesAPI) GetByName(ctx context.Context, name string) (*ShareInfo, error)
- func (a *SharesAPI) Impl() SharesService
- func (a *SharesAPI) ListAll(ctx context.Context) ([]ShareInfo, error)
- func (a *SharesAPI) SharePermissions(ctx context.Context, request SharePermissionsRequest) (*catalog.PermissionsList, error)
- func (a *SharesAPI) SharePermissionsByName(ctx context.Context, name string) (*catalog.PermissionsList, error)
- func (a *SharesAPI) Update(ctx context.Context, request UpdateShare) (*ShareInfo, error)
- func (a *SharesAPI) UpdatePermissions(ctx context.Context, request UpdateSharePermissions) error
- func (a *SharesAPI) WithImpl(impl SharesService) *SharesAPI
- type SharesService
- type UpdateProvider
- type UpdateRecipient
- type UpdateShare
- type UpdateSharePermissions
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 (at *AuthenticationType) Set(v string) error
Set raw string value and validate it against allowed values
func (*AuthenticationType) String ¶
func (at *AuthenticationType) String() string
String representation for fmt.Print
func (*AuthenticationType) Type ¶
func (at *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 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 {
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 {
PermissionsOut []ShareToPrivilegeAssignment `json:"permissions_out,omitempty"`
}
type GetShareRequest ¶
type GetShareRequest struct {
IncludeSharedData bool `json:"-" url:"include_shared_data,omitempty"`
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 {
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 string `json:"-" url:"-"`
}
List shares by Provider
type ListSharesResponse ¶
type ListSharesResponse struct {
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 (pvo *PartitionValueOp) Set(v string) error
Set raw string value and validate it against allowed values
func (*PartitionValueOp) String ¶
func (pvo *PartitionValueOp) String() string
String representation for fmt.Print
func (*PartitionValueOp) Type ¶
func (pvo *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 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 PrivilegeUsage Privilege = `USAGE`
const PrivilegeUseCatalog Privilege = `USE_CATALOG`
const PrivilegeUseProvider Privilege = `USE_PROVIDER`
const PrivilegeUseRecipient Privilege = `USE_RECIPIENT`
const PrivilegeUseSchema Privilege = `USE_SCHEMA`
const PrivilegeWriteFiles Privilege = `WRITE_FILES`
const PrivilegeWritePrivateFiles Privilege = `WRITE_PRIVATE_FILES`
type PrivilegeAssignment ¶
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 {
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.
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 ¶
func (a *ProvidersAPI) Get(ctx context.Context, request GetProviderRequest) (*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) 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.
func (*ProvidersAPI) ListShares ¶
func (a *ProvidersAPI) ListShares(ctx context.Context, request ListSharesRequest) (*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) 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.
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)
//
// 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.
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 ¶
func (a *RecipientActivationAPI) Impl() RecipientActivationService
Impl returns low-level RecipientActivation API implementation
func (*RecipientActivationAPI) RetrieveToken ¶
func (a *RecipientActivationAPI) RetrieveToken(ctx context.Context, request RetrieveTokenRequest) (*RetrieveTokenResponse, error)
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 ¶
func (a *RecipientActivationAPI) WithImpl(impl RecipientActivationService) *RecipientActivationAPI
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"`
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)
}
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 ¶
func (a *RecipientsAPI) Get(ctx context.Context, request GetRecipientRequest) (*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
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)
}
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)
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.
func (*RecipientsAPI) SharePermissions ¶
func (a *RecipientsAPI) SharePermissions(ctx context.Context, request SharePermissionsRequest) (*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) 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)
}
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)
//
// 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"`
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
A map of key-value properties attached to the securable.
type ShareInfo ¶
type ShareInfo struct {
Comment string `json:"comment,omitempty"`
CreatedAt int64 `json:"created_at,omitempty"`
CreatedBy string `json:"created_by,omitempty"`
Name string `json:"name,omitempty"`
Objects []SharedDataObject `json:"objects,omitempty"`
Owner string `json:"owner,omitempty"`
UpdatedAt int64 `json:"updated_at,omitempty"`
UpdatedBy string `json:"updated_by,omitempty"`
}
type SharePermissionsRequest ¶
type SharePermissionsRequest struct {
Name string `json:"-" url:"-"`
}
Get recipient share permissions
type ShareToPrivilegeAssignment ¶
type ShareToPrivilegeAssignment struct {
PrivilegeAssignments []PrivilegeAssignment `json:"privilege_assignments,omitempty"`
ShareName string `json:"share_name,omitempty"`
}
type SharedDataObject ¶
type SharedDataObject struct {
// milliseconds.
AddedAt int64 `json:"added_at,omitempty"`
AddedBy string `json:"added_by,omitempty"`
CdfEnabled bool `json:"cdf_enabled,omitempty"`
// [Update:OPT]
Comment string `json:"comment,omitempty"`
DataObjectType string `json:"data_object_type,omitempty"`
//
// For example, a table's fully qualified name is in the format of
// `<catalog>.<schema>.<table>`.
Name string `json:"name"`
Partitions []Partition `json:"partitions,omitempty"`
// 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"`
// 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"`
Status SharedDataObjectStatus `json:"status,omitempty"`
}
type SharedDataObjectStatus ¶
type SharedDataObjectStatus string
One of: **ACTIVE**, **PERMISSION_DENIED**.
func (*SharedDataObjectStatus) Set ¶
func (sdos *SharedDataObjectStatus) Set(v string) error
Set raw string value and validate it against allowed values
func (*SharedDataObjectStatus) String ¶
func (sdos *SharedDataObjectStatus) String() string
String representation for fmt.Print
func (*SharedDataObjectStatus) Type ¶
func (sdos *SharedDataObjectStatus) Type() string
Type always returns SharedDataObjectStatus to satisfy [pflag.Value] interface
type SharedDataObjectUpdate ¶
type SharedDataObjectUpdate struct {
Action SharedDataObjectUpdateAction `json:"action,omitempty"`
DataObject *SharedDataObject `json:"data_object,omitempty"`
}
type SharedDataObjectUpdateAction ¶
type SharedDataObjectUpdateAction string
One of: **ADD**, **REMOVE**, **UPDATE**.
func (*SharedDataObjectUpdateAction) Set ¶
func (sdoua *SharedDataObjectUpdateAction) Set(v string) error
Set raw string value and validate it against allowed values
func (*SharedDataObjectUpdateAction) String ¶
func (sdoua *SharedDataObjectUpdateAction) String() string
String representation for fmt.Print
func (*SharedDataObjectUpdateAction) Type ¶
func (sdoua *SharedDataObjectUpdateAction) Type() string
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 ¶
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.
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 ¶
Delete a share.
Deletes a data object share from the metastore. The caller must be an owner of the share.
func (*SharesAPI) Get ¶
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) GetByName ¶
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 ¶
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.
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 ¶
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.
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 {
//
// 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)
//
// Deletes a data object share from the metastore. The caller must be an
// owner of the share.
Delete(ctx context.Context, request DeleteShareRequest) error
//
// 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)
//
// 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)
//
// 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)
//
// 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)
//
// 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 {
Comment string `json:"comment,omitempty"`
Name string `json:"name,omitempty" url:"-"`
Owner string `json:"owner,omitempty"`
Updates []SharedDataObjectUpdate `json:"updates,omitempty"`
}
type UpdateSharePermissions ¶
type UpdateSharePermissions struct {
Changes []catalog.PermissionsChange `json:"changes,omitempty"`
Name string `json:"-" url:"-"`
}