Documentation
¶
Index ¶
- type AccessControl
- type Alert
- type AlertOptions
- type AlertState
- type AlertsAPI
- func (a *AlertsAPI) AlertNameToIdMap(ctx context.Context) (map[string]string, error)
- func (a *AlertsAPI) CreateAlert(ctx context.Context, request EditAlert) (*Alert, error)
- func (a *AlertsAPI) CreateSchedule(ctx context.Context, request CreateRefreshSchedule) (*RefreshSchedule, error)
- func (a *AlertsAPI) DeleteAlert(ctx context.Context, request DeleteAlertRequest) error
- func (a *AlertsAPI) DeleteAlertByAlertId(ctx context.Context, alertId string) error
- func (a *AlertsAPI) DeleteSchedule(ctx context.Context, request DeleteScheduleRequest) error
- func (a *AlertsAPI) DeleteScheduleByAlertIdAndScheduleId(ctx context.Context, alertId string, scheduleId string) error
- func (a *AlertsAPI) GetAlert(ctx context.Context, request GetAlertRequest) (*Alert, error)
- func (a *AlertsAPI) GetAlertByAlertId(ctx context.Context, alertId string) (*Alert, error)
- func (a *AlertsAPI) GetByName(ctx context.Context, name string) (*Alert, error)
- func (a *AlertsAPI) GetSubscriptions(ctx context.Context, request GetSubscriptionsRequest) ([]Subscription, error)
- func (a *AlertsAPI) GetSubscriptionsByAlertId(ctx context.Context, alertId string) ([]Subscription, error)
- func (a *AlertsAPI) Impl() AlertsService
- func (a *AlertsAPI) ListAlerts(ctx context.Context) ([]Alert, error)
- func (a *AlertsAPI) ListSchedules(ctx context.Context, request ListSchedulesRequest) ([]RefreshSchedule, error)
- func (a *AlertsAPI) ListSchedulesByAlertId(ctx context.Context, alertId string) ([]RefreshSchedule, error)
- func (a *AlertsAPI) Subscribe(ctx context.Context, request CreateSubscription) (*Subscription, error)
- func (a *AlertsAPI) Unsubscribe(ctx context.Context, request UnsubscribeRequest) error
- func (a *AlertsAPI) UnsubscribeByAlertIdAndSubscriptionId(ctx context.Context, alertId string, subscriptionId string) error
- func (a *AlertsAPI) UpdateAlert(ctx context.Context, request EditAlert) error
- func (a *AlertsAPI) WithImpl(impl AlertsService) *AlertsAPI
- type AlertsService
- type CreateDashboardRequest
- type CreateRefreshSchedule
- type CreateSubscription
- type Dashboard
- type DashboardOptions
- type DashboardsAPI
- func (a *DashboardsAPI) CreateDashboard(ctx context.Context, request CreateDashboardRequest) (*Dashboard, error)
- func (a *DashboardsAPI) DashboardNameToIdMap(ctx context.Context, request ListDashboardsRequest) (map[string]string, error)
- func (a *DashboardsAPI) DeleteDashboard(ctx context.Context, request DeleteDashboardRequest) error
- func (a *DashboardsAPI) DeleteDashboardByDashboardId(ctx context.Context, dashboardId string) error
- func (a *DashboardsAPI) GetByName(ctx context.Context, name string) (*Dashboard, error)
- func (a *DashboardsAPI) GetDashboard(ctx context.Context, request GetDashboardRequest) (*Dashboard, error)
- func (a *DashboardsAPI) GetDashboardByDashboardId(ctx context.Context, dashboardId string) (*Dashboard, error)
- func (a *DashboardsAPI) Impl() DashboardsService
- func (a *DashboardsAPI) ListDashboardsAll(ctx context.Context, request ListDashboardsRequest) ([]Dashboard, error)
- func (a *DashboardsAPI) RestoreDashboard(ctx context.Context, request RestoreDashboardRequest) error
- func (a *DashboardsAPI) WithImpl(impl DashboardsService) *DashboardsAPI
- type DashboardsService
- type DataSource
- type DataSourcesAPI
- func (a *DataSourcesAPI) DataSourceNameToIdMap(ctx context.Context) (map[string]string, error)
- func (a *DataSourcesAPI) GetByName(ctx context.Context, name string) (*DataSource, error)
- func (a *DataSourcesAPI) Impl() DataSourcesService
- func (a *DataSourcesAPI) ListDataSources(ctx context.Context) ([]DataSource, error)
- func (a *DataSourcesAPI) WithImpl(impl DataSourcesService) *DataSourcesAPI
- type DataSourcesService
- type DbsqlPermissionsAPI
- func (a *DbsqlPermissionsAPI) GetPermissions(ctx context.Context, request GetPermissionsRequest) (*GetPermissionsResponse, error)
- func (a *DbsqlPermissionsAPI) GetPermissionsByObjectTypeAndObjectId(ctx context.Context, objectType ObjectTypePlural, objectId string) (*GetPermissionsResponse, error)
- func (a *DbsqlPermissionsAPI) Impl() DbsqlPermissionsService
- func (a *DbsqlPermissionsAPI) SetPermissions(ctx context.Context, request SetPermissionsRequest) (*SetPermissionsResponse, error)
- func (a *DbsqlPermissionsAPI) TransferOwnership(ctx context.Context, request TransferOwnershipRequest) (*Success, error)
- func (a *DbsqlPermissionsAPI) WithImpl(impl DbsqlPermissionsService) *DbsqlPermissionsAPI
- type DbsqlPermissionsService
- type DeleteAlertRequest
- type DeleteDashboardRequest
- type DeleteQueryRequest
- type DeleteScheduleRequest
- type Destination
- type DestinationType
- type EditAlert
- type GetAlertRequest
- type GetDashboardRequest
- type GetPermissionsRequest
- type GetPermissionsResponse
- type GetQueryRequest
- type GetSubscriptionsRequest
- type ListDashboardsOrder
- type ListDashboardsRequest
- type ListDashboardsResponse
- type ListQueriesRequest
- type ListQueriesResponse
- type ListSchedulesRequest
- type ObjectType
- type ObjectTypePlural
- type OwnableObjectType
- type Parameter
- type ParameterType
- type PermissionLevel
- type QueriesAPI
- func (a *QueriesAPI) CreateQuery(ctx context.Context, request QueryPostContent) (*Query, error)
- func (a *QueriesAPI) DeleteQuery(ctx context.Context, request DeleteQueryRequest) error
- func (a *QueriesAPI) DeleteQueryByQueryId(ctx context.Context, queryId string) error
- func (a *QueriesAPI) GetByName(ctx context.Context, name string) (*Query, error)
- func (a *QueriesAPI) GetQuery(ctx context.Context, request GetQueryRequest) (*Query, error)
- func (a *QueriesAPI) GetQueryByQueryId(ctx context.Context, queryId string) (*Query, error)
- func (a *QueriesAPI) Impl() QueriesService
- func (a *QueriesAPI) ListQueriesAll(ctx context.Context, request ListQueriesRequest) ([]Query, error)
- func (a *QueriesAPI) QueryNameToIdMap(ctx context.Context, request ListQueriesRequest) (map[string]string, error)
- func (a *QueriesAPI) RestoreQuery(ctx context.Context, request RestoreQueryRequest) error
- func (a *QueriesAPI) UpdateQuery(ctx context.Context, request QueryPostContent) (*Query, error)
- func (a *QueriesAPI) WithImpl(impl QueriesService) *QueriesAPI
- type QueriesService
- type Query
- type QueryInterval
- type QueryOptions
- type QueryPostContent
- type RefreshSchedule
- type RestoreDashboardRequest
- type RestoreQueryRequest
- type SetPermissionsRequest
- type SetPermissionsResponse
- type Subscription
- type Success
- type SuccessMessage
- type TransferOwnershipObjectId
- type TransferOwnershipRequest
- type UnsubscribeRequest
- type User
- type Visualization
- type Widget
- type WidgetOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessControl ¶
type AccessControl struct {
GroupName string `json:"group_name,omitempty"`
// This describes an enum
PermissionLevel PermissionLevel `json:"permission_level,omitempty"`
UserName string `json:"user_name,omitempty"`
}
type Alert ¶
type Alert struct {
// Timestamp when the alert was created.
CreatedAt string `json:"created_at,omitempty"`
// ID of the alert.
Id string `json:"id,omitempty"`
// Timestamp when the alert was last triggered.
LastTriggeredAt string `json:"last_triggered_at,omitempty"`
// Name of the alert.
Name string `json:"name,omitempty"`
// Alert configuration options.
Options *AlertOptions `json:"options,omitempty"`
Query *Query `json:"query,omitempty"`
// Number of seconds after being triggered before the alert rearms itself
// and can be triggered again. If `null`, alert will never be triggered
// again.
Rearm int `json:"rearm,omitempty"`
// State of the alert. Possible values are: `unknown` (yet to be evaluated),
// `triggered` (evaluated and fulfilled trigger conditions), or `ok`
// (evaluated and did not fulfill trigger conditions).
State AlertState `json:"state,omitempty"`
// Timestamp when the alert was last updated.
UpdatedAt string `json:"updated_at,omitempty"`
User *User `json:"user,omitempty"`
}
type AlertOptions ¶
type AlertOptions struct {
// Name of column in the query result to compare in alert evaluation.
Column string `json:"column"`
// Custom body of alert notification, if it exists. See
// [here](https://docs.databricks.com/sql/user/alerts/index.html) for custom
// templating instructions.
CustomBody string `json:"custom_body,omitempty"`
// Custom subject of alert notification, if it exists. This includes email
// subject, Slack notification header, etc. See
// [here](https://docs.databricks.com/sql/user/alerts/index.html) for custom
// templating instructions.
CustomSubject string `json:"custom_subject,omitempty"`
// Whether or not the alert is muted. If an alert is muted, it will not
// notify users and alert destinations when triggered.
Muted bool `json:"muted,omitempty"`
// Operator used to compare in alert evaluation: `>`, `>=`, `<`, `<=`, `==`,
// `!=`
Op string `json:"op"`
// Number of failures encountered during alert refresh. This counter is used
// for sending aggregated alert failure email notifications.
ScheduleFailures int `json:"schedule_failures,omitempty"`
// Value used to compare in alert evaluation.
Value string `json:"value"`
}
Alert configuration options.
type AlertState ¶
type AlertState string
State of the alert. Possible values are: `unknown` (yet to be evaluated), `triggered` (evaluated and fulfilled trigger conditions), or `ok` (evaluated and did not fulfill trigger conditions).
const AlertStateOk AlertState = `ok`
const AlertStateTriggered AlertState = `triggered`
const AlertStateUnknown AlertState = `unknown`
type AlertsAPI ¶
type AlertsAPI struct {
// contains filtered or unexported fields
}
The alerts API can be used to perform CRUD operations on alerts. An alert is a Databricks SQL object that periodically runs a query, evaluates a condition of its result, and notifies one or more users and/or alert destinations if the condition was met.
func NewAlerts ¶
func NewAlerts(client *client.DatabricksClient) *AlertsAPI
func (*AlertsAPI) AlertNameToIdMap ¶
AlertNameToIdMap calls AlertsAPI.ListAlerts and creates a map of results with Alert.Name as key and Alert.Id as value.
Returns an error if there's more than one Alert with the same .Name.
Note: All Alert instances are loaded into memory before creating a map.
This method is generated by Databricks SDK Code Generator.
func (*AlertsAPI) CreateAlert ¶
Create an alert
Creates an alert. An alert is a Databricks SQL object that periodically runs a query, evaluates a condition of its result, and notifies users or alert destinations if the condition was met.
func (*AlertsAPI) CreateSchedule ¶
func (a *AlertsAPI) CreateSchedule(ctx context.Context, request CreateRefreshSchedule) (*RefreshSchedule, error)
Create a refresh schedule
Creates a new refresh schedule for an alert.
**Note:** The structure of refresh schedules is subject to change.
func (*AlertsAPI) DeleteAlert ¶
func (a *AlertsAPI) DeleteAlert(ctx context.Context, request DeleteAlertRequest) error
Delete an alert
Deletes an alert. Deleted alerts are no longer accessible and cannot be restored. **Note:** Unlike queries and dashboards, alerts cannot be moved to the trash.
func (*AlertsAPI) DeleteAlertByAlertId ¶
Delete an alert
Deletes an alert. Deleted alerts are no longer accessible and cannot be restored. **Note:** Unlike queries and dashboards, alerts cannot be moved to the trash.
func (*AlertsAPI) DeleteSchedule ¶
func (a *AlertsAPI) DeleteSchedule(ctx context.Context, request DeleteScheduleRequest) error
Delete a refresh schedule
Deletes an alert's refresh schedule. The refresh schedule specifies when to refresh and evaluate the associated query result.
func (*AlertsAPI) DeleteScheduleByAlertIdAndScheduleId ¶
func (a *AlertsAPI) DeleteScheduleByAlertIdAndScheduleId(ctx context.Context, alertId string, scheduleId string) error
Delete a refresh schedule
Deletes an alert's refresh schedule. The refresh schedule specifies when to refresh and evaluate the associated query result.
func (*AlertsAPI) GetByName ¶
GetByName calls AlertsAPI.AlertNameToIdMap and returns a single Alert.
Returns an error if there's more than one Alert with the same .Name.
Note: All Alert instances are loaded into memory before returning matching by name.
This method is generated by Databricks SDK Code Generator.
func (*AlertsAPI) GetSubscriptions ¶
func (a *AlertsAPI) GetSubscriptions(ctx context.Context, request GetSubscriptionsRequest) ([]Subscription, error)
Get an alert's subscriptions
Get the subscriptions for an alert. An alert subscription represents exactly one recipient being notified whenever the alert is triggered. The alert recipient is specified by either the `user` field or the `destination` field. The `user` field is ignored if `destination` is non-`null`.
func (*AlertsAPI) GetSubscriptionsByAlertId ¶
func (a *AlertsAPI) GetSubscriptionsByAlertId(ctx context.Context, alertId string) ([]Subscription, error)
Get an alert's subscriptions
Get the subscriptions for an alert. An alert subscription represents exactly one recipient being notified whenever the alert is triggered. The alert recipient is specified by either the `user` field or the `destination` field. The `user` field is ignored if `destination` is non-`null`.
func (*AlertsAPI) Impl ¶
func (a *AlertsAPI) Impl() AlertsService
Impl returns low-level Alerts API implementation
func (*AlertsAPI) ListSchedules ¶
func (a *AlertsAPI) ListSchedules(ctx context.Context, request ListSchedulesRequest) ([]RefreshSchedule, error)
Get refresh schedules
Gets the refresh schedules for the specified alert. Alerts can have refresh schedules that specify when to refresh and evaluate the associated query result.
**Note:** Although refresh schedules are returned in a list, only one refresh schedule per alert is currently supported. The structure of refresh schedules is subject to change.
func (*AlertsAPI) ListSchedulesByAlertId ¶
func (a *AlertsAPI) ListSchedulesByAlertId(ctx context.Context, alertId string) ([]RefreshSchedule, error)
Get refresh schedules
Gets the refresh schedules for the specified alert. Alerts can have refresh schedules that specify when to refresh and evaluate the associated query result.
**Note:** Although refresh schedules are returned in a list, only one refresh schedule per alert is currently supported. The structure of refresh schedules is subject to change.
func (*AlertsAPI) Subscribe ¶
func (a *AlertsAPI) Subscribe(ctx context.Context, request CreateSubscription) (*Subscription, error)
Subscribe to an alert
func (*AlertsAPI) Unsubscribe ¶
func (a *AlertsAPI) Unsubscribe(ctx context.Context, request UnsubscribeRequest) error
Unsubscribe to an alert
Unsubscribes a user or a destination to an alert.
func (*AlertsAPI) UnsubscribeByAlertIdAndSubscriptionId ¶
func (a *AlertsAPI) UnsubscribeByAlertIdAndSubscriptionId(ctx context.Context, alertId string, subscriptionId string) error
Unsubscribe to an alert
Unsubscribes a user or a destination to an alert.
func (*AlertsAPI) WithImpl ¶
func (a *AlertsAPI) WithImpl(impl AlertsService) *AlertsAPI
WithImpl could be used to override low-level API implementations for unit testing purposes with github.com/golang/mock or other mocking frameworks.
type AlertsService ¶
type AlertsService interface {
// Create an alert
//
// Creates an alert. An alert is a Databricks SQL object that periodically
// runs a query, evaluates a condition of its result, and notifies users or
// alert destinations if the condition was met.
CreateAlert(ctx context.Context, request EditAlert) (*Alert, error)
// Create a refresh schedule
//
// Creates a new refresh schedule for an alert.
//
// **Note:** The structure of refresh schedules is subject to change.
CreateSchedule(ctx context.Context, request CreateRefreshSchedule) (*RefreshSchedule, error)
// Delete an alert
//
// Deletes an alert. Deleted alerts are no longer accessible and cannot be
// restored. **Note:** Unlike queries and dashboards, alerts cannot be moved
// to the trash.
DeleteAlert(ctx context.Context, request DeleteAlertRequest) error
// Delete a refresh schedule
//
// Deletes an alert's refresh schedule. The refresh schedule specifies when
// to refresh and evaluate the associated query result.
DeleteSchedule(ctx context.Context, request DeleteScheduleRequest) error
// Get an alert
//
// Gets an alert.
GetAlert(ctx context.Context, request GetAlertRequest) (*Alert, error)
// Get an alert's subscriptions
//
// Get the subscriptions for an alert. An alert subscription represents
// exactly one recipient being notified whenever the alert is triggered. The
// alert recipient is specified by either the `user` field or the
// `destination` field. The `user` field is ignored if `destination` is
// non-`null`.
GetSubscriptions(ctx context.Context, request GetSubscriptionsRequest) ([]Subscription, error)
// Get alerts
//
// Gets a list of alerts.
ListAlerts(ctx context.Context) ([]Alert, error)
// Get refresh schedules
//
// Gets the refresh schedules for the specified alert. Alerts can have
// refresh schedules that specify when to refresh and evaluate the
// associated query result.
//
// **Note:** Although refresh schedules are returned in a list, only one
// refresh schedule per alert is currently supported. The structure of
// refresh schedules is subject to change.
ListSchedules(ctx context.Context, request ListSchedulesRequest) ([]RefreshSchedule, error)
// Subscribe to an alert
Subscribe(ctx context.Context, request CreateSubscription) (*Subscription, error)
// Unsubscribe to an alert
//
// Unsubscribes a user or a destination to an alert.
Unsubscribe(ctx context.Context, request UnsubscribeRequest) error
// Update an alert
//
// Updates an alert.
UpdateAlert(ctx context.Context, request EditAlert) error
}
The alerts API can be used to perform CRUD operations on alerts. An alert is a Databricks SQL object that periodically runs a query, evaluates a condition of its result, and notifies one or more users and/or alert destinations if the condition was met.
type CreateDashboardRequest ¶
type CreateDashboardRequest struct {
// In the web application, query filters that share a name are coupled to a
// single selection box if this value is true.
DashboardFiltersEnabled bool `json:"dashboard_filters_enabled,omitempty"`
// Draft dashboards only appear in list views for their owners.
IsDraft bool `json:"is_draft,omitempty"`
// Indicates whether the dashboard is trashed. Trashed dashboards don't
// appear in list views.
IsTrashed bool `json:"is_trashed,omitempty"`
// The title of this dashboard that appears in list views and at the top of
// the dashboard page.
Name string `json:"name,omitempty"`
Tags []string `json:"tags,omitempty"`
// An array of widget objects. A complete description of widget objects can
// be found in the response to [Retrieve A Dashboard
// Definition](#operation/sql-analytics-fetch-dashboard). Databricks does
// not recommend creating new widgets via this API.
Widgets []Widget `json:"widgets,omitempty"`
}
Create a dashboard object
type CreateRefreshSchedule ¶
type CreateRefreshSchedule struct {
AlertId string `json:"-" url:"-"`
// Cron string representing the refresh schedule.
Cron string `json:"cron"`
// ID of the SQL warehouse to refresh with. If `null`, query's SQL warehouse
// will be used to refresh.
DataSourceId string `json:"data_source_id,omitempty"`
}
type CreateSubscription ¶
type CreateSubscription struct {
// ID of the alert.
AlertId string `json:"alert_id" url:"-"`
// ID of the alert subscriber (if subscribing an alert destination). Alert
// destinations can be configured by admins through the UI. See
// [here](/sql/admin/alert-destinations.html).
DestinationId string `json:"destination_id,omitempty"`
// ID of the alert subscriber (if subscribing a user).
UserId int64 `json:"user_id,omitempty"`
}
type Dashboard ¶
type Dashboard struct {
// Whether the authenticated user can edit the query definition.
CanEdit bool `json:"can_edit,omitempty"`
// Timestamp when this dashboard was created.
CreatedAt string `json:"created_at,omitempty"`
// In the web application, query filters that share a name are coupled to a
// single selection box if this value is `true`.
DashboardFiltersEnabled bool `json:"dashboard_filters_enabled,omitempty"`
// The ID for this dashboard.
Id string `json:"id,omitempty"`
// Indicates whether a dashboard is trashed. Trashed dashboards won't appear
// in list views. If this boolean is `true`, the `options` property for this
// dashboard includes a `moved_to_trash_at` timestamp. Items in trash are
// permanently deleted after 30 days.
IsArchived bool `json:"is_archived,omitempty"`
// Whether a dashboard is a draft. Draft dashboards only appear in list
// views for their owners.
IsDraft bool `json:"is_draft,omitempty"`
// Indicates whether this query object appears in the current user's
// favorites list. This flag determines whether the star icon for favorites
// is selected.
IsFavorite bool `json:"is_favorite,omitempty"`
// The title of the dashboard that appears in list views and at the top of
// the dashboard page.
Name string `json:"name,omitempty"`
Options *DashboardOptions `json:"options,omitempty"`
// This describes an enum
PermissionTier PermissionLevel `json:"permission_tier,omitempty"`
// URL slug. Usually mirrors the query name with dashes (`-`) instead of
// spaces. Appears in the URL for this query.
Slug string `json:"slug,omitempty"`
Tags []string `json:"tags,omitempty"`
// Timestamp when this dashboard was last updated.
UpdatedAt string `json:"updated_at,omitempty"`
User *User `json:"user,omitempty"`
// The ID of the user that created and owns this dashboard.
UserId int `json:"user_id,omitempty"`
Widgets []Widget `json:"widgets,omitempty"`
}
A JSON representing a dashboard containing widgets of visualizations and text boxes.
type DashboardOptions ¶
type DashboardOptions struct {
// The timestamp when this dashboard was moved to trash. Only present when
// the `is_archived` property is `true`. Trashed items are deleted after
// thirty days.
MovedToTrashAt string `json:"moved_to_trash_at,omitempty"`
}
type DashboardsAPI ¶
type DashboardsAPI struct {
// contains filtered or unexported fields
}
In general, there is little need to modify dashboards using the API. However, it can be useful to use dashboard objects to look-up a collection of related query IDs. The API can also be used to duplicate multiple dashboards at once since you can get a dashboard definition with a GET request and then POST it to create a new one.
func NewDashboards ¶
func NewDashboards(client *client.DatabricksClient) *DashboardsAPI
func (*DashboardsAPI) CreateDashboard ¶
func (a *DashboardsAPI) CreateDashboard(ctx context.Context, request CreateDashboardRequest) (*Dashboard, error)
Create a dashboard object
func (*DashboardsAPI) DashboardNameToIdMap ¶
func (a *DashboardsAPI) DashboardNameToIdMap(ctx context.Context, request ListDashboardsRequest) (map[string]string, error)
DashboardNameToIdMap calls DashboardsAPI.ListDashboardsAll and creates a map of results with Dashboard.Name as key and Dashboard.Id as value.
Returns an error if there's more than one Dashboard with the same .Name.
Note: All Dashboard instances are loaded into memory before creating a map.
This method is generated by Databricks SDK Code Generator.
func (*DashboardsAPI) DeleteDashboard ¶
func (a *DashboardsAPI) DeleteDashboard(ctx context.Context, request DeleteDashboardRequest) error
Remove a dashboard
Moves a dashboard to the trash. Trashed dashboards do not appear in list views or searches, and cannot be shared.
func (*DashboardsAPI) DeleteDashboardByDashboardId ¶
func (a *DashboardsAPI) DeleteDashboardByDashboardId(ctx context.Context, dashboardId string) error
Remove a dashboard
Moves a dashboard to the trash. Trashed dashboards do not appear in list views or searches, and cannot be shared.
func (*DashboardsAPI) GetByName ¶
GetByName calls DashboardsAPI.DashboardNameToIdMap and returns a single Dashboard.
Returns an error if there's more than one Dashboard with the same .Name.
Note: All Dashboard instances are loaded into memory before returning matching by name.
This method is generated by Databricks SDK Code Generator.
func (*DashboardsAPI) GetDashboard ¶
func (a *DashboardsAPI) GetDashboard(ctx context.Context, request GetDashboardRequest) (*Dashboard, error)
Retrieve a definition
Returns a JSON representation of a dashboard object, including its visualization and query objects.
func (*DashboardsAPI) GetDashboardByDashboardId ¶
func (a *DashboardsAPI) GetDashboardByDashboardId(ctx context.Context, dashboardId string) (*Dashboard, error)
Retrieve a definition
Returns a JSON representation of a dashboard object, including its visualization and query objects.
func (*DashboardsAPI) Impl ¶
func (a *DashboardsAPI) Impl() DashboardsService
Impl returns low-level Dashboards API implementation
func (*DashboardsAPI) ListDashboardsAll ¶
func (a *DashboardsAPI) ListDashboardsAll(ctx context.Context, request ListDashboardsRequest) ([]Dashboard, error)
Get dashboard objects
Fetch a paginated list of dashboard objects.
This method is generated by Databricks SDK Code Generator.
func (*DashboardsAPI) RestoreDashboard ¶
func (a *DashboardsAPI) RestoreDashboard(ctx context.Context, request RestoreDashboardRequest) error
Restore a dashboard
A restored dashboard appears in list views and searches and can be shared.
func (*DashboardsAPI) WithImpl ¶
func (a *DashboardsAPI) WithImpl(impl DashboardsService) *DashboardsAPI
WithImpl could be used to override low-level API implementations for unit testing purposes with github.com/golang/mock or other mocking frameworks.
type DashboardsService ¶
type DashboardsService interface {
// Create a dashboard object
CreateDashboard(ctx context.Context, request CreateDashboardRequest) (*Dashboard, error)
// Remove a dashboard
//
// Moves a dashboard to the trash. Trashed dashboards do not appear in list
// views or searches, and cannot be shared.
DeleteDashboard(ctx context.Context, request DeleteDashboardRequest) error
// Retrieve a definition
//
// Returns a JSON representation of a dashboard object, including its
// visualization and query objects.
GetDashboard(ctx context.Context, request GetDashboardRequest) (*Dashboard, error)
// Get dashboard objects
//
// Fetch a paginated list of dashboard objects.
//
// Use ListDashboardsAll() to get all Dashboard instances, which will iterate over every result page.
ListDashboards(ctx context.Context, request ListDashboardsRequest) (*ListDashboardsResponse, error)
// Restore a dashboard
//
// A restored dashboard appears in list views and searches and can be
// shared.
RestoreDashboard(ctx context.Context, request RestoreDashboardRequest) error
}
In general, there is little need to modify dashboards using the API. However, it can be useful to use dashboard objects to look-up a collection of related query IDs. The API can also be used to duplicate multiple dashboards at once since you can get a dashboard definition with a GET request and then POST it to create a new one.
type DataSource ¶
type DataSource struct {
// The unique identifier for this data source / SQL warehouse. Can be used
// when creating / modifying queries and dashboards.
Id string `json:"id,omitempty"`
// The string name of this data source / SQL warehouse as it appears in the
// Databricks SQL web application.
Name string `json:"name,omitempty"`
// <needs content>
PauseReason string `json:"pause_reason,omitempty"`
// <needs content>
Paused any `json:"paused,omitempty"`
// <needs content>
SupportsAutoLimit bool `json:"supports_auto_limit,omitempty"`
// <needs content>
Syntax string `json:"syntax,omitempty"`
// <needs content>
Type string `json:"type,omitempty"`
// <needs content>
ViewOnly bool `json:"view_only,omitempty"`
// <needs content>
WarehouseId string `json:"warehouse_id,omitempty"`
}
A JSON object representing a DBSQL data source / SQL warehouse.
type DataSourcesAPI ¶
type DataSourcesAPI struct {
// contains filtered or unexported fields
}
This API is provided to assist you in making new query objects. When creating a query object, you may optionally specify a `data_source_id` for the SQL warehouse against which it will run. If you don't already know the `data_source_id` for your desired SQL warehouse, this API will help you find it.
This API does not support searches. It returns the full list of SQL warehouses in your workspace. We advise you to use any text editor, REST client, or `grep` to search the response from this API for the name of your SQL warehouse as it appears in Databricks SQL.
func NewDataSources ¶
func NewDataSources(client *client.DatabricksClient) *DataSourcesAPI
func (*DataSourcesAPI) DataSourceNameToIdMap ¶
DataSourceNameToIdMap calls DataSourcesAPI.ListDataSources and creates a map of results with DataSource.Name as key and DataSource.Id as value.
Returns an error if there's more than one DataSource with the same .Name.
Note: All DataSource instances are loaded into memory before creating a map.
This method is generated by Databricks SDK Code Generator.
func (*DataSourcesAPI) GetByName ¶
func (a *DataSourcesAPI) GetByName(ctx context.Context, name string) (*DataSource, error)
GetByName calls DataSourcesAPI.DataSourceNameToIdMap and returns a single DataSource.
Returns an error if there's more than one DataSource with the same .Name.
Note: All DataSource instances are loaded into memory before returning matching by name.
This method is generated by Databricks SDK Code Generator.
func (*DataSourcesAPI) Impl ¶
func (a *DataSourcesAPI) Impl() DataSourcesService
Impl returns low-level DataSources API implementation
func (*DataSourcesAPI) ListDataSources ¶
func (a *DataSourcesAPI) ListDataSources(ctx context.Context) ([]DataSource, error)
Get a list of SQL warehouses
Retrieves a full list of SQL warehouses available in this workspace. All fields that appear in this API response are enumerated for clarity. However, you need only a SQL warehouse's `id` to create new queries against it.
func (*DataSourcesAPI) WithImpl ¶
func (a *DataSourcesAPI) WithImpl(impl DataSourcesService) *DataSourcesAPI
WithImpl could be used to override low-level API implementations for unit testing purposes with github.com/golang/mock or other mocking frameworks.
type DataSourcesService ¶
type DataSourcesService interface {
// Get a list of SQL warehouses
//
// Retrieves a full list of SQL warehouses available in this workspace. All
// fields that appear in this API response are enumerated for clarity.
// However, you need only a SQL warehouse's `id` to create new queries
// against it.
ListDataSources(ctx context.Context) ([]DataSource, error)
}
This API is provided to assist you in making new query objects. When creating a query object, you may optionally specify a `data_source_id` for the SQL warehouse against which it will run. If you don't already know the `data_source_id` for your desired SQL warehouse, this API will help you find it.
This API does not support searches. It returns the full list of SQL warehouses in your workspace. We advise you to use any text editor, REST client, or `grep` to search the response from this API for the name of your SQL warehouse as it appears in Databricks SQL.
type DbsqlPermissionsAPI ¶
type DbsqlPermissionsAPI struct {
// contains filtered or unexported fields
}
The SQL Permissions API is similar to the endpoints of the :method:permissions/setobjectpermissions. However, this exposes only one endpoint, which gets the Access Control List for a given object. You cannot modify any permissions using this API.
There are three levels of permission:
- `CAN_VIEW`: Allows read-only access
- `CAN_RUN`: Allows read access and run access (superset of `CAN_VIEW`)
- `CAN_MANAGE`: Allows all actions: read, run, edit, delete, modify permissions (superset of `CAN_RUN`)
func NewDbsqlPermissions ¶
func NewDbsqlPermissions(client *client.DatabricksClient) *DbsqlPermissionsAPI
func (*DbsqlPermissionsAPI) GetPermissions ¶
func (a *DbsqlPermissionsAPI) GetPermissions(ctx context.Context, request GetPermissionsRequest) (*GetPermissionsResponse, error)
Get object ACL
Gets a JSON representation of the access control list (ACL) for a specified object.
func (*DbsqlPermissionsAPI) GetPermissionsByObjectTypeAndObjectId ¶
func (a *DbsqlPermissionsAPI) GetPermissionsByObjectTypeAndObjectId(ctx context.Context, objectType ObjectTypePlural, objectId string) (*GetPermissionsResponse, error)
Get object ACL
Gets a JSON representation of the access control list (ACL) for a specified object.
func (*DbsqlPermissionsAPI) Impl ¶
func (a *DbsqlPermissionsAPI) Impl() DbsqlPermissionsService
Impl returns low-level DbsqlPermissions API implementation
func (*DbsqlPermissionsAPI) SetPermissions ¶
func (a *DbsqlPermissionsAPI) SetPermissions(ctx context.Context, request SetPermissionsRequest) (*SetPermissionsResponse, error)
Set object ACL
Sets the access control list (ACL) for a specified object. This operation will complete rewrite the ACL.
func (*DbsqlPermissionsAPI) TransferOwnership ¶
func (a *DbsqlPermissionsAPI) TransferOwnership(ctx context.Context, request TransferOwnershipRequest) (*Success, error)
Transfer object ownership
Transfers ownership of a dashboard, query, or alert to an active user. Requires an admin API key.
func (*DbsqlPermissionsAPI) WithImpl ¶
func (a *DbsqlPermissionsAPI) WithImpl(impl DbsqlPermissionsService) *DbsqlPermissionsAPI
WithImpl could be used to override low-level API implementations for unit testing purposes with github.com/golang/mock or other mocking frameworks.
type DbsqlPermissionsService ¶
type DbsqlPermissionsService interface {
// Get object ACL
//
// Gets a JSON representation of the access control list (ACL) for a
// specified object.
GetPermissions(ctx context.Context, request GetPermissionsRequest) (*GetPermissionsResponse, error)
// Set object ACL
//
// Sets the access control list (ACL) for a specified object. This operation
// will complete rewrite the ACL.
SetPermissions(ctx context.Context, request SetPermissionsRequest) (*SetPermissionsResponse, error)
// Transfer object ownership
//
// Transfers ownership of a dashboard, query, or alert to an active user.
// Requires an admin API key.
TransferOwnership(ctx context.Context, request TransferOwnershipRequest) (*Success, error)
}
The SQL Permissions API is similar to the endpoints of the :method:permissions/setobjectpermissions. However, this exposes only one endpoint, which gets the Access Control List for a given object. You cannot modify any permissions using this API.
There are three levels of permission:
- `CAN_VIEW`: Allows read-only access
- `CAN_RUN`: Allows read access and run access (superset of `CAN_VIEW`)
- `CAN_MANAGE`: Allows all actions: read, run, edit, delete, modify permissions (superset of `CAN_RUN`)
type DeleteAlertRequest ¶
type DeleteAlertRequest struct {
AlertId string `json:"-" url:"-"`
}
Delete an alert
type DeleteDashboardRequest ¶
type DeleteDashboardRequest struct {
DashboardId string `json:"-" url:"-"`
}
Remove a dashboard
type DeleteQueryRequest ¶
type DeleteQueryRequest struct {
QueryId string `json:"-" url:"-"`
}
Delete a query
type DeleteScheduleRequest ¶
type DeleteScheduleRequest struct {
AlertId string `json:"-" url:"-"`
ScheduleId string `json:"-" url:"-"`
}
Delete a refresh schedule
type Destination ¶
type Destination struct {
// ID of the alert destination.
Id string `json:"id,omitempty"`
// Name of the alert destination.
Name string `json:"name,omitempty"`
// Type of the alert destination.
Type DestinationType `json:"type,omitempty"`
}
Alert destination subscribed to the alert, if it exists. Alert destinations can be configured by admins through the UI. See [here](https://docs.databricks.com/sql/admin/alert-destinations.html).
type DestinationType ¶
type DestinationType string
Type of the alert destination.
const DestinationTypeEmail DestinationType = `email`
const DestinationTypeHangoutsChat DestinationType = `hangouts_chat`
const DestinationTypeMattermost DestinationType = `mattermost`
const DestinationTypeMicrosoftTeams DestinationType = `microsoft_teams`
const DestinationTypePagerduty DestinationType = `pagerduty`
const DestinationTypeSlack DestinationType = `slack`
const DestinationTypeWebhook DestinationType = `webhook`
type EditAlert ¶
type EditAlert struct {
AlertId string `json:"-" url:"-"`
// Name of the alert.
Name string `json:"name"`
// Alert configuration options.
Options AlertOptions `json:"options"`
// ID of the query evaluated by the alert.
QueryId string `json:"query_id"`
// Number of seconds after being triggered before the alert rearms itself
// and can be triggered again. If `null`, alert will never be triggered
// again.
Rearm int `json:"rearm,omitempty"`
}
type GetAlertRequest ¶
type GetAlertRequest struct {
AlertId string `json:"-" url:"-"`
}
Get an alert
type GetDashboardRequest ¶
type GetDashboardRequest struct {
DashboardId string `json:"-" url:"-"`
}
Retrieve a definition
type GetPermissionsRequest ¶
type GetPermissionsRequest struct {
// Object ID. An ACL is returned for the object with this UUID.
ObjectId string `json:"-" url:"-"`
// The type of object permissions to check.
ObjectType ObjectTypePlural `json:"-" url:"-"`
}
Get object ACL
type GetPermissionsResponse ¶
type GetPermissionsResponse struct {
AccessControlList []AccessControl `json:"access_control_list,omitempty"`
// A singular noun object type.
ObjectId ObjectType `json:"object_id,omitempty"`
// An object's type and UUID, separated by a forward slash (/) character.
ObjectType string `json:"object_type,omitempty"`
}
type GetQueryRequest ¶
type GetQueryRequest struct {
QueryId string `json:"-" url:"-"`
}
Get a query definition.
type GetSubscriptionsRequest ¶
type GetSubscriptionsRequest struct {
AlertId string `json:"-" url:"-"`
}
Get an alert's subscriptions
type ListDashboardsOrder ¶
type ListDashboardsOrder string
const ListDashboardsOrderCreatedAt ListDashboardsOrder = `created_at`
const ListDashboardsOrderName ListDashboardsOrder = `name`
type ListDashboardsRequest ¶
type ListDashboardsRequest struct {
// Name of dashboard attribute to order by.
Order ListDashboardsOrder `json:"-" url:"order,omitempty"`
// Page number to retrieve.
Page int `json:"-" url:"page,omitempty"`
// Number of dashboards to return per page.
PageSize int `json:"-" url:"page_size,omitempty"`
// Full text search term.
Q string `json:"-" url:"q,omitempty"`
}
Get dashboard objects
type ListDashboardsResponse ¶
type ListDashboardsResponse struct {
// The total number of dashboards.
Count int `json:"count,omitempty"`
// The current page being displayed.
Page int `json:"page,omitempty"`
// The number of dashboards per page.
PageSize int `json:"page_size,omitempty"`
// List of dashboards returned.
Results []Dashboard `json:"results,omitempty"`
}
type ListQueriesRequest ¶
type ListQueriesRequest struct {
// Name of query attribute to order by. Default sort order is ascending.
// Append a dash (`-`) to order descending instead.
//
// - `name`: The name of the query.
//
// - `created_at`: The timestamp the query was created.
//
// - `schedule`: The refresh interval for each query. For example: "Every 5
// Hours" or "Every 5 Minutes". "Never" is treated as the highest value for
// sorting.
//
// - `runtime`: The time it took to run this query. This is blank for
// parameterized queries. A blank value is treated as the highest value for
// sorting.
//
// - `executed_at`: The timestamp when the query was last run.
//
// - `created_by`: The user name of the user that created the query.
Order string `json:"-" url:"order,omitempty"`
// Page number to retrieve.
Page int `json:"-" url:"page,omitempty"`
// Number of queries to return per page.
PageSize int `json:"-" url:"page_size,omitempty"`
// Full text search term
Q string `json:"-" url:"q,omitempty"`
}
Get a list of queries
type ListQueriesResponse ¶
type ListQueriesResponse struct {
// The total number of queries.
Count int `json:"count,omitempty"`
// The page number that is currently displayed.
Page int `json:"page,omitempty"`
// The number of queries per page.
PageSize int `json:"page_size,omitempty"`
// List of queries returned.
Results []Query `json:"results,omitempty"`
}
type ListSchedulesRequest ¶
type ListSchedulesRequest struct {
AlertId string `json:"-" url:"-"`
}
Get refresh schedules
type ObjectType ¶
type ObjectType string
A singular noun object type.
const ObjectTypeAlert ObjectType = `alert`
const ObjectTypeDashboard ObjectType = `dashboard`
const ObjectTypeDataSource ObjectType = `data_source`
const ObjectTypeQuery ObjectType = `query`
type ObjectTypePlural ¶
type ObjectTypePlural string
Always a plural of the object type.
const ObjectTypePluralAlerts ObjectTypePlural = `alerts`
const ObjectTypePluralDashboards ObjectTypePlural = `dashboards`
const ObjectTypePluralDataSources ObjectTypePlural = `data_sources`
const ObjectTypePluralQueries ObjectTypePlural = `queries`
type OwnableObjectType ¶
type OwnableObjectType string
The singular form of the type of object which can be owned.
const OwnableObjectTypeAlert OwnableObjectType = `alert`
const OwnableObjectTypeDashboard OwnableObjectType = `dashboard`
const OwnableObjectTypeQuery OwnableObjectType = `query`
type Parameter ¶
type Parameter struct {
// The literal parameter marker that appears between double curly braces in
// the query text.
Name string `json:"name,omitempty"`
// The text displayed in a parameter picking widget.
Title string `json:"title,omitempty"`
// Parameters can have several different types.
Type ParameterType `json:"type,omitempty"`
// The default value for this parameter.
Value string `json:"value,omitempty"`
}
type ParameterType ¶
type ParameterType string
Parameters can have several different types.
const ParameterTypeDatetime ParameterType = `datetime`
const ParameterTypeNumber ParameterType = `number`
const ParameterTypeText ParameterType = `text`
type PermissionLevel ¶
type PermissionLevel string
This describes an enum
const PermissionLevelCanManage PermissionLevel = `CAN_MANAGE`
Can manage the query
const PermissionLevelCanRun PermissionLevel = `CAN_RUN`
Can run the query
const PermissionLevelCanView PermissionLevel = `CAN_VIEW`
Can view the query
type QueriesAPI ¶
type QueriesAPI struct {
// contains filtered or unexported fields
}
These endpoints are used for CRUD operations on query definitions. Query definitions include the target SQL warehouse, query text, name, description, tags, execution schedule, parameters, and visualizations.
func NewQueries ¶
func NewQueries(client *client.DatabricksClient) *QueriesAPI
func (*QueriesAPI) CreateQuery ¶
func (a *QueriesAPI) CreateQuery(ctx context.Context, request QueryPostContent) (*Query, error)
Create a new query definition
Creates a new query definition. Queries created with this endpoint belong to the authenticated user making the request.
The `data_source_id` field specifies the ID of the SQL warehouse to run this query against. You can use the Data Sources API to see a complete list of available SQL warehouses. Or you can copy the `data_source_id` from an existing query.
**Note**: You cannot add a visualization until you create the query.
func (*QueriesAPI) DeleteQuery ¶
func (a *QueriesAPI) DeleteQuery(ctx context.Context, request DeleteQueryRequest) error
Delete a query
Moves a query to the trash. Trashed queries immediately disappear from searches and list views, and they cannot be used for alerts. The trash is deleted after 30 days.
func (*QueriesAPI) DeleteQueryByQueryId ¶
func (a *QueriesAPI) DeleteQueryByQueryId(ctx context.Context, queryId string) error
Delete a query
Moves a query to the trash. Trashed queries immediately disappear from searches and list views, and they cannot be used for alerts. The trash is deleted after 30 days.
func (*QueriesAPI) GetByName ¶
GetByName calls QueriesAPI.QueryNameToIdMap and returns a single Query.
Returns an error if there's more than one Query with the same .Name.
Note: All Query instances are loaded into memory before returning matching by name.
This method is generated by Databricks SDK Code Generator.
func (*QueriesAPI) GetQuery ¶
func (a *QueriesAPI) GetQuery(ctx context.Context, request GetQueryRequest) (*Query, error)
Get a query definition.
Retrieve a query object definition along with contextual permissions information about the currently authenticated user.
func (*QueriesAPI) GetQueryByQueryId ¶
Get a query definition.
Retrieve a query object definition along with contextual permissions information about the currently authenticated user.
func (*QueriesAPI) Impl ¶
func (a *QueriesAPI) Impl() QueriesService
Impl returns low-level Queries API implementation
func (*QueriesAPI) ListQueriesAll ¶
func (a *QueriesAPI) ListQueriesAll(ctx context.Context, request ListQueriesRequest) ([]Query, error)
Get a list of queries
Gets a list of queries. Optionally, this list can be filtered by a search term.
This method is generated by Databricks SDK Code Generator.
func (*QueriesAPI) QueryNameToIdMap ¶
func (a *QueriesAPI) QueryNameToIdMap(ctx context.Context, request ListQueriesRequest) (map[string]string, error)
QueryNameToIdMap calls QueriesAPI.ListQueriesAll and creates a map of results with Query.Name as key and Query.Id as value.
Returns an error if there's more than one Query with the same .Name.
Note: All Query instances are loaded into memory before creating a map.
This method is generated by Databricks SDK Code Generator.
func (*QueriesAPI) RestoreQuery ¶
func (a *QueriesAPI) RestoreQuery(ctx context.Context, request RestoreQueryRequest) error
Restore a query
Restore a query that has been moved to the trash. A restored query appears in list views and searches. You can use restored queries for alerts.
func (*QueriesAPI) UpdateQuery ¶
func (a *QueriesAPI) UpdateQuery(ctx context.Context, request QueryPostContent) (*Query, error)
Change a query definition
Modify this query definition.
**Note**: You cannot undo this operation.
func (*QueriesAPI) WithImpl ¶
func (a *QueriesAPI) WithImpl(impl QueriesService) *QueriesAPI
WithImpl could be used to override low-level API implementations for unit testing purposes with github.com/golang/mock or other mocking frameworks.
type QueriesService ¶
type QueriesService interface {
// Create a new query definition
//
// Creates a new query definition. Queries created with this endpoint belong
// to the authenticated user making the request.
//
// The `data_source_id` field specifies the ID of the SQL warehouse to run
// this query against. You can use the Data Sources API to see a complete
// list of available SQL warehouses. Or you can copy the `data_source_id`
// from an existing query.
//
// **Note**: You cannot add a visualization until you create the query.
CreateQuery(ctx context.Context, request QueryPostContent) (*Query, error)
// Delete a query
//
// Moves a query to the trash. Trashed queries immediately disappear from
// searches and list views, and they cannot be used for alerts. The trash is
// deleted after 30 days.
DeleteQuery(ctx context.Context, request DeleteQueryRequest) error
// Get a query definition.
//
// Retrieve a query object definition along with contextual permissions
// information about the currently authenticated user.
GetQuery(ctx context.Context, request GetQueryRequest) (*Query, error)
// Get a list of queries
//
// Gets a list of queries. Optionally, this list can be filtered by a search
// term.
//
// Use ListQueriesAll() to get all Query instances, which will iterate over every result page.
ListQueries(ctx context.Context, request ListQueriesRequest) (*ListQueriesResponse, error)
// Restore a query
//
// Restore a query that has been moved to the trash. A restored query
// appears in list views and searches. You can use restored queries for
// alerts.
RestoreQuery(ctx context.Context, request RestoreQueryRequest) error
// Change a query definition
//
// Modify this query definition.
//
// **Note**: You cannot undo this operation.
UpdateQuery(ctx context.Context, request QueryPostContent) (*Query, error)
}
These endpoints are used for CRUD operations on query definitions. Query definitions include the target SQL warehouse, query text, name, description, tags, execution schedule, parameters, and visualizations.
type Query ¶
type Query struct {
// Describes whether the authenticated user is allowed to edit the
// definition of this query.
CanEdit bool `json:"can_edit,omitempty"`
// The timestamp when this query was created.
CreatedAt string `json:"created_at,omitempty"`
// Data Source ID. The UUID that uniquely identifies this data source / SQL
// warehouse across the API.
DataSourceId string `json:"data_source_id,omitempty"`
// General description that conveys additional information about this query
// such as usage notes.
Description string `json:"description,omitempty"`
Id string `json:"id,omitempty"`
// Indicates whether the query is trashed. Trashed queries can't be used in
// dashboards, or appear in search results. If this boolean is `true`, the
// `options` property for this query includes a `moved_to_trash_at`
// timestamp. Trashed queries are permanently deleted after 30 days.
IsArchived bool `json:"is_archived,omitempty"`
// Whether the query is a draft. Draft queries only appear in list views for
// their owners. Visualizations from draft queries cannot appear on
// dashboards.
IsDraft bool `json:"is_draft,omitempty"`
// Whether this query object appears in the current user's favorites list.
// This flag determines whether the star icon for favorites is selected.
IsFavorite bool `json:"is_favorite,omitempty"`
// Text parameter types are not safe from SQL injection for all types of
// data source. Set this Boolean parameter to `true` if a query either does
// not use any text type parameters or uses a data source type where text
// type parameters are handled safely.
IsSafe bool `json:"is_safe,omitempty"`
LastModifiedBy *User `json:"last_modified_by,omitempty"`
// The ID of the user who last saved changes to this query.
LastModifiedById int `json:"last_modified_by_id,omitempty"`
// If there is a cached result for this query and user, this field includes
// the query result ID. If this query uses parameters, this field is always
// null.
LatestQueryDataId string `json:"latest_query_data_id,omitempty"`
// The title of this query that appears in list views, widget headings, and
// on the query page.
Name string `json:"name,omitempty"`
Options *QueryOptions `json:"options,omitempty"`
// This describes an enum
PermissionTier PermissionLevel `json:"permission_tier,omitempty"`
// The text of the query to be run.
Query string `json:"query,omitempty"`
// A SHA-256 hash of the query text along with the authenticated user ID.
QueryHash string `json:"query_hash,omitempty"`
Schedule *QueryInterval `json:"schedule,omitempty"`
Tags []string `json:"tags,omitempty"`
// The timestamp at which this query was last updated.
UpdatedAt string `json:"updated_at,omitempty"`
User *User `json:"user,omitempty"`
// The ID of the user who created this query.
UserId int `json:"user_id,omitempty"`
Visualizations []Visualization `json:"visualizations,omitempty"`
}
type QueryInterval ¶
type QueryInterval struct {
// For weekly runs, the day of the week to start the run.
DayOfWeek any `json:"day_of_week,omitempty"`
// Integer number of seconds between runs.
Interval int `json:"interval,omitempty"`
// For daily, weekly, and monthly runs, the time of day to start the run.
Time any `json:"time,omitempty"`
// A date after which this schedule no longer applies.
Until any `json:"until,omitempty"`
}
type QueryOptions ¶
type QueryOptions struct {
// The timestamp when this query was moved to trash. Only present when the
// `is_archived` property is `true`. Trashed items are deleted after thirty
// days.
MovedToTrashAt string `json:"moved_to_trash_at,omitempty"`
Parameters []Parameter `json:"parameters,omitempty"`
}
type QueryPostContent ¶
type QueryPostContent struct {
// The ID of the data source / SQL warehouse where this query will run.
DataSourceId string `json:"data_source_id,omitempty"`
// General description that can convey additional information about this
// query such as usage notes.
Description string `json:"description,omitempty"`
// The name or title of this query to display in list views.
Name string `json:"name,omitempty"`
// Exclusively used for storing a list parameter definitions. A parameter is
// an object with `title`, `name`, `type`, and `value` properties. The
// `value` field here is the default value. It can be overridden at runtime.
Options any `json:"options,omitempty"`
// The text of the query.
Query string `json:"query,omitempty"`
QueryId string `json:"-" url:"-"`
// JSON object that describes the scheduled execution frequency. A schedule
// object includes `interval`, `time`, `day_of_week`, and `until` fields. If
// a scheduled is supplied, then only `interval` is required. All other
// field can be `null`.
Schedule *QueryInterval `json:"schedule,omitempty"`
}
type RefreshSchedule ¶
type RefreshSchedule struct {
// Cron string representing the refresh schedule.
Cron string `json:"cron,omitempty"`
// ID of the SQL warehouse to refresh with. If `null`, query's SQL warehouse
// will be used to refresh.
DataSourceId string `json:"data_source_id,omitempty"`
// ID of the refresh schedule.
Id string `json:"id,omitempty"`
}
type RestoreDashboardRequest ¶
type RestoreDashboardRequest struct {
DashboardId string `json:"-" url:"-"`
}
Restore a dashboard
type RestoreQueryRequest ¶
type RestoreQueryRequest struct {
QueryId string `json:"-" url:"-"`
}
Restore a query
type SetPermissionsRequest ¶
type SetPermissionsRequest struct {
AccessControlList []AccessControl `json:"access_control_list,omitempty"`
// Object ID. The ACL for the object with this UUID is overwritten by this
// request's POST content.
ObjectId string `json:"-" url:"-"`
// The type of object permission to set.
ObjectType ObjectTypePlural `json:"-" url:"-"`
}
Set object ACL
type SetPermissionsResponse ¶
type SetPermissionsResponse struct {
AccessControlList []AccessControl `json:"access_control_list,omitempty"`
// A singular noun object type.
ObjectId ObjectType `json:"object_id,omitempty"`
// An object's type and UUID, separated by a forward slash (/) character.
ObjectType string `json:"object_type,omitempty"`
}
type Subscription ¶
type Subscription struct {
// ID of the alert.
AlertId string `json:"alert_id,omitempty"`
// Alert destination subscribed to the alert, if it exists. Alert
// destinations can be configured by admins through the UI. See
// [here](https://docs.databricks.com/sql/admin/alert-destinations.html).
Destination *Destination `json:"destination,omitempty"`
// ID of the alert subscription.
Id string `json:"id,omitempty"`
User *User `json:"user,omitempty"`
}
type Success ¶
type Success struct {
Message SuccessMessage `json:"message,omitempty"`
}
type SuccessMessage ¶
type SuccessMessage string
const SuccessMessageSuccess SuccessMessage = `Success`
type TransferOwnershipObjectId ¶
type TransferOwnershipObjectId struct {
// Email address for the new owner, who must exist in the workspace.
NewOwner string `json:"new_owner,omitempty"`
}
type TransferOwnershipRequest ¶
type TransferOwnershipRequest struct {
// Email address for the new owner, who must exist in the workspace.
NewOwner string `json:"new_owner,omitempty"`
// The ID of the object on which to change ownership.
ObjectId TransferOwnershipObjectId `json:"-" url:"-"`
// The type of object on which to change ownership.
ObjectType OwnableObjectType `json:"-" url:"-"`
}
Transfer object ownership
type UnsubscribeRequest ¶
type UnsubscribeRequest struct {
AlertId string `json:"-" url:"-"`
SubscriptionId string `json:"-" url:"-"`
}
Unsubscribe to an alert
type User ¶
type User struct {
Email string `json:"email,omitempty"`
Id int `json:"id,omitempty"`
// Whether this user is an admin in the Databricks workspace.
IsDbAdmin bool `json:"is_db_admin,omitempty"`
Name string `json:"name,omitempty"`
// The URL for the gravatar profile picture tied to this user's email
// address.
ProfileImageUrl string `json:"profile_image_url,omitempty"`
}
type Visualization ¶
type Visualization struct {
CreatedAt string `json:"created_at,omitempty"`
// A short description of this visualization. This is not displayed in the
// UI.
Description string `json:"description,omitempty"`
// The UUID for this visualization.
Id string `json:"id,omitempty"`
// The name of the visualization that appears on dashboards and the query
// screen.
Name string `json:"name,omitempty"`
// The options object varies widely from one visualization type to the next
// and is unsupported. Databricks does not recommend modifying visualization
// settings in JSON.
Options any `json:"options,omitempty"`
// The type of visualization: chart, table, pivot table, and so on.
Type string `json:"type,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
}
The visualization description API changes frequently and is unsupported. You can duplicate a visualization by copying description objects received _from the API_ and then using them to create a new one with a POST request to the same endpoint. Databricks does not recommend constructing ad-hoc visualizations entirely in JSON.
type Widget ¶
type Widget struct {
// The unique ID for this widget.
Id int `json:"id,omitempty"`
Options *WidgetOptions `json:"options,omitempty"`
// The visualization description API changes frequently and is unsupported.
// You can duplicate a visualization by copying description objects received
// _from the API_ and then using them to create a new one with a POST
// request to the same endpoint. Databricks does not recommend constructing
// ad-hoc visualizations entirely in JSON.
Visualization *Visualization `json:"visualization,omitempty"`
// Unused field.
Width int `json:"width,omitempty"`
}
type WidgetOptions ¶
type WidgetOptions struct {
// Timestamp when this object was created
CreatedAt string `json:"created_at,omitempty"`
// The dashboard ID to which this widget belongs. Each widget can belong to
// one dashboard.
DashboardId string `json:"dashboard_id,omitempty"`
// Whether this widget is hidden on the dashboard.
IsHidden bool `json:"isHidden,omitempty"`
// How parameters used by the visualization in this widget relate to other
// widgets on the dashboard. Databricks does not recommend modifying this
// definition in JSON.
ParameterMappings any `json:"parameterMappings,omitempty"`
// Coordinates of this widget on a dashboard. This portion of the API
// changes frequently and is unsupported.
Position any `json:"position,omitempty"`
// If this is a textbox widget, the application displays this text. This
// field is ignored if the widget contains a visualization in the
// `visualization` field.
Text string `json:"text,omitempty"`
// Timestamp of the last time this object was updated.
UpdatedAt string `json:"updated_at,omitempty"`
}