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