ServiceConfig.fromJson constructor

ServiceConfig.fromJson(
  1. Object? j
)

Implementation

factory ServiceConfig.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return ServiceConfig(
    service: switch (json['service']) {
      null => '',
      Object $1 => decodeString($1),
    },
    timeoutSeconds: switch (json['timeoutSeconds']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    availableMemory: switch (json['availableMemory']) {
      null => '',
      Object $1 => decodeString($1),
    },
    availableCpu: switch (json['availableCpu']) {
      null => '',
      Object $1 => decodeString($1),
    },
    environmentVariables: switch (json['environmentVariables']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException(
        '"environmentVariables" is not an object',
      ),
    },
    maxInstanceCount: switch (json['maxInstanceCount']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    minInstanceCount: switch (json['minInstanceCount']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    vpcConnector: switch (json['vpcConnector']) {
      null => '',
      Object $1 => decodeString($1),
    },
    vpcConnectorEgressSettings: switch (json['vpcConnectorEgressSettings']) {
      null => ServiceConfig_VpcConnectorEgressSettings.$default,
      Object $1 => ServiceConfig_VpcConnectorEgressSettings.fromJson($1),
    },
    ingressSettings: switch (json['ingressSettings']) {
      null => ServiceConfig_IngressSettings.$default,
      Object $1 => ServiceConfig_IngressSettings.fromJson($1),
    },
    uri: switch (json['uri']) {
      null => '',
      Object $1 => decodeString($1),
    },
    serviceAccountEmail: switch (json['serviceAccountEmail']) {
      null => '',
      Object $1 => decodeString($1),
    },
    allTrafficOnLatestRevision: switch (json['allTrafficOnLatestRevision']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    secretEnvironmentVariables: switch (json['secretEnvironmentVariables']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) SecretEnvVar.fromJson(i)],
      _ => throw const FormatException(
        '"secretEnvironmentVariables" is not a list',
      ),
    },
    secretVolumes: switch (json['secretVolumes']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) SecretVolume.fromJson(i)],
      _ => throw const FormatException('"secretVolumes" is not a list'),
    },
    revision: switch (json['revision']) {
      null => '',
      Object $1 => decodeString($1),
    },
    maxInstanceRequestConcurrency:
        switch (json['maxInstanceRequestConcurrency']) {
          null => 0,
          Object $1 => decodeInt($1),
        },
    securityLevel: switch (json['securityLevel']) {
      null => ServiceConfig_SecurityLevel.$default,
      Object $1 => ServiceConfig_SecurityLevel.fromJson($1),
    },
    binaryAuthorizationPolicy: switch (json['binaryAuthorizationPolicy']) {
      null => '',
      Object $1 => decodeString($1),
    },
  );
}