Class Config
Config is a bag of related configuration state. Each bag contains any number
of configuration variables, indexed by simple keys, and each has a name that uniquely
identifies it; two bags with different names do not share values for variables that
otherwise share the same key. For example, a bag whose name is pulumi:foo
, with keys
a
, b
, and c
, is entirely separate from a bag whose name is
pulumi:bar
with the same simple key names. Each key has a fully qualified names,
such as pulumi:foo:a
, ..., and pulumi:bar:a
, respectively.
Inheritance
System.Object
Config
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Pulumi.dll
Syntax
public sealed class Config
Constructors
View Source
Config(String)
Creates a new Config instance. name
is the
configuration bag's logical name and uniquely identifies it. The default is the name of
the current project.
Declaration
public Config(string name = null)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Methods
View Source
Get(String)
Loads an optional configuration value by its key, or null if it doesn't exist.
Declaration
public string Get(string key)
Parameters
Type |
Name |
Description |
System.String |
key |
|
Returns
Type |
Description |
System.String |
|
View Source
GetBoolean(String)
Loads an optional configuration value, as a boolean, by its key, or null if it doesn't exist.
If the configuration value isn't a legal boolean, this function will throw an error.
Declaration
public bool? GetBoolean(string key)
Parameters
Type |
Name |
Description |
System.String |
key |
|
Returns
Type |
Description |
System.Nullable<System.Boolean> |
|
View Source
GetInt32(String)
Loads an optional configuration value, as a number, by its key, or null if it doesn't exist.
If the configuration value isn't a legal number, this function will throw an error.
Declaration
public int? GetInt32(string key)
Parameters
Type |
Name |
Description |
System.String |
key |
|
Returns
Type |
Description |
System.Nullable<System.Int32> |
|
View Source
GetObject<T>(String)
Loads an optional configuration value, as an object, by its key, or null if it doesn't
exist. This works by taking the value associated with key
and passing
it to System.Text.Json.JsonSerializer.Deserialize``1(System.String,System.Text.Json.JsonSerializerOptions).
Declaration
public T GetObject<T>(string key)
Parameters
Type |
Name |
Description |
System.String |
key |
|
Returns
Type Parameters
View Source
GetSecret(String)
Loads an optional configuration value by its key, marking it as a secret, or null if it doesn't exist.
Declaration
public Output<string> GetSecret(string key)
Parameters
Type |
Name |
Description |
System.String |
key |
|
Returns
Type |
Description |
Output<System.String> |
|
View Source
GetSecretBoolean(String)
Loads an optional configuration value, as a boolean, by its key, making it as a secret or
null if it doesn't exist. If the configuration value isn't a legal boolean, this
function will throw an error.
Declaration
public Output<bool> GetSecretBoolean(string key)
Parameters
Type |
Name |
Description |
System.String |
key |
|
Returns
Type |
Description |
Output<System.Boolean> |
|
View Source
GetSecretInt32(String)
Loads an optional configuration value, as a number, by its key, marking it as a secret
or null if it doesn't exist.
If the configuration value isn't a legal number, this function will throw an error.
Declaration
public Output<int> GetSecretInt32(string key)
Parameters
Type |
Name |
Description |
System.String |
key |
|
Returns
Type |
Description |
Output<System.Int32> |
|
View Source
GetSecretObject<T>(String)
Loads an optional configuration value, as an object, by its key, marking it as a secret
or null if it doesn't exist. This works by taking the value associated with key
and passing it to System.Text.Json.JsonSerializer.Deserialize``1(System.String,System.Text.Json.JsonSerializerOptions).
Declaration
public Output<T> GetSecretObject<T>(string key)
Parameters
Type |
Name |
Description |
System.String |
key |
|
Returns
Type Parameters
View Source
Require(String)
Loads a configuration value by its given key. If it doesn't exist, an error is thrown.
Declaration
public string Require(string key)
Parameters
Type |
Name |
Description |
System.String |
key |
|
Returns
Type |
Description |
System.String |
|
View Source
RequireBoolean(String)
Loads a configuration value, as a boolean, by its given key. If it doesn't exist, or the
configuration value is not a legal boolean, an error is thrown.
Declaration
public bool RequireBoolean(string key)
Parameters
Type |
Name |
Description |
System.String |
key |
|
Returns
Type |
Description |
System.Boolean |
|
View Source
RequireInt32(String)
Loads a configuration value, as a number, by its given key. If it doesn't exist, or the
configuration value is not a legal number, an error is thrown.
Declaration
public int RequireInt32(string key)
Parameters
Type |
Name |
Description |
System.String |
key |
|
Returns
Type |
Description |
System.Int32 |
|
View Source
RequireObject<T>(String)
Loads a configuration value as a JSON string and deserializes the JSON into an object.
object. If it doesn't exist, or the configuration value cannot be converted using System.Text.Json.JsonSerializer.Deserialize``1(System.String,System.Text.Json.JsonSerializerOptions), an error is
thrown.
Declaration
public T RequireObject<T>(string key)
Parameters
Type |
Name |
Description |
System.String |
key |
|
Returns
Type Parameters
View Source
RequireSecret(String)
Loads a configuration value by its given key, marking it as a secret. If it doesn't exist, an error
is thrown.
Declaration
public Output<string> RequireSecret(string key)
Parameters
Type |
Name |
Description |
System.String |
key |
|
Returns
Type |
Description |
Output<System.String> |
|
View Source
RequireSecretBoolean(String)
Loads a configuration value, as a boolean, by its given key, marking it as a secret.
If it doesn't exist, or the configuration value is not a legal boolean, an error is thrown.
Declaration
public Output<bool> RequireSecretBoolean(string key)
Parameters
Type |
Name |
Description |
System.String |
key |
|
Returns
Type |
Description |
Output<System.Boolean> |
|
View Source
RequireSecretInt32(String)
Loads a configuration value, as a number, by its given key, marking it as a secret.
If it doesn't exist, or the configuration value is not a legal number, an error is thrown.
Declaration
public Output<int> RequireSecretInt32(string key)
Parameters
Type |
Name |
Description |
System.String |
key |
|
Returns
Type |
Description |
Output<System.Int32> |
|
View Source
RequireSecretObject<T>(String)
Loads a configuration value as a JSON string and deserializes the JSON into a JavaScript
object, marking it as a secret. If it doesn't exist, or the configuration value cannot
be converted using System.Text.Json.JsonSerializer.Deserialize``1(System.String,System.Text.Json.JsonSerializerOptions),
an error is thrown.
Declaration
public Output<T> RequireSecretObject<T>(string key)
Parameters
Type |
Name |
Description |
System.String |
key |
|
Returns
Type Parameters