ServiceAttachment.fromJson constructor

ServiceAttachment.fromJson(
  1. Object? j
)

Implementation

factory ServiceAttachment.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return ServiceAttachment(
    connectedEndpoints: switch (json['connectedEndpoints']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) ServiceAttachmentConnectedEndpoint.fromJson(i),
      ],
      _ => throw const FormatException('"connectedEndpoints" is not a list'),
    },
    connectionPreference: switch (json['connectionPreference']) {
      null => null,
      Object $1 => decodeString($1),
    },
    consumerAcceptLists: switch (json['consumerAcceptLists']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) ServiceAttachmentConsumerProjectLimit.fromJson(i),
      ],
      _ => throw const FormatException('"consumerAcceptLists" is not a list'),
    },
    consumerRejectLists: switch (json['consumerRejectLists']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"consumerRejectLists" is not a list'),
    },
    creationTimestamp: switch (json['creationTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => null,
      Object $1 => decodeString($1),
    },
    domainNames: switch (json['domainNames']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"domainNames" is not a list'),
    },
    enableProxyProtocol: switch (json['enableProxyProtocol']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    fingerprint: switch (json['fingerprint']) {
      null => null,
      Object $1 => decodeString($1),
    },
    id: switch (json['id']) {
      null => null,
      Object $1 => decodeUint64($1),
    },
    kind: switch (json['kind']) {
      null => null,
      Object $1 => decodeString($1),
    },
    metadata: switch (json['metadata']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException('"metadata" is not an object'),
    },
    name: switch (json['name']) {
      null => null,
      Object $1 => decodeString($1),
    },
    natIpsPerEndpoint: switch (json['natIpsPerEndpoint']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    natSubnets: switch (json['natSubnets']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"natSubnets" is not a list'),
    },
    producerForwardingRule: switch (json['producerForwardingRule']) {
      null => null,
      Object $1 => decodeString($1),
    },
    propagatedConnectionLimit: switch (json['propagatedConnectionLimit']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    pscServiceAttachmentId: switch (json['pscServiceAttachmentId']) {
      null => null,
      Object $1 => Uint128.fromJson($1),
    },
    reconcileConnections: switch (json['reconcileConnections']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    region: switch (json['region']) {
      null => null,
      Object $1 => decodeString($1),
    },
    selfLink: switch (json['selfLink']) {
      null => null,
      Object $1 => decodeString($1),
    },
    targetService: switch (json['targetService']) {
      null => null,
      Object $1 => decodeString($1),
    },
  );
}