ecsutil

package module
v0.119.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package ecsutil provides a common task metadata definition and client for ECS environments

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Get(path string) ([]byte, error)
}

Client defines the basic HTTP client interface with GET response validation and content parsing

type ClientProvider

type ClientProvider interface {
	BuildClient() (Client, error)
}

ClientProvider defines

func NewClientProvider

func NewClientProvider(baseURL url.URL, clientSettings confighttp.ClientConfig, host component.Host, settings component.TelemetrySettings) ClientProvider

NewClientProvider creates the default rest client provider

type ContainerMetadata

type ContainerMetadata struct {
	ContainerARN  string            `json:"ContainerARN,omitempty"`
	ContainerName string            `json:"Name,omitempty"`
	CreatedAt     string            `json:"CreatedAt,omitempty"`
	DockerID      string            `json:"DockerId,omitempty"`
	DockerName    string            `json:"DockerName,omitempty"`
	ExitCode      *int64            `json:"ExitCode,omitempty"`
	FinishedAt    string            `json:"FinishedAt,omitempty"`
	Image         string            `json:"Image,omitempty"`
	ImageID       string            `json:"ImageID,omitempty"`
	KnownStatus   string            `json:"KnownStatus,omitempty"`
	Labels        map[string]string `json:"Labels,omitempty"`
	Limits        Limits            `json:"Limits,omitempty"`
	LogDriver     string            `json:"LogDriver,omitempty"`
	LogOptions    LogOptions        `json:"LogOptions,omitempty"`
	Networks      []Network         `json:"Networks,omitempty"`
	StartedAt     string            `json:"StartedAt,omitempty"`
	Type          string            `json:"Type,omitempty"`
}

ContainerMetadata defines container metadata for a container

type Limits

type Limits struct {
	CPU    *float64 `json:"CPU,omitempty"`
	Memory *uint64  `json:"Memory,omitempty"`
}

Limits defines the Cpu and Memory limits

type LogOptions

type LogOptions struct {
	LogGroup string `json:"awslogs-group,omitempty"`
	Region   string `json:"awslogs-region,omitempty"`
	Stream   string `json:"awslogs-stream,omitempty"`
}

LogOptions defines the CloudWatch configuration

type MetadataProvider

type MetadataProvider interface {
	FetchTaskMetadata() (*TaskMetadata, error)
	FetchContainerMetadata() (*ContainerMetadata, error)
}

func NewDetectedTaskMetadataProvider

func NewDetectedTaskMetadataProvider(set component.TelemetrySettings) (MetadataProvider, error)

func NewTaskMetadataProvider

func NewTaskMetadataProvider(client RestClient, logger *zap.Logger) MetadataProvider

type Network

type Network struct {
	IPv4Addresses []string `json:"IPv4Addresses,omitempty"`
	NetworkMode   string   `json:"NetworkMode,omitempty"`
}

type RestClient

type RestClient interface {
	GetResponse(path string) ([]byte, error)
}

RestClient is swappable for testing.

func NewRestClient

func NewRestClient(baseEndpoint url.URL, clientSettings confighttp.ClientConfig, settings component.TelemetrySettings) (RestClient, error)

type TaskMetadata

type TaskMetadata struct {
	AvailabilityZone string              `json:"AvailabilityZone,omitempty"`
	Cluster          string              `json:"Cluster,omitempty"`
	Containers       []ContainerMetadata `json:"Containers,omitempty"`
	Family           string              `json:"Family,omitempty"`
	KnownStatus      string              `json:"KnownStatus,omitempty"`
	LaunchType       string              `json:"LaunchType,omitempty"`
	Limits           Limits              `json:"Limits,omitempty"`
	PullStartedAt    string              `json:"PullStartedAt,omitempty"`
	PullStoppedAt    string              `json:"PullStoppedAt,omitempty"`
	Revision         string              `json:"Revision,omitempty"`
	ServiceName      string              `json:"ServiceName,omitempty"`
	TaskARN          string              `json:"TaskARN,omitempty"`
}

TaskMetadata defines task metadata for a task

type TaskMetadataRestClient

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

TaskMetadataRestClient is a thin wrapper around an ecs task metadata client, encapsulating endpoints and their corresponding http methods.

func NewRestClientFromClient

func NewRestClientFromClient(client Client) *TaskMetadataRestClient

NewRestClientFromClient creates a new copy of the Client

func (*TaskMetadataRestClient) GetResponse

func (c *TaskMetadataRestClient) GetResponse(path string) ([]byte, error)

GetResponse gets the desired path from the configured metadata endpoint

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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