taskmetadata

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultURL represents Task Metadata URL
	DefaultURL = "http://169.254.170.2"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	GetMetadata(context.Context) (*ecsTypes.TaskResponse, error)
	GetStats(context.Context) (map[string]*dockerTypes.Stats, error)
}

Client interface gets metadata and stats

func NewClient

func NewClient(baseURL string, ignoreContainer *regexp.Regexp) (Client, error)

NewClient creates a new Client

type MockClient

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

MockClient a mock client of ECS task metadata endpoint

func NewMockClient

func NewMockClient(opts ...MockClientOption) *MockClient

NewMockClient creates a new mock client of ECS task metadata endpoint

func (*MockClient) ApplyOption

func (c *MockClient) ApplyOption(opt MockClientOption)

ApplyOption applies a mock client option

func (*MockClient) GetMetadata

func (c *MockClient) GetMetadata(ctx context.Context) (*ecsTypes.TaskResponse, error)

GetMetadata ...

func (*MockClient) GetStats

func (c *MockClient) GetStats(ctx context.Context) (map[string]*dockerTypes.Stats, error)

GetStats ...

type MockClientOption

type MockClientOption func(*MockClient)

MockClientOption represents an option of mock client of ECS task metadata endpoint

func MockGetMetadata

func MockGetMetadata(callback func(context.Context) (*ecsTypes.TaskResponse, error)) MockClientOption

MockGetMetadata returns an option to set the callback of GetMetadata

func MockGetStats

func MockGetStats(callback func(context.Context) (map[string]*dockerTypes.Stats, error)) MockClientOption

MockGetStats returns an option to set the callback of GetStats

Jump to

Keyboard shortcuts

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