Help us shape the future of Go! Take the 2026 Go Developer Survey

temporal

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 20 Imported by: 0

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

func CountCalls(ctx context.Context, n *atomic.Int64) context.Context

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 IsCloud

func IsCloud(address string) bool

IsCloud reports whether address is a Temporal Cloud namespace or regional endpoint.

func WithTool

func WithTool(ctx context.Context, name string, rpcs, targets []string) context.Context

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) Client

func (c *Clients) Client(name string) client.Client

Client returns the client for the target with the given name.

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

func WithPlaintextCloudOpsAPI(address string) Option

WithPlaintextCloudOpsAPI makes the clients call the Temporal Cloud Ops API at address, in plaintext, rather than at its public endpoint.

func WithRootCAs

func WithRootCAs(pool *x509.CertPool) Option

WithRootCAs makes the clients trust only the CAs in pool, rather than the system's, when they connect to targets with a client certificate.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL