toJson method

Map<String, Object> toJson()

Converts a ResourcePolicyRule instance to JSON data.

Implementation

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

  final tempApiGroups = apiGroups;
  final tempClusterScope = clusterScope;
  final tempNamespaces = namespaces;
  final tempResources = resources;
  final tempVerbs = verbs;

  jsonData['apiGroups'] = tempApiGroups;

  if (tempClusterScope != null) {
    jsonData['clusterScope'] = tempClusterScope;
  }

  if (tempNamespaces != null) {
    jsonData['namespaces'] = tempNamespaces;
  }

  jsonData['resources'] = tempResources;

  jsonData['verbs'] = tempVerbs;

  return jsonData;
}