module Bindings::Binding

A representation of a binding as defined by the Kubernetes Service Binding Specification: github.com/k8s-service-bindings/spec#workload-projection

Public Instance Methods

get(key) click to toggle source

Returns the contents of a binding entry as a UTF-8 decoded String. Any whitespace is trimmed.

@param [String] key the key of the entry to retrieve @return [String] the contents of a binding entry as a UTF-8 decoded String if it exists @return [nil]

# File lib/binding.rb, line 53
def get(key)
  b = get_as_bytes(key)

  return nil if b.nil?

  b.pack("U*").strip
end
get_as_bytes(_key) click to toggle source

Returns the contents of a binding entry in its raw bytes form.

@param [String] _key the key of the entry to retrieve @return [String] the contents of a binding entry if it exists @return [nil]

# File lib/binding.rb, line 37
def get_as_bytes(_key)
  raise "unimplemented"
end
name() click to toggle source

Returns the name of the binding

@return [String] the name of the binding

# File lib/binding.rb, line 44
def name
  raise "unimplemented"
end
provider() click to toggle source

Returns the value of the PROVIDER key

@return [String] the value of the PROVIDER key if it exists @return [nil]

# File lib/binding.rb, line 65
def provider
  get(PROVIDER)
end
type() click to toggle source

Returns the value of the TYPE key.

@return [String] the value of the TYPE key

# File lib/binding.rb, line 72
def type
  t = get(TYPE)

  raise "binding codes not contain a type" if t.nil?

  t
end