GoodMemGoodMem
ReferenceSdkV2.NET

Admin

Server lifecycle ops — drain, license reload, background-job purge.

Namespace: Goodmem.Client.Api · Class: AdminApi

Reach this surface as client.Admin on a GoodmemClient. Every network method is asynchronous — it returns a Task<T> (or an IAsyncEnumerable<T> for pagination and streaming) and accepts a CancellationToken; the Async suffix marks the standard .NET Task-based async pattern.

Methods

MethodSummary
DrainAsyncRequest the server to enter drain mode.
BackgroundJobsPurgeAsyncPurge completed background jobs.
LicenseReloadAsyncReload the active license from disk.
RetrieveMemoryLogPoliciesCreateAsyncCreate a RetrieveMemory log policy.
RetrieveMemoryLogPoliciesDeleteAsyncDelete a RetrieveMemory log policy.
RetrieveMemoryLogPoliciesGetAsyncGet a RetrieveMemory log policy.
RetrieveMemoryLogPoliciesListAsyncList RetrieveMemory log policies.

DrainAsync

Initiates drain mode and optionally waits for the server to quiesce.

Declaration

public Task<AdminDrainResponse> DrainAsync(AdminDrainRequest? request = null, CancellationToken ct = default)

HTTPPOST /v1/admin:drain

Parameters

TypeNameDescription
AdminDrainRequestrequestThe request payload; the linked model lists every field and its JSON wire name. (optional)
CancellationTokenctCancellation / deadline signal for the call. (optional)

Returns

Task<AdminDrainResponse> — an awaitable that resolves to AdminDrainResponse.

Exceptions

TypeCondition
NetworkExceptionThe request could not reach the server (DNS, connection, or TLS failure).
ApiExceptionThe server returned a non-success (non-2xx) status. A status-specific subtype is thrown where it applies — e.g. NotFoundException (404), PermissionDeniedException (403), ConflictException (409).

Example

var result = await client.Admin.DrainAsync(new AdminDrainRequest { TimeoutSec = 0 });
Console.WriteLine(result.Quiesced);


BackgroundJobsPurgeAsync

Deletes terminal background jobs older than a retention cutoff.

Declaration

public Task<AdminPurgeJobsResponse> BackgroundJobsPurgeAsync(AdminPurgeJobsRequest? request = null, CancellationToken ct = default)

HTTPPOST /v1/admin/background-jobs:purge

Parameters

TypeNameDescription
AdminPurgeJobsRequestrequestThe request payload; the linked model lists every field and its JSON wire name. (optional)
CancellationTokenctCancellation / deadline signal for the call. (optional)

Returns

Task<AdminPurgeJobsResponse> — an awaitable that resolves to AdminPurgeJobsResponse.

Exceptions

TypeCondition
NetworkExceptionThe request could not reach the server (DNS, connection, or TLS failure).
ApiExceptionThe server returned a non-success (non-2xx) status. A status-specific subtype is thrown where it applies — e.g. NotFoundException (404), PermissionDeniedException (403), ConflictException (409).

Example

var result = await client.Admin.BackgroundJobsPurgeAsync(
    new AdminPurgeJobsRequest { OlderThan = "2000-01-01T00:00:00Z", DryRun = true }
);
Console.WriteLine(result.JobsPurged);


LicenseReloadAsync

Triggers the server to reload its license file from the configured directory and returns metadata about the currently active license.

Declaration

public Task<AdminReloadLicenseResponse> LicenseReloadAsync(CancellationToken ct = default)

HTTPPOST /v1/admin/license:reload

Parameters

TypeNameDescription
CancellationTokenctCancellation / deadline signal for the call. (optional)

Returns

Task<AdminReloadLicenseResponse> — an awaitable that resolves to AdminReloadLicenseResponse.

Exceptions

TypeCondition
NetworkExceptionThe request could not reach the server (DNS, connection, or TLS failure).
ApiExceptionThe server returned a non-success (non-2xx) status. A status-specific subtype is thrown where it applies — e.g. NotFoundException (404), PermissionDeniedException (403), ConflictException (409).

Example

var result = await client.Admin.LicenseReloadAsync();
Console.WriteLine(result.Status);


RetrieveMemoryLogPoliciesCreateAsync

Creates an immutable administrative policy that can automatically enable durable RetrieveMemory request logging.

Declaration

public Task<RetrieveMemoryLogPolicy> RetrieveMemoryLogPoliciesCreateAsync(CreateRetrieveMemoryLogPolicyRequest? request = null, CancellationToken ct = default)

HTTPPOST /v1/admin/retrieve-memory-log-policies

Parameters

TypeNameDescription
CreateRetrieveMemoryLogPolicyRequestrequestThe request payload; the linked model lists every field and its JSON wire name. (optional)
CancellationTokenctCancellation / deadline signal for the call. (optional)

Returns

Task<RetrieveMemoryLogPolicy> — an awaitable that resolves to RetrieveMemoryLogPolicy.

Exceptions

TypeCondition
NetworkExceptionThe request could not reach the server (DNS, connection, or TLS failure).
ApiExceptionThe server returned a non-success (non-2xx) status. A status-specific subtype is thrown where it applies — e.g. NotFoundException (404), PermissionDeniedException (403), ConflictException (409).

Example

var created = await client.Admin.RetrieveMemoryLogPoliciesCreateAsync(
    new CreateRetrieveMemoryLogPolicyRequest
    {
        DisplayName = "audit-doc-example",
        Condition = new RetrieveMemoryLogPolicyCondition { MatchAll = true },
    }
);
Console.WriteLine(created.PolicyId);


RetrieveMemoryLogPoliciesDeleteAsync

Idempotently tombstones an immutable RetrieveMemory log policy.

Declaration

public Task<RetrieveMemoryLogPolicy> RetrieveMemoryLogPoliciesDeleteAsync(string id, DeleteRetrieveMemoryLogPolicyRequest? request = null, CancellationToken ct = default)

HTTPDELETE /v1/admin/retrieve-memory-log-policies/&#123;id&#125;

Parameters

TypeNameDescription
stringidThe UUID of the policy to delete
DeleteRetrieveMemoryLogPolicyRequestrequestThe request payload; the linked model lists every field and its JSON wire name. (optional)
CancellationTokenctCancellation / deadline signal for the call. (optional)

Returns

Task<RetrieveMemoryLogPolicy> — an awaitable that resolves to RetrieveMemoryLogPolicy.

Exceptions

TypeCondition
ArgumentExceptionid is null or empty.
NetworkExceptionThe request could not reach the server (DNS, connection, or TLS failure).
ApiExceptionThe server returned a non-success (non-2xx) status. A status-specific subtype is thrown where it applies — e.g. NotFoundException (404), PermissionDeniedException (403), ConflictException (409).

Example

var tombstoned = await client.Admin.RetrieveMemoryLogPoliciesDeleteAsync(
    "your-policy-id",
    new DeleteRetrieveMemoryLogPolicyRequest { Reason = "doc example cleanup" }
);
Console.WriteLine(tombstoned.PolicyId);


RetrieveMemoryLogPoliciesGetAsync

Retrieves a live RetrieveMemory log policy by UUID, or a tombstoned policy when includeDeleted is true.

Declaration

public Task<RetrieveMemoryLogPolicy> RetrieveMemoryLogPoliciesGetAsync(string id, AdminRetrieveMemoryLogPoliciesGetOptions? options = null, CancellationToken ct = default)

HTTPGET /v1/admin/retrieve-memory-log-policies/&#123;id&#125;

Parameters

TypeNameDescription
stringidThe UUID of the policy to retrieve
AdminRetrieveMemoryLogPoliciesGetOptionsoptionsOptions bag carrying the lookup key(s) / convenience knobs; the linked type lists them all. (optional)
CancellationTokenctCancellation / deadline signal for the call. (optional)

Returns

Task<RetrieveMemoryLogPolicy> — an awaitable that resolves to RetrieveMemoryLogPolicy.

Exceptions

TypeCondition
ArgumentExceptionid is null or empty.
NetworkExceptionThe request could not reach the server (DNS, connection, or TLS failure).
ApiExceptionThe server returned a non-success (non-2xx) status. A status-specific subtype is thrown where it applies — e.g. NotFoundException (404), PermissionDeniedException (403), ConflictException (409).

Example

var fetched = await client.Admin.RetrieveMemoryLogPoliciesGetAsync("your-policy-id");
Console.WriteLine(fetched.DisplayName);


RetrieveMemoryLogPoliciesListAsync

Lists RetrieveMemory log policies with optional tombstone, active-time, name, label, sort, and pagination filters. LABEL FILTERS: Label filters accept either label.<key>=<value> or label[key]=value (for example, label.environment=production or label[environment]=production).

Declaration

public IAsyncEnumerable<RetrieveMemoryLogPolicy> RetrieveMemoryLogPoliciesListAsync(AdminRetrieveMemoryLogPoliciesListOptions? options = null, CancellationToken ct = default)

HTTPGET /v1/admin/retrieve-memory-log-policies

Parameters

TypeNameDescription
AdminRetrieveMemoryLogPoliciesListOptionsoptionsOptions bag carrying the lookup key(s) / convenience knobs; the linked type lists them all. (optional)
CancellationTokenctCancellation / deadline signal for the call. (optional)

Returns

IAsyncEnumerable<RetrieveMemoryLogPolicy> — an async stream; await foreach yields each RetrieveMemoryLogPolicy across pages / events.

Exceptions

TypeCondition
NetworkExceptionThe request could not reach the server (DNS, connection, or TLS failure).
ApiExceptionThe server returned a non-success (non-2xx) status. A status-specific subtype is thrown where it applies — e.g. NotFoundException (404), PermissionDeniedException (403), ConflictException (409).

Example

// Auto-paginate every retrieve-memory log policy.
await foreach (var policy in client.Admin.RetrieveMemoryLogPoliciesListAsync())
    Console.WriteLine(policy.DisplayName);


Data Models

Types in the Goodmem.Client.Models namespace. Each row lists the C# property, its type, the JSON wire name, and a description.

AdminPurgeJobsRequest

PropertyTypeJSON (wire)Description
OlderThanstringolderThanISO-8601 timestamp cutoff; only terminal jobs older than this instant are eligible. (optional)
StatusesIReadOnlyList<PurgeableBackgroundJobStatus>statusesOptional terminal background job statuses to target for purging. If omitted, all terminal statuses are eligible. Canonical values are BACKGROUND_JOB_SUCCEEDED, BACKGROUND_JOB_FAILED, and BACKGROUND_JOB_CANCELED. Short aliases SUCCEEDED, FAILED, and CANCELED are also accepted for compatibility. (optional)
DryRunbooldryRunIf true, report purge counts without deleting any rows. (optional)
LimitintlimitMaximum number of jobs to purge in this request. Must be >= 0; 0 means no limit. (optional)

PurgeableBackgroundJobStatus

Terminal background job statuses eligible for purge requests.

String enum: "BACKGROUND_JOB_SUCCEEDED" · "BACKGROUND_JOB_FAILED" · "BACKGROUND_JOB_CANCELED"

AdminPurgeJobsResponse

PropertyTypeJSON (wire)Description
JobsPurgedlongjobsPurgedNumber of background job rows removed, or that would be removed during dry-run.
AttemptsPurgedlongattemptsPurgedNumber of background job attempt rows removed.
ReferencesPurgedlongreferencesPurgedNumber of background job reference rows removed.
DryRunbooldryRunWhether the purge executed in dry-run mode.

AdminDrainRequest

PropertyTypeJSON (wire)Description
TimeoutSecinttimeoutSecMaximum seconds to wait for the server to quiesce before returning. (optional)
ReasonstringreasonHuman-readable reason for initiating drain mode. (optional)
WaitForQuiesceboolwaitForQuiesceIf true, wait for in-flight requests to complete and the server to reach QUIESCED before responding. (optional)

AdminDrainResponse

PropertyTypeJSON (wire)Description
StatestringstateLifecycle state reported after the drain request was processed. (optional)
QuiescedboolquiescedWhether the server has reached the QUIESCED lifecycle state.
MessagestringmessageHuman-readable status message describing the drain outcome. (optional)

AdminReloadLicenseResponse

PropertyTypeJSON (wire)Description
StatusstringstatusOutcome of the reload attempt, such as LOADED, UNCHANGED, FAILED, or NOT_FOUND.
MessagestringmessageHuman-readable message describing the reload result.
ActiveLicenseActiveLicenseMetadataactiveLicenseMetadata for the currently active license after reload, or null if no license is active. (optional)

ActiveLicenseMetadata

PropertyTypeJSON (wire)Description
FilenamestringfilenameFilename of the active license on disk.
Sha256stringsha256Hex-encoded SHA-256 hash of the active license file.
SizeByteslongsizeBytesSize of the active license file in bytes.
ModifiedAtstringmodifiedAtLast modification timestamp of the active license file.

CreateRetrieveMemoryLogPolicyRequest

REST request for creating an immutable RetrieveMemory log policy.

PropertyTypeJSON (wire)Description
PolicyIdstringpolicyIdOptional client-provided policy UUID. (optional)
DisplayNamestringdisplayNameHuman-readable policy name.
DescriptionstringdescriptionOptional operator description. (optional)
ConditionRetrieveMemoryLogPolicyConditionconditionPolicy match condition.
ActiveFromDateTimeOffsetactiveFromInclusive activation time in milliseconds since epoch. (optional)
ActiveUntilDateTimeOffsetactiveUntilExclusive deactivation time in milliseconds since epoch. (optional)
LabelsIReadOnlyDictionary<string, string>labelsOperator labels for listing and administration. (optional)

RetrieveMemoryLogPolicyCondition

RetrieveMemory log policy condition. Set matchAll=true to match every authenticated RetrieveMemory request and do not provide anyOf clauses. Otherwise, anyOf is required and must contain at least one non-empty scoped clause.

PropertyTypeJSON (wire)Description
MatchAllboolmatchAllWhen true, match every authenticated RetrieveMemory request. Must be omitted or false when anyOf contains clauses. Defaults to false when omitted. (optional)
AnyOfIReadOnlyList<RetrieveMemoryLogPolicyConditionClause>anyOfOR clauses used for scoped matching. Required and non-empty when matchAll is false or omitted. Must be omitted or empty when matchAll is true. Each clause must include at least one match dimension. (optional)

RetrieveMemoryLogPolicyConditionClause

One OR clause in a RetrieveMemory log policy condition. All populated dimensions in the clause must match; clauses are ORed together.

PropertyTypeJSON (wire)Description
RequestorUserIdsIReadOnlyList<string>requestorUserIdsAuthenticated requestor user UUID strings. (optional)
ApiKeyIdsIReadOnlyList<string>apiKeyIdsAPI key UUID strings used to authenticate RetrieveMemory requests. (optional)
SpaceIdsIReadOnlyList<string>spaceIdsPost-permission accessible space UUID strings. (optional)
ApiKeyLabelSelectorsIReadOnlyDictionary<string, string>apiKeyLabelSelectorsExact API-key label selectors that must all match. (optional)
SpaceLabelSelectorsIReadOnlyDictionary<string, string>spaceLabelSelectorsExact space label selectors that must match at least one accessible space. (optional)

RetrieveMemoryLogPolicy

REST representation of an immutable RetrieveMemory log policy.

PropertyTypeJSON (wire)Description
PolicyIdstringpolicyIdPolicy UUID.
DisplayNamestringdisplayNameHuman-readable policy name.
DescriptionstringdescriptionOptional operator description. (optional)
ConditionRetrieveMemoryLogPolicyConditionconditionPolicy match condition.
ActiveFromDateTimeOffsetactiveFromInclusive activation time in milliseconds since epoch.
ActiveUntilDateTimeOffsetactiveUntilExclusive deactivation time in milliseconds since epoch. (optional)
LabelsIReadOnlyDictionary<string, string>labelsOperator labels for listing and administration.
CurrentlyActiveboolcurrentlyActiveWhether the policy is active at response evaluation time.
DeletedAtDateTimeOffsetdeletedAtTombstone time in milliseconds since epoch. (optional)
DeletedByIdstringdeletedByIdUser UUID that tombstoned the policy. (optional)
DeleteReasonstringdeleteReasonOptional tombstone reason. (optional)
CreatedAtDateTimeOffsetcreatedAtCreation time in milliseconds since epoch.
UpdatedAtDateTimeOffsetupdatedAtUpdate time in milliseconds since epoch.
CreatedByIdstringcreatedByIdCreator user UUID.
UpdatedByIdstringupdatedByIdLast-updater user UUID.

DeleteRetrieveMemoryLogPolicyRequest

Optional REST body for tombstoning a RetrieveMemory log policy.

PropertyTypeJSON (wire)Description
ReasonstringreasonOptional tombstone reason. (optional)

ListRetrieveMemoryLogPoliciesResponse

REST response containing a page of RetrieveMemory log policies.

PropertyTypeJSON (wire)Description
PoliciesIReadOnlyList<RetrieveMemoryLogPolicy>policiesPolicy page.
NextTokenstringnextTokenOpaque token for the next page. (optional)