awl

package module
v0.0.0-...-4b44dc4 Latest Latest
Warning

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

Go to latest
Published: May 13, 2018 License: CC0-1.0 Imports: 9 Imported by: 0

README

awl

Awl is a Golang AWS SDK wrapper for lazy coders. It doesn't cover everything, or even most things. In fact, the vast majority of the AWS SDK is not available through Awl.

Philosophy

Awl is all about being lazy. It requires very minimal setup, and lazily provisions API clients on demand. This probably greatly increases the risk of runtime errors in complex applications. Awl is not meant for these purposes.

Awl also forces you to use assumed roles to do any work. It doesn't help you set up your initial credentials (it will pick things up from the standard places via the SDK of course), and it requires that you give it a role to assume before it will do anything for you. If you are not a fan of that approach, Awl may not be the library for you.

Status

Awl is in the very earliest stages of development. You should probably avoid it.

Who is Awl for?

Awl is intended to be for lazy coders who aren't writing ultra-high reliability programs, but instead just want to get something done and not spend too much time futzing with the nits of the AWS SDK. Seriously, though, this is not the library to use if you are deploying high-stakes non-trivial production level services.

However, given its extremely early stage of development, you probably still shouldn't use it.

Testing

Run go test.

License

This software is public domain. No rights are reserved. See LICENSE for more information.

Documentation

Overview

awl is an AWS SDK wrapper for lazy coders.

Index

Constants

This section is empty.

Variables

View Source
var DefaultRegion string
View Source
var Session *session.Session

Session contains the AWS session, which is created on initialization.

Functions

func SetBaseCredentials

func SetBaseCredentials(creds *credentials.Credentials)

Types

type Account

type Account struct {
	Id            string
	Alias         string
	AssumeRoleArn string
	// contains filtered or unexported fields
}

An Account represents an AWS account you will use via an assumed role. You should use the NewAccount constructor to set it up.

If you need to use more than one role with one AWS account, simply construct additional Account objects, specifying different roles.

func NewAccount

func NewAccount(id string, role string) *Account

Constructs a new Account object from an AWS account ID and the name (not the full ARN) of a role, including the path, if any.

func (*Account) AllInstances

func (a *Account) AllInstances(region string) ([]*ec2.Instance, error)

Returns all of the EC2 instances in the given region.

func (*Account) AllSecurityGroups

func (a *Account) AllSecurityGroups(region string) ([]*ec2.SecurityGroup, error)

Returns all security groups in the given region.

func (*Account) AllSubnets

func (a *Account) AllSubnets(region string) ([]*ec2.Subnet, error)

Returns all subnets in the given region.

func (*Account) AllVpcs

func (a *Account) AllVpcs(region string) ([]*ec2.Vpc, error)

Returns all VPCs in the given region.

func (*Account) CacheAlias

func (a *Account) CacheAlias() (string, error)

Returns (and caches) the account alias. If none is set, then returns the account ID.

func (*Account) Credentials

func (a *Account) Credentials() *credentials.Credentials

Fetches a lazily provisioned STS credentials manager which will renew the credentials as necessary. Usually this function will only be called internally, but it's here if you need it.

func (*Account) EC2

func (a *Account) EC2(region string) *ec2.EC2

Returns a lazily provisioned EC2 client for the given region.

func (*Account) IAM

func (a *Account) IAM() *iam.IAM

Returns a lazily provisioned IAM client for the default region, since IAM is a global service.

func (*Account) InstanceByPrivateIP

func (a *Account) InstanceByPrivateIP(region string, ip string) (*ec2.Instance, error)

Returns an instance from the given region by private IP.

Jump to

Keyboard shortcuts

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