AccessPolicy
Rust access_policy API reference: typed methods, request options, return values, and resource models.
goodmem::api::AccessPolicy
Access this service with client.access_policy().
pub struct AccessPolicy<'a> {
/* private fields */
}Methods
| Method | HTTP | Path |
|---|---|---|
check | POST | /v1/access-policy:check |
grants_create | POST | /v1/access-policy/grants |
grants_delete | DELETE | /v1/access-policy/grants/{id} |
grants_get | GET | /v1/access-policy/grants/{id} |
grants_list | GET | /v1/access-policy/grants |
role_assignments_create | POST | /v1/access-policy/role-assignments |
role_assignments_delete | DELETE | /v1/access-policy/role-assignments/{id} |
role_assignments_get | GET | /v1/access-policy/role-assignments/{id} |
role_assignments_list | GET | /v1/access-policy/role-assignments |
Errors and cancellation
Calls return Result<T>. See Error for validation, HTTP, transport, decoding, and timeout failures. Stream items can also return errors after the call succeeds.
Pagination helpers fetch pages when polled. Drop a page or event stream to cancel further work.
Implementations
impl AccessPolicy<'_>
check
pub async fn check( &self, body: &CheckAuthorizationsRequest, ) ->Result<CheckAuthorizationsResponse>
Check effective authorization
Evaluates 1 to 50 concrete operation-and-target checks under the authenticated caller's live authority and any API-key ceiling. Results are positional and advisory: missing targets and denied operations both return allowed=false, and every later resource request performs fresh authorization. Top-level creates and LIST_API_KEY target INSTANCE; CREATE_MEMORY and LIST_MEMORY target their parent SPACE; reads, mutations, proxy operations, and access-policy administration target concrete resources. LIST_RETRIEVE_MEMORY_LOG_POLICY is rejected because its current candidate-based list rule has no instance-wide preflight.
Errors include local validation, HTTP failures, and malformed responses.
HTTP: POST /v1/access-policy:check
grants_create
pub async fn grants_create( &self, body: &CreateAuthorizationGrantRequest, ) ->Result<AuthorizationGrant>
Create an authorization grant
Creates one direct grant after resolving its typed policy target and requiring MANAGE_ACCESS. Direct grants cannot confer credential-read or ownership-transfer authority. ALL_AUTHENTICATED grants require an assigned-resource selector. MANAGE_ACCESS and MANAGE_USER_ENROLLMENT require a concrete principal and ANY or EXACT; MANAGE_USER_ENROLLMENT with EXACT must target USER.
Errors include local validation, HTTP failures, and malformed responses.
HTTP: POST /v1/access-policy/grants
grants_delete
pub async fn grants_delete(&self, id: impl std::fmt::Display) ->Result<AuthorizationGrant>
Revoke an authorization grant
Soft-revokes one grant and returns its durable historical row. Repeating the request is idempotent while the caller retains MANAGE_ACCESS on the target.
Errors include local validation, HTTP failures, and malformed responses.
HTTP: DELETE /v1/access-policy/grants/{id}
grants_get
pub async fn grants_get( &self, id: impl std::fmt::Display, options: &AccessPolicyGrantsGetOptions, ) ->Result<AuthorizationGrant>
Get an authorization grant
Reads one live grant, or one revoked historical grant when includeRevoked is true, after requiring MANAGE_ACCESS on its policy target.
Errors include local validation, HTTP failures, and malformed responses.
HTTP: GET /v1/access-policy/grants/{id}
grants_list
pub async fn grants_list( &self, options: &AccessPolicyGrantsListOptions, ) ->Result<ListAuthorizationGrantsResponse>
List authorization grants
Lists grants attached to one resource. MANAGE_ACCESS is required on that resource; continuation tokens are bound to the caller and filters.
Errors include local validation, HTTP failures, and malformed responses.
HTTP: GET /v1/access-policy/grants
role_assignments_create
pub async fn role_assignments_create( &self, body: &AssignRoleRequest, ) ->Result<RoleAssignment>
Assign a scoped role
Assigns one code-defined role to an active principal at INSTANCE or SPACE scope after requiring MANAGE_ACCESS. ROOT is maintained only by ownership workflows.
Errors include local validation, HTTP failures, and malformed responses.
HTTP: POST /v1/access-policy/role-assignments
role_assignments_delete
pub async fn role_assignments_delete( &self, id: impl std::fmt::Display, ) ->Result<RoleAssignment>
Revoke a scoped role assignment
Soft-revokes one non-ROOT assignment and returns its durable historical row. Repeating the request is idempotent while the caller retains MANAGE_ACCESS.
Errors include local validation, HTTP failures, and malformed responses.
HTTP: DELETE /v1/access-policy/role-assignments/{id}
role_assignments_get
pub async fn role_assignments_get( &self, id: impl std::fmt::Display, options: &AccessPolicyRoleAssignmentsGetOptions, ) ->Result<RoleAssignment>
Get a scoped role assignment
Reads one live assignment, or one revoked historical assignment when includeRevoked is true, after requiring MANAGE_ACCESS on its policy target.
Errors include local validation, HTTP failures, and malformed responses.
HTTP: GET /v1/access-policy/role-assignments/{id}
role_assignments_list
pub async fn role_assignments_list( &self, options: &AccessPolicyRoleAssignmentsListOptions, ) ->Result<ListRoleAssignmentsResponse>
List scoped role assignments
Lists assignments attached to one required INSTANCE or SPACE boundary after requiring MANAGE_ACCESS. Continuation tokens are bound to the caller and filters.
Errors include local validation, HTTP failures, and malformed responses.
HTTP: GET /v1/access-policy/role-assignments
Types
AccessPolicyGrantsGetOptionsAccessPolicyGrantsListOptionsAccessPolicyRoleAssignmentsGetOptionsAccessPolicyRoleAssignmentsListOptionsAssignRoleRequestAuthorizationGrantCheckAuthorizationsRequestCheckAuthorizationsResponseCreateAuthorizationGrantRequestListAuthorizationGrantsResponseListRoleAssignmentsResponseRoleAssignment
Trait implementations
Clone(derived)Copy(derived)Debug(derived)