ec2metadata

package
v0.0.0-...-81f2ad6 Latest Latest
Warning

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

Go to latest
Published: May 27, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound             = errors.New("not found")
	ErrUnexpectedStatusCode = errors.New("unexpected status code")
)

Functions

This section is empty.

Types

type ASGReBalanceResponse

type ASGReBalanceResponse struct {
	Time time.Time `json:"noticeTime"`
}

type InstanceInfo

type InstanceInfo struct {
	InstanceID       string `json:"instance_id"`
	AutoscalingGroup string `json:"autoscaling_group"`
	LifecycleHook    string `json:"lifecycle_hook"`
}

type LifecycleResponse

type LifecycleResponse struct {
	State string `json:"state"`
}

type MetadataServiceConfig

type MetadataServiceConfig struct {
	TokenTTL int
	Host     string
	Port     string
}

func DefaultConfig

func DefaultConfig() *MetadataServiceConfig

type Service

type Service interface {
	GetToken(ctx context.Context) (string, error)
	GetInstanceInfo(ctx context.Context, token string) (*InstanceInfo, error)
	GetASGReBalance(ctx context.Context, token string) (*ASGReBalanceResponse, error)
	GetSpotInterruption(ctx context.Context, token string) (*SpotInterruptionResponse, error)
	GetLifecycle(ctx context.Context, token string) (*LifecycleResponse, error)
}

func NewService

func NewService(cfg *MetadataServiceConfig) Service

type SpotInterruptionResponse

type SpotInterruptionResponse struct {
	Action string    `json:"action"`
	Time   time.Time `json:"time"`
}

Jump to

Keyboard shortcuts

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