Module ffi

Source
Expand description

FFI utilities, see comments in the module itself

Structs§

AuthorizationCall
Struct containing the input data for authorization
AuthorizationError
Error (or warning) which occurred in a particular policy during authorization
Context
Wrapper around a JSON value describing a context. Expects the same format as crate::Context::from_json_value. See https://docs.cedarpolicy.com/auth/entities-syntax.html
ContextParsingCall
Struct containing the input data for check_parse_context()
DetailedError
Structure of the JSON output representing one miette error
Diagnostics
Interface version of Diagnostics that stores error messages and warnings in the DetailedError format
Entities
Wrapper around a JSON value describing a set of entities. Expects the same format as crate::Entities::from_json_value. See https://docs.cedarpolicy.com/auth/entities-syntax.html
EntitiesParsingCall
Struct containing the input data for check_parse_entities()
EntityUid
Wrapper around a JSON value describing an entity uid in either explicit or implicit __entity form. Expects the same format as crate::EntityUid::from_json.
FormattingCall
Struct containing the input data for formatting
JsonValueWithNoDuplicateKeys
Wrapper around serde_json::Value, with a different Deserialize implementation, such that duplicate keys in JSON objects (maps/records) are not allowed (result in an error).
PartialAuthorizationCallpartial-eval
Struct containing the input data for partial authorization
PolicySet
Represents a policy set, including static policies, templates, and template links
ResidualResponsepartial-eval
FFI version of a crate::PartialResponse
Response
Interface version of a Response that uses the interface version of Diagnostics
SourceLabel
Structure of the JSON output representing a miette source label (range)
SourceLocation
A range of source code representing the location of an error or warning.
TemplateLink
Represents a template-linked policy
ValidationCall
Struct containing the input data for validation
ValidationError
Error (or warning) for a specified policy after validation
ValidationSettings
Configuration for the validation call

Enums§

AuthorizationAnswer
Answer struct from authorization call
CheckParseAnswer
Result struct for syntax validation
FormattingAnswer
Result struct for formatting
PartialAuthorizationAnswerpartial-eval
Answer struct from partial-authorization call
Policy
Represents a static policy in either the Cedar or JSON policy format
PolicyToJsonAnswer
Result of converting a policy or template to JSON
PolicyToTextAnswer
Result of converting a policy or template to the Cedar format
Schema
Represents a schema in either the Cedar or JSON schema format
SchemaToJsonAnswer
Result of converting a schema to JSON
SchemaToTextAnswer
Result of converting a schema to the Cedar format
Severity
Exactly like miette::Severity but implements Hash
StaticPolicySet
Represents a set of static policies
Template
Represents a policy template in either the Cedar or JSON policy format.
ValidationAnswer
Result struct for validation

Functions§

check_parse_context
Check whether a context successfully parses.
check_parse_context_json
Check whether a context successfully parses. Input is a JSON encoding of ContextParsingCall and output is a JSON encoding of CheckParseAnswer.
check_parse_context_json_str
Check whether a context successfully parses. Input and output are strings containing serialized JSON, in the shapes expected by check_parse_context_json().
check_parse_entities
Check whether a set of entities successfully parses.
check_parse_entities_json
Check whether a set of entities successfully parses. Input is a JSON encoding of EntitiesParsingCall and output is a JSON encoding of CheckParseAnswer.
check_parse_entities_json_str
Check whether a set of entities successfully parses. Input and output are strings containing serialized JSON, in the shapes expected by check_parse_entities_json().
check_parse_policy_set
Check whether a policy set successfully parses.
check_parse_policy_set_json
Check whether a policy set successfully parses. Input is a JSON encoding of PolicySet and output is a JSON encoding of CheckParseAnswer.
check_parse_policy_set_json_str
Check whether a policy set successfully parses. Input and output are strings containing serialized JSON, in the shapes expected by check_parse_policy_set_json().
check_parse_schema
Check whether a schema successfully parses.
check_parse_schema_json
Check whether a schema successfully parses. Input is a JSON encoding of Schema and output is a JSON encoding of CheckParseAnswer.
check_parse_schema_json_str
Check whether a schema successfully parses. Input and output are strings containing serialized JSON, in the shapes expected by check_parse_schema_json().
format
Apply the Cedar policy formatter to a policy set in the Cedar policy format
format_json
Apply the Cedar policy formatter. Input is a JSON encoding of FormattingCall and output is a JSON encoding of FormattingAnswer.
format_json_str
Apply the Cedar policy formatter. Input and output are strings containing serialized JSON, in the shapes expected by format_json().
get_lang_version
Get language version of Cedar
get_sdk_version
Get SDK version of Cedar
is_authorized
Basic interface, using AuthorizationCall and AuthorizationAnswer types
is_authorized_json
Input is a JSON encoding of AuthorizationCall and output is a JSON encoding of AuthorizationAnswer
is_authorized_json_str
Input and output are strings containing serialized JSON, in the shapes expected by is_authorized_json()
is_authorized_partialpartial-eval
Basic interface for partial evaluation, using AuthorizationCall and PartialAuthorizationAnswer types
is_authorized_partial_jsonpartial-eval
Input is a JSON encoding of AuthorizationCall and output is a JSON encoding of PartialAuthorizationAnswer
is_authorized_partial_json_strpartial-eval
Input and output are strings containing serialized JSON, in the shapes expected by is_authorized_partial_json()
policy_to_json
Return the JSON representation of a policy.
policy_to_text
Return the Cedar (textual) representation of a policy.
schema_to_json
Return the JSON representation of a schema.
schema_to_text
Return the Cedar (textual) representation of a schema.
template_to_json
Return the JSON representation of a template.
template_to_text
Return the Cedar (textual) representation of a template.
validate
Parse a policy set and optionally validate it against a provided schema
validate_json
Input is a JSON encoding of ValidationCall and output is a JSON encoding of ValidationAnswer
validate_json_str
Input and output are strings containing serialized JSON, in the shapes expected by validate_json()