Documentation
¶
Overview ¶
The Global Init Scripts API enables Workspace administrators to configure global initialization scripts for their workspace.
Index ¶
- type CreateResponse
- type Delete
- type Get
- type GlobalInitScriptCreateRequest
- type GlobalInitScriptDetails
- type GlobalInitScriptDetailsWithContent
- type GlobalInitScriptUpdateRequest
- type GlobalInitScriptsAPI
- func (a *GlobalInitScriptsAPI) Create(ctx context.Context, request GlobalInitScriptCreateRequest) (*CreateResponse, error)
- func (a *GlobalInitScriptsAPI) Delete(ctx context.Context, request Delete) error
- func (a *GlobalInitScriptsAPI) DeleteByScriptId(ctx context.Context, scriptId string) error
- func (a *GlobalInitScriptsAPI) Get(ctx context.Context, request Get) (*GlobalInitScriptDetailsWithContent, error)
- func (a *GlobalInitScriptsAPI) GetByName(ctx context.Context, name string) (*GlobalInitScriptDetails, error)
- func (a *GlobalInitScriptsAPI) GetByScriptId(ctx context.Context, scriptId string) (*GlobalInitScriptDetailsWithContent, error)
- func (a *GlobalInitScriptsAPI) GlobalInitScriptDetailsNameToScriptIdMap(ctx context.Context) (map[string]string, error)
- func (a *GlobalInitScriptsAPI) Impl() GlobalInitScriptsService
- func (a *GlobalInitScriptsAPI) ListAll(ctx context.Context) ([]GlobalInitScriptDetails, error)
- func (a *GlobalInitScriptsAPI) Update(ctx context.Context, request GlobalInitScriptUpdateRequest) error
- func (a *GlobalInitScriptsAPI) WithImpl(impl GlobalInitScriptsService) *GlobalInitScriptsAPI
- type GlobalInitScriptsService
- type ListGlobalInitScriptsResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateResponse ¶ added in v0.2.0
type CreateResponse struct {
// The global init script ID.
ScriptId string `json:"script_id,omitempty"`
}
type Delete ¶ added in v0.2.0
type Delete struct {
// The ID of the global init script.
ScriptId string `json:"-" url:"-"`
}
Delete init script
type Get ¶ added in v0.2.0
type Get 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"`
// 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"`
// 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) Create ¶ added in v0.2.0
func (a *GlobalInitScriptsAPI) Create(ctx context.Context, request GlobalInitScriptCreateRequest) (*CreateResponse, error)
Create init script.
Creates a new global init script in this workspace.
func (*GlobalInitScriptsAPI) Delete ¶ added in v0.2.0
func (a *GlobalInitScriptsAPI) Delete(ctx context.Context, request Delete) error
Delete init script.
Deletes a global init script.
func (*GlobalInitScriptsAPI) DeleteByScriptId ¶ added in v0.2.0
func (a *GlobalInitScriptsAPI) DeleteByScriptId(ctx context.Context, scriptId string) error
Delete init script.
Deletes a global init script.
func (*GlobalInitScriptsAPI) Get ¶ added in v0.2.0
func (a *GlobalInitScriptsAPI) Get(ctx context.Context, request Get) (*GlobalInitScriptDetailsWithContent, error)
Get an init script.
Gets all the details of a script, including its Base64-encoded contents.
func (*GlobalInitScriptsAPI) GetByName ¶
func (a *GlobalInitScriptsAPI) GetByName(ctx context.Context, name string) (*GlobalInitScriptDetails, error)
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) GetByScriptId ¶ added in v0.2.0
func (a *GlobalInitScriptsAPI) GetByScriptId(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.ListAll 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 ¶
func (a *GlobalInitScriptsAPI) Impl() GlobalInitScriptsService
Impl returns low-level GlobalInitScripts API implementation
func (*GlobalInitScriptsAPI) ListAll ¶ added in v0.2.0
func (a *GlobalInitScriptsAPI) ListAll(ctx context.Context) ([]GlobalInitScriptDetails, 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.
This method is generated by Databricks SDK Code Generator.
func (*GlobalInitScriptsAPI) Update ¶ added in v0.2.0
func (a *GlobalInitScriptsAPI) Update(ctx context.Context, request GlobalInitScriptUpdateRequest) 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.
func (*GlobalInitScriptsAPI) WithImpl ¶
func (a *GlobalInitScriptsAPI) WithImpl(impl GlobalInitScriptsService) *GlobalInitScriptsAPI
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.
Create(ctx context.Context, request GlobalInitScriptCreateRequest) (*CreateResponse, error)
// Delete init script.
//
// Deletes a global init script.
Delete(ctx context.Context, request Delete) error
// Get an init script.
//
// Gets all the details of a script, including its Base64-encoded contents.
Get(ctx context.Context, request Get) (*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 ListAll() to get all GlobalInitScriptDetails instances
List(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.
Update(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"`
}