APIGroup.fromJson constructor
Creates a APIGroup from JSON data.
Implementation
factory APIGroup.fromJson(Map<String, dynamic> json) {
final tempApiVersionJson = json['apiVersion'];
final tempKindJson = json['kind'];
final tempNameJson = json['name'];
final tempPreferredVersionJson = json['preferredVersion'];
final tempServerAddressByClientCIDRsJson =
json['serverAddressByClientCIDRs'];
final tempVersionsJson = json['versions'];
final String? tempApiVersion = tempApiVersionJson;
final String? tempKind = tempKindJson;
final String tempName = tempNameJson;
final GroupVersionForDiscovery? tempPreferredVersion =
tempPreferredVersionJson != null
? GroupVersionForDiscovery.fromJson(tempPreferredVersionJson)
: null;
final List<ServerAddressByClientCIDR>? tempServerAddressByClientCIDRs =
tempServerAddressByClientCIDRsJson != null
? List<dynamic>.from(tempServerAddressByClientCIDRsJson)
.map(
(e) => ServerAddressByClientCIDR.fromJson(
Map<String, dynamic>.from(e),
),
)
.toList()
: null;
final List<GroupVersionForDiscovery> tempVersions =
List<dynamic>.from(tempVersionsJson)
.map(
(e) => GroupVersionForDiscovery.fromJson(
Map<String, dynamic>.from(e),
),
)
.toList();
return APIGroup(
apiVersion: tempApiVersion,
kind: tempKind,
name: tempName,
preferredVersion: tempPreferredVersion,
serverAddressByClientCIDRs: tempServerAddressByClientCIDRs,
versions: tempVersions,
);
}