Documentation ¶
Index ¶
- func BindDynamicCfg(flag *pflag.Flag)
- func BindFlagSet(flagSet *pflag.FlagSet)
- func BindFlagSetWithKeyPrefix(flagSet *pflag.FlagSet, keyPrefix string)
- func BindMetadataCfg(flag *pflag.Flag)
- func BindServerCfg(flag *pflag.Flag)
- func BindTopLevelGFlags(flags []*pflag.Flag)
- func BindUserdataCfg(flag *pflag.Flag)
- func GetCfgDnPathsPrefix() string
- func GetCfgDnValPrefix() string
- func GetCfgMdPathsPrefix() string
- func GetCfgMdValPrefix() string
- func GetCfgUdPathsPrefix() string
- func GetCfgUdValPrefix() string
- func GetDefaultCfgFileName() string
- func GetDynamicDefaults() (map[string]interface{}, map[string]interface{})
- func GetDynamicValueToPlaceholderPathsKeyMap() map[string][]string
- func GetMetadataDefaults() (map[string]interface{}, map[string]interface{})
- func GetMetadataValueToPlaceholderPathsKeyMap() map[string][]string
- func GetSavedCfgFileName() string
- func GetUserdataDefaults() (map[string]interface{}, map[string]interface{})
- func GetUserdataValueToPlaceholderPathsKeyMap() map[string][]string
- func LoadConfigForRoot(configFileFlagName string, cmdDefaults map[string]interface{})
- func LoadConfigFromDefaults(cmdDefaults map[string]interface{})
- func SetDynamicDefaults(jsonWithDefaults []byte)
- func SetMetadataDefaults(jsonWithDefaults []byte)
- func SetServerCfgDefaults()
- func SetUserdataDefaults(jsonWithDefaults []byte)
- func WriteConfigToFile()
- type Config
- type Dynamic
- type DynamicPaths
- type DynamicValues
- type Metadata
- type Paths
- type Server
- type Userdata
- type UserdataPaths
- type UserdataValues
- type Values
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindDynamicCfg ¶ added in v1.2.0
BindDynamicCfg binds a flag that represents a dynamic value to configuration
func BindFlagSet ¶
BindFlagSet binds the given flag set to the config, using each flag's long name as the config key.
func BindFlagSetWithKeyPrefix ¶
BindFlagSetWithKeyPrefix binds the given flag set to the config, using prefix + flag's long name as the config key.
func BindMetadataCfg ¶
BindMetadataCfg binds a flag that represents a metadata value to configuration
func BindServerCfg ¶
BindServerCfg binds a flag that represents a server config to configuration
func BindTopLevelGFlags ¶
BindTopLevelGFlags binds the global flags that need to be at top level of the config with Viper.
func BindUserdataCfg ¶ added in v1.11.0
BindUserdataCfg binds a flag that represents a userdata value to configuration
func GetCfgDnPathsPrefix ¶ added in v1.2.0
func GetCfgDnPathsPrefix() string
GetCfgDnPathsPrefix returns the prefix to use to access dynamic values in config
func GetCfgDnValPrefix ¶ added in v1.2.0
func GetCfgDnValPrefix() string
GetCfgDnValPrefix returns the prefix to use to access dynamic values in config
func GetCfgMdPathsPrefix ¶
func GetCfgMdPathsPrefix() string
GetCfgMdPathsPrefix returns the prefix to use to access metadata values in config
func GetCfgMdValPrefix ¶
func GetCfgMdValPrefix() string
GetCfgMdValPrefix returns the prefix to use to access metadata values in config
func GetCfgUdPathsPrefix ¶ added in v1.11.0
func GetCfgUdPathsPrefix() string
GetCfgUdPathsPrefix returns the prefix to use to access userdata values in config
func GetCfgUdValPrefix ¶ added in v1.11.0
func GetCfgUdValPrefix() string
GetCfgUdValPrefix returns the prefix to use to access userdata values in config
func GetDefaultCfgFileName ¶
func GetDefaultCfgFileName() string
GetDefaultCfgFileName returns the default CLI config file name with path
func GetDynamicDefaults ¶ added in v1.2.0
GetDynamicDefaults returns config defaults for dynamic paths and values
func GetDynamicValueToPlaceholderPathsKeyMap ¶ added in v1.2.0
GetDynamicValueToPlaceholderPathsKeyMap returns collection of dynamic values that are substituted into paths
func GetMetadataDefaults ¶
GetMetadataDefaults returns config defaults for metadata paths and values
func GetMetadataValueToPlaceholderPathsKeyMap ¶
GetMetadataValueToPlaceholderPathsKeyMap returns collection of metadata values that are substituted into paths
func GetSavedCfgFileName ¶
func GetSavedCfgFileName() string
GetSavedCfgFileName returns the default CLI config file name with path
func GetUserdataDefaults ¶ added in v1.11.0
GetUserdataDefaults returns config defaults for userdata paths and values
func GetUserdataValueToPlaceholderPathsKeyMap ¶ added in v1.11.0
GetUserdataValueToPlaceholderPathsKeyMap returns collection of userdata values that are substituted into paths
func LoadConfigForRoot ¶
LoadConfigForRoot is initiated by the root command. It loads config from various input sources
func LoadConfigFromDefaults ¶
func LoadConfigFromDefaults(cmdDefaults map[string]interface{})
LoadConfigFromDefaults loads the given defaults into the config
func SetDynamicDefaults ¶ added in v1.2.0
func SetDynamicDefaults(jsonWithDefaults []byte)
SetDynamicDefaults sets config defaults for dynamic paths and values
func SetMetadataDefaults ¶
func SetMetadataDefaults(jsonWithDefaults []byte)
SetMetadataDefaults sets config defaults for metadata paths and values
func SetServerCfgDefaults ¶
func SetServerCfgDefaults()
SetServerCfgDefaults sets config defaults for server config
func SetUserdataDefaults ¶ added in v1.11.0
func SetUserdataDefaults(jsonWithDefaults []byte)
SetUserdataDefaults sets config defaults for userdata paths and values
func WriteConfigToFile ¶
func WriteConfigToFile()
WriteConfigToFile attempts to save the configuration to a local file
Types ¶
type Config ¶
type Config struct { // ----- metadata config ----- // Metadata Metadata `mapstructure:"metadata"` // ----- userdata config ----- // Userdata Userdata `mapstructure:"userdata"` // ----- CLI config ----- // // config keys that are also cli flags CfgFile string `mapstructure:"config-file"` MockDelayInSec int64 `mapstructure:"mock-delay-sec"` MockTriggerTime string `mapstructure:"mock-trigger-time"` MockIPCount int `mapstructure:"mock-ip-count"` SaveConfigToFile bool `mapstructure:"save-config-to-file"` Server Server `mapstructure:"server"` Imdsv2Required bool `mapstructure:"imdsv2"` RebalanceDelayInSec int64 `mapstructure:"rebalance-delay-sec"` RebalanceTriggerTime string `mapstructure:"rebalance-trigger-time"` ASGTerminationDelayInSec int64 `mapstructure:"asg-termination-delay-sec"` ASGTerminationTriggerTime string `mapstructure:"asg-termination-trigger-time"` // config keys for subcommands SpotConfig spot.Config `mapstructure:"spot"` EventsConfig events.Config `mapstructure:"events"` // ----- dynamic config ----- // Dynamic Dynamic `mapstructure:"dynamic"` }
Config set via various input sources (Sample CLI config in cli-config.json)
type Dynamic ¶ added in v1.2.0
type Dynamic struct { Paths DynamicPaths `mapstructure:"paths"` Values DynamicValues `mapstructure:"values"` }
Dynamic represents metadata config used by the mock (Json values in metadata-config.json)
type DynamicPaths ¶ added in v1.2.0
type DynamicPaths struct { InstanceIdentityDocument string `mapstructure:"instance-identity-document"` InstanceIdentityPKCS string `mapstructure:"instance-identity-pkcs"` InstanceIdentitySignature string `mapstructure:"instance-identity-signature"` FwsInstanceMonitoring string `mapstructure:"fws-instance-monitoring"` }
DynamicPaths represents EC2 dynamic paths
type DynamicValues ¶ added in v1.2.0
type DynamicValues struct { InstanceIdentityDocument dynamic.InstanceIdentityDocument `mapstructure:"instance-identity-document"` InstanceIdentityPKCS string `mapstructure:"instance-identity-pkcs"` InstanceIdentitySignature string `mapstructure:"instance-identity-signature"` FwsInstanceMonitoring string `mapstructure:"fws-instance-monitoring"` }
DynamicValues represents EC2 dynamic paths
type Metadata ¶
Metadata represents metadata config used by the mock (Json values in metadata-config.json)
type Paths ¶
type Paths struct { AmiID string `mapstructure:"ami-id"` AmiLaunchIndex string `mapstructure:"ami-launch-index"` AmiManifestPath string `mapstructure:"ami-manifest-path"` ASGLifecycle string `mapstructure:"target-lifecycle-state"` BlockDeviceMappingAmi string `mapstructure:"block-device-mapping-ami"` BlockDeviceMappingEbs string `mapstructure:"block-device-mapping-ebs"` BlockDeviceMappingEphemeral string `mapstructure:"block-device-mapping-ephemeral"` BlockDeviceMappingRoot string `mapstructure:"block-device-mapping-root"` BlockDeviceMappingSwap string `mapstructure:"block-device-mapping-swap"` ElasticInferenceAccelerator string `mapstructure:"elastic-inference-accelerator"` ElasticInferenceAssociations string `mapstructure:"elastic-inference-associations"` Events string `mapstructure:"events"` Hostname string `mapstructure:"hostname"` IamInformation string `mapstructure:"iam-info"` IamSecurityCredentialsRole string `mapstructure:"iam-security-credentials-role"` IamSecurityCredentials string `mapstructure:"iam-security-credentials"` InstanceAction string `mapstructure:"instance-action"` InstanceID string `mapstructure:"instance-id"` InstanceLifecycle string `mapstructure:"instance-life-cycle"` InstanceType string `mapstructure:"instance-type"` KernelID string `mapstructure:"kernel-id"` LocalHostName string `mapstructure:"local-hostname"` LocalIpv4 string `mapstructure:"local-ipv4"` Mac string `mapstructure:"mac"` MacDeviceNumber string `mapstructure:"mac-device-number"` MacNetworkInterfaceID string `mapstructure:"mac-network-interface-id"` MacNetworkInterfaceCardIndex string `mapstructure:"mac-network-interface-card-index"` MacIpv4Associations string `mapstructure:"mac-ipv4-associations"` MacIpv6Associations string `mapstructure:"mac-ipv6-associations"` MacLocalHostname string `mapstructure:"mac-local-hostname"` MacLocalIpv4s string `mapstructure:"mac-local-ipv4s"` MacMac string `mapstructure:"mac-mac"` MacOwnerID string `mapstructure:"mac-owner-id"` MacPublicHostname string `mapstructure:"mac-public-hostname"` MacPublicIpv4s string `mapstructure:"mac-public-ipv4s"` MacSecurityGroups string `mapstructure:"mac-security-groups"` MacSecurityGroupIds string `mapstructure:"mac-security-group-ids"` MacSubnetID string `mapstructure:"mac-subnet-id"` MacSubnetIpv4CidrBlock string `mapstructure:"mac-subnet-ipv4-cidr-block"` MacSubnetIpv6CidrBlocks string `mapstructure:"mac-subnet-ipv6-cidr-blocks"` MacVpcID string `mapstructure:"mac-vpc-id"` MacVpcIpv4CidrBlock string `mapstructure:"mac-vpc-ipv4-cidr-block"` MacVpcIpv4CidrBlocks string `mapstructure:"mac-vpc-ipv4-cidr-blocks"` MacVpcIpv6CidrBlocks string `mapstructure:"mac-vpc-ipv6-cidr-blocks"` PlacementAvailabilityZone string `mapstructure:"placement-availability-zone"` PlacementAvailabilityZoneID string `mapstructure:"placement-availability-zone-id"` PlacementGroupName string `mapstructure:"placement-group-name"` PlacementHostID string `mapstructure:"placement-host-id"` PlacementPartitionNumber string `mapstructure:"placement-partition-number"` PlacementRegion string `mapstructure:"placement-region"` ProductCodes string `mapstructure:"product-codes"` PublicHostName string `mapstructure:"public-hostname"` PublicIpv4 string `mapstructure:"public-ipv4"` PublicKey string `mapstructure:"public-key"` RamdiskID string `mapstructure:"ramdisk-id"` ReservationID string `mapstructure:"reservation-id"` SecurityGroups string `mapstructure:"security-groups"` ServicesDomain string `mapstructure:"services-domain"` ServicesPartition string `mapstructure:"services-partition"` Spot string `mapstructure:"spot"` SpotTerminationTime string `mapstructure:"spot-termination-time"` RebalanceRecTime string `mapstructure:"rebalance-rec-time"` TagsInstanceName string `mapstructure:"tags-instance-name"` TagsInstanceTest string `mapstructure:"tags-instance-test"` }
Paths represents EC2 metadata paths
type Userdata ¶ added in v1.11.0
type Userdata struct { Paths UserdataPaths `mapstructure:"paths"` Values UserdataValues `mapstructure:"values"` }
Userdata represents userdata config used by the mock (Json values in metadata-config.json)
type UserdataPaths ¶ added in v1.11.0
type UserdataPaths struct {
Userdata string `mapstructure:"userdata"`
}
UserdataPaths represents EC2 userdata paths
type UserdataValues ¶ added in v1.11.0
type UserdataValues struct {
Userdata string `mapstructure:"userdata"`
}
UserdataValues represents EC2 userdata paths
type Values ¶
type Values struct { AmiID string `mapstructure:"ami-id"` AmiLaunchIndex string `mapstructure:"ami-launch-index"` AmiManifestPath string `mapstructure:"ami-manifest-path"` BlockDeviceMappingAmi string `mapstructure:"block-device-mapping-ami"` BlockDeviceMappingEbs string `mapstructure:"block-device-mapping-ebs"` BlockDeviceMappingEphemeral string `mapstructure:"block-device-mapping-ephemeral"` BlockDeviceMappingRoot string `mapstructure:"block-device-mapping-root"` BlockDeviceMappingSwap string `mapstructure:"block-device-mapping-swap"` ElasticInferenceAccelerator types.ElasticInferenceAccelerator `mapstructure:"elastic-inference-accelerator"` ElasticInferenceAssociations string `mapstructure:"elastic-inference-associations"` EventID string `mapstructure:"event-id" json:"EventId"` Hostname string `mapstructure:"hostname"` IamInformation types.IamInformation `mapstructure:"iam-info"` IamSecurityCredentialsRole string `mapstructure:"iam-security-credentials-role"` IamSecurityCredentials types.IamSecurityCredentials `mapstructure:"iam-security-credentials"` InstanceAction string `mapstructure:"instance-action"` InstanceID string `mapstructure:"instance-id"` InstanceLifecycle string `mapstructure:"instance-life-cycle"` InstanceType string `mapstructure:"instance-type"` KernelID string `mapstructure:"kernel-id"` LocalHostName string `mapstructure:"local-hostname"` LocalIpv4 string `mapstructure:"local-ipv4"` Mac string `mapstructure:"mac"` MacDeviceNumber string `mapstructure:"mac-device-number"` MacNetworkInterfaceID string `mapstructure:"mac-network-interface-id"` MacNetworkInterfaceCardIndex string `mapstructure:"mac-network-interface-card-index"` MacIpv4Associations string `mapstructure:"mac-ipv4-associations"` MacIpv6Associations string `mapstructure:"mac-ipv6-associations"` MacLocalHostname string `mapstructure:"mac-local-hostname"` MacLocalIpv4s string `mapstructure:"mac-local-ipv4s"` MacMac string `mapstructure:"mac-mac"` MacOwnerID string `mapstructure:"mac-owner-id"` MacPublicHostname string `mapstructure:"mac-public-hostname"` MacPublicIpv4s string `mapstructure:"mac-public-ipv4s"` MacSecurityGroups string `mapstructure:"mac-security-groups"` MacSecurityGroupIds string `mapstructure:"mac-security-group-ids"` MacSubnetID string `mapstructure:"mac-subnet-id"` MacSubnetIpv4CidrBlock string `mapstructure:"mac-subnet-ipv4-cidr-block"` MacSubnetIpv6CidrBlocks string `mapstructure:"mac-subnet-ipv6-cidr-blocks"` MacVpcID string `mapstructure:"mac-vpc-id"` MacVpcIpv4CidrBlock string `mapstructure:"mac-vpc-ipv4-cidr-block"` MacVpcIpv4CidrBlocks string `mapstructure:"mac-vpc-ipv4-cidr-blocks"` MacVpcIpv6CidrBlocks string `mapstructure:"mac-vpc-ipv6-cidr-blocks"` PlacementAvailabilityZone string `mapstructure:"placement-availability-zone"` PlacementAvailabilityZoneID string `mapstructure:"placement-availability-zone-id"` PlacementGroupName string `mapstructure:"placement-group-name"` PlacementHostID string `mapstructure:"placement-host-id"` PlacementPartitionNumber string `mapstructure:"placement-partition-number"` PlacementRegion string `mapstructure:"placement-region"` ProductCodes string `mapstructure:"product-codes"` PublicHostName string `mapstructure:"public-hostname"` PublicIpv4 string `mapstructure:"public-ipv4"` PublicKey string `mapstructure:"public-key"` RamdiskID string `mapstructure:"ramdisk-id"` ReservationID string `mapstructure:"reservation-id"` SecurityGroups string `mapstructure:"security-groups"` ServicesDomain string `mapstructure:"services-domain"` ServicesPartition string `mapstructure:"services-partition"` TagsInstanceName string `mapstructure:"tags-instance-name"` TagsInstanceTest string `mapstructure:"tags-instance-test"` }
Values represents config used in the mock responses