Class: CloudOperationsClient
Experimental
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
Experimental
Parameters
options
Returns
CloudOperationsClient
Properties
connection
readonlyconnection:CloudOperationsConnection
Experimental
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
readonlyoptions:Readonly<CloudOperationsClientOptions>
Experimental
Accessors
cloudService
Get Signature
get cloudService():
CloudService
Experimental
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>
Experimental
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
R
R
Parameters
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>
Experimental
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
R
R
Parameters
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>
Experimental
Set metadata for any service requests executed in fn's scope.
Type Parameters
R
R
Parameters
metadata
fn
() => Promise<R>
Returns
Promise<R>
returned value of fn
This method is only a convenience wrapper around CloudOperationsConnection.withMetadata.