Documentation
¶
Index ¶
- func NewLogger(opts CommonOptions, w io.Writer) (*slog.Logger, error)
- func ParseFlagDuration(s string) (time.Duration, error)
- func StoreClientOAuth(opts StoreClientOAuthOptions) error
- type ClientOptions
- type ClientOptionsBuilder
- type CommonOptions
- type FlagDuration
- type FlagStringEnum
- type FlagStringEnumArray
- type FlagTimestamp
- type LoadClientOAuthOptions
- type LoadClientOAuthResult
- type OAuthConfig
- type StoreClientOAuthOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLogger ¶
NewLogger creates a new slog.Logger from CommonOptions. The output is written to the provided writer (typically stderr). Returns a nop logger if LogLevel is "never".
func ParseFlagDuration ¶
ParseFlagDuration is like time.ParseDuration, but supports unit "d" for days (always interpreted as exactly 24 hours).
func StoreClientOAuth ¶
func StoreClientOAuth(opts StoreClientOAuthOptions) error
StoreClientOAuth stores OAuth configuration in the config file for a specific profile. If OAuth is nil, it removes the OAuth configuration from the profile. This function preserves all other content in the config file.
Types ¶
type ClientOptions ¶
type ClientOptions struct {
Address string
ClientAuthority string
Namespace string
ApiKey string
GrpcMeta []string
Tls bool
TlsCertPath string
TlsCertData string
TlsKeyPath string
TlsKeyData string
TlsCaPath string
TlsCaData string
TlsDisableHostVerification bool
TlsServerName string
CodecEndpoint string
CodecAuth string
CodecHeader []string
Identity string
FlagSet *pflag.FlagSet
}
func (*ClientOptions) BuildFlags ¶
func (v *ClientOptions) BuildFlags(f *pflag.FlagSet)
type ClientOptionsBuilder ¶
type ClientOptionsBuilder struct {
// CommonOptions contains common CLI options including profile config.
CommonOptions CommonOptions
// ClientOptions contains the client configuration from flags.
ClientOptions ClientOptions
// EnvLookup is the environment variable lookup function.
// If nil, environment variables are not used for profile loading.
EnvLookup envconfig.EnvLookup
// Logger is the slog logger to use for the client. If set, it will be
// wrapped with the SDK's structured logger adapter.
Logger *slog.Logger
}
ClientOptionsBuilder contains options for building SDK client.Options.
type CommonOptions ¶
type CommonOptions struct {
Env string
EnvFile string
ConfigFile string
Profile string
DisableConfigFile bool
DisableConfigEnv bool
LogLevel FlagStringEnum
LogFormat FlagStringEnum
Output FlagStringEnum
TimeFormat FlagStringEnum
Color FlagStringEnum
NoJsonShorthandPayloads bool
CommandTimeout FlagDuration
ClientConnectTimeout FlagDuration
FlagSet *pflag.FlagSet
}
func (*CommonOptions) BuildFlags ¶
func (v *CommonOptions) BuildFlags(f *pflag.FlagSet)
type FlagDuration ¶
FlagDuration extends time.Duration with support for days ("d" suffix).
func MustParseFlagDuration ¶
func MustParseFlagDuration(s string) FlagDuration
MustParseFlagDuration parses a duration string and panics on error. Used in generated code for compile-time constants.
func (FlagDuration) Duration ¶
func (d FlagDuration) Duration() time.Duration
func (*FlagDuration) Set ¶
func (d *FlagDuration) Set(s string) error
func (*FlagDuration) String ¶
func (d *FlagDuration) String() string
func (*FlagDuration) Type ¶
func (d *FlagDuration) Type() string
type FlagStringEnum ¶
FlagStringEnum is a flag type that restricts values to a predefined set.
func NewFlagStringEnum ¶
func NewFlagStringEnum(allowed []string, value string) FlagStringEnum
NewFlagStringEnum creates a new FlagStringEnum with the given allowed values and default.
func (*FlagStringEnum) Set ¶
func (s *FlagStringEnum) Set(p string) error
func (*FlagStringEnum) String ¶
func (s *FlagStringEnum) String() string
func (*FlagStringEnum) Type ¶
func (*FlagStringEnum) Type() string
type FlagStringEnumArray ¶
FlagStringEnumArray is a flag type that accumulates multiple values from a predefined set.
func NewFlagStringEnumArray ¶
func NewFlagStringEnumArray(allowed []string, values []string) FlagStringEnumArray
NewFlagStringEnumArray creates a new FlagStringEnumArray with the given allowed values and defaults.
func (*FlagStringEnumArray) Set ¶
func (s *FlagStringEnumArray) Set(p string) error
func (*FlagStringEnumArray) String ¶
func (s *FlagStringEnumArray) String() string
func (*FlagStringEnumArray) Type ¶
func (*FlagStringEnumArray) Type() string
type FlagTimestamp ¶
FlagTimestamp wraps time.Time with RFC3339 format for flags.
func (*FlagTimestamp) Set ¶
func (t *FlagTimestamp) Set(s string) error
func (*FlagTimestamp) String ¶
func (t *FlagTimestamp) String() string
func (FlagTimestamp) Time ¶
func (t FlagTimestamp) Time() time.Time
func (*FlagTimestamp) Type ¶
func (t *FlagTimestamp) Type() string
type LoadClientOAuthOptions ¶
type LoadClientOAuthOptions struct {
// ConfigFilePath overrides the config file path. If empty, uses TEMPORAL_CONFIG_FILE
// env var or the default path.
ConfigFilePath string
// ProfileName specifies which profile to load OAuth from. If empty, uses TEMPORAL_PROFILE
// env var or "default".
ProfileName string
// EnvLookup overrides environment variable lookup. If nil, uses os.LookupEnv.
EnvLookup envconfig.EnvLookup
}
LoadClientOAuthOptions are options for LoadClientOAuth.
type LoadClientOAuthResult ¶
type LoadClientOAuthResult struct {
// OAuth is the loaded OAuth configuration, or nil if not configured.
OAuth *OAuthConfig
// ConfigFilePath is the resolved path to the config file.
ConfigFilePath string
// ProfileName is the resolved profile name.
ProfileName string
}
LoadClientOAuthResult is the result of LoadClientOAuth.
func LoadClientOAuth ¶
func LoadClientOAuth(opts LoadClientOAuthOptions) (LoadClientOAuthResult, error)
LoadClientOAuth loads OAuth configuration from the config file for a specific profile.
type OAuthConfig ¶
type OAuthConfig struct {
// ClientConfig is the OAuth 2.0 client configuration.
ClientConfig *oauth2.Config
// Token is the OAuth 2.0 token.
Token *oauth2.Token
}
OAuthConfig combines OAuth client configuration with token information.
type StoreClientOAuthOptions ¶
type StoreClientOAuthOptions struct {
// ConfigFilePath overrides the config file path. If empty, uses TEMPORAL_CONFIG_FILE
// env var or the default path.
ConfigFilePath string
// ProfileName specifies which profile to store OAuth for. If empty, uses TEMPORAL_PROFILE
// env var or "default".
ProfileName string
// OAuth is the OAuth configuration to store. If nil, removes OAuth from the profile.
OAuth *OAuthConfig
// EnvLookup overrides environment variable lookup. If nil, uses os.LookupEnv.
EnvLookup envconfig.EnvLookup
}
StoreClientOAuthOptions are options for StoreClientOAuth.