Documentation
¶
Index ¶
Constants ¶
View Source
const ( // V2TokenTTLHeader defines the HTTP header used by the IMDS service for // generating a new IMDS session token V2TokenTTLHeader = "X-aws-ec2-metadata-token-ttl-seconds" )
Variables ¶
View Source
var DefaultOptions = Options{ AutoStart: true, ExcludeInstanceTags: false, IMDSv2: false, InstanceTags: map[string]string{ "Name": "imds-mock-ec2", }, Port: 1338, Pretty: false, Spot: false, SpotAction: SpotActionEvent{ Action: patch.TerminateSpotInstanceAction, Duration: 0 * time.Second, }, }
DefaultOptions defines the default set of options that will be applied to the IMDS mock upon startup
Functions ¶
Types ¶
type Options ¶
type Options struct { // AutoStart determines whether the IMDS mock immediately starts // after initialisation AutoStart bool // ExcludeInstanceTags controls if the IMDS mock excludes instance // tags from its supported list of metadata categories ExcludeInstanceTags bool // IMDSv2 enables exclusive V2 support only. All requests must contain // a valid metadata token, otherwise they will be rejected. By default // the mock will run with both V1 and V2 support IMDSv2 bool // InstanceTags contains a map of key value pairs that are to be // exposed as instance tags through the IMDS mock InstanceTags map[string]string // Port controls the port that is used by the IMDS mock. By default // it will use port 1338 Port int // Pretty controls if the JSON outputted by any instance category // is pretty printed. By default all JSON will be compacted Pretty bool // Spot enables the simulation of a spot instance and interruption notice // through the IMDS mock. By default this will set to false and an on-demand // instance will be simulated Spot bool // SpotAction defines the type of spot interruption event to be raised when // simulating a spot instance. By default the spot interruption will be // immediate, but can be delayed by a pre-configured interval SpotAction SpotActionEvent }
Options provides a set of options for configuring the behaviour of the IMDS mock
type SpotActionEvent ¶ added in v0.3.0
type SpotActionEvent struct { Action patch.SpotInstanceAction Duration time.Duration }
SpotActionEvent defines a spot interruption event
Click to show internal directories.
Click to hide internal directories.