Instance.fromJson constructor

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

Implementation

factory Instance.fromJson(Map<String, dynamic> json) {
  return Instance(
    addOns: (json['addOns'] as List?)
        ?.whereNotNull()
        .map((e) => AddOn.fromJson(e as Map<String, dynamic>))
        .toList(),
    arn: json['arn'] as String?,
    blueprintId: json['blueprintId'] as String?,
    blueprintName: json['blueprintName'] as String?,
    bundleId: json['bundleId'] as String?,
    createdAt: timeStampFromJson(json['createdAt']),
    hardware: json['hardware'] != null
        ? InstanceHardware.fromJson(json['hardware'] as Map<String, dynamic>)
        : null,
    ipv6Address: json['ipv6Address'] as String?,
    isStaticIp: json['isStaticIp'] as bool?,
    location: json['location'] != null
        ? ResourceLocation.fromJson(json['location'] as Map<String, dynamic>)
        : null,
    name: json['name'] as String?,
    networking: json['networking'] != null
        ? InstanceNetworking.fromJson(
            json['networking'] as Map<String, dynamic>)
        : null,
    privateIpAddress: json['privateIpAddress'] as String?,
    publicIpAddress: json['publicIpAddress'] as String?,
    resourceType: (json['resourceType'] as String?)?.toResourceType(),
    sshKeyName: json['sshKeyName'] as String?,
    state: json['state'] != null
        ? InstanceState.fromJson(json['state'] as Map<String, dynamic>)
        : null,
    supportCode: json['supportCode'] as String?,
    tags: (json['tags'] as List?)
        ?.whereNotNull()
        .map((e) => Tag.fromJson(e as Map<String, dynamic>))
        .toList(),
    username: json['username'] as String?,
  );
}