PolicyRule.fromJson constructor

PolicyRule.fromJson(
  1. Map<String, dynamic> json
)

Creates a PolicyRule from JSON data.

Implementation

factory PolicyRule.fromJson(Map<String, dynamic> json) {
  final tempApiGroupsJson = json['apiGroups'];
  final tempNonResourceURLsJson = json['nonResourceURLs'];
  final tempResourceNamesJson = json['resourceNames'];
  final tempResourcesJson = json['resources'];
  final tempVerbsJson = json['verbs'];

  final List<String>? tempApiGroups =
      tempApiGroupsJson != null ? List<String>.from(tempApiGroupsJson) : null;
  final List<String>? tempNonResourceURLs = tempNonResourceURLsJson != null
      ? List<String>.from(tempNonResourceURLsJson)
      : null;
  final List<String>? tempResourceNames = tempResourceNamesJson != null
      ? List<String>.from(tempResourceNamesJson)
      : null;
  final List<String>? tempResources =
      tempResourcesJson != null ? List<String>.from(tempResourcesJson) : null;
  final List<String> tempVerbs = List<String>.from(tempVerbsJson);

  return PolicyRule(
    apiGroups: tempApiGroups,
    nonResourceURLs: tempNonResourceURLs,
    resourceNames: tempResourceNames,
    resources: tempResources,
    verbs: tempVerbs,
  );
}