aws

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2017 License: Apache-2.0 Imports: 62 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PARENT_OF = iota // default
	APPLIES_ON
	DEPENDING_ON
)
View Source
const ImageQuerySpec = "owner:distro:variant:arch:virtualization:store"

Variables

View Source
var (
	Platforms = map[string]Platform{
		"canonical":       Canonical,
		"redhat":          RedHat,
		"debian":          Debian,
		"amazonlinux":     AmazonLinux,
		"suselinux":       SuseLinux,
		"microsoftserver": MicrosoftServer,
	}

	Canonical = Platform{
		Name: "canonical", Id: "099720109477", DistroName: "ubuntu", LatestVariant: "xenial",
		MatchFunc: func(s string, d Distro) bool {
			return strings.HasPrefix(s, fmt.Sprintf("%s/images/%s-ssd/%s-%s", d.Name, d.Virt, d.Name, d.Variant))
		},
	}

	RedHat = Platform{
		Name: "redhat", Id: "309956199498", DistroName: "rhel", LatestVariant: "7.3",
		MatchFunc: func(s string, d Distro) bool {
			return strings.Contains(s, fmt.Sprintf("%s-%s", d.Name, d.Variant))
		},
	}

	Debian = Platform{
		Name: "debian", Id: "379101102735", DistroName: "debian", LatestVariant: "jessie",
		MatchFunc: func(s string, d Distro) bool {
			return strings.HasPrefix(s, fmt.Sprintf("%s-%s", d.Name, d.Variant))
		},
	}

	AmazonLinux = Platform{
		Name: "amazonlinux", Id: "137112412989", LatestVariant: "hvm",
		MatchFunc: func(s string, d Distro) bool {
			return strings.HasPrefix(s, fmt.Sprintf("amzn-ami-%s", d.Variant))
		},
	}

	SuseLinux = Platform{
		Name: "suselinux", Id: "013907871322", LatestVariant: "sles-12",
		MatchFunc: func(s string, d Distro) bool {
			return strings.HasPrefix(s, fmt.Sprintf("suse-%s", d.Variant))
		},
	}

	MicrosoftServer = Platform{
		Name: "microsoftserver", Id: "801119661308", LatestVariant: "Windows_Server-2016",
		MatchFunc: func(s string, d Distro) bool {
			return strings.HasPrefix(s, fmt.Sprintf("%s", d.Variant))
		},
	}

	SupportedAMIOwners []string
)
View Source
var APIPerResourceType = map[string]string{
	"instance":            "ec2",
	"subnet":              "ec2",
	"vpc":                 "ec2",
	"keypair":             "ec2",
	"securitygroup":       "ec2",
	"volume":              "ec2",
	"internetgateway":     "ec2",
	"natgateway":          "ec2",
	"routetable":          "ec2",
	"availabilityzone":    "ec2",
	"image":               "ec2",
	"importimagetask":     "ec2",
	"elasticip":           "ec2",
	"snapshot":            "ec2",
	"loadbalancer":        "elbv2",
	"targetgroup":         "elbv2",
	"listener":            "elbv2",
	"database":            "rds",
	"dbsubnetgroup":       "rds",
	"launchconfiguration": "autoscaling",
	"scalinggroup":        "autoscaling",
	"scalingpolicy":       "autoscaling",
	"repository":          "ecr",
	"containercluster":    "ecs",
	"containertask":       "ecs",
	"container":           "ecs",
	"containerinstance":   "ecs",
	"user":                "iam",
	"group":               "iam",
	"role":                "iam",
	"policy":              "iam",
	"accesskey":           "iam",
	"bucket":              "s3",
	"s3object":            "s3",
	"subscription":        "sns",
	"topic":               "sns",
	"queue":               "sqs",
	"zone":                "route53",
	"record":              "route53",
	"function":            "lambda",
	"metric":              "cloudwatch",
	"alarm":               "cloudwatch",
	"distribution":        "cloudfront",
	"stack":               "cloudformation",
}
View Source
var (
	AccessService, InfraService, StorageService, MessagingService, DnsService, LambdaService, MonitoringService, CdnService, CloudformationService cloud.Service
)
View Source
var DefaultNetworkMonitor = &NetworkMonitor{requests: make(map[*request.Request]*req)}
View Source
var ErrTagNotFound = errors.New("aws tag key not found")
View Source
var GlobalServices = []string{
	"access",
	"dns",
	"cdn",
}
View Source
var ResourceTypes = []string{
	"instance",
	"subnet",
	"vpc",
	"keypair",
	"securitygroup",
	"volume",
	"internetgateway",
	"natgateway",
	"routetable",
	"availabilityzone",
	"image",
	"importimagetask",
	"elasticip",
	"snapshot",
	"loadbalancer",
	"targetgroup",
	"listener",
	"database",
	"dbsubnetgroup",
	"launchconfiguration",
	"scalinggroup",
	"scalingpolicy",
	"repository",
	"containercluster",
	"containertask",
	"container",
	"containerinstance",
	"user",
	"group",
	"role",
	"policy",
	"accesskey",
	"bucket",
	"s3object",
	"subscription",
	"topic",
	"queue",
	"zone",
	"record",
	"function",
	"metric",
	"alarm",
	"distribution",
	"stack",
}
View Source
var ServiceNames = []string{
	"infra",
	"access",
	"storage",
	"messaging",
	"dns",
	"lambda",
	"monitoring",
	"cdn",
	"cloudformation",
}
View Source
var ServicePerAPI = map[string]string{
	"ec2":                    "infra",
	"elbv2":                  "infra",
	"rds":                    "infra",
	"autoscaling":            "infra",
	"ecr":                    "infra",
	"ecs":                    "infra",
	"applicationautoscaling": "infra",
	"iam":                    "access",
	"sts":                    "access",
	"s3":                     "storage",
	"sns":                    "messaging",
	"sqs":                    "messaging",
	"route53":                "dns",
	"lambda":                 "lambda",
	"cloudwatch":             "monitoring",
	"cloudfront":             "cdn",
	"cloudformation":         "cloudformation",
}
View Source
var ServicePerResourceType = map[string]string{
	"instance":            "infra",
	"subnet":              "infra",
	"vpc":                 "infra",
	"keypair":             "infra",
	"securitygroup":       "infra",
	"volume":              "infra",
	"internetgateway":     "infra",
	"natgateway":          "infra",
	"routetable":          "infra",
	"availabilityzone":    "infra",
	"image":               "infra",
	"importimagetask":     "infra",
	"elasticip":           "infra",
	"snapshot":            "infra",
	"loadbalancer":        "infra",
	"targetgroup":         "infra",
	"listener":            "infra",
	"database":            "infra",
	"dbsubnetgroup":       "infra",
	"launchconfiguration": "infra",
	"scalinggroup":        "infra",
	"scalingpolicy":       "infra",
	"repository":          "infra",
	"containercluster":    "infra",
	"containertask":       "infra",
	"container":           "infra",
	"containerinstance":   "infra",
	"user":                "access",
	"group":               "access",
	"role":                "access",
	"policy":              "access",
	"accesskey":           "access",
	"bucket":              "storage",
	"s3object":            "storage",
	"subscription":        "messaging",
	"topic":               "messaging",
	"queue":               "messaging",
	"zone":                "dns",
	"record":              "dns",
	"function":            "lambda",
	"metric":              "monitoring",
	"alarm":               "monitoring",
	"distribution":        "cdn",
	"stack":               "cloudformation",
}

Functions

func GetCloudServicesForAPIs added in v0.0.21

func GetCloudServicesForAPIs(apis ...string) (services []cloud.Service)

func GetCloudServicesForTypes added in v0.0.21

func GetCloudServicesForTypes(types ...string) (services []cloud.Service)

func InitServices

func InitServices(conf map[string]interface{}, log *logger.Logger, profileSetterCallback func(val string) error) error

func IsGlobalService added in v0.1.1

func IsGlobalService(name string) bool

func NewAccess

func NewAccess(sess *session.Session, awsconf config, log *logger.Logger) cloud.Service

func NewCdn added in v0.0.25

func NewCdn(sess *session.Session, awsconf config, log *logger.Logger) cloud.Service

func NewCloudformation added in v0.0.25

func NewCloudformation(sess *session.Session, awsconf config, log *logger.Logger) cloud.Service

func NewDns

func NewDns(sess *session.Session, awsconf config, log *logger.Logger) cloud.Service

func NewDriver added in v0.0.23

func NewDriver(region, profile string, log ...*logger.Logger) (driver.Driver, error)

func NewInfra

func NewInfra(sess *session.Session, awsconf config, log *logger.Logger) cloud.Service

func NewLambda added in v0.0.23

func NewLambda(sess *session.Session, awsconf config, log *logger.Logger) cloud.Service

func NewMessaging added in v0.1.1

func NewMessaging(sess *session.Session, awsconf config, log *logger.Logger) cloud.Service

func NewMonitoring added in v0.0.23

func NewMonitoring(sess *session.Session, awsconf config, log *logger.Logger) cloud.Service

func NewStorage

func NewStorage(sess *session.Session, awsconf config, log *logger.Logger) cloud.Service

func ResourceTypesPerServiceName added in v0.0.22

func ResourceTypesPerServiceName() map[string][]string

Types

type Access

type Access struct {
	iamiface.IAMAPI
	stsiface.STSAPI
	// contains filtered or unexported fields
}

func (*Access) Drivers

func (s *Access) Drivers() []driver.Driver

func (*Access) FetchByType

func (s *Access) FetchByType(t string) (*graph.Graph, error)

func (*Access) FetchResources

func (s *Access) FetchResources() (*graph.Graph, error)

func (*Access) GetIdentity added in v0.0.21

func (s *Access) GetIdentity() (*Identity, error)

func (*Access) GetUserPolicies added in v0.0.21

func (s *Access) GetUserPolicies(username string) (*UserPolicies, error)

func (*Access) IsSyncDisabled

func (s *Access) IsSyncDisabled() bool

func (*Access) Name

func (s *Access) Name() string

func (*Access) Region added in v0.1.1

func (s *Access) Region() string

func (*Access) ResourceTypes

func (s *Access) ResourceTypes() []string

type AwsImage added in v0.0.24

type AwsImage struct {
	Id                 string
	Owner              string
	Location           string
	Type               string
	Architecture       string
	VirtualizationType string
	Name               string
	Created            time.Time
	Hypervisor         string
	Store              string
}

type Cdn added in v0.0.25

type Cdn struct {
	cloudfrontiface.CloudFrontAPI
	// contains filtered or unexported fields
}

func (*Cdn) Drivers added in v0.0.25

func (s *Cdn) Drivers() []driver.Driver

func (*Cdn) FetchByType added in v0.0.25

func (s *Cdn) FetchByType(t string) (*graph.Graph, error)

func (*Cdn) FetchResources added in v0.0.25

func (s *Cdn) FetchResources() (*graph.Graph, error)

func (*Cdn) IsSyncDisabled added in v0.0.25

func (s *Cdn) IsSyncDisabled() bool

func (*Cdn) Name added in v0.0.25

func (s *Cdn) Name() string

func (*Cdn) Region added in v0.1.1

func (s *Cdn) Region() string

func (*Cdn) ResourceTypes added in v0.0.25

func (s *Cdn) ResourceTypes() []string

type Cloudformation added in v0.0.25

type Cloudformation struct {
	cloudformationiface.CloudFormationAPI
	// contains filtered or unexported fields
}

func (*Cloudformation) Drivers added in v0.0.25

func (s *Cloudformation) Drivers() []driver.Driver

func (*Cloudformation) FetchByType added in v0.0.25

func (s *Cloudformation) FetchByType(t string) (*graph.Graph, error)

func (*Cloudformation) FetchResources added in v0.0.25

func (s *Cloudformation) FetchResources() (*graph.Graph, error)

func (*Cloudformation) IsSyncDisabled added in v0.0.25

func (s *Cloudformation) IsSyncDisabled() bool

func (*Cloudformation) Name added in v0.0.25

func (s *Cloudformation) Name() string

func (*Cloudformation) Region added in v0.1.1

func (s *Cloudformation) Region() string

func (*Cloudformation) ResourceTypes added in v0.0.25

func (s *Cloudformation) ResourceTypes() []string

type Distro added in v0.0.24

type Distro struct {
	Name, Variant, Arch, Virt, Store string
}

type Dns

type Dns struct {
	route53iface.Route53API
	// contains filtered or unexported fields
}

func (*Dns) Drivers

func (s *Dns) Drivers() []driver.Driver

func (*Dns) FetchByType

func (s *Dns) FetchByType(t string) (*graph.Graph, error)

func (*Dns) FetchResources

func (s *Dns) FetchResources() (*graph.Graph, error)

func (*Dns) IsSyncDisabled

func (s *Dns) IsSyncDisabled() bool

func (*Dns) Name

func (s *Dns) Name() string

func (*Dns) Region added in v0.1.1

func (s *Dns) Region() string

func (*Dns) ResourceTypes

func (s *Dns) ResourceTypes() []string

type Identity added in v0.0.21

type Identity struct {
	Account, Arn, UserId, ResourceType, ResourcePath, Resource string
}

func (*Identity) IsRoot added in v0.0.24

func (i *Identity) IsRoot() bool

func (*Identity) IsUserType added in v0.0.24

func (i *Identity) IsUserType() bool

type ImageQuery added in v0.0.24

type ImageQuery struct {
	Platform Platform
	Distro   Distro
}

func ParseImageQuery added in v0.0.24

func ParseImageQuery(s string) (ImageQuery, error)

func (ImageQuery) String added in v0.0.24

func (q ImageQuery) String() string

type ImageResolver added in v0.0.24

type ImageResolver struct {
	InfraService *Infra
}

Image resolving allows to find AWS AMIs identifiers specifying what you want instead of an id that is specific to a region. The ami query string specification is as follows:

owner:distro:variant:arch:virtualization:store

Everything optional expect for the owner.

As for now only the main specific owner are taken into account and we deal with bares machines only distribution. Here are some examples:

- canonical:ubuntu:trusty

- redhat:rhel:6.8

- redhat::6.8

- amazonlinux

- suselinux:sles-12

- canonical:::i386

- redhat::::instance-store

The default values are: Arch="x86_64", Virt="hvm", Store="ebs"

func (*ImageResolver) Resolve added in v0.0.24

func (r *ImageResolver) Resolve(q ImageQuery) ([]*AwsImage, error)

type Infra

func (*Infra) Drivers

func (s *Infra) Drivers() []driver.Driver

func (*Infra) FetchByType

func (s *Infra) FetchByType(t string) (*graph.Graph, error)

func (*Infra) FetchResources

func (s *Infra) FetchResources() (*graph.Graph, error)

func (*Infra) IsSyncDisabled

func (s *Infra) IsSyncDisabled() bool

func (*Infra) Name

func (s *Infra) Name() string

func (*Infra) Region added in v0.1.1

func (s *Infra) Region() string

func (*Infra) ResourceTypes

func (s *Infra) ResourceTypes() []string

type Lambda added in v0.0.23

type Lambda struct {
	lambdaiface.LambdaAPI
	// contains filtered or unexported fields
}

func (*Lambda) Drivers added in v0.0.23

func (s *Lambda) Drivers() []driver.Driver

func (*Lambda) FetchByType added in v0.0.23

func (s *Lambda) FetchByType(t string) (*graph.Graph, error)

func (*Lambda) FetchResources added in v0.0.23

func (s *Lambda) FetchResources() (*graph.Graph, error)

func (*Lambda) IsSyncDisabled added in v0.0.23

func (s *Lambda) IsSyncDisabled() bool

func (*Lambda) Name added in v0.0.23

func (s *Lambda) Name() string

func (*Lambda) Region added in v0.1.1

func (s *Lambda) Region() string

func (*Lambda) ResourceTypes added in v0.0.23

func (s *Lambda) ResourceTypes() []string

type Messaging added in v0.1.1

type Messaging struct {
	snsiface.SNSAPI
	sqsiface.SQSAPI
	// contains filtered or unexported fields
}

func (*Messaging) Drivers added in v0.1.1

func (s *Messaging) Drivers() []driver.Driver

func (*Messaging) FetchByType added in v0.1.1

func (s *Messaging) FetchByType(t string) (*graph.Graph, error)

func (*Messaging) FetchResources added in v0.1.1

func (s *Messaging) FetchResources() (*graph.Graph, error)

func (*Messaging) IsSyncDisabled added in v0.1.1

func (s *Messaging) IsSyncDisabled() bool

func (*Messaging) Name added in v0.1.1

func (s *Messaging) Name() string

func (*Messaging) Region added in v0.1.1

func (s *Messaging) Region() string

func (*Messaging) ResourceTypes added in v0.1.1

func (s *Messaging) ResourceTypes() []string

type Monitoring added in v0.0.23

type Monitoring struct {
	cloudwatchiface.CloudWatchAPI
	// contains filtered or unexported fields
}

func (*Monitoring) Drivers added in v0.0.23

func (s *Monitoring) Drivers() []driver.Driver

func (*Monitoring) FetchByType added in v0.0.23

func (s *Monitoring) FetchByType(t string) (*graph.Graph, error)

func (*Monitoring) FetchResources added in v0.0.23

func (s *Monitoring) FetchResources() (*graph.Graph, error)

func (*Monitoring) IsSyncDisabled added in v0.0.23

func (s *Monitoring) IsSyncDisabled() bool

func (*Monitoring) Name added in v0.0.23

func (s *Monitoring) Name() string

func (*Monitoring) Region added in v0.1.1

func (s *Monitoring) Region() string

func (*Monitoring) ResourceTypes added in v0.0.23

func (s *Monitoring) ResourceTypes() []string

type NetworkMonitor added in v0.1.1

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

func (*NetworkMonitor) DisplayStats added in v0.1.1

func (n *NetworkMonitor) DisplayStats(w io.Writer)

type Platform added in v0.0.24

type Platform struct {
	Name          string
	Id            string
	DistroName    string
	LatestVariant string
	MatchFunc     func(s string, d Distro) bool
}

type Storage

type Storage struct {
	s3iface.S3API
	// contains filtered or unexported fields
}

func (*Storage) Drivers

func (s *Storage) Drivers() []driver.Driver

func (*Storage) FetchByType

func (s *Storage) FetchByType(t string) (*graph.Graph, error)

func (*Storage) FetchResources

func (s *Storage) FetchResources() (*graph.Graph, error)

func (*Storage) IsSyncDisabled

func (s *Storage) IsSyncDisabled() bool

func (*Storage) Name

func (s *Storage) Name() string

func (*Storage) Region added in v0.1.1

func (s *Storage) Region() string

func (*Storage) ResourceTypes

func (s *Storage) ResourceTypes() []string

type UserPolicies added in v0.0.21

type UserPolicies struct {
	Username string
	Inlined  []string
	Attached []string
	ByGroup  map[string][]string
}

Directories

Path Synopsis
DO NOT EDIT This file was automatically generated with go generate
DO NOT EDIT This file was automatically generated with go generate
DO NOT EDIT This file was automatically generated with go generate DO NOT EDIT This file was automatically generated with go generate DO NOT EDIT This file was automatically generated with go generate
DO NOT EDIT This file was automatically generated with go generate DO NOT EDIT This file was automatically generated with go generate DO NOT EDIT This file was automatically generated with go generate

Jump to

Keyboard shortcuts

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