ClusterRole.fromJson constructor
Creates a ClusterRole from JSON data.
Implementation
factory ClusterRole.fromJson(Map<String, dynamic> json) {
final tempAggregationRuleJson = json['aggregationRule'];
final tempApiVersionJson = json['apiVersion'];
final tempKindJson = json['kind'];
final tempMetadataJson = json['metadata'];
final tempRulesJson = json['rules'];
final AggregationRule? tempAggregationRule = tempAggregationRuleJson != null
? AggregationRule.fromJson(tempAggregationRuleJson)
: null;
final String? tempApiVersion = tempApiVersionJson;
final String? tempKind = tempKindJson;
final ObjectMeta? tempMetadata =
tempMetadataJson != null ? ObjectMeta.fromJson(tempMetadataJson) : null;
final List<PolicyRule>? tempRules = tempRulesJson != null
? List<dynamic>.from(tempRulesJson)
.map(
(e) => PolicyRule.fromJson(
Map<String, dynamic>.from(e),
),
)
.toList()
: null;
return ClusterRole(
aggregationRule: tempAggregationRule,
apiVersion: tempApiVersion,
kind: tempKind,
metadata: tempMetadata,
rules: tempRules,
);
}