Documentation ¶
Index ¶
- Constants
- func Get(binding Binding, key string) (string, bool)
- func GetProvider(binding Binding) (string, bool)
- func GetType(binding Binding) (string, error)
- type Binding
- func Cached(bindings []Binding) []Binding
- func Filter(bindings []Binding, bindingType string) []Binding
- func FilterWithProvider(bindings []Binding, bindingType string, provider string) []Binding
- func Find(bindings []Binding, name string) (Binding, bool)
- func From(root string) []Binding
- func FromServiceBindingRoot() []Binding
- type CacheBinding
- type ConfigTreeBinding
- type MapBinding
Constants ¶
const Provider = "provider"
Provider is the key for the provider of a binding.
const ServiceBindingRoot = "SERVICE_BINDING_ROOT"
ServiceBindingRoot is the name of the environment variable read to determine the bindings file system root. Specified by the Kubernetes Service Binding Specification.
const Type = "type"
Type is the key for the type of a binding.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
Get returns contents of a binding entry as a UTF-8 decoded string. Any whitespace is trimmed.
func GetProvider ¶
GetProvider returns the value of the Provider key.
Types ¶
type Binding ¶
type Binding interface { // GetAsBytes returns the contents of a binding entry in its raw []byte form. GetAsBytes(key string) ([]byte, bool) // GetName returns the name of the binding. GetName() string }
Binding is representation of a binding as defined by the Kubernetes Service Binding Specification: https://github.com/k8s-service-bindings/spec#workload-projection.
func Filter ¶
Filter returns zero or more Bindings with a given type. Equivalent to FilterWithProvider with an empty provider.
func FilterWithProvider ¶
FilterWithProvider returns zero or more Bindings with a given type and provider. If type or provider are empty, the result is not filtered on that argument. Comparisons are case-insensitive.
func From ¶
From creates a collection Bindings from the specified path. If the directory does not exist an, empty collection is returned.
func FromServiceBindingRoot ¶
func FromServiceBindingRoot() []Binding
FromServiceBindingRoot creates Bindings using the $SERVICE_BINDING_ROOT environment variable to determine the file system toot. If the $SERVICE_BINDING_ROOT environment variable is not set, an empty collection is returned. If the directory does not exist, an empty collection is returned.
type CacheBinding ¶
type CacheBinding struct { // Delegate is the Binding used to retrieve original values Delegate Binding // contains filtered or unexported fields }
CacheBinding is an implementation of the Binding interface that caches values once they've been retrieved.
func (*CacheBinding) GetAsBytes ¶
func (c *CacheBinding) GetAsBytes(key string) ([]byte, bool)
func (*CacheBinding) GetName ¶
func (c *CacheBinding) GetName() string
type ConfigTreeBinding ¶
type ConfigTreeBinding struct { // Root is the filesystem root of the binding. Root string }
ConfigTreeBinding is an implementation of the Binding interface that reads files from a volume mounted Kubernetes secret: https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets.
func (ConfigTreeBinding) GetAsBytes ¶
func (c ConfigTreeBinding) GetAsBytes(key string) ([]byte, bool)
func (ConfigTreeBinding) GetName ¶
func (c ConfigTreeBinding) GetName() string
type MapBinding ¶
type MapBinding struct { // Name is the name of the binding. Name string // Content is the content of the binding. Content map[string][]byte }
MapBinding is an implementation of the Binding interface that returns values from a map.
func (MapBinding) GetAsBytes ¶
func (m MapBinding) GetAsBytes(key string) ([]byte, bool)
func (MapBinding) GetName ¶
func (m MapBinding) GetName() string