manager/client.ts
Source: sdks/typescript/packages/sdk/src/manager/client.ts. Back to the TypeScript SDK reference index.
This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.
Interface ManagerClientOptions
Options of ManagerClient: URL, token, on behalf of user, locale, fetch, retries, timeout and headers.
Fields:
| Name | Type | Required | Description |
|---|---|---|---|
baseUrl | string | yes | Platform Manager URL, for example <manager-url> (https, or http on localhost). |
token | string | (() => string | Promise<string>) | no | Manager API token nmt_<12 hex>_<secret> (string or async provider reading a secret store). |
onBehalfOf | string | no | User the service token acts for: sends X-NM-On-Behalf-Of (token with the explicit auth:delegate permission). |
locale | Locale | no | Language of the messages, en (default) or fr. |
fetch | FetchLike | no | fetch implementation to use; defaults to the global fetch. |
retries | number | no | Number of retries of GET, PUT and DELETE on 429, 5xx and network errors (default 2); POST is never retried. |
timeoutMs | number | no | Per request timeout in ms (default 60000, 0 disables). |
headers | Record<string | no | Headers of the event, string values. The trace context is added. |
sleep | (ms: number) => Promise<void> | no | Sleep function used between retries (injectable for tests). |
Interface ManagerClient
Client of the Platform Manager API (hosts, clusters, services, HA, backups, restores, DR), one generated sub-client per group of manager-openapi.json.
Groups
This model declares no field.
Class ManagerClient
Client of the Platform Manager API (hosts, clusters, services, HA, backups, restores, DR), one generated sub-client per group of manager-openapi.json.
Attributes:
| Name | Type | Required | Description |
|---|---|---|---|
http | HttpClient | yes | HTTP transport shared by every sub-client. |
Constructor ManagerClient
new ManagerClient(options: ManagerClientOptions)
Checks the token format nmt_<12 hex>_<secret>, sets X-NM-On-Behalf-Of when asked and creates every sub-client.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
options | ManagerClientOptions | yes | Per call options (idempotency key, traceparent, headers, abort signal). |
ManagerClient.onBehalfOf
onBehalfOf(user: string): ManagerClient
A client with the same settings acting on behalf of user.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
user | string | yes | User the service token acts for, sent as X-NM-On-Behalf-Of. |
Returns: ManagerClient. A new ManagerClient; the current one is unchanged.
ManagerClient.operation
operation(operationId: string): (...args: unknown[]) => Promise<unknown>
Calls an operation of manager-openapi.json by operationId (path parameters in template order).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
operationId | string | yes | operationId of manager-openapi.json; an unknown one throws an Error. |
Returns: (...args: unknown[]) => Promise<unknown>. The bound method of the sub-client that wraps the operation.
Raises: Error.
ManagerClient.toJSON
toJSON(): Record<string, unknown>
Safe view of the client for logs: base URL, locale, masked token and onBehalfOf.
This element takes no parameter.
Returns: Record<string, unknown>. Object without any clear secret.