MCPcopy
hub / github.com/ory/keto / ListNamespaces

Method ListNamespaces

internal/namespace/namespacehandler/handler.go:47–63  ·  view source on GitHub ↗
(ctx context.Context, _ *rts.ListNamespacesRequest)

Source from the content-addressed store, hash-verified

45}
46
47func (h *Handler) ListNamespaces(ctx context.Context, _ *rts.ListNamespacesRequest) (*rts.ListNamespacesResponse, error) {
48 m, err := h.Config(ctx).NamespaceManager()
49 if err != nil {
50 h.Logger().WithError(err).Errorf("could not get namespace manager")
51 return nil, herodot.ErrInternalServerError
52 }
53 namespaces, err := m.Namespaces(ctx)
54 if err != nil {
55 h.Logger().WithError(err).Errorf("could not get namespaces")
56 return nil, herodot.ErrInternalServerError
57 }
58 apiNamespaces := make([]*rts.Namespace, len(namespaces))
59 for i, n := range namespaces {
60 apiNamespaces[i] = &rts.Namespace{Name: n.Name}
61 }
62 return &rts.ListNamespacesResponse{Namespaces: apiNamespaces}, nil
63}
64
65// swagger:route GET /namespaces relationship listRelationshipNamespaces
66//

Callers 1

getNamespacesMethod · 0.95

Calls 6

WithErrorMethod · 0.80
NamespaceManagerMethod · 0.65
ConfigMethod · 0.65
LoggerMethod · 0.65
NamespacesMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected