resources

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLongOutputTemplate = `` /* 536-byte string literal not displayed */

DefaultLongOutputTemplate defines default template for the detailed output

View Source
var DefaultShortOutputTemplate = "" /* 452-byte string literal not displayed */

DefaultShortOutputTemplate defines default template for the list output

Functions

func ParseTemplate

func ParseTemplate(templateContent string) *template.Template

ParseTemplate creates template from template string

Types

type Ec2Instance

type Ec2Instance struct {
	NativeObject ec2.Instance

	ShortOutputTemplate string
	LongOutputTemplate  string
}

Ec2Instance represents resource for ec2 instances

func NewEc2Instance

func NewEc2Instance() *Ec2Instance

NewEc2Instance creates Ec2Instnace var with default render templates

func (*Ec2Instance) ConnectIdentifier

func (i *Ec2Instance) ConnectIdentifier(usePrivateID bool, useDNS bool) string

ConnectIdentifier returns the identifier (eg. IP or DNS name) which will be used when connecting to instances

func (*Ec2Instance) GetTag

func (i *Ec2Instance) GetTag(tagName string) string

GetTag returns tag value or empty string if not found

func (*Ec2Instance) Name

func (i *Ec2Instance) Name() string

Name returns resource name

func (*Ec2Instance) RenderLongOutput

func (i *Ec2Instance) RenderLongOutput() string

RenderLongOutput renders the detailed output for resource

func (*Ec2Instance) RenderShortOutput

func (i *Ec2Instance) RenderShortOutput() string

RenderShortOutput renders the list output for resource

func (*Ec2Instance) ResourceID

func (i *Ec2Instance) ResourceID() string

ResourceID returns unique resource ID

func (*Ec2Instance) SortKey

func (i *Ec2Instance) SortKey() string

SortKey returns sort key

func (*Ec2Instance) String

func (i *Ec2Instance) String() string

String returns resource attributes as string

type Resource

type Resource interface {
	ConnectIdentifier(bool, bool) string
	Name() string
	ResourceID() string
	GetTag(string) string
	RenderShortOutput() string
	RenderLongOutput() string
	SortKey() string
	String() string
}

Resource is an interface which all of the resources should be implementing

type ResourceList

type ResourceList []Resource

ResourceList is list of resources

func (ResourceList) Len

func (r ResourceList) Len() int

Len returns length of resources list

func (ResourceList) Less

func (r ResourceList) Less(i, j int) bool

Less returns whether i is less than j

func (ResourceList) Swap

func (r ResourceList) Swap(i, j int)

Swap swaps i and j

Jump to

Keyboard shortcuts

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