toJson method

Map<String, Object> toJson()

Converts a ResourcePolicyRule instance to JSON data.

Implementation

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

  jsonData['apiGroups'] = apiGroups;
  if (clusterScope != null) {
    jsonData['clusterScope'] = clusterScope!;
  }
  if (namespaces != null) {
    jsonData['namespaces'] = namespaces!;
  }
  jsonData['resources'] = resources;
  jsonData['verbs'] = verbs;

  return jsonData;
}