CockpitRemoteCommandResponse.fromExecution constructor

CockpitRemoteCommandResponse.fromExecution(
  1. CockpitCommandExecution execution
)

Implementation

factory CockpitRemoteCommandResponse.fromExecution(
  CockpitCommandExecution execution,
) {
  final artifactsByPath = {
    for (final artifact in execution.result.artifacts)
      artifact.relativePath: artifact,
  };
  return CockpitRemoteCommandResponse(
    result: execution.result,
    artifactPayloads: execution.artifactPayloads.entries
        .where((entry) => artifactsByPath.containsKey(entry.key))
        .map(
          (entry) => CockpitRemoteArtifactPayload(
            artifact: artifactsByPath[entry.key]!,
            bytes: entry.value,
          ),
        )
        .toList(growable: false),
    runtimeSteps: execution.runtimeSteps,
  );
}