api

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

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

These are not intended to be used directly.

They are kept in a separate package to avoid confusion between the Terraform resources and the API objects. While their structure is very similar, there are a handful of nuanced differences to improve the UX of the Terraform resource.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStringOrInt

func NewStringOrInt(s string) stringOrInt

Types

type Dashboard

type Dashboard struct {
	ID      string            `json:"id"`
	Name    string            `json:"name"`
	Tags    []string          `json:"tags,omitempty"`
	Widgets []json.RawMessage `json:"widgets,omitempty"`
	Parent  string            `json:"parent,omitempty"`
}

Dashboard ...

type DateTimeRange added in v1.7.0

type DateTimeRange struct {
	Start string `json:"start"`
	End   string `json:"end"`
}

type Query

type Query struct {
	ID           string `json:"id,omitempty"`
	DataSourceID string `json:"data_source_id"`
	Name         string `json:"name"`
	Description  string `json:"description"`
	Query        string `json:"query"`
	// Deprecated: Use databricks_job resource to schedule a Query
	Schedule       *QuerySchedule    `json:"schedule"`
	Options        *QueryOptions     `json:"options,omitempty"`
	Tags           []string          `json:"tags,omitempty"`
	Visualizations []json.RawMessage `json:"visualizations,omitempty"`
	Parent         string            `json:"parent,omitempty"`
}

Query ...

type QueryOptions

type QueryOptions struct {
	Parameters    []any             `json:"-"`
	RawParameters []json.RawMessage `json:"parameters,omitempty"`

	RunAsRole string `json:"run_as_role,omitempty"`
}

QueryOptions ...

func (*QueryOptions) MarshalJSON

func (o *QueryOptions) MarshalJSON() ([]byte, error)

MarshalJSON ...

func (*QueryOptions) UnmarshalJSON

func (o *QueryOptions) UnmarshalJSON(b []byte) error

UnmarshalJSON ...

type QueryParameter

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

QueryParameter ...

type QueryParameterDate

type QueryParameterDate struct {
	QueryParameter

	Value string `json:"value"`
}

QueryParameterDate ...

func (QueryParameterDate) MarshalJSON

func (p QueryParameterDate) MarshalJSON() ([]byte, error)

MarshalJSON sets the type before marshaling.

func (*QueryParameterDate) UnmarshalJSON

func (p *QueryParameterDate) UnmarshalJSON(b []byte) error

UnmarshalJSON clears the type after marshaling.

type QueryParameterDateRange

type QueryParameterDateRange struct {
	QueryParameterRangeBase
}

QueryParameterDateRange ...

func (QueryParameterDateRange) MarshalJSON

func (p QueryParameterDateRange) MarshalJSON() ([]byte, error)

MarshalJSON sets the type before marshaling.

func (*QueryParameterDateRange) UnmarshalJSON

func (p *QueryParameterDateRange) UnmarshalJSON(b []byte) error

UnmarshalJSON clears the type after marshaling.

type QueryParameterDateTime

type QueryParameterDateTime struct {
	QueryParameter

	Value       any    `json:"value"`
	StringValue string `json:"-"`
}

QueryParameterDateTime ...

func (QueryParameterDateTime) MarshalJSON

func (p QueryParameterDateTime) MarshalJSON() ([]byte, error)

MarshalJSON sets the type before marshaling.

func (*QueryParameterDateTime) UnmarshalJSON

func (p *QueryParameterDateTime) UnmarshalJSON(b []byte) error

UnmarshalJSON clears the type after marshaling.

type QueryParameterDateTimeRange

type QueryParameterDateTimeRange struct {
	QueryParameterRangeBase
}

QueryParameterDateTimeRange ...

func (QueryParameterDateTimeRange) MarshalJSON

func (p QueryParameterDateTimeRange) MarshalJSON() ([]byte, error)

MarshalJSON sets the type before marshaling.

func (*QueryParameterDateTimeRange) UnmarshalJSON

func (p *QueryParameterDateTimeRange) UnmarshalJSON(b []byte) error

UnmarshalJSON clears the type after marshaling.

type QueryParameterDateTimeSec

type QueryParameterDateTimeSec struct {
	QueryParameter

	Value string `json:"value"`
}

QueryParameterDateTimeSec ...

func (QueryParameterDateTimeSec) MarshalJSON

func (p QueryParameterDateTimeSec) MarshalJSON() ([]byte, error)

MarshalJSON sets the type before marshaling.

func (*QueryParameterDateTimeSec) UnmarshalJSON

func (p *QueryParameterDateTimeSec) UnmarshalJSON(b []byte) error

UnmarshalJSON clears the type after marshaling.

type QueryParameterDateTimeSecRange

type QueryParameterDateTimeSecRange struct {
	QueryParameterRangeBase
}

QueryParameterDateTimeSecRange ...

func (QueryParameterDateTimeSecRange) MarshalJSON

func (p QueryParameterDateTimeSecRange) MarshalJSON() ([]byte, error)

MarshalJSON sets the type before marshaling.

func (*QueryParameterDateTimeSecRange) UnmarshalJSON

func (p *QueryParameterDateTimeSecRange) UnmarshalJSON(b []byte) error

UnmarshalJSON clears the type after marshaling.

type QueryParameterEnum

type QueryParameterEnum struct {
	QueryParameter

	Values []string `json:"-"`

	Value   json.RawMessage                      `json:"value"`
	Options string                               `json:"enumOptions"`
	Multi   *QueryParameterMultipleValuesOptions `json:"multiValuesOptions,omitempty"`
}

QueryParameterEnum ...

func (QueryParameterEnum) MarshalJSON

func (p QueryParameterEnum) MarshalJSON() ([]byte, error)

MarshalJSON sets the type before marshaling.

func (*QueryParameterEnum) UnmarshalJSON

func (p *QueryParameterEnum) UnmarshalJSON(b []byte) error

UnmarshalJSON deals with polymorphism of the `value` field.

type QueryParameterMultipleValuesOptions

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

QueryParameterMultipleValuesOptions ...

type QueryParameterNumber

type QueryParameterNumber struct {
	QueryParameter

	Value float64 `json:"value"`
}

QueryParameterNumber ...

func (QueryParameterNumber) MarshalJSON

func (p QueryParameterNumber) MarshalJSON() ([]byte, error)

MarshalJSON sets the type before marshaling.

func (*QueryParameterNumber) UnmarshalJSON

func (p *QueryParameterNumber) UnmarshalJSON(b []byte) error

UnmarshalJSON clears the type after marshaling.

type QueryParameterQuery

type QueryParameterQuery struct {
	QueryParameter

	Values []string `json:"-"`

	Value   json.RawMessage                      `json:"value"`
	QueryID string                               `json:"queryId"`
	Multi   *QueryParameterMultipleValuesOptions `json:"multiValuesOptions,omitempty"`
}

QueryParameterQuery ...

func (QueryParameterQuery) MarshalJSON

func (p QueryParameterQuery) MarshalJSON() ([]byte, error)

MarshalJSON sets the type before marshaling.

func (*QueryParameterQuery) UnmarshalJSON

func (p *QueryParameterQuery) UnmarshalJSON(b []byte) error

UnmarshalJSON deals with polymorphism of the `value` field.

type QueryParameterRangeBase added in v1.7.0

type QueryParameterRangeBase struct {
	QueryParameter

	Value       any            `json:"value"`
	StringValue string         `json:"-"`
	RangeValue  *DateTimeRange `json:"-"`
}

type QueryParameterText

type QueryParameterText struct {
	QueryParameter

	Value string `json:"value"`
}

QueryParameterText ...

func (QueryParameterText) MarshalJSON

func (p QueryParameterText) MarshalJSON() ([]byte, error)

MarshalJSON sets the type before marshaling.

func (*QueryParameterText) UnmarshalJSON

func (p *QueryParameterText) UnmarshalJSON(b []byte) error

UnmarshalJSON clears the type after marshaling.

type QuerySchedule

type QuerySchedule struct {
	// Interval in seconds.
	//
	// For daily schedules, this MUST be a multiple of 86400.
	// For weekly schedules, this MUST be a multiple of 604800.
	//
	Interval int `json:"interval"`

	// Time of day, for daily and weekly schedules.
	Time *string `json:"time"`

	// Day of week, for weekly schedules.
	DayOfWeek *string `json:"day_of_week"`

	// Schedule should be active until this date.
	Until *string `json:"until"`
}

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

type Visualization

type Visualization struct {
	// Visualizations evolved from having integer IDs to string UUIDs.
	// This type supports either in support of a transition without breakage.
	ID stringOrInt `json:"id,omitempty"`

	QueryID     string          `json:"query_id,omitempty"`
	Type        string          `json:"type"`
	Name        string          `json:"name"`
	Description string          `json:"description,omitempty"`
	Options     json.RawMessage `json:"options,omitempty"`
	Query       json.RawMessage `json:"query,omitempty"`
	QueryPlan   json.RawMessage `json:"query_plan,omitempty"`
}

Visualization ...

type Widget

type Widget struct {
	// Widgets evolved from having integer IDs to string UUIDs.
	// This type supports either in support of a transition without breakage.
	ID stringOrInt `json:"id,omitempty"`

	// Widgets are part of a dashboard.
	DashboardID string `json:"dashboard_id"`

	// They are either linked to a query visualization or embed a piece of Markdown text.
	// These fields are mutually exclusive and must be `null` if they don't apply.
	VisualizationID *stringOrInt `json:"visualization_id"`
	Text            *string      `json:"text"`

	// Options apply to both visualization and text widgets.
	Options WidgetOptions `json:"options"`

	// This field is no longer in use, but is still required as part of the schema.
	// It's OK that the field value is 0 everywhere.
	Width int `json:"width"`

	// Fields below are set only when retrieving an existing widget.
	Visualization json.RawMessage `json:"visualization,omitempty"`
}

Widget ...

func (*Widget) UnmarshalJSON

func (w *Widget) UnmarshalJSON(b []byte) error

UnmarshalJSON ...

type WidgetOptions

type WidgetOptions struct {
	ParameterMapping map[string]WidgetParameterMapping `json:"parameterMappings"`
	Position         *WidgetPosition                   `json:"position,omitempty"`
	Title            string                            `json:"title,omitempty"`
	Description      string                            `json:"description,omitempty"`
}

WidgetOptions ...

type WidgetParameterMapping

type WidgetParameterMapping struct {
	Name  string `json:"name"`
	Type  string `json:"type"`
	MapTo string `json:"mapTo,omitempty"`

	// The type of the value depends on the type of the parameter referred to by `name`.
	Value any `json:"value"`

	// This title overrides the title given to this parameter by the query, if specified.
	Title string `json:"title,omitempty"`
}

WidgetParameterMapping ...

type WidgetPosition

type WidgetPosition struct {
	AutoHeight bool `json:"autoHeight"`
	SizeX      int  `json:"sizeX,omitempty"`
	SizeY      int  `json:"sizeY,omitempty"`
	PosX       int  `json:"col"`
	PosY       int  `json:"row"`
}

WidgetPosition ...

Jump to

Keyboard shortcuts

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