ResourcePolicyRule.fromJson constructor

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

Creates a ResourcePolicyRule from JSON data.

Implementation

factory ResourcePolicyRule.fromJson(Map<String, dynamic> json) {
  final tempApiGroupsJson = json['apiGroups'];
  final tempClusterScopeJson = json['clusterScope'];
  final tempNamespacesJson = json['namespaces'];
  final tempResourcesJson = json['resources'];
  final tempVerbsJson = json['verbs'];

  final List<String> tempApiGroups = List<String>.from(tempApiGroupsJson);
  final bool? tempClusterScope = tempClusterScopeJson;
  final List<String>? tempNamespaces = tempNamespacesJson != null
      ? List<String>.from(tempNamespacesJson)
      : null;
  final List<String> tempResources = List<String>.from(tempResourcesJson);
  final List<String> tempVerbs = List<String>.from(tempVerbsJson);

  return ResourcePolicyRule(
    apiGroups: tempApiGroups,
    clusterScope: tempClusterScope,
    namespaces: tempNamespaces,
    resources: tempResources,
    verbs: tempVerbs,
  );
}