oticonfig

package
v0.0.0-...-c50e0c2 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2014 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Overview

package oticonfig configuration for the oti command.

Essentials

technically all you really need to get going are aws credentials. if you save them in aws_credentials.json then oti will find them automatically (use 0400 permissions on the file).

{ "AccessKey": "xxxxxxxxxxxx", "SecretKey": "yyyyyyyyyyyy", }

see the AwsKey type for details

Configuration file

a configuration file can make repeated use much easier. create a file containing a json object. by default, oti looks for a file called oti.json.

see the C type for details on the configuration format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Read

func Read(path string, c *C) error

unmarshal json data stored at path into c. any error encountered is returned.

Types

type AwsKey

type AwsKey struct {
	AccessKey string
	SecretKey string
}

type C

type C struct {
	// packer manifest configuration
	Packer Packer `json:",omitempty"`

	// metadata allowing usage of tags on images
	Images Images

	// see func (c *C) AwsKey()
	AwsKeyPath string `json:",omitempty"`

	// default Ec2 deployment configurations
	Ec2 Ec2 `json:",omitempty"`
}

the json configuration for oti

func (*C) AwsAuth

func (c *C) AwsAuth() (aws.Auth, error)

like c.AwsKey() but returns an aws.Auth type

func (*C) AwsKey

func (c *C) AwsKey() (*AwsKey, error)

unmarshal the json data stored in c.AwsKeyPath into a new AwsKey. return any error encountered.

func (*C) Ec2KeyName

func (c *C) Ec2KeyName(r aws.Region) string

BUG uses the first region config with right name

func (*C) Ec2Region

func (c *C) Ec2Region(r aws.Region) *Ec2Region

returns the first region config with RegionName equal to r.Name

func (*C) Ec2SecurityGroups

func (c *C) Ec2SecurityGroups(r aws.Region) []awsec2.SecurityGroup

BUG uses the first region config with right name

func (*C) Ec2Tag

func (c *C) Ec2Tag(tag otitag.OTITag) string

returns name prefixed with c.TagPrefix

func (*C) PackerManifest

func (c *C) PackerManifest(name string) (*PackerManifest, error)

unmarshal a packer file by name. see c.Packers() for details about names.

func (*C) PackerManifestNames

func (c *C) PackerManifestNames() ([]string, error)

return the name of packer manifests in c.PackerDir. the name of the manifest is the file basename (without the ".json" extension).

type Ec2

type Ec2 struct {
	// see func (c *C) Ec2Tag(otitag.OTITag)
	TagPrefix string `json:",omitempty"`

	// region specific configuration
	Regions []Ec2Region
}

type Ec2Region

type Ec2Region struct {
	// a unique identifier for the object. required if more than one region
	// profile is defined for the same RegionName.
	Id string `json:",omitempty"`

	// an ec2 canonical region name (e.g. "us-east-1"). required
	RegionName string

	// ec2 key name (recommended). overrideable per instance
	KeyName string `json:",omitempty"`

	// security groups. additional groups can be added per instance.
	SecurityGroups []Ec2SecurityGroup `json:",omitempty"`
}

type Ec2SecurityGroup

type Ec2SecurityGroup struct {
	Id   string `json:",omitempty"`
	Name string `json:",omitempty"`
}

security groups with neither Id or Name are ignored.

type Images

type Images struct {
	// tag identifying the service(s) provided by an image
	NameTag string `json:",omitempty"`

	// tag identifying the date an image was created
	BuildDateTag string `json:",omitempty"`

	// tag containing a semantic version for the image
	VersionTag string `json:",omitempty"` // not used
}

type Packer

type Packer struct {
	// a directory containing packer manifests.
	// see func (c *C) Packer(string)
	ManifestDir string `json:",omitempty"`
}

type PackerManifest

type PackerManifest struct {
	Vars         *jsontree.JsonTree
	Builders     []*jsontree.JsonTree
	Provisioners []*jsontree.JsonTree
}

Jump to

Keyboard shortcuts

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