toJson method

Map<String, Object> toJson()

Converts a ContainerStatus instance to JSON data.

Implementation

Map<String, Object> toJson() {
  final jsonData = <String, Object>{};

  final tempAllocatedResources = allocatedResources;
  final tempContainerID = containerID;
  final tempImage = image;
  final tempImageID = imageID;
  final tempLastState = lastState;
  final tempName = name;
  final tempReady = ready;
  final tempResources = resources;
  final tempRestartCount = restartCount;
  final tempStarted = started;
  final tempState = state;

  if (tempAllocatedResources != null) {
    jsonData['allocatedResources'] = tempAllocatedResources;
  }

  if (tempContainerID != null) {
    jsonData['containerID'] = tempContainerID;
  }

  jsonData['image'] = tempImage;

  jsonData['imageID'] = tempImageID;

  if (tempLastState != null) {
    jsonData['lastState'] = tempLastState.toJson();
  }

  jsonData['name'] = tempName;

  jsonData['ready'] = tempReady;

  if (tempResources != null) {
    jsonData['resources'] = tempResources.toJson();
  }

  jsonData['restartCount'] = tempRestartCount;

  if (tempStarted != null) {
    jsonData['started'] = tempStarted;
  }

  if (tempState != null) {
    jsonData['state'] = tempState.toJson();
  }

  return jsonData;
}