Documentation ¶
Index ¶
- 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 GetCfgMdPathsPrefix() string
- func GetCfgMdValPrefix() string
- func GetDefaultCfgFileName() string
- func GetMetadataDefaults() (map[string]interface{}, map[string]interface{})
- func GetMetadataValueToPlaceholderPathsKeyMap() map[string][]string
- func GetSavedCfgFileName() string
- func LoadConfigForRoot(configFileFlagName string, cmdDefaults map[string]interface{})
- func LoadConfigFromDefaults(cmdDefaults map[string]interface{})
- func SetMetadataDefaults(jsonWithDefaults []byte)
- func SetServerCfgDefaults()
- func WriteConfigToFile()
- type Config
- type Metadata
- type Paths
- type Server
- type Values
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 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 GetDefaultCfgFileName ¶
func GetDefaultCfgFileName() string
GetDefaultCfgFileName returns the default CLI config file name with path
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 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 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 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"` // ----- CLI config ----- // // config keys that are also cli flags CfgFile string `mapstructure:"config-file"` MockDelayInSec int64 `mapstructure:"mock-delay-sec"` SaveConfigToFile bool `mapstructure:"save-config-to-file"` Server Server `mapstructure:"server"` Imdsv2Required bool `mapstructure:"imdsv2"` // config keys for subcommands SpotConfig spot.Config `mapstructure:"spot"` EventsConfig events.Config `mapstructure:"events"` }
Config set via various input sources (Sample CLI config in cli-config.json)
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"` 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"` InstanceType string `mapstructure:"instance-type"` 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"` 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"` ProductCodes string `mapstructure:"product-codes"` PublicHostName string `mapstructure:"public-hostname"` PublicIpv4 string `mapstructure:"public-ipv4"` PublicKey string `mapstructure:"public-key"` 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"` }
Paths represents EC2 metadata 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"` InstanceType string `mapstructure:"instance-type"` 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"` 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"` ProductCodes string `mapstructure:"product-codes"` PublicHostName string `mapstructure:"public-hostname"` PublicIpv4 string `mapstructure:"public-ipv4"` PublicKey string `mapstructure:"public-key"` ReservationID string `mapstructure:"reservation-id"` SecurityGroups string `mapstructure:"security-groups"` ServicesDomain string `mapstructure:"services-domain"` ServicesPartition string `mapstructure:"services-partition"` }
Values represents config used in the mock responses