Documentation
¶
Index ¶
- type AsyncJobFailed
- type AuthType
- type Client
- func (self *Client) GetDeviceInfo(ctx context.Context, nodeName string, volumeName string) (*JobHandle, error)
- func (self *Client) GetDeviceName(ctx context.Context, nodeName string, volumeName string, devicePath string) (string, error)
- func (self *Client) PollJob(ctx context.Context, job *JobHandle, nodeName string) (map[string]interface{}, error)
- func (self *Client) PrepareVolume(ctx context.Context, nodeName string, volumeName string, saltenv string) (*JobHandle, error)
- func (self *Client) UnprepareVolume(ctx context.Context, nodeName string, volumeName string, saltenv string) (*JobHandle, error)
- type Credential
- type JobHandle
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
Click to show internal directories.
Click to hide internal directories.