RouteSpec constructor

RouteSpec({
  1. String version = 'v1',
  2. String kind = 'Route',
  3. required RouteMetadata metadata,
  4. required String domain,
  5. required RouteBackend backend,
  6. List<RoutePath> paths = const [],
})

Implementation

RouteSpec({
  this.version = 'v1',
  this.kind = 'Route',
  required this.metadata,
  required this.domain,
  required this.backend,
  List<RoutePath> paths = const [],
}) : paths = List.unmodifiable(paths) {
  if (backend.agent != null) {
    for (final path in paths) {
      if (path.targetContent == null || path.targetPort != null || path.stripPrefix || path.unavailable != null) {
        throw ArgumentError('RouteSpec agent paths require targetContent without service options');
      }
      if (path.targetContent!.iap) {
        throw ArgumentError('RouteSpec agent content routes do not support IAP');
      }
    }
  }
}