Documentation ¶
Index ¶
Constants ¶
View Source
const ( // GcpCredentialsFileKey is the Env variable to store path // to service accounts credentials JSON file GcpCredentialsFileKey = "GOOGLE_APPLICATION_CREDENTIALS" )
Variables ¶
View Source
var ( // ErrPermissionDenied is returned if not enough permissions to perform action ErrPermissionDenied = errors.New("permission denied") )
Functions ¶
This section is empty.
Types ¶
type AllResourceCollection ¶
type AllResourceCollection struct { Owner string Instances []Instance Images []Image Volumes []Volume Snapshots []Snapshot Buckets []Bucket }
AllResourceCollection encapsulates collections of all resources, including buckets
type Bucket ¶
type Bucket interface { Resource LastModified() time.Time ObjectCount() int64 TotalSizeGB() float64 StorageTypeSizesGB() map[string]float64 }
Bucket represents a bucket in a CSP, such as an S3 bucket in AWS
type Image ¶
Image composes the Resource interface, and descibe an image in any CSP. Such as an AMI in AWS.
type Resource ¶
type Resource interface { CSP() CSP Owner() string ID() string Tags() map[string]string Location() string Public() bool CreationTime() time.Time SetTag(key, value string, overwrite bool) error RemoveTag(key string) error Cleanup() error }
Resource represents a generic resource in any CSP. It should be concretizised further.
type ResourceCollection ¶
type ResourceCollection struct { Owner string Instances []Instance Images []Image Volumes []Volume Snapshots []Snapshot }
ResourceCollection encapsulates collections of multiple resources. Does not include buckets.
type ResourceManager ¶
type ResourceManager interface { // Owners return a list of all owners the manager handle Owners() []string // BucketsPerAccount returns a mapping from account/project to // its associated buckets BucketsPerAccount() map[string][]Bucket // InstancesPerAccount returns a mapping from account/project // to its associated instances InstancesPerAccount() map[string][]Instance // ImagesPerAccount returns a mapping from account/project // to its associated images ImagesPerAccount() map[string][]Image // VolumesPerAccount returns a mapping from account/project // to its associated volumes VolumesPerAccount() map[string][]Volume // SnapshotsPerAccount returns a mapping from account/project // to its associated snaphots SnapshotsPerAccount() map[string][]Snapshot // AllResourcesPerAccount will return a mapping from account/project // to all of the resources associated with that account/project AllResourcesPerAccount() map[string]*ResourceCollection // CleanupInstances termiantes a list of instances, which is faster // than calling Cleanup() on every individual instance CleanupInstances([]Instance) error // CleanupImages de-registers a list of images CleanupImages([]Image) error // CleanupVolumes deletes a list of volumes CleanupVolumes([]Volume) error // CleanupSnapshots delete a list of snapshots CleanupSnapshots([]Snapshot) error // CleanupBuckets deletes the specified buckets CleanupBuckets([]Bucket) error }
ResourceManager is used to manage the different resources on a CSP. It can be used to get e.g. all instances for all accounts in AWS.
func NewManager ¶
func NewManager(c CSP, accounts ...string) (ResourceManager, error)
NewManager will build a new resource manager for the specified CSP
Source Files ¶
Click to show internal directories.
Click to hide internal directories.