Documentation
¶
Overview ¶
These APIs allow you to manage Clean Rooms, Providers, Recipient Activation, Recipients, Shares, etc.
Index ¶
- type AuthenticationType
- type CentralCleanRoomInfo
- type CleanRoomAssetInfo
- type CleanRoomCatalog
- type CleanRoomCatalogUpdate
- type CleanRoomCollaboratorInfo
- type CleanRoomInfo
- type CleanRoomNotebookInfo
- type CleanRoomTableInfo
- type CleanRoomsAPI
- func (a *CleanRoomsAPI) Create(ctx context.Context, request CreateCleanRoom) (*CleanRoomInfo, error)
- func (a *CleanRoomsAPI) Delete(ctx context.Context, request DeleteCleanRoomRequest) error
- func (a *CleanRoomsAPI) DeleteByNameArg(ctx context.Context, nameArg string) error
- func (a *CleanRoomsAPI) Get(ctx context.Context, request GetCleanRoomRequest) (*CleanRoomInfo, error)
- func (a *CleanRoomsAPI) GetByNameArg(ctx context.Context, nameArg string) (*CleanRoomInfo, error)
- func (a *CleanRoomsAPI) Impl() CleanRoomsService
- func (a *CleanRoomsAPI) ListAll(ctx context.Context) ([]CleanRoomInfo, error)
- func (a *CleanRoomsAPI) Update(ctx context.Context, request UpdateCleanRoom) (*CleanRoomInfo, error)
- func (a *CleanRoomsAPI) WithImpl(impl CleanRoomsService) *CleanRoomsAPI
- type CleanRoomsService
- type ColumnInfo
- type ColumnMask
- type ColumnTypeName
- type CreateCleanRoom
- type CreateProvider
- type CreateRecipient
- type CreateShare
- type DeleteCleanRoomRequest
- type DeleteProviderRequest
- type DeleteRecipientRequest
- type DeleteShareRequest
- type GetActivationUrlInfoRequest
- type GetCleanRoomRequest
- type GetProviderRequest
- type GetRecipientRequest
- type GetRecipientSharePermissionsResponse
- type GetShareRequest
- type IpAccessList
- type ListCleanRoomsResponse
- 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) ListSharesAll(ctx context.Context, request ListSharesRequest) ([]ProviderShare, 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 SharedDataObjectHistoryDataSharingStatus
- 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 UpdateCleanRoom
- type UpdateProvider
- type UpdateRecipient
- type UpdateShare
- type UpdateSharePermissions
Examples ¶
- ProvidersAPI.Create (Providers)
- ProvidersAPI.Get (Providers)
- ProvidersAPI.ListAll (Providers)
- ProvidersAPI.Update (Providers)
- RecipientsAPI.Create (Recipients)
- RecipientsAPI.Get (Recipients)
- RecipientsAPI.ListAll (Recipients)
- RecipientsAPI.RotateToken (Recipients)
- RecipientsAPI.SharePermissions (Recipients)
- RecipientsAPI.Update (Recipients)
- SharesAPI.Create (Shares)
- SharesAPI.Get (Shares)
- SharesAPI.ListAll (Shares)
- SharesAPI.Update (Shares)
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 CentralCleanRoomInfo ¶ added in v0.13.0
type CentralCleanRoomInfo struct {
// All assets from all collaborators that are available in the clean room.
// Only one of table_info or notebook_info will be filled in.
CleanRoomAssets []CleanRoomAssetInfo `json:"clean_room_assets,omitempty"`
// All collaborators who are in the clean room.
Collaborators []CleanRoomCollaboratorInfo `json:"collaborators,omitempty"`
// The collaborator who created the clean room.
Creator *CleanRoomCollaboratorInfo `json:"creator,omitempty"`
// The cloud where clean room tasks will be run.
StationCloud string `json:"station_cloud,omitempty"`
// The region where clean room tasks will be run.
StationRegion string `json:"station_region,omitempty"`
}
type CleanRoomAssetInfo ¶ added in v0.13.0
type CleanRoomAssetInfo struct {
// Time at which this asset was added, in epoch milliseconds.
AddedAt int64 `json:"added_at,omitempty"`
// Details about the notebook asset.
NotebookInfo *CleanRoomNotebookInfo `json:"notebook_info,omitempty"`
// The collaborator who owns the asset.
Owner *CleanRoomCollaboratorInfo `json:"owner,omitempty"`
// Details about the table asset.
TableInfo *CleanRoomTableInfo `json:"table_info,omitempty"`
// Time at which this asset was updated, in epoch milliseconds.
UpdatedAt int64 `json:"updated_at,omitempty"`
}
type CleanRoomCatalog ¶ added in v0.13.0
type CleanRoomCatalog struct {
// Name of the catalog in the clean room station. Empty for notebooks.
CatalogName string `json:"catalog_name,omitempty"`
// The details of the shared notebook files.
NotebookFiles []SharedDataObject `json:"notebook_files,omitempty"`
// The details of the shared tables.
Tables []SharedDataObject `json:"tables,omitempty"`
}
type CleanRoomCatalogUpdate ¶ added in v0.13.0
type CleanRoomCatalogUpdate struct {
// The name of the catalog to update assets.
CatalogName string `json:"catalog_name,omitempty"`
// The updates to the assets in the catalog.
Updates *SharedDataObjectUpdate `json:"updates,omitempty"`
}
type CleanRoomCollaboratorInfo ¶ added in v0.13.0
type CleanRoomCollaboratorInfo struct {
// The global Unity Catalog metastore id of the collaborator. Also known as
// the sharing identifier. The identifier is of format
// __cloud__:__region__:__metastore-uuid__.
GlobalMetastoreId string `json:"global_metastore_id,omitempty"`
// The organization name of the collaborator. This is configured in the
// metastore for Delta Sharing and is used to identify the organization to
// other collaborators.
OrganizationName string `json:"organization_name,omitempty"`
}
type CleanRoomInfo ¶ added in v0.13.0
type CleanRoomInfo struct {
// User-provided free-form text description.
Comment string `json:"comment,omitempty"`
// Time at which this clean room was created, in epoch milliseconds.
CreatedAt int64 `json:"created_at,omitempty"`
// Username of clean room creator.
CreatedBy string `json:"created_by,omitempty"`
// Catalog aliases shared by the current collaborator with asset details.
LocalCatalogs []CleanRoomCatalog `json:"local_catalogs,omitempty"`
// Name of the clean room.
Name string `json:"name,omitempty"`
// Username of current owner of clean room.
Owner string `json:"owner,omitempty"`
// Central clean room details.
RemoteDetailedInfo *CentralCleanRoomInfo `json:"remote_detailed_info,omitempty"`
// Time at which this clean room was updated, in epoch milliseconds.
UpdatedAt int64 `json:"updated_at,omitempty"`
// Username of clean room updater.
UpdatedBy string `json:"updated_by,omitempty"`
}
type CleanRoomNotebookInfo ¶ added in v0.13.0
type CleanRoomTableInfo ¶ added in v0.13.0
type CleanRoomTableInfo struct {
// Name of parent catalog.
CatalogName string `json:"catalog_name,omitempty"`
// The array of __ColumnInfo__ definitions of the table's columns.
Columns []ColumnInfo `json:"columns,omitempty"`
// Full name of table, in form of
// __catalog_name__.__schema_name__.__table_name__
FullName string `json:"full_name,omitempty"`
// Name of table, relative to parent schema.
Name string `json:"name,omitempty"`
// Name of parent schema relative to its parent catalog.
SchemaName string `json:"schema_name,omitempty"`
}
type CleanRoomsAPI ¶ added in v0.13.0
type CleanRoomsAPI struct {
// contains filtered or unexported fields
}
A clean room is a secure, privacy-protecting environment where two or more parties can share sensitive enterprise data, including customer data, for measurements, insights, activation and other use cases.
To create clean rooms, you must be a metastore admin or a user with the **CREATE_CLEAN_ROOM** privilege.
func NewCleanRooms ¶ added in v0.13.0
func NewCleanRooms(client *client.DatabricksClient) *CleanRoomsAPI
func (*CleanRoomsAPI) Create ¶ added in v0.13.0
func (a *CleanRoomsAPI) Create(ctx context.Context, request CreateCleanRoom) (*CleanRoomInfo, error)
Create a clean room.
Creates a new clean room with specified colaborators. The caller must be a metastore admin or have the **CREATE_CLEAN_ROOM** privilege on the metastore.
func (*CleanRoomsAPI) Delete ¶ added in v0.13.0
func (a *CleanRoomsAPI) Delete(ctx context.Context, request DeleteCleanRoomRequest) error
Delete a clean room.
Deletes a data object clean room from the metastore. The caller must be an owner of the clean room.
func (*CleanRoomsAPI) DeleteByNameArg ¶ added in v0.13.0
func (a *CleanRoomsAPI) DeleteByNameArg(ctx context.Context, nameArg string) error
Delete a clean room.
Deletes a data object clean room from the metastore. The caller must be an owner of the clean room.
func (*CleanRoomsAPI) Get ¶ added in v0.13.0
func (a *CleanRoomsAPI) Get(ctx context.Context, request GetCleanRoomRequest) (*CleanRoomInfo, error)
Get a clean room.
Gets a data object clean room from the metastore. The caller must be a metastore admin or the owner of the clean room.
func (*CleanRoomsAPI) GetByNameArg ¶ added in v0.13.0
func (a *CleanRoomsAPI) GetByNameArg(ctx context.Context, nameArg string) (*CleanRoomInfo, error)
Get a clean room.
Gets a data object clean room from the metastore. The caller must be a metastore admin or the owner of the clean room.
func (*CleanRoomsAPI) Impl ¶ added in v0.13.0
func (a *CleanRoomsAPI) Impl() CleanRoomsService
Impl returns low-level CleanRooms API implementation
func (*CleanRoomsAPI) ListAll ¶ added in v0.13.0
func (a *CleanRoomsAPI) ListAll(ctx context.Context) ([]CleanRoomInfo, error)
List clean rooms.
Gets an array of data object clean rooms from the metastore. The caller must be a metastore admin or the owner of the clean room. There is no guarantee of a specific ordering of the elements in the array.
This method is generated by Databricks SDK Code Generator.
func (*CleanRoomsAPI) Update ¶ added in v0.13.0
func (a *CleanRoomsAPI) Update(ctx context.Context, request UpdateCleanRoom) (*CleanRoomInfo, error)
Update a clean room.
Updates the clean room with the changes and data objects in the request. The caller must be the owner of the clean room or a metastore admin.
When the caller is a metastore admin, only the __owner__ field can be updated.
In the case that the clean room name is changed **updateCleanRoom** requires that the caller is both the clean room owner and a metastore admin.
For each table that is added through this method, the clean room owner must also have **SELECT** privilege on the table. The privilege must be maintained indefinitely for recipients to be able to access the table. Typically, you should use a group as the clean room owner.
Table removals through **update** do not require additional privileges.
func (*CleanRoomsAPI) WithImpl ¶ added in v0.13.0
func (a *CleanRoomsAPI) WithImpl(impl CleanRoomsService) *CleanRoomsAPI
WithImpl could be used to override low-level API implementations for unit testing purposes with github.com/golang/mock or other mocking frameworks.
type CleanRoomsService ¶ added in v0.13.0
type CleanRoomsService interface {
// Create a clean room.
//
// Creates a new clean room with specified colaborators. The caller must be
// a metastore admin or have the **CREATE_CLEAN_ROOM** privilege on the
// metastore.
Create(ctx context.Context, request CreateCleanRoom) (*CleanRoomInfo, error)
// Delete a clean room.
//
// Deletes a data object clean room from the metastore. The caller must be
// an owner of the clean room.
Delete(ctx context.Context, request DeleteCleanRoomRequest) error
// Get a clean room.
//
// Gets a data object clean room from the metastore. The caller must be a
// metastore admin or the owner of the clean room.
Get(ctx context.Context, request GetCleanRoomRequest) (*CleanRoomInfo, error)
// List clean rooms.
//
// Gets an array of data object clean rooms from the metastore. The caller
// must be a metastore admin or the owner of the clean room. There is no
// guarantee of a specific ordering of the elements in the array.
//
// Use ListAll() to get all CleanRoomInfo instances
List(ctx context.Context) (*ListCleanRoomsResponse, error)
// Update a clean room.
//
// Updates the clean room with the changes and data objects in the request.
// The caller must be the owner of the clean room or a metastore admin.
//
// When the caller is a metastore admin, only the __owner__ field can be
// updated.
//
// In the case that the clean room name is changed **updateCleanRoom**
// requires that the caller is both the clean room owner and a metastore
// admin.
//
// For each table that is added through this method, the clean room owner
// must also have **SELECT** privilege on the table. The privilege must be
// maintained indefinitely for recipients to be able to access the table.
// Typically, you should use a group as the clean room owner.
//
// Table removals through **update** do not require additional privileges.
Update(ctx context.Context, request UpdateCleanRoom) (*CleanRoomInfo, error)
}
A clean room is a secure, privacy-protecting environment where two or more parties can share sensitive enterprise data, including customer data, for measurements, insights, activation and other use cases.
To create clean rooms, you must be a metastore admin or a user with the **CREATE_CLEAN_ROOM** privilege.
type ColumnInfo ¶ added in v0.13.0
type ColumnInfo struct {
// User-provided free-form text description.
Comment string `json:"comment,omitempty"`
Mask *ColumnMask `json:"mask,omitempty"`
// Name of Column.
Name string `json:"name,omitempty"`
// Whether field may be Null (default: true).
Nullable bool `json:"nullable,omitempty"`
// Partition index for column.
PartitionIndex int `json:"partition_index,omitempty"`
// Ordinal position of column (starting at position 0).
Position int `json:"position,omitempty"`
// Format of IntervalType.
TypeIntervalType string `json:"type_interval_type,omitempty"`
// Full data type specification, JSON-serialized.
TypeJson string `json:"type_json,omitempty"`
// Name of type (INT, STRUCT, MAP, etc.).
TypeName ColumnTypeName `json:"type_name,omitempty"`
// Digits of precision; required for DecimalTypes.
TypePrecision int `json:"type_precision,omitempty"`
// Digits to right of decimal; Required for DecimalTypes.
TypeScale int `json:"type_scale,omitempty"`
// Full data type specification as SQL/catalogString text.
TypeText string `json:"type_text,omitempty"`
}
type ColumnMask ¶ added in v0.13.0
type ColumnMask struct {
// The full name of the column mask SQL UDF.
FunctionName string `json:"function_name,omitempty"`
// The list of additional table columns to be passed as input to the column
// mask function. The first arg of the mask function should be of the type
// of the column being masked and the types of the rest of the args should
// match the types of columns in 'using_column_names'.
UsingColumnNames []string `json:"using_column_names,omitempty"`
}
type ColumnTypeName ¶ added in v0.13.0
type ColumnTypeName string
Name of type (INT, STRUCT, MAP, etc.).
const ColumnTypeNameArray ColumnTypeName = `ARRAY`
const ColumnTypeNameBinary ColumnTypeName = `BINARY`
const ColumnTypeNameBoolean ColumnTypeName = `BOOLEAN`
const ColumnTypeNameByte ColumnTypeName = `BYTE`
const ColumnTypeNameChar ColumnTypeName = `CHAR`
const ColumnTypeNameDate ColumnTypeName = `DATE`
const ColumnTypeNameDecimal ColumnTypeName = `DECIMAL`
const ColumnTypeNameDouble ColumnTypeName = `DOUBLE`
const ColumnTypeNameFloat ColumnTypeName = `FLOAT`
const ColumnTypeNameInt ColumnTypeName = `INT`
const ColumnTypeNameInterval ColumnTypeName = `INTERVAL`
const ColumnTypeNameLong ColumnTypeName = `LONG`
const ColumnTypeNameMap ColumnTypeName = `MAP`
const ColumnTypeNameNull ColumnTypeName = `NULL`
const ColumnTypeNameShort ColumnTypeName = `SHORT`
const ColumnTypeNameString ColumnTypeName = `STRING`
const ColumnTypeNameStruct ColumnTypeName = `STRUCT`
const ColumnTypeNameTableType ColumnTypeName = `TABLE_TYPE`
const ColumnTypeNameTimestamp ColumnTypeName = `TIMESTAMP`
const ColumnTypeNameTimestampNtz ColumnTypeName = `TIMESTAMP_NTZ`
const ColumnTypeNameUserDefinedType ColumnTypeName = `USER_DEFINED_TYPE`
func (*ColumnTypeName) Set ¶ added in v0.13.0
func (f *ColumnTypeName) Set(v string) error
Set raw string value and validate it against allowed values
func (*ColumnTypeName) String ¶ added in v0.13.0
func (f *ColumnTypeName) String() string
String representation for fmt.Print
func (*ColumnTypeName) Type ¶ added in v0.13.0
func (f *ColumnTypeName) Type() string
Type always returns ColumnTypeName to satisfy [pflag.Value] interface
type CreateCleanRoom ¶ added in v0.13.0
type CreateCleanRoom struct {
// User-provided free-form text description.
Comment string `json:"comment,omitempty"`
// Name of the clean room.
Name string `json:"name"`
// Central clean room details.
RemoteDetailedInfo CentralCleanRoomInfo `json:"remote_detailed_info"`
}
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 DeleteCleanRoomRequest ¶ added in v0.13.0
type DeleteCleanRoomRequest struct {
// The name of the clean room.
NameArg string `json:"-" url:"-"`
}
Delete a clean room
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 GetCleanRoomRequest ¶ added in v0.13.0
type GetCleanRoomRequest struct {
// Whether to include remote details (central) on the clean room.
IncludeRemoteDetails bool `json:"-" url:"include_remote_details,omitempty"`
// The name of the clean room.
NameArg string `json:"-" url:"-"`
}
Get a clean room
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 ListCleanRoomsResponse ¶ added in v0.13.0
type ListCleanRoomsResponse struct {
// An array of clean rooms. Remote details (central) are not included.
CleanRooms []CleanRoomInfo `json:"clean_rooms,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 (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 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 PrivilegeUseMarketplaceAssets Privilege = `USE_MARKETPLACE_ASSETS`
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.
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)
}
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.
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)
}
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)
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)
}
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.
//
// 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 ¶
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.
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)
}
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"`
// the default is **DISABLED**.
HistoryDataSharingStatus SharedDataObjectHistoryDataSharingStatus `json:"history_data_sharing_status,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 SharedDataObjectHistoryDataSharingStatus ¶ added in v0.12.0
type SharedDataObjectHistoryDataSharingStatus string
Whether to enable or disable sharing of data history. If not specified, the default is **DISABLED**.
func (*SharedDataObjectHistoryDataSharingStatus) Set ¶ added in v0.12.0
func (f *SharedDataObjectHistoryDataSharingStatus) Set(v string) error
Set raw string value and validate it against allowed values
func (*SharedDataObjectHistoryDataSharingStatus) String ¶ added in v0.12.0
func (f *SharedDataObjectHistoryDataSharingStatus) String() string
String representation for fmt.Print
func (*SharedDataObjectHistoryDataSharingStatus) Type ¶ added in v0.12.0
func (f *SharedDataObjectHistoryDataSharingStatus) Type() string
Type always returns SharedDataObjectHistoryDataSharingStatus to satisfy [pflag.Value] interface
type SharedDataObjectStatus ¶
type SharedDataObjectStatus string
One of: **ACTIVE**, **PERMISSION_DENIED**.
func (*SharedDataObjectStatus) Set ¶
func (f *SharedDataObjectStatus) Set(v string) error
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 {
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 (f *SharedDataObjectUpdateAction) Set(v string) error
Set raw string value and validate it against allowed values
func (*SharedDataObjectUpdateAction) String ¶
func (f *SharedDataObjectUpdateAction) String() string
String representation for fmt.Print
func (*SharedDataObjectUpdateAction) Type ¶
func (f *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 UpdateCleanRoom ¶ added in v0.13.0
type UpdateCleanRoom struct {
// Array of shared data object updates.
CatalogUpdates []CleanRoomCatalogUpdate `json:"catalog_updates,omitempty"`
// User-provided free-form text description.
Comment string `json:"comment,omitempty"`
// Name of the clean room.
Name string `json:"name,omitempty"`
// The name of the clean room.
NameArg string `json:"-" url:"-"`
// Username of current owner of clean room.
Owner string `json:"owner,omitempty"`
}
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:"-"`
}