Documentation
¶
Index ¶
- func IsNotFound(err error) bool
- type CachedIMDS
- type EC2MetadataIface
- type FakeIMDS
- type TypedIMDS
- func (imds TypedIMDS) GetAZ(ctx context.Context) (string, error)
- func (imds TypedIMDS) GetDeviceNumber(ctx context.Context, mac string) (int, error)
- func (imds TypedIMDS) GetIPv6s(ctx context.Context, mac string) ([]net.IP, error)
- func (imds TypedIMDS) GetInstanceID(ctx context.Context) (string, error)
- func (imds TypedIMDS) GetInstanceType(ctx context.Context) (string, error)
- func (imds TypedIMDS) GetInterfaceID(ctx context.Context, mac string) (string, error)
- func (imds TypedIMDS) GetLocalIPv4(ctx context.Context) (net.IP, error)
- func (imds TypedIMDS) GetLocalIPv4s(ctx context.Context, mac string) ([]net.IP, error)
- func (imds TypedIMDS) GetMAC(ctx context.Context) (string, error)
- func (imds TypedIMDS) GetMACs(ctx context.Context) ([]string, error)
- func (imds TypedIMDS) GetSecurityGroupIDs(ctx context.Context, mac string) ([]string, error)
- func (imds TypedIMDS) GetSubnetID(ctx context.Context, mac string) (string, error)
- func (imds TypedIMDS) GetSubnetIPv4CIDRBlock(ctx context.Context, mac string) (net.IPNet, error)
- func (imds TypedIMDS) GetSubnetIPv6CIDRBlocks(ctx context.Context, mac string) (net.IPNet, error)
- func (imds TypedIMDS) GetVPCIPv4CIDRBlocks(ctx context.Context, mac string) ([]net.IPNet, error)
- func (imds TypedIMDS) GetVPCIPv6CIDRBlocks(ctx context.Context, mac string) ([]net.IPNet, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNotFound ¶
IsNotFound returns true if the error was caused by an AWS API 404 response.
Types ¶
type CachedIMDS ¶
type CachedIMDS struct {
// contains filtered or unexported fields
}
CachedIMDS is a wrapper around EC2MetadataIface that adds a naive cache. There is no cache expiry, so don't use this for dynamic information.
func NewCachedIMDS ¶
func NewCachedIMDS(imds EC2MetadataIface) CachedIMDS
NewCachedIMDS creates a new CachedIMDS.
func (CachedIMDS) GetMetadataWithContext ¶
GetMetadataWithContext implements the EC2MetadataIface interface.
type EC2MetadataIface ¶
type EC2MetadataIface interface {
GetMetadataWithContext(ctx context.Context, p string) (string, error)
}
EC2MetadataIface is a subset of the EC2Metadata API.
type FakeIMDS ¶
type FakeIMDS map[string]interface{}
FakeIMDS is a trivial implementation of EC2MetadataIface using an in-memory map - for testing.
type TypedIMDS ¶
type TypedIMDS struct {
EC2MetadataIface
}
TypedIMDS is a typed wrapper around raw untyped IMDS SDK API.
func NewTypedIMDS ¶
func NewTypedIMDS(inner EC2MetadataIface) TypedIMDS
NewTypedIMDS returns a typed wrapper around raw untyped IMDS SDK API.
func (TypedIMDS) GetDeviceNumber ¶
GetDeviceNumber returns the unique device number associated with an interface. The primary interface is 0.
func (TypedIMDS) GetInstanceID ¶
GetInstanceID returns the ID of this instance.
func (TypedIMDS) GetInstanceType ¶
GetInstanceType returns the type of this instance.
func (TypedIMDS) GetInterfaceID ¶
GetInterfaceID returns the ID of the network interface.
func (TypedIMDS) GetLocalIPv4 ¶
GetLocalIPv4 returns the private (primary) IPv4 address of the instance.
func (TypedIMDS) GetLocalIPv4s ¶
GetLocalIPv4s returns the private IPv4 addresses associated with the interface. First returned address is the primary address.
func (TypedIMDS) GetSecurityGroupIDs ¶
GetSecurityGroupIDs returns the IDs of the security groups to which the network interface belongs.
func (TypedIMDS) GetSubnetID ¶
GetSubnetID returns the ID of the subnet in which the interface resides.
func (TypedIMDS) GetSubnetIPv4CIDRBlock ¶
GetSubnetIPv4CIDRBlock returns the IPv4 CIDR block for the subnet in which the interface resides.
func (TypedIMDS) GetSubnetIPv6CIDRBlocks ¶
GetSubnetIPv6CIDRBlocks returns the IPv6 CIDR block for the subnet in which the interface resides. Note, despite plural name, this only returns a single CIDR block.
func (TypedIMDS) GetVPCIPv4CIDRBlocks ¶
GetVPCIPv4CIDRBlocks returns the IPv4 CIDR blocks for the VPC.