Documentation
¶
Index ¶
- Variables
- func CheckAuthorization(ctx context.Context, logger *slog.Logger, pdp authzcore.PDP, action Action, ...) error
- func FormatDualScopedResourceName(namespace, name string, isClusterScoped bool) string
- type Action
- type Client
- func (c *Client) BatchEvaluate(ctx context.Context, request *authzcore.BatchEvaluateRequest) (*authzcore.BatchEvaluateResponse, error)
- func (c *Client) Evaluate(ctx context.Context, request *authzcore.EvaluateRequest) (*authzcore.Decision, error)
- func (c *Client) GetSubjectProfile(ctx context.Context, request *authzcore.ProfileRequest) (*authzcore.UserCapabilitiesResponse, error)
- type ResourceType
- func ComponentScopeAuthz(namespace, project, component string) (ResourceType, string, authzcore.ResourceHierarchy)
- func EventsScopeAuthz(req *types.EventsQueryRequest) (ResourceType, string, authzcore.ResourceHierarchy, error)
- func LogsScopeAuthz(req *types.LogsQueryRequest) (ResourceType, string, authzcore.ResourceHierarchy, error)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CheckAuthorization ¶
func CheckAuthorization( ctx context.Context, logger *slog.Logger, pdp authzcore.PDP, action Action, resourceType ResourceType, resourceID string, hierarchy authzcore.ResourceHierarchy, authzCtx authzcore.Context, ) error
CheckAuthorization performs a complete authorization check for observer operations.
func FormatDualScopedResourceName ¶ added in v1.1.0
FormatDualScopedResourceName returns the authz-engine identifier for a dual-scoped resource. Namespace-scoped resources use "{namespace}/{name}"; cluster-scoped resources use plain "{name}". An empty name returns "" so callers can omit the attribute when the scope is not provided.
Types ¶
type Action ¶
type Action string
const ( ActionViewLogs Action = "logs:view" ActionViewEvents Action = "events:view" ActionViewTraces Action = "traces:view" ActionViewMetrics Action = "metrics:view" ActionViewAlerts Action = "alerts:view" ActionViewIncidents Action = "incidents:view" ActionUpdateIncidents Action = "incidents:update" )
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) BatchEvaluate ¶
func (c *Client) BatchEvaluate(ctx context.Context, request *authzcore.BatchEvaluateRequest) (*authzcore.BatchEvaluateResponse, error)
BatchEvaluate evaluates multiple authorization requests via the unified evaluates endpoint.
func (*Client) Evaluate ¶
func (c *Client) Evaluate(ctx context.Context, request *authzcore.EvaluateRequest) (*authzcore.Decision, error)
Evaluate evaluates a single authorization request via the unified evaluates endpoint.
func (*Client) GetSubjectProfile ¶
func (c *Client) GetSubjectProfile(ctx context.Context, request *authzcore.ProfileRequest) (*authzcore.UserCapabilitiesResponse, error)
GetSubjectProfile is not implemented for observer API
type ResourceType ¶
type ResourceType string
const ( ResourceTypeUnknown ResourceType = "unknown" ResourceTypeComponent ResourceType = "component" ResourceTypeProject ResourceType = "project" ResourceTypeNamespace ResourceType = "namespace" ResourceTypeWorkflowRun ResourceType = "workflowRun" )
func ComponentScopeAuthz ¶ added in v0.17.0
func ComponentScopeAuthz(namespace, project, component string) (ResourceType, string, authzcore.ResourceHierarchy)
ComponentScopeAuthz determines the authorization resource type, name, and hierarchy from a component search scope (namespace/project/component). The most specific non-empty field determines the resource type.
func EventsScopeAuthz ¶ added in v1.2.0
func EventsScopeAuthz(req *types.EventsQueryRequest) (ResourceType, string, authzcore.ResourceHierarchy, error)
EventsScopeAuthz determines the authorization resource type, name, and hierarchy from an events query request's search scope.
func LogsScopeAuthz ¶ added in v0.17.0
func LogsScopeAuthz(req *types.LogsQueryRequest) (ResourceType, string, authzcore.ResourceHierarchy, error)
LogsScopeAuthz determines the authorization resource type, name, and hierarchy from a logs query request's search scope.