Tie together the database-driven session handling with the worker and add relevant CLI comands (#370)
This commit is contained in:
1 parent
fd8ceb6cc4
commit
07a7e9750a
57 files changed
+2548
-826
No files matched your search
@@ -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",
|
||||
},
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user