getAllConfig method

Future<Map<String, AutomationConfigValue>> getAllConfig(
  1. String stackName
)

Reads all config values for stackName.

Implementation

Future<Map<String, AutomationConfigValue>> getAllConfig(
  String stackName,
) async {
  final result = await runPulumiCommand(<String>[
    'config',
    '--show-secrets',
    '--json',
    '--stack',
    stackName,
  ]);

  final decoded = jsonDecode(result.stdout);
  if (decoded is! Map) {
    throw FormatException('Expected object JSON from `pulumi config --json`');
  }

  final config = <String, AutomationConfigValue>{};
  for (final entry in decoded.entries) {
    config['${entry.key}'] = _decodeConfigValueFromDecoded(entry.value);
  }
  return config;
}