GoodMemGoodMem

AccessPolicy

Methods on this page are called as client.access_policy.<method>(...) on a Goodmem instance.

Classai.pairsys.goodmem.client.api.AccessPolicyAPI (extends internal AccessPolicyAPIBase).

import ai.pairsys.goodmem.client.Goodmem;

try (Goodmem client = Goodmem.builder()
        .baseUrl("http://localhost:8080")
        .apiKey("gm_...")
        .build()) {
    // client.access_policy.<method>(...)
}

Async variants

Every method listed below also exists on ai.pairsys.goodmem.client.api.AsyncAccessPolicyAPI (accessed via asyncClient.access_policy on an AsyncGoodmem) with the same parameter list, wrapped in CompletableFuture<T>. Paginated list methods return CompletableFuture<AsyncPage<T>>. See the async client guide for composition patterns.

import ai.pairsys.goodmem.client.AsyncGoodmem;

try (AsyncGoodmem asyncClient = AsyncGoodmem.builder()
        .baseUrl("http://localhost:8080")
        .apiKey("gm_...")
        .build()) {
    asyncClient.access_policy.<method>(...)  // returns CompletableFuture<T>
}

Method Summary

Method Detail

check(CheckAuthorizationsRequest)

CheckAuthorizationsResponse check(CheckAuthorizationsRequest request)

Javadoccheck(CheckAuthorizationsRequest)

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 target INSTANCE; CREATE_MEMORY and LIST_MEMORY target their parent SPACE; reads, mutations, proxy operations, and access-policy administration target concrete resources. LIST_API_KEY and LIST_RETRIEVE_MEMORY_LOG_POLICY are rejected because their current candidate-based list rules have no instance-wide preflight.

HTTPPOST /v1/access-policy:check

Parameters

ReturnsCheckAuthorizationsResponse

Throws

Example

CheckAuthorizationsResponse checkAuthorizationsResponse = client.access_policy.check(CheckAuthorizationsRequest.builder()
            // …set required fields…
            .build());

REST equivalent

curl -X POST 'http://localhost:8080/v1/access-policy:check' \
  -H "x-api-key: gm_..." \
  -H "Content-Type: application/json" \
  -d '{
    "checks": [
      {
        "operation": "READ_INSTANCE",
        "target": {
          "kind": "INSTANCE"
        }
      }
    ]
  }'

grantsCreate(CreateAuthorizationGrantRequest)

AuthorizationGrant grantsCreate(CreateAuthorizationGrantRequest request)

JavadocgrantsCreate(CreateAuthorizationGrantRequest)

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.

HTTPPOST /v1/access-policy/grants

Parameters

ReturnsAuthorizationGrant

Throws

Example

AuthorizationGrant authorizationGrant = client.access_policy.grantsCreate(CreateAuthorizationGrantRequest.builder()
            // …set required fields…
            .build());

REST equivalent

curl -X POST 'http://localhost:8080/v1/access-policy/grants' \
  -H "x-api-key: gm_..." \
  -H "Content-Type: application/json" \
  -d '{ /* CreateAuthorizationGrantRequest fields, see Javadoc */ }'

grantsDelete(String)

AuthorizationGrant grantsDelete(String id)

JavadocgrantsDelete(String)

Soft-revokes one grant and returns its durable historical row. Repeating the request is idempotent while the caller retains MANAGE_ACCESS on the target.

HTTPDELETE /v1/access-policy/grants/&#123;id&#125;

Parameters

  • id (String) — Grant UUID

ReturnsAuthorizationGrant

Throws

Example

AuthorizationGrant authorizationGrant = client.access_policy.grantsDelete("...");

REST equivalent

curl -X DELETE 'http://localhost:8080/v1/access-policy/grants/{id}' \
  -H "x-api-key: gm_..."

grantsGet(String, Map<String, Object>)

AuthorizationGrant grantsGet(String id, Map<String, Object> query)

JavadocgrantsGet(String, Map<String, Object>)

Reads one live grant, or one revoked historical grant when includeRevoked is true, after requiring MANAGE_ACCESS on its policy target.

HTTPGET /v1/access-policy/grants/&#123;id&#125;

Parameters

  • id (String) — Grant UUID
  • query (Map<String, Object>) — query-string parameters; use Map.of() when none.

ReturnsAuthorizationGrant

Throws

Example

AuthorizationGrant authorizationGrant = client.access_policy.grantsGet("...", java.util.Map.of());

REST equivalent

curl -X GET 'http://localhost:8080/v1/access-policy/grants/{id}' \
  -H "x-api-key: gm_..."

grantsList(Map<String, Object>)

Page<AuthorizationGrant> grantsList(Map<String, Object> query)

JavadocgrantsList(Map<String, Object>)

Lists grants attached to one resource. MANAGE_ACCESS is required on that resource; continuation tokens are bound to the caller and filters.

HTTPGET /v1/access-policy/grants

Parameters

  • query (Map<String, Object>) — query-string parameters; use Map.of() when none.

ReturnsPage<AuthorizationGrant>

Throws

Example

Page<AuthorizationGrant> page = client.access_policy.grantsList(java.util.Map.of());

REST equivalent

curl -X GET 'http://localhost:8080/v1/access-policy/grants' \
  -H "x-api-key: gm_..."

roleAssignmentsCreate(AssignRoleRequest)

RoleAssignment roleAssignmentsCreate(AssignRoleRequest request)

JavadocroleAssignmentsCreate(AssignRoleRequest)

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.

HTTPPOST /v1/access-policy/role-assignments

Parameters

  • request (AssignRoleRequest) — full request payload. The linked Javadoc lists every field and its Builder setter.

ReturnsRoleAssignment

Throws

Example

RoleAssignment roleAssignment = client.access_policy.roleAssignmentsCreate(AssignRoleRequest.builder()
            // …set required fields…
            .build());

REST equivalent

curl -X POST 'http://localhost:8080/v1/access-policy/role-assignments' \
  -H "x-api-key: gm_..." \
  -H "Content-Type: application/json" \
  -d '{ /* AssignRoleRequest fields, see Javadoc */ }'

roleAssignmentsDelete(String)

RoleAssignment roleAssignmentsDelete(String id)

JavadocroleAssignmentsDelete(String)

Soft-revokes one non-ROOT assignment and returns its durable historical row. Repeating the request is idempotent while the caller retains MANAGE_ACCESS.

HTTPDELETE /v1/access-policy/role-assignments/&#123;id&#125;

Parameters

  • id (String) — Role-assignment UUID

ReturnsRoleAssignment

Throws

Example

RoleAssignment roleAssignment = client.access_policy.roleAssignmentsDelete("...");

REST equivalent

curl -X DELETE 'http://localhost:8080/v1/access-policy/role-assignments/{id}' \
  -H "x-api-key: gm_..."

roleAssignmentsGet(String, Map<String, Object>)

RoleAssignment roleAssignmentsGet(String id, Map<String, Object> query)

JavadocroleAssignmentsGet(String, Map<String, Object>)

Reads one live assignment, or one revoked historical assignment when includeRevoked is true, after requiring MANAGE_ACCESS on its policy target.

HTTPGET /v1/access-policy/role-assignments/&#123;id&#125;

Parameters

  • id (String) — Role-assignment UUID
  • query (Map<String, Object>) — query-string parameters; use Map.of() when none.

ReturnsRoleAssignment

Throws

Example

RoleAssignment roleAssignment = client.access_policy.roleAssignmentsGet("...", java.util.Map.of());

REST equivalent

curl -X GET 'http://localhost:8080/v1/access-policy/role-assignments/{id}' \
  -H "x-api-key: gm_..."

roleAssignmentsList(Map<String, Object>)

Page<RoleAssignment> roleAssignmentsList(Map<String, Object> query)

JavadocroleAssignmentsList(Map<String, Object>)

Lists assignments attached to one required INSTANCE or SPACE boundary after requiring MANAGE_ACCESS. Continuation tokens are bound to the caller and filters.

HTTPGET /v1/access-policy/role-assignments

Parameters

  • query (Map<String, Object>) — query-string parameters; use Map.of() when none.

ReturnsPage<RoleAssignment>

Throws

Example

Page<RoleAssignment> page = client.access_policy.roleAssignmentsList(java.util.Map.of());

REST equivalent

curl -X GET 'http://localhost:8080/v1/access-policy/role-assignments' \
  -H "x-api-key: gm_..."

Errors

Every method on this page may throw the standard HTTP-error class hierarchy rooted at GoodmemException:

BadRequestException (400), AuthenticationException (401), PermissionDeniedException (403), NotFoundException (404), ConflictException (409), UnprocessableEntityException (422), RateLimitException (429), InternalServerException (5xx), or the generic ApiException for any other 4xx/5xx. All are unchecked (RuntimeException). See Errors.

All error classes live in ai.pairsys.goodmem.client.errors and are unchecked (RuntimeException). Async siblings complete the returned CompletableFuture exceptionally with the same types, wrapped in CompletionException at await time. See Errors on the index for the full table.