Class: CloudOperationsClient
cloud.CloudOperationsClient
High level client for the Temporal Cloud API.
The Temporal Cloud Operations Client API is an experimental feature and may be subject to change.
Constructors
constructor
• new CloudOperationsClient(options): CloudOperationsClient
Parameters
| Name | Type |
|---|---|
options | CloudOperationsClientOptions |
Returns
Properties
connection
• Readonly connection: CloudOperationsConnection
The underlying connection used by this client.
Clients are cheap to create, but connections are expensive. Where it makes sense,
a single connection may and should be reused by multiple CloudOperationsClients.
options
• Readonly options: Readonly<CloudOperationsClientOptions>
Accessors
cloudService
• get cloudService(): CloudService
Raw gRPC access to the Temporal Cloud Operations service.
NOTE: The Temporal Cloud Operations service API Version provided in options is not automatically set on requests made via the raw gRPC service object. If the namespace requires it, you may need to do the following:
const metadata: Metadata = { ['temporal-cloud-api-version']: apiVersion }
const response = await client.withMetadata(metadata, async () => {
return client.cloudService.getNamespace({ namespace });
});
Returns
Methods
withAbortSignal
▸ withAbortSignal<R>(abortSignal, fn): Promise<R>
Set an AbortSignal that, when aborted, cancels any ongoing service requests executed in
fn's scope. This will locally result in the request call throwing a grpc.ServiceError|ServiceError
with code grpc.status.CANCELLED|CANCELLED; see isGrpcCancelledError.
This method is only a convenience wrapper around CloudOperationsConnection.withAbortSignal.
Type parameters
| Name |
|---|
R |
Parameters
| Name | Type |
|---|---|
abortSignal | AbortSignal |
fn | () => Promise<R> |
Returns
Promise<R>
value returned from fn
Example
const ctrl = new AbortController();
setTimeout(() => ctrl.abort(), 10_000);
// 👇 throws if incomplete by the timeout.
await conn.withAbortSignal(ctrl.signal, () => client.cloudService.getNamespace({ namespace }));
See
https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
withDeadline
▸ withDeadline<R>(deadline, fn): Promise<R>
Set a deadline for any service requests executed in fn's scope.
The deadline is a point in time after which any pending gRPC request will be considered as failed; this will locally result in the request call throwing a grpc.ServiceError|ServiceError with code grpc.status.DEADLINE_EXCEEDED|DEADLINE_EXCEEDED; see isGrpcDeadlineError.
It is stronly recommended to explicitly set deadlines. If no deadline is set, then it is possible for the client to end up waiting forever for a response.
This method is only a convenience wrapper around CloudOperationsConnection.withDeadline.
Type parameters
| Name |
|---|
R |
Parameters
| Name | Type | Description |
|---|---|---|
deadline | number | Date | a point in time after which the request will be considered as failed; either a Date object, or a number of milliseconds since the Unix epoch (UTC). |
fn | () => Promise<R> | - |
Returns
Promise<R>
the value returned from fn
See
https://grpc.io/docs/guides/deadlines/
withMetadata
▸ withMetadata<R>(metadata, fn): Promise<R>
Set metadata for any service requests executed in fn's scope.
Type parameters
| Name |
|---|
R |
Parameters
| Name | Type |
|---|---|
metadata | Metadata |
fn | () => Promise<R> |
Returns
Promise<R>
returned value of fn
This method is only a convenience wrapper around CloudOperationsConnection.withMetadata.