mgr

package
v0.0.0-...-cbea63e Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAWSAccountRole

func GetAWSAccountRole(accId string) string

func GetAuth

func GetAuth(accId string) (*aws.Auth, error)

func Init

func Init(configPath ...string)

Init initialises the package mgr configPath determines where the awsAccounts config is stored in the config service in respect to your service For example hailo/service/foo/awsAccounts.

func NewASClient

func NewASClient(accId, region string) (*autoscaling.AutoScaling, error)

func NewDynamoDBClient

func NewDynamoDBClient(accId, region string) (*dynamodb.Server, error)

func NewEC2Client

func NewEC2Client(accId, region string) (*ec2.EC2, error)

func NewIamClient

func NewIamClient(accId, region string) (*iam.IAM, error)

func NewS3Client

func NewS3Client(accId, region string) (*s3.S3, error)

func NewSQSClient

func NewSQSClient(accId, region string) (*sqs.SQS, error)

Types

type AWSAccount

type AWSAccount struct {
	Id      string   `json:"id"`
	Regions []string `json:"regions"`
	SNSRole string   `json:"snsRole"`
}

AWSAccount holds aws credentials and can be marshlled to/from JSON stored in the config service Params Id - the AWS Account id Regions - the supported regions for this account (currently we support eu-west-1, us-east-1 and ap-northeast-1). You might want to restrict the regions to only the local region depending on your use case SNSRole - the designated role for your service for this account

func GetAWSAccounts

func GetAWSAccounts() []*AWSAccount

func (*AWSAccount) String

func (a *AWSAccount) String() string

type AwsMgr

type AwsMgr struct {
	sync.RWMutex
	Accounts []*AWSAccount
	// contains filtered or unexported fields
}

AwsMgr encapsulates an AWS Manager object

func (*AwsMgr) GetAWSAccountRole

func (m *AwsMgr) GetAWSAccountRole(accId string) string

Returns the role for a specific account

func (*AwsMgr) GetAWSAccounts

func (m *AwsMgr) GetAWSAccounts() []*AWSAccount

Returns the configured AWS accounts from the config

func (*AwsMgr) GetAuth

func (m *AwsMgr) GetAuth(accId string) (*aws.Auth, error)

GetAuth returns an AWS auth object based on account id

func (*AwsMgr) NewASClient

func (m *AwsMgr) NewASClient(accId, region string) (*autoscaling.AutoScaling, error)

NewASClient returns a new AutoScaling client

func (*AwsMgr) NewDynamoDBClient

func (m *AwsMgr) NewDynamoDBClient(accId, region string) (*dynamodb.Server, error)

NewDynamoDB returns a new DynamoDB client

func (*AwsMgr) NewEC2Client

func (m *AwsMgr) NewEC2Client(accId, region string) (*ec2.EC2, error)

NewEC2Client returns a new EC2 client

func (*AwsMgr) NewIamClient

func (m *AwsMgr) NewIamClient(accId, region string) (*iam.IAM, error)

NewIamClient returns a new Iam client

func (*AwsMgr) NewS3Client

func (m *AwsMgr) NewS3Client(accId, region string) (*s3.S3, error)

NewS3Client returns a new S3 client

func (*AwsMgr) NewSQSClient

func (m *AwsMgr) NewSQSClient(accId, region string) (*sqs.SQS, error)

NewSQSClient returns a new SQS client

Jump to

Keyboard shortcuts

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