-
Notifications
You must be signed in to change notification settings - Fork 27
/
usage.go
58 lines (53 loc) · 1.76 KB
/
usage.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package usage
const (
// Key is the key used to set the usage
// on the values passed to the resources
Key string = "tc_usage"
)
// Default is the default Usage that will be used if none is configured
var Default = Usage{
ResourceDefaultTypeUsage: map[string]interface{}{
"aws_eks_node_group": map[string]interface{}{
"instances": 15,
"operating_system": "linux",
"reserved_instance_type": "standard",
"reserved_instance_term": "1_year",
"reserved_instance_payment_option": "partial_upfront",
"monthly_cpu_credit_hrs": 350,
"vcpu_count": 2,
},
"aws_efs_file_system": map[string]interface{}{
"storage_gb": 180,
"infrequent_access_storage_gb": 10,
"monthly_infrequent_access_read_gb": 20,
"monthly_infrequent_access_write_gb": 30,
},
"aws_fsx_openzfs_file_system": map[string]interface{}{
"backup_storage_gb": 1024,
},
"aws_fsx_windows_file_system": map[string]interface{}{
"backup_storage_gb": 1024,
},
"aws_fsx_ontap_file_system": map[string]interface{}{
"backup_storage_gb": 1024,
},
"aws_fsx_lustre_file_system": map[string]interface{}{
"backup_storage_gb": 1024,
},
"aws_nat_gateway": map[string]interface{}{
"monthly_data_processed_gb": 10,
},
},
}
// Usage is the struct defining all the configure usages
type Usage struct {
ResourceDefaultTypeUsage map[string]interface{} `json:"resource_default_type_usage",yaml:"resource_default_type_usage"`
}
// GetUsage will return the usage from the resource rt (ex: aws_instance)
func (u Usage) GetUsage(rt string) map[string]interface{} {
us, ok := u.ResourceDefaultTypeUsage[rt]
if ok {
return us.(map[string]interface{})
}
return nil
}