Interface Output<T>

All Superinterfaces:
com.pulumi.core.internal.Copyable<Output<T>>

public interface Output<T> extends com.pulumi.core.internal.Copyable<Output<T>>
Output<T> is a key part of how Pulumi tracks dependencies between Resources. Because the values of outputs are not available until resources are created, these are represented using the special Output<T> type, which internally represents two things:
  1. An eventually available value of the output
  2. The dependency on the source(s) of the output value
In fact, Output<T> is quite similar to CompletableFuture. Additionally, they carry along dependency information.

The output properties of all resource objects in Pulumi have type Output<T>.

  • Method Details

    • apply

      <U> Output<U> apply(Function<T,Output<U>> func)
      Transforms the data of this Output<T> with the provided func. The result remains an Output<T> so that dependent resources can be properly tracked.

      func should not be used to create resources unless necessary as `func` may not be run during some program executions.

      func can return other Output<T>s. This can be handy if you have an Output<SomeType> and you want to get a transitive dependency of it. i.e.:
      Output<SomeType> d1 = ...; Output<OtherType> d2 = d1.apply(v -> v.otherOutput); // getting an output off of 'v'.

      In this example, taking a dependency on d2 means a resource will depend on all the resources of d1. It will not depend on the resources of v.x.y.OtherDep.

      Importantly, the Resources that d2 feels like it will depend on are the same resources as d1.

      If you need have multiple Output<T>s and a single Output<T> is needed that combines both set of resources, then all(Output[]) or tuple(Output, Output, Output) should be used instead.

      This function will only be called during execution of a pulumi up request. It will not run during pulumi preview (as the values of resources are of course not known then).

      Type Parameters:
      U - type of the Output returned by func
      Parameters:
      func - the function to apply to the current value
      Returns:
      an Output after applying func
    • applyValue

      default <U> Output<U> applyValue(Function<T,U> func)
      Type Parameters:
      U - type returned by func
      Parameters:
      func - the function to apply to the current value
      Returns:
      an Output after applying func
      See Also:
    • copy

      Output<T> copy()
      Creates a shallow copy (the underlying CompletableFuture is copied) of this Output<T>
      Specified by:
      copy in interface com.pulumi.core.internal.Copyable<T>
      Returns:
      a shallow copy of the Output<T>
    • asPlaintext

      Output<T> asPlaintext()
      Returns a new Output<T> which is a copy of the existing output but marked as a non-secret. The original output or input is not modified in any way.

      Please use with caution

      Returns:
      this Output as a non-secret
    • asSecret

      Output<T> asSecret()
      Returns a new Output<T> which is a copy of the existing output but marked as a secret. The original output or input is not modified in any way.
      Returns:
      this Output as a secret
    • of

      static <T> Output<T> of(T value)
      Returns an Output<T> describing the given non-null value.
      Type Parameters:
      T - the type of the value
      Parameters:
      value - the value to describe, which must be non-null
      Returns:
      an Output<T> with the value present
      Throws:
      NullPointerException - if value is null
    • of

      static <T> Output<T> of(CompletableFuture<T> future)
      Returns an Output<T> describing a future value.
      Type Parameters:
      T - the type of the value
      Parameters:
      future - the future to describe, which must be non-null
      Returns:
      an Output<T> with the value present
      Throws:
      NullPointerException - if future is null, but not the future value
    • ofSecret

      static <T> Output<T> ofSecret(T value)
      Returns an Output<T> describing the given non-null secret value.
      Type Parameters:
      T - the type of the value
      Parameters:
      value - the secret value to describe, which must be non-null
      Returns:
      an Output<T> with the value present
      Throws:
      NullPointerException - if value is null
    • ofNullable

      static <T> Output<T> ofNullable(@Nullable T value)
      Returns an Output<T> describing the given value, if non-null, otherwise returns an empty Output<T>.
      Type Parameters:
      T - the type of the value
      Parameters:
      value - the possibly-null value to describe
      Returns:
      an Output<T> with a present value if the specified value is non-null, otherwise an empty Output<T>
    • all

      @SafeVarargs static <T> Output<List<T>> all(Output<T>... outputs)
      Combines all the Output<T> values in outputs into a single Output<T> with an List<T> containing all their underlying values.

      If any of the Output<T>s are not known, the final result will be not known. Similarly, if any of the Output<T>s are secrets, then the final result will be a secret.

      Type Parameters:
      T - the type of the value
      Parameters:
      outputs - the outputs to be combined
      Returns:
      an Output with a list of all values of the given outputs
    • all

      static <T> Output<List<T>> all(Iterable<Output<T>> outputs)
      Type Parameters:
      T - the type of the value
      Parameters:
      outputs - the outputs to be combined
      Returns:
      an Output with a list of all values of the given outputs
      See Also:
    • format

      static Output<String> format(String formattableString, @Nullable Object... arguments)
      Takes in a formattableString with potential Output or a regular Object. in the 'placeholder holes'. Conceptually, this method unwraps all the underlying values in the holes, combines them appropriately with the formattableString, and produces an Output containing the final result.

      If any of the Outputs are not known, the final result will be not known.

      Similarly, if any of the Outputs are secrets, then the final result will be a secret.

      Parameters:
      formattableString - The format string with same syntax as expected by String.format(String, Object...), the behaviour on a null argument depends on the format conversion.
      arguments - Outputs or regular Objects that values of will be applied to the format String
      Returns:
      an Output with the result of the formatting
    • ofLeft

      static <L, R> Output<Either<L,R>> ofLeft(L value)
      Represents an Output value that can be one of two different types. For example, it might potentially be an "Integer" some time or a "String" in other cases.
      Type Parameters:
      L - the type contained by the Left instance
      R - the type contained by the Right instance
      Parameters:
      value - the value to create the Left instance with
      Returns:
      an Output holding Left instance with the given value
    • ofRight

      static <L, R> Output<Either<L,R>> ofRight(R value)
      Type Parameters:
      L - the type contained by the Left instance
      R - the type contained by the Right instance
      Parameters:
      value - the value to create the Right instance with
      Returns:
      an Output holding Right instance with the given value
      See Also:
    • ofLeft

      static <L, R> Output<Either<L,R>> ofLeft(Output<L> value)
      Type Parameters:
      L - the type contained by the Left instance
      R - the type contained by the Right instance
      Parameters:
      value - an Output with the value to create the Left instance with
      Returns:
      an Output holding Left instance with the value of the given Output
      See Also:
    • ofRight

      static <L, R> Output<Either<L,R>> ofRight(Output<R> value)
      Type Parameters:
      L - the type contained by the Left instance
      R - the type contained by the Right instance
      Parameters:
      value - an Output with the value to create the Right instance with
      Returns:
      an Output holding Right instance with the value of the given Output
      See Also:
    • ofJson

      static Output<com.google.gson.JsonElement> ofJson()
      Returns:
      a JsonNull.INSTANCE
      See Also:
    • ofJson

      static Output<com.google.gson.JsonElement> ofJson(com.google.gson.JsonElement json)
      Represents an Output value that wraps a JsonElement
      Parameters:
      json - the JsonElement to wrap
      Returns:
      given JsonElement wrapped in an Output
    • parseJson

      static Output<com.google.gson.JsonElement> parseJson(String json)
      Parameters:
      json - the json value to wrap
      Returns:
      given json value as a JsonElement wrapped in an Output
      Throws:
      com.google.gson.JsonSyntaxException - if json is not valid
      See Also:
    • parseJson

      static Output<com.google.gson.JsonElement> parseJson(Output<String> json)
      Parameters:
      json - the json value wrapped in an Output<String>
      Returns:
      given json value as a JsonElement wrapped in an Output
      Throws:
      com.google.gson.JsonSyntaxException - if json is not valid
      See Also:
    • copyOfList

      static <E> Output<List<E>> copyOfList(List<E> values)
      Returns a shallow copy of the List wrapped in an Output
      Returns:
      an Output holding a copy of the given list
    • concatList

      @Nonnull static <E> Output<List<E>> concatList(@Nullable Output<List<E>> left, @Nullable Output<List<E>> right)
      Concatenates two lists of Output, can take a null value that will be treated as an empty list, always returns non-null.
      Type Parameters:
      E - type of the list element
      Parameters:
      left - fist list to concatenate
      right - second list to concatenate
      Returns:
      an Output with left and right lists concatenated
    • ofList

      static <E> Output<List<E>> ofList()
      Returns:
      an Output with an empty List
      See Also:
    • ofList

      static <E> Output<List<E>> ofList(E e1)
      Returns:
      an Output value that wraps a List with one element.
      See Also:
    • ofList

      static <E> Output<List<E>> ofList(E e1, E e2)
      Returns:
      an Output value that wraps a List with two elements.
      See Also:
    • ofList

      static <E> Output<List<E>> ofList(E e1, E e2, E e3)
      Returns:
      an Output value that wraps a List with three elements.
      See Also:
    • ofList

      static <E> Output<List<E>> ofList(E e1, E e2, E e3, E e4)
      Returns:
      an Output value that wraps a List with four elements.
      See Also:
    • ofList

      static <E> Output<List<E>> ofList(E e1, E e2, E e3, E e4, E e5)
      Returns:
      an Output value that wraps a List with five elements.
      See Also:
    • ofList

      static <E> Output<List<E>> ofList(E e1, E e2, E e3, E e4, E e5, E e6)
      Returns:
      an Output value that wraps a List with six elements.
      See Also:
    • ofList

      static <E> Output<List<E>> ofList(E e1, E e2, E e3, E e4, E e5, E e6, E e7)
      Returns:
      an Output value that wraps a List with seven elements.
      See Also:
    • ofList

      static <E> Output<List<E>> ofList(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8)
      Returns:
      an Output value that wraps a List with eight elements.
      See Also:
    • ofList

      static <E> Output<List<E>> ofList(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9)
      Returns:
      an Output value that wraps a List with nine elements.
      See Also:
    • ofList

      static <E> Output<List<E>> ofList(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10)
      Returns:
      an Output value that wraps a List with ten elements.
      See Also:
    • ofList

      static <E> Output<List<E>> ofList(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11)
      Returns:
      an Output value that wraps a List with eleven elements.
      See Also:
    • ofList

      static <E> Output<List<E>> ofList(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11, E e12)
      Returns:
      an Output value that wraps a List with twelve elements.
      See Also:
    • ofList

      @SafeVarargs static <E> Output<List<E>> ofList(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11, E e12, E... others)
      Returns:
      an Output value that wraps a List with more than twelve elements.
      See Also:
    • listBuilder

      static <E> Output.ListBuilder<E> listBuilder()
      Helps to build an Output that wraps a List.
      Returns:
      an Output.ListBuilder<E> instance
      See Also:
    • copyOfMap

      static <V> Output<Map<String,V>> copyOfMap(Map<String,V> values)
      Returns a shallow copy of the Map wrapped in an Output
      Returns:
      an Output holding a copy of the given map
    • concatMap

      static <V> Output<Map<String,V>> concatMap(@Nullable Output<Map<String,V>> left, @Nullable Output<Map<String,V>> right)
      Concatenates two Map wrapped in an Output. Returns a new instance without modifying any of the arguments.

      If both maps contain the same key, the value from the second map takes over.

      null values in the Output or Map layer are treated as empty maps.

      Type Parameters:
      V - type of the map value
      Parameters:
      left - The first @see Output<Map<String, V>> to concatenate
      right - The second @see Output<Map<String, V>> to concatenate, it has higher priority in case of key clash
      Returns:
      an Output<Map<String, V>> that contains the items from both maps given
    • ofMap

      static <V> Output<Map<String,V>> ofMap()
      Returns:
      an Output with an empty Map
      See Also:
    • ofMap

      static <V> Output<Map<String,V>> ofMap(String key1, V value1)
      Returns:
      an Output that wraps a Map with one pair.
      See Also:
    • ofMap

      static <V> Output<Map<String,V>> ofMap(String key1, V value1, String key2, V value2)
      Returns:
      an Output that wraps a Map with two pairs.
      See Also:
    • ofMap

      static <V> Output<Map<String,V>> ofMap(String key1, V value1, String key2, V value2, String key3, V value3)
      Returns:
      an Output that wraps a Map with three pairs.
      See Also:
    • ofMap

      static <V> Output<Map<String,V>> ofMap(String key1, V value1, String key2, V value2, String key3, V value3, String key4, V value4)
      Returns:
      an Output that wraps a Map with four pairs.
      See Also:
    • ofMap

      static <V> Output<Map<String,V>> ofMap(String key1, V value1, String key2, V value2, String key3, V value3, String key4, V value4, String key5, V value5)
      Returns:
      an Output that wraps a Map with five pairs.
      See Also:
    • mapBuilder

      static <E> Output.MapBuilder<E> mapBuilder()
      Helps to build a Map wrapped in an Output.
      See Also:
    • tuple

      static <T1, T2> Output<Tuples.Tuple2<T1,T2>> tuple(Output<T1> item1, Output<T2> item2)
      Type Parameters:
      T1 - type of item1
      T2 - type of item2
      Parameters:
      item1 - the 1st item ot the tuple
      item2 - the 2nd item ot the tuple
      Returns:
      an Output holding a Tuples.Tuple2 with all given items
      See Also:
    • tuple

      static <T1, T2, T3> Output<Tuples.Tuple3<T1,T2,T3>> tuple(Output<T1> item1, Output<T2> item2, Output<T3> item3)
      Type Parameters:
      T1 - type of item1
      T2 - type of item2
      T3 - type of item3
      Parameters:
      item1 - the 1st item ot the tuple
      item2 - the 2nd item ot the tuple
      item3 - the 3rd item ot the tuple
      Returns:
      an Output holding a Tuples.Tuple3 with all given items
      See Also:
    • tuple

      static <T1, T2, T3, T4> Output<Tuples.Tuple4<T1,T2,T3,T4>> tuple(Output<T1> item1, Output<T2> item2, Output<T3> item3, Output<T4> item4)
      Type Parameters:
      T1 - type of item1
      T2 - type of item2
      T3 - type of item3
      T4 - type of item4
      Parameters:
      item1 - the 1st item ot the tuple
      item2 - the 2nd item ot the tuple
      item3 - the 3rd item ot the tuple
      item4 - the 4th item ot the tuple
      Returns:
      an Output holding a Tuples.Tuple4 with all given items
      See Also:
    • tuple

      static <T1, T2, T3, T4, T5> Output<Tuples.Tuple5<T1,T2,T3,T4,T5>> tuple(Output<T1> item1, Output<T2> item2, Output<T3> item3, Output<T4> item4, Output<T5> item5)
      Type Parameters:
      T1 - type of item1
      T2 - type of item2
      T3 - type of item3
      T4 - type of item4
      T5 - type of item5
      Parameters:
      item1 - the 1st item ot the tuple
      item2 - the 2nd item ot the tuple
      item3 - the 3rd item ot the tuple
      item4 - the 4th item ot the tuple
      item5 - the 5th item ot the tuple
      Returns:
      an Output holding a Tuples.Tuple5 with all given items
      See Also:
    • tuple

      static <T1, T2, T3, T4, T5, T6> Output<Tuples.Tuple6<T1,T2,T3,T4,T5,T6>> tuple(Output<T1> item1, Output<T2> item2, Output<T3> item3, Output<T4> item4, Output<T5> item5, Output<T6> item6)
      Type Parameters:
      T1 - type of item1
      T2 - type of item2
      T3 - type of item3
      T4 - type of item4
      T5 - type of item5
      T6 - type of item6
      Parameters:
      item1 - the 1st item ot the tuple
      item2 - the 2nd item ot the tuple
      item3 - the 3rd item ot the tuple
      item4 - the 4th item ot the tuple
      item5 - the 5th item ot the tuple
      item6 - the 6th item ot the tuple
      Returns:
      an Output holding a Tuples.Tuple6 with all given items
      See Also:
    • tuple

      static <T1, T2, T3, T4, T5, T6, T7> Output<Tuples.Tuple7<T1,T2,T3,T4,T5,T6,T7>> tuple(Output<T1> item1, Output<T2> item2, Output<T3> item3, Output<T4> item4, Output<T5> item5, Output<T6> item6, Output<T7> item7)
      Type Parameters:
      T1 - type of item1
      T2 - type of item2
      T3 - type of item3
      T4 - type of item4
      T5 - type of item5
      T6 - type of item6
      T7 - type of item7
      Parameters:
      item1 - the 1st item ot the tuple
      item2 - the 2nd item ot the tuple
      item3 - the 3rd item ot the tuple
      item4 - the 4th item ot the tuple
      item5 - the 5th item ot the tuple
      item6 - the 6th item ot the tuple
      item7 - the 7th item ot the tuple
      Returns:
      an Output holding a Tuples.Tuple7 with all given items
      See Also:
    • tuple

      static <T1, T2, T3, T4, T5, T6, T7, T8> Output<Tuples.Tuple8<T1,T2,T3,T4,T5,T6,T7,T8>> tuple(Output<T1> item1, Output<T2> item2, Output<T3> item3, Output<T4> item4, Output<T5> item5, Output<T6> item6, Output<T7> item7, Output<T8> item8)
      Combines all the Output values in the provided parameters and combines them all into a single tuple containing each of their underlying values. If any of the Outputs are not known, the final result will be not known. Similarly, if any of the Outputs are secrets, then the final result will be a secret.
      Type Parameters:
      T1 - type of item1
      T2 - type of item2
      T3 - type of item3
      T4 - type of item4
      T5 - type of item5
      T6 - type of item6
      T7 - type of item7
      T8 - type of item8
      Parameters:
      item1 - the 1st item ot the tuple
      item2 - the 2nd item ot the tuple
      item3 - the 3rd item ot the tuple
      item4 - the 4th item ot the tuple
      item5 - the 5th item ot the tuple
      item6 - the 6th item ot the tuple
      item7 - the 7th item ot the tuple
      item8 - the 8th item ot the tuple
      Returns:
      an Output holding a Tuples.Tuple8 with all given items