Class Env

  • All Implemented Interfaces:
    software.amazon.jsii.JsiiSerializable

    @Generated(value="jsii-pacmak/1.75.0 (build 63bb957)",
               date="2023-02-20T02:42:01.847Z")
    @Stability(Stable)
    public class Env
    extends software.amazon.jsii.JsiiObject
    Container environment variables.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

        software.amazon.jsii.JsiiObject.InitializationMode
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        Env​(List<EnvFrom> sources, Map<String,​EnvValue> variables)  
      protected Env​(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)  
      protected Env​(software.amazon.jsii.JsiiObjectRef objRef)  
    • Constructor Detail

      • Env

        protected Env​(software.amazon.jsii.JsiiObjectRef objRef)
      • Env

        protected Env​(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
      • Env

        @Stability(Stable)
        public Env​(@NotNull
                   List<EnvFrom> sources,
                   @NotNull
                   Map<String,​EnvValue> variables)
        Parameters:
        sources - This parameter is required.
        variables - This parameter is required.
    • Method Detail

      • fromConfigMap

        @Stability(Stable)
        @NotNull
        public static EnvFrom fromConfigMap​(@NotNull
                                            IConfigMap configMap,
                                            @Nullable
                                            String prefix)
        Selects a ConfigMap to populate the environment variables with.

        The contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables.

        Parameters:
        configMap - This parameter is required.
        prefix -
      • fromConfigMap

        @Stability(Stable)
        @NotNull
        public static EnvFrom fromConfigMap​(@NotNull
                                            IConfigMap configMap)
        Selects a ConfigMap to populate the environment variables with.

        The contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables.

        Parameters:
        configMap - This parameter is required.
      • fromSecret

        @Stability(Stable)
        @NotNull
        public static EnvFrom fromSecret​(@NotNull
                                         ISecret secr)
        Selects a Secret to populate the environment variables with.

        The contents of the target Secret's Data field will represent the key-value pairs as environment variables.

        Parameters:
        secr - This parameter is required.
      • addVariable

        @Stability(Stable)
        public void addVariable​(@NotNull
                                String name,
                                @NotNull
                                EnvValue value)
        Add a single variable by name and value.

        The variable value can come from various dynamic sources such a secrets of config maps. Use EnvValue.fromXXX to select sources.

        Parameters:
        name - This parameter is required.
        value - This parameter is required.
      • copyFrom

        @Stability(Stable)
        public void copyFrom​(@NotNull
                             EnvFrom from)
        Add a collection of variables by copying from another source.

        Use Env.fromXXX functions to select sources.

        Parameters:
        from - This parameter is required.
      • getSources

        @Stability(Stable)
        @NotNull
        public List<EnvFrom> getSources()
        The list of sources used to populate the container environment, in addition to the `variables`.

        Returns a copy. To add a source use container.env.copyFrom().

      • getVariables

        @Stability(Stable)
        @NotNull
        public Map<String,​EnvValue> getVariables()
        The environment variables for this container.

        Returns a copy. To add environment variables use container.env.addVariable().