toJson method

Map<String, Object> toJson()

Converts a Deployment instance to JSON data.

Implementation

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

  final tempApiVersion = apiVersion;
  final tempKind = kind;
  final tempMetadata = metadata;
  final tempSpec = spec;
  final tempStatus = status;

  if (tempApiVersion != null) {
    jsonData['apiVersion'] = tempApiVersion;
  }

  if (tempKind != null) {
    jsonData['kind'] = tempKind;
  }

  if (tempMetadata != null) {
    jsonData['metadata'] = tempMetadata.toJson();
  }

  if (tempSpec != null) {
    jsonData['spec'] = tempSpec.toJson();
  }

  if (tempStatus != null) {
    jsonData['status'] = tempStatus.toJson();
  }

  return jsonData;
}