resource

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2018 License: BSD-2-Clause Imports: 3 Imported by: 8

Documentation

Overview

Package resource provides the interfaces to the resources common to cloud providers such as OpenStack, Amazon's AWS, Google's GCP, and Microsoft's Azure. The orgranization of these resources is opinionated such that it matches the needs of the Spark Call project.

Arc

The arc resource tree begins with the Arc resource as it's root, it contains a datacenter resource and a dns resource.

The following files implement Arc.

	arc.Arc
		Implements the resource.Arc interface.
		Embeds resource.Resources since it is a collection of the datacenter and dns resources.
		Embeds config.Arc which provides the StaticArc interface.

	config.Arc
 		Implements the resource.StaticArc interface.
		The arc configuration file is unmarshalled into config.Arc

DataCenter

The purpose of the datacenter is to collect and manage the resources necessary to standup instances to do real work. The datacenter resource contains network resources and compute resources. It also has it's own provider separate from the dns provider.

Network

The network resource contains the resources necessary to create a network for the datacenter. TODO

SubnetGroups, SubnetGroup and Subnet

The subnet groups are a concept specific to spark call. A subnet group is a collection of related subnets whose purpose is to create an extended subnet across availability zones in order to provide highly available instances.

For example if a network has three availability zones, and a subnet group name "public" was defined, such as

"network": {
	"cidr": "192.168.0.0/16",
	"availability_zones": [ "az1", "az2", "az3" ],
	"subnet_groups": [
	{
		"name":   "public",
		"cidr":   "192.168.10.0/24",
		"access": "public"
	},

The "public" subnet group would contain three subnets, each one located in a separate availability zone, one subnet with the starting cidr of 192.168.10.0, the next with 192.168.10.1 and the next with 192.168.10.2.

Subnet groups are also intended to be the destionation of a security rule. This means that a security group can specify "subnet:public" and a three security rules will be created, one for each subnet.

SecurityGroups, SecurityGroup, SecurityRules and SecurityRule

A security group is a collection of security rules which allow ingress and egress network traffic to flow to given destination.

Compute

TODO.

KeyPair

TODO.

Clusters and Cluster

TODO.

Pods and Pod

TODO.

Instances and Instance

TODO.

Dns

TODO.

DnsRecords and DnsRecord

TODO.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account interface {
	Resource
	StaticAccount

	// Amp provides access to Account's parent object.
	Amp() Amp
	// Storage provides access to Account's child Storage.
	Storage() Storage
}

type Amp

type Amp interface {
	Resource
	StaticAmp

	// Run is the entry point for arc.
	Run() (int, error)

	// Account provides access to Amp's child account.
	Account() Account
}

Amp provides the resource interface used for the common amp object implemented in the amp package. It contains an Run method used to start application processing. It also contains the Storage method used to access the storage child.

type Arc

type Arc interface {
	Resource
	StaticArc

	// Run is the entry point for arc.
	Run() (int, error)

	// DataCenter provides access to Arc's child datacenter service.
	DataCenter() DataCenter

	// DatabaseService provides access to Arc's child database service.
	DatabaseService() DatabaseService

	// Dns provides access to Arc's child dns service.
	Dns() Dns
}

Arc provides the resource interface used for the common arc object implemented in the arc package. It contains an Run method used to start application processing. It also contains DataCenter and Dns methods used to access it's children.

type Attacher

type Attacher interface {

	// Attach asks the provider to attach the resource to the instance.
	Attach() error

	// Attached returns true if the resource is associated with an instance.
	Attached() bool
}

Attacher provides the ability to attach the resource with the cloud provider and to see if the resource is attached.

type AuditOverride

type AuditOverride interface {

	// PreAudit executes before the object being audited with the cloud provider.
	PreAudit(flags ...string) error

	// MidAudit audits the resource.
	MidAudit(flags ...string) error

	// PostAudit executes after to the object being audited with the cloud provider.
	PostAudit(flags ...string) error
}

AuditOverride allows the audit methods of the class to be overridden by a derived class.

type Auditor

type Auditor interface {

	// Audit asks the provider to audit this resource.
	Audit(flags ...string) error
}

Auditor provides the ability to audit the resource with the cloud provider.

type Bucket

type Bucket interface {
	route.Router
	StaticBucket
	DynamicBucket

	Storage() Storage
	ProviderBucket() ProviderBucket
}

Bucket provides the resource interface used for the common storage object implemented in the amp package. It contains an Storage method used to access its parent object.

type BucketSet

type BucketSet interface {
	route.Router
	StaticBucketSet
	DynamicBucketSet

	BucketSets() BucketSets
}

BucketReplicationSet provides the resource interface used for the common bucket replication set object implemented in the amp package. It contains an Storage method used to access its parent object.

type BucketSets

type BucketSets interface {
	Resource

	Storage() Storage
	Find(name string) BucketSet
}

type Buckets

type Buckets interface {
	Resource

	Find(name string) Bucket
}

type Cluster

type Cluster interface {
	Resource
	StaticCluster
	Auditor

	// Compute provides access to Cluster's parent.
	Compute() Compute

	// Pods provides access to Compute's child pods.
	Pods() Pods

	// Find pod by name. This implies pods are named uniquely.
	FindPod(name string) Pod

	// Find instance by name. This implies instances are named uniquely.
	// The name takes the form "<pod name>-<instance number>".
	FindInstance(name string) Instance

	// Find the instance by ip address.
	FindInstanceByIP(ip string) Instance

	// Creator
	PreCreate(req *route.Request) route.Response
	Create(req *route.Request) route.Response
	PostCreate(req *route.Request) route.Response

	// Destroyer
	PreDestroy(req *route.Request) route.Response
	Destroy(req *route.Request) route.Response
	PostDestroy(req *route.Request) route.Response

	// Provisioner
	PreProvision(req *route.Request) route.Response
	Provision(req *route.Request) route.Response
	PostProvision(req *route.Request) route.Response

	// Starter
	PreStart(req *route.Request) route.Response
	Start(req *route.Request) route.Response
	PostStart(req *route.Request) route.Response

	// Stopper
	PreStop(req *route.Request) route.Response
	Stop(req *route.Request) route.Response
	PostStop(req *route.Request) route.Response

	// Restarter
	PreRestart(req *route.Request) route.Response
	Restart(req *route.Request) route.Response
	PostRestart(req *route.Request) route.Response

	// Replacer
	PreReplace(req *route.Request) route.Response
	Replace(req *route.Request) route.Response
	PostReplace(req *route.Request) route.Response

	// Auditor
	AuditOverride
}

Cluster provides the resource interface used for the common cluster object implemented in the arc package.

type Clusters

type Clusters interface {
	Resource

	// Find cluster by name. This implies clusters are named uniquely.
	Find(name string) Cluster

	// Find pod by name. This implies pods are named uniquely.
	FindPod(name string) Pod

	// Find instance by name. This implies instances are named uniquely.
	// The name takes the form "<pod name>-<instance number>".
	FindInstance(name string) Instance

	// Find the instance by ip address.
	FindInstanceByIP(ip string) Instance
}

Clusters provides the resource interface used for the common clusters object implemented in the arc package. Clusters is a collection of Cluster objects, so it has a Find method associated with it. The FindPod, FindInstance and FindInstanceByIP are convenience methods which refer to other collection objects -- Pods and Instances respectively. Since this is a collection object, having a pointer to it's parent isn't practical.

type Compute

type Compute interface {
	Resource
	StaticCompute
	DynamicCompute

	// DataCenter provides access to Compute's parent.
	DataCenter() DataCenter

	// KeyPair provides access to Compute's child keypair.
	KeyPair() KeyPair

	// Clusters provides access to Compute's child clusters.
	Clusters() Clusters

	// Find cluster by name. This implies clusters are named uniquely.
	FindCluster(name string) Cluster

	// Find pod by name. This implies pods are named uniquely.
	FindPod(name string) Pod

	// Find instance by name. This implies instances are named uniquely.
	// The name takes the form "<pod name>-<instance number>".
	FindInstance(name string) Instance

	// Find the instance by ip address.
	FindInstanceByIP(ip string) Instance

	// ProviderCompute provides access to the provider specific compute.
	ProviderCompute() ProviderCompute
}

Compute provides the resource interface used for the common compute object implemented in the arc package. It contains a DataCenter method to access it's parent, and the KeyPair and Clusters methods to access it's children.

type CreateOverride

type CreateOverride interface {

	// PreCreate executes before the object being createed with the cloud provider.
	PreCreate(flags ...string) error

	// MidCreate asks the provider to allocate the resource.
	MidCreate(flags ...string) error

	// PostCreate executes after to the object being createed with the cloud provider.
	PostCreate(flags ...string) error
}

CreateOverride allows the create methods of the class to be overridden by a derived class.

type Creator

type Creator interface {

	// Create asks the provider to allocate this resource.
	Create(flags ...string) error

	// Created indicated that the underlying resource has not been created
	// with the cloud provider. With a composite resource, destruction may
	// only be true if all the contained resources have been created.
	Created() bool
}

Creator provides the ability to create the resource with the cloud provider and to see if the resource has been created.

type DataCenter

type DataCenter interface {
	Resource
	StaticDataCenter

	// Arc provides access to DataCenter's parent.
	Arc() Arc

	// DataCenter provides access to DataCenter's child network resources.
	Network() Network

	// DataCenter provides access to DataCenter's child compute resources.
	Compute() Compute

	// Dns providess acess to the Dns resource.
	Dns() Dns
}

DataCenter provides the resource interface used for the common datacenter object implemented in the arc package. It contains an Arc method used to access it's parent object, and Network and Compute methods used to access it's children.

type Database

type Database interface {
	route.Router
	StaticDatabase
	DynamicDatabase
	Helper

	// DatabaseService provides access to the database's parent.
	DatabaseService() DatabaseService

	// ProviderDatabase allows access to the provider's database object.
	ProviderDatabase() ProviderDatabase
}

Database provides the resource interface used for the common subnet group object implemented in the arc package.

type DatabaseParams

type DatabaseParams struct {
	DatabaseService ProviderDatabaseService
	Subnets         []ProviderSubnet
	SecurityGroups  []ProviderSecurityGroup
}

DatabaseParams collects provider resources necessary to create the provider database instance.

type DatabaseService

type DatabaseService interface {
	route.Router
	StaticDatabaseService
	DynamicDatabaseService
	Provisioner
	Helper

	// Arc provides access to DataCenter's parent.
	Arc() Arc

	// Find returns the database with the given name.
	Find(string) Database

	// ProviderDatabaseSerivces allows access to the provider's database service object.
	ProviderDatabaseService() ProviderDatabaseService
}

DatabaseService provides the resource interface used for the database service object implemented in the arc package.

type DestroyOverride

type DestroyOverride interface {

	// PreDestroy executes before the object being destroyed with the cloud provider.
	PreDestroy(flags ...string) error

	// MidDestroy asks the provider to deallocate the resource.
	MidDestroy(flags ...string) error

	// PostDestroy executes after to the object being destroyed with the cloud provider.
	PostDestroy(flags ...string) error
}

DestroyOverride allows the destroy methods of the class to be overridden by a derived class.

type Destroyer

type Destroyer interface {

	// Destroy asks the provider to deallocate this resource.
	Destroy(flags ...string) error

	// Destroyed indicated that the underlying resource has not been created
	// with the cloud provider. With a composite resource, destruction may
	// only be true if all the contained resources have been destroyed.
	Destroyed() bool
}

Destroyer provides the ability to destroy the resource with the cloud provider and to see if the resource has been destroyed.

type Detacher

type Detacher interface {

	// Detach asks the provider to detach the resource from the instance.
	Detach() error

	// Detached returns true if the resource is not associated with an instance.
	Detached() bool
}

Detacher provides the ability to detach the resource with the cloud provider and to see if the resource is detached.

type Dns

type Dns interface {
	Resource
	StaticDns
	DynamicDns

	// Arc provides access to Dns' parent.
	Arc() Arc

	// ProviderDns provides access to the provider specific dns implementation.
	ProviderDns() ProviderDns

	// ARecords provides access to Dns' A records.
	ARecords() DnsRecords

	// CNameRecords provides access to Dns' CNAME records.
	CNameRecords() DnsRecords

	// DataCenter provides access to the DataCenter resource.
	DataCenter() DataCenter
}

Dns provides the resource interface used for the common dns object implemented in the arc package. It contains an Arc method used to access it's parent object, and ARecords and CNameRecords methods used

to access it's children.

type DnsRecord

type DnsRecord interface {
	Resource
	StaticDnsRecord
	DynamicDnsRecord

	// Dns provides access to the dns record's parent.
	Dns() Dns
}

DnsRecord provides the resource interface used for the common dns record object implemented in the arc package.

type DnsRecords

type DnsRecords interface {
	Resource

	// Find DnsRecord by host name, not fqdn. I.e. mirror-01, not mirror-01-internal.na-int1.huron-int.com.
	Find(name string) DnsRecord

	// FindByPod returns the DnsRecords associated with the given pod name.
	FindByPod(name string) []DnsRecord
}

DnsRecords provides the resource interface used for the common dns records object implemented in the arc package. DnsRecords is a collection of DnsRecord objects, so it has a Find method associated with it.

type DynamicBucket

type DynamicBucket interface {
	Auditor
	Creator
	Destroyer
	Provisioner
	// SetTags sets the tags for the bucket.
	SetTags(map[string]string) error

	// EnableReplication enables cross region bucket replication - requires role and destination in json file.
	EnableReplication() error

	// Info prints out the bucket's information to the console.
	Info()
}

DynamicBucket provides the interface to the dynamic portion of the bucket.

type DynamicBucketSet

type DynamicBucketSet interface {
	Auditor
	Creator
	Destroyer
	Provisioner

	// Info prints out the bucket's information to the console.
	Info()
}

DynamicBucketReplicationSet provides the interface to the dynamic portion of the bucket replication set.

type DynamicCompute

type DynamicCompute interface {

	// AuditVolumes identifies any volumes that have been deployed but are not in the configuration.
	AuditVolumes(flags ...string) error

	// AuditEIP identifies any elastic IPs that have been allocated but are associated with anything.
	AuditEIP(flags ...string) error

	// AuditInstance identifies any instances that have been deployed but are not in the configuration.
	AuditInstances(flags ...string) error
}

DyanmicCompute provides the interface to the dynamic portion of compute.

type DynamicDatabase

type DynamicDatabase interface {
	Loader
	Creator
	Destroyer
	Provisioner
	Auditor
	Informer

	// Id returns the id of the instance.
	Id() string

	// State returns the state of the database instance.
	State() string
}

DynamicDatabase provides access to the dynamic portion of the database.

type DynamicDatabaseService

type DynamicDatabaseService interface {
	Loader
	Auditor
	Informer
}

DynamicDatabaseService provides access to the dynamic portion of the database service.

type DynamicDns

type DynamicDns interface {

	// Id returns the Dns id.
	Id() string

	// AuditDnsRecords checks for any dns records that are unnamedo or deployed but not configured
	AuditDnsRecords(flags ...string) error
}

DyanmicDns provides the interface to the dynamic portion of dns. This information is provided by the resource allocated by the cloud provider.

type DynamicDnsRecord

type DynamicDnsRecord interface {
	Auditor
	Loader

	// Id returns the DnsRecord Id.
	Id() string

	// Type returns the type of Dns record.
	Type() string

	// DynamicValues returns a slice of the values associated with a dns record.
	DynamicValues() []string
}

DynamicDnsRecord provides access to the dynamic portion of the dns record.

type DynamicElasticIP

type DynamicElasticIP interface {

	// Loader is the interface that requires the Load function to be implmented.
	Loader

	// Attacher provides the ability to attach the resource with the cloud provider and to see
	// if the resource is attached.
	Attacher

	// Detacher provides the ability to detach the resource with the cloud provider and to see
	// if the resource is detached.
	Detacher

	// Id returns the identifier of the elastic IP.
	Id() string

	// Instance returns the instance that the elastic IP is or will be associated with.
	Instance() Instance

	// IpAddress returns the elastic IP address.
	IpAddress() string

	// Create allocates the elastic IP.
	Create() error

	// Destroy releases the elastic IP.
	Destroy() error
}

DynamicElasticIP provides the interface to the dynamic portion of the elastic IP

type DynamicInstance

type DynamicInstance interface {

	// Id returns the id of the instance.
	Id() string

	// ImageId returns the imageId.
	ImageId() string

	// KeyName returns the name of the keypair.
	KeyName() string

	// State returns the state of the instance.
	State() string

	// Started returns true if the instance has been started.
	Started() bool

	// Stopped returns true if the instance is currently stopped.
	Stopped() bool

	// PrivateIPAddress returns the private IP address associated with the instance.
	PrivateIPAddress() string

	// PublicIPAddress returns the public IP address associated with the instance.
	PublicIPAddress() string

	// SetTags sets the tags for the instance such as who created it and the last person
	// that modified the instance.
	SetTags(map[string]string) error

	Auditor
}

DynamicInstance provides access to the dynamic portion of the instance.

type DynamicKeyPair

type DynamicKeyPair interface {

	// Loader is the interface that requires the Load function to be implmented.
	Loader

	// FingerPrint returns the finger print of the keypair from the provider.
	FingerPrint() string
}

DynamicKeyPair provides access to the dynamic portion of the keypair.

type DynamicNetwork

type DynamicNetwork interface {

	// Id returns the id of the network.
	Id() string

	// State returns the state of the network.
	State() string

	// AuditSubnets identifies any subnets that have been deployed but are not in the configuration.
	AuditSubnets(flags ...string) error

	// AuditSecgroups indentifies any secgroups that have been deployed but are not configured.
	AuditSecgroups(flags ...string) error
}

DyanmicNetwork provides the interface to the dynamic portion of the network. This information is provided by the resource allocated by the cloud provider.

type DynamicRole

type DynamicRole interface {
	Loader
	Attacher
	Detacher

	// Id returns the underlying role id.
	Id() string

	// InstanceId returns the id of the role's instance.
	InstanceId() string

	// Update changes the role to be what is currently in the config file.
	Update() error
}

DynamicRole provides the interface to the dynamic portion of the role.

type DynamicSecurityGroup

type DynamicSecurityGroup interface {
	Auditor
	Loader

	// Id returns the security group id.
	Id() string
}

DyanmicSecurityGroup provides the interface to the dynamic portion of the security group. This information is provided by the resource allocated by the cloud provider.

type DynamicStorage

type DynamicStorage interface {
	// Audit identifies any buckets that have been deployed but are not in the configuration.
	Audit(flags ...string) error
}

type DynamicSubnet

type DynamicSubnet interface {
	Auditor
	Loader

	// Id returns the id of the subnet.
	Id() string

	// State returns the state of the subnet.
	State() string
}

DyanmicSubnet provides the interface to the dynamic portion of the subnet. This information is provided by the resource allocated by the cloud provider.

type DynamicVolume

type DynamicVolume interface {
	Loader
	Attacher
	Detacher
	Auditor

	// Id returns the underlying volume id.
	Id() string

	// State returns the state of the volume.
	State() string

	// Destroys the underlying volume. Detach must be called before this
	// otherwise this could return an error.
	Destroy() error

	// SetTags sets the tags for the volume.
	SetTags(map[string]string) error

	// Info prints out volume information to the console.
	Info()

	// Reset the volume to an initialized state.
	Reset()
}

DynamicVolume provides the interface to the dynamic portion of the volume.

type ElasticIP

type ElasticIP interface {
	Resource
	DynamicElasticIP
}

ElasticIP provides the resource interface used for the common elastic IP object implemented in the arc package.

type Helper

type Helper interface {

	// Help dumps help text to the console.
	Help()
}

Helper provides an interface for a resource that needs to provide user help text.

type Hiera

type Hiera interface {
	Install(Instance, bool) error
}

type Informer

type Informer interface {

	// Info dumps the resource runtime data to the console.
	Info()
}

Informer provides an interface for a resource that needs to provide the object runtime info to the user.

type Instance

type Instance interface {
	Resource
	StaticInstance
	DynamicInstance

	// Pod provides access to Instance's parent.
	Pod() Pod

	// Network provides access to the network to which instance is associated.
	Network() Network

	// Subnet provides access to the subnet to which instance is allocated.
	Subnet() Subnet

	// SecurityGroups provides access to the security groups to which instance is associated.
	SecurityGroups() []SecurityGroup

	// KeyPair provides access to the keypair that will be assigned to this instance.
	KeyPair() KeyPair

	// Dns provides access to the dns associated with the datacenter.
	Dns() Dns

	// PrivateHostname returns the hostname (without the domain name) associated with the
	// private ip address of the instance.
	PrivateHostname() string

	// PrivateFQDN returns the FQDN associated with the private ip address of the instance.
	PrivateFQDN() string

	// PublicHostname returns the hostname (without the domain name) associated with the
	// public ip address of the instance.
	PublicHostname() string

	// PublicFQDN returns the FQDN associated with the public ip address of the instance.
	// If this instance doesn't have a public ip address (most don't) this will return
	// an empty string "".
	PublicFQDN() string

	// PrivateDnsARecord returns the dns a record associated with this instance.
	PrivateDnsARecord() DnsRecord

	// PublicDnsARecord return the dns a record associated with the public ip address of this
	// instance. If this instance doesn't have a public ip address (most don't) this will
	// return nil.
	PublicDnsARecord() DnsRecord

	// FQDNMatch returns true if the given list of values contains a match to either the
	// private or public fqdn.
	FQDNMatch([]string) bool

	// RootUser returns the name of the root user for the given image type.
	RootUser() string

	// ProviderVolumes returns a slice of provider created volumes.
	ProviderVolumes() []ProviderVolume

	// ProviderRole returns the role of the instance.
	ProviderRole() ProviderRole

	// Creator
	PreCreate(req *route.Request) route.Response
	Create(req *route.Request) route.Response
	PostCreate(req *route.Request) route.Response

	// Destroyer
	PreDestroy(req *route.Request) route.Response
	Destroy(req *route.Request) route.Response
	PostDestroy(req *route.Request) route.Response

	// Provisioner
	PreProvision(req *route.Request) route.Response
	Provision(req *route.Request) route.Response
	PostProvision(req *route.Request) route.Response

	// Starter
	PreStart(req *route.Request) route.Response
	Start(req *route.Request) route.Response
	PostStart(req *route.Request) route.Response

	// Stopper
	PreStop(req *route.Request) route.Response
	Stop(req *route.Request) route.Response
	PostStop(req *route.Request) route.Response

	// Restarter
	PreRestart(req *route.Request) route.Response
	Restart(req *route.Request) route.Response
	PostRestart(req *route.Request) route.Response

	// Replacer
	PreReplace(req *route.Request) route.Response
	Replace(req *route.Request) route.Response
	PostReplace(req *route.Request) route.Response

	AuditOverride
}

Instance provides the resource interface used for the common instance object implemented in the arc package.

type Instances

type Instances interface {
	Resource

	// GetInstances returns a map of all instances indexed by instance name.
	GetInstances() map[string]Instance

	// Find instance by name. This implies instances are named uniquely.
	// The name takes the form "<pod name>-<instance number>".
	Find(name string) Instance

	// Find the instance by ip address.
	FindByIP(ip string) Instance
}

Instances provides the resource interface used for the common instances object implemented in the arc package.

type KeyPair

type KeyPair interface {
	Resource
	StaticKeyPair
	DynamicKeyPair
}

KeyPair provides the resource interface used for the common keypair object implemented in the arc package.

type Loader

type Loader interface {

	// Load retrieves resource information from the provider then populates the resource.
	Load() error
}

Loader provides an interface for a resource that needs to be loaded from the provider.

type Network

type Network interface {
	Resource
	StaticNetwork
	DynamicNetwork

	// ProviderNetwork provides access to the provider specific network.
	ProviderNetwork() ProviderNetwork

	// DataCenter provides access to Network's parent.
	DataCenter() DataCenter

	// SubnetGroups provides access to Network's child subnet groups.
	SubnetGroups() SubnetGroups

	// SecurityGroups provides access to Network's child security groups.
	SecurityGroups() SecurityGroups

	// CidrAlias return the alias for the given name.
	CidrAlias(string) string

	// CidrGroup returns the slice of cidr values for the given name.
	CidrGroup(string) []string
}

Network provides the resource interface used for the common network object implemented in the arc package. It contains a DataCenter method to access it's parent, and the SubnetGroups and SecurityGroups methods to access it's children.

type NetworkPost

type NetworkPost interface {
	Resource
	StaticNetwork
	ProviderNetworkPost() ProviderNetworkPost
}

type Pod

type Pod interface {
	Resource
	StaticPod
	Auditor

	// Cluster provides access to Pod's parent.
	Cluster() Cluster

	// Instances provides access to Pod's child instances.
	Instances() Instances

	// Find instance by name. This implies instances are named uniquely.
	// The name takes the form "<pod name>-<instance number>".
	FindInstance(name string) Instance

	// Find the instance by ip address.
	FindInstanceByIP(ip string) Instance

	// Dervied returns the base pod.
	Derived() Pod

	// DnsCNameRecords returns the configred dns cname records associated with this pod.
	// If this pod doesn't have configured cname records, this will return nil.
	DnsCNameRecords() []DnsRecord

	// PrimaryCname returns the primaru cname record for this pod.
	// If this pod doesn't have configured cname records, this will return nil.
	PrimaryCname() DnsRecord

	// PrimaryInstance returns the instance associated with the cname record for this pod.
	// If this pod doesn't have a configured cname record or cannot find a primary instance
	// this will return nil.
	PrimaryInstance() Instance

	// SecondaryInstances return the instances not associated with the cname reocrd for this pod.
	// If this pod doesn't have a configured cname record, cannot find a primary instance
	// or has a single instance this will return nil.
	SecondaryInstances() []Instance

	// PkgName returns the name of the servertype rpm or deb associated with this pod.
	PkgName() string

	// Creator
	PreCreate(req *route.Request) route.Response
	Create(req *route.Request) route.Response
	PostCreate(req *route.Request) route.Response

	// Destroyer
	PreDestroy(req *route.Request) route.Response
	Destroy(req *route.Request) route.Response
	PostDestroy(req *route.Request) route.Response

	// Provisioner
	PreProvision(req *route.Request) route.Response
	Provision(req *route.Request) route.Response
	PostProvision(req *route.Request) route.Response

	// Starter
	PreStart(req *route.Request) route.Response
	Start(req *route.Request) route.Response
	PostStart(req *route.Request) route.Response

	// Stopper
	PreStop(req *route.Request) route.Response
	Stop(req *route.Request) route.Response
	PostStop(req *route.Request) route.Response

	// Restarter
	PreRestart(req *route.Request) route.Response
	Restart(req *route.Request) route.Response
	PostRestart(req *route.Request) route.Response

	// Replacer
	PreReplace(req *route.Request) route.Response
	Replace(req *route.Request) route.Response
	PostReplace(req *route.Request) route.Response

	// Auditor
	AuditOverride
}

Pod provides the resource interface used for the common pod object implemented in the arc package.

type Pods

type Pods interface {
	Resource

	// Find pod by name. This implies pods are named uniquely.
	Find(name string) Pod

	// Find instance by name. This implies instances are named uniquely.
	// The name takes the form "<pod name>-<instance number>".
	FindInstance(name string) Instance

	// Find the instance by ip address.
	FindInstanceByIP(ip string) Instance
}

Pods provides the resource interface used for the common pods object implemented in the arc package.

type ProviderBucket

type ProviderBucket interface {
	route.Router
	DynamicBucket
}

type ProviderCompute

type ProviderCompute interface {
	DynamicCompute
}

ProviderCompute provides a resource interface for the provider supplied compute.

type ProviderDatabase

type ProviderDatabase interface {
	DynamicDatabase
}

ProviderDatabase provides a resource interface for the provider supplied database instance.

type ProviderDatabaseService

type ProviderDatabaseService interface {
	DynamicDatabaseService
}

ProviderDatabaseService provides a resource interface for the provider supplied database service.

type ProviderDns

type ProviderDns interface {
	DynamicDns
}

ProviderDns provides an interface for the provider supplied dns resource.

type ProviderDnsRecord

type ProviderDnsRecord interface {
	Resource
	DynamicDnsRecord
}

ProviderDnsRecord provides an interface for the provider supplied dns record resource.

type ProviderElasticIP

type ProviderElasticIP interface {
	Resource
	DynamicElasticIP
}

ProviderElasticIP provides a resource interface for the provider supplied elastic IP. The common elastic IP object delegates provider specific behavior to the provider elastic IP.

type ProviderInstance

type ProviderInstance interface {
	Resource
	DynamicInstance
}

ProviderInstance provides a resource interface for the provider supplied instance. The common instance object delegates provider specific behavior to the raw instance.

type ProviderKeyPair

type ProviderKeyPair interface {
	Resource
	DynamicKeyPair
}

ProviderKeyPair provides a resource interface for the provider supplied keypair. The common keypair object delegates provider specific behavior to the raw keypair.

type ProviderNetwork

type ProviderNetwork interface {
	Resource
	DynamicNetwork

	// Does the ProviderNetwork support provider specific requests?
	CanRoute(*route.Request) bool

	// Additional help commands for provider specific requests.
	HelpCommands() []help.Command
}

ProviderNetwork provides a resource interface for the provider supplied resources. The common network object, Network, delegates provider specific behavior to the raw network.

type ProviderNetworkPost

type ProviderNetworkPost interface {
	Resource

	// Does the ProviderNetwork support provider specific requests?
	CanRoute(*route.Request) bool

	// Additional help commands for provider specific requests.
	HelpCommands() []help.Command
}

type ProviderRole

type ProviderRole interface {
	Resource
	DynamicRole
}

ProviderRole provides a resource interface for the provider supplied role. The common role object delegates provider specific behavior to the raw role.

type ProviderSecurityGroup

type ProviderSecurityGroup interface {
	Resource
	DynamicSecurityGroup
}

ProviderSecurityGroup provides a resource interface for the provider supplied security group. The common security group object delegates provider specific behavior to the raw security group.

type ProviderStorage

type ProviderStorage interface {
	DynamicStorage
}

type ProviderSubnet

type ProviderSubnet interface {
	Resource
	DynamicSubnet
}

ProviderSubnet provides a resource interface for the provider supplied subnet. The common subnet object delegates provider specific behavior to the raw subnet.

type ProviderVolume

type ProviderVolume interface {
	Resource
	DynamicVolume
}

ProviderVolume provides a resource interface for the provider supplied volume. The common volume object delegates provider specific behavior to the raw volume.

type ProvisionOverride

type ProvisionOverride interface {

	// PreProvision executes before the object being provisioned with the cloud provider.
	PreProvision(flags ...string) error

	// MidProvision provision the resource.
	MidProvision(flags ...string) error

	// PostProvision executes after to the object being provisioned with the cloud provider.
	PostProvision(flags ...string) error
}

ProvisionOverride allows the provision methods of the class to be overridden by a derived class.

type Provisioner

type Provisioner interface {

	// Provision asks the provider to provision this resource.
	Provision(flags ...string) error
}

Provisioner provides the ability to provision the resource with the cloud provider.

type ReplaceOverride

type ReplaceOverride interface {

	// PreReplace executes before the object being replaceed with the cloud provider.
	PreReplace(flags ...string) error

	// MidReplace replaces the resource.
	MidReplace(flags ...string) error

	// PostReplace executes after to the object being replaceed with the cloud provider.
	PostReplace(flags ...string) error
}

ReplaceOverride allows the replace methods of the class to be overridden by a derived class.

type Replacer

type Replacer interface {

	// Replace asks the provider to replace this resource.
	Replace(flags ...string) error
}

Replacer provides the ability to replace the resource with the cloud provider.

type Resource

type Resource interface {
	route.Router
	Created() bool
	Destroyed() bool
}

Resource is the base interface that provides the common functionality for concrete resources. It groups together the Router interface from the route package, together with the Created and Destroyed methods.

route.Router provides the ability to route requests to the resource objects.

Created indicates that the underlying resource has been created with the cloud provider. With a composite resource, creation may only be true if all contained resources have been created.

Destoyed indicated that the underlying resource has not been created with the cloud provider. With a composite resource, destruction may only be true if all the contained resources have been destroyed.

type Resources

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

Resources provides a collection of resource.Resource objects while implementing the Resource interface. It is meant to be used as an embedded field in compostive resource type.

func NewResources

func NewResources() *Resources

NewResources constructs a Resources object.

func (*Resources) Append

func (r *Resources) Append(rsrc Resource)

Append adds a resource to the collection.

func (*Resources) Created

func (r *Resources) Created() bool

Created indicates true if all resources in the collection have been created. It is possible for the collection to fail both Created and Destroyed tests if for some reason the collection of resources has been partially created.

func (*Resources) Destroyed

func (r *Resources) Destroyed() bool

Destroyed indicates true if all resources in the collection have been destroyed. It is possible for the collection to fail both Created and Destroyed tests if for some reason the collection of resources has been partially created.

func (*Resources) Get

func (r *Resources) Get() []Resource

Get returns the list of Resources in the collection.

func (*Resources) Length

func (r *Resources) Length() int

Length provides the number of resources in the collection.

func (*Resources) RouteInOrder

func (r *Resources) RouteInOrder(req *route.Request) route.Response

RouteInOrder routes requests to each resouce in the collection in the order they were added to the collection. Most requests should use this method to route requests.

func (*Resources) RouteReverseOrder

func (r *Resources) RouteReverseOrder(req *route.Request) route.Response

RouteReverseOrder routes requests to each resouce in the collection in the reverse order they were added to the collection. This is useful for the destroy request where the resources need to be destroyed in the reverse order that they where created.

type RestartOverride

type RestartOverride interface {

	// PreRestart executes before the object being restarted with the cloud provider.
	PreRestart(flags ...string) error

	// MidRestart restarts the resource.
	MidRestart(flags ...string) error

	// PostRestart executes after to the object being restarted with the cloud provider.
	PostRestart(flags ...string) error
}

RestartOverride allows the restart methods of the class to be overridden by a derived class.

type Restarter

type Restarter interface {

	// Restart asks the provider to restart this resource.
	Restart(flags ...string) error
}

Restarter provides the ability to restart the resource with the cloud provider.

type Role

type Role interface {
	Resource
	StaticRole
	DynamicRole

	ProviderRole() ProviderRole
}

Role provides the resource interface used for the common role object implemented in the arc package.

type Secrets

type Secrets interface {
	InstallCerts(Instance) error
	InstallMachineUser(Instance) error
}

type SecurityGroup

type SecurityGroup interface {
	Resource
	StaticSecurityGroup
	DynamicSecurityGroup

	// ProviderSecurityGroup provides access to the provider specific security group.
	ProviderSecurityGroup() ProviderSecurityGroup

	// Network provides access to SecurityGroup's parent.
	Network() Network
}

SecurityGroup provides the resource interface used for the common security group object implemented in the arc package.

type SecurityGroups

type SecurityGroups interface {
	Resource
	Auditor

	// Find the security group with the given name.
	Find(name string) SecurityGroup
}

SecurityGroups provides the resource interface used for the common security groups object implemented in the arc package. SecurityGroups is a collection of SecurityGroup objects, so it has a Find method associated with it. Since this is a collection object, having a pointer to it's parent isn't practical.

type StartOverride

type StartOverride interface {

	// PreStart executes before the object being started with the cloud provider.
	PreStart(flags ...string) error

	// MidStart starts the resource.
	MidStart(flags ...string) error

	// PostStart executes after to the object being started with the cloud provider.
	PostStart(flags ...string) error
}

StartOverride allows the start methods of the class to be overridden by a derived class.

type Starter

type Starter interface {

	// Start asks the provider to start this resource.
	Start(flags ...string) error
}

Starter provides the ability to start the resource with the cloud provider.

type StaticAccount

type StaticAccount interface {
	SecurityTags() config.SecurityTags
}

type StaticAmp

type StaticAmp interface {
	Name() string
}

StaticAmp provides the interface to the static portion of the amp resource tree. This information is provided via config file and is implemented config.Amp.

type StaticArc

type StaticArc interface {
	Name() string
	Title() string
}

StaticArc provides the interface to the static portion of the arc resource tree. This information is provided via config file and is implemented config.Arc.

type StaticBucket

type StaticBucket interface {
	Name() string
	Region() string
	SecurityTags() config.SecurityTags
}

type StaticBucketSet

type StaticBucketSet interface {
	Name() string
	Buckets() *config.Buckets
}

type StaticCluster

type StaticCluster interface {
	Name() string
	SecurityTags() config.SecurityTags
	AuditIgnore() bool
}

StaticCluster provides the interface to the static portion of the cluster. This information is provided via config file and is implemented by config.Cluster.

type StaticCompute

type StaticCompute interface {
	Name() string
	BootstrapVersion() int
	DeployVersion() int
	SecretsVersion() int
	AideVersion() int
}

StaticCompuite provides the interface to the static portion of the compute object. This information is provided via config file and is implemented by config.Compute.

type StaticDataCenter

type StaticDataCenter interface {
	SecurityTags() config.SecurityTags
}

type StaticDatabase

type StaticDatabase interface {
	config.Printer

	// Name of the configured database instance. Required.
	Name() string

	// DBName is The name of the database to create when the DB instance is created.
	// If not set the name will be used. Optional.
	DBName() string

	// Engine used by the database instance. Required.
	Engine() string

	// Version of the engine. Optional.
	Version() string

	// InstanceType of the database instance. Required.
	InstanceType() string

	// Port used by the database instance. Optional.
	Port() int

	// Subnet the database instance will use. Required.
	SubnetGroup() string

	// SecurityGroups the database instance will use. Required.
	SecurityGroups() []string

	// StorageType associated with the database instance. Optional.
	StorageType() string

	// StorageSize is the configured size of the storage attached to the database instance. Optional.
	StorageSize() int

	// StorageIops is the configured tops of the storage attached to the database instance. Optional.
	StorageIops() int

	// MasterUserName is the name for the master user. Optional
	MasterUserName() string

	// MasterPassword is the password for the master user. Optional.
	MasterPassword() string
}

StaticDatabase provides the interface to the static portion of the database. This information is provided via config file and is implemented by config.Database.

type StaticDatabaseService

type StaticDatabaseService interface {
	config.Printer
}

StaticDatabaseService provides the interface to the static portion of the database service. This information is provided via config file and is implemented by config.DatabaseService.

type StaticDns

type StaticDns interface {
	DomainName() string
	Subdomain() string
	Domain() string
}

StaticDns provides the interface to the static portion of dns. This information is provided via config file and is implemented config.Dns.

type StaticDnsRecord

type StaticDnsRecord interface {
	Name() string
	Ttl() int
	Values() []string
}

StaticDnsRecord provides the interface to the static dns record. This information is provided via config file and is implemented config.DnsRecord.

type StaticInstance

type StaticInstance interface {
	Name() string
	Count() int
	ServerType() string
	Version() string
	Image() string
	InstanceType() string
	SubnetGroupName() string
	SecurityGroupNames() []string
	Teams() []string
}

StaticInstance provides the interface to the static portion of the instance. This information is provided via config file and is implemented by config.Instance.

type StaticKeyPair

type StaticKeyPair interface {
	Name() string
	LocalName() string
	Format() string
	Comment() string
	KeyMaterial() string
}

StaticKeyPair provides the interface to the static portion of the keypair.

type StaticNetwork

type StaticNetwork interface {
	Name() string
	CidrBlock() string
	AvailabilityZones() []string
	DnsNameServers() []string
	CidrAliases() map[string]string
	CidrGroups() map[string][]string
}

StaticNetwork provides the interface to the static portion of the network. This information is provided via config file and is implemented by config.Network.

type StaticPod

type StaticPod interface {
	Name() string
	ServerType() string
	Version() string
	PackageName() string
	Image() string
	InstanceType() string
	Role() string
	SubnetGroup() string
	SecurityGroups() []string
	Teams() []string
	Count() int
}

StaticPod provides the interface to the static portion of the pod. This information is provided via config file and is implemented by config.Pod.

type StaticRole

type StaticRole interface {
	Name() string
}

StaticRole provides the interface to the static portion of the role.

type StaticSecurityGroup

type StaticSecurityGroup interface {
	Name() string
}

StaticSecurityGroup provides the interface to the static portion of the security group.

type StaticSecurityRule

type StaticSecurityRule interface {
	Description() string
	Directions() []string
	Remotes() []string
	Protocols() []string
	Ports() []string
}

StaticSecurityRule provides the interface to the static portion of a security rule. It has a description, a collection of directions being ingress or egress, a list of remotes being either a cidr block or a subnet group, a list of applicable protocols and a list of ports.

type StaticStorage

type StaticStorage interface {
}

type StaticSubnet

type StaticSubnet interface {
	Name() string
	GroupName() string
	CidrBlock() string
	Access() string
	AvailabilityZone() string
	ManageRoutes() bool
}

StaticSubnet provides the interface to the static portion of the subnet.

type StaticSubnetGroup

type StaticSubnetGroup interface {
	Name() string
	CidrBlock() string
	Access() string
	ManageRoutes() bool
}

StaticSubnetGroup provides the interface to the static portion of the subnet group. This information is provided via config file and is implemented by config.SubnetGroup.

type StaticVolume

type StaticVolume interface {
	Device() string
	Size() int64
	Type() string
	Keep() bool
	Boot() bool
	Preserve() bool
	FsType() string
	Inodes() int
	MountPoint() string
}

StaticVolume provides the interface to the static portion of the volume.

type StopOverride

type StopOverride interface {

	// PreStop executes before the object being stopped with the cloud provider.
	PreStop(flags ...string) error

	// MidStop stops the resource.
	MidStop(flags ...string) error

	// PostStop executes after to the object being stopped with the cloud provider.
	PostStop(flags ...string) error
}

StopOverride allows the stop methods of the class to be overridden by a derived class.

type Stopper

type Stopper interface {

	// Stop asks the provider to stop this resource.
	Stop(flags ...string) error
}

Stopper provides the ability to stopp the resource with the cloud provider.

type Storage

type Storage interface {
	Resource
	StaticStorage
	DynamicStorage

	// Account provides access to Storage's parent object.
	Account() Account
	// Bucket provides access to Storage's children Buckets.
	Buckets() Buckets
	// ProviderStorage provides access to the provider storage object.
	ProviderStorage() ProviderStorage
}

type Subnet

type Subnet interface {
	Resource
	StaticSubnet
	DynamicSubnet

	// ProviderSubnet provides access to the provider specific subnet.
	ProviderSubnet() ProviderSubnet

	// Network provides access to Subnet's parent.
	Network() Network
}

Subnet provides the resource interface used for the common subnet object implemented in the arc package.

type SubnetGroup

type SubnetGroup interface {
	Resource
	StaticSubnetGroup
	Auditor

	// Subnets provides access to SubnetGroup's child subnets.
	Subnets() map[string]Subnet

	// Find the subnet given the name, where the name takes the form "<subnet_group name>-<availability_zone>".
	Find(name string) Subnet
}

SubnetGroup provides the resource interface used for the common subnet group object implemented in the arc package.

type SubnetGroups

type SubnetGroups interface {
	Resource
	Auditor

	// Find the subnet group with the given name.
	Find(name string) SubnetGroup
}

SubnetGroups provides the resource interface used for the common subnet groups object implemented in the arc package. SubnetGroups is a collection of SubnetGroup objects, so it has a Find method associated with it. Since this is a collection object, having a pointer to it's parent isn't practical.

type Volume

type Volume interface {
	Resource
	StaticVolume
	DynamicVolume

	ProviderVolume() ProviderVolume
}

Volume provides the resource interface used for the common volume object implemented in the arc package.

type Volumes

type Volumes interface {
	Resource

	// Find volume by device name.
	Find(device string) Volume
}

Volumes provides the resource interface used for the common volumes object implemented in the arc package. Volumes is a collection of Volume objects, so it has a Find method associated with it.

Jump to

Keyboard shortcuts

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