-
Notifications
You must be signed in to change notification settings - Fork 523
/
cloudformation_stack_set.go
53 lines (45 loc) 路 1.49 KB
/
cloudformation_stack_set.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
package aws
import (
"github.com/infracost/infracost/internal/resources"
"github.com/infracost/infracost/internal/schema"
)
type CloudFormationStackSet struct {
Address string
Region string
TemplateBody string
MonthlyHandlerOperations *int64 `infracost_usage:"monthly_handler_operations"`
MonthlyDurationSecs *int64 `infracost_usage:"monthly_duration_secs"`
}
func (r *CloudFormationStackSet) CoreType() string {
return "CloudFormationStackSet"
}
func (r *CloudFormationStackSet) UsageSchema() []*schema.UsageItem {
return []*schema.UsageItem{
{Key: "monthly_handler_operations", ValueType: schema.Int64, DefaultValue: 0},
{Key: "monthly_duration_secs", ValueType: schema.Int64, DefaultValue: 0},
}
}
func (r *CloudFormationStackSet) PopulateUsage(u *schema.UsageData) {
resources.PopulateArgsWithUsage(r, u)
}
func (r *CloudFormationStackSet) BuildResource() *schema.Resource {
stack := &CloudFormationStack{
Region: r.Region,
TemplateBody: r.TemplateBody,
MonthlyHandlerOperations: r.MonthlyHandlerOperations,
MonthlyDurationSecs: r.MonthlyDurationSecs,
}
if stack.checkAWS() || stack.checkAlexa() || stack.checkCustom() {
return &schema.Resource{
Name: r.Address,
NoPrice: true,
IsSkipped: true,
UsageSchema: r.UsageSchema(),
}
}
return &schema.Resource{
Name: r.Address,
CostComponents: stack.costComponents(),
UsageSchema: r.UsageSchema(),
}
}