tagit

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdExecutor added in v0.0.2

type CmdExecutor struct{}

func (*CmdExecutor) Execute added in v0.0.2

func (e *CmdExecutor) Execute(command string) ([]byte, error)

type CommandExecutor added in v0.0.2

type CommandExecutor interface {
	Execute(command string) ([]byte, error)
}

CommandExecutor is an interface for running commands.

type ConsulAPIWrapper added in v0.0.2

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

ConsulAPIWrapper wraps the Consul API client to conform to the ConsulClient interface.

func NewConsulAPIWrapper added in v0.0.2

func NewConsulAPIWrapper(client *api.Client) *ConsulAPIWrapper

NewConsulAPIWrapper creates a new instance of ConsulAPIWrapper.

func (*ConsulAPIWrapper) Agent added in v0.0.2

func (w *ConsulAPIWrapper) Agent() ConsulAgent

Agent returns an object that conforms to the ConsulAgent interface.

type ConsulAgent added in v0.0.2

type ConsulAgent interface {
	Services() (map[string]*api.AgentService, error)
	ServiceRegister(*api.AgentServiceRegistration) error
}

ConsulClientAgent is an interface for the Consul agent.

type ConsulClient added in v0.0.2

type ConsulClient interface {
	Agent() ConsulAgent
}

ConsulClient is an interface for the Consul client.

type TagIt

type TagIt struct {
	ConsulAddr string
	ServiceID  string
	Script     string
	Interval   time.Duration
	Token      string
	TagPrefix  string
	// contains filtered or unexported fields
}

TagIt is the main struct for the tagit flow.

func New

func New(consulClient ConsulClient, commandExecutor CommandExecutor, serviceID string, script string, interval time.Duration, tagPrefix string) *TagIt

New creates a new TagIt struct.

func (*TagIt) CleanupTags added in v0.0.2

func (t *TagIt) CleanupTags() error

CleanupTags removes all tags with the given prefix from the service.

func (*TagIt) Run

func (t *TagIt) Run(ctx context.Context)

Run will run the tagit flow and tag consul services based on the script output

Jump to

Keyboard shortcuts

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