Documentation
¶
Overview ¶
Package temporal provides one Temporal client per target, plus a Cloud Ops API client for each Temporal Cloud target with an API key, and limits the calls each tool can make through them. Each call's API key comes from a credential that sees the caller.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountCalls ¶
CountCalls returns a context whose Temporal calls are counted in n: those that pass the limits set by WithTool, with every attempt of a retried call counted.
func WithTool ¶
WithTool returns a context for Temporal calls made by the named tool, which may call only the given Temporal RPCs (full gRPC method names) and only on the targets with the given names. A request with a namespace field must set it to the target's configured namespace; an empty one is rejected. RPCs whose requests lack the field, such as ListNamespaces and the Nexus endpoint RPCs, are limited only by the RPC list. A Temporal call whose context lacks a tool is rejected.
Types ¶
type Clients ¶
type Clients struct {
// contains filtered or unexported fields
}
Clients holds a Temporal client for each target.
func NewClients ¶
func NewClients(targets []config.Target, name, version string, logger *slog.Logger, opts ...Option) (*Clients, error)
NewClients returns the clients for targets. Calls identify this server by name and version in the gRPC user agent and the client-name and client-version headers. The clients log to logger. It fails if a client certificate cannot be loaded, if a target's address cannot be parsed, or if a Cloud Ops API client cannot be created.
func (*Clients) CloudOps ¶
func (c *Clients) CloudOps(name string) cloudservice.CloudServiceClient
CloudOps returns the Temporal Cloud Ops API client for the target with the given name, or nil if the target is not on Temporal Cloud or has no API key.
type Option ¶
type Option func(*options)
An Option changes how NewClients connects. Options are for tests.
func WithPlaintextCloudOpsAPI ¶
WithPlaintextCloudOpsAPI makes the clients call the Temporal Cloud Ops API at address, in plaintext, rather than at its public endpoint.
func WithRootCAs ¶
WithRootCAs makes the clients trust only the CAs in pool, rather than the system's, when they connect to targets with a client certificate.