ContainerStatus.fromJson constructor

ContainerStatus.fromJson(
  1. Map<String, dynamic> json
)

Creates a ContainerStatus from JSON data.

Implementation

factory ContainerStatus.fromJson(Map<String, dynamic> json) {
  final tempAllocatedResourcesJson = json['allocatedResources'];
  final tempContainerIDJson = json['containerID'];
  final tempImageJson = json['image'];
  final tempImageIDJson = json['imageID'];
  final tempLastStateJson = json['lastState'];
  final tempNameJson = json['name'];
  final tempReadyJson = json['ready'];
  final tempResourcesJson = json['resources'];
  final tempRestartCountJson = json['restartCount'];
  final tempStartedJson = json['started'];
  final tempStateJson = json['state'];

  final Map<String, String>? tempAllocatedResources =
      tempAllocatedResourcesJson != null
          ? Map<String, String>.from(tempAllocatedResourcesJson)
          : null;

  final String? tempContainerID = tempContainerIDJson;
  final String tempImage = tempImageJson;
  final String tempImageID = tempImageIDJson;
  final ContainerState? tempLastState = tempLastStateJson != null
      ? ContainerState.fromJson(tempLastStateJson)
      : null;
  final String tempName = tempNameJson;
  final bool tempReady = tempReadyJson;
  final ResourceRequirements? tempResources = tempResourcesJson != null
      ? ResourceRequirements.fromJson(tempResourcesJson)
      : null;
  final int tempRestartCount = tempRestartCountJson;
  final bool? tempStarted = tempStartedJson;
  final ContainerState? tempState =
      tempStateJson != null ? ContainerState.fromJson(tempStateJson) : null;

  return ContainerStatus(
    allocatedResources: tempAllocatedResources,
    containerID: tempContainerID,
    image: tempImage,
    imageID: tempImageID,
    lastState: tempLastState,
    name: tempName,
    ready: tempReady,
    resources: tempResources,
    restartCount: tempRestartCount,
    started: tempStarted,
    state: tempState,
  );
}