Show / Hide Table of Contents

Class InputMap<TValue>

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<TValue> differs from a normal IDictionary<TKey, TValue> in that it is itself an Input<T>. For example, a Resource that accepts an InputMap<TValue> 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<TValue> 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<TValue> 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 },
    },
});
Inheritance
object
Input<ImmutableDictionary<string, TValue>>
InputMap<TValue>
Implements
IEnumerable
IAsyncEnumerable<Input<KeyValuePair<string, TValue>>>
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Pulumi
Assembly: Pulumi.dll
Syntax
public sealed class InputMap<TValue> : Input<ImmutableDictionary<string, TValue>>, IEnumerable, IAsyncEnumerable<Input<KeyValuePair<string, TValue>>>
Type Parameters
Name Description
TValue

Constructors

View Source

InputMap()

Declaration
public InputMap()

Properties

View Source

this[string]

Declaration
public Input<TValue> this[string key] { set; }
Parameters
Type Name Description
string key
Property Value
Type Description
Input<TValue>

Methods

View Source

Add(InputMap<TValue>)

Note: this is non-standard convenience for use with collection initializers.

Declaration
public void Add(InputMap<TValue> values)
Parameters
Type Name Description
InputMap<TValue> values
View Source

Add(string, Input<TValue>)

Declaration
public void Add(string key, Input<TValue> value)
Parameters
Type Name Description
string key
Input<TValue> value
View Source

AddRange(InputMap<TValue>)

Declaration
public void AddRange(InputMap<TValue> values)
Parameters
Type Name Description
InputMap<TValue> values
View Source

GetAsyncEnumerator(CancellationToken)

Returns an enumerator that iterates asynchronously through the collection.

Declaration
public IAsyncEnumerator<Input<KeyValuePair<string, TValue>>> GetAsyncEnumerator(CancellationToken cancellationToken)
Parameters
Type Name Description
CancellationToken cancellationToken

A CancellationToken that may be used to cancel the asynchronous iteration.

Returns
Type Description
IAsyncEnumerator<Input<KeyValuePair<string, TValue>>>

An enumerator that can be used to iterate asynchronously through the collection.

View Source

Merge(InputMap<TValue>, InputMap<TValue>)

Merge two instances of <xref href="Pulumi.InputMap%601" data-throw-if-not-resolved="false"></xref>. Returns a new <xref href="Pulumi.InputMap%601" data-throw-if-not-resolved="false"></xref>
without modifying any of the arguments.

<p></p>

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

Declaration
public static InputMap<TValue> Merge(InputMap<TValue> first, InputMap<TValue> second)
Parameters
Type Name Description
InputMap<TValue> first

The first InputMap<TValue>. Has lower priority in case of key clash.

InputMap<TValue> second

The second InputMap<TValue>. Has higher priority in case of key clash.

Returns
Type Description
InputMap<TValue>

A new instance of InputMap<TValue> that contains the items from both input maps.

Operators

View Source

implicit operator InputMap<TValue>(Output<Dictionary<string, TValue>>)

Declaration
public static implicit operator InputMap<TValue>(Output<Dictionary<string, TValue>> values)
Parameters
Type Name Description
Output<Dictionary<string, TValue>> values
Returns
Type Description
InputMap<TValue>
View Source

implicit operator InputMap<TValue>(Output<IDictionary<string, TValue>>)

Declaration
public static implicit operator InputMap<TValue>(Output<IDictionary<string, TValue>> values)
Parameters
Type Name Description
Output<IDictionary<string, TValue>> values
Returns
Type Description
InputMap<TValue>
View Source

implicit operator InputMap<TValue>(Output<ImmutableDictionary<string, TValue>>)

Declaration
public static implicit operator InputMap<TValue>(Output<ImmutableDictionary<string, TValue>> values)
Parameters
Type Name Description
Output<ImmutableDictionary<string, TValue>> values
Returns
Type Description
InputMap<TValue>
View Source

implicit operator InputMap<TValue>(Dictionary<string, TValue>)

Declaration
public static implicit operator InputMap<TValue>(Dictionary<string, TValue> values)
Parameters
Type Name Description
Dictionary<string, TValue> values
Returns
Type Description
InputMap<TValue>
View Source

implicit operator InputMap<TValue>(ImmutableDictionary<string, TValue>)

Declaration
public static implicit operator InputMap<TValue>(ImmutableDictionary<string, TValue> values)
Parameters
Type Name Description
ImmutableDictionary<string, TValue> values
Returns
Type Description
InputMap<TValue>

Implements

IEnumerable
IAsyncEnumerable<T>

Extension Methods

InputExtensions.Apply<T, TResult>(Input<T>?, Func<T, Input<TResult>?>)
InputExtensions.Apply<T, TResult>(Input<T>?, Func<T, Output<TResult>?>)
InputExtensions.Apply<T, TResult>(Input<T>?, Func<T, Task<TResult>>)
InputExtensions.Apply<T, TResult>(Input<T>?, Func<T, TResult>)
InputExtensions.ToOutput<T>(Input<T>?)

Version 3.106.2

  • View Source
Back to top Copyright 2016-2023, Pulumi Corporation.