setPasswords static method
Implementation
static Future<void> setPasswords(
final Client cloudApiClient, {
required final CommandLogger logger,
required final String projectId,
required final Map<String, String> passwords,
final bool suppressCommandMessages = false,
}) async {
for (final MapEntry(key: name, value: value) in passwords.entries) {
final validationError = PasswordDefinitions.isValidValue(name, value);
if (validationError != null) {
throw ErrorExitException('Password "$name": $validationError');
}
}
final secrets = {
for (final MapEntry(key: name, value: value) in passwords.entries)
PasswordDefinitions.getFullSecretName(name): value,
};
try {
await cloudApiClient.secrets.upsert(
secrets: secrets,
cloudCapsuleId: projectId,
);
} on Exception catch (e, s) {
throw FailureException.nested(e, s, 'Failed to set passwords');
}
}