Role.fromJson constructor
Creates a Role from JSON data.
Implementation
factory Role.fromJson(Map<String, dynamic> json) {
final tempApiVersionJson = json['apiVersion'];
final tempKindJson = json['kind'];
final tempMetadataJson = json['metadata'];
final tempRulesJson = json['rules'];
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 Role(
apiVersion: tempApiVersion,
kind: tempKind,
metadata: tempMetadata,
rules: tempRules,
);
}