rundeck

package module
v0.0.0-...-64574ac Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2018 License: MIT Imports: 13 Imported by: 0

README

go-rundeck

Testing

Use the supplied Vagrantfile to spin up a local instance of Rundeck. Login to http://localhost:4440 using admin and admin as the username and password. Create an API token and set that to an environment variable called RUNDECK_TOKEN.

This environment variable must be set in the same session as running the tests, otherwise the tests will fail to authenticate with the containerized instance of Rundeck.

Documentation

Index

Constants

View Source
const (
	// APIVersion24 is defaulted to the specified api version
	APIVersion24 = 24

	// EnvRundeckToken sets the name of the environment variable to read
	EnvRundeckToken = "RUNDECK_TOKEN"

	// EnvRundeckServerURL is the name of the environment variable for the server url
	EnvRundeckServerURL = "RUNDECK_SERVER_URL"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ACL

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

ACL in information about API submitted ACLs, not hard-disk ACLs

func (*ACL) Create

func (a *ACL) Create(name string, policy []byte) error

Create is used to create an ACL policy

func (*ACL) Delete

func (a *ACL) Delete(name string) error

Delete removes an ACL polciy file

func (*ACL) Get

func (a *ACL) Get(name string) ([]byte, error)

Get retrieves the YAML text of the ACL Policy file. The contents of the file as a []byte will be returned.

func (*ACL) List

func (a *ACL) List() (*ListACLsResponse, error)

List returns an overview of the API submitted ACLs

func (*ACL) Update

func (a *ACL) Update(name string, policy []byte) error

Update updates an existing acl policy

type ACLResource

type ACLResource struct {
	Path string `json:"path"`
	Type string `json:"type"`
	Name string `json:"name"`
	HREF string `json:"href"`
}

ACLResource is an element in the resources portion of the ListACLsReponse payload.

type Abort

type Abort struct {
	Status AbortState `json:"status"`
	Reason string     `json:"reason"`
}

Abort contains the state and reason for the abort

type AbortExecutionResponse

type AbortExecutionResponse struct {
	Abort     Abort     `json:"abort"`
	Execution Execution `json:"execution"`
}

AbortExecutionResponse ...

type AbortState

type AbortState string

AbortState will be one of "pending", "failed", or "aborted"

const (
	AbortStatePending AbortState = "pending"
	AbortStateFailed  AbortState = "failed"
	AbortStateAborted AbortState = "aborted"
)

type AdhocAPI

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

AdhocAPI interacts with the adhoc endpoints

func (*AdhocAPI) RunCommandString

func (a *AdhocAPI) RunCommandString(input *AdhocCommandStringInput) (*AdhocCommandResponse, error)

RunCommandString runs an adhoc command

func (*AdhocAPI) RunScript

func (a *AdhocAPI) RunScript(input *AdhocScriptInput) (*AdhocCommandResponse, error)

RunScript runs a script

func (*AdhocAPI) RunURL

func (a *AdhocAPI) RunURL(input *AdhocURLInput) (*AdhocCommandResponse, error)

RunURL runs a script downloaded from a url

type AdhocCommandResponse

type AdhocCommandResponse struct {
	Message   string    `json:"message"`
	Execution Execution `json:"execution"`
}

AdhocCommandResponse ...

type AdhocCommandStringInput

type AdhocCommandStringInput struct {
	Exec string `json:"exec"`
	AdhocOptions
}

AdhocCommandStringInput ...

type AdhocOptions

type AdhocOptions struct {
	Project         string `json:"project"`
	NodeThreadcount int    `json:"nodeThreadcount,omitempty"`
	NodeKeepGoing   bool   `json:"nodeKeepgoing,omitempty"`
	AsUser          string `json:"asUser,omitempty"`
	Filter          string `json:"filter,omitempty"`
}

type AdhocScriptInput

type AdhocScriptInput struct {
	Script string `json:"script"`
	AdhocOptions
	AdhocScriptOptions
}

AdhocScriptInput ...

type AdhocScriptOptions

type AdhocScriptOptions struct {
	ArgString             string `json:"argString,omitempty"`
	ScriptInterpreter     string `json:"scriptInterpreter,omitempty"`
	InterpreterArgsQuoted bool   `json:"interpreterArgsQuoted,omitempty"`
	FileExtension         string `json:"fileExtension,omitempty"`
}

type AdhocURLInput

type AdhocURLInput struct {
	URL string `json:"url"`
	AdhocOptions
	AdhocScriptOptions
}

AdhocURLInput ...

type ArchiveExportAsyncStatusResponse

type ArchiveExportAsyncStatusResponse struct {
	Token      string `json:"token"`
	Ready      bool   `json:"ready"`
	Percentage int    `json:"int"`
}

ArchiveExportAsyncStatusResponse struct

type ArchiveExportInput

type ArchiveExportInput struct {
	ExecutionIDs     []int
	ExportAll        bool
	ExportJobs       bool
	ExportExecutions bool
	ExportConfigs    bool
	ExportReadmes    bool
	ExportAcls       bool
}

ArchiveExportInput ...

type ArchiveImportInput

type ArchiveImportInput struct {
	JobUUIDOption    UUIDOption
	ImportExecutions bool
	ImportConfig     bool
	ImportACL        bool
}

ArchiveImportInput are option parameters for importing a project archive

type ArchiveImportResponse

type ArchiveImportResponse struct {
	ImportStatus    Status   `json:"import_status"`
	Errors          []string `json:"errors"`
	ExecutionErrors []string `json:"execution_errors"`
	ACLErrors       []string `json:"acl_errors"`
}

ArchiveImportResponse ...

type Boolean

type Boolean int

Boolean often times have more than 2 values

const (
	BooleanDefault Boolean = iota
	BooleanFalse
	BooleanTrue
)

type BulkModifyInput

type BulkModifyInput struct {
	IDs []string `json:"ids"`
}

BulkModifyInput contains a string slice of ids to modify in bulk

type BulkModifyObject

type BulkModifyObject struct {
	ID        string `json:"id"`
	ErrorCode string `json:"errorCode"`
	Message   string `json:"message"`
}

BulkModifyObject is an object in the BulkModifyResponse slices

type BulkModifyResponse

type BulkModifyResponse struct {
	RequestCount  int                 `json:"requestCount"`
	AllSuccessful bool                `json:"allsuccessful"`
	Enabled       bool                `json:"enabled,omitempty"`
	Succeeded     []*BulkModifyObject `json:"successful,omitempty"`
	Failed        []*BulkModifyObject `json:"failed,omitempty"`
}

BulkModifyResponse is the response body from the bulk modify endpoint

type CPUStats

type CPUStats struct {
	LoadAverage LoadAverageStats `json:"loadAverage"`
	Processors  int              `json:"processors"`
}

CPUStats are basic stats about the CPU usage

type Client

type Client struct {
	Config *Config

	RundeckAddr string
	// contains filtered or unexported fields
}

Client is the basic client that interacts with the Rundeck API.

func NewClient

func NewClient(config *Config) *Client

NewClient returns a rundeck client

If config is nil, then the configuration from DefaultConfig() will be used. DefaultConfig() assumes that the environment variable RUNDECK_TOKEN is set, and that its value is a valid Rundeck API token.

func (*Client) ACL

func (c *Client) ACL() *ACL

ACL interacts with the ACL API

func (*Client) Adhoc

func (c *Client) Adhoc() *AdhocAPI

Adhoc restuns and adhoc api client

func (*Client) ClusterScheduler

func (c *Client) ClusterScheduler() *ClusterScheduler

ClusterScheduler interacts with the cluster endpoints on Rundeck

func (*Client) Executions

func (c *Client) Executions() *Executions

Executions interacts with endpoints pertaining to executions

func (*Client) Jobs

func (c *Client) Jobs() *Jobs

Jobs interacts with endpoints pertaining to jobs

func (*Client) KeyStorage

func (c *Client) KeyStorage() *KeyStore

KeyStorage returns a keystore for use

func (*Client) LogStore

func (c *Client) LogStore() *LogStore

LogStore interacts with the according API

func (*Client) Projects

func (c *Client) Projects() *Projects

Projects interacts with endpoints pertaining to projects

func (*Client) SetAPIToken

func (c *Client) SetAPIToken(token string)

SetAPIToken will update the token (and associated client transport for the API calls)

func (*Client) System

func (c *Client) System() *System

System interacts with the system api

func (*Client) Tokens

func (c *Client) Tokens() *Tokens

Tokens is used to return the client for token specific API operations

func (*Client) Users

func (c *Client) Users() *Users

Users interacts with the User profile API

type ClusterScheduler

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

ClusterScheduler contains information relating to cluster mode in Rundeck

func (*ClusterScheduler) ListScheduledJobs

func (cs *ClusterScheduler) ListScheduledJobs(uuid *string) ([]*Job, error)

ListScheduledJobs lists scheduled jobs with the schedule owned by the server with the specified uuid. If uuid is nil, then the client server will be used.

func (*ClusterScheduler) TakeoverSchedule

func (cs *ClusterScheduler) TakeoverSchedule(input *TakeoverScheduleInput) (*TakeoverScheduleResponse, error)

TakeoverSchedule tells the Rundeck server in cluster mode to claim scheduled jobs from another cluster server

type Config

type Config struct {
	// ServerURL is expected in the given format, ie: http://localhost:4440, or https://my.rundeck.com.
	ServerURL string

	// APIVersion is the version of the api you want to use.
	APIVersion int

	// RundeckAuthToken is the authentication token used to communicate with Rundeck
	RundeckAuthToken string
}

Config is the basic configuration needed by the client to communicate with Rundeck

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig implements a localhost basic configuration, relying on and assuming a valid api token set in the environment variable RUNDECK_TOKEN.

The environment variable RUNDECK_SERVER_URL will be used if it is present, otherwise http://localhost:4440 will be used as the server url.

type CreateProjectInput

type CreateProjectInput struct {
	Name        string            `json:"name"`
	Description string            `json:"description,omitempty"`
	Config      map[string]string `json:"config,omitempty"`
}

CreateProjectInput is the payload when posting for project creation

type DeleteExecutionsResponse

type DeleteExecutionsResponse struct {
	Failures []struct {
		ID      string `json:"id"`
		Message string `json:"message"`
	} `json:"failures"`
	FailedCount   int  `json:"failedCount"`
	SuccessCount  int  `json:"successCount"`
	AllSuccessful bool `json:"allsuccessful"`
	RequestCount  int  `json:"requestCount"`
}

DeleteExecutionsResponse contains information about the success and failures of the delete operation

type DuplicateOption

type DuplicateOption string

DuplicateOption instructs the job importer how to handle duplicate jobs

const (
	DuplicateOptionSkip   DuplicateOption = "skip"
	DuplicateOptionCreate DuplicateOption = "create"
	DuplicateOptionUpdate DuplicateOption = "update"
)

type Error

type Error struct {
	ErrorPresent bool   `json:"error"`
	APIVersion   int    `json:"apiversion"`
	ErrorCode    string `json:"errorCode"`
	Message      string `json:"message"`
}

Error is what Rundeck returns given a bad API call

func (Error) Error

func (e Error) Error() string

Error marshals the struct into a json string

type Execution

type Execution struct {
	ID              int                `json:"id"`
	HREF            string             `json:"href"`
	Permalink       string             `json:"permalink"`
	Status          ExecutionStatus    `json:"status"`
	CustomStatus    string             `json:"customStatus"`
	Project         string             `json:"project"`
	User            string             `json:"user"`
	ServerUUID      string             `json:"serverUUID"`
	DateStarted     ExecutionTimestamp `json:"date-started"`
	DateEnded       ExecutionTimestamp `json:"date-ended"`
	Job             Job                `json:"job"`
	Description     string             `json:"description"`
	ArgString       string             `json:"argstring"`
	Storage         LogStorageMetadata `json:"storage"`
	SuccessfulNodes []string           `json:"successfulNodes"`
	FailedNodes     []string           `json:"failedNodes"`
	Errors          []string           `json:"errors"`
}

Execution is information regarding an execution

type ExecutionMode

type ExecutionMode string

ExecutionMode informs the whether or not rundeck can execute jobs

const (
	ExecutionModeActive  ExecutionMode = "active"
	ExecutionModePassive ExecutionMode = "passive"
)

type ExecutionModeResponse

type ExecutionModeResponse struct {
	Active        bool          `json:"active"`
	ExecutionMode ExecutionMode `json:"executionMode"`
}

ExecutionModeResponse is information about the rundeck server's ability to execute jobs

type ExecutionQueryInput

type ExecutionQueryInput struct {
	PagingInfo
	Status                ExecutionStatus
	AbortedBy             string
	User                  string
	RecentFilter          string
	OlderFilter           string
	Begin                 *time.Time // unix ms
	End                   *time.Time // unix ms
	AdHoc                 Boolean
	JobIDList             []string
	ExcludeJobIDList      []string
	JobList               []string
	ExcludeJobList        []string
	GroupPath             string
	GroupPathExact        string
	ExcludeGroupPath      string
	ExcludeGroupPathExact string
	JobName               string
	ExcludeJobName        string
	JobNameExact          string
	ExcludeJobNameExact   string
	ExecutionType         ExecutionType
}

ExecutionQueryInput are parameters to narrow down the result set of a query operation

type ExecutionState

type ExecutionState string

ExecutionState is the state of the execution

const (
	ExecutionStateWaiting              ExecutionState = "WAITING"
	ExecutionStateRunning              ExecutionState = "RUNNING"
	ExecutionStateRunningHandler       ExecutionState = "RUNNING_HANDLER"
	ExecutionStateSucceeded            ExecutionState = "SUCCEEDED"
	ExecutionStateFailed               ExecutionState = "FAILED"
	ExecutionStateAborted              ExecutionState = "ABORTED"
	ExecutionStateNodePartialSucceeded ExecutionState = "NODE_PARTIAL_SUCCEEDED"
	ExecutionStateNodeMixed            ExecutionState = "NODE_MIXED"
	ExecutionStateNotStarted           ExecutionState = "NOT_STARTED"
)

type ExecutionStateIndicator

type ExecutionStateIndicator struct {
	ExecutionState        ExecutionState `json:"executionState"`
	StepContextIdentifier string         `json:"stepctx"`
}

ExecutionStateIndicator ...

type ExecutionStateInfo

type ExecutionStateInfo struct {
	StartTime      time.Time      `json:"startTime"`
	EndTime        time.Time      `json:"endTime"`
	UpdateTime     time.Time      `json:"updateTime"`
	ExecutionState ExecutionState `json:"executionState"`
}

ExecutionStateInfo ...

type ExecutionStateResponse

type ExecutionStateResponse struct {
	ExecutionStateInfo
	ExecutionWorkflow
	AllNodes    []string                           `json:"allNodes"`
	Nodes       map[string]ExecutionStateIndicator `json:"nodes"`
	ServerNode  string                             `json:"serverNode"`
	ExecutionID int                                `json:"executionId"`
	Completed   bool                               `json:"completed"`
}

ExecutionStateResponse ...

type ExecutionStatus

type ExecutionStatus string

ExecutionStatus ensure a constant is used in parameters

const (
	ExecutionStatusRunning         ExecutionStatus = "running"
	ExecutionStatusSucceeded       ExecutionStatus = "succeeded"
	ExecutionStatusFailed          ExecutionStatus = "failed"
	ExecutionStatusAborted         ExecutionStatus = "aborted"
	ExecutionStatusTimedout        ExecutionStatus = "timedout"
	ExecutionStatusFailedWithRetry ExecutionStatus = "failed-with-retry"
	ExecutionStatusScheduled       ExecutionStatus = "scheduled"
	ExecutionStatusOther           ExecutionStatus = "other"
)

type ExecutionStepState

type ExecutionStepState struct {
	ExecutionStateInfo
	ID                    string                        `json:"id"`
	StepContextIdentifier string                        `json:"stepctx"`
	NodeStep              bool                          `json:"nodeStep"`
	NodeStates            map[string]ExecutionStateInfo `json:"nodeStates"`
	HasSubworkflow        bool                          `json:"hasSubworkflow"`
	Workflow              ExecutionWorkflow             `json:"workflow"`
}

ExecutionStepState ...

type ExecutionTimestamp

type ExecutionTimestamp struct {
	UnixTime int64     `json:"unixtime"`
	Date     time.Time `json:"date"`
}

ExecutionTimestamp is basic time metadata

type ExecutionType

type ExecutionType string

ExecutionType ensure a constant is used in parameters

const (
	ExecutionTypeScheduled     ExecutionType = "scheduled"
	ExecutionTypeUser          ExecutionType = "user"
	ExecutionTypeUserScheduled ExecutionType = "user-scheduled"
)

type ExecutionWorkflow

type ExecutionWorkflow struct {
	StepCount   int                  `json:"stepCount"`
	TargetNodes []string             `json:"targetNodes"`
	Steps       []ExecutionStepState `json:"steps"`
}

ExecutionWorkflow ...

type Executions

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

Executions is information pertaining to executions API endpoints

func (*Executions) Abort

func (e *Executions) Abort(id int, asUser *string) (*AbortExecutionResponse, error)

Abort aborts a running execution by id

func (*Executions) BulkDelete

func (e *Executions) BulkDelete(ids []int) (*DeleteExecutionsResponse, error)

BulkDelete deletes a set of executions by their ids

func (*Executions) Delete

func (e *Executions) Delete(id int) error

Delete deletes an execution by id

func (*Executions) DeleteExecutions

func (e *Executions) DeleteExecutions(id int) (*DeleteExecutionsResponse, error)

DeleteExecutions deletes all executions for a job

func (*Executions) GetExecutionsForAJob

func (e *Executions) GetExecutionsForAJob(id int, status *string, paging *PagingInfo) (*ExecutionsResponse, error)

GetExecutionsForAJob returns the executions pertaining to a certain job

func (*Executions) Info

func (e *Executions) Info(id int) (*Execution, error)

Info returns information about the specific execution

func (*Executions) ListInputFiles

func (e *Executions) ListInputFiles(id int) (*UploadedFilesResponse, error)

ListInputFiles lists input ifle sused for an execution

func (*Executions) ListRunningExecutions

func (e *Executions) ListRunningExecutions(project string) (*ExecutionsResponse, error)

ListRunningExecutions returns running executions for the specified project ("*" for all projects)

func (*Executions) Output

Output gets the output for an execution by ID. The execution can be currently running or may have already completed. Output can be filtered down to a specific node or workflow step.

func (*Executions) OutputWithState

func (e *Executions) OutputWithState(id int, stateOnly bool) (*ExecutionsOutputResponse, error)

OutputWithState get the metadata associated with workflow step state changes along with the log output, optionally excluding log output.

func (*Executions) Query

func (e *Executions) Query(project string, input *ExecutionQueryInput) (*ExecutionsResponse, error)

Query queries for executions based on job or execution details

func (*Executions) State

func (e *Executions) State(id int) (*ExecutionStateResponse, error)

State gets detailed about the node and step state of an execution by ID. The execution can be currently running or completed.

type ExecutionsOutputInput

type ExecutionsOutputInput struct {
	Node        string
	StepContext string
	Offset      int
	LastLines   int
	LastMod     *time.Time
	Compacted   bool
}

ExecutionsOutputInput ...

type ExecutionsOutputResponse

type ExecutionsOutputResponse struct {
	ID             string         `json:"id"`
	Message        string         `json:"message"`
	Error          string         `json:"error"`
	Unmodified     bool           `json:"unmodified"`
	Empty          bool           `json:"empty"`
	Offset         string         `json:"offset"`
	Completed      bool           `json:"completed"`
	ExecCompleted  bool           `json:"execCompleted"`
	HasFailedNodes bool           `json:"hasFailedNodes"`
	ExecutionState ExecutionState `json:"execState"`
	LastModified   string         `json:"lastModified"`
	ExecDuration   int64          `json:"execDuration"`
	PercentLoaded  float32        `json:"percentLoaded"`
	TotalSize      int            `json:"totalSize"`
	// Filter?  NodeName StepContext?
	Compacted     bool        `json:"compacted"`
	CompactedAttr string      `json:"compactedAttr"`
	Entries       []*LogEntry `json:"entries"`
}

ExecutionsOutputResponse ...

type ExecutionsResponse

type ExecutionsResponse struct {
	PagingInfo `json:"paging"`
	Executions []*Execution `json:"executions"`
}

ExecutionsResponse contains paging information as well as executions

type ExportJobsInput

type ExportJobsInput struct {
	Format    JobFormat
	IDList    []string
	GroupPath string
	JobFilter string
}

ExportJobsInput are the optional parameters for the export endpoint

type FileOption

type FileOption struct {
	ID             string    `json:"id"`
	User           string    `json:"user"`
	FileState      FileState `json:"fileState"`
	SHA            string    `json:"sha"`
	JobID          string    `json:"jobId"`
	DateCreated    time.Time `json:"dateCreated"`
	ServerNodeUUID string    `json:"serverNodeUUID"`
	FileName       *string   `json:"fileName"`
	Size           int64     `json:"size"`
	ExpirationDate time.Time `json:"expirationDate"`
	ExecID         *int64    `json:"execId"`
}

FileOption is the metadata about a file that was uploaded for a job option

type FileState

type FileState string

FileState informs the state of the uploaded file

const (
	FileStateTemp     FileState = "temp"
	FileStateDeleted  FileState = "deleted"
	FileStateExpired  FileState = "expired"
	FileStateRetained FileState = "retained"
)

type HealthCheck

type HealthCheck struct {
	HREF        string `json:"href"`
	ContentType string `json:"contentType"`
}

HealthCheck contains a urll to a page regarding health information

type ImportJobsInput

type ImportJobsInput struct {
	FileFormat      JobFormat
	DuplicateOption DuplicateOption
	UUIDOption      UUIDOption
	RawContent      []byte
}

ImportJobsInput are the parameters for the import endpoint

type ImportJobsResponse

type ImportJobsResponse struct {
	Succeeded []*Job `json:"succeeded,omitempty"`
	Failed    []*Job `json:"failed,omitempty"`
	Skipped   []*Job `json:"skipped,omitempty"`
}

ImportJobsResponse is the response that comes back from importing jobs

type IncompleteLogStorageResponse

type IncompleteLogStorageResponse struct {
	PagingInfo
	Executions []*Execution `json:"executions"`
}

IncompleteLogStorageResponse is the response from the associated endpoint

type JVM

type JVM struct {
	Name                   string `json:"name"`
	Vendor                 string `json:"vendor"`
	Version                string `json:"version"`
	ImplementationVeresion string `json:"implementationVersion"`
}

JVM is information about the JVM of Rundeck

type Job

type Job struct {
	ID                     string            `json:"id,omitempty"`
	AverageDuration        int64             `json:"averageDuration,omitempty"`
	Name                   string            `json:"name,omitempty"`
	Group                  string            `json:"group,omitempty"`
	Project                string            `json:"project,omitempty"`
	Description            string            `json:"description,omitempty"`
	HREF                   string            `json:"href,omitempty"`
	Permalink              string            `json:"permalink,omitempty"`
	Options                map[string]string `json:"options,omitempty"`
	Scheduled              bool              `json:"scheduled,omitempty"`
	ScheduleEnabled        bool              `json:"scheduleEnabled,omitempty"`
	Enabled                bool              `json:"enabled,omitempty"`
	ServerNodeUUID         string            `json:"serverNodeUUID,omitempty"`
	ServerOwner            bool              `json:"serverOwner,omitempty"`
	Index                  int               `json:"index,omitempty"`
	NextScheduledExecution time.Time         `json:"nextScheduledExecution,omitempty"`
}

Job is information about a Rundeck job

type JobFormat

type JobFormat string

JobFormat specifies the content type

const (
	JobFormatXML  JobFormat = "xml"
	JobFormatYAML JobFormat = "yaml"
)

type Jobs

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

Jobs is information pertaining to jobs API endpoints

func (*Jobs) BulkDelete

func (j *Jobs) BulkDelete(input *BulkModifyInput) (*BulkModifyResponse, error)

BulkDelete deletes jobs in bulk by ID

func (*Jobs) BulkToggleExecutionsOrSchedules

func (j *Jobs) BulkToggleExecutionsOrSchedules(input *BulkModifyInput, enabled bool, toggleKind ToggleKind) (*BulkModifyResponse, error)

BulkToggleExecutionsOrSchedules toggles the execution or scheudle value of the suppplied job ids

func (*Jobs) DeleteDefinition

func (j *Jobs) DeleteDefinition(id string) error

DeleteDefinition deletes a job definition

func (*Jobs) Export

func (j *Jobs) Export(project string, input *ExportJobsInput) ([]byte, error)

Export exports a projects jobs defintions

func (*Jobs) FileInfo

func (j *Jobs) FileInfo(id string) (*FileOption, error)

FileInfo returns information about an uploaded file

func (*Jobs) GetDefinition

func (j *Jobs) GetDefinition(id string, format *JobFormat) ([]byte, error)

GetDefinition returns a job definition as a slice of bytces in either xml or yaml

func (*Jobs) GetMetadata

func (j *Jobs) GetMetadata(id string) (*Job, error)

GetMetadata returns basic information about a job

func (*Jobs) Import

func (j *Jobs) Import(project string, input *ImportJobsInput) (*ImportJobsResponse, error)

Import imports job definitions

func (*Jobs) List

func (j *Jobs) List(project string, input *ListJobsInput) ([]*Job, error)

List returns a list of jobs

func (*Jobs) ListFilesUploadedForJob

func (j *Jobs) ListFilesUploadedForJob(id string, fileState *FileState, max *int) (*UploadedFilesResponse, error)

ListFilesUploadedForJob returns files that were uploaded for a particular job

func (*Jobs) Retry

func (j *Jobs) Retry(jobID string, execID int64, input *RetryJobInput) (*Execution, error)

Retry retries a job based on an execution id

func (*Jobs) Run

func (j *Jobs) Run(jobID string, input *RunJobInput) (*Execution, error)

Run will execute a job

func (*Jobs) ToggleExecutionsOrSchedules

func (j *Jobs) ToggleExecutionsOrSchedules(id string, enabled bool, toggleKind ToggleKind) (*SuccessResponse, error)

ToggleExecutionsOrSchedules toggles the executions or schedules of the supplied job

func (*Jobs) UploadFileForJobOption

func (j *Jobs) UploadFileForJobOption(id, optionName string, content []byte, fileName *string) (*UploadFileResponse, error)

UploadFileForJobOption uploads a file to rundeck for a job option and returns the file key

type KeyMetadata

type KeyMetadata struct {
	KeyType     string `json:"Rundeck-key-type"`
	ContentMask string `json:"Rundeck-content-mask"`
	ContentSize int64  `json:"Rundeck-content-size"`
	ContentType string `json:"Rundeck-content-type"`
}

KeyMetadata ...

type KeyResource

type KeyResource struct {
	Meta KeyMetadata `json:"meta"`
	Name string      `json:"name"`
	// contains filtered or unexported fields
}

KeyResource ...

type KeyStore

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

KeyStore interacts with the storage facility with regards to keys

func (*KeyStore) Delete

func (k *KeyStore) Delete(path, file string) error

Delete deletes the file if it exists

func (*KeyStore) KeyMetadata

func (k *KeyStore) KeyMetadata(path, file string) (*KeyMetadata, error)

KeyMetadata returns the metadata about the stored key file

func (*KeyStore) List

func (k *KeyStore) List(path string) (*ListKeysResponse, error)

List lists resources at the specified path

type ListACLsResponse

type ListACLsResponse struct {
	Path      string         `json:"path"`
	Type      string         `json:"type"`
	HREF      string         `json:"href"`
	Resources []*ACLResource `json:"resources"`
}

ListACLsResponse is the response body from the system/acl endpoint

type ListJobsInput

type ListJobsInput struct {
	IDs                  []string
	GroupPath            string
	JobFilter            string
	JobExactFilter       string
	GroupPathExact       string
	ScheduledFilter      bool
	ServerNodeUUIDFilter string
}

ListJobsInput adds parameters to the endpoint for listing jobs

type ListKeysResponse

type ListKeysResponse struct {
	Resources []*KeyResource `json:"resources"`
	// contains filtered or unexported fields
}

ListKeysResponse ...

type LoadAverageStats

type LoadAverageStats struct {
	Unit    string  `json:"unit"`
	Average float64 `json:"average"`
}

LoadAverageStats are stats about the CPU load

type LogEntry

type LogEntry struct {
	Time         string       `json:"time"`
	AbsoluteTime *time.Time   `json:"absolute_time"`
	Level        LogLevel     `json:"level"`
	Log          string       `json:"log"`
	User         string       `json:"user"`
	Command      string       `json:"command"`
	Node         string       `json:"node"`
	StepContext  string       `json:"stepctx"`
	Type         LogEntryType `json:"type"`
}

LogEntry ...

type LogEntryType

type LogEntryType string

LogEntryType ...

const (
	LogEntryTypeLog       LogEntryType = "log"
	LogEntryTypeStepBegin LogEntryType = "stepbegin"
	LogEntryTypeStepEnd   LogEntryType = "stepend"
	LogEntryTypeNodeBegin LogEntryType = "nodebegin"
	LogEntryTypeNodeEnd   LogEntryType = "nodeend"
)

type LogLevel

type LogLevel string

LogLevel pertains to job log levels

const (
	JobLogLevelDebug   LogLevel = "DEBUG"
	JobLogLevelVerbose LogLevel = "VERBOSE"
	JobLogLevelInfo    LogLevel = "INFO"
	JobLogLevelWarn    LogLevel = "WARN"
	JobLogLevelError   LogLevel = "ERROR"
)

type LogStorageMetadata

type LogStorageMetadata struct {
	LocalFilesPresent   bool      `json:"localFilesPresent"`
	IncompleteFileTypes []string  `json:"incompleteFileTypes"`
	Queued              bool      `json:"queued"`
	Failed              bool      `json:"failed"`
	Date                time.Time `json:"date"`
}

LogStorageMetadata is information about an executions associated log storage

type LogStorageStats

type LogStorageStats struct {
	Enabled         bool   `json:"enabled"`
	PluginName      string `json:"pluginName"`
	SucceededCount  int64  `json:"succeededCount"`
	FailedCount     int64  `json:"failedCount"`
	QueuedCount     int64  `json:"queuedCount"`
	TotalCount      int64  `json:"totalCount"`
	ImcompleteCount int64  `json:"incompleteCount"`
	MissingCount    int64  `json:"missingCount"`
}

LogStorageStats is the log storage info and stats

type LogStore

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

LogStore contains information about logstorage in the system API

func (*LogStore) IncompleteLogStorage

func (l *LogStore) IncompleteLogStorage() (*IncompleteLogStorageResponse, error)

IncompleteLogStorage lists executions with incomplete logstorage

func (*LogStore) LogStorage

func (l *LogStore) LogStorage() (*LogStorageStats, error)

LogStorage returns log storage information and stats

func (*LogStore) ResumeIncompleteLogStorage

func (l *LogStore) ResumeIncompleteLogStorage() (*ResumedIncompleteLogStorageResponse, error)

ResumeIncompleteLogStorage resumes processing incomplete log storage uploads

type MemoryStats

type MemoryStats struct {
	Unit  string `json:"unit"`
	Max   int64  `json:"max"`
	Free  int64  `json:"free"`
	Total int64  `json:"total"`
}

MemoryStats are basic stats about memory usage

type Metrics

type Metrics struct {
	HREF        string `json:"href"`
	ContentType string `json:"contentType"`
}

Metrics contains a url to a page regarding metrics

type ModifyUserInput

type ModifyUserInput struct {
	FirstName string `json:"firstName"`
	LastName  string `json:"lastName"`
	Email     string `json:"email"`
}

ModifyUserInput are the fields necessary to modify a user

type NodeEntry

type NodeEntry struct {
	Nodename    string `json:"nodename"`
	Hostname    string `json:"hostname"`
	Username    string `json:"username"`
	Description string `json:"description"`
	Tags        string `json:"tags"`
	OSFamily    string `json:"osFamily"`
	OSArch      string `json:"osArch"`
	OSName      string `json:"osName"`
	OSVersion   string `json:"osVersion"`
	EditURL     string `json:"editUrl"`
	RemoteURL   string `json:"remoteUrl"`
	NodeEntryAnything
}

NodeEntry contains some specific entries in the node entry map

type NodeEntryAnything

type NodeEntryAnything map[string]string

NodeEntryAnything represents everything else that can be added to the node entry map

type OperatingSystem

type OperatingSystem struct {
	Architecture string `json:"arch"`
	Name         string `json:"name"`
	Version      string `json:"version"`
}

OperatingSystem is information regarding the Rundeck host

type PagingInfo

type PagingInfo struct {
	Count  int `json:"count"`
	Total  int `json:"total"`
	Max    int `json:"max"`
	Offset int `json:"offset"`
}

PagingInfo contains information relating to a paginated response

type Project

type Project struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	URL         string `json:"url"`
}

Project is metadata about a project in rundeck

type ProjectConfigKeyPair

type ProjectConfigKeyPair struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

ProjectConfigKeyPair is a single key pair from a project configuration

type ProjectInfo

type ProjectInfo struct {
	Project
	Config map[string]string `json:"config,omitempty"`
}

ProjectInfo contains the configuration for the project in addition to the metadata

type Projects

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

Projects is information pertaining to projects API endpoints

func (*Projects) ArchiveExport

func (p *Projects) ArchiveExport(project string, input *ArchiveExportInput) ([]byte, error)

ArchiveExport exports a zip archive of the project synchronously

func (*Projects) ArchiveExportAsync

func (p *Projects) ArchiveExportAsync(project string, input *ArchiveExportInput) (*ArchiveExportAsyncStatusResponse, error)

ArchiveExportAsync exports a zip archive of the project asynchronously

func (*Projects) ArchiveExportAsyncDownload

func (p *Projects) ArchiveExportAsyncDownload(project, token string) ([]byte, error)

ArchiveExportAsyncDownload downloads the finished artifact

func (*Projects) ArchiveExportAsyncStatus

func (p *Projects) ArchiveExportAsyncStatus(project, token string) (*ArchiveExportAsyncStatusResponse, error)

ArchiveExportAsyncStatus gets the status of the async archive

func (*Projects) ArchiveImport

func (p *Projects) ArchiveImport(project string, content []byte, input *ArchiveImportInput) (*ArchiveImportResponse, error)

ArchiveImport imports a zip archive into the project

func (*Projects) Configuration

func (p *Projects) Configuration(project string) (map[string]string, error)

Configuration retrieves the project configuration data

func (*Projects) Configure

func (p *Projects) Configure(project string, config map[string]string) (map[string]string, error)

Configure modifies the project configuration data

func (*Projects) Create

func (p *Projects) Create(data *CreateProjectInput) (*ProjectInfo, error)

Create will make a new project

func (*Projects) Delete

func (p *Projects) Delete(project string) error

Delete removes an existing project

func (*Projects) DeleteConfigKey

func (p *Projects) DeleteConfigKey(project, key string) error

DeleteConfigKey removes the key

func (*Projects) GetConfigKey

func (p *Projects) GetConfigKey(project, key string) (*ProjectConfigKeyPair, error)

GetConfigKey retieves the value

func (*Projects) GetInfo

func (p *Projects) GetInfo(project string) (*ProjectInfo, error)

GetInfo returns project info

func (*Projects) List

func (p *Projects) List() ([]*Project, error)

List returns a list of the projects

func (*Projects) ListResources

func (p *Projects) ListResources(project string, nodeFilters map[string]string) (map[string]*NodeEntry, error)

ListResources lists resources for a given project

func (*Projects) SetConfigKey

func (p *Projects) SetConfigKey(project string, keyPair *ProjectConfigKeyPair) (*ProjectConfigKeyPair, error)

SetConfigKey modifies the value

type ResumedIncompleteLogStorageResponse

type ResumedIncompleteLogStorageResponse struct {
	Resumed bool `json:"resumed"`
}

ResumedIncompleteLogStorageResponse is the response body from the associated endpoint

type RetryJobInput

type RetryJobInput struct {
	LogLevel    LogLevel          `json:"loglevel,omitempty"`
	AsUser      string            `json:"asUser,omitempty"`
	Options     map[string]string `json:"options,omitempty"`
	FailedNodes bool              `json:"failedNodes,omitempty"`
}

RetryJobInput are the optional parameters passed when retrying a job based on execution id

type RunJobInput

type RunJobInput struct {
	LogLevel  LogLevel
	AsUser    string
	Filters   map[string]string
	RunAtTime *time.Time
	Options   map[string]string
}

RunJobInput are the optional paramenters passed when running a job

type Rundeck

type Rundeck struct {
	Version    string `json:"version"`
	Build      string `json:"build"`
	Node       string `json:"node"`
	APIVersion int    `json:"apiversion"`
	ServerUUID string `json:"serverUUID"`
}

Rundeck is information about the build

type SchedulerStats

type SchedulerStats struct {
	Running        int `json:"running"`
	ThreadPoolSize int `json:"threadPoolSize"`
}

SchedulerStats are stats about the Rundeck scheduler

type Stats

type Stats struct {
	Uptime    UptimeStats    `json:"uptime"`
	CPU       CPUStats       `json:"cpu"`
	Memory    MemoryStats    `json:"memory"`
	Scheduler SchedulerStats `json:"scheduler"`
	Threads   ThreadStats    `json:"threads"`
}

Stats are basic Rundeck stats

type Status

type Status string

Status indicates the general status of an operation

const (
	StatusSuccessful Status = "successful"
	StatusFailed     Status = "failed"
)

type SuccessResponse

type SuccessResponse struct {
	Success bool `json:"success"`
}

SuccessResponse is a response containing whether or not the api call was a success

type System

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

System is the information regarding system calls

func (*System) Info

func (s *System) Info() (*SystemInfoResponse, error)

Info retrieves Rundeck server information and stats.

func (*System) SetExecutionMode

func (s *System) SetExecutionMode(mode ExecutionMode) (*ExecutionModeResponse, error)

SetExecutionMode sets the execution mode

type SystemInfo

type SystemInfo struct {
	Timestamp   Timestamp             `json:"timestamp"`
	Rundeck     Rundeck               `json:"rundeck"`
	Executions  ExecutionModeResponse `json:"executions"`
	OS          OperatingSystem       `json:"os"`
	JVM         JVM                   `json:"jvm"`
	Stats       Stats                 `json:"stats"`
	Metrics     Metrics               `json:"metrics"`
	ThreadDump  ThreadDump            `json:"threadDump"`
	HealthCheck HealthCheck           `json:"healthcheck"`
}

SystemInfo is information about the rundeck system

type SystemInfoResponse

type SystemInfoResponse struct {
	System SystemInfo `json:"system"`
}

SystemInfoResponse is Rundeck server information and stats

type TakeoverJob

type TakeoverJob struct {
	HREF          string `json:"href"`
	Permalink     string `json:"permalink"`
	ID            string `json:"id"`
	PreviousOwner string `json:"previous-owner"`
}

TakeoverJob ...

type TakeoverJobInput

type TakeoverJobInput struct {
	ID string `json:"id,omitempty"`
}

TakeoverJobInput ...

type TakeoverJobs

type TakeoverJobs struct {
	Failed     []TakeoverJob `json:"failed"`
	Successful []TakeoverJob `json:"successful"`
	Total      int           `json:"total"`
}

TakeoverJobs ...

type TakeoverSchedule

type TakeoverSchedule struct {
	Jobs    TakeoverJobs   `json:"jobs,omitempty"`
	Server  TakeoverServer `json:"server,omitempty"`
	Project string         `json:"project,omitempty"`
}

TakeoverSchedule is the result from issuing a takeover call

type TakeoverScheduleInput

type TakeoverScheduleInput struct {
	Server  *TakeoverServer   `json:"server,omitempty"`
	Project *string           `json:"project,omitempty"`
	Job     *TakeoverJobInput `json:"job,omitempty"`
}

TakeoverScheduleInput is the payload to takeover jobs in cluster mode

type TakeoverScheduleResponse

type TakeoverScheduleResponse struct {
	TakeoverSchedule TakeoverSchedule `json:"takeoverSchedule"`
	Self             struct {
		Server TakeoverServer `json:"server,omitempty"`
	} `json:"self,omitempty"`
	Message    string `json:"message"`
	APIVersion int    `json:"apiversion"`
	Success    bool   `json:"success"`
}

TakeoverScheduleResponse is the response body from the endpoint

type TakeoverServer

type TakeoverServer struct {
	UUID string `json:"uuid,omitempty"`
	All  bool   `json:"all,omitempty"`
}

TakeoverServer ...

type ThreadDump

type ThreadDump struct {
	HREF        string `json:"href"`
	ContentType string `json:"contentType"`
}

ThreadDump contains a url to a page regarding thread dump information

type ThreadStats

type ThreadStats struct {
	Active int `json:"active"`
}

ThreadStats are stats about thread usage

type Timestamp

type Timestamp struct {
	Epoch    int64     `json:"epoch"`
	Unit     string    `json:"unit"`
	DateTime time.Time `json:"datetime"`
}

Timestamp is time information on the Rundeck server

type ToggleKind

type ToggleKind string

ToggleKind informs if executions or scheudles are being targeted

const (
	ToggleKindExecution ToggleKind = "execution"
	ToggleKindSchedule  ToggleKind = "schedule"
)

type Token

type Token struct {
	User       string    `json:"user"`
	ID         string    `json:"id"`
	Creator    string    `json:"creator"`
	Expiration time.Time `json:"expiration"`
	Roles      []string  `json:"roles"`
	Expired    bool      `json:"expired"`
}

Token is the information regarding a user token

type Tokens

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

Tokens is used to perform token specific API operations

func (*Tokens) Create

func (t *Tokens) Create(user string, roles []string, duration *string) (*Token, error)

Create creates a token based on the supplied config.

If duration is nil, Rundeck will use the configured default. NOTE: the duration needs to be something that rundeck can understand. Unfortunately, this isn't a go parseable duration. "120d" is understood by Rundeck while "2880h0m0s" is not (what time.Duration.String() returns for the equivalence).

func (*Tokens) Delete

func (t *Tokens) Delete(id string) error

Delete deletes a token

func (*Tokens) Get

func (t *Tokens) Get(id string) (*Token, error)

Get returns the token by the supplied id

func (*Tokens) List

func (t *Tokens) List() ([]*Token, error)

List returns all tokens

func (*Tokens) User

func (t *Tokens) User(user string) ([]*Token, error)

User returns the tokens associated with the supplied user

type UUIDOption

type UUIDOption string

UUIDOption instructs the job importer how to handle duplicate job uuids

const (
	UUIDOptionPreserve UUIDOption = "preserve"
	UUIDOptionRemove   UUIDOption = "remove"
)

type UploadFileResponse

type UploadFileResponse struct {
	Total   int               `json:"total"`
	Options map[string]string `json:"options"`
}

UploadFileResponse is the response from uploading a file for a job. It will contain the fileKey.

type UploadedFilesResponse

type UploadedFilesResponse struct {
	PagingInfo
	File []*FileOption `json:"files"`
}

UploadedFilesResponse returns the files uploaded for a particular job

type UptimeStats

type UptimeStats struct {
	Duration int64     `json:"duration"`
	Unit     string    `json:"unit"`
	Since    Timestamp `json:"since"`
}

UptimeStats are basic stats about system uptime

type UserProfile

type UserProfile struct {
	Login     string `json:"login"`
	FirstName string `json:"firstName"`
	LastName  string `json:"lastName"`
	Email     string `json:"email"`
}

UserProfile is the information relating to a user on Rundeck

type Users

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

Users the is information regarding user profiles

func (*Users) Get

func (u *Users) Get(login *string) (*UserProfile, error)

Get fetches a user profile.

If the login parameter is nil, the profile associated with the supplied auth token will be returned.

func (*Users) List

func (u *Users) List() ([]*UserProfile, error)

List returns a list of all the users

func (*Users) Modify

func (u *Users) Modify(login *string, input *ModifyUserInput) (*UserProfile, error)

Modify will modify the user.

If the user parameter is nil, then the user associated with the auth token will be modified.

Jump to

Keyboard shortcuts

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