globalinitscripts

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

The Global Init Scripts API enables Workspace administrators to configure global initialization scripts for their workspace.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateScriptResponse

type CreateScriptResponse struct {
	// The global init script ID.
	ScriptId string `json:"script_id,omitempty"`
}

type DeleteScript

type DeleteScript struct {
	// The ID of the global init script.
	ScriptId string `json:"-" url:"-"`
}

Delete init script

type GetScript

type GetScript struct {
	// The ID of the global init script.
	ScriptId string `json:"-" url:"-"`
}

Get an init script

type GlobalInitScriptCreateRequest

type GlobalInitScriptCreateRequest struct {
	// Specifies whether the script is enabled. The script runs only if enabled.
	Enabled bool `json:"enabled,omitempty"`
	// The name of the script
	Name string `json:"name"`
	// The position of a global init script, where 0 represents the first script
	// to run, 1 is the second script to run, in ascending order.
	//
	// If you omit the numeric position for a new global init script, it
	// defaults to last position. It will run after all current scripts. Setting
	// any value greater than the position of the last script is equivalent to
	// the last position. Example: Take three existing scripts with positions 0,
	// 1, and 2. Any position of (3) or greater puts the script in the last
	// position. If an explicit position value conflicts with an existing script
	// value, your request succeeds, but the original script at that position
	// and all later scripts have their positions incremented by 1.
	Position int `json:"position,omitempty"`
	// The Base64-encoded content of the script.
	Script string `json:"script"`
}

type GlobalInitScriptDetails

type GlobalInitScriptDetails struct {
	// Time when the script was created, represented as a Unix timestamp in
	// milliseconds.
	CreatedAt int `json:"created_at,omitempty"`
	// The username of the user who created the script.
	CreatedBy string `json:"created_by,omitempty"`
	// Specifies whether the script is enabled. The script runs only if enabled.
	Enabled bool `json:"enabled,omitempty"`
	// The name of the script
	Name string `json:"name,omitempty"`
	// The position of a script, where 0 represents the first script to run, 1
	// is the second script to run, in ascending order.
	Position int `json:"position,omitempty"`
	// The global init script ID.
	ScriptId string `json:"script_id,omitempty"`
	// Time when the script was updated, represented as a Unix timestamp in
	// milliseconds.
	UpdatedAt int `json:"updated_at,omitempty"`
	// The username of the user who last updated the script
	UpdatedBy string `json:"updated_by,omitempty"`
}

type GlobalInitScriptDetailsWithContent

type GlobalInitScriptDetailsWithContent struct {
	// Time when the script was created, represented as a Unix timestamp in
	// milliseconds.
	CreatedAt int `json:"created_at,omitempty"`
	// The username of the user who created the script.
	CreatedBy string `json:"created_by,omitempty"`
	// Specifies whether the script is enabled. The script runs only if enabled.
	Enabled bool `json:"enabled,omitempty"`
	// The name of the script
	Name string `json:"name,omitempty"`
	// The position of a script, where 0 represents the first script to run, 1
	// is the second script to run, in ascending order.
	Position int `json:"position,omitempty"`
	// The Base64-encoded content of the script.
	Script string `json:"script,omitempty"`
	// The global init script ID.
	ScriptId string `json:"script_id,omitempty"`
	// Time when the script was updated, represented as a Unix timestamp in
	// milliseconds.
	UpdatedAt int `json:"updated_at,omitempty"`
	// The username of the user who last updated the script
	UpdatedBy string `json:"updated_by,omitempty"`
}

type GlobalInitScriptUpdateRequest

type GlobalInitScriptUpdateRequest struct {
	// Specifies whether the script is enabled. The script runs only if enabled.
	Enabled bool `json:"enabled,omitempty"`
	// The name of the script
	Name string `json:"name,omitempty"`
	// The position of a script, where 0 represents the first script to run, 1
	// is the second script to run, in ascending order. To move the script to
	// run first, set its position to 0.
	//
	// To move the script to the end, set its position to any value greater or
	// equal to the position of the last script. Example, three existing scripts
	// with positions 0, 1, and 2. Any position value of 2 or greater puts the
	// script in the last position (2).
	//
	// If an explicit position value conflicts with an existing script, your
	// request succeeds, but the original script at that position and all later
	// scripts have their positions incremented by 1.
	Position int `json:"position,omitempty"`
	// The Base64-encoded content of the script.
	Script string `json:"script,omitempty"`
	// The ID of the global init script.
	ScriptId string `json:"-" url:"-"`
}

type GlobalInitScriptsAPI

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

The Global Init Scripts API enables Workspace administrators to configure global initialization scripts for their workspace. These scripts run on every node in every cluster in the workspace.

**Important:** Existing clusters must be restarted to pick up any changes made to global init scripts. Global init scripts are run in order. If the init script returns with a bad exit code, the Apache Spark container fails to launch and init scripts with later position are skipped. If enough containers fail, the entire cluster fails with a `GLOBAL_INIT_SCRIPT_FAILURE` error code.

func NewGlobalInitScripts

func NewGlobalInitScripts(client *client.DatabricksClient) *GlobalInitScriptsAPI

func (*GlobalInitScriptsAPI) CreateScript

Create init script

Creates a new global init script in this workspace.

func (*GlobalInitScriptsAPI) DeleteScript

func (a *GlobalInitScriptsAPI) DeleteScript(ctx context.Context, request DeleteScript) error

Delete init script

Deletes a global init script.

func (*GlobalInitScriptsAPI) DeleteScriptByScriptId

func (a *GlobalInitScriptsAPI) DeleteScriptByScriptId(ctx context.Context, scriptId string) error

Delete init script

Deletes a global init script.

func (*GlobalInitScriptsAPI) GetByName

GetByName calls GlobalInitScriptsAPI.GlobalInitScriptDetailsNameToScriptIdMap and returns a single GlobalInitScriptDetails.

Returns an error if there's more than one GlobalInitScriptDetails with the same .Name.

Note: All GlobalInitScriptDetails instances are loaded into memory before returning matching by name.

This method is generated by Databricks SDK Code Generator.

func (*GlobalInitScriptsAPI) GetScript

Get an init script

Gets all the details of a script, including its Base64-encoded contents.

func (*GlobalInitScriptsAPI) GetScriptByScriptId

func (a *GlobalInitScriptsAPI) GetScriptByScriptId(ctx context.Context, scriptId string) (*GlobalInitScriptDetailsWithContent, error)

Get an init script

Gets all the details of a script, including its Base64-encoded contents.

func (*GlobalInitScriptsAPI) GlobalInitScriptDetailsNameToScriptIdMap

func (a *GlobalInitScriptsAPI) GlobalInitScriptDetailsNameToScriptIdMap(ctx context.Context) (map[string]string, error)

GlobalInitScriptDetailsNameToScriptIdMap calls GlobalInitScriptsAPI.ListScriptsAll and creates a map of results with GlobalInitScriptDetails.Name as key and GlobalInitScriptDetails.ScriptId as value.

Returns an error if there's more than one GlobalInitScriptDetails with the same .Name.

Note: All GlobalInitScriptDetails instances are loaded into memory before creating a map.

This method is generated by Databricks SDK Code Generator.

func (*GlobalInitScriptsAPI) Impl

Impl returns low-level GlobalInitScripts API implementation

func (*GlobalInitScriptsAPI) ListScriptsAll

Get init scripts

"Get a list of all global init scripts for this workspace. This returns all properties for each script but **not** the script contents. To retrieve the contents of a script, use the [get a global init script](#operation/get-script) operation.

This method is generated by Databricks SDK Code Generator.

func (*GlobalInitScriptsAPI) UpdateScript

Update init script

Updates a global init script, specifying only the fields to change. All fields are optional. Unspecified fields retain their current value.

func (*GlobalInitScriptsAPI) WithImpl

WithImpl could be used to override low-level API implementations for unit testing purposes with github.com/golang/mock or other mocking frameworks.

type GlobalInitScriptsService

type GlobalInitScriptsService interface {

	// Create init script
	//
	// Creates a new global init script in this workspace.
	CreateScript(ctx context.Context, request GlobalInitScriptCreateRequest) (*CreateScriptResponse, error)

	// Delete init script
	//
	// Deletes a global init script.
	DeleteScript(ctx context.Context, request DeleteScript) error

	// Get an init script
	//
	// Gets all the details of a script, including its Base64-encoded contents.
	GetScript(ctx context.Context, request GetScript) (*GlobalInitScriptDetailsWithContent, error)

	// Get init scripts
	//
	// "Get a list of all global init scripts for this workspace. This returns
	// all properties for each script but **not** the script contents. To
	// retrieve the contents of a script, use the [get a global init
	// script](#operation/get-script) operation.
	//
	// Use ListScriptsAll() to get all GlobalInitScriptDetails instances
	ListScripts(ctx context.Context) (*ListGlobalInitScriptsResponse, error)

	// Update init script
	//
	// Updates a global init script, specifying only the fields to change. All
	// fields are optional. Unspecified fields retain their current value.
	UpdateScript(ctx context.Context, request GlobalInitScriptUpdateRequest) error
}

The Global Init Scripts API enables Workspace administrators to configure global initialization scripts for their workspace. These scripts run on every node in every cluster in the workspace.

**Important:** Existing clusters must be restarted to pick up any changes made to global init scripts. Global init scripts are run in order. If the init script returns with a bad exit code, the Apache Spark container fails to launch and init scripts with later position are skipped. If enough containers fail, the entire cluster fails with a `GLOBAL_INIT_SCRIPT_FAILURE` error code.

type ListGlobalInitScriptsResponse

type ListGlobalInitScriptsResponse struct {
	Scripts []GlobalInitScriptDetails `json:"scripts,omitempty"`
}

Jump to

Keyboard shortcuts

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