Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyIntent(doc map[string]any, sets *PathMap, unsets []Path)
- func BaseURL() string
- func Bearer(ctx context.Context) (string, error)
- func CheckedURL(url, envName string) (string, error)
- func Covers(lock, path []string) bool
- func Diff(base, new map[string]any, prefix Path) (*PathMap, []Path)
- func DisplayURL(url string) string
- func Encode(segments []string) string
- func EncodeChanges(sets *PathMap, unsets []Path) (*jsonutil.Object, []string)
- func GetRemoteBackend() config.ConfigBackend
- func InstanceID() string
- func IntentDiff(base, new map[string]any, prefix Path) (*PathMap, []Path)
- func IsSecretPath(segments []string) bool
- func JSONEqual(a, b any) bool
- func PlaneToken(ctx context.Context) (string, error)
- func ResetForTests()
- func ShownURL() string
- func ToWire(value any, path Path) (any, error)
- func Validate(segments []string, encoded *string) error
- type CredentialDestinationError
- type IncompleteRead
- type Lock
- type Path
- type PathError
- type PathMap
- type PathValue
- type PlaneCredentialError
- type Response
- type TransportError
Constants ¶
const ( URLEnv = "ICEBATH_CONFIG_REMOTE_URL" InstanceEnv = "ICEBATH_CONFIG_INSTANCE_ID" )
const ( MaxSegments = 32 MaxSegmentBytes = 256 MaxEncodedBytes = 2048 )
const MaxSafeInteger = 1<<53 - 1
Variables ¶
var (
BootRetryDelays = []float64{10, 20}
)
var PlaneCredentialEnvNames = []string{ config.BackendEnv, URLEnv, InstanceEnv, idpEnvPrefix + "TOKEN_URL", idpEnvPrefix + "CLIENT_ID", idpEnvPrefix + "CLIENT_SECRET", idpEnvPrefix + "SCOPE", }
Every env name deciding which plane token is sent where, refused from a secret source at boot
Functions ¶
func ApplyIntent ¶
Applies an intent edit to doc in place, an empty mapping set keeping a mapping already there
func BaseURL ¶
func BaseURL() string
Configured plane origin and path prefix with trailing slashes dropped, empty when none is set
func CheckedURL ¶
URL itself when a credential may be sent to it, else a CredentialDestinationError
func DisplayURL ¶
URL for messages with any user info dropped, an unparsable one cut at the last at sign
func Encode ¶
Wire string of a path, backslash and dot escaped in each segment and segments joined by dots
func EncodeChanges ¶
Wire set object keyed by encoded path and the encoded unset list
func GetRemoteBackend ¶
func GetRemoteBackend() config.ConfigBackend
Process wide remote backend with one poller and one in memory layer per profile home
func InstanceID ¶
func InstanceID() string
func IntentDiff ¶
Diff as a key level intent, a non empty mapping the base did not hold as a mapping expanded to its leaves
func IsSecretPath ¶
Secret shaped key rule on decoded segments with list indices already dropped
func PlaneToken ¶
Fresh bearer from the OAuth2 client credentials grant, an error naming the missing setting when none is configured
func ResetForTests ¶
func ResetForTests()
Stops the poller of the process wide backend and drops it so the next read boots again
func ShownURL ¶
func ShownURL() string
Plane URL without user info for messages, describe and provenance, naming the unset variable when there is none
Types ¶
type CredentialDestinationError ¶
type CredentialDestinationError struct{ *PlaneCredentialError }
Credential bound for a destination the transport policy forbids, never retryable
func (*CredentialDestinationError) Unwrap ¶
func (e *CredentialDestinationError) Unwrap() error
type IncompleteRead ¶
Body that ended before its declared length, the http.client.IncompleteRead no transport handler catches
func (*IncompleteRead) Error ¶
func (e *IncompleteRead) Error() string
type Lock ¶
One lock with the level it holds
func CoveringLock ¶
First lock covering a path, false when none does
type Path ¶
type Path []string
Config plane path as its mapping key segments
func Decode ¶
Segments of an encoded path, a PathError for a bad escape, an empty segment or a broken limit
func FromDotted ¶
Path of a dotted key as callers spell it, split on every dot when it does not parse as encoded
func SecretLiteralPath ¶
First path under a set of value at path that holds a secret literal, false when none does
type PathError ¶
type PathError struct{ Message string }
Encoded path that does not parse or breaks a segment or length limit
type PathMap ¶
type PathMap struct {
// contains filtered or unexported fields
}
Insertion ordered map from path to value with Python dict update semantics
func (*PathMap) SetDefault ¶
Stores value at p only when p is absent
type PlaneCredentialError ¶
No plane credential could be obtained, Retryable false when only a configuration change helps
func (*PlaneCredentialError) Error ¶
func (e *PlaneCredentialError) Error() string
type Response ¶
type Response struct {
Status int
Body map[string]any
ETag string
RetryAfter float64
HasRetryAfter bool
}
One plane answer, HasRetryAfter set when a Retry-After header held a delay in seconds or an HTTP date
func Request ¶
func Request(ctx context.Context, method, profile, etag string, body any, token string) (Response, error)
One call to the self route with token or a bearer resolved here, never following a redirect
type TransportError ¶
type TransportError struct{ Message string }
Request that never produced an HTTP response
func (*TransportError) Error ¶
func (e *TransportError) Error() string