ComputeResource.fromJson constructor
ComputeResource.fromJson(
- Map<String, dynamic> json
)
Implementation
factory ComputeResource.fromJson(Map<String, dynamic> json) {
return ComputeResource(
maxvCpus: json['maxvCpus'] as int,
subnets: (json['subnets'] as List)
.whereNotNull()
.map((e) => e as String)
.toList(),
type: (json['type'] as String).toCRType(),
allocationStrategy:
(json['allocationStrategy'] as String?)?.toCRAllocationStrategy(),
bidPercentage: json['bidPercentage'] as int?,
desiredvCpus: json['desiredvCpus'] as int?,
ec2Configuration: (json['ec2Configuration'] as List?)
?.whereNotNull()
.map((e) => Ec2Configuration.fromJson(e as Map<String, dynamic>))
.toList(),
ec2KeyPair: json['ec2KeyPair'] as String?,
imageId: json['imageId'] as String?,
instanceRole: json['instanceRole'] as String?,
instanceTypes: (json['instanceTypes'] as List?)
?.whereNotNull()
.map((e) => e as String)
.toList(),
launchTemplate: json['launchTemplate'] != null
? LaunchTemplateSpecification.fromJson(
json['launchTemplate'] as Map<String, dynamic>)
: null,
minvCpus: json['minvCpus'] as int?,
placementGroup: json['placementGroup'] as String?,
securityGroupIds: (json['securityGroupIds'] as List?)
?.whereNotNull()
.map((e) => e as String)
.toList(),
spotIamFleetRole: json['spotIamFleetRole'] as String?,
tags: (json['tags'] as Map<String, dynamic>?)
?.map((k, e) => MapEntry(k, e as String)),
);
}