sql

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ClusterSizes   = []string{"2X-Small", "X-Small", "Small", "Medium", "Large", "X-Large", "2X-Large", "3X-Large", "4X-Large"}
	MaxNumClusters = 30
)

ClusterSizes for SQL endpoints

View Source
var (
	GlobalSqlConfigResourceID = "global"
)

Functions

func DataSourceWarehouse added in v1.1.0

func DataSourceWarehouse() *schema.Resource

func DataSourceWarehouses added in v1.1.0

func DataSourceWarehouses() *schema.Resource

func NewSqlGlobalConfigAPI

func NewSqlGlobalConfigAPI(ctx context.Context, m any) globalConfigAPI

func ResourceSqlAlert added in v1.13.0

func ResourceSqlAlert() *schema.Resource

func ResourceSqlDashboard

func ResourceSqlDashboard() *schema.Resource

func ResourceSqlEndpoint

func ResourceSqlEndpoint() *schema.Resource

func ResourceSqlGlobalConfig

func ResourceSqlGlobalConfig() *schema.Resource

func ResourceSqlQuery

func ResourceSqlQuery() *schema.Resource

func ResourceSqlVisualization

func ResourceSqlVisualization() *schema.Resource

func ResourceSqlWidget

func ResourceSqlWidget() *schema.Resource

Types

type AlertEntity added in v1.13.0

type AlertEntity struct {
	Name    string        `json:"name"`
	QueryId string        `json:"query_id"`
	Rearm   int           `json:"rearm,omitempty"`
	Options *AlertOptions `json:"options"`
	Parent  string        `json:"parent,omitempty" tf:"suppress_diff,force_new"`
}

type AlertOptions added in v1.13.0

type AlertOptions struct {
	Column        string `json:"column"`
	Op            string `json:"op"`
	Value         string `json:"value"`
	Muted         bool   `json:"muted,omitempty"`
	CustomBody    string `json:"custom_body,omitempty"`
	CustomSubject string `json:"custom_subject,omitempty"`
}

type DashboardAPI

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

DashboardAPI ...

func NewDashboardAPI

func NewDashboardAPI(ctx context.Context, m any) DashboardAPI

NewDashboardAPI ...

func (DashboardAPI) Create

func (a DashboardAPI) Create(d *api.Dashboard) error

Create ...

func (DashboardAPI) Delete

func (a DashboardAPI) Delete(dashboardID string) error

Delete ...

func (DashboardAPI) Read

func (a DashboardAPI) Read(dashboardID string) (*api.Dashboard, error)

Read ...

func (DashboardAPI) Update

func (a DashboardAPI) Update(dashboardID string, d *api.Dashboard) error

Update ...

type DashboardEntity

type DashboardEntity struct {
	Name   string   `json:"name"`
	Tags   []string `json:"tags,omitempty"`
	Parent string   `json:"parent,omitempty" tf:"suppress_diff,force_new"`
}

DashboardEntity defines the parameters that can be set in the resource.

type DataSource

type DataSource struct {
	ID         string `json:"id"`
	EndpointID string `json:"endpoint_id"`
}

DataSource

Note: this object returns more fields than contained in this struct, but we only list the ones that are in use here.

type EndpointList

type EndpointList struct {
	Endpoints []SQLEndpoint `json:"warehouses"`
}

endpointList ...

type GlobalConfig

type GlobalConfig struct {
	SecurityPolicy          string            `json:"security_policy,omitempty" tf:"default:DATA_ACCESS_CONTROL"`
	DataAccessConfig        map[string]string `json:"data_access_config,omitempty"`
	InstanceProfileARN      string            `json:"instance_profile_arn,omitempty"`
	EnableServerlessCompute bool              `json:"enable_serverless_compute,omitempty" tf:"default:false"`
	SqlConfigParams         map[string]string `json:"sql_config_params,omitempty"`
}

GlobalConfig used to generate Terraform resource schema and bind to resource data

type GlobalConfigForRead

type GlobalConfigForRead struct {
	SecurityPolicy             string                     `json:"security_policy"`
	DataAccessConfig           []confPair                 `json:"data_access_config"`
	InstanceProfileARN         string                     `json:"instance_profile_arn,omitempty"`
	EnableServerlessCompute    bool                       `json:"enable_serverless_compute"`
	SqlConfigurationParameters *repeatedEndpointConfPairs `json:"sql_configuration_parameters,omitempty"`
}

GlobalConfigForRead used to talk to REST API

type OdbcParams

type OdbcParams struct {
	Hostname string `json:"hostname,omitempty"`
	Path     string `json:"path"`
	Protocol string `json:"protocol"`
	Port     int32  `json:"port"`

	// TODO: eventually remove this column,
	// as it doesn't seem to be populated
	Host string `json:"host,omitempty"`
}

OdbcParams hold information required to submit SQL commands to the SQL endpoint using ODBC.

type QueryAPI

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

QueryAPI ...

func NewQueryAPI

func NewQueryAPI(ctx context.Context, m any) QueryAPI

NewQueryAPI ...

func (QueryAPI) Create

func (a QueryAPI) Create(q *api.Query) error

Create ...

func (QueryAPI) Delete

func (a QueryAPI) Delete(queryID string) error

Delete ...

func (QueryAPI) Read

func (a QueryAPI) Read(queryID string) (*api.Query, error)

Read ...

func (QueryAPI) Update

func (a QueryAPI) Update(queryID string, q *api.Query) error

Update ...

type QueryEntity

type QueryEntity struct {
	DataSourceID string `json:"data_source_id"`
	Name         string `json:"name"`
	Description  string `json:"description,omitempty"`
	Query        string `json:"query"`
	// Deprecated: Use databricks_job resource to schedule a Query
	Schedule  *QuerySchedule   `json:"schedule,omitempty"`
	Tags      []string         `json:"tags,omitempty"`
	Parameter []QueryParameter `json:"parameter,omitempty"`
	RunAsRole string           `json:"run_as_role,omitempty"`
	Parent    string           `json:"parent,omitempty" tf:"suppress_diff,force_new"`
}

QueryEntity defines the parameters that can be set in the resource.

type QueryParameter

type QueryParameter struct {
	Name  string `json:"name"`
	Title string `json:"title,omitempty"`

	// Type specific structs.
	// Only one of them may be set.
	Text             *QueryParameterText          `json:"text,omitempty"`
	Number           *QueryParameterNumber        `json:"number,omitempty"`
	Enum             *QueryParameterEnum          `json:"enum,omitempty"`
	Query            *QueryParameterQuery         `json:"query,omitempty"`
	Date             *QueryParameterDateLike      `json:"date,omitempty"`
	DateTime         *QueryParameterDateLike      `json:"datetime,omitempty"`
	DateTimeSec      *QueryParameterDateLike      `json:"datetimesec,omitempty"`
	DateRange        *QueryParameterDateRangeLike `json:"date_range,omitempty"`
	DateTimeRange    *QueryParameterDateRangeLike `json:"datetime_range,omitempty"`
	DateTimeSecRange *QueryParameterDateRangeLike `json:"datetimesec_range,omitempty"`
}

QueryParameter ...

type QueryParameterAllowMultiple

type QueryParameterAllowMultiple struct {
	Prefix    string `json:"prefix"`
	Suffix    string `json:"suffix"`
	Separator string `json:"separator"`
}

QueryParameterAllowMultiple ...

type QueryParameterDateLike

type QueryParameterDateLike struct {
	Value string `json:"value"`
}

QueryParameterDateLike ...

type QueryParameterDateRangeLike

type QueryParameterDateRangeLike struct {
	Value string             `json:"value,omitempty"`
	Range *api.DateTimeRange `json:"range,omitempty"`
}

QueryParameterDateRangeLike ...

type QueryParameterEnum

type QueryParameterEnum struct {
	// Value iff `multiple == nil`
	Value string `json:"value,omitempty"`
	// Values iff `multiple != nil`
	Values []string `json:"values,omitempty"`

	Options  []string                     `json:"options"`
	Multiple *QueryParameterAllowMultiple `json:"multiple,omitempty"`
}

QueryParameterEnum ...

type QueryParameterNumber

type QueryParameterNumber struct {
	Value float64 `json:"value"`
}

QueryParameterNumber ...

type QueryParameterQuery

type QueryParameterQuery struct {
	// Value iff `multiple == nil`
	Value string `json:"value,omitempty"`
	// Values iff `multiple != nil`
	Values []string `json:"values,omitempty"`

	QueryID  string                       `json:"query_id"`
	Multiple *QueryParameterAllowMultiple `json:"multiple,omitempty"`
}

QueryParameterQuery ...

type QueryParameterText

type QueryParameterText struct {
	Value string `json:"value"`
}

QueryParameterText ...

type QuerySchedule

type QuerySchedule struct {
	Continuous *QueryScheduleContinuous `json:"continuous,omitempty"`
	Daily      *QueryScheduleDaily      `json:"daily,omitempty"`
	Weekly     *QueryScheduleWeekly     `json:"weekly,omitempty"`
}

QuerySchedule ... Deprecated: Use databricks_job resource to schedule a Query

type QueryScheduleContinuous

type QueryScheduleContinuous struct {
	IntervalSeconds int    `json:"interval_seconds"`
	UntilDate       string `json:"until_date,omitempty"`
}

QueryScheduleContinuous ... Deprecated: Use databricks_job resource to schedule a Query

type QueryScheduleDaily

type QueryScheduleDaily struct {
	IntervalDays int    `json:"interval_days"`
	TimeOfDay    string `json:"time_of_day"`
	UntilDate    string `json:"until_date,omitempty"`
}

QueryScheduleDaily ... Deprecated: Use databricks_job resource to schedule a Query

type QueryScheduleWeekly

type QueryScheduleWeekly struct {
	IntervalWeeks int    `json:"interval_weeks"`
	DayOfWeek     string `json:"day_of_week"`
	TimeOfDay     string `json:"time_of_day"`
	UntilDate     string `json:"until_date,omitempty"`
}

QueryScheduleWeekly ... Deprecated: Use databricks_job resource to schedule a Query

type ReleaseChannel

type ReleaseChannel struct {
	Name string `json:"name,omitempty" tf:"default:CHANNEL_NAME_CURRENT"`
}

ReleaseChannel holds information about DBSQL Release Channel

type SQLEndpoint

type SQLEndpoint struct {
	ID                      string          `json:"id,omitempty" tf:"computed"`
	Name                    string          `json:"name"`
	ClusterSize             string          `json:"cluster_size"`
	AutoStopMinutes         int             `json:"auto_stop_mins" tf:"optional,default:120"`
	MinNumClusters          int             `json:"min_num_clusters,omitempty" tf:"suppress_diff"`
	MaxNumClusters          int             `json:"max_num_clusters,omitempty" tf:"default:1"`
	NumClusters             int             `json:"num_clusters,omitempty" tf:"suppress_diff"`
	EnablePhoton            bool            `json:"enable_photon" tf:"optional,default:true"`
	EnableServerlessCompute bool            `json:"enable_serverless_compute,omitempty" tf:"suppress_diff"`
	InstanceProfileARN      string          `json:"instance_profile_arn,omitempty"`
	State                   string          `json:"state,omitempty" tf:"computed"`
	JdbcURL                 string          `json:"jdbc_url,omitempty" tf:"computed"`
	OdbcParams              *OdbcParams     `json:"odbc_params,omitempty" tf:"computed"`
	Tags                    *Tags           `json:"tags,omitempty" tf:"suppress_diff"`
	SpotInstancePolicy      string          `json:"spot_instance_policy,omitempty" tf:"default:COST_OPTIMIZED"`
	Channel                 *ReleaseChannel `json:"channel,omitempty" tf:"suppress_diff"`
	WarehouseType           string          `json:"warehouse_type,omitempty" tf:"suppress_diff"`

	// The data source ID is not part of the endpoint API response.
	// We manually resolve it by retrieving the list of data sources
	// and matching this entity's endpoint ID.
	DataSourceID string `json:"data_source_id,omitempty" tf:"computed"`
}

SQLEndpoint ...

type SQLEndpointsAPI

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

SQLEndpointsAPI ...

func NewSQLEndpointsAPI

func NewSQLEndpointsAPI(ctx context.Context, m any) SQLEndpointsAPI

NewSQLEndpointsAPI ...

func (SQLEndpointsAPI) Create

func (a SQLEndpointsAPI) Create(se *SQLEndpoint, timeout time.Duration) error

Create ...

func (SQLEndpointsAPI) Delete

func (a SQLEndpointsAPI) Delete(endpointID string) error

Delete ...

func (SQLEndpointsAPI) Edit

func (a SQLEndpointsAPI) Edit(se SQLEndpoint) error

Edit ...

func (SQLEndpointsAPI) Get

func (a SQLEndpointsAPI) Get(endpointID string) (se SQLEndpoint, err error)

Get ...

func (SQLEndpointsAPI) List

func (a SQLEndpointsAPI) List() (lst EndpointList, err error)

List all SQL endpoints

func (SQLEndpointsAPI) ResolveDataSourceID

func (a SQLEndpointsAPI) ResolveDataSourceID(endpointID string) (dataSourceID string, err error)

ResolveDataSourceID ...

func (SQLEndpointsAPI) Start

func (a SQLEndpointsAPI) Start(endpointID string, timeout time.Duration) error

Start ..

func (SQLEndpointsAPI) Stop

func (a SQLEndpointsAPI) Stop(endpointID string) error

Stop ...

type Tag

type Tag struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Tag ...

type Tags

type Tags struct {
	CustomTags []Tag `json:"custom_tags"`
}

Tags ...

type VisualizationAPI

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

VisualizationAPI ...

func NewVisualizationAPI

func NewVisualizationAPI(ctx context.Context, m any) VisualizationAPI

NewVisualizationAPI ...

func (VisualizationAPI) Create

func (a VisualizationAPI) Create(v *api.Visualization) error

Create ...

func (VisualizationAPI) Delete

func (a VisualizationAPI) Delete(visualizationID string) error

Delete ...

func (VisualizationAPI) Read

func (a VisualizationAPI) Read(queryID, visualizationID string) (*api.Visualization, error)

Read ...

func (VisualizationAPI) Update

func (a VisualizationAPI) Update(visualizationID string, v *api.Visualization) error

Update ...

type VisualizationEntity

type VisualizationEntity struct {
	QueryID         string `json:"query_id" tf:"force_new"`
	VisualizationID string `json:"visualization_id,omitempty" tf:"computed,force_new"`

	Type        string `json:"type"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Options     string `json:"options"`
	QueryPlan   string `json:"query_plan,omitempty"`
}

VisualizationEntity defines the parameters that can be set in the resource.

type WidgetAPI

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

WidgetAPI ...

func NewWidgetAPI

func NewWidgetAPI(ctx context.Context, m any) WidgetAPI

NewWidgetAPI ...

func (WidgetAPI) Create

func (a WidgetAPI) Create(w *api.Widget) error

Create ...

func (WidgetAPI) Delete

func (a WidgetAPI) Delete(widgetID string) error

Delete ...

func (WidgetAPI) Read

func (a WidgetAPI) Read(dashboardID, widgetID string) (*api.Widget, error)

Read ...

func (WidgetAPI) Update

func (a WidgetAPI) Update(widgetID string, w *api.Widget) error

Update ...

type WidgetEntity

type WidgetEntity struct {
	DashboardID string `json:"dashboard_id" tf:"force_new"`
	WidgetID    string `json:"widget_id,omitempty" tf:"computed,force_new"`

	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`

	Text            string `json:"text,omitempty"`
	VisualizationID string `json:"visualization_id,omitempty" tf:"force_new"`

	Position  *WidgetPosition   `json:"position,omitempty"`
	Parameter []WidgetParameter `json:"parameter,omitempty" tf:"slice_set"`
}

WidgetEntity defines the parameters that can be set in the resource.

type WidgetParameter

type WidgetParameter struct {
	Name  string `json:"name"`
	Type  string `json:"type"`
	MapTo string `json:"map_to,omitempty"`
	Title string `json:"title,omitempty"`

	// Mutually exclusive.
	Value  string   `json:"value,omitempty"`
	Values []string `json:"values,omitempty"`
}

WidgetParameter ...

type WidgetPosition

type WidgetPosition struct {
	SizeX      int  `json:"size_x"`
	SizeY      int  `json:"size_y"`
	PosX       int  `json:"pos_x" tf:"optional,default:0"`
	PosY       int  `json:"pos_y" tf:"optional,default:0"`
	AutoHeight bool `json:"auto_height,omitempty"`
}

WidgetPosition ...

Directories

Path Synopsis
Package api contains API structures for use with the Databricks SQL API.
Package api contains API structures for use with the Databricks SQL API.

Jump to

Keyboard shortcuts

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