runWithConfig method
Runs this command with prepared configuration (options). Subclasses should override this method.
Implementation
@override
Future<void> runWithConfig(
final Configuration<DeleteSecretCommandConfig> commandConfig,
) async {
final projectId = commandConfig.value(DeleteSecretCommandConfig.projectId);
final name = commandConfig.value(DeleteSecretCommandConfig.name);
final shouldDelete = await logger.confirm(
'Are you sure you want to delete the secret "$name"?',
defaultValue: false,
);
if (!shouldDelete) {
throw UserAbortException();
}
final apiCloudClient = runner.serviceProvider.cloudApiClient;
try {
await apiCloudClient.secrets.delete(
cloudCapsuleId: projectId,
key: name,
);
} on Exception catch (e, s) {
throw FailureException.nested(e, s, 'Failed to delete the secret');
}
logger.success('Successfully deleted secret: $name.');
}