toJson method
Converts a ClusterRole instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempAggregationRule = aggregationRule;
final tempApiVersion = apiVersion;
final tempKind = kind;
final tempMetadata = metadata;
final tempRules = rules;
if (tempAggregationRule != null) {
jsonData['aggregationRule'] = tempAggregationRule.toJson();
}
if (tempApiVersion != null) {
jsonData['apiVersion'] = tempApiVersion;
}
if (tempKind != null) {
jsonData['kind'] = tempKind;
}
if (tempMetadata != null) {
jsonData['metadata'] = tempMetadata.toJson();
}
if (tempRules != null) {
jsonData['rules'] =
tempRules.map((e) => e.toJson()).toList(growable: false);
}
return jsonData;
}