Reservation.fromJson constructor

Reservation.fromJson(
  1. Object? j
)

Implementation

factory Reservation.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Reservation(
    advancedDeploymentControl: switch (json['advancedDeploymentControl']) {
      null => null,
      Object $1 => ReservationAdvancedDeploymentControl.fromJson($1),
    },
    aggregateReservation: switch (json['aggregateReservation']) {
      null => null,
      Object $1 => AllocationAggregateReservation.fromJson($1),
    },
    commitment: switch (json['commitment']) {
      null => null,
      Object $1 => decodeString($1),
    },
    confidentialComputeType: switch (json['confidentialComputeType']) {
      null => null,
      Object $1 => decodeString($1),
    },
    creationTimestamp: switch (json['creationTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    deleteAfterDuration: switch (json['deleteAfterDuration']) {
      null => null,
      Object $1 => Duration.fromJson($1),
    },
    deleteAtTime: switch (json['deleteAtTime']) {
      null => null,
      Object $1 => decodeString($1),
    },
    deploymentType: switch (json['deploymentType']) {
      null => null,
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => null,
      Object $1 => decodeString($1),
    },
    earlyAccessMaintenance: switch (json['earlyAccessMaintenance']) {
      null => null,
      Object $1 => decodeString($1),
    },
    enableEmergentMaintenance: switch (json['enableEmergentMaintenance']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    id: switch (json['id']) {
      null => null,
      Object $1 => decodeUint64($1),
    },
    kind: switch (json['kind']) {
      null => null,
      Object $1 => decodeString($1),
    },
    linkedCommitments: switch (json['linkedCommitments']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"linkedCommitments" is not a list'),
    },
    name: switch (json['name']) {
      null => null,
      Object $1 => decodeString($1),
    },
    params: switch (json['params']) {
      null => null,
      Object $1 => ReservationParams.fromJson($1),
    },
    protectionTier: switch (json['protectionTier']) {
      null => null,
      Object $1 => decodeString($1),
    },
    reservationSharingPolicy: switch (json['reservationSharingPolicy']) {
      null => null,
      Object $1 => AllocationReservationSharingPolicy.fromJson($1),
    },
    resourceMetadata: switch (json['resourceMetadata']) {
      null => null,
      Object $1 => ResourceMetadata.fromJson($1),
    },
    resourcePolicies: switch (json['resourcePolicies']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException('"resourcePolicies" is not an object'),
    },
    resourceStatus: switch (json['resourceStatus']) {
      null => null,
      Object $1 => AllocationResourceStatus.fromJson($1),
    },
    satisfiesPzs: switch (json['satisfiesPzs']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    schedulingType: switch (json['schedulingType']) {
      null => null,
      Object $1 => decodeString($1),
    },
    selfLink: switch (json['selfLink']) {
      null => null,
      Object $1 => decodeString($1),
    },
    shareSettings: switch (json['shareSettings']) {
      null => null,
      Object $1 => ShareSettings.fromJson($1),
    },
    specificReservation: switch (json['specificReservation']) {
      null => null,
      Object $1 => AllocationSpecificSkureservation.fromJson($1),
    },
    specificReservationRequired:
        switch (json['specificReservationRequired']) {
          null => null,
          Object $1 => decodeBool($1),
        },
    status: switch (json['status']) {
      null => null,
      Object $1 => decodeString($1),
    },
    zone: switch (json['zone']) {
      null => null,
      Object $1 => decodeString($1),
    },
  );
}