Tie together the database-driven session handling with the worker and add relevant CLI comands (#370)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-09-19 00:18:17 -04:00
1 parent fd8ceb6cc4
commit 07a7e9750a
57 files changed
+2548 -826

No files matched your search

+19
View File
@@ -31,6 +31,7 @@ type fieldInfo struct {
GenerateSdkOption bool
SubtypeName string
Query bool
SkipDefault bool
}
type structInfo struct {
@@ -338,6 +339,14 @@ var inputStructs = []*structInfo{
sliceSubTypes: map[string]string{
"HostSets": "hostSetIds",
},
extraOptions: []fieldInfo{
{
Name: "HostId",
ProtoName: "host_id",
FieldType: "string",
SkipDefault: true,
},
},
versionEnabled: true,
typeOnCreate: true,
createResponseTypes: true,
@@ -347,4 +356,14 @@ var inputStructs = []*structInfo{
outFile: "targets/tcp_target_attributes.gen.go",
subtypeName: "TcpTarget",
},
{
inProto: &targets.SessionAuthorization{},
outFile: "targets/session_authorization.gen.go",
subtypeName: "SessionAuthorization",
},
{
inProto: &targets.WorkerInfo{},
outFile: "targets/worker_info.gen.go",
subtypeName: "WorkerInfo",
},
}
+2
View File
@@ -62,6 +62,8 @@ func parsePBs() {
name = fmt.Sprintf("%s.%s", pkg, name)
}
fi.FieldType = sliceText + ptr + name
case protoreflect.BytesKind:
fi.FieldType = "[]byte"
default:
fi.FieldType = sliceText + k.String()
}
+2 -1
View File
@@ -728,7 +728,7 @@ func With{{ .SubtypeName }}{{ .Name }}(in{{ .Name }} {{ .FieldType }}) Option {
o.postMap["{{ .ProtoName }}"] = in{{ .Name }}
{{ end }} }
}
{{ if ( not .SkipDefault ) }}
func Default{{ .SubtypeName }}{{ .Name }}() Option {
return func(o *options) { {{ if ( not ( eq .SubtypeName "" ) ) }}
raw, ok := o.postMap["attributes"]
@@ -743,6 +743,7 @@ func Default{{ .SubtypeName }}{{ .Name }}() Option {
{{ end }} }
}
{{ end }}
{{ end }}
`))
func makeSlice(strs ...string) []string {