Cloud provider interface
Context
The cloud provider interface will have the methods to support different cloud providers implementations. These cloud providers will be used to create machines, save logs and more.
For our current milestone, we'll be using Amazon EC2 machines to create simulation machines and Amazon S3 storage to save logs. Other cloud providers should be taken into account while creating this interface. That being said, the interface should be as generic as possible.
Machines
- Create machine instances
- Terminate machine instances
- Count the amount of machine instances.
Storage
- Upload file/logs
- Get logs URL
Proposed changes
Machines interface
type CreateMachinesInput struct {
DryRun bool
KeyName string
MinCount int64
MaxCount int64
FirewallRules []string // SecurityGroups on AWS
SubnetId string
Tags map[string]string
}
type TerminateMachinesInput struct {
Names []string
DryRun bool
}
type CountMachinesInput struct {
MaxResults int
Tags map[string][]string
}
type Machines interface {
Create(input CreateMachinesInput) error
Terminate(input TerminateMachinesInput) error
Count(input CountMachinesInput) int
}
Storage interface
type UploadInput struct {
Bucket string
Key string
File *bytes.Reader
ContentLength int64
ContentType string
}
type Storage interface {
Upload(input UploadInput) error
GetURL(bucket string, key string, expireIn time.Duration) string
}
Other information
Edited by Marcos Huck