types

package
v0.14.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	InfraResourceStateRunning    InfraResourceState = "running"
	InfraResourceStateStopped                       = "stopped"
	InfraResourceStateTerminated                    = "terminated"
)
View Source
const INFRA_RESOURCE_FIELD_STRING_LIST_SEPARATOR string = ","

Variables

This section is empty.

Functions

func GetInfraResourceTypeAliasesDNSRecord added in v0.13.0

func GetInfraResourceTypeAliasesDNSRecord() []string

GetInfraResourceTypeAliasVM returns a list of aliases for the DNS record resource type

func GetInfraResourceTypeAliasesDatabase added in v0.13.0

func GetInfraResourceTypeAliasesDatabase() []string

GetInfraResourceTypeAliasVM returns a list of aliases for the database resource type

func GetInfraResourceTypeAliasesVM added in v0.13.0

func GetInfraResourceTypeAliasesVM() []string

GetInfraResourceTypeAliasVM returns a list of aliases for the VM resource type

Types

type CostAndUsageFilter

type CostAndUsageFilter struct {
	Providers     []string
	ResourceTypes []string
	Regions       []string
	Tags          map[string]string
	Granularity   string
	StartDate     string
	EndDate       string
	GroupBy       map[string]string
	SortRate      string
	SortCurAmount string
}

CostAndUsageFilter defines parameters used to filter costs

type CostAndUsageOutput

type CostAndUsageOutput struct {
	Provider string
	Groups   map[string]float64
	Period   *CostAndUsagePeriod
}

CostAndUsageOutput defines output to be returned by `GetCostAndUsage`

type CostAndUsagePeriod

type CostAndUsagePeriod struct {
	StartDate string
	EndDate   string
}

CostAndUsagePeriod defines period used to calculate costs and usage

type CostSpikeOutput

type CostSpikeOutput struct {
	Provider         string
	GroupKey         string
	CurPeriod        *CostAndUsagePeriod
	PrevPeriod       *CostAndUsagePeriod
	CurPeriodAmount  float64
	PrevPeriodAmount float64
	IncreaseRate     float64
}

type InfraFilter

type InfraFilter struct {
	Providers      []string
	ResourceTypes  []string
	Regions        []string
	Tags           map[string]string
	Properties     map[string]string
	DNSZones       []string
	DNSRecordTypes []string
}

type InfraProvider added in v0.13.0

type InfraProvider interface {
	// IsEnabled returns true if the provider, all factors considered (including the host SRE Tooling is running),
	// will be able to return resources when initialized
	IsAvailable() bool
	Init() error
	GetName() string
	GetCostsAndUsages(filter *CostAndUsageFilter) (*CostAndUsageOutput, error)
	// GetResourceTypes returns a map of resource types provided by the provider
	// the key in the map should be the name of the ResourceType and should be
	// equivalent to what is returned by the ResourceType.GetName() function
	GetResourceTypes() (map[string]InfraResourceType, error)
}

type InfraResource

type InfraResource struct {
	Provider     string
	ID           string
	Location     string
	ResourceType string
	LaunchTime   time.Time
	Tags         map[string]*InfraResourceField
	Properties   map[string]*InfraResourceField
	Data         map[string]string
	Meta         map[string]*InfraResourceField
}

type InfraResourceField added in v0.13.0

type InfraResourceField struct {
	Name         string
	Value        string
	DataType     InfraResourceFieldDataType
	ContentTypes []InfraResourceFieldContentType
}

type InfraResourceFieldContentType added in v0.13.0

type InfraResourceFieldContentType int // A field's content type (e.g. "DNS Record Type") indicates the data the field's value holds
const (
	InfraResourceFieldContentTypeDNSRecordType InfraResourceFieldContentType = iota
)

type InfraResourceFieldDataType added in v0.13.0

type InfraResourceFieldDataType int
const (
	InfraResourceFieldDataTypeString InfraResourceFieldDataType = iota
	InfraResourceFieldDataTypeNumber
	InfraResourceFieldDataTypeTime
	InfraResourceFieldDataTypeBool
	InfraResourceFieldDataTypeStringList
)

type InfraResourceState added in v0.11.0

type InfraResourceState string

func (InfraResourceState) IsValid added in v0.11.0

func (s InfraResourceState) IsValid() error

type InfraResourceType added in v0.13.0

type InfraResourceType interface {
	GetName() string
	// GetAliases returns a list of names the resources is also known as (apart from
	// what is returned by GetName())
	GetAliases() []string
	GetRegions() ([]string, error)
	// GetDNSZones returns the list of DNS zones supported by the resource type
	// function should return an error if resource type doesn't support regions
	GetDNSZones() ([]string, error)
	// SupportsRegions indicates whether the resource type has regions. Determines
	// whether SRE Tooling can call GetRegionResources and GetRegions
	SupportsRegions() bool
	// GetRegionResources returns a list of resources in the specified region
	// if resources not grouped by region, return a blank set
	// function should return an error if resource type doesn't support regions
	GetRegionResources(region string) ([]*InfraResource, error)
	// SupportsDNSZones indicates whether the resource type has regions. Determines
	// whether SRE Tooling can call GetDNSZoneResources and GetDNSZones
	SupportsDNSZones() bool
	// GetDNSZoneResources returns a list of resources in the specified DNS zone
	// if resources not grouped by DNS zone, return a blank set
	// function should return an error if resource type doesn't support DNS zones
	GetDNSZoneResources(dnsZones string) ([]*InfraResource, error)
	UpdateResourceTag(resource *InfraResource, tagKey *string, tagValue *string) error
	// Update's a resource's state.
	//   If safe is set to true, then the implementation must guarantee that the resource can be restored
	//   to its previous state. This might mean safely backing up the resource
	//   If wait is set to true, the implementation must block execution until the resource changes state completely
	UpdateResourceState(resource *InfraResource, safe *bool, wait *bool, state *InfraResourceState) error
	// Creates a backup of the resource
	//   If safe is set, the implemtation must guarantee the integrity of the backup. We make an assumption that
	//   guaranteeing the integrity of the backup might temporarily impact the availability of the resource
	//   If wait is set to true, the implementation must block execution until the resource's backup is available
	Backup(resource *InfraResource, safe *bool, wait *bool) error
}

Jump to

Keyboard shortcuts

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