Documentation
¶
Overview ¶
Package unused provides the basic interfaces to obtain information and in some cases, manipulate, unused resources in different Cloud Service Providers (CSPs).
Currently only unused disks are supported.
The following providers are already implemented:
- Google Cloud Platform (GCP)
- Amazon Web Services (AWS)
- Azure
Index ¶
Constants ¶
View Source
const GiBbytes = 1_073_741_824 // 2^30
Variables ¶
This section is empty.
Functions ¶
func ByCreatedAt ¶
ByCreatedAt sorts a Disks collection by disk creation time.
func ByProvider ¶
ByProvider sorts a Disks collection by provider name.
Types ¶
type Disk ¶
type Disk interface { // ID should return a unique ID for a disk within each cloud // provider. ID() string // Provider returns a reference to the provider used to instantiate // this disk Provider() Provider // Name returns the disk name. Name() string // SizeGB returns the disk size in GB (Azure/GCP) and GiB for AWS. SizeGB() int // SizeBytes returns the disk size in bytes. SizeBytes() float64 // CreatedAt returns the time when the disk was created. CreatedAt() time.Time // LastUsedAt returns the date when the disk was last used. LastUsedAt() time.Time // Meta returns the disk metadata. Meta() Meta // DiskType returns the normalized type of disk. DiskType() DiskType }
Disk represents an unused disk on a given cloud provider.
type Meta ¶
Meta is a map of key/value pairs.
func (Meta) CreatedForNamespace ¶ added in v0.0.3
func (Meta) CreatedForPV ¶ added in v0.0.3
func (Meta) CreatedForPVC ¶ added in v0.0.3
func (Meta) Matches ¶
Matches returns true when the given key exists in the map with the given value.
type Provider ¶
type Provider interface { // Name returns the provider name. Name() string // ID returns the project (GCP) or profile (AWS) or subscription (Azure) for this provider. ID() string // ListUnusedDisks returns a list of unused disks for the given // provider. ListUnusedDisks(ctx context.Context) (Disks, error) // Meta returns the provider metadata. Meta() Meta // Delete deletes a disk from the provider. Delete(ctx context.Context, disk Disk) error }
Provider represents a cloud provider.
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
unused
command
unused is a CLI tool to query the given providers for unused disks.
|
unused is a CLI tool to query the given providers for unused disks. |
unused-exporter
command
unused-exporter is a Prometheus exporter with a web interface to expose unused disks as metrics.
|
unused-exporter is a Prometheus exporter with a web interface to expose unused disks as metrics. |
Click to show internal directories.
Click to hide internal directories.