contracts

package
v0.0.0-...-3f59448 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2016 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package contracts contains all necessary interface and models necessary for communication and sharing within the agent.

Package contracts contains objects for parsing and encoding MDS/SSM messages.

Index

Constants

View Source
const (
	//MaximumPluginOutputSize represents the maximum output size that agent supports
	MaximumPluginOutputSize = 2400
)

Variables

This section is empty.

Functions

func TruncateOutput

func TruncateOutput(stdout string, stderr string, capacity int) (response string)

TruncateOutput truncates the output

Types

type AdditionalInfo

type AdditionalInfo struct {
	Agent               AgentInfo      `json:"agent"`
	DateTime            string         `json:"dateTime"`
	RunID               string         `json:"runId"`
	RuntimeStatusCounts map[string]int `json:"runtimeStatusCounts"`
}

AdditionalInfo section in agent response

type AgentConfiguration

type AgentConfiguration struct {
	AgentInfo  AgentInfo
	InstanceID string
}

AgentConfiguration is a struct that stores information about the agent and instance.

type AgentInfo

type AgentInfo struct {
	Lang      string `json:"lang"`
	Name      string `json:"name"`
	Os        string `json:"os"`
	OsVersion string `json:"osver"`
	Version   string `json:"ver"`
}

AgentInfo represents the agent response

type Configuration

type Configuration struct {
	Properties             interface{}
	OutputS3KeyPrefix      string
	OutputS3BucketName     string
	OrchestrationDirectory string
	MessageId              string
	BookKeepingFileName    string
}

Configuration represents a plugin configuration as in the json format.

type DocumentContent

type DocumentContent struct {
	SchemaVersion string                   `json:"schemaVersion"`
	Description   string                   `json:"description"`
	RuntimeConfig map[string]*PluginConfig `json:"runtimeConfig"`
	Parameters    map[string]*Parameter    `json:"parameters"`
}

DocumentContent object which represents ssm document content.

type ICorePlugin

type ICorePlugin interface {
	Name() string
	Execute(context context.T) (err error)
	RequestStop(stopType StopType) (err error)
}

ICorePlugin is the very much of core itself will be implemented as plugins that are simply hardcoded to run with agent framework. The hardcoded plugins will implement the ICorePlugin

type IPlugin

type IPlugin interface {
	Name() string
	Execute(context context.T, input PluginConfig) (output PluginResult, err error)
	RequestStop(stopType StopType) (err error)
}

IPlugin is interface for authoring a functionality of work. Every functionality of work is implemented as a plugin.

type IWorkerPlugin

type IWorkerPlugin IPlugin

IWorkerPlugin is the plugins which do not form part of core These plugins are invoked on demand.

type Parameter

type Parameter struct {
	DefaultVal  interface{} `json:"default"`
	Description string      `json:"description"`
	ParamType   string      `json:"type"`
}

A Parameter in the DocumentContent of an MDS message.

type Plugin

type Plugin struct {
	Configuration
	PluginResult
}

Plugin wraps the plugin configuration and plugin result.

type PluginConfig

type PluginConfig struct {
	Properties  interface{} `json:"properties"`
	Description string      `json:"description"`
}

PluginConfig stores plugin configuration

type PluginInput

type PluginInput struct {
}

PluginInput represents the input of the plugin.

type PluginOutput

type PluginOutput struct {
	ExitCode int
	Status   ResultStatus
	Stdout   string
	Stderr   string
	Errors   []string
}

PluginOutput represents the output of the plugin.

func (*PluginOutput) String

func (p *PluginOutput) String() (response string)

type PluginResult

type PluginResult struct {
	Status             ResultStatus `json:"status"`
	Code               int          `json:"code"`
	Output             interface{}  `json:"output"`
	StartDateTime      time.Time    `json:"startDateTime"`
	EndDateTime        time.Time    `json:"endDateTime"`
	OutputS3BucketName string       `json:"outputS3BucketName"`
	OutputS3KeyPrefix  string       `json:"outputS3KeyPrefix"`
	Error              error        `json:"-"`
}

PluginResult represents a plugin execution result.

type PluginRuntimeStatus

type PluginRuntimeStatus struct {
	Status             ResultStatus `json:"status"`
	Code               int          `json:"code"`
	Output             string       `json:"output"`
	StartDateTime      string       `json:"startDateTime"`
	EndDateTime        string       `json:"endDateTime"`
	OutputS3BucketName string       `json:"outputS3BucketName"`
	OutputS3KeyPrefix  string       `json:"outputS3KeyPrefix"`
}

PluginRuntimeStatus represents plugin runtime status section in agent response

type ResultStatus

type ResultStatus string

ResultStatus provides the granular status of a plugin. These are internal states maintained by agent during the execution of a command/config

const (
	ResultStatusUnknown          ResultStatus = "Unknown"
	ResultStatusNotStarted       ResultStatus = "NotStarted"
	ResultStatusInProgress       ResultStatus = "InProgress"
	ResultStatusSuccess          ResultStatus = "Success"
	ResultStatusSuccessAndReboot ResultStatus = "SuccessAndReboot"
	ResultStatusFailed           ResultStatus = "Failed"
	ResultStatusCancelled        ResultStatus = "Cancelled"
	ResultStatusTimedOut         ResultStatus = "TimedOut"
)

type StopType

type StopType string
const (
	StopTypeSoftStop StopType = "SoftStop"
	StopTypeHardStop StopType = "HardStop"
)

Jump to

Keyboard shortcuts

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