toJson method

Map<String, Object> toJson()

Converts a RuleWithOperations instance to JSON data.

Implementation

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

  final tempApiGroups = apiGroups;
  final tempApiVersions = apiVersions;
  final tempOperations = operations;
  final tempResources = resources;
  final tempScope = scope;

  if (tempApiGroups != null) {
    jsonData['apiGroups'] = tempApiGroups;
  }

  if (tempApiVersions != null) {
    jsonData['apiVersions'] = tempApiVersions;
  }

  if (tempOperations != null) {
    jsonData['operations'] = tempOperations;
  }

  if (tempResources != null) {
    jsonData['resources'] = tempResources;
  }

  if (tempScope != null) {
    jsonData['scope'] = tempScope;
  }

  return jsonData;
}