awsutil

package
v0.0.0-...-be64df0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateConfig

func ValidateConfig(i *InstanceConfig, config *config.StorkConfig) bool

ValidateConfig ensures that InstanceConfig is complete and can safely be sent to a Synthea instance without error.

Types

type AWSClient

type AWSClient struct {
	Config  *config.StorkConfig
	Session *session.Session
	S3      s3iface.S3API
	EC2     ec2iface.EC2API
}

AWSClient contains the initialized clients and interfaces needed for Stork to interact with AWS.

func NewAWSClient

func NewAWSClient(config *config.StorkConfig) *AWSClient

NewAWSClient returns a pointer to an initialized AWSClient

func (*AWSClient) CreateBucket

func (s *AWSClient) CreateBucket(name string) error

CreateBucket creates a new S3 bucket with a given name

func (*AWSClient) DeleteBucket

func (s *AWSClient) DeleteBucket(name string) error

DeleteBucket deletes an existing S3 bucket and its contents, by name

func (*AWSClient) DescribeInstanceStatus

func (s *AWSClient) DescribeInstanceStatus(instanceIDs []string) ([]InstanceStatus, error)

DescribeInstanceStatus returns the status of one or more Synthea instances. The status returned from ec2.DescribeInstanceStatus is converted to a local representation of status.

func (*AWSClient) StartInstances

func (s *AWSClient) StartInstances(n int64, iConfig *InstanceConfig) ([]string, error)

StartInstances starts n new Synthea instances with the same configuration. All instances are expected to share an equal compute load, with a minimum of 500 patients each (this is validated elsewhere).

func (*AWSClient) TerminateInstances

func (s *AWSClient) TerminateInstances(instanceIDs []string) error

TerminateInstances terminates one or more Synthea instances. This may be called after the /done endpoint is pinged, or if an abort request is made.

type EC2Mock

type EC2Mock struct {
	ec2iface.EC2API
	// contains filtered or unexported fields
}

EC2Mock mocks out the AWS EC2 API for testing

func NewEC2Mock

func NewEC2Mock() *EC2Mock

NewEC2Mock returns a pointer to an initialized EC2 mock

func (*EC2Mock) CreateTags

func (e *EC2Mock) CreateTags(*ec2.CreateTagsInput) (*ec2.CreateTagsOutput, error)

CreateTags mocks the ec2.createTags operation

func (*EC2Mock) DescribeInstanceStatus

DescribeInstanceStatus mocks the ec2.describeInstanceStatus operation

func (*EC2Mock) RunInstances

func (e *EC2Mock) RunInstances(*ec2.RunInstancesInput) (*ec2.Reservation, error)

RunInstances mocks the ec2.runInstances operation

func (*EC2Mock) TerminateInstances

TerminateInstances mocks the ec2.terminateInstances operation

type InstanceConfig

type InstanceConfig struct {
	TaskID       string `json:"task_id"`
	Population   int    `json:"population"`
	BucketName   string `json:"bucketName"`
	BucketRegion string `json:"bucketRegion"`
	// The endpoint Synthea should ping when done generating patients
	DoneEndpoint string `json:"done_endpoint"`
}

InstanceConfig describes the configuration that will be passed to each Synthea instance as serialized JSON (in user data).

type InstanceStatus

type InstanceStatus struct {
	InstanceID string
	Status     string
}

InstanceStatus describes the current status of a running Synthea instance.

type S3Mock

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

S3Mock mocks out the AWS S3 API for testing

func NewS3Mock

func NewS3Mock() *S3Mock

NewS3Mock returns a pointer to an initialized S3 mock

func (*S3Mock) CreateBucket

func (s *S3Mock) CreateBucket(in *s3.CreateBucketInput) (*s3.CreateBucketOutput, error)

CreateBucket mocks the s3.createBucket operation

func (*S3Mock) DeleteBucket

func (s *S3Mock) DeleteBucket(in *s3.DeleteBucketInput) (*s3.DeleteBucketOutput, error)

DeleteBucket mocks the s3.deleteBucket operation

Jump to

Keyboard shortcuts

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