Liking cljdoc? Tell your friends :D

goog.workspace.vault

Clojure wrapper for the Google Vault API (v1).

Provides idiomatic Clojure functions for eDiscovery and compliance workflows: matters (cases), legal holds, exports, saved queries, and long-running operations.

Auth: use csl/scoped-delegated-credentials or csl/user-credentials with the appropriate scope. Note that the scope URL uses 'ediscovery', NOT 'vault':

Vault requires a Workspace plan that includes Vault (Business Plus, Enterprise, Education Plus) and an admin role with eDiscovery privileges (typically super-admin or a custom role granting Vault access).

All list functions return {:data [...] :next-page-token "..."}. :next-page-token is absent when there are no further pages.

Matters have a lifecycle distinct from CRUD: close-matter, reopen-matter, and undelete-matter are POST operations that transition state and return the updated matter.

count-matter-artifacts initiates a long-running Operation. Use wait-for-operation to poll until completion.

All functions return {:data ...} on success or {:error ...} on failure.

Clojure wrapper for the Google Vault API (v1).

Provides idiomatic Clojure functions for eDiscovery and compliance workflows:
matters (cases), legal holds, exports, saved queries, and long-running
operations.

Auth: use csl/scoped-delegated-credentials or csl/user-credentials with the
appropriate scope. Note that the scope URL uses 'ediscovery', NOT 'vault':
- VaultScopes/EDISCOVERY          (full read/write — https://www.googleapis.com/auth/ediscovery)
- VaultScopes/EDISCOVERY_READONLY (read-only       — https://www.googleapis.com/auth/ediscovery.readonly)

Vault requires a Workspace plan that includes Vault (Business Plus,
Enterprise, Education Plus) and an admin role with eDiscovery privileges
(typically super-admin or a custom role granting Vault access).

All list functions return {:data [...] :next-page-token "..."}.
:next-page-token is absent when there are no further pages.

Matters have a lifecycle distinct from CRUD: close-matter, reopen-matter, and
undelete-matter are POST operations that transition state and return the
updated matter.

count-matter-artifacts initiates a long-running Operation. Use
wait-for-operation to poll until completion.

All functions return {:data ...} on success or {:error ...} on failure.
raw docstring

add-held-accountsclj

(add-held-accounts client matter-id hold-id request & [opts])

Add accounts to a hold in bulk.

request — map with kebab-case keys (exactly one of these is required): :account-ids — vector of account IDs to add to the hold :emails — vector of email addresses (resolved server-side to accounts)

opts:

  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Add accounts to a hold in bulk.

request — map with kebab-case keys (exactly one of these is required):
  :account-ids — vector of account IDs to add to the hold
  :emails      — vector of email addresses (resolved server-side to accounts)

opts:
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

add-matter-permissionsclj

(add-matter-permissions client matter-id request & [opts])

Add a permission to a matter (grant a user access at a specific role).

request — map with kebab-case keys: :matter-permission — required; map with :account-id and :role ("COLLABORATOR" or "OWNER") :send-emails — boolean; whether to notify the user :cc-me — boolean; whether to CC the caller on notification

opts:

  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Add a permission to a matter (grant a user access at a specific role).

request — map with kebab-case keys:
  :matter-permission — required; map with :account-id and :role
                       ("COLLABORATOR" or "OWNER")
  :send-emails       — boolean; whether to notify the user
  :cc-me             — boolean; whether to CC the caller on notification

opts:
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

cancel-operationclj

(cancel-operation client operation-name & [opts])

Request cancellation of a long-running operation. The server makes a best- effort attempt to cancel; the operation's eventual :done state will indicate the result.

opts:

  • :read-timeout-ms — int, override the HTTP client's default read timeout
Request cancellation of a long-running operation. The server makes a best-
effort attempt to cancel; the operation's eventual :done state will indicate
the result.

opts:
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

close-matterclj

(close-matter client matter-id & [opts])

Close a matter. Closed matters are read-only; reopen with reopen-matter.

opts:

  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Close a matter. Closed matters are read-only; reopen with reopen-matter.

opts:
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

count-matter-artifactsclj

(count-matter-artifacts client matter-id request & [opts])

Initiate a count of artifacts matching a query in a matter. Returns a long-running Operation; poll with wait-for-operation to retrieve the count.

request — map with kebab-case keys. Required: :query — Query map (corpus, data-scope, search-method, etc.) Optional: :view — "TOTAL_COUNT" (default) or "ALL" for per-account breakdown :matter-permission — MatterPermission map for access checks

opts:

  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Initiate a count of artifacts matching a query in a matter. Returns a
long-running Operation; poll with wait-for-operation to retrieve the count.

request — map with kebab-case keys. Required:
  :query — Query map (corpus, data-scope, search-method, etc.)
Optional:
  :view  — "TOTAL_COUNT" (default) or "ALL" for per-account breakdown
  :matter-permission — MatterPermission map for access checks

opts:
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

create-exportclj

(create-export client matter-id export & [opts])

Initiate an export of matter data. Returns the Export resource immediately; the actual archive build is asynchronous. Poll with get-export until :status is "COMPLETED" (or "FAILED"). The archive URIs live in :cloud-storage-sink on the completed Export.

export — map with kebab-case keys. Required: :name — display name :query — Query map (corpus, data-scope, search-method, etc.) Optional: :export-options — ExportOptions map (region, format, etc.) :matter-permission — MatterPermission map for access checks

opts:

  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Initiate an export of matter data. Returns the Export resource immediately;
the actual archive build is asynchronous. Poll with get-export until
:status is "COMPLETED" (or "FAILED"). The archive URIs live in
:cloud-storage-sink on the completed Export.

export — map with kebab-case keys. Required:
  :name  — display name
  :query — Query map (corpus, data-scope, search-method, etc.)
Optional:
  :export-options    — ExportOptions map (region, format, etc.)
  :matter-permission — MatterPermission map for access checks

opts:
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

create-held-accountclj

(create-held-account client matter-id hold-id account & [opts])

Add a single account to a hold.

account — map with kebab-case keys (exactly one of these is required): :account-id — account ID :email — email address (resolved server-side)

opts:

  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Add a single account to a hold.

account — map with kebab-case keys (exactly one of these is required):
  :account-id — account ID
  :email      — email address (resolved server-side)

opts:
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

create-holdclj

(create-hold client matter-id hold & [opts])

Create a hold within a matter.

hold — map with kebab-case keys. Required: :name — display name :corpus — one of "MAIL", "DRIVE", "GROUPS", "HANGOUTS_CHAT", "VOICE", "CALENDAR" Optional: :query — Query map narrowing the data placed on hold :accounts — vector of HeldAccount maps to include at creation time :org-unit — OrgUnit map (alternative to :accounts for org-wide holds)

opts:

  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Create a hold within a matter.

hold — map with kebab-case keys. Required:
  :name   — display name
  :corpus — one of "MAIL", "DRIVE", "GROUPS", "HANGOUTS_CHAT",
            "VOICE", "CALENDAR"
Optional:
  :query    — Query map narrowing the data placed on hold
  :accounts — vector of HeldAccount maps to include at creation time
  :org-unit — OrgUnit map (alternative to :accounts for org-wide holds)

opts:
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

create-matterclj

(create-matter client matter & [opts])

Create a new matter.

matter — map with kebab-case keys. Required: :name — display name of the matter Optional: :description — free-text description

opts:

  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Create a new matter.

matter — map with kebab-case keys. Required:
  :name        — display name of the matter
Optional:
  :description — free-text description

opts:
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

create-saved-queryclj

(create-saved-query client matter-id saved-query & [opts])

Save a query for reuse within a matter.

saved-query — map with kebab-case keys. Required: :display-name — user-visible name for the saved query :query — Query map (corpus, data-scope, search-method, etc.)

opts:

  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Save a query for reuse within a matter.

saved-query — map with kebab-case keys. Required:
  :display-name — user-visible name for the saved query
  :query        — Query map (corpus, data-scope, search-method, etc.)

opts:
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

delete-exportclj

(delete-export client matter-id export-id & [opts])

Delete an export. The export's archive in cloud storage is removed.

opts:

  • :read-timeout-ms — int, override the HTTP client's default read timeout
Delete an export. The export's archive in cloud storage is removed.

opts:
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

delete-held-accountclj

(delete-held-account client matter-id hold-id account-id & [opts])

Remove a single account from a hold by account ID.

opts:

  • :read-timeout-ms — int, override the HTTP client's default read timeout
Remove a single account from a hold by account ID.

opts:
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

delete-holdclj

(delete-hold client matter-id hold-id & [opts])

Delete a hold from a matter.

opts:

  • :read-timeout-ms — int, override the HTTP client's default read timeout
Delete a hold from a matter.

opts:
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

delete-matterclj

(delete-matter client matter-id & [opts])

Delete a matter. Soft-delete only — use undelete-matter to restore.

opts:

  • :read-timeout-ms — int, override the HTTP client's default read timeout
Delete a matter. Soft-delete only — use undelete-matter to restore.

opts:
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

delete-operationclj

(delete-operation client operation-name & [opts])

Delete a long-running operation's bookkeeping. Does not cancel the operation; use cancel-operation for that. Returns {:data :deleted} on success.

opts:

  • :read-timeout-ms — int, override the HTTP client's default read timeout
Delete a long-running operation's bookkeeping. Does not cancel the operation;
use cancel-operation for that. Returns {:data :deleted} on success.

opts:
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

delete-saved-queryclj

(delete-saved-query client matter-id saved-query-id & [opts])

Delete a saved query.

opts:

  • :read-timeout-ms — int, override the HTTP client's default read timeout
Delete a saved query.

opts:
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

get-exportclj

(get-export client matter-id export-id & [opts])

Get an export by ID within a matter. Use this to poll an in-progress export until its :status reaches "COMPLETED" (or "FAILED").

opts:

  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Get an export by ID within a matter. Use this to poll an in-progress export
until its :status reaches "COMPLETED" (or "FAILED").

opts:
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

get-holdclj

(get-hold client matter-id hold-id & [opts])

Get a hold by ID within a matter.

opts:

  • :view — "BASIC" or "FULL" (FULL includes accounts/orgUnit)
  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Get a hold by ID within a matter.

opts:
- :view            — "BASIC" or "FULL" (FULL includes accounts/orgUnit)
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

get-matterclj

(get-matter client matter-id & [opts])

Get a matter by ID.

opts:

  • :view — "BASIC" or "FULL" (controls level of detail)
  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Get a matter by ID.

opts:
- :view            — "BASIC" or "FULL" (controls level of detail)
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

get-operationclj

(get-operation client operation-name & [opts])

Get a long-running operation by name. Returned operation has :done (boolean), :metadata (operation-specific progress info), and either :response (when done successfully) or :error (when done with failure).

opts:

  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Get a long-running operation by name. Returned operation has :done (boolean),
:metadata (operation-specific progress info), and either :response (when done
successfully) or :error (when done with failure).

opts:
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

get-saved-queryclj

(get-saved-query client matter-id saved-query-id & [opts])

Get a saved query by ID within a matter.

opts:

  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Get a saved query by ID within a matter.

opts:
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

list-exportsclj

(list-exports client matter-id & [opts])

List exports within a matter.

opts:

  • :page-token — token from a previous response
  • :page-size — max exports per page (1–100; API default 100)
  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
List exports within a matter.

opts:
- :page-token      — token from a previous response
- :page-size       — max exports per page (1–100; API default 100)
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

list-held-accountsclj

(list-held-accounts client matter-id hold-id & [opts])

List accounts on a hold.

The Vault API does not paginate this endpoint — all accounts are returned in a single response. Result shape: {:data [...]} with no :next-page-token.

opts:

  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
List accounts on a hold.

The Vault API does not paginate this endpoint — all accounts are returned in
a single response. Result shape: {:data [...]} with no :next-page-token.

opts:
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

list-holdsclj

(list-holds client matter-id & [opts])

List holds within a matter.

opts:

  • :page-token — token from a previous response
  • :page-size — max holds per page (1–100; API default 100)
  • :view — "BASIC" or "FULL"
  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
List holds within a matter.

opts:
- :page-token      — token from a previous response
- :page-size       — max holds per page (1–100; API default 100)
- :view            — "BASIC" or "FULL"
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

list-mattersclj

(list-matters client & [opts])

List matters accessible to the caller.

opts:

  • :page-token — token from a previous response
  • :page-size — max matters per page (1–100; API default 100)
  • :view — "BASIC" or "FULL"
  • :state — "OPEN", "CLOSED", or "DELETED" — filter by state
  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
List matters accessible to the caller.

opts:
- :page-token      — token from a previous response
- :page-size       — max matters per page (1–100; API default 100)
- :view            — "BASIC" or "FULL"
- :state           — "OPEN", "CLOSED", or "DELETED" — filter by state
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

list-operationsclj

(list-operations client & [opts])

List long-running operations.

opts:

  • :filter — server-side filter expression (e.g. "done=false")
  • :page-token — token from a previous response
  • :page-size — max operations per page (1–100)
  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
List long-running operations.

opts:
- :filter          — server-side filter expression (e.g. "done=false")
- :page-token      — token from a previous response
- :page-size       — max operations per page (1–100)
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

list-saved-queriesclj

(list-saved-queries client matter-id & [opts])

List saved queries within a matter.

opts:

  • :page-token — token from a previous response
  • :page-size — max saved queries per page (1–100; API default 100)
  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
List saved queries within a matter.

opts:
- :page-token      — token from a previous response
- :page-size       — max saved queries per page (1–100; API default 100)
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

remove-held-accountsclj

(remove-held-accounts client matter-id hold-id request & [opts])

Remove accounts from a hold in bulk.

request — map with kebab-case keys: :account-ids — required; vector of account IDs to remove from the hold

opts:

  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Remove accounts from a hold in bulk.

request — map with kebab-case keys:
  :account-ids — required; vector of account IDs to remove from the hold

opts:
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

remove-matter-permissionsclj

(remove-matter-permissions client matter-id request & [opts])

Remove a user's permission from a matter.

request — map with kebab-case keys: :account-id — required; the account whose permission is removed

opts:

  • :read-timeout-ms — int, override the HTTP client's default read timeout
Remove a user's permission from a matter.

request — map with kebab-case keys:
  :account-id — required; the account whose permission is removed

opts:
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

reopen-matterclj

(reopen-matter client matter-id & [opts])

Reopen a closed matter. The matter returns to OPEN state.

opts:

  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Reopen a closed matter. The matter returns to OPEN state.

opts:
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

replace-holdclj

(replace-hold client matter-id hold-id hold & [opts])

Fully replace a hold (PUT semantics). The entire hold resource is replaced with the provided data; omitted fields are cleared. Vault does not expose a PATCH endpoint for holds.

opts:

  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Fully replace a hold (PUT semantics). The entire hold resource is replaced
with the provided data; omitted fields are cleared. Vault does not expose a
PATCH endpoint for holds.

opts:
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

replace-matterclj

(replace-matter client matter-id matter & [opts])

Fully replace a matter (PUT semantics). The entire matter resource is replaced with the provided data; omitted fields are cleared. Vault does not expose a PATCH endpoint for matters.

opts:

  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Fully replace a matter (PUT semantics). The entire matter resource is replaced
with the provided data; omitted fields are cleared. Vault does not expose a
PATCH endpoint for matters.

opts:
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

undelete-matterclj

(undelete-matter client matter-id & [opts])

Restore a deleted matter. The matter returns to OPEN state.

opts:

  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Restore a deleted matter. The matter returns to OPEN state.

opts:
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

vault-clientclj

(vault-client credentials)
(vault-client credentials opts)

Build an authenticated Vault v1 REST client.

credentials — a com.google.auth.oauth2.GoogleCredentials instance, typically from csl/scoped-delegated-credentials or csl/user-credentials with one of the VaultScopes scopes (EDISCOVERY or EDISCOVERY_READONLY).

opts (optional):

  • :read-timeout-ms per-client default read timeout (default 120000 / 120s)
  • :connect-timeout-ms per-client default connect timeout (default 30000 / 30s)

Per-request opts on individual call sites override the client-level defaults.

Build an authenticated Vault v1 REST client.

credentials — a com.google.auth.oauth2.GoogleCredentials instance, typically
from csl/scoped-delegated-credentials or csl/user-credentials with one of
the VaultScopes scopes (EDISCOVERY or EDISCOVERY_READONLY).

opts (optional):
- :read-timeout-ms     per-client default read timeout (default 120000 / 120s)
- :connect-timeout-ms  per-client default connect timeout (default 30000 / 30s)

Per-request opts on individual call sites override the client-level defaults.
raw docstring

wait-for-operationclj

(wait-for-operation client operation-name & [opts])

Poll a long-running Operation until it reports :done true, or until :timeout-ms elapses.

operation-name — the full resource name returned by the initiating call (typically the :name field of the Operation map).

opts:

  • :poll-interval-ms — int, milliseconds between polls (default 5000)
  • :timeout-ms — int, overall deadline in milliseconds (default 600000 = 10 minutes)
  • :read-timeout-ms — int, per-poll HTTP read timeout

Returns {:data <operation-map>} when the operation reports done=true, or {:error ...} on timeout or on the first polling failure. Note the returned operation map may itself contain :error — that's the operation's own failure result, distinct from a polling failure.

Delegates the polling loop to csl/wait-for-operation; this fn is a thin library-specific shim that closes over Vault's get-operation.

Poll a long-running Operation until it reports :done true, or until
:timeout-ms elapses.

operation-name — the full resource name returned by the initiating call
                 (typically the :name field of the Operation map).

opts:
- :poll-interval-ms — int, milliseconds between polls (default 5000)
- :timeout-ms       — int, overall deadline in milliseconds (default 600000
                      = 10 minutes)
- :read-timeout-ms  — int, per-poll HTTP read timeout

Returns {:data <operation-map>} when the operation reports done=true, or
{:error ...} on timeout or on the first polling failure. Note the returned
operation map may itself contain :error — that's the operation's own
failure result, distinct from a polling failure.

Delegates the polling loop to csl/wait-for-operation; this fn is a thin
library-specific shim that closes over Vault's get-operation.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close