destroyResult method

Future<AutomationDestroyResult> destroyResult({
  1. bool yes = true,
  2. bool skipPreview = true,
  3. bool nonInteractive = true,
  4. bool check = true,
  5. bool captureEvents = true,
  6. bool includeSummary = true,
  7. bool showSummarySecrets = false,
  8. AutomationEngineEventHandler? onEvent,
  9. List<String> extraArgs = const <String>[],
})

Runs pulumi destroy and returns a typed operation result.

Implementation

Future<AutomationDestroyResult> destroyResult({
  bool yes = true,
  bool skipPreview = true,
  bool nonInteractive = true,
  bool check = true,
  bool captureEvents = true,
  bool includeSummary = true,
  bool showSummarySecrets = false,
  AutomationEngineEventHandler? onEvent,
  List<String> extraArgs = const <String>[],
}) async {
  final args = <String>['destroy', '--stack', name];
  if (yes) {
    args.add('--yes');
  }
  if (skipPreview) {
    args.add('--skip-preview');
  }
  if (nonInteractive) {
    args.add('--non-interactive');
  }
  args.addAll(extraArgs);

  final (result, events) = await _runStackCommand(
    args,
    check: check,
    captureEvents: captureEvents,
    onEvent: onEvent,
  );
  AutomationUpdateSummary? summary;
  final effectiveShowSummarySecrets = workspace.remote
      ? false
      : showSummarySecrets;
  if (includeSummary && result.succeeded) {
    summary = workspace.remote
        ? await _awaitTerminalRemoteSummary(
            showSecrets: effectiveShowSummarySecrets,
          )
        : await infoSummary(showSecrets: effectiveShowSummarySecrets);
  }
  return AutomationDestroyResult(
    commandResult: result,
    events: events,
    summary: summary,
  );
}