import { Output } from "./output"; /** * 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. */ export declare class Config { /** * name is the configuration bag's logical name and uniquely identifies it. The default is the name of the current * project. */ readonly name: string; constructor(name?: string); /** * get loads an optional configuration value by its key, or undefined if it doesn't exist. * * @param key The key to lookup. * @param opts An options bag to constrain legal values. */ private getImpl; /** * get loads an optional configuration value by its key, or undefined if it doesn't exist. * * @param key The key to lookup. * @param opts An options bag to constrain legal values. */ get(key: string, opts?: StringConfigOptions): K | undefined; /** * getSecret loads an optional configuration value by its key, marking it as a secret, or undefined if it * doesn't exist. * * @param key The key to lookup. * @param opts An options bag to constrain legal values. */ getSecret(key: string, opts?: StringConfigOptions): Output | undefined; private getBooleanImpl; /** * getBoolean loads an optional configuration value, as a boolean, by its key, or undefined if it doesn't exist. * If the configuration value isn't a legal boolean, this function will throw an error. * * @param key The key to lookup. */ getBoolean(key: string): boolean | undefined; /** * getSecretBoolean loads an optional configuration value, as a boolean, by its key, making it as a secret * or undefined if it doesn't exist. If the configuration value isn't a legal boolean, this function will * throw an error. * * @param key The key to lookup. */ getSecretBoolean(key: string): Output | undefined; private getNumberImpl; /** * getNumber loads an optional configuration value, as a number, by its key, or undefined if it doesn't exist. * If the configuration value isn't a legal number, this function will throw an error. * * @param key The key to lookup. * @param opts An options bag to constrain legal values. */ getNumber(key: string, opts?: NumberConfigOptions): number | undefined; /** * getSecretNumber loads an optional configuration value, as a number, by its key, marking it as a secret * or undefined if it doesn't exist. * If the configuration value isn't a legal number, this function will throw an error. * * @param key The key to lookup. * @param opts An options bag to constrain legal values. */ getSecretNumber(key: string, opts?: NumberConfigOptions): Output | undefined; private getObjectImpl; /** * getObject loads an optional configuration value, as an object, by its key, or undefined if it doesn't exist. * This routine simply JSON parses and doesn't validate the shape of the contents. * * @param key The key to lookup. */ getObject(key: string): T | undefined; /** * getSecretObject loads an optional configuration value, as an object, by its key, marking it as a secret * or undefined if it doesn't exist. * This routine simply JSON parses and doesn't validate the shape of the contents. * * @param key The key to lookup. */ getSecretObject(key: string): Output | undefined; private requireImpl; /** * require loads a configuration value by its given key. If it doesn't exist, an error is thrown. * * @param key The key to lookup. * @param opts An options bag to constrain legal values. */ require(key: string, opts?: StringConfigOptions): K; /** * require loads a configuration value by its given key, marking it as a secret. If it doesn't exist, an error * is thrown. * * @param key The key to lookup. * @param opts An options bag to constrain legal values. */ requireSecret(key: string, opts?: StringConfigOptions): Output; private requireBooleanImpl; /** * requireBoolean 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. * * @param key The key to lookup. */ requireBoolean(key: string): boolean; /** * requireSecretBoolean 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. * * @param key The key to lookup. */ requireSecretBoolean(key: string): Output; private requireNumberImpl; /** * requireNumber 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. * * @param key The key to lookup. * @param opts An options bag to constrain legal values. */ requireNumber(key: string, opts?: NumberConfigOptions): number; /** * requireSecretNumber 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. * * @param key The key to lookup. * @param opts An options bag to constrain legal values. */ requireSecretNumber(key: string, opts?: NumberConfigOptions): Output; private requireObjectImpl; /** * requireObject loads a configuration value as a JSON string and deserializes the JSON into a JavaScript object. If * it doesn't exist, or the configuration value is not a legal JSON string, an error is thrown. * * @param key The key to lookup. */ requireObject(key: string): T; /** * requireSecretObject 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 is not a legal JSON * string, an error is thrown. * * @param key The key to lookup. */ requireSecretObject(key: string): Output; /** * fullKey turns a simple configuration key into a fully resolved one, by prepending the bag's name. * * @param key The key to lookup. */ private fullKey; } /** * StringConfigOptions may be used to constrain the set of legal values a string config value may contain. */ export interface StringConfigOptions { /** * The legal enum values. If it does not match, a ConfigEnumError is thrown. */ allowedValues?: K[]; /** * The minimum string length. If the string is not this long, a ConfigRangeError is thrown. */ minLength?: number; /** * The maximum string length. If the string is longer than this, a ConfigRangeError is thrown. */ maxLength?: number; /** * A regular expression the string must match. If it does not match, a ConfigPatternError is thrown. */ pattern?: string | RegExp; } /** * NumberConfigOptions may be used to constrain the set of legal values a number config value may contain. */ export interface NumberConfigOptions { /** * The minimum number value, inclusive. If the number is less than this, a ConfigRangeError is thrown. */ min?: number; /** * The maximum number value, inclusive. If the number is greater than this, a ConfigRangeError is thrown. */ max?: number; }