metadata

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PathAmiId                                                = "ami-id"
	PathAmiLaunchIndex                                       = "ami-launch-index"
	PathAmiManifestPath                                      = "ami-manifest-path"
	PathBlockDeviceMappingAmi                                = "block-device-mapping/ami"
	PathBlockDeviceMappingEbs2                               = "block-device-mapping/ebs2"
	PathBlockDeviceMappingRoot                               = "block-device-mapping/root"
	PathEventsMaintenanceHistory                             = "events/maintenance/history"
	PathEventsMaintenanceScheduled                           = "events/maintenance/scheduled"
	PathHostname                                             = "hostname"
	PathIamInfo                                              = "iam/info"
	PathIamSecurityCredentialList                            = "iam/security-credentials/"
	PathIamSecurityCredentials                               = "iam/security-credentials/%s"
	PathIdentityCredentialsEC2Info                           = "identity-credentials/ec2/info"
	PathIdentityCredentialsEC2SecurityCredentialsEC2Instance = "identity-credentials/ec2/security-credentials/ec2-instance"
	PathInstanceAction                                       = "instance-action"
	PathInstanceId                                           = "instance-id"
	PathInstanceLifeCycle                                    = "instance-life-cycle"
	PathInstanceType                                         = "instance-type"
	PathLocalHostname                                        = "local-hostname"
	PathLocalIpv4                                            = "local-ipv4"
	PathMac                                                  = "mac"
	PathMetricsVhostmd                                       = "metrics/vhostmd"
	PathNetworkInterfaces                                    = "network/interfaces/macs/"
	PathNetworkInterfacesDeviceNumber                        = "network/interfaces/macs/%s/device-number"
	PathNetworkInterfacesInterfaceId                         = "network/interfaces/macs/%s/interface-id"
	PathNetworkInterfacesLocalHostname                       = "network/interfaces/macs/%s/local-hostname"
	PathNetworkInterfacesLocalIpv4s                          = "network/interfaces/macs/%s/local-ipv4s"
	PathNetworkInterfacesMac                                 = "network/interfaces/macs/%s/mac"
	PathNetworkInterfacesNetworkCard                         = "network/interfaces/macs/%s/network-card"
	PathNetworkInterfacesOwnerId                             = "network/interfaces/macs/%s/owner-id"
	PathNetworkInterfacesSecurityGroupIds                    = "network/interfaces/macs/%s/security-group-ids"
	PathNetworkInterfacesSecurityGroups                      = "network/interfaces/macs/%s/security-groups"
	PathNetworkInterfacesSubnetId                            = "network/interfaces/macs/%s/subnet-id"
	PathNetworkInterfacesSubnetIpv4CidrBlock                 = "network/interfaces/macs/%s/subnet-ipv4-cidr-block"
	PathNetworkInterfacesSubnetIpv6CidrBlocks                = "network/interfaces/macs/%s/subnet-ipv6-cidr-blocks"
	PathNetworkInterfacesVpcId                               = "network/interfaces/macs/%s/vpc-id"
	PathNetworkInterfacesVpcIpv4CidrBlock                    = "network/interfaces/macs/%s/vpc-ipv4-cidr-block"
	PathNetworkInterfacesVpcIpv4CidrBlocks                   = "network/interfaces/macs/%s/vpc-ipv4-cidr-blocks"
	PathNetworkInterfacesVpcIpv6CidrBlocks                   = "network/interfaces/macs/%s/vpc-ipv6-cidr-blocks"
	PathPlacementAvailabilityZone                            = "placement/availability-zone"
	PathPlacementAvailabilityZoneId                          = "placement/availability-zone-id"
	PathPlacementRegion                                      = "placement/region"
	PathProfile                                              = "profile"
	PathReservationId                                        = "reservation-id"
	PathSecurityGroups                                       = "security-groups"
	PathServicesDomain                                       = "services/domain"
	PathServicesPartition                                    = "services/partition"
	PathSystem                                               = "system"
)

Variables

View Source
var ErrNotAvailable = fmt.Errorf("metadata not available")

Functions

This section is empty.

Types

type Provider

type Provider interface {
	GetMetadata(ctx context.Context, path string) (string, error)
}

A Provider gives you convenient access to the metadata of your EC2 instance. See also https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html.

func NewProviderWithInterfaces

func NewProviderWithInterfaces(httpClient http.Client, clock clock.Clock, settings Settings) Provider

func ProvideProvider

func ProvideProvider(ctx context.Context, config cfg.Config, logger log.Logger) (Provider, error)

type Settings

type Settings struct {
	// The Host setting allows you to overwrite the endpoint we query metadata from
	Host string `cfg:"host" default:"169.254.169.254"`
	// If you are not running on a EC2 instance, you can set Available to false, and we won't try to query a non-existing
	// endpoint, but instead return a NotAvailableError. Calling code is expected to handle this error and react accordingly.
	Available bool `cfg:"available" default:"true"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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