zbc

package
v8.5.9 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 31 Imported by: 22

Documentation

Index

Constants

View Source
const CaCertificatePath = "ZEEBE_CA_CERTIFICATE_PATH"
View Source
const DefaultAddressHost = "127.0.0.1"
View Source
const DefaultAddressPort = "26500"
View Source
const DefaultKeepAlive = 45 * time.Second
View Source
const DefaultOAuthCacheFile = "credentials"
View Source
const DefaultOAuthCacheFileDir = ".camunda"
View Source
const ErrFileNotFound = Error("file not found")

ErrFileNotFound is returned whenever a file can't be found at the provided path. Use this value to do error comparison.

View Source
const ErrOAuthCredentialsCacheFolderIsNotDir = Error("OAuth credentials cache folder is not a directory, cannot create cache file under it")
View Source
const ErrOAuthCredentialsCacheIsDir = Error("OAuth credentials cache must be a file, not a directory")
View Source
const GatewayAddressEnvVar = "ZEEBE_ADDRESS"
View Source
const GatewayHostEnvVar = "ZEEBE_HOST"
View Source
const GatewayPortEnvVar = "ZEEBE_PORT"
View Source
const InsecureEnvVar = "ZEEBE_INSECURE_CONNECTION"
View Source
const KeepAliveEnvVar = "ZEEBE_KEEP_ALIVE"
View Source
const OAuthAuthorizationUrlEnvVar = "ZEEBE_AUTHORIZATION_SERVER_URL"
View Source
const OAuthCachePathEnvVar = "ZEEBE_CLIENT_CONFIG_PATH"
View Source
const OAuthClientIdEnvVar = "ZEEBE_CLIENT_ID"
View Source
const OAuthClientSecretEnvVar = "ZEEBE_CLIENT_SECRET"

#nosec 101

View Source
const OAuthDefaultAuthzURL = "https://login.cloud.camunda.io/oauth/token/"

OAuthDefaultAuthzURL points to the expected default URL for this credentials provider, the Camunda Cloud endpoint.

View Source
const OAuthDefaultRequestTimeout = 10 * time.Second

OAuthDefaultRequestTimeout is the default timeout for OAuth requests

View Source
const OAuthRequestTimeoutEnvVar = "ZEEBE_AUTH_REQUEST_TIMEOUT"
View Source
const OAuthTokenAudienceEnvVar = "ZEEBE_TOKEN_AUDIENCE"

#nosec 101

View Source
const OAuthTokenScopeEnvVar = "ZEEBE_TOKEN_SCOPE"

#nosec 101

View Source
const OverrideAuthorityEnvVar = "ZEEBE_OVERRIDE_AUTHORITY"

Variables

View Source
var DefaultOauthYamlCachePath = getDefaultOAuthYamlCredentialsCachePath()
View Source
var Version = embedded.Version

Version specifies the client's version; this is used as part of the user agent string, for example

Functions

This section is empty.

Types

type Client

type Client interface {
	NewTopologyCommand() *commands.TopologyCommand
	// Deprecated: Use NewDeployResourceCommand instead. To be removed in 8.1.0.
	NewDeployProcessCommand() *commands.DeployCommand
	NewDeployResourceCommand() *commands.DeployResourceCommand

	NewCreateInstanceCommand() commands.CreateInstanceCommandStep1
	NewCancelInstanceCommand() commands.CancelInstanceStep1
	NewSetVariablesCommand() commands.SetVariablesCommandStep1
	NewResolveIncidentCommand() commands.ResolveIncidentCommandStep1

	NewEvaluateDecisionCommand() commands.EvaluateDecisionCommandStep1

	NewPublishMessageCommand() commands.PublishMessageCommandStep1

	NewBroadcastSignalCommand() commands.BroadcastSignalCommandStep1

	NewActivateJobsCommand() commands.ActivateJobsCommandStep1
	NewStreamJobsCommand() commands.StreamJobsCommandStep1
	NewCompleteJobCommand() commands.CompleteJobCommandStep1
	NewFailJobCommand() commands.FailJobCommandStep1
	NewUpdateJobRetriesCommand() commands.UpdateJobRetriesCommandStep1
	NewUpdateJobTimeoutCommand() commands.UpdateJobTimeoutCommandStep1
	NewThrowErrorCommand() commands.ThrowErrorCommandStep1
	NewDeleteResourceCommand() commands.DeleteResourceCommandStep1

	NewJobWorker() worker.JobWorkerBuilderStep1

	Close() error
}

func NewClient

func NewClient(config *ClientConfig) (Client, error)

type ClientConfig

type ClientConfig struct {
	GatewayAddress         string
	UsePlaintextConnection bool
	CaCertificatePath      string
	OverrideAuthority      string
	CredentialsProvider    CredentialsProvider

	// KeepAlive can be used configure how often keep alive messages should be sent to the gateway. These will be sent
	// whether or not there are active requests. Negative values will result in error and zero will result in the default
	// of 45 seconds being used
	KeepAlive time.Duration

	// UserAgent is an optional field, to specify the user-agent header which should be sent by each
	// gRPC request. Defaults to zeebe-client-go/%version.
	UserAgent string
	DialOpts  []grpc.DialOption
}

type ClientImpl

type ClientImpl struct {
	// contains filtered or unexported fields
}

func (*ClientImpl) Close

func (c *ClientImpl) Close() error

func (*ClientImpl) NewActivateJobsCommand

func (c *ClientImpl) NewActivateJobsCommand() commands.ActivateJobsCommandStep1

func (*ClientImpl) NewBroadcastSignalCommand added in v8.2.0

func (c *ClientImpl) NewBroadcastSignalCommand() commands.BroadcastSignalCommandStep1

func (*ClientImpl) NewCancelInstanceCommand

func (c *ClientImpl) NewCancelInstanceCommand() commands.CancelInstanceStep1

func (*ClientImpl) NewCompleteJobCommand

func (c *ClientImpl) NewCompleteJobCommand() commands.CompleteJobCommandStep1

func (*ClientImpl) NewCreateInstanceCommand

func (c *ClientImpl) NewCreateInstanceCommand() commands.CreateInstanceCommandStep1

func (*ClientImpl) NewDeleteResourceCommand added in v8.3.0

func (c *ClientImpl) NewDeleteResourceCommand() commands.DeleteResourceCommandStep1

func (*ClientImpl) NewDeployProcessCommand

func (c *ClientImpl) NewDeployProcessCommand() *commands.DeployCommand

func (*ClientImpl) NewDeployResourceCommand

func (c *ClientImpl) NewDeployResourceCommand() *commands.DeployResourceCommand

func (*ClientImpl) NewEvaluateDecisionCommand added in v8.2.0

func (c *ClientImpl) NewEvaluateDecisionCommand() commands.EvaluateDecisionCommandStep1

func (*ClientImpl) NewFailJobCommand

func (c *ClientImpl) NewFailJobCommand() commands.FailJobCommandStep1

func (*ClientImpl) NewJobWorker

func (c *ClientImpl) NewJobWorker() worker.JobWorkerBuilderStep1

func (*ClientImpl) NewPublishMessageCommand

func (c *ClientImpl) NewPublishMessageCommand() commands.PublishMessageCommandStep1

func (*ClientImpl) NewResolveIncidentCommand

func (c *ClientImpl) NewResolveIncidentCommand() commands.ResolveIncidentCommandStep1

func (*ClientImpl) NewSetVariablesCommand

func (c *ClientImpl) NewSetVariablesCommand() commands.SetVariablesCommandStep1

func (*ClientImpl) NewStreamJobsCommand added in v8.4.0

func (c *ClientImpl) NewStreamJobsCommand() commands.StreamJobsCommandStep1

func (*ClientImpl) NewThrowErrorCommand

func (c *ClientImpl) NewThrowErrorCommand() commands.ThrowErrorCommandStep1

func (*ClientImpl) NewTopologyCommand

func (c *ClientImpl) NewTopologyCommand() *commands.TopologyCommand

func (*ClientImpl) NewUpdateJobRetriesCommand

func (c *ClientImpl) NewUpdateJobRetriesCommand() commands.UpdateJobRetriesCommandStep1

func (*ClientImpl) NewUpdateJobTimeoutCommand added in v8.4.0

func (c *ClientImpl) NewUpdateJobTimeoutCommand() commands.UpdateJobTimeoutCommandStep1

type CredentialsProvider

type CredentialsProvider interface {
	// Takes a map of gRPC headers as defined in credentials.PerRPCCredentials and adds credentials to them.
	ApplyCredentials(ctx context.Context, headers map[string]string) error
	// Returns true if the request should be retried, false otherwise.
	ShouldRetryRequest(ctx context.Context, err error) bool
}

CredentialsProvider is responsible for adding credentials to each gRPC call's headers.

type Error

type Error string

func (Error) Error

func (e Error) Error() string

type OAuthCredentialsCache

type OAuthCredentialsCache interface {
	// Refresh should clear and re-populate the cache from defaults
	Refresh() error
	// Get should return the cached credentials for the given audience, or nil
	Get(audience string) *oauth2.Token
	// Update should set the credentials as the cached credentials for the given audience
	Update(audience string, token *oauth2.Token) error
}

OAuthCredentialsCache is used to cache results of fetching OAuth credentials

func NewOAuthYamlCredentialsCache

func NewOAuthYamlCredentialsCache(path string) (OAuthCredentialsCache, error)

type OAuthCredentialsProvider

type OAuthCredentialsProvider struct {
	Audience    string
	TokenConfig *clientcredentials.Config
	Cache       OAuthCredentialsCache
	// contains filtered or unexported fields
}

OAuthCredentialsProvider is a built-in CredentialsProvider that contains credentials obtained from an OAuth authorization server, including a token prefix and an access token. Using these values it sets the 'Authorization' header of each gRPC call.

func NewOAuthCredentialsProvider

func NewOAuthCredentialsProvider(config *OAuthProviderConfig) (*OAuthCredentialsProvider, error)

NewOAuthCredentialsProvider requests credentials from an authorization server and uses them to create an OAuthCredentialsProvider.

func (*OAuthCredentialsProvider) ApplyCredentials

func (p *OAuthCredentialsProvider) ApplyCredentials(ctx context.Context, headers map[string]string) error

ApplyCredentials takes a map of headers as input and adds an access token prefixed by a token type to the 'Authorization' header of a gRPC call.

func (*OAuthCredentialsProvider) ShouldRetryRequest

func (p *OAuthCredentialsProvider) ShouldRetryRequest(ctx context.Context, err error) bool

ShouldRetryRequest checks if the error is UNAUTHENTICATED and, if so, attempts to refresh the access token. If the new credentials are different from the stored ones, returns true. If the credentials are the same, returns false.

type OAuthProviderConfig

type OAuthProviderConfig struct {
	// The client identifier used to request an access token. Can be overridden with the environment variable 'ZEEBE_CLIENT_ID'.
	ClientID string
	// The client secret used to request an access token. Can be overridden with the environment variable 'ZEEBE_CLIENT_SECRET'.
	ClientSecret string
	// The audience to which the access token will be sent. Can be overridden with the environment variable 'ZEEBE_TOKEN_AUDIENCE'.
	Audience string
	// The scope(s) to be included in the access token. Can be overridden with the environment variable 'ZEEBE_TOKEN_SCOPE'.
	Scope string
	// The URL for the authorization server from which the access token will be requested. Can be overridden with
	// the environment variable 'ZEEBE_AUTHORIZATION_SERVER_URL'.
	AuthorizationServerURL string
	// Cache to read/write credentials from; if none given, defaults to an oauthYamlCredentialsCache instance with the
	// path '$HOME/.camunda/credentials' as default (can be overridden by 'ZEEBE_CLIENT_CONFIG_PATH')
	Cache OAuthCredentialsCache
	// Timeout is the maximum duration of an OAuth request. The default value is 10 seconds
	Timeout time.Duration
}

OAuthProviderConfig configures an OAuthCredentialsProvider, containing the required data to request an access token from an OAuth authorization server which will be appended to each gRPC call's headers.

Jump to

Keyboard shortcuts

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