-
Notifications
You must be signed in to change notification settings - Fork 31
/
log_monitoring.go
46 lines (39 loc) · 1.69 KB
/
log_monitoring.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
package quota
import (
"github.com/dynatrace-oss/terraform-provider-dynatrace/terraform/hcl"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
// LogMonitoring represents log monitoring consumption and quota information on environment level. Not set (and not editable) if Log monitoring is not enabled. Not set (and not editable) if Log monitoring is migrated to Davis data on license level. If skipped when editing via PUT method then already set quotas will remain
type LogMonitoring struct {
MonthlyLimit *int64 `json:"monthlyLimit,omitempty"` // Monthly environment quota. Not set if unlimited. When updating via PUT method, skipping this field will set quota unlimited
AnnualLimit *int64 `json:"annualLimit,omitempty"` // Annual environment quota. Not set if unlimited. When updating via PUT method, skipping this field will set quota unlimited
}
func (me *LogMonitoring) IsEmpty() bool {
return me == nil || (me.MonthlyLimit == nil && me.AnnualLimit == nil)
}
func (me *LogMonitoring) Schema() map[string]*schema.Schema {
return map[string]*schema.Schema{
"monthly": {
Type: schema.TypeInt,
Optional: true,
Description: "Monthly environment quota. Not set if unlimited",
},
"annual": {
Type: schema.TypeInt,
Optional: true,
Description: "Annual environment quota. Not set if unlimited",
},
}
}
func (me *LogMonitoring) MarshalHCL(properties hcl.Properties) error {
return properties.EncodeAll(map[string]any{
"monthly": me.MonthlyLimit,
"annual": me.AnnualLimit,
})
}
func (me *LogMonitoring) UnmarshalHCL(decoder hcl.Decoder) error {
return decoder.DecodeAll(map[string]any{
"monthly": &me.MonthlyLimit,
"annual": &me.AnnualLimit,
})
}