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