Documentation ¶
Index ¶
- Variables
- func AddToTerminationPlan(t TerminationItem)
- func AddVirtualResource(resource VirtualResource)
- func ClearTerminationPlan()
- func CostBetween(c []CostItem, t1 time.Time, t2 time.Time) float64
- func CurrentTerminationPlanToString() string
- func FilterNonOT3C()
- func GetCostTillBillingEnd(vr VirtualResource) float64
- func GetCurrentCost(vr VirtualResource) float64
- func GetPrio(vr VirtualResource) int
- func ParseTerminationPlanFromString(str string) error
- func RemoveResourceWithID(id string) bool
- func RenderTerminationPlanToYAMLFile() (string, error)
- func SetTerminationItems(t []TerminationItem)
- func SortResourcesByPriority()
- func UpdateTerminationPlan()
- type CostItem
- type CostSortByDate
- type ECSResource
- func (c ECSResource) GetCostItems() []CostItem
- func (c ECSResource) GetDescription() string
- func (c ECSResource) GetID() string
- func (c ECSResource) GetPredCostItems() []CostItem
- func (c ECSResource) GetTags() map[string]string
- func (c *ECSResource) SetPastCostItems(cost []enterprise.Consumption)
- func (c *ECSResource) SetPredCostItems(cost []CostItem)
- func (c ECSResource) Terminate(client *golangsdk.ProviderClient) error
- type EVSResource
- func (c *EVSResource) BuildPastCostItems(cost []enterprise.Consumption)
- func (c EVSResource) GetCostItems() []CostItem
- func (c EVSResource) GetDescription() string
- func (c EVSResource) GetID() string
- func (c EVSResource) GetPredCostItems() []CostItem
- func (c EVSResource) GetTags() map[string]string
- func (c *EVSResource) SetPredCostItems(cost []CostItem)
- func (c EVSResource) Terminate(client *golangsdk.ProviderClient) error
- type GhostResource
- func (c *GhostResource) BuildPastCostItems(cost []enterprise.Consumption)
- func (c GhostResource) GetCostItems() []CostItem
- func (c GhostResource) GetDescription() string
- func (c GhostResource) GetID() string
- func (c GhostResource) GetPredCostItems() []CostItem
- func (c GhostResource) GetTags() map[string]string
- func (c GhostResource) Terminate(client *golangsdk.ProviderClient) error
- type GroupResource
- func (g GroupResource) GetCostItems() []CostItem
- func (g GroupResource) GetDescription() string
- func (g GroupResource) GetID() string
- func (g GroupResource) GetPredCostItems() []CostItem
- func (g GroupResource) GetTags() map[string]string
- func (g GroupResource) PatchGroup()
- func (g GroupResource) Terminate(client *golangsdk.ProviderClient) error
- type SortByPrio
- type TerminationItem
- type TerminationPlan
- type VirtualResource
Constants ¶
This section is empty.
Variables ¶
var Resources []VirtualResource
Resources is the in-memory representation of the cloud environment
Functions ¶
func AddToTerminationPlan ¶
func AddToTerminationPlan(t TerminationItem)
func AddVirtualResource ¶
func AddVirtualResource(resource VirtualResource)
AddVirtualResource adds a new VirtualResource
func ClearTerminationPlan ¶
func ClearTerminationPlan()
func CostBetween ¶
CostBetween returns sums all costItems between t1 and t2
func CurrentTerminationPlanToString ¶
func CurrentTerminationPlanToString() string
CurrentTerminationPlanToString renders the current TerminationPlan to string
func GetCostTillBillingEnd ¶
func GetCostTillBillingEnd(vr VirtualResource) float64
GetCostTillBillingEnd calculates the rest cost for this cost month
func GetCurrentCost ¶
func GetCurrentCost(vr VirtualResource) float64
GetCurrentCost calculates the current cost in this cost month
func GetPrio ¶
func GetPrio(vr VirtualResource) int
GetPrio returns a prio for a vr if available. If not then it returns -1
func RemoveResourceWithID ¶
RemoveResourceWithID removes a VR based on its ID. Returns true on found and removed. Caution ... destroys order
func RenderTerminationPlanToYAMLFile ¶
RenderTerminationPlanToYAMLFile encodes the TerminationPlan to a String writable to a YAML file
func SetTerminationItems ¶
func SetTerminationItems(t []TerminationItem)
func SortResourcesByPriority ¶
func SortResourcesByPriority()
SortResourcesByPriority rearranges the VRs in the Resource List based on Priority decending.
func UpdateTerminationPlan ¶
func UpdateTerminationPlan()
UpdateTerminationPlan creates new TerminationPlan based upon current Termination Items
Types ¶
type CostSortByDate ¶
type CostSortByDate []CostItem
CostSortByDate is a list for sorting by date
func (CostSortByDate) Len ¶
func (a CostSortByDate) Len() int
func (CostSortByDate) Less ¶
func (a CostSortByDate) Less(i, j int) bool
func (CostSortByDate) Swap ¶
func (a CostSortByDate) Swap(i, j int)
type ECSResource ¶
type ECSResource struct { ID string OTCServer servers.Server PredCost []CostItem Tags map[string]string // contains filtered or unexported fields }
ECSResource ECSResource
func (ECSResource) GetCostItems ¶
func (c ECSResource) GetCostItems() []CostItem
func (ECSResource) GetDescription ¶
func (c ECSResource) GetDescription() string
func (ECSResource) GetID ¶
func (c ECSResource) GetID() string
func (ECSResource) GetPredCostItems ¶
func (c ECSResource) GetPredCostItems() []CostItem
func (ECSResource) GetTags ¶
func (c ECSResource) GetTags() map[string]string
func (*ECSResource) SetPastCostItems ¶
func (c *ECSResource) SetPastCostItems(cost []enterprise.Consumption)
SetPastCostItems build past cost items
func (*ECSResource) SetPredCostItems ¶
func (c *ECSResource) SetPredCostItems(cost []CostItem)
func (ECSResource) Terminate ¶
func (c ECSResource) Terminate(client *golangsdk.ProviderClient) error
type EVSResource ¶
type EVSResource struct { ID string OTCEVS hVolumes.Volume PredCost []CostItem // contains filtered or unexported fields }
ECSResource ECSResource
func (*EVSResource) BuildPastCostItems ¶
func (c *EVSResource) BuildPastCostItems(cost []enterprise.Consumption)
func (EVSResource) GetCostItems ¶
func (c EVSResource) GetCostItems() []CostItem
func (EVSResource) GetDescription ¶
func (c EVSResource) GetDescription() string
func (EVSResource) GetID ¶
func (c EVSResource) GetID() string
func (EVSResource) GetPredCostItems ¶
func (c EVSResource) GetPredCostItems() []CostItem
func (EVSResource) GetTags ¶
func (c EVSResource) GetTags() map[string]string
func (*EVSResource) SetPredCostItems ¶
func (c *EVSResource) SetPredCostItems(cost []CostItem)
func (EVSResource) Terminate ¶
func (c EVSResource) Terminate(client *golangsdk.ProviderClient) error
type GhostResource ¶
type GhostResource struct { ID string // contains filtered or unexported fields }
GhostResource are VRs that once where a real VR but are now terminated and no longer produce any future costs. They are still needet for current cost calculation.
func (*GhostResource) BuildPastCostItems ¶
func (c *GhostResource) BuildPastCostItems(cost []enterprise.Consumption)
func (GhostResource) GetCostItems ¶
func (c GhostResource) GetCostItems() []CostItem
func (GhostResource) GetDescription ¶
func (c GhostResource) GetDescription() string
func (GhostResource) GetID ¶
func (c GhostResource) GetID() string
func (GhostResource) GetPredCostItems ¶
func (c GhostResource) GetPredCostItems() []CostItem
func (GhostResource) GetTags ¶
func (c GhostResource) GetTags() map[string]string
func (GhostResource) Terminate ¶
func (c GhostResource) Terminate(client *golangsdk.ProviderClient) error
type GroupResource ¶
type GroupResource struct { List []VirtualResource Tags map[string]string }
GroupResource is a grouped resource. IDs should start with GR_
func (GroupResource) GetCostItems ¶
func (g GroupResource) GetCostItems() []CostItem
func (GroupResource) GetDescription ¶
func (g GroupResource) GetDescription() string
func (GroupResource) GetID ¶
func (g GroupResource) GetID() string
func (GroupResource) GetPredCostItems ¶
func (g GroupResource) GetPredCostItems() []CostItem
func (GroupResource) GetTags ¶
func (g GroupResource) GetTags() map[string]string
func (GroupResource) PatchGroup ¶
func (g GroupResource) PatchGroup()
PatchGroup searches through all the VRs and patches different tags on the group Set highest prio. Searches through all VRs, gets the highes prio and sets it for the group.
func (GroupResource) Terminate ¶
func (g GroupResource) Terminate(client *golangsdk.ProviderClient) error
type SortByPrio ¶
type SortByPrio []VirtualResource
func (SortByPrio) Len ¶
func (a SortByPrio) Len() int
func (SortByPrio) Less ¶
func (a SortByPrio) Less(i, j int) bool
func (SortByPrio) Swap ¶
func (a SortByPrio) Swap(i, j int)
type TerminationItem ¶
type TerminationItem struct { TVR VirtualResource TDate time.Time //TSave is the amount of money saved by this termination TSave float64 //TASAP determines if this termination is a ASAP Termination TASAP bool }
TerminationItem is an item on the Termination list
type TerminationPlan ¶
type TerminationPlan struct { CreatedAt time.Time Items []TerminationItem }
var ActiveTerminationPlan TerminationPlan
type VirtualResource ¶
type VirtualResource interface { //GetID returns a unique ID for the VR GetID() string //GetDescription returns a description for the VR GetDescription() string //GetCostItems returns all past costs up to the current date GetCostItems() []CostItem //GetPredCostItems returns future costs. Length can be 0 if no prediction has been done yet. GetPredCostItems() []CostItem //GetTags returns the VRs Tags GetTags() map[string]string //Terminate terminates the VR Terminate(*golangsdk.ProviderClient) error }
VirtualResource is the internal representation of a resource
func FindVRByID ¶
func FindVRByID(id string) VirtualResource
FindVRByID returns a VR that contains the id in question . Works also on grouped VRs.