apimodels

package
v0.0.0-...-366f0b0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderEC2                     = "ec2"
	ProviderDocker                  = "docker"
	ScopeTask                       = "task"
	ScopeBuild                      = "build"
	DefaultSetupTimeoutSecs         = 600
	DefaultTeardownTimeoutSecs      = 21600
	DefaultContainerWaitTimeoutSecs = 600
	DefaultPollFrequency            = 30
)
View Source
const (
	SystemLogPrefix = "S"
	AgentLogPrefix  = "E"
	TaskLogPrefix   = "T"

	LogErrorPrefix = "E"
	LogWarnPrefix  = "W"
	LogDebugPrefix = "D"
	LogInfoPrefix  = "I"
)

for the different types of remote logging

Variables

This section is empty.

Functions

This section is empty.

Types

type APIBuild

type APIBuild struct {
	Tasks []string `json:"tasks"`
}

APIBuild represents part of a build from the REST API for use in the smoke test.

type APITask

type APITask struct {
	Status string            `json:"status"`
	Logs   map[string]string `json:"logs"`
}

APITask represents part of a task from the REST API for use in the smoke test.

type CreateHost

type CreateHost struct {
	// agent-controlled settings
	CloudProvider       string `mapstructure:"provider" json:"provider" plugin:"expand"`
	NumHosts            string `mapstructure:"num_hosts" json:"num_hosts" plugin:"expand"`
	Scope               string `mapstructure:"scope" json:"scope" plugin:"expand"`
	SetupTimeoutSecs    int    `mapstructure:"timeout_setup_secs" json:"timeout_setup_secs"`
	TeardownTimeoutSecs int    `mapstructure:"timeout_teardown_secs" json:"timeout_teardown_secs"`
	Retries             int    `mapstructure:"retries" json:"retries"`

	// EC2-related settings
	AMI             string      `mapstructure:"ami" json:"ami" plugin:"expand"`
	Distro          string      `mapstructure:"distro" json:"distro" plugin:"expand"`
	EBSDevices      []EbsDevice `mapstructure:"ebs_block_device" json:"ebs_block_device" plugin:"expand"`
	InstanceType    string      `mapstructure:"instance_type" json:"instance_type" plugin:"expand"`
	IPv6            bool        `mapstructure:"ipv6" json:"ipv6"`
	Region          string      `mapstructure:"region" json:"region" plugin:"expand"`
	SecurityGroups  []string    `mapstructure:"security_group_ids" json:"security_group_ids" plugin:"expand"`
	Spot            bool        `mapstructure:"spot" json:"spot"`
	Subnet          string      `mapstructure:"subnet_id" json:"subnet_id" plugin:"expand"`
	UserdataFile    string      `mapstructure:"userdata_file" json:"-" plugin:"expand"`
	UserdataCommand string      `json:"userdata_command" plugin:"expand"`
	AWSKeyID        string      `mapstructure:"aws_access_key_id" json:"aws_access_key_id" plugin:"expand"`
	AWSSecret       string      `mapstructure:"aws_secret_access_key" json:"aws_secret_access_key" plugin:"expand"`
	KeyName         string      `mapstructure:"key_name" json:"key_name" plugin:"expand"`

	// docker-related settings
	Image                    string           `mapstructure:"image" json:"image" plugin:"expand"`
	Command                  string           `mapstructure:"command" json:"command" plugin:"expand"`
	Registry                 RegistrySettings `mapstructure:"registry" json:"registry" plugin:"expand"`
	Background               bool             `mapstructure:"background" json:"background"` // default is true
	ContainerWaitTimeoutSecs int              `mapstructure:"container_wait_timeout_secs" json:"container_wait_timeout_secs"`
	PollFrequency            int              `mapstructure:"poll_frequency_secs" json:"poll_frequency_secs"` // poll frequency in seconds
	StdoutFile               string           `mapstructure:"stdout_file_name" json:"stdout_file_name" plugin:"expand"`
	StderrFile               string           `mapstructure:"stderr_file_name" json:"stderr_file_name" plugin:"expand"`
}

func (*CreateHost) Expand

func (ch *CreateHost) Expand(exp *util.Expansions) error

func (*CreateHost) Validate

func (ch *CreateHost) Validate() error

func (*CreateHost) ValidateDocker

func (ch *CreateHost) ValidateDocker() error

func (*CreateHost) ValidateEC2

func (ch *CreateHost) ValidateEC2() error

type EbsDevice

type EbsDevice struct {
	DeviceName string `mapstructure:"device_name" json:"device_name"`
	IOPS       int    `mapstructure:"ebs_iops" json:"ebs_iops"`
	SizeGiB    int    `mapstructure:"ebs_size" json:"ebs_size"`
	SnapshotID string `mapstructure:"ebs_snapshot_id" json:"ebs_snapshot_id"`
}

type EndTaskResponse

type EndTaskResponse struct {
	ShouldExit bool `json:"should_exit,omitempty"`
}

EndTaskResponse is what is returned when the task ends

type ExpansionVars

type ExpansionVars struct {
	Vars        map[string]string `json:"vars"`
	PrivateVars map[string]bool   `json:"private_vars"`
}

ExpansionVars is a map of expansion variables for a project.

type GeneratePollResponse

type GeneratePollResponse struct {
	Finished bool     `json:"finished"`
	Errors   []string `json:"errors"`
}

type GetNextTaskDetails

type GetNextTaskDetails struct {
	TaskGroup string `json:"task_group"`
}

type HeartbeatResponse

type HeartbeatResponse struct {
	Abort bool `json:"abort,omitempty"`
}

HeartbeatResponse is sent by the API server in response to the agent's heartbeat message.

type LogInfo

type LogInfo struct {
	Command string `bson:"command" json:"command"`
	URL     string `bson:"url" json:"url"`
}

type LogMessage

type LogMessage struct {
	Type      string    `bson:"t" json:"t"`
	Severity  string    `bson:"s" json:"s"`
	Message   string    `bson:"m" json:"m"`
	Timestamp time.Time `bson:"ts" json:"ts"`
	Version   int       `bson:"v" json:"v"`
}

Also used in the task_logg collection in the database. The LogMessage type is used by the models package and is stored in the database (inside in the model.TaskLog structure.)

type NextTaskResponse

type NextTaskResponse struct {
	TaskId     string `json:"task_id,omitempty"`
	TaskSecret string `json:"task_secret,omitempty"`
	TaskGroup  string `json:"task_group,omitempty"`
	Version    string `json:"version,omitempty"`
	Build      string `json:"build,omitempty"`
	ShouldExit bool   `json:"should_exit,omitempty"`
}

NextTaskResponse represents the response sent back when an agent asks for a next task

type ProcessTimeoutResponse

type ProcessTimeoutResponse struct {
	Status        string      `json:"status"`
	LateProcesses interface{} `json:"late_mci_processes,omitempty"`
}

Struct for reporting process timeouts

type RegistrySettings

type RegistrySettings struct {
	Name     string `mapstructure:"registry_name" json:"registry_name"`
	Username string `mapstructure:"registry_username" json:"registry_username"`
	Password string `mapstructure:"registry_password" json:"registry_password"`
}

type S3CopyRequest

type S3CopyRequest struct {
	AwsKey              string `json:"aws_key"`
	AwsSecret           string `json:"aws_secret"`
	S3SourceBucket      string `json:"s3_source_bucket"`
	S3SourcePath        string `json:"s3_source_path"`
	S3DestinationBucket string `json:"s3_destination_bucket"`
	S3DestinationPath   string `json:"s3_destination_path"`
	S3DisplayName       string `json:"display_name"`
	S3Permissions       string `json:"s3_permissions"`
}

S3CopyRequest holds information necessary for the API server to complete an S3 copy request; namely, an S3 key/secret, a source and a destination path

type TaskEndDetail

type TaskEndDetail struct {
	Status      string    `bson:"status,omitempty" json:"status,omitempty"`
	Type        string    `bson:"type,omitempty" json:"type,omitempty"`
	Description string    `bson:"desc,omitempty" json:"desc,omitempty"`
	TimedOut    bool      `bson:"timed_out,omitempty" json:"timed_out,omitempty"`
	Logs        *TaskLogs `bson:"-" json:"logs,omitempty"`
}

TaskEndDetail contains data sent from the agent to the API server after each task run.

type TaskEndDetails

type TaskEndDetails struct {
	TimeoutStage string `bson:"timeout_stage,omitempty" json:"timeout_stage,omitempty"`
	TimedOut     bool   `bson:"timed_out,omitempty" json:"timed_out,omitempty"`
}

type TaskLog

type TaskLog struct {
	TaskId       string       `json:"t_id"`
	Execution    int          `json:"e"`
	Timestamp    time.Time    `json:"ts"`
	MessageCount int          `json:"c"`
	Messages     []LogMessage `json:"m"`
}

TaskLog is a group of LogMessages, and mirrors the model.TaskLog type, sans the ObjectID field.

type TaskLogs

type TaskLogs struct {
	AgentLogURLs  []LogInfo `bson:"agent" json:"agent"`
	SystemLogURLs []LogInfo `bson:"system" json:"system"`
	TaskLogURLs   []LogInfo `bson:"task" json:"task"`
}

type TaskStartRequest

type TaskStartRequest struct {
	Pid string `json:"pid"`
}

TaskStartRequest holds information sent by the agent to the API server at the beginning of each task run.

Jump to

Keyboard shortcuts

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