Documentation
¶
Overview ¶
Package iron provides support for HSDP Iron services
Index ¶
- Constants
- Variables
- func DecryptPayload(privKey []byte, payload string) ([]byte, error)
- func EncryptPayload(publicKey []byte, pbytes []byte) (string, error)
- func FormatBrokenPubkey(pubkey []byte) []byte
- type Client
- type Cluster
- type ClusterInfo
- type ClusterStats
- type ClusterUser
- type ClustersServices
- type Code
- type CodesServices
- func (c *CodesServices) CreateOrUpdateCode(code Code) (*Code, *Response, error)
- func (c *CodesServices) DeleteCode(codeID string) (bool, *Response, error)
- func (c *CodesServices) DockerLogin(creds DockerCredentials) (bool, *Response, error)
- func (c *CodesServices) GetCode(codeID string) (*Code, *Response, error)
- func (c *CodesServices) GetCodes() (*[]Code, *Response, error)
- type Config
- type DockerCredentials
- type Machine
- type OptionFunc
- type Response
- type Schedule
- type SchedulesServices
- func (s *SchedulesServices) CancelSchedule(scheduleID string) (bool, *Response, error)
- func (s *SchedulesServices) CreateSchedule(schedule Schedule) (*Schedule, *Response, error)
- func (s *SchedulesServices) CreateSchedules(schedules []Schedule) (*[]Schedule, *Response, error)
- func (s *SchedulesServices) GetSchedule(scheduleID string) (*Schedule, *Response, error)
- func (s *SchedulesServices) GetSchedules() (*[]Schedule, *Response, error)
- func (s *SchedulesServices) GetSchedulesWithCode(codeName string) (*[]Schedule, *Response, error)
- type Task
- type TasksServices
- func (t *TasksServices) CancelTask(taskID string) (bool, *Response, error)
- func (t *TasksServices) GetTask(taskID string) (*Task, *Response, error)
- func (t *TasksServices) GetTasks() (*[]Task, *Response, error)
- func (t *TasksServices) QueueTask(task Task) (*Task, *Response, error)
- func (t *TasksServices) QueueTasks(tasks []Task) (*[]Task, *Response, error)
Constants ¶
const (
IronBaseURL = "https://worker-aws-us-east-1.iron.io/"
)
Variables ¶
var ( ErrBaseIRONURLCannotBeEmpty = errors.New("base IRON URL cannot be empty") ErrNotImplemented = errors.New("not implemented") ErrNotFound = errors.New("not found") ErrInvalidDockerCredentials = errors.New("invalid docker credentials. all fields required") ErrNoPublicKey = errors.New("no public key present") )
Functions ¶
func DecryptPayload ¶
DecryptPayload decrypts a base64 encoded payload using private key
func EncryptPayload ¶
EncryptPayload encrypts pbytes using publicKey
func FormatBrokenPubkey ¶
FormatBrokenPubkey fixes to broken service broker pubkey format
Types ¶
type Client ¶
type Client struct {
// User agent used when communicating with the HSDP IAM API.
UserAgent string
Tasks *TasksServices
Codes *CodesServices
Clusters *ClustersServices
Schedules *SchedulesServices
// contains filtered or unexported fields
}
A Client manages communication with IronIO
func NewClient ¶
NewClient returns a new HSDP Iron API client. If a nil httpClient is provided, http.DefaultClient will be used. A configured IAM client must be provided as well
func (*Client) SetBaseIronURL ¶
SetBaseIronURL sets the base URL for API requests to a custom endpoint. urlStr should always be specified with a trailing slash.
type Cluster ¶
type Cluster struct {
ID string `json:"id"`
Name string `json:"name"`
UserID string `json:"user_id"`
Memory int64 `json:"memory"`
DiskSpace int64 `json:"disk_space"`
RunnersTotal int `json:"runners_total"`
RunnersAvailable int `json:"runners_available"`
Machines []Machine `json:"machines"`
}
Cluster describes an Iron cluster
type ClusterInfo ¶
type ClusterInfo struct {
ClusterID string `cloud:"cluster_id" json:"cluster_id"`
ClusterName string `cloud:"cluster_name" json:"cluster_name"`
Pubkey string `cloud:"pubkey" json:"pubkey"`
UserID string `cloud:"user_id" json:"user_id"`
}
ClusterInfo contains details on an Iron cluster
type ClusterStats ¶
type ClusterUser ¶
type ClusterUser struct {
UserID string `json:"user_id"`
ClusterID string `json:"cluster_id"`
UpdatedAt time.Time `json:"updated_at"`
Name string `json:"name"`
Email string `json:"email"`
}
ClusterUser can share resources on a cluster
type ClustersServices ¶
type ClustersServices struct {
// contains filtered or unexported fields
}
ClustersServices implements API calls to get details on Iron clusters. As HSDP Iron clusters are not user serviceable only informational API calls are implemented
func (*ClustersServices) GetCluster ¶
func (c *ClustersServices) GetCluster(clusterID string) (*Cluster, *Response, error)
GetCluster gets cluster details
func (*ClustersServices) GetClusterStats ¶
func (c *ClustersServices) GetClusterStats(clusterID string) (*ClusterStats, *Response, error)
GetClusterStats gets cluster statistics
func (*ClustersServices) GetClusters ¶
func (c *ClustersServices) GetClusters() (*[]Cluster, *Response, error)
GetClusters gets the list of available clusters In some cases a token might not have the proper scope to retrieve a list of clusters in which case the list will be empty
type Code ¶
type Code struct {
ID string `json:"id,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
ProjectID string `json:"project_id,omitempty"`
Name string `json:"name"`
Image string `json:"image"`
LatestChecksum string `json:"latest_checksum,omitempty"`
Rev int `json:"rev,omitempty"`
LatestHistoryID string `json:"latest_history_id,omitempty"`
LatestChange *time.Time `json:"latest_change,omitempty"`
}
Code describes a Iron code package
type CodesServices ¶
type CodesServices struct {
// contains filtered or unexported fields
}
func (*CodesServices) CreateOrUpdateCode ¶
func (c *CodesServices) CreateOrUpdateCode(code Code) (*Code, *Response, error)
CreateOrUpdateCode creates or updates code packages on Iron which can be used to run tasks
func (*CodesServices) DeleteCode ¶
func (c *CodesServices) DeleteCode(codeID string) (bool, *Response, error)
DeleteCode deletes a code from Iron
func (*CodesServices) DockerLogin ¶
func (c *CodesServices) DockerLogin(creds DockerCredentials) (bool, *Response, error)
DockerLogin stores private Docker registry credentials so Iron can fetch images when needed
type Config ¶
type Config struct {
BaseURL string `cloud:"-" json:"base_url,omitempty"`
Debug bool `cloud:"-" json:"-"`
DebugLog io.Writer `cloud:"-" json:"-"`
ClusterInfo []ClusterInfo `cloud:"cluster_info" json:"cluster_info"`
Email string `cloud:"email" json:"email"`
Password string `cloud:"password" json:"password"`
Project string `cloud:"project" json:"project"`
ProjectID string `cloud:"project_id" json:"project_id"`
Token string `cloud:"token" json:"token"`
UserID string `cloud:"user_id" json:"user_id"`
}
Config contains the configuration of a client
type DockerCredentials ¶
type DockerCredentials struct {
Email string `json:"email"`
Username string `json:"username"`
Password string `json:"password"`
ServerAddress string `json:"serveraddress"`
}
DockerCredentials describes a set of docker credentials
func (DockerCredentials) Valid ¶
func (d DockerCredentials) Valid() bool
type Machine ¶
type Machine struct {
InstanceID string `json:"instance_id"`
Version string `json:"version"`
RunnersTotal int `json:"runners_total"`
RunnersAvailable int `json:"runners_available"`
}
Machine is a node in an Iron cluster
type OptionFunc ¶
OptionFunc is the function signature function for options
type Response ¶
Response is a HSDP IAM API response. This wraps the standard http.Response returned from HSDP IAM and provides convenient access to things like errors
type Schedule ¶
type Schedule struct {
ID string `json:"id,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
ProjectID string `json:"project_id,omitempty"`
Status string `json:"status,omitempty"`
CodeName string `json:"code_name"`
StartAt *time.Time `json:"start_at,omitempty"`
EndAt *time.Time `json:"end_at,omitempty"`
NextStart *time.Time `json:"next_start,omitempty"`
LastRunTime *time.Time `json:"last_run_time,omitempty"`
Timeout int `json:"timeout"`
RunTimes int `json:"run_times,omitempty"`
RunEvery int `json:"run_every,omitempty"`
Cluster string `json:"cluster,omitempty"`
Payload string `json:"payload,omitempty"`
}
type SchedulesServices ¶
type SchedulesServices struct {
// contains filtered or unexported fields
}
func (*SchedulesServices) CancelSchedule ¶
func (s *SchedulesServices) CancelSchedule(scheduleID string) (bool, *Response, error)
CancelSchedule cancels a schedule
func (*SchedulesServices) CreateSchedule ¶
func (s *SchedulesServices) CreateSchedule(schedule Schedule) (*Schedule, *Response, error)
CreateSchedule creates a schedule
func (*SchedulesServices) CreateSchedules ¶
func (s *SchedulesServices) CreateSchedules(schedules []Schedule) (*[]Schedule, *Response, error)
CreateSchedules creates one or more schedules
func (*SchedulesServices) GetSchedule ¶
func (s *SchedulesServices) GetSchedule(scheduleID string) (*Schedule, *Response, error)
GetSchedule gets info on a schedule
func (*SchedulesServices) GetSchedules ¶
func (s *SchedulesServices) GetSchedules() (*[]Schedule, *Response, error)
GetSchedules gets the schedules of the project
func (*SchedulesServices) GetSchedulesWithCode ¶
func (s *SchedulesServices) GetSchedulesWithCode(codeName string) (*[]Schedule, *Response, error)
GetSchedulesWithCode gets schedules which use code
type Task ¶
type Task struct {
ID string `json:"id,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
ProjectID string `json:"project_id,omitempty"`
CodeID string `json:"code_id,omitempty"`
CodeHistoryID string `json:"code_history_id,omitempty"`
Status string `json:"status,omitempty"`
Msg string `json:"msg,omitempty"`
CodeName string `json:"code_name,omitempty"`
CodeRev string `json:"code_rev,omitempty"`
StartTime *time.Time `json:"start_time,omitempty"`
EndTime *time.Time `json:"end_time,omitempty"`
Timeout int `json:"timeout,omitempty"`
Payload string `json:"payload,omitempty"`
ScheduleID string `json:"schedule_id,omitempty"`
MessageID string `json:"message_id,omitempty"`
Cluster string `json:"cluster,omitempty"`
Duration int `json:"duration,omitempty"`
LogSize int `json:"log_size,omitempty"`
}
type TasksServices ¶
type TasksServices struct {
// contains filtered or unexported fields
}
func (*TasksServices) CancelTask ¶
func (t *TasksServices) CancelTask(taskID string) (bool, *Response, error)
CancelTask cancels the given task
func (*TasksServices) GetTask ¶
func (t *TasksServices) GetTask(taskID string) (*Task, *Response, error)
GetTask gets info on a single task
func (*TasksServices) GetTasks ¶
func (t *TasksServices) GetTasks() (*[]Task, *Response, error)
GetTasks gets the tasks of the project
func (*TasksServices) QueueTask ¶
func (t *TasksServices) QueueTask(task Task) (*Task, *Response, error)
QueueTask queues a single task for execution
func (*TasksServices) QueueTasks ¶
func (t *TasksServices) QueueTasks(tasks []Task) (*[]Task, *Response, error)
QueueTasks queues one or more tasks for execution