clecsmeta

package
v0.39.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package clecsmeta provides metadata information about the ECS instance the code is running on.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoMetadataURI = errors.New("no metadata uri provided")

ErrNoMetadataURI if the code provided no metadata uri.

Functions

func Provide

func Provide() fx.Option

Provide configures the DI for providng rpc.

func TestProvide

func TestProvide() fx.Option

TestProvide provides the metadata for testing environment.

Types

type Config

type Config struct{}

Config configures this package.

type ContainerMetadataV4

type ContainerMetadataV4 struct {
	DockerID      string    `json:"DockerId"`
	Name          string    `json:"Name"`
	DockerName    string    `json:"DockerName"`
	Image         string    `json:"Image"`
	ImageID       string    `json:"ImageID"`
	Labels        LabelsV4  `json:"Labels"`
	DesiredStatus string    `json:"DesiredStatus"`
	KnownStatus   string    `json:"KnownStatus"`
	Limits        Limits    `json:"Limits"`
	CreatedAt     time.Time `json:"CreatedAt"`
	StartedAt     time.Time `json:"StartedAt"`
	Type          string    `json:"Type"`
	ContainerARN  string    `json:"ContainerARN"`
	LogDriver     string    `json:"LogDriver"`
	LogOptions    struct {
		AwsLogsCreateGroup string `json:"awslogs-create-group"`
		AwsLogsGroup       string `json:"awslogs-group"`
		AwsLogsStream      string `json:"awslogs-stream"`
		AwsRegion          string `json:"awslogs-region"`
	} `json:"LogOptions"`
	Networks []struct {
		NetworkMode              string   `json:"NetworkMode"`
		IPv4Addresses            []string `json:"IPv4Addresses"`
		AttachmentIndex          int      `json:"AttachmentIndex"`
		IPv4SubnetCIDRBlock      string   `json:"IPv4SubnetCIDRBlock"`
		MACAddress               string   `json:"MACAddress"`
		DomainNameServers        []string `json:"DomainNameServers"`
		DomainNameSearchList     []string `json:"DomainNameSearchList"`
		PrivateDNSName           string   `json:"PrivateDNSName"`
		SubnetGatewayIpv4Address string   `json:"SubnetGatewayIpv4Address"`
	} `json:"Networks"`
}

type LabelsV4

type LabelsV4 struct {
	EcsCluster               string `json:"-"`
	EcsContainerName         string `json:"-"`
	EcsTaskArn               string `json:"-"`
	EcsTaskDefinitionFamily  string `json:"-"`
	EcsTaskDefinitionVersion string `json:"-"`
	// contains filtered or unexported fields
}

func (LabelsV4) Get

func (l LabelsV4) Get(name string) string

func (*LabelsV4) UnmarshalJSON

func (l *LabelsV4) UnmarshalJSON(b []byte) error

type Limits

type Limits struct {
	CPU    float64 `json:"CPU"`
	Memory int     `json:"Memory"`
}

type Metadata

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

Metadata instance.

func New

func New(cfg Config, logs *zap.Logger, client *http.Client, ecsMetadataURI string) (*Metadata, error)

New inits the empty metadata.

func (*Metadata) Start

func (md *Metadata) Start(ctx context.Context) error

func (Metadata) TaskV4

func (md Metadata) TaskV4() TaskMetadataV4

type TaskMetadataV4

type TaskMetadataV4 struct {
	Cluster          string                `json:"Cluster"`
	TaskARN          string                `json:"TaskARN"`
	Family           string                `json:"Family"`
	Revision         string                `json:"Revision"`
	DesiredStatus    string                `json:"DesiredStatus"`
	KnownStatus      string                `json:"KnownStatus"`
	Limits           Limits                `json:"Limits"`
	PullStartedAt    time.Time             `json:"PullStartedAt"`
	PullStoppedAt    time.Time             `json:"PullStoppedAt"`
	AvailabilityZone string                `json:"AvailabilityZone"`
	LaunchType       string                `json:"LaunchType"`
	Containers       []ContainerMetadataV4 `json:"Containers"`
}

Jump to

Keyboard shortcuts

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