Documentation
¶
Overview ¶
Package clientinfo collects information about the client and its environment into an immutable ClientInfo value.
Default returns a ClientInfo pre-populated with process-level defaults (SDK version, Go version, OS, and detected environment). ClientInfo.With derives a new value with additional key/value segments; it never mutates the original.
Databricks tooling (Terraform provider, CLI, partner integrations) should call SetProduct, SetPartner, or AddToDefault at startup to register global metadata before any client is created.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrOddKeyvals indicates an odd number of key/value arguments. ErrOddKeyvals = errors.New("odd number of key/value arguments") // ErrInvalidKey indicates a segment key with invalid characters. ErrInvalidKey = errors.New("invalid key") // ErrInvalidValue indicates a segment value with invalid characters. ErrInvalidValue = errors.New("invalid value") // ErrInvalidVersion indicates a version string that is not valid semver. ErrInvalidVersion = errors.New("invalid version") )
Functions ¶
func AddToDefault ¶
AddToDefault adds a global key/value segment that will be included in every Default call. Same key with different values is allowed (e.g., multiple partners). Exact key+value duplicates are silently ignored.
Must be called before any client is created. Not safe for concurrent use.
func SetPartner ¶
SetPartner adds a partner identifier globally. Partner attribution is a first-class concept used for support ticket routing.
Must be called before any client is created. Not safe for concurrent use.
func SetProduct ¶
SetProduct sets the product name and version globally. The version must be a valid semver string.
Must be called before any client is created. Not safe for concurrent use.
Types ¶
type ClientInfo ¶
type ClientInfo struct {
// contains filtered or unexported fields
}
ClientInfo is an immutable, ordered list of key/value segments. Use Default to get the process-level defaults and ClientInfo.With to derive new values with additional segments.
func Default ¶
func Default() ClientInfo
Default returns a ClientInfo populated with SDK metadata, runtime information, segments registered via AddToDefault, and automatically detected environment properties.
func (ClientInfo) String ¶
func (ci ClientInfo) String() string
String returns a string representation of the client info suitable for inclusion in HTTP headers. Key/value pairs are formatted as "key/value" and joined by spaces in the order they were inserted.
func (ClientInfo) With ¶
func (ci ClientInfo) With(keyvals ...string) (ClientInfo, error)
With returns a new ClientInfo with the given key/value pairs appended. The original is not modified. An odd number of arguments returns an error.
Keys and values must contain only alphanumeric characters plus the characters: undescore ('_'), dot ('.'), plus ('+'), or hyphen ('-').
Exact key+value duplicates are silently ignored. On error, the zero value is returned (all-or-nothing).