/
table_osquery_acpi_table.go
60 lines (55 loc) · 1.5 KB
/
table_osquery_acpi_table.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
package osquery
import (
"context"
"github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto"
"github.com/turbot/steampipe-plugin-sdk/v5/plugin"
"github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform"
)
//// TABLE DEFINITION
func tableOSQueryAcpiTable(_ context.Context) *plugin.Table {
return &plugin.Table{
Name: "osquery_acpi_table",
Description: "List of machine ACPI tables.",
Columns: []*plugin.Column{
{
Name: "hostname",
Type: proto.ColumnType_STRING,
Description: "The name of the host whose ACPI table are being accessed.",
Transform: transform.FromField("Hostname"),
},
{
Name: "name",
Type: proto.ColumnType_STRING,
Description: "The ACPI table name.",
Transform: transform.FromField("Name"),
},
{
Name: "size",
Type: proto.ColumnType_INT,
Description: "The ACPI table size.",
Transform: transform.FromField("size").Transform(SafeInt(-1)),
},
{
Name: "md5",
Type: proto.ColumnType_STRING,
Description: "The ACPI table's MD5 sum.",
Transform: transform.FromField("md5"),
},
},
List: &plugin.ListConfig{
Hydrate: makeListOSQuery[*osQueryAcpiTable]("select * from acpi_tables;"),
KeyColumns: plugin.KeyColumnSlice{
&plugin.KeyColumn{
Name: "hostname",
Require: plugin.Required,
},
},
},
}
}
type osQueryAcpiTable struct {
Result
Name string `json:"name"`
Size string `json:"size"`
Md5 string `json:"md5"`
}