| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- package cloudcost
- import (
- "time"
- "github.com/opencost/opencost/pkg/kubecost"
- )
- func DefaultMockCloudCostSet(start, end time.Time, provider, integration string) *kubecost.CloudCostSet {
- ccs := kubecost.NewCloudCostSet(start, end)
- ccs.Integration = integration
- ccs.Insert(&kubecost.CloudCost{
- Window: ccs.Window,
- Properties: &kubecost.CloudCostProperties{
- Provider: provider,
- AccountID: "account1",
- InvoiceEntityID: "invoiceEntity1",
- Service: provider + "-storage",
- Category: kubecost.StorageCategory,
- Labels: kubecost.CloudCostLabels{
- "label1": "value1",
- "label2": "value2",
- "label3": "value3",
- },
- ProviderID: "id1",
- },
- ListCost: kubecost.CostMetric{
- Cost: 100,
- KubernetesPercent: 0,
- },
- NetCost: kubecost.CostMetric{
- Cost: 100,
- KubernetesPercent: 0,
- },
- })
- ccs.Insert(&kubecost.CloudCost{
- Window: ccs.Window,
- Properties: &kubecost.CloudCostProperties{
- Provider: provider,
- AccountID: "account1",
- InvoiceEntityID: "invoiceEntity1",
- Service: provider + "-compute",
- Category: kubecost.ComputeCategory,
- Labels: kubecost.CloudCostLabels{
- "label1": "value1",
- "label2": "value2",
- "label3": "value3",
- },
- ProviderID: "id2",
- },
- ListCost: kubecost.CostMetric{
- Cost: 2000,
- KubernetesPercent: 1,
- },
- NetCost: kubecost.CostMetric{
- Cost: 1800,
- KubernetesPercent: 1,
- },
- })
- ccs.Insert(&kubecost.CloudCost{
- Window: ccs.Window,
- Properties: &kubecost.CloudCostProperties{
- Provider: provider,
- AccountID: "account2",
- InvoiceEntityID: "invoiceEntity2",
- Service: provider + "-compute",
- Category: kubecost.ComputeCategory,
- Labels: kubecost.CloudCostLabels{
- "label1": "value1",
- "label2": "value2",
- "label3": "value3",
- },
- ProviderID: "id3",
- },
- ListCost: kubecost.CostMetric{
- Cost: 8000,
- KubernetesPercent: 1,
- },
- NetCost: kubecost.CostMetric{
- Cost: 8000,
- KubernetesPercent: 1,
- },
- })
- return ccs
- }
|