toJson method
Converts a PolicyRule instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempApiGroups = apiGroups;
final tempNonResourceURLs = nonResourceURLs;
final tempResourceNames = resourceNames;
final tempResources = resources;
final tempVerbs = verbs;
if (tempApiGroups != null) {
jsonData['apiGroups'] = tempApiGroups;
}
if (tempNonResourceURLs != null) {
jsonData['nonResourceURLs'] = tempNonResourceURLs;
}
if (tempResourceNames != null) {
jsonData['resourceNames'] = tempResourceNames;
}
if (tempResources != null) {
jsonData['resources'] = tempResources;
}
jsonData['verbs'] = tempVerbs;
return jsonData;
}