Class Bindings

java.lang.Object
org.springframework.cloud.bindings.Bindings

public final class Bindings extends Object
A representation of a collection of bindings as defined by the Kubernetes Service Binding Specification.
  • Field Details

    • CNB_BINDINGS

      public static final String CNB_BINDINGS
      The name of the environment variable to read to determine the bindings file system root. Specified by the Cloud Native Buildpacks Specification
      See Also:
    • SERVICE_BINDING_ROOT

      public static final String SERVICE_BINDING_ROOT
      The name of the environment variable to read to determine the bindings file system root. Specified by the Kubernetes Service Binding Specification.
      See Also:
  • Constructor Details

    • Bindings

      public Bindings()
      Creates a new Bindings instance, using the $SERVICE_BINDING_ROOT environment variable or the $CNB_BINDINGS environment variable if it does not exist to determine the file system root. If neither the $SERVICE_BINDING_ROOT nor $CNB_BINDINGS environment variables are set, an empty Bindings is returned. If the directory does not exist, an empty Bindings is returned.
    • Bindings

      public Bindings(@Nullable String path)
      Creates a new Bindings instance, using the specified path. If the directory does not exist, an empty Bindings is returned.
      Parameters:
      path - the path to populate the Bindings from.
    • Bindings

      public Bindings(Binding... bindings)
      Creates a new Bindings instance using the specified content.
      Parameters:
      bindings - the Bindings.
  • Method Details

    • getBindings

      public List<Binding> getBindings()
      Returns all the Bindings that were found during construction.
      Returns:
      all the Bindings that were found during construction.
    • findBinding

      @Nullable public Binding findBinding(String name)
      Returns a Binding with a given name.
      Parameters:
      name - the name of the Binding to find.
      Returns:
      the Binding with a given name if it exists, null otherwise.
    • filterBindings

      public List<Binding> filterBindings(@Nullable String type)
      Returns zero or more Bindings with a given type. Equivalent to filterBindings(String, String).
      Parameters:
      type - the type of the Binding to find.
      Returns:
      the collection of Bindings with a given type.
    • filterBindings

      public List<Binding> filterBindings(@Nullable String type, @Nullable String provider)
      Return zero or more Bindings with a given type and provider. If type or provider are null, the result is not filtered on that argument.
      Parameters:
      type - the type of Binding to find.
      provider - the provider of Binding to find
      Returns:
      the collection of Bindings with a given type and provider.