diff --git a/api/sessionrecordings/option.gen.go b/api/sessionrecordings/option.gen.go index 3b3c76b2ca..34ea486e98 100644 --- a/api/sessionrecordings/option.gen.go +++ b/api/sessionrecordings/option.gen.go @@ -6,7 +6,6 @@ package sessionrecordings import ( "strconv" - "strings" "github.com/hashicorp/boundary/api" ) @@ -64,15 +63,6 @@ func WithSkipCurlOutput(skip bool) Option { } } -// WithFilter tells the API to filter the items returned using the provided -// filter term. The filter should be in a format supported by -// hashicorp/go-bexpr. -func WithFilter(filter string) Option { - return func(o *options) { - o.withFilter = strings.TrimSpace(filter) - } -} - // WithRecursive tells the API to use recursion for listing operations on this // resource func WithRecursive(recurse bool) Option { diff --git a/internal/api/genapi/input.go b/internal/api/genapi/input.go index 770143e69e..fe51a698ec 100644 --- a/internal/api/genapi/input.go +++ b/internal/api/genapi/input.go @@ -109,6 +109,10 @@ type structInfo struct { // useful to avoid collisions nameOverride string + // skipListFiltering indicates that the collection doesn't support + // filtering when listing + skipListFiltering bool + // recursiveListing indicates that the collection supports recursion when // listing recursiveListing bool @@ -1082,6 +1086,7 @@ var inputStructs = []*structInfo{ pluralResourceName: "session-recordings", createResponseTypes: []string{ReadResponseType, ListResponseType}, recursiveListing: true, + skipListFiltering: true, versionEnabled: false, fieldOverrides: []fieldInfo{ // int64 fields get marshalled by protobuf as strings, so we have diff --git a/internal/api/genapi/templates.go b/internal/api/genapi/templates.go index 3105b807ad..3e7ead32fa 100644 --- a/internal/api/genapi/templates.go +++ b/internal/api/genapi/templates.go @@ -51,6 +51,7 @@ type templateInput struct { ExtraFields []fieldInfo VersionEnabled bool CreateResponseTypes []string + SkipListFiltering bool RecursiveListing bool } @@ -69,6 +70,7 @@ func fillTemplates() { ExtraFields: in.extraFields, VersionEnabled: in.versionEnabled, CreateResponseTypes: in.createResponseTypes, + SkipListFiltering: in.skipListFiltering, RecursiveListing: in.recursiveListing, } if in.packageOverride != "" { @@ -191,10 +193,11 @@ func fillTemplates() { } input := templateInput{ - Package: pkg, - Fields: fields, - RecursiveListing: inputMap[pkg].recursiveListing, - VersionEnabled: inputMap[pkg].versionEnabled, + Package: pkg, + Fields: fields, + SkipListFiltering: inputMap[pkg].skipListFiltering, + RecursiveListing: inputMap[pkg].recursiveListing, + VersionEnabled: inputMap[pkg].versionEnabled, } if err := optionTemplate.Execute(outBuf, input); err != nil { @@ -763,6 +766,7 @@ func WithSkipCurlOutput(skip bool) Option { } } +{{ if not .SkipListFiltering }} // WithFilter tells the API to filter the items returned using the provided // filter term. The filter should be in a format supported by // hashicorp/go-bexpr. @@ -771,6 +775,7 @@ func WithFilter(filter string) Option { o.withFilter = strings.TrimSpace(filter) } } +{{ end }} {{ if .RecursiveListing }} // WithRecursive tells the API to use recursion for listing operations on this // resource diff --git a/internal/cmd/commands/sessionrecordingscmd/sessionrecordings.gen.go b/internal/cmd/commands/sessionrecordingscmd/sessionrecordings.gen.go index 784af59d1e..8e43e0cd35 100644 --- a/internal/cmd/commands/sessionrecordingscmd/sessionrecordings.gen.go +++ b/internal/cmd/commands/sessionrecordingscmd/sessionrecordings.gen.go @@ -91,7 +91,7 @@ var flagsMap = map[string][]string{ "read": {"id"}, - "list": {"scope-id", "filter", "recursive"}, + "list": {"scope-id", "recursive"}, } func (c *Command) Flags() *base.FlagSets { @@ -174,10 +174,6 @@ func (c *Command) Run(args []string) int { opts = append(opts, sessionrecordings.WithRecursive(true)) } - if c.FlagFilter != "" { - opts = append(opts, sessionrecordings.WithFilter(c.FlagFilter)) - } - var version uint32 if ok := extraFlagsHandlingFunc(c, f, &opts); !ok { diff --git a/internal/cmd/gencli/input.go b/internal/cmd/gencli/input.go index 4ed04f5f10..9e9ada40cb 100644 --- a/internal/cmd/gencli/input.go +++ b/internal/cmd/gencli/input.go @@ -86,6 +86,8 @@ type cmdInfo struct { // SkipClientCallActions allows skipping creation of an actual client // call for an action in favor of custom logic in extra actions SkipClientCallActions []string + + SkipFiltering bool } var inputStructs = map[string][]*cmdInfo{ @@ -575,6 +577,7 @@ var inputStructs = map[string][]*cmdInfo{ HasExtraCommandVars: true, HasExtraHelpFunc: true, HasId: true, + SkipFiltering: true, }, }, "storagebuckets": { diff --git a/internal/cmd/gencli/templates.go b/internal/cmd/gencli/templates.go index bf12ce8ac0..7f6518a02a 100644 --- a/internal/cmd/gencli/templates.go +++ b/internal/cmd/gencli/templates.go @@ -195,7 +195,7 @@ var flags{{ camelCase .SubActionPrefix }}Map = map[string][]string{ "delete": {"id"}, {{ end }} {{ if eq $action "list" }} - "list": { "{{ kebabCase $input.Container }}-id", "filter" {{ if (eq $input.Container "Scope") }}, "recursive"{{ end }} }, + "list": { "{{ kebabCase $input.Container }}-id"{{ if not $input.SkipFiltering }}, "filter" {{ end }} {{ if (eq $input.Container "Scope") }}, "recursive"{{ end }} }, {{ end }} {{ end }} {{ end }} @@ -382,9 +382,11 @@ func (c *{{ camelCase .SubActionPrefix }}Command) Run(args []string) int { } {{ end }} + {{ if not .SkipFiltering }} if c.FlagFilter != "" { opts = append(opts, {{ .Pkg }}.WithFilter(c.FlagFilter)) } + {{ end }} {{ if .HasScopeName }} switch c.FlagScopeName {