appconfig

package
v0.0.0-...-7638cb1 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package appconfig manages the configuration of the agent.

Package appconfig manages the configuration of the agent.

Package appconfig manages the configuration of the agent.

Package appconfig manages the configuration of the agent.

Index

Constants

View Source
const (
	// Agent defaults
	DefaultAgentName = "amazon-ssm-agent"

	DefaultCommandWorkersLimit    = 1
	DefaultCommandWorkersLimitMin = 1
	DefaultCommandWorkersLimitMax = 10

	DefaultCommandRetryLimit    = 15
	DefaultCommandRetryLimitMin = 1
	DefaultCommandRetryLimitMax = 100

	DefaultStopTimeoutMillis    = 20000
	DefaultStopTimeoutMillisMin = 10000
	DefaultStopTimeoutMillisMax = 1000000

	// SSM defaults
	DefaultSsmHealthFrequencyMinutes    = 5
	DefaultSsmHealthFrequencyMinutesMin = 5
	DefaultSsmHealthFrequencyMinutesMax = 60

	DefaultSsmAssociationFrequencyMinutes    = 10
	DefaultSsmAssociationFrequencyMinutesMin = 5
	DefaultSsmAssociationFrequencyMinutesMax = 60

	//aws-ssm-agent bookkeeping constants
	DefaultLocationOfPending     = "pending"
	DefaultLocationOfCurrent     = "current"
	DefaultLocationOfCompleted   = "completed"
	DefaultLocationOfCorrupt     = "corrupt"
	DefaultLocationOfState       = "state"
	DefaultLocationOfAssociation = "association"

	//aws-ssm-agent bookkeeping constants for long running plugins
	LongRunningPluginsLocation         = "longrunningplugins"
	LongRunningPluginsHealthCheck      = "healthcheck"
	LongRunningPluginDataStoreLocation = "datastore"
	LongRunningPluginDataStoreFileName = "store"
	PluginNameLongRunningPluginInvoker = "lrpminvoker"

	//aws-ssm-agent bookkeeping constants for inventory plugin
	InventoryRootDirName         = "inventory"
	CustomInventoryRootDirName   = "custom"
	InventoryContentHashFileName = "contentHash"

	// DefaultDocumentRootDirName is the root directory for storing command states
	DefaultDocumentRootDirName = "document"

	// ConfigurationRootDirName - the configuration folder used in ec2 config
	ConfigurationRootDirName = "Configuration"

	// WorkersRootDirName  - the worker folder used in ec2 config
	WorkersRootDirName = "Workers"

	// Permissions defaults
	//NOTE: Limit READ, WRITE and EXECUTE access to administrators/root.
	ReadWriteAccess        = 0600
	ReadWriteExecuteAccess = 0700

	// ExitCodes
	SuccessExitCode = 0
	ErrorExitCode   = 1

	// DefaultPluginConfig is a default config with which the plugins are initialized
	DefaultPluginConfig = "aws:defaultPluginConfig"

	// PluginNameAwsConfigureDaemon is the name for configure daemon plugin
	PluginNameAwsConfigureDaemon = "aws:configureDaemon"

	// PluginNameAwsConfigurePackage is the name for configure package plugin
	PluginNameAwsConfigurePackage = "aws:configurePackage"

	// PluginNameAwsRunShellScript is the name for run shell script plugin
	PluginNameAwsRunShellScript = "aws:runShellScript"

	// PluginNameAwsRunPowerShellScript is the name of the run powershell script plugin
	PluginNameAwsRunPowerShellScript = "aws:runPowerShellScript"

	// PluginNameAwsAgentUpdate is the name for agent update plugin
	PluginNameAwsAgentUpdate = "aws:updateSsmAgent"

	// PluginEC2ConfigUpdate is the name for ec2 config update plugin
	PluginEC2ConfigUpdate = "aws:updateAgent"

	// PluginNameAwsSoftwareInventory is the name for inventory plugin
	PluginNameAwsSoftwareInventory = "aws:softwareInventory"

	AppConfigFileName    = "amazon-ssm-agent.json"
	SeelogConfigFileName = "seelog.xml"

	// PluginNameDomainJoin is the name of domain join plugin
	PluginNameDomainJoin = "aws:domainJoin"

	// PluginNameCloudWatch is the name of cloud watch plugin
	PluginNameCloudWatch = "aws:cloudWatch"

	// PluginNameRunDockerAction is the name of the docker container plugin
	PluginNameDockerContainer = "aws:runDockerAction"

	// PluginNameConfigureDocker is the name of the configure Docker plugin
	PluginNameConfigureDocker = "aws:configureDocker"

	// PluginNameRefreshAssociation is the name of refresh association plugin
	PluginNameRefreshAssociation = "aws:refreshAssociation"
)
View Source
const (
	// DefaultProgramFolder is the default folder for SSM
	DefaultProgramFolder = "/etc/amazon/ssm/"

	// AppConfigPath is the path of the AppConfig
	AppConfigPath = DefaultProgramFolder + AppConfigFileName

	// PackageRoot specifies the directory under which packages will be downloaded and installed
	PackageRoot = "/var/lib/amazon/ssm/packages"

	// PackagePlatform is the platform name to use when looking for packages
	PackagePlatform = "linux"

	// DaemonRoot specifies the directory where daemon registration information is stored
	DaemonRoot = "/var/lib/amazon/ssm/daemons"

	// LocalCommandRoot specifies the directory where users can submit command documents offline
	LocalCommandRoot = "/var/lib/amazon/ssm/localcommands"

	// LocalCommandRootSubmitted is the directory where locally submitted command documents
	// are moved when they have been picked up
	LocalCommandRootSubmitted = "/var/lib/amazon/ssm/localcommands/submitted"

	// LocalCommandRootInvalid is the directory where locally submitted command documents
	// are moved if the service cannot validate the document (generally impossible via cli)
	LocalCommandRootInvalid = "/var/lib/amazon/ssm/localcommands/invalid"

	// DownloadRoot specifies the directory under which files will be downloaded
	DownloadRoot = "/var/log/amazon/ssm/download/"

	// DefaultDataStorePath represents the directory for storing system data
	DefaultDataStorePath = "/var/lib/amazon/ssm/"

	// EC2ConfigDataStorePath represents the directory for storing ec2 config data
	EC2ConfigDataStorePath = "/var/lib/amazon/ec2config/"

	// EC2ConfigSettingPath represents the directory for storing ec2 config settings
	EC2ConfigSettingPath = "/var/lib/amazon/ec2configservice/"

	// UpdaterArtifactsRoot represents the directory for storing update related information
	UpdaterArtifactsRoot = "/var/lib/amazon/ssm/update/"

	// DefaultPluginPath represents the directory for storing plugins in SSM
	DefaultPluginPath = "/var/lib/amazon/ssm/plugins"

	// RebootExitCode that would trigger a Soft Reboot
	RebootExitCode = 194

	// Default Custom Inventory Inventory Folder
	DefaultCustomInventoryFolder = DefaultDataStorePath + "inventory/custom"

	// PowerShellPluginCommandName is the path of the powershell.exe to be used by the runPowerShellScript plugin
	PowerShellPluginCommandName = "/usr/bin/powershell"

	// Used to capture and return exit code for windows powershell script execution - empty for unix shell script case
	ExitCodeTrap = ""

	// PowerShellPluginCommandArgs is the arguments of powershell.exe to be used by the runPowerShellScript plugin
	PowerShellPluginCommandArgs = ""

	// Exit Code for a command that exits before completion (generally due to timeout or cancel)
	CommandStoppedPreemptivelyExitCode = 137 // Fatal error (128) + signal for SIGKILL (9) = 137

	// RunCommandScriptName is the script name where all downloaded or provided commands will be stored
	RunCommandScriptName = "_script.sh"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentInfo

type AgentInfo struct {
	Name                 string
	Version              string
	Region               string
	OrchestrationRootDir string
	DownloadRootDir      string
}

AgentInfo represents metadata for amazon-ssm-agent

type CredentialProfile

type CredentialProfile struct {
	Path         string
	Name         string
	ShareCreds   bool
	ShareProfile string
}

CredentialProfile represents configurations for aws credential profile

type MdsCfg

type MdsCfg struct {
	Endpoint            string
	CommandWorkersLimit int
	StopTimeoutMillis   int64
	CommandRetryLimit   int
}

MdsCfg represents configuration for Message delivery service (MDS)

type Mock

type Mock struct {
	mock.Mock
}

Mock mocks a AppConfig.

func NewMockAppConfig

func NewMockAppConfig() *Mock

NewMockAppConfig returns an instance of Mock for AppConfig.

func (*Mock) GetConfig

func (m *Mock) GetConfig(reload bool) (appconfig SsmagentConfig, errs []error)

GetConfig is a mocked method that just returns what mock tells it to.

type OsInfo

type OsInfo struct {
	Lang    string
	Name    string
	Version string
}

OsInfo represents os related information

type S3Cfg

type S3Cfg struct {
	Region    string
	LogBucket string
	LogKey    string
}

S3Cfg represents configurations related to S3 bucket and key for SSM

type SsmCfg

type SsmCfg struct {
	Endpoint                    string
	HealthFrequencyMinutes      int
	AssociationFrequencyMinutes int
	AssociationRetryLimit       int
	// TODO: test hook, can be removed before release
	// this is to skip ssl verification for the beta self signed certs
	InsecureSkipVerify             bool
	CustomInventoryDefaultLocation string
}

SsmCfg represents configuration for Simple system manager (SSM)

type SsmagentConfig

type SsmagentConfig struct {
	Profile CredentialProfile
	Mds     MdsCfg
	Ssm     SsmCfg
	Agent   AgentInfo
	Os      OsInfo
	S3      S3Cfg
}

SsmagentConfig stores agent configuration values.

func Config

func Config(reload bool) (SsmagentConfig, error)

Config loads the app configuration for amazon-ssm-agent. If reload is true, it loads the config afresh, otherwise it returns a previous loaded version, if any.

func DefaultConfig

func DefaultConfig() SsmagentConfig

DefaultConfig returns default ssm agent configuration

func (SsmagentConfig) ProfileCredentials

func (config SsmagentConfig) ProfileCredentials() (credsInConfig *credentials.Credentials, err error)

ProfileCredentials checks to see if specific profile is being asked to use

Jump to

Keyboard shortcuts

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