ResourceRule.fromJson constructor

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

Creates a ResourceRule from JSON data.

Implementation

factory ResourceRule.fromJson(Map<String, dynamic> json) {
  final tempApiGroupsJson = json['apiGroups'];
  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>? 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 ResourceRule(
    apiGroups: tempApiGroups,
    resourceNames: tempResourceNames,
    resources: tempResources,
    verbs: tempVerbs,
  );
}