salt

package
v0.0.0-...-e1524c0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncJobFailed

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

func (*AsyncJobFailed) Error

func (self *AsyncJobFailed) Error() string

type AuthType

type AuthType string
const (
	Bearer AuthType = "Bearer"
)

Supported SaltAPI authentication methods.

type Client

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

A Salt API client.

func NewClient

func NewClient(creds *Credential, caCertData []byte) (*Client, error)

Create a new Salt API client.

func (*Client) GetDeviceInfo

func (self *Client) GetDeviceInfo(
	ctx context.Context, nodeName string, volumeName string,
) (*JobHandle, error)

Return the info of the specified device on the given node.

This request is asynchronous.

Arguments

ctx:        the request context (used for cancellation)
nodeName:   name of the node where the volume will be
volumeName: name of the volume to target

Returns

The Salt job handle.

func (*Client) GetDeviceName

func (self *Client) GetDeviceName(
	ctx context.Context, nodeName string, volumeName string, devicePath string,
) (string, error)

Return the name of the block device designed by `devicePath`.

This request is synchronous.

Arguments

ctx:        the request context (used for cancellation)
nodeName:   name of the node where the device is
volumeName: name of the associated volume
devicePath: path of the device for which we want the name

Returns

The Salt job handle.

func (*Client) PollJob

func (self *Client) PollJob(
	ctx context.Context, job *JobHandle, nodeName string,
) (map[string]interface{}, error)

Poll the status of an asynchronous Salt job.

Arguments

ctx:      the request context (used for cancellation)
job:      Salt job handle
nodeName: node on which the job is executed

Returns

The result of the job if the execution is over, otherwise nil.

func (*Client) PrepareVolume

func (self *Client) PrepareVolume(
	ctx context.Context, nodeName string, volumeName string, saltenv string,
) (*JobHandle, error)

Spawn a job, asynchronously, to prepare the volume on the specified node.

Arguments

ctx:        the request context (used for cancellation)
nodeName:   name of the node where the volume will be
volumeName: name of the volume to prepare
saltenv:    saltenv to use

Returns

The Salt job handle.

func (*Client) UnprepareVolume

func (self *Client) UnprepareVolume(
	ctx context.Context, nodeName string, volumeName string, saltenv string,
) (*JobHandle, error)

Spawn a job, asynchronously, to unprepare the volume on the specified node.

Arguments

ctx:      the request context (used for cancellation)
nodeName: name of the node where the volume will be
volumeName: name of the volume to prepare
saltenv:    saltenv to use

Returns

The Salt job handle.

type Credential

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

Credentials for Salt API.

func NewCredential

func NewCredential(username string, secret string, authType AuthType) *Credential

Create a new Salt API client.

Arguments

username: user name
secret:   user token or password (interpretation depends on authType)
authType: authentication method

type JobHandle

type JobHandle struct {
	Name string
	ID   string
}

A Salt job handle.

func JobFromString

func JobFromString(s string) (*JobHandle, error)

func (*JobHandle) String

func (job *JobHandle) String() string

Get the string representation of a job handle.

Jump to

Keyboard shortcuts

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