handlers

package
v0.36.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2026 License: BSD-3-Clause-Clear Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AttributeRuleAllOf     = "ALL_OF"
	AttributeRuleAnyOf     = "ANY_OF"
	AttributeRuleHierarchy = "HIERARCHY"
)
View Source
const (
	SubjectMappingOperatorIn          = "IN"
	SubjectMappingOperatorNotIn       = "NOT_IN"
	SubjectMappingOperatorInContains  = "IN_CONTAINS"
	SubjectMappingOperatorUnspecified = "UNSPECIFIED"
)
View Source
const (
	MaxAssertionsFileSize = int64(5 * 1024 * 1024) // 5MB
)

Variables

View Source
var (
	SDK *sdk.SDK

	ErrUnauthenticated = errors.New("unauthenticated")
)
View Source
var (
	ErrInvalidSortDirection = errors.New("invalid sort direction")
	ErrInvalidSortField     = errors.New("invalid sort field")
)
View Source
var (
	ErrTDFInspectFailNotValidTDF                = errors.New("file or input is not a valid TDF")
	ErrTDFInspectFailNotInspectable             = errors.New("file or input is not inspectable")
	ErrTDFUnableToReadAttributes                = errors.New("unable to read attributes from TDF")
	ErrTDFUnableToReadUnencryptedMetadata       = errors.New("unable to read unencrypted metadata from TDF")
	ErrTDFUnableToReadAssertions                = errors.New("unable to read assertions")
	ErrTDFUnableToReadAssertionVerificationKeys = errors.New("unable to read assertion verification keys")
)
View Source
var DynamicValueMappingOperatorEnumChoices = []string{SubjectMappingOperatorIn, SubjectMappingOperatorInContains}

DynamicValueMappingOperatorEnumChoices are the operators supported by a dynamic value resolver. NOT_IN and UNSPECIFIED are excluded: dynamic resolution is existential over the resolved entity values, so a negative operator is not supported.

Functions

func FlattenSubjectContext

func FlattenSubjectContext(subject string) ([]flat.Item, error)

func GetAttributeFqn

func GetAttributeFqn(namespace string, name string) string

func GetAttributeRuleFromAttributeType

func GetAttributeRuleFromAttributeType(rule policy.AttributeRuleTypeEnum) string

Provides the un-prefixed human-readable attribute rule

func GetAttributeRuleFromReadableString

func GetAttributeRuleFromReadableString(rule string) (policy.AttributeRuleTypeEnum, error)

func GetAttributeRuleOptions

func GetAttributeRuleOptions() []string

func GetSubjectMappingOperatorChoiceFromEnum

func GetSubjectMappingOperatorChoiceFromEnum(enum policy.SubjectMappingOperatorEnum) string

func GetSubjectMappingOperatorFromChoice

func GetSubjectMappingOperatorFromChoice(readable string) policy.SubjectMappingOperatorEnum

func ParseSortOrder added in v0.32.0

func ParseSortOrder(value string) (policy.SortDirection, error)

func ParseSubjectString

func ParseSubjectString(subject string) (map[string]interface{}, error)

func ParseToIDFqnIdentifier

func ParseToIDFqnIdentifier(value string) *common.IdFqnIdentifier

ParseToIDFqnIdentifier creates an IdFqnIdentifier based on whether the input is a UUID or FQN

func ParseToIDNameIdentifier

func ParseToIDNameIdentifier(value string) *common.IdNameIdentifier

ParseToIDNameIdentifier creates an IdNameIdentifier based on whether the input is a UUID or name

func SetDefaultSDKFactory added in v0.36.0

func SetDefaultSDKFactory(f SDKFactory)

SetDefaultSDKFactory overrides the factory for all handlers that don't set one. Call once at startup; nil resets to sdk.New.

Types

type CreateAttributeError

type CreateAttributeError struct {
	ValueErrors map[string]error

	Err error
}

func (*CreateAttributeError) Error

func (e *CreateAttributeError) Error() string

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...HandlerOption) (Handler, error)

Creates a new handler wrapping the SDK, which is authenticated through the cached client-credentials flow tokens

func (Handler) AssignKeyToAttribute

func (h Handler) AssignKeyToAttribute(ctx context.Context, attr, keyID string) (*attributes.AttributeKey, error)

func (*Handler) AssignKeyToAttributeNamespace

func (h *Handler) AssignKeyToAttributeNamespace(ctx context.Context, namespace, keyID string) (*namespaces.NamespaceKey, error)

AssignKeyToAttributeNamespace assigns a KAS key to an attribute namespace

func (*Handler) AssignKeyToAttributeValue

func (h *Handler) AssignKeyToAttributeValue(ctx context.Context, value, keyID string) (*attributes.ValueKey, error)

AssignKeyToAttributeValue assigns a KAS key to an attribute value

func (Handler) Close

func (h Handler) Close() error

func (Handler) CreateAction

func (h Handler) CreateAction(ctx context.Context, name string, namespace string, metadata *common.MetadataMutable) (*policy.Action, error)

func (Handler) CreateAttribute

func (h Handler) CreateAttribute(ctx context.Context, name string, rule string, namespace string, values []string, metadata *common.MetadataMutable, allowTraversal *wrapperspb.BoolValue) (*policy.Attribute, error)

Creates and returns the created attribute

func (*Handler) CreateAttributeValue

func (h *Handler) CreateAttributeValue(ctx context.Context, attributeID string, value string, metadata *common.MetadataMutable) (*policy.Value, error)

Creates and returns the created value

func (Handler) CreateDynamicValueMapping added in v0.36.0

func (h Handler) CreateDynamicValueMapping(ctx context.Context, attribute string, resolver *policy.DynamicValueResolver, actions []*policy.Action, existingSCSID string, newSCS *subjectmapping.SubjectConditionSetCreate, namespace string, m *common.MetadataMutable) (*policy.DynamicValueMapping, error)

Creates and returns the created dynamic value mapping

func (Handler) CreateKasKey

func (h Handler) CreateKasKey(
	ctx context.Context,
	kasID string,
	keyID string,
	alg policy.Algorithm,
	mode policy.KeyMode,
	pubKeyCtx *policy.PublicKeyCtx,
	privKeyCtx *policy.PrivateKeyCtx,
	providerConfigID string,
	metadata *common.MetadataMutable,
	legacy bool,
) (*policy.KasKey, error)

func (Handler) CreateKasRegistryEntry

func (h Handler) CreateKasRegistryEntry(ctx context.Context, uri string, name string, metadata *common.MetadataMutable) (*policy.KeyAccessServer, error)

Creates the KAS registry and then returns the KAS

func (Handler) CreateNamespace

func (h Handler) CreateNamespace(ctx context.Context, name string, metadata *common.MetadataMutable) (*policy.Namespace, error)

Creates and returns the created n

func (Handler) CreateNewSubjectMapping

func (h Handler) CreateNewSubjectMapping(ctx context.Context, attrValID string, actions []*policy.Action, existingSCSId string, newScs *subjectmapping.SubjectConditionSetCreate, m *common.MetadataMutable, namespace string) (*policy.SubjectMapping, error)

Creates and returns the created subject mapping

func (Handler) CreateObligation

func (h Handler) CreateObligation(ctx context.Context, namespace, name string, values []string, metadata *common.MetadataMutable) (*policy.Obligation, error)

func (Handler) CreateObligationTrigger

func (h Handler) CreateObligationTrigger(ctx context.Context, attributeValue, action, obligationValue, clientID string, metadata *common.MetadataMutable) (*policy.ObligationTrigger, error)

****** Obligation Triggers ******

func (Handler) CreateObligationValue

func (h Handler) CreateObligationValue(ctx context.Context, obligation, value string, triggers []*obligations.ValueTriggerRequest, metadata *common.MetadataMutable) (*policy.ObligationValue, error)

func (Handler) CreateProviderConfig

func (h Handler) CreateProviderConfig(
	ctx context.Context,
	name, manager string,
	config []byte,
	metadata *common.MetadataMutable,
) (*policy.KeyProviderConfig, error)

func (Handler) CreateRegisteredResource

func (h Handler) CreateRegisteredResource(ctx context.Context, namespace, name string, values []string, metadata *common.MetadataMutable) (*policy.RegisteredResource, error)

func (Handler) CreateRegisteredResourceValue

func (h Handler) CreateRegisteredResourceValue(ctx context.Context, resourceID string, value string, actionAttributeValues []*registeredresources.ActionAttributeValue, metadata *common.MetadataMutable) (*policy.RegisteredResourceValue, error)

func (*Handler) CreateResourceMapping

func (h *Handler) CreateResourceMapping(ctx context.Context, attributeID string, terms []string, grpID, namespace string, metadata *common.MetadataMutable) (*policy.ResourceMapping, error)

Creates and returns the created resource mapping

func (*Handler) CreateResourceMappingGroup

func (h *Handler) CreateResourceMappingGroup(ctx context.Context, namespaceID string, name string, metadata *common.MetadataMutable) (*policy.ResourceMappingGroup, error)

Creates and returns the created resource mapping

func (Handler) CreateSubjectConditionSet

func (h Handler) CreateSubjectConditionSet(ctx context.Context, ss []*policy.SubjectSet, metadata *common.MetadataMutable, namespace string) (*policy.SubjectConditionSet, error)

Creates and returns the created subject condition set

func (Handler) DeactivateAttribute

func (h Handler) DeactivateAttribute(ctx context.Context, id string) (*policy.Attribute, error)

Deactivates and returns deactivated attribute

func (*Handler) DeactivateAttributeValue

func (h *Handler) DeactivateAttributeValue(ctx context.Context, id string) (*policy.Value, error)

Deactivates and returns deactivated value

func (Handler) DeactivateNamespace

func (h Handler) DeactivateNamespace(ctx context.Context, id string) (*policy.Namespace, error)

Deactivates and returns the deactivated namespace

func (Handler) DecryptBytes

func (h Handler) DecryptBytes(
	ctx context.Context,
	toDecrypt []byte,
	assertionVerificationKeysFile string,
	disableAssertionCheck bool,
	sessionKeyAlgorithm ocrypto.KeyType,
	kasAllowList []string,
	ignoreAllowlist bool,
	fulfillableObligations []string,
) (*bytes.Buffer, error)

func (Handler) DeleteAction

func (h Handler) DeleteAction(ctx context.Context, id string) error

func (Handler) DeleteDynamicValueMapping added in v0.36.0

func (h Handler) DeleteDynamicValueMapping(ctx context.Context, id string) (*policy.DynamicValueMapping, error)

func (Handler) DeleteKasGrantFromAttribute

func (h Handler) DeleteKasGrantFromAttribute(ctx context.Context, attrID string, kasID string) (*attributes.AttributeKeyAccessServer, error)

func (Handler) DeleteKasGrantFromNamespace

func (h Handler) DeleteKasGrantFromNamespace(ctx context.Context, nsID string, kasID string) (*namespaces.NamespaceKeyAccessServer, error)

func (Handler) DeleteKasGrantFromValue

func (h Handler) DeleteKasGrantFromValue(ctx context.Context, valID string, kasID string) (*attributes.ValueKeyAccessServer, error)

func (Handler) DeleteKasRegistryEntry

func (h Handler) DeleteKasRegistryEntry(ctx context.Context, id string) (*policy.KeyAccessServer, error)

Deletes the KAS registry and returns the deleted KAS

func (Handler) DeleteObligation

func (h Handler) DeleteObligation(ctx context.Context, id, fqn string) error

func (Handler) DeleteObligationTrigger

func (h Handler) DeleteObligationTrigger(ctx context.Context, id string) (*policy.ObligationTrigger, error)

func (Handler) DeleteObligationValue

func (h Handler) DeleteObligationValue(ctx context.Context, id, fqn string) error

func (*Handler) DeleteProviderConfig

func (h *Handler) DeleteProviderConfig(ctx context.Context, id string) error

func (Handler) DeleteRegisteredResource

func (h Handler) DeleteRegisteredResource(ctx context.Context, id string) error

func (Handler) DeleteRegisteredResourceValue

func (h Handler) DeleteRegisteredResourceValue(ctx context.Context, id string) error

func (*Handler) DeleteResourceMapping

func (h *Handler) DeleteResourceMapping(ctx context.Context, id string) (*policy.ResourceMapping, error)

func (*Handler) DeleteResourceMappingGroup

func (h *Handler) DeleteResourceMappingGroup(ctx context.Context, id string) (*policy.ResourceMappingGroup, error)

func (Handler) DeleteSubjectConditionSet

func (h Handler) DeleteSubjectConditionSet(ctx context.Context, id string) error

func (Handler) DeleteSubjectMapping

func (h Handler) DeleteSubjectMapping(ctx context.Context, id string) (*policy.SubjectMapping, error)

func (Handler) Direct

func (h Handler) Direct() *sdk.SDK

func (Handler) EncryptBytes

func (h Handler) EncryptBytes(
	tdfType string,
	unencrypted []byte,
	attrValues []string,
	mimeType string,
	kasURLPath string,
	assertions string,
	wrappingKeyAlgorithm ocrypto.KeyType,
	targetMode string,
) (*bytes.Buffer, error)

func (Handler) GetAction

func (h Handler) GetAction(ctx context.Context, id string, name string, namespace string) (*policy.Action, error)

func (Handler) GetAttribute

func (h Handler) GetAttribute(ctx context.Context, identifier string) (*policy.Attribute, error)

func (*Handler) GetAttributeValue

func (h *Handler) GetAttributeValue(ctx context.Context, identifier string) (*policy.Value, error)

func (Handler) GetBaseKey

func (h Handler) GetBaseKey(ctx context.Context) (*policy.SimpleKasKey, error)

GetBaseKey retrieves a base key from the KAS registry. This is a stub function and needs to be implemented.

func (Handler) GetDynamicValueMapping added in v0.36.0

func (h Handler) GetDynamicValueMapping(ctx context.Context, id string) (*policy.DynamicValueMapping, error)

func (Handler) GetKasKey

func (h Handler) GetKasKey(ctx context.Context, id string, key *kasregistry.KasKeyIdentifier) (*policy.KasKey, error)

func (Handler) GetKasRegistryEntry

func (h Handler) GetKasRegistryEntry(ctx context.Context, identifer KasIdentifier) (*policy.KeyAccessServer, error)

func (Handler) GetNamespace

func (h Handler) GetNamespace(ctx context.Context, identifier string) (*policy.Namespace, error)

func (Handler) GetObligation

func (h Handler) GetObligation(ctx context.Context, id, fqn string) (*policy.Obligation, error)

func (Handler) GetObligationValue

func (h Handler) GetObligationValue(ctx context.Context, id, fqn string) (*policy.ObligationValue, error)

func (Handler) GetProviderConfig

func (h Handler) GetProviderConfig(ctx context.Context, id, name, manager string) (*policy.KeyProviderConfig, error)

func (Handler) GetRegisteredResource

func (h Handler) GetRegisteredResource(ctx context.Context, id, name, namespace string) (*policy.RegisteredResource, error)

func (Handler) GetRegisteredResourceValue

func (h Handler) GetRegisteredResourceValue(ctx context.Context, id, fqn string) (*policy.RegisteredResourceValue, error)

func (*Handler) GetResourceMapping

func (h *Handler) GetResourceMapping(ctx context.Context, id string) (*policy.ResourceMapping, error)

func (*Handler) GetResourceMappingGroup

func (h *Handler) GetResourceMappingGroup(ctx context.Context, id string) (*policy.ResourceMappingGroup, error)

func (Handler) GetSubjectConditionSet

func (h Handler) GetSubjectConditionSet(ctx context.Context, id string) (*policy.SubjectConditionSet, error)

func (Handler) GetSubjectMapping

func (h Handler) GetSubjectMapping(ctx context.Context, id string) (*policy.SubjectMapping, error)

func (Handler) InspectTDF

func (h Handler) InspectTDF(toInspect []byte) (TDFInspect, []error)

func (Handler) ListActions

func (h Handler) ListActions(ctx context.Context, limit, offset int32, namespace string) (*actions.ListActionsResponse, error)

func (*Handler) ListAttributeValues

func (h *Handler) ListAttributeValues(ctx context.Context, attributeID string) ([]*policy.Value, error)

ListAttributeValues fetches all values via GetAttribute; client-side filtering replaces the deprecated ListAttributeValues RPC.

func (Handler) ListAttributes

func (h Handler) ListAttributes(ctx context.Context, state common.ActiveStateEnum, limit, offset int32, search string, sort SortOption) (*attributes.ListAttributesResponse, error)

func (Handler) ListDynamicValueMappings added in v0.36.0

func (h Handler) ListDynamicValueMappings(ctx context.Context, limit, offset int32, namespace, attribute string, sort SortOption) (*dynamicvaluemapping.ListDynamicValueMappingsResponse, error)

func (Handler) ListKasGrants

func (h Handler) ListKasGrants(ctx context.Context, kasID, kasURI string, limit, offset int32) ([]*kasregistry.KeyAccessServerGrants, *policy.PageResponse, error)

func (Handler) ListKasKeys

func (h Handler) ListKasKeys(
	ctx context.Context,
	limit, offset int32,
	algorithm policy.Algorithm,
	identifier KasIdentifier,
	legacy *bool,
	search string,
	sort SortOption,
) (*kasregistry.ListKeysResponse, error)

func (Handler) ListKasRegistryEntries

func (h Handler) ListKasRegistryEntries(ctx context.Context, limit, offset int32, search string, sort SortOption) (*kasregistry.ListKeyAccessServersResponse, error)

func (Handler) ListKeyMappings

func (h Handler) ListKeyMappings(
	ctx context.Context,
	limit, offset int32,
	keySystemID string,
	keyUserIdentifier *kasregistry.KasKeyIdentifier,
) (*kasregistry.ListKeyMappingsResponse, error)

func (Handler) ListNamespaces

func (h Handler) ListNamespaces(ctx context.Context, state common.ActiveStateEnum, limit, offset int32, search string, sort SortOption) (*namespaces.ListNamespacesResponse, error)

func (Handler) ListObligationTriggers

func (h Handler) ListObligationTriggers(ctx context.Context, namespace string, limit, offset int32) (*obligations.ListObligationTriggersResponse, error)

func (Handler) ListObligations

func (h Handler) ListObligations(ctx context.Context, limit, offset int32, namespace string, search string, sort SortOption) (*obligations.ListObligationsResponse, error)

func (Handler) ListProviderConfigs

func (h Handler) ListProviderConfigs(ctx context.Context, limit, offset int32) (*keymanagement.ListProviderConfigsResponse, error)

func (Handler) ListRegisteredResourceValues

func (h Handler) ListRegisteredResourceValues(ctx context.Context, resourceID string, limit, offset int32) (*registeredresources.ListRegisteredResourceValuesResponse, error)

func (Handler) ListRegisteredResources

func (h Handler) ListRegisteredResources(ctx context.Context, limit, offset int32, namespace string, search string, sort SortOption) (*registeredresources.ListRegisteredResourcesResponse, error)

func (*Handler) ListResourceMappingGroups

func (h *Handler) ListResourceMappingGroups(ctx context.Context, namespace string, limit, offset int32) (*resourcemapping.ListResourceMappingGroupsResponse, error)

func (*Handler) ListResourceMappings

func (h *Handler) ListResourceMappings(ctx context.Context, namespace string, limit, offset int32) (*resourcemapping.ListResourceMappingsResponse, error)

func (Handler) ListSubjectConditionSets

func (h Handler) ListSubjectConditionSets(ctx context.Context, limit, offset int32, namespace string, search string, sort SortOption) (*subjectmapping.ListSubjectConditionSetsResponse, error)

func (Handler) ListSubjectMappings

func (h Handler) ListSubjectMappings(ctx context.Context, limit, offset int32, namespace string, search string, sort SortOption) (*subjectmapping.ListSubjectMappingsResponse, error)

func (Handler) MatchSubjectMappings

func (h Handler) MatchSubjectMappings(ctx context.Context, selectors []string) ([]*policy.SubjectMapping, error)

func (Handler) PruneSubjectConditionSets

func (h Handler) PruneSubjectConditionSets(ctx context.Context) ([]*policy.SubjectConditionSet, error)

func (Handler) RemoveKeyFromAttribute

func (h Handler) RemoveKeyFromAttribute(ctx context.Context, attr, keyID string) error

func (*Handler) RemoveKeyFromAttributeNamespace

func (h *Handler) RemoveKeyFromAttributeNamespace(ctx context.Context, namespace, keyID string) error

RemoveKeyFromAttributeNamespace removes a KAS key from an attribute namespace

func (*Handler) RemoveKeyFromAttributeValue

func (h *Handler) RemoveKeyFromAttributeValue(ctx context.Context, value, keyID string) error

RemoveKeyFromAttributeValue removes a KAS key from an attribute value

func (Handler) RotateKasKey

func (Handler) UnsafeDeleteAttribute

func (h Handler) UnsafeDeleteAttribute(ctx context.Context, id, fqn string) error

Deletes and returns error if deletion failed

func (Handler) UnsafeDeleteAttributeValue

func (h Handler) UnsafeDeleteAttributeValue(ctx context.Context, id, fqn string) error

Deletes and returns error if deletion failed

func (Handler) UnsafeDeleteKasKey

func (h Handler) UnsafeDeleteKasKey(ctx context.Context, id, kid, kasURI string) (*policy.KasKey, error)

func (Handler) UnsafeDeleteNamespace

func (h Handler) UnsafeDeleteNamespace(ctx context.Context, id string, fqn string) error

Deletes and returns the deleted namespace

func (Handler) UnsafeReactivateAttribute

func (h Handler) UnsafeReactivateAttribute(ctx context.Context, id string) (*policy.Attribute, error)

Reactivates and returns reactivated attribute

func (Handler) UnsafeReactivateAttributeValue

func (h Handler) UnsafeReactivateAttributeValue(ctx context.Context, id string) (*policy.Value, error)

Reactivates and returns reactivated attribute

func (Handler) UnsafeReactivateNamespace

func (h Handler) UnsafeReactivateNamespace(ctx context.Context, id string) (*policy.Namespace, error)

Reactivates and returns the reactivated namespace

func (Handler) UnsafeUpdateAttribute

func (h Handler) UnsafeUpdateAttribute(ctx context.Context, id, name, rule string, valuesOrder []string, allowTraversal *wrapperspb.BoolValue) (*policy.Attribute, error)

Deletes and returns error if deletion failed

func (Handler) UnsafeUpdateAttributeValue

func (h Handler) UnsafeUpdateAttributeValue(ctx context.Context, id, value string) error

Deletes and returns error if deletion failed

func (Handler) UnsafeUpdateKasKey added in v0.36.0

func (h Handler) UnsafeUpdateKasKey(ctx context.Context, id string, mode policy.KeyMode, providerConfigID string) (*policy.KasKey, error)

func (Handler) UnsafeUpdateNamespace

func (h Handler) UnsafeUpdateNamespace(ctx context.Context, id, name string) (*policy.Namespace, error)

Unsafely updates the namespace and returns the renamed namespace

func (Handler) UpdateAction

func (h Handler) UpdateAction(ctx context.Context, id, name string, metadata *common.MetadataMutable, behavior common.MetadataUpdateEnum) (*policy.Action, error)

func (*Handler) UpdateAttribute

func (h *Handler) UpdateAttribute(
	ctx context.Context,
	id string,
	metadata *common.MetadataMutable,
	behavior common.MetadataUpdateEnum,
) (*policy.Attribute, error)

Updates and returns updated attribute

func (*Handler) UpdateAttributeValue

func (h *Handler) UpdateAttributeValue(ctx context.Context, id string, metadata *common.MetadataMutable, behavior common.MetadataUpdateEnum) (*policy.Value, error)

Updates and returns updated value

func (Handler) UpdateDynamicValueMapping added in v0.36.0

func (h Handler) UpdateDynamicValueMapping(ctx context.Context, id string, resolver *policy.DynamicValueResolver, scsID string, actions []*policy.Action, m *common.MetadataMutable, behavior common.MetadataUpdateEnum) (*policy.DynamicValueMapping, error)

Updates and returns the updated dynamic value mapping

func (Handler) UpdateKasKey

func (h Handler) UpdateKasKey(ctx context.Context, id string, metadata *common.MetadataMutable, behavior common.MetadataUpdateEnum) (*policy.KasKey, error)

func (Handler) UpdateKasRegistryEntry

func (h Handler) UpdateKasRegistryEntry(ctx context.Context, id, uri, name string, metadata *common.MetadataMutable, behavior common.MetadataUpdateEnum) (*policy.KeyAccessServer, error)

Updates the KAS registry and then returns the KAS

func (Handler) UpdateNamespace

func (h Handler) UpdateNamespace(ctx context.Context, id string, metadata *common.MetadataMutable, behavior common.MetadataUpdateEnum) (*policy.Namespace, error)

Updates and returns the updated namespace

func (Handler) UpdateObligation

func (h Handler) UpdateObligation(ctx context.Context, id, name string, metadata *common.MetadataMutable, behavior common.MetadataUpdateEnum) (*policy.Obligation, error)

func (Handler) UpdateObligationValue

func (h Handler) UpdateObligationValue(ctx context.Context, id, value string, triggers []*obligations.ValueTriggerRequest, metadata *common.MetadataMutable, behavior common.MetadataUpdateEnum) (*policy.ObligationValue, error)

func (Handler) UpdateProviderConfig

func (h Handler) UpdateProviderConfig(
	ctx context.Context,
	id, name, manager string,
	config []byte,
	metadata *common.MetadataMutable,
	behavior common.MetadataUpdateEnum,
) (*policy.KeyProviderConfig, error)

func (Handler) UpdateRegisteredResource

func (h Handler) UpdateRegisteredResource(ctx context.Context, id, name string, metadata *common.MetadataMutable, behavior common.MetadataUpdateEnum) (*policy.RegisteredResource, error)

func (Handler) UpdateRegisteredResourceValue

func (h Handler) UpdateRegisteredResourceValue(ctx context.Context, id, value string, actionAttributeValues []*registeredresources.ActionAttributeValue, metadata *common.MetadataMutable, behavior common.MetadataUpdateEnum) (*policy.RegisteredResourceValue, error)

func (*Handler) UpdateResourceMapping

func (h *Handler) UpdateResourceMapping(ctx context.Context, id, attrValueID, grpID, namespace string, terms []string, metadata *common.MetadataMutable, behavior common.MetadataUpdateEnum) (*policy.ResourceMapping, error)

TODO: verify updation behavior Updates and returns the updated resource mapping

func (*Handler) UpdateResourceMappingGroup

func (h *Handler) UpdateResourceMappingGroup(ctx context.Context, id string, namespaceID string, name string, metadata *common.MetadataMutable, behavior common.MetadataUpdateEnum) (*policy.ResourceMappingGroup, error)

TODO: verify updation behavior Updates and returns the updated resource mapping

func (Handler) UpdateSubjectConditionSet

func (h Handler) UpdateSubjectConditionSet(ctx context.Context, id string, ss []*policy.SubjectSet, metadata *common.MetadataMutable, behavior common.MetadataUpdateEnum) (*policy.SubjectConditionSet, error)

Updates and returns the updated subject condition set

func (Handler) UpdateSubjectMapping

func (h Handler) UpdateSubjectMapping(ctx context.Context, id string, updatedSCSId string, updatedActions []*policy.Action, metadata *common.MetadataMutable, metadataBehavior common.MetadataUpdateEnum) (*policy.SubjectMapping, error)

Updates and returns the updated subject mapping

func (Handler) WithLabelMetadata

func (h Handler) WithLabelMetadata(metadata *common.MetadataMutable, key, value string) func(*common.MetadataMutable) *common.MetadataMutable

Append a label to the metadata

func (Handler) WithReplaceLabelsMetadata

func (h Handler) WithReplaceLabelsMetadata(metadata *common.MetadataMutable, labels map[string]string) func(*common.MetadataMutable) *common.MetadataMutable

Replace all labels in the metadata

type HandlerOption added in v0.36.0

type HandlerOption func(handlerOpts) handlerOpts

HandlerOption configures a Handler during construction. Callers compose options by passing them to New; extension points that want to defer their SDK-option contribution until profile resolution is complete should use WithHook rather than WithSDKOpts.

func WithEndpoint

func WithEndpoint(endpoint string, tlsNoVerify bool) HandlerOption

func WithHook added in v0.36.0

func WithHook(hooks ...Hook) HandlerOption

WithHook registers one or more Hooks that run during handler construction after every HandlerOption has been applied and before the SDK is built. Nil entries are ignored so a caller cannot accidentally register a hook that would panic on execution.

func WithProfile

func WithProfile(profile *profiles.OtdfctlProfileStore) HandlerOption

func WithSDKFactory added in v0.36.0

func WithSDKFactory(f SDKFactory) HandlerOption

WithSDKFactory overrides the factory for this handler only, taking precedence over SetDefaultSDKFactory. Handy for injecting a fake in tests.

func WithSDKOpts

func WithSDKOpts(opts ...sdk.Option) HandlerOption

type Hook added in v0.36.0

type Hook interface {
	// contains filtered or unexported methods
}

Hook is the umbrella type for handler-construction hooks. Concrete hook variants (PreSDKHook, and any future point-specific hooks added later) implement Hook so callers can pass them uniformly through WithHook and common.NewHandler. New hook points are added by declaring a new named callback type, giving it an isHandlerHook receiver, and extending the applyHooks dispatch switch — no new exported registration function is needed.

type KasIdentifier

type KasIdentifier struct {
	ID   string
	Name string
	URI  string
}

type PreSDKHook added in v0.36.0

type PreSDKHook func(PreSDKHookContext) []sdk.Option

PreSDKHook runs after every HandlerOption has been applied and before sdk.New is called. It returns additional SDK options that get appended to the final options list. Multiple PreSDKHooks compose in registration order and each sees the same fully-resolved PreSDKHookContext.

type PreSDKHookContext added in v0.36.0

type PreSDKHookContext struct {
	Endpoint    string
	TLSNoVerify bool
	Profile     *profiles.OtdfctlProfileStore
}

PreSDKHookContext exposes the resolved handler configuration to a PreSDKHook callback so it can decide which SDK options to contribute (for example, an interceptor that only attaches for a specific endpoint or profile).

type RotateKeyResult

type RotateKeyResult struct {
	KasKey           *policy.KasKey                `json:"kas_key"`
	RotatedResources *kasregistry.RotatedResources `json:"rotated_resources"`
}

type SDKFactory added in v0.36.0

type SDKFactory func(endpoint string, opts ...sdk.Option) (*sdk.SDK, error)

SDKFactory constructs the platform SDK. Defaults to sdk.New; a downstream CLI can override it to return a wrapped or custom *sdk.SDK.

type SortOption added in v0.32.0

type SortOption struct {
	Field     string
	Direction policy.SortDirection
}

func NewSortOption added in v0.32.0

func NewSortOption(field, order string) (SortOption, error)

func (SortOption) IsZero added in v0.32.0

func (s SortOption) IsZero() bool

type TDFInspect

type TDFInspect struct {
	ZTDFManifest        *sdk.Manifest
	Attributes          []string
	UnencryptedMetadata []byte
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL