ec2

package
v0.0.0-...-b702281 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const (

	// InstanceMaxTagsNum is the maximum number of tags that an instance can have.
	InstanceMaxTagsNum = 50

	ResourceIDFilterName            = "resource-id"
	ResourceTypeFilterName          = "resource-type"
	ResourceTypeFilterValueInstance = "instance"
)
View Source
const (
	SecurityCredentialsResource               = "iam/security-credentials/"
	InstanceIdentityDocumentResource          = "instance-identity/document"
	InstanceIdentityDocumentSignatureResource = "instance-identity/signature"
	MacResource                               = "mac"
	AllMacResource                            = "network/interfaces/macs"
	VPCIDResourceFormat                       = "network/interfaces/macs/%s/vpc-id"
	SubnetIDResourceFormat                    = "network/interfaces/macs/%s/subnet-id"
	SpotInstanceActionResource                = "spot/instance-action"
	InstanceIDResource                        = "instance-id"
	PrivateIPv4Resource                       = "local-ipv4"
	PublicIPv4Resource                        = "public-ipv4"
	OutpostARN                                = "outpost-arn"
	PrimaryIPV4VPCCIDRResourceFormat          = "network/interfaces/macs/%s/vpc-ipv4-cidr-block"
	TargetLifecycleState                      = "autoscaling/target-lifecycle-state"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	CreateTags(input *ec2sdk.CreateTagsInput) (*ec2sdk.CreateTagsOutput, error)
	DescribeECSTagsForInstance(instanceID string) ([]*ecs.Tag, error)
}

func NewClientImpl

func NewClientImpl(awsRegion string) Client

type ClientImpl

type ClientImpl struct {
	// contains filtered or unexported fields
}

func (*ClientImpl) CreateTags

func (c *ClientImpl) CreateTags(input *ec2sdk.CreateTagsInput) (*ec2sdk.CreateTagsOutput, error)

func (*ClientImpl) DescribeECSTagsForInstance

func (c *ClientImpl) DescribeECSTagsForInstance(instanceID string) ([]*ecs.Tag, error)

DescribeECSTagsForInstance calls DescribeTags API to get the EC2 tags of the instance id, and return it back as ECS tags

func (*ClientImpl) SetClientSDK

func (c *ClientImpl) SetClientSDK(sdk ClientSDK)

SetSDK overrides the SDK to the given one. This is useful for injecting a test implementation

type ClientSDK

type ClientSDK interface {
	CreateTags(input *ec2sdk.CreateTagsInput) (*ec2sdk.CreateTagsOutput, error)
	DescribeTags(input *ec2sdk.DescribeTagsInput) (*ec2sdk.DescribeTagsOutput, error)
}

type EC2MetadataClient

type EC2MetadataClient interface {
	DefaultCredentials() (*RoleCredentials, error)
	GetMetadata(string) (string, error)
	GetDynamicData(string) (string, error)
	InstanceIdentityDocument() (ec2metadata.EC2InstanceIdentityDocument, error)
	VPCID(mac string) (string, error)
	SubnetID(mac string) (string, error)
	PrimaryENIMAC() (string, error)
	AllENIMacs() (string, error)
	InstanceID() (string, error)
	GetUserData() (string, error)
	Region() (string, error)
	PrivateIPv4Address() (string, error)
	PublicIPv4Address() (string, error)
	SpotInstanceAction() (string, error)
	OutpostARN() (string, error)
	TargetLifecycleState() (string, error)
}

EC2MetadataClient is the client used to get metadata from instance metadata service

func NewBlackholeEC2MetadataClient

func NewBlackholeEC2MetadataClient() EC2MetadataClient

func NewEC2MetadataClient

func NewEC2MetadataClient(client HttpClient) EC2MetadataClient

NewEC2MetadataClient creates an ec2metadata client to retrieve metadata

type HttpClient

type HttpClient interface {
	GetMetadata(string) (string, error)
	GetDynamicData(string) (string, error)
	GetInstanceIdentityDocument() (ec2metadata.EC2InstanceIdentityDocument, error)
	GetUserData() (string, error)
	Region() (string, error)
}

type RoleCredentials

type RoleCredentials struct {
	Code            string    `json:"Code"`
	LastUpdated     time.Time `json:"LastUpdated"`
	Type            string    `json:"Type"`
	AccessKeyId     string    `json:"AccessKeyId"`
	SecretAccessKey string    `json:"SecretAccessKey"`
	Token           string    `json:"Token"`
	Expiration      time.Time `json:"Expiration"`
}

RoleCredentials contains the information associated with an IAM role

Directories

Path Synopsis
mocks
Package mock_http is a generated GoMock package.
Package mock_http is a generated GoMock package.
Package mock_ec2 is a generated GoMock package.
Package mock_ec2 is a generated GoMock package.

Jump to

Keyboard shortcuts

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