toJson method

Map<String, Object> toJson()

Converts a CustomResourceDefinitionVersion instance to JSON data.

Implementation

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

  final tempAdditionalPrinterColumns = additionalPrinterColumns;
  final tempDeprecated = deprecated;
  final tempDeprecationWarning = deprecationWarning;
  final tempName = name;
  final tempSchema = schema;
  final tempServed = served;
  final tempStorage = storage;
  final tempSubresources = subresources;

  if (tempAdditionalPrinterColumns != null) {
    jsonData['additionalPrinterColumns'] = tempAdditionalPrinterColumns
        .map((e) => e.toJson())
        .toList(growable: false);
  }

  if (tempDeprecated != null) {
    jsonData['deprecated'] = tempDeprecated;
  }

  if (tempDeprecationWarning != null) {
    jsonData['deprecationWarning'] = tempDeprecationWarning;
  }

  jsonData['name'] = tempName;

  if (tempSchema != null) {
    jsonData['schema'] = tempSchema.toJson();
  }

  jsonData['served'] = tempServed;

  jsonData['storage'] = tempStorage;

  if (tempSubresources != null) {
    jsonData['subresources'] = tempSubresources.toJson();
  }

  return jsonData;
}