BackendService.fromJson constructor

BackendService.fromJson(
  1. Object? j
)

Implementation

factory BackendService.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return BackendService(
    affinityCookieTtlSec: switch (json['affinityCookieTtlSec']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    backends: switch (json['backends']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) Backend.fromJson(i)],
      _ => throw const FormatException('"backends" is not a list'),
    },
    cdnPolicy: switch (json['cdnPolicy']) {
      null => null,
      Object $1 => BackendServiceCdnPolicy.fromJson($1),
    },
    circuitBreakers: switch (json['circuitBreakers']) {
      null => null,
      Object $1 => CircuitBreakers.fromJson($1),
    },
    compressionMode: switch (json['compressionMode']) {
      null => null,
      Object $1 => decodeString($1),
    },
    connectionDraining: switch (json['connectionDraining']) {
      null => null,
      Object $1 => ConnectionDraining.fromJson($1),
    },
    connectionTrackingPolicy: switch (json['connectionTrackingPolicy']) {
      null => null,
      Object $1 => BackendServiceConnectionTrackingPolicy.fromJson($1),
    },
    consistentHash: switch (json['consistentHash']) {
      null => null,
      Object $1 => ConsistentHashLoadBalancerSettings.fromJson($1),
    },
    creationTimestamp: switch (json['creationTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    customMetrics: switch (json['customMetrics']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) BackendServiceCustomMetric.fromJson(i),
      ],
      _ => throw const FormatException('"customMetrics" is not a list'),
    },
    customRequestHeaders: switch (json['customRequestHeaders']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException(
        '"customRequestHeaders" is not a list',
      ),
    },
    customResponseHeaders: switch (json['customResponseHeaders']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException(
        '"customResponseHeaders" is not a list',
      ),
    },
    description: switch (json['description']) {
      null => null,
      Object $1 => decodeString($1),
    },
    edgeSecurityPolicy: switch (json['edgeSecurityPolicy']) {
      null => null,
      Object $1 => decodeString($1),
    },
    enableCDN: switch (json['enableCDN']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    externalManagedMigrationState:
        switch (json['externalManagedMigrationState']) {
          null => null,
          Object $1 => decodeString($1),
        },
    externalManagedMigrationTestingPercentage:
        switch (json['externalManagedMigrationTestingPercentage']) {
          null => null,
          Object $1 => decodeDouble($1),
        },
    failoverPolicy: switch (json['failoverPolicy']) {
      null => null,
      Object $1 => BackendServiceFailoverPolicy.fromJson($1),
    },
    fingerprint: switch (json['fingerprint']) {
      null => null,
      Object $1 => decodeString($1),
    },
    haPolicy: switch (json['haPolicy']) {
      null => null,
      Object $1 => BackendServiceHapolicy.fromJson($1),
    },
    healthChecks: switch (json['healthChecks']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"healthChecks" is not a list'),
    },
    iap: switch (json['iap']) {
      null => null,
      Object $1 => BackendServiceIap.fromJson($1),
    },
    id: switch (json['id']) {
      null => null,
      Object $1 => decodeUint64($1),
    },
    ipAddressSelectionPolicy: switch (json['ipAddressSelectionPolicy']) {
      null => null,
      Object $1 => decodeString($1),
    },
    kind: switch (json['kind']) {
      null => null,
      Object $1 => decodeString($1),
    },
    loadBalancingScheme: switch (json['loadBalancingScheme']) {
      null => null,
      Object $1 => decodeString($1),
    },
    localityLbPolicies: switch (json['localityLbPolicies']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1)
          BackendServiceLocalityLoadBalancingPolicyConfig.fromJson(i),
      ],
      _ => throw const FormatException('"localityLbPolicies" is not a list'),
    },
    localityLbPolicy: switch (json['localityLbPolicy']) {
      null => null,
      Object $1 => decodeString($1),
    },
    logConfig: switch (json['logConfig']) {
      null => null,
      Object $1 => BackendServiceLogConfig.fromJson($1),
    },
    maxStreamDuration: switch (json['maxStreamDuration']) {
      null => null,
      Object $1 => Duration.fromJson($1),
    },
    metadatas: switch (json['metadatas']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException('"metadatas" is not an object'),
    },
    name: switch (json['name']) {
      null => null,
      Object $1 => decodeString($1),
    },
    network: switch (json['network']) {
      null => null,
      Object $1 => decodeString($1),
    },
    networkPassThroughLbTrafficPolicy:
        switch (json['networkPassThroughLbTrafficPolicy']) {
          null => null,
          Object $1 =>
            BackendServiceNetworkPassThroughLbTrafficPolicy.fromJson($1),
        },
    orchestrationInfo: switch (json['orchestrationInfo']) {
      null => null,
      Object $1 => BackendServiceOrchestrationInfo.fromJson($1),
    },
    outlierDetection: switch (json['outlierDetection']) {
      null => null,
      Object $1 => OutlierDetection.fromJson($1),
    },
    params: switch (json['params']) {
      null => null,
      Object $1 => BackendServiceParams.fromJson($1),
    },
    port: switch (json['port']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    portName: switch (json['portName']) {
      null => null,
      Object $1 => decodeString($1),
    },
    protocol: switch (json['protocol']) {
      null => null,
      Object $1 => decodeString($1),
    },
    region: switch (json['region']) {
      null => null,
      Object $1 => decodeString($1),
    },
    securityPolicy: switch (json['securityPolicy']) {
      null => null,
      Object $1 => decodeString($1),
    },
    securitySettings: switch (json['securitySettings']) {
      null => null,
      Object $1 => SecuritySettings.fromJson($1),
    },
    selfLink: switch (json['selfLink']) {
      null => null,
      Object $1 => decodeString($1),
    },
    serviceBindings: switch (json['serviceBindings']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"serviceBindings" is not a list'),
    },
    serviceLbPolicy: switch (json['serviceLbPolicy']) {
      null => null,
      Object $1 => decodeString($1),
    },
    sessionAffinity: switch (json['sessionAffinity']) {
      null => null,
      Object $1 => decodeString($1),
    },
    strongSessionAffinityCookie:
        switch (json['strongSessionAffinityCookie']) {
          null => null,
          Object $1 => BackendServiceHttpCookie.fromJson($1),
        },
    subsetting: switch (json['subsetting']) {
      null => null,
      Object $1 => Subsetting.fromJson($1),
    },
    timeoutSec: switch (json['timeoutSec']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    tlsSettings: switch (json['tlsSettings']) {
      null => null,
      Object $1 => BackendServiceTlsSettings.fromJson($1),
    },
    usedBy: switch (json['usedBy']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) BackendServiceUsedBy.fromJson(i),
      ],
      _ => throw const FormatException('"usedBy" is not a list'),
    },
  );
}