Add namespace and collection inventories
This commit is contained in:
@@ -97,6 +97,8 @@ type identityInventory interface {
|
||||
ListBackends(context.Context) ([]string, error)
|
||||
ListProfiles(context.Context) ([]string, error)
|
||||
ListPrompts(context.Context) ([]domain.PromptIdentity, error)
|
||||
ListNamespaces(context.Context, []string) ([]string, error)
|
||||
ListCollections(context.Context) ([]configuration.CollectionIdentity, error)
|
||||
}
|
||||
|
||||
// ListingFilterMode selects namespace membership for one identity listing.
|
||||
@@ -277,6 +279,21 @@ func (e *Engine) ListPrompts(ctx context.Context, filters ...ListingFilter) ([]d
|
||||
return filtered, nil
|
||||
}
|
||||
|
||||
func (e *Engine) ListNamespaces(ctx context.Context, kinds []string) ([]string, error) {
|
||||
for _, kind := range kinds {
|
||||
switch kind {
|
||||
case "prompt", "profile", "backend":
|
||||
default:
|
||||
return nil, fmt.Errorf("%w: unknown resource kind %q", usecase.ErrInvalidRequest, kind)
|
||||
}
|
||||
}
|
||||
return e.listing.ListNamespaces(ctx, kinds)
|
||||
}
|
||||
|
||||
func (e *Engine) ListCollections(ctx context.Context) ([]configuration.CollectionIdentity, error) {
|
||||
return e.listing.ListCollections(ctx)
|
||||
}
|
||||
|
||||
func filterIdentityList(
|
||||
ctx context.Context,
|
||||
filters []ListingFilter,
|
||||
|
||||
Reference in New Issue
Block a user