-
Notifications
You must be signed in to change notification settings - Fork 255
/
dashboard_with.go
81 lines (66 loc) · 1.84 KB
/
dashboard_with.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package modconfig
import (
"fmt"
"github.com/hashicorp/hcl/v2"
"github.com/turbot/pipe-fittings/hclhelpers"
"github.com/zclconf/go-cty/cty"
)
// DashboardWith is a struct representing a leaf dashboard node
type DashboardWith struct {
ResourceWithMetadataImpl
QueryProviderImpl
// required to allow partial decoding
Remain hcl.Body `hcl:",remain" json:"-"`
}
func NewDashboardWith(block *hcl.Block, mod *Mod, shortName string) HclResource {
// with blocks cannot be anonymous
c := &DashboardWith{
QueryProviderImpl: QueryProviderImpl{
RuntimeDependencyProviderImpl: RuntimeDependencyProviderImpl{
ModTreeItemImpl: ModTreeItemImpl{
HclResourceImpl: HclResourceImpl{
ShortName: shortName,
FullName: fmt.Sprintf("%s.%s.%s", mod.ShortName, block.Type, shortName),
UnqualifiedName: fmt.Sprintf("%s.%s", block.Type, shortName),
DeclRange: hclhelpers.BlockRange(block),
blockType: block.Type,
},
Mod: mod,
},
},
},
}
return c
}
func (w *DashboardWith) Equals(other *DashboardWith) bool {
diff := w.Diff(other)
return !diff.HasChanges()
}
// OnDecoded implements HclResource
func (w *DashboardWith) OnDecoded(_ *hcl.Block, _ ResourceMapsProvider) hcl.Diagnostics {
return nil
}
func (w *DashboardWith) Diff(other *DashboardWith) *DashboardTreeItemDiffs {
res := &DashboardTreeItemDiffs{
Item: w,
Name: w.Name(),
}
res.queryProviderDiff(w, other)
return res
}
// GetWidth implements DashboardLeafNode
func (*DashboardWith) GetWidth() int {
return 0
}
// GetDisplay implements DashboardLeafNode
func (*DashboardWith) GetDisplay() string {
return ""
}
// GetType implements DashboardLeafNode
func (*DashboardWith) GetType() string {
return ""
}
// CtyValue implements CtyValueProvider
func (w *DashboardWith) CtyValue() (cty.Value, error) {
return GetCtyValue(w)
}