Endpoint.fromJson constructor

Endpoint.fromJson(
  1. Object? j
)

Implementation

factory Endpoint.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Endpoint(
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    displayName: switch (json['displayName']) {
      null => '',
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => '',
      Object $1 => decodeString($1),
    },
    deployedModels: switch (json['deployedModels']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) DeployedModel.fromJson(i)],
      _ => throw const FormatException('"deployedModels" is not a list'),
    },
    trafficSplit: switch (json['trafficSplit']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries) decodeString(e.key): decodeInt(e.value),
      },
      _ => throw const FormatException('"trafficSplit" is not an object'),
    },
    etag: switch (json['etag']) {
      null => '',
      Object $1 => decodeString($1),
    },
    labels: switch (json['labels']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException('"labels" is not an object'),
    },
    createTime: switch (json['createTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    updateTime: switch (json['updateTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    encryptionSpec: switch (json['encryptionSpec']) {
      null => null,
      Object $1 => EncryptionSpec.fromJson($1),
    },
    network: switch (json['network']) {
      null => '',
      Object $1 => decodeString($1),
    },
    enablePrivateServiceConnect:
        switch (json['enablePrivateServiceConnect']) {
          null => false,
          Object $1 => decodeBool($1),
        },
    privateServiceConnectConfig:
        switch (json['privateServiceConnectConfig']) {
          null => null,
          Object $1 => PrivateServiceConnectConfig.fromJson($1),
        },
    modelDeploymentMonitoringJob:
        switch (json['modelDeploymentMonitoringJob']) {
          null => '',
          Object $1 => decodeString($1),
        },
    predictRequestResponseLoggingConfig:
        switch (json['predictRequestResponseLoggingConfig']) {
          null => null,
          Object $1 => PredictRequestResponseLoggingConfig.fromJson($1),
        },
    dedicatedEndpointEnabled: switch (json['dedicatedEndpointEnabled']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    dedicatedEndpointDns: switch (json['dedicatedEndpointDns']) {
      null => '',
      Object $1 => decodeString($1),
    },
    clientConnectionConfig: switch (json['clientConnectionConfig']) {
      null => null,
      Object $1 => ClientConnectionConfig.fromJson($1),
    },
    satisfiesPzs: switch (json['satisfiesPzs']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    satisfiesPzi: switch (json['satisfiesPzi']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    genAiAdvancedFeaturesConfig:
        switch (json['genAiAdvancedFeaturesConfig']) {
          null => null,
          Object $1 => GenAiAdvancedFeaturesConfig.fromJson($1),
        },
    privateModelServerEnabled: switch (json['privateModelServerEnabled']) {
      null => false,
      Object $1 => decodeBool($1),
    },
  );
}