Interface Output<T>
- All Superinterfaces:
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:
- An eventually available value of the output
- The dependency on the source(s) of the output value
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>.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classstatic final class -
Method Summary
Modifier and TypeMethodDescription<U> Output<U>Transforms the data of thisOutput<T> with the providedfunc.default <U> Output<U>applyValue(Function<T, U> func) Returns a newOutput<T> which is a copy of the existing output but marked as a non-secret.asSecret()Returns a newOutput<T> which is a copy of the existing output but marked as a secret.concatList(Output<List<E>> left, Output<List<E>> right) Concatenates two lists ofOutput, can take anullvalue that will be treated as an empty list, always returnsnon-null.copy()Creates a shallow copy (the underlying CompletableFuture is copied) of thisOutput<T>copyOfList(List<E> values) static <E> Output.ListBuilder<E>static <E> Output.MapBuilder<E>static <T> Output<T>of(CompletableFuture<T> future) Returns anOutput<T> describing a future value.static <T> Output<T>of(T value) Returns anOutput<T> describing the given non-nullvalue.static Output<com.google.gson.JsonElement>ofJson()static Output<com.google.gson.JsonElement>ofJson(com.google.gson.JsonElement json) Represents anOutputvalue that wraps aJsonElementofLeft(L value) Represents anOutputvalue that can be one of two different types.ofList()ofList(E e1) ofList(E e1, E e2) ofList(E e1, E e2, E e3) ofList(E e1, E e2, E e3, E e4) ofList(E e1, E e2, E e3, E e4, E e5) ofList(E e1, E e2, E e3, E e4, E e5, E e6) ofList(E e1, E e2, E e3, E e4, E e5, E e6, E e7) ofList(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) ofList(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) ofList(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) ofList(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11) 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) 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) ofMap()ofMap(String key1, V value1, String key2, V value2, String key3, V value3, String key4, V value4, String key5, V value5) static <T> Output<T>ofNullable(T value) Returns anOutput<T> describing the given value, if non-null, otherwise returns an emptyOutput<T>.ofRight(R value) static <T> Output<T>ofSecret(T value) Returns anOutput<T> describing the given non-nullsecret value.static Output<com.google.gson.JsonElement>static Output<com.google.gson.JsonElement>static <T1,T2> Output<Tuples.Tuple2<T1, T2>> static <T1,T2, T3> Output<Tuples.Tuple3<T1, T2, T3>> static <T1,T2, T3, T4>
Output<Tuples.Tuple4<T1,T2, T3, T4>> static <T1,T2, T3, T4, T5>
Output<Tuples.Tuple5<T1,T2, T3, T4, T5>> 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) 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) 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 theOutputvalues in the provided parameters and combines them all into a single tuple containing each of their underlying values.
-
Method Details
-
apply
Transforms the data of thisOutput<T> with the providedfunc. The result remains anOutput<T> so that dependent resources can be properly tracked.funcshould not be used to create resources unless necessary as `func` may not be run during some program executions.funccan return otherOutput<T>s. This can be handy if you have anOutput<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 singleOutput<T> is needed that combines both set of resources, thenall(Output[])ortuple(Output, Output, Output)should be used instead.This function will only be called during execution of a
pulumi uprequest. It will not run duringpulumi preview(as the values of resources are of course not known then). -
applyValue
- Type Parameters:
U- type returned byfunc- Parameters:
func- the function to apply to the current value- Returns:
- an
Outputafter applyingfunc - See Also:
-
copy
Creates a shallow copy (the underlying CompletableFuture is copied) of thisOutput<T> -
asPlaintext
Returns a newOutput<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
Outputas a non-secret
-
asSecret
Returns a newOutput<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
Outputas a secret
-
of
Returns anOutput<T> describing the given non-nullvalue.- 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 isnull
-
of
Returns anOutput<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 isnull, but not the future value
-
ofSecret
Returns anOutput<T> describing the given non-nullsecret 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 isnull
-
ofNullable
Returns anOutput<T> describing the given value, if non-null, otherwise returns an emptyOutput<T>.- Type Parameters:
T- the type of the value- Parameters:
value- the possibly-nullvalue to describe- Returns:
- an
Output<T> with a present value if the specified value is non-null, otherwise an emptyOutput<T>
-
all
Combines all theOutput<T> values inoutputsinto a singleOutput<T> with anList<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 theOutput<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
Outputwith a list of all values of the givenoutputs
-
all
- Type Parameters:
T- the type of the value- Parameters:
outputs- the outputs to be combined- Returns:
- an
Outputwith a list of all values of the givenoutputs - See Also:
-
format
Takes in aformattableStringwith potentialOutputor a regularObject. in the 'placeholder holes'. Conceptually, this method unwraps all the underlying values in the holes, combines them appropriately with theformattableString, and produces anOutputcontaining 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 byString.format(String, Object...), the behaviour on anullargument depends on the format conversion.arguments-Outputs or regularObjects that values of will be applied to the format String- Returns:
- an
Outputwith the result of the formatting
-
ofLeft
Represents anOutputvalue 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 theLeftinstanceR- the type contained by theRightinstance- Parameters:
value- the value to create theLeftinstance with- Returns:
- an
OutputholdingLeftinstance with the given value
-
ofRight
- Type Parameters:
L- the type contained by theLeftinstanceR- the type contained by theRightinstance- Parameters:
value- the value to create theRightinstance with- Returns:
- an
OutputholdingRightinstance with the given value - See Also:
-
ofLeft
-
ofRight
-
ofJson
- Returns:
- a
JsonNull.INSTANCE - See Also:
-
ofJson
Represents anOutputvalue that wraps aJsonElement- Parameters:
json- theJsonElementto wrap- Returns:
- given
JsonElementwrapped in anOutput
-
parseJson
- Parameters:
json- the json value to wrap- Returns:
- given json value as a
JsonElementwrapped in anOutput - Throws:
com.google.gson.JsonSyntaxException- if json is not valid- See Also:
-
parseJson
-
copyOfList
- Returns:
- an
Outputholding 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 ofOutput, can take anullvalue that will be treated as an empty list, always returnsnon-null.- Type Parameters:
E- type of the list element- Parameters:
left- fist list to concatenateright- second list to concatenate- Returns:
- an
Outputwithleftandrightlists concatenated
-
ofList
-
ofList
-
ofList
-
ofList
-
ofList
-
ofList
-
ofList
-
ofList
-
ofList
-
ofList
-
ofList
-
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) -
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) -
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) -
listBuilder
- Returns:
- an
Output.ListBuilder<E> instance - See Also:
-
copyOfMap
- Returns:
- an
Outputholding 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 twoMapwrapped in anOutput. 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.
nullvalues in the Output or Map layer are treated as empty maps.- Type Parameters:
V- type of the map value- Parameters:
left- The first @seeOutput<Map<String, V>>to concatenateright- The second @seeOutput<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
-
ofMap
-
ofMap
-
ofMap
static <V> Output<Map<String,V>> ofMap(String key1, V value1, String key2, V value2, String key3, V value3) -
ofMap
static <V> Output<Map<String,V>> ofMap(String key1, V value1, String key2, V value2, String key3, V value3, String key4, V value4) -
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) -
mapBuilder
- See Also:
-
tuple
- Type Parameters:
T1- type ofitem1T2- type ofitem2- Parameters:
item1- the 1st item ot the tupleitem2- the 2nd item ot the tuple- Returns:
- an
Outputholding aTuples.Tuple2with all given items - See Also:
-
tuple
static <T1,T2, Output<Tuples.Tuple3<T1,T3> T2, tupleT3>> (Output<T1> item1, Output<T2> item2, Output<T3> item3) - Type Parameters:
T1- type ofitem1T2- type ofitem2T3- type ofitem3- Parameters:
item1- the 1st item ot the tupleitem2- the 2nd item ot the tupleitem3- the 3rd item ot the tuple- Returns:
- an
Outputholding aTuples.Tuple3with all given items - See Also:
-
tuple
static <T1,T2, Output<Tuples.Tuple4<T1,T3, T4> T2, tupleT3, T4>> (Output<T1> item1, Output<T2> item2, Output<T3> item3, Output<T4> item4) - Type Parameters:
T1- type ofitem1T2- type ofitem2T3- type ofitem3T4- type ofitem4- Parameters:
item1- the 1st item ot the tupleitem2- the 2nd item ot the tupleitem3- the 3rd item ot the tupleitem4- the 4th item ot the tuple- Returns:
- an
Outputholding aTuples.Tuple4with all given items - See Also:
-
tuple
static <T1,T2, Output<Tuples.Tuple5<T1,T3, T4, T5> T2, tupleT3, T4, T5>> (Output<T1> item1, Output<T2> item2, Output<T3> item3, Output<T4> item4, Output<T5> item5) - Type Parameters:
T1- type ofitem1T2- type ofitem2T3- type ofitem3T4- type ofitem4T5- type ofitem5- Parameters:
item1- the 1st item ot the tupleitem2- the 2nd item ot the tupleitem3- the 3rd item ot the tupleitem4- the 4th item ot the tupleitem5- the 5th item ot the tuple- Returns:
- an
Outputholding aTuples.Tuple5with all given items - See Also:
-
tuple
static <T1,T2, Output<Tuples.Tuple6<T1,T3, T4, T5, T6> T2, tupleT3, T4, T5, T6>> (Output<T1> item1, Output<T2> item2, Output<T3> item3, Output<T4> item4, Output<T5> item5, Output<T6> item6) - Type Parameters:
T1- type ofitem1T2- type ofitem2T3- type ofitem3T4- type ofitem4T5- type ofitem5T6- type ofitem6- Parameters:
item1- the 1st item ot the tupleitem2- the 2nd item ot the tupleitem3- the 3rd item ot the tupleitem4- the 4th item ot the tupleitem5- the 5th item ot the tupleitem6- the 6th item ot the tuple- Returns:
- an
Outputholding aTuples.Tuple6with all given items - See Also:
-
tuple
static <T1,T2, Output<Tuples.Tuple7<T1,T3, T4, T5, T6, T7> T2, tupleT3, T4, T5, T6, T7>> (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 ofitem1T2- type ofitem2T3- type ofitem3T4- type ofitem4T5- type ofitem5T6- type ofitem6T7- type ofitem7- Parameters:
item1- the 1st item ot the tupleitem2- the 2nd item ot the tupleitem3- the 3rd item ot the tupleitem4- the 4th item ot the tupleitem5- the 5th item ot the tupleitem6- the 6th item ot the tupleitem7- the 7th item ot the tuple- Returns:
- an
Outputholding aTuples.Tuple7with all given items - See Also:
-
tuple
static <T1,T2, Output<Tuples.Tuple8<T1,T3, T4, T5, T6, T7, T8> T2, tupleT3, T4, T5, T6, T7, T8>> (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 theOutputvalues in the provided parameters and combines them all into a single tuple containing each of their underlying values. If any of theOutputs are not known, the final result will be not known. Similarly, if any of theOutputs are secrets, then the final result will be a secret.- Type Parameters:
T1- type ofitem1T2- type ofitem2T3- type ofitem3T4- type ofitem4T5- type ofitem5T6- type ofitem6T7- type ofitem7T8- type ofitem8- Parameters:
item1- the 1st item ot the tupleitem2- the 2nd item ot the tupleitem3- the 3rd item ot the tupleitem4- the 4th item ot the tupleitem5- the 5th item ot the tupleitem6- the 6th item ot the tupleitem7- the 7th item ot the tupleitem8- the 8th item ot the tuple- Returns:
- an
Outputholding aTuples.Tuple8with all given items
-