Class InputMap<V>
A mapping of strings to values that can be passed in as the arguments to a
Resource. The individual values are themselves Input<T>s. i.e.
the individual values can be concrete values or Output<T>s.
InputMap<V> differs from a normal
IDictionary<TKey, TValue> in that it is
itself an
Input<T>. For example, a
Resource that accepts an
InputMap<V> will accept not just a dictionary but an
Output<T>
of a dictionary as well. This is important for cases where the
Output<T>
map from some
Resource needs to be passed into another
Resource.
Or for cases where creating the map invariably produces an
Output<T> because
its resultant value is dependent on other
Output<T>s.
This benefit of
InputMap<V> is also a limitation. Because it represents a
list of values that may eventually be created, there is no way to simply iterate over, or
access the elements of the map synchronously.
InputMap<V> is designed to be easily used in object and collection
initializers. For example, a resource that accepts a map of values can be written easily in
this form:
new SomeResource("name", new SomeResourceArgs {
MapProperty = {
{ Key1, Value1 },
{ Key2, Value2 },
{ Key3, Value3 },
},
});
Assembly: Pulumi.dll
public sealed class InputMap<V> : Input<ImmutableDictionary<string, V>>, IEnumerable, IAsyncEnumerable<Input<KeyValuePair<string, V>>>
Type Parameters
Constructors
View Source
Declaration
Properties
View Source
Declaration
public Input<V> this[string key] { set; }
Parameters
Type |
Name |
Description |
string |
key |
|
Property Value
Type |
Description |
Input<V> |
|
Methods
View Source
Note: this is non-standard convenience for use with collection initializers.
Declaration
public void Add(InputMap<V> values)
Parameters
Type |
Name |
Description |
InputMap<V> |
values |
|
View Source
Declaration
public void Add(string key, Input<V> value)
Parameters
View Source
Declaration
public void AddRange(InputMap<V> values)
Parameters
Type |
Name |
Description |
InputMap<V> |
values |
|
View Source
Declaration
public IAsyncEnumerator<Input<KeyValuePair<string, V>>> GetAsyncEnumerator(CancellationToken cancellationToken)
Parameters
Returns
View Source
Merge two instances of InputMap<V>. Returns a new InputMap<V>
without modifying any of the arguments.
If both maps contain the same key, the value from the second map takes over.
Declaration
public static InputMap<V> Merge(InputMap<V> first, InputMap<V> second)
Parameters
Returns
Type |
Description |
InputMap<V> |
A new instance of InputMap<V> that contains the items from
both input maps.
|
Operators
View Source
Declaration
public static implicit operator InputMap<V>(Output<Dictionary<string, V>> values)
Parameters
Returns
View Source
Declaration
public static implicit operator InputMap<V>(Output<IDictionary<string, V>> values)
Parameters
Returns
View Source
Declaration
public static implicit operator InputMap<V>(Output<ImmutableDictionary<string, V>> values)
Parameters
Returns
View Source
Declaration
public static implicit operator InputMap<V>(Dictionary<string, V> values)
Parameters
Returns
View Source
Declaration
public static implicit operator InputMap<V>(ImmutableDictionary<string, V> values)
Parameters
Returns
Implements
Extension Methods