Documentation ¶
Index ¶
- Constants
- Variables
- func FlattenSubjectContext(subject string) ([]flat.Item, error)
- func GetAttributeFqn(namespace string, name string) string
- func GetAttributeRuleFromAttributeType(rule policy.AttributeRuleTypeEnum) string
- func GetAttributeRuleFromReadableString(rule string) (policy.AttributeRuleTypeEnum, error)
- func GetAttributeRuleOptions() []string
- func GetSubjectMappingOperatorChoiceFromEnum(enum policy.SubjectMappingOperatorEnum) string
- func GetSubjectMappingOperatorFromChoice(readable string) policy.SubjectMappingOperatorEnum
- func ParseSubjectString(subject string) (map[string]interface{}, error)
- func WithEndpoint(endpoint string, tlsNoVerify bool) handlerOptsFunc
- func WithProfile(profile *profiles.ProfileStore) handlerOptsFunc
- func WithSDKOpts(opts ...sdk.Option) handlerOptsFunc
- type CreateAttributeError
- type Handler
- func (h Handler) AssignKasGrantToAttribute(ctx context.Context, attr_id string, kas_id string) (*attributes.AttributeKeyAccessServer, error)
- func (h Handler) AssignKasGrantToNamespace(ctx context.Context, ns_id string, kas_id string) (*namespaces.NamespaceKeyAccessServer, error)
- func (h Handler) AssignKasGrantToValue(ctx context.Context, val_id string, kas_id string) (*attributes.ValueKeyAccessServer, error)
- func (h Handler) Close() error
- func (h Handler) CreateAttribute(name string, rule string, namespace string, values []string, ...) (*policy.Attribute, error)
- func (h *Handler) CreateAttributeValue(attributeId string, value string, metadata *common.MetadataMutable) (*policy.Value, error)
- func (h Handler) CreateKasRegistryEntry(uri string, publicKey *policy.PublicKey, name string, ...) (*policy.KeyAccessServer, error)
- func (h Handler) CreateNamespace(name string, metadata *common.MetadataMutable) (*policy.Namespace, error)
- func (h Handler) CreateNewSubjectMapping(attrValId string, actions []*policy.Action, existingSCSId string, ...) (*policy.SubjectMapping, error)
- func (h *Handler) CreateResourceMapping(attributeId string, terms []string, metadata *common.MetadataMutable) (*policy.ResourceMapping, error)
- func (h Handler) CreateSubjectConditionSet(ss []*policy.SubjectSet, metadata *common.MetadataMutable) (*policy.SubjectConditionSet, error)
- func (h Handler) DeactivateAttribute(id string) (*policy.Attribute, error)
- func (h *Handler) DeactivateAttributeValue(id string) (*policy.Value, error)
- func (h Handler) DeactivateNamespace(id string) (*policy.Namespace, error)
- func (h Handler) DecryptBytes(toDecrypt []byte, disableAssertionCheck bool) (*bytes.Buffer, error)
- func (h Handler) DeleteKasGrantFromAttribute(ctx context.Context, attr_id string, kas_id string) (*attributes.AttributeKeyAccessServer, error)
- func (h Handler) DeleteKasGrantFromNamespace(ctx context.Context, ns_id string, kas_id string) (*namespaces.NamespaceKeyAccessServer, error)
- func (h Handler) DeleteKasGrantFromValue(ctx context.Context, val_id string, kas_id string) (*attributes.ValueKeyAccessServer, error)
- func (h Handler) DeleteKasRegistryEntry(id string) (*policy.KeyAccessServer, error)
- func (h *Handler) DeleteResourceMapping(id string) (*policy.ResourceMapping, error)
- func (h Handler) DeleteSubjectConditionSet(id string) error
- func (h Handler) DeleteSubjectMapping(id string) (*policy.SubjectMapping, error)
- func (h Handler) Direct() *sdk.SDK
- func (h Handler) EncryptBytes(tdfType string, unencrypted []byte, attrValues []string, mimeType string, ...) (*bytes.Buffer, error)
- func (h Handler) GetAttribute(id string) (*policy.Attribute, error)
- func (h *Handler) GetAttributeValue(id string) (*policy.Value, error)
- func (h Handler) GetKasRegistryEntry(id string) (*policy.KeyAccessServer, error)
- func (h Handler) GetNamespace(id string) (*policy.Namespace, error)
- func (h *Handler) GetResourceMapping(id string) (*policy.ResourceMapping, error)
- func (h Handler) GetSubjectConditionSet(id string) (*policy.SubjectConditionSet, error)
- func (h Handler) GetSubjectMapping(id string) (*policy.SubjectMapping, error)
- func (h Handler) InspectTDF(toInspect []byte) (TDFInspect, []error)
- func (h *Handler) ListAttributeValues(attributeId string, state common.ActiveStateEnum, limit, offset int32) ([]*policy.Value, *policy.PageResponse, error)
- func (h Handler) ListAttributes(state common.ActiveStateEnum, limit, offset int32) ([]*policy.Attribute, *policy.PageResponse, error)
- func (h Handler) ListKasGrants(ctx context.Context, kas_id, kas_uri string, limit, offset int32) ([]*kasregistry.KeyAccessServerGrants, *policy.PageResponse, error)
- func (h Handler) ListKasRegistryEntries(limit, offset int32) ([]*policy.KeyAccessServer, *policy.PageResponse, error)
- func (h Handler) ListNamespaces(state common.ActiveStateEnum, limit, offset int32) ([]*policy.Namespace, *policy.PageResponse, error)
- func (h *Handler) ListResourceMappings(ctx context.Context, limit, offset int32) ([]*policy.ResourceMapping, *policy.PageResponse, error)
- func (h Handler) ListSubjectConditionSets(limit, offset int32) ([]*policy.SubjectConditionSet, *policy.PageResponse, error)
- func (h Handler) ListSubjectMappings(limit, offset int32) ([]*policy.SubjectMapping, *policy.PageResponse, error)
- func (h Handler) MatchSubjectMappings(selectors []string) ([]*policy.SubjectMapping, error)
- func (h Handler) PruneSubjectConditionSets() ([]*policy.SubjectConditionSet, error)
- func (h Handler) UnsafeDeleteAttribute(id, fqn string) error
- func (h Handler) UnsafeDeleteAttributeValue(id, fqn string) error
- func (h Handler) UnsafeDeleteNamespace(id string, fqn string) error
- func (h Handler) UnsafeReactivateAttribute(id string) (*policy.Attribute, error)
- func (h Handler) UnsafeReactivateAttributeValue(id string) (*policy.Value, error)
- func (h Handler) UnsafeReactivateNamespace(id string) (*policy.Namespace, error)
- func (h Handler) UnsafeUpdateAttribute(id, name, rule string, values_order []string) error
- func (h Handler) UnsafeUpdateAttributeValue(id, value string) error
- func (h Handler) UnsafeUpdateNamespace(id, name string) (*policy.Namespace, error)
- func (h *Handler) UpdateAttribute(id string, metadata *common.MetadataMutable, ...) (*policy.Attribute, error)
- func (h *Handler) UpdateAttributeValue(id string, metadata *common.MetadataMutable, ...) (*policy.Value, error)
- func (h Handler) UpdateKasRegistryEntry(id, uri, name string, pubKey *policy.PublicKey, ...) (*policy.KeyAccessServer, error)
- func (h Handler) UpdateNamespace(id string, metadata *common.MetadataMutable, ...) (*policy.Namespace, error)
- func (h *Handler) UpdateResourceMapping(id string, attrValueId string, terms []string, ...) (*policy.ResourceMapping, error)
- func (h Handler) UpdateSubjectConditionSet(id string, ss []*policy.SubjectSet, metadata *common.MetadataMutable, ...) (*policy.SubjectConditionSet, error)
- func (h Handler) UpdateSubjectMapping(id string, updatedSCSId string, updatedActions []*policy.Action, ...) (*policy.SubjectMapping, error)
- func (h Handler) WithLabelMetadata(metadata *common.MetadataMutable, key, value string) func(*common.MetadataMutable) *common.MetadataMutable
- func (h Handler) WithReplaceLabelsMetadata(metadata *common.MetadataMutable, labels map[string]string) func(*common.MetadataMutable) *common.MetadataMutable
- type ResourceMapping
- type TDFInspect
Constants ¶
const ( AttributeRuleAllOf = "ALL_OF" AttributeRuleAnyOf = "ANY_OF" AttributeRuleHierarchy = "HIERARCHY" )
const ( SubjectMappingOperatorIn = "IN" SubjectMappingOperatorNotIn = "NOT_IN" SubjectMappingOperatorInContains = "IN_CONTAINS" SubjectMappingOperatorUnspecified = "UNSPECIFIED" )
const ( TDF_TYPE_ZTDF = "ztdf" TDF_TYPE_TDF3 = "tdf3" // alias for TDF TDF_TYPE_NANO = "nano" )
Variables ¶
var ( SDK *sdk.SDK ErrUnauthenticated = errors.New("unauthenticated") )
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") )
var SubjectMappingOperatorEnumChoices = []string{SubjectMappingOperatorIn, SubjectMappingOperatorNotIn, SubjectMappingOperatorUnspecified}
Functions ¶
func FlattenSubjectContext ¶ added in v0.16.0
func GetAttributeFqn ¶
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 ParseSubjectString ¶ added in v0.16.0
func WithEndpoint ¶ added in v0.10.0
func WithProfile ¶ added in v0.10.0
func WithProfile(profile *profiles.ProfileStore) handlerOptsFunc
func WithSDKOpts ¶ added in v0.10.0
Types ¶
type CreateAttributeError ¶
func (*CreateAttributeError) Error ¶
func (e *CreateAttributeError) Error() string
type Handler ¶
type Handler struct { OIDC_TOKEN string // contains filtered or unexported fields }
func New ¶
Creates a new handler wrapping the SDK, which is authenticated through the cached client-credentials flow tokens
func (Handler) AssignKasGrantToAttribute ¶ added in v0.10.0
func (h Handler) AssignKasGrantToAttribute(ctx context.Context, attr_id string, kas_id string) (*attributes.AttributeKeyAccessServer, error)
func (Handler) AssignKasGrantToNamespace ¶ added in v0.10.0
func (h Handler) AssignKasGrantToNamespace(ctx context.Context, ns_id string, kas_id string) (*namespaces.NamespaceKeyAccessServer, error)
func (Handler) AssignKasGrantToValue ¶ added in v0.10.0
func (h Handler) AssignKasGrantToValue(ctx context.Context, val_id string, kas_id string) (*attributes.ValueKeyAccessServer, error)
func (Handler) CreateAttribute ¶
func (h Handler) CreateAttribute(name string, rule string, namespace string, values []string, metadata *common.MetadataMutable) (*policy.Attribute, error)
Creates and returns the created attribute
func (*Handler) CreateAttributeValue ¶
func (h *Handler) CreateAttributeValue(attributeId string, value string, metadata *common.MetadataMutable) (*policy.Value, error)
Creates and returns the created value
func (Handler) CreateKasRegistryEntry ¶
func (h Handler) CreateKasRegistryEntry(uri string, publicKey *policy.PublicKey, name string, metadata *common.MetadataMutable) (*policy.KeyAccessServer, error)
Creates the KAS registry and then returns the KAS
func (Handler) CreateNamespace ¶
func (h Handler) CreateNamespace(name string, metadata *common.MetadataMutable) (*policy.Namespace, error)
Creates and returns the created n
func (Handler) CreateNewSubjectMapping ¶
func (h Handler) CreateNewSubjectMapping(attrValId string, actions []*policy.Action, existingSCSId string, newScs *subjectmapping.SubjectConditionSetCreate, m *common.MetadataMutable) (*policy.SubjectMapping, error)
Creates and returns the created subject mapping
func (*Handler) CreateResourceMapping ¶
func (h *Handler) CreateResourceMapping(attributeId string, terms []string, metadata *common.MetadataMutable) (*policy.ResourceMapping, error)
Creates and returns the created resource mapping
func (Handler) CreateSubjectConditionSet ¶
func (h Handler) CreateSubjectConditionSet(ss []*policy.SubjectSet, metadata *common.MetadataMutable) (*policy.SubjectConditionSet, error)
Creates and returns the created subject condition set
func (Handler) DeactivateAttribute ¶
Deactivates and returns deactivated attribute
func (*Handler) DeactivateAttributeValue ¶
Deactivates and returns deactivated value
func (Handler) DeactivateNamespace ¶
Deactivates and returns the deactivated namespace
func (Handler) DecryptBytes ¶ added in v0.16.0
func (Handler) DeleteKasGrantFromAttribute ¶
func (h Handler) DeleteKasGrantFromAttribute(ctx context.Context, attr_id string, kas_id string) (*attributes.AttributeKeyAccessServer, error)
func (Handler) DeleteKasGrantFromNamespace ¶ added in v0.10.0
func (h Handler) DeleteKasGrantFromNamespace(ctx context.Context, ns_id string, kas_id string) (*namespaces.NamespaceKeyAccessServer, error)
func (Handler) DeleteKasGrantFromValue ¶
func (h Handler) DeleteKasGrantFromValue(ctx context.Context, val_id string, kas_id string) (*attributes.ValueKeyAccessServer, error)
func (Handler) DeleteKasRegistryEntry ¶
func (h Handler) DeleteKasRegistryEntry(id string) (*policy.KeyAccessServer, error)
Deletes the KAS registry and returns the deleted KAS
func (*Handler) DeleteResourceMapping ¶
func (h *Handler) DeleteResourceMapping(id string) (*policy.ResourceMapping, error)
func (Handler) DeleteSubjectConditionSet ¶
func (Handler) DeleteSubjectMapping ¶
func (h Handler) DeleteSubjectMapping(id string) (*policy.SubjectMapping, error)
func (Handler) EncryptBytes ¶
func (*Handler) GetAttributeValue ¶
func (Handler) GetKasRegistryEntry ¶
func (h Handler) GetKasRegistryEntry(id string) (*policy.KeyAccessServer, error)
func (*Handler) GetResourceMapping ¶
func (h *Handler) GetResourceMapping(id string) (*policy.ResourceMapping, error)
func (Handler) GetSubjectConditionSet ¶
func (h Handler) GetSubjectConditionSet(id string) (*policy.SubjectConditionSet, error)
func (Handler) GetSubjectMapping ¶
func (h Handler) GetSubjectMapping(id string) (*policy.SubjectMapping, error)
func (Handler) InspectTDF ¶
func (h Handler) InspectTDF(toInspect []byte) (TDFInspect, []error)
func (*Handler) ListAttributeValues ¶
func (h *Handler) ListAttributeValues(attributeId string, state common.ActiveStateEnum, limit, offset int32) ([]*policy.Value, *policy.PageResponse, error)
func (Handler) ListAttributes ¶
func (h Handler) ListAttributes(state common.ActiveStateEnum, limit, offset int32) ([]*policy.Attribute, *policy.PageResponse, error)
func (Handler) ListKasGrants ¶ added in v0.13.0
func (h Handler) ListKasGrants(ctx context.Context, kas_id, kas_uri string, limit, offset int32) ([]*kasregistry.KeyAccessServerGrants, *policy.PageResponse, error)
func (Handler) ListKasRegistryEntries ¶
func (h Handler) ListKasRegistryEntries(limit, offset int32) ([]*policy.KeyAccessServer, *policy.PageResponse, error)
func (Handler) ListNamespaces ¶
func (h Handler) ListNamespaces(state common.ActiveStateEnum, limit, offset int32) ([]*policy.Namespace, *policy.PageResponse, error)
func (*Handler) ListResourceMappings ¶
func (h *Handler) ListResourceMappings(ctx context.Context, limit, offset int32) ([]*policy.ResourceMapping, *policy.PageResponse, error)
func (Handler) ListSubjectConditionSets ¶
func (h Handler) ListSubjectConditionSets(limit, offset int32) ([]*policy.SubjectConditionSet, *policy.PageResponse, error)
func (Handler) ListSubjectMappings ¶
func (h Handler) ListSubjectMappings(limit, offset int32) ([]*policy.SubjectMapping, *policy.PageResponse, error)
func (Handler) MatchSubjectMappings ¶ added in v0.16.0
func (h Handler) MatchSubjectMappings(selectors []string) ([]*policy.SubjectMapping, error)
func (Handler) PruneSubjectConditionSets ¶ added in v0.17.0
func (h Handler) PruneSubjectConditionSets() ([]*policy.SubjectConditionSet, error)
func (Handler) UnsafeDeleteAttribute ¶
Deletes and returns error if deletion failed
func (Handler) UnsafeDeleteAttributeValue ¶
Deletes and returns error if deletion failed
func (Handler) UnsafeDeleteNamespace ¶
Deletes and returns the deleted namespace
func (Handler) UnsafeReactivateAttribute ¶
Reactivates and returns reactivated attribute
func (Handler) UnsafeReactivateAttributeValue ¶
Reactivates and returns reactivated attribute
func (Handler) UnsafeReactivateNamespace ¶
Reactivates and returns the reactivated namespace
func (Handler) UnsafeUpdateAttribute ¶
Deletes and returns error if deletion failed
func (Handler) UnsafeUpdateAttributeValue ¶
Deletes and returns error if deletion failed
func (Handler) UnsafeUpdateNamespace ¶
Unsafely updates the namespace and returns the renamed namespace
func (*Handler) UpdateAttribute ¶
func (h *Handler) UpdateAttribute( id string, metadata *common.MetadataMutable, behavior common.MetadataUpdateEnum, ) (*policy.Attribute, error)
Updates and returns updated attribute
func (*Handler) UpdateAttributeValue ¶
func (h *Handler) UpdateAttributeValue(id string, metadata *common.MetadataMutable, behavior common.MetadataUpdateEnum) (*policy.Value, error)
Updates and returns updated value
func (Handler) UpdateKasRegistryEntry ¶
func (h Handler) UpdateKasRegistryEntry(id, uri, name string, pubKey *policy.PublicKey, 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(id string, metadata *common.MetadataMutable, behavior common.MetadataUpdateEnum) (*policy.Namespace, error)
Updates and returns the updated namespace
func (*Handler) UpdateResourceMapping ¶
func (h *Handler) UpdateResourceMapping(id string, attrValueId 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) UpdateSubjectConditionSet ¶
func (h Handler) UpdateSubjectConditionSet(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(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