{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/tunnelhub/latest.json",
  "x-lintel": {
    "source": "https://www.schemastore.org/tunnelhub.json",
    "sourceSha256": "c95bfc788a241e9179c5d9f36f7f8f2aa8e412f6b376dbfae0515db4bc7c1178",
    "fileMatch": [
      "tunnelhub.yml",
      "tunnelhub.yaml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "package": {
      "type": "object",
      "properties": {
        "artifact": {
          "type": "string"
        }
      },
      "required": [
        "artifact"
      ],
      "additionalProperties": false
    },
    "configuration": {
      "type": "object",
      "properties": {
        "entrypoint": {
          "type": "string"
        },
        "memorySize": {
          "type": "number"
        },
        "runtime": {
          "enum": [
            "dotnet6",
            "dotnetcore1.0",
            "dotnetcore2.0",
            "dotnetcore2.1",
            "dotnetcore3.1",
            "go1.x",
            "java11",
            "java17",
            "java8",
            "java8.al2",
            "nodejs",
            "nodejs10.x",
            "nodejs12.x",
            "nodejs14.x",
            "nodejs16.x",
            "nodejs18.x",
            "nodejs20.x",
            "nodejs22.x",
            "nodejs4.3",
            "nodejs4.3-edge",
            "nodejs6.10",
            "nodejs8.10",
            "provided",
            "provided.al2",
            "python2.7",
            "python3.10",
            "python3.11",
            "python3.6",
            "python3.7",
            "python3.8",
            "python3.9",
            "ruby2.5",
            "ruby2.7",
            "ruby3.2"
          ]
        },
        "runtimeEngine": {
          "enum": [
            "LAMBDA",
            "ECS_FARGATE"
          ],
          "type": "string"
        },
        "timeout": {
          "type": "number"
        },
        "lambdaLayers": true,
        "environmentVariables": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "runInVpc": {
          "type": "boolean",
          "description": "Whether to run Lambda in VPC. If true and vpcConfig is not provided, uses tenant settings or environment variables as fallback."
        },
        "vpcConfig": {
          "else": {
            "not": {
              "required": [
                "lambdaLayers"
              ]
            }
          },
          "properties": {
            "securityGroupIds": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "subnetIds": {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          },
          "required": [
            "subnetIds",
            "securityGroupIds"
          ],
          "type": "object",
          "if": {
            "properties": {
              "runtimeEngine": {
                "const": "LAMBDA"
              }
            }
          },
          "then": {
            "properties": {
              "lambdaLayers": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            }
          },
          "additionalProperties": false
        },
        "stsAccess": {
          "type": "object",
          "properties": {
            "assumeRoles": {
              "items": {
                "pattern": "^arn:aws:iam::\\d{12}:role/[a-zA-Z0-9+=,.@_-]+$",
                "type": "string"
              },
              "minItems": 1,
              "type": "array"
            }
          },
          "required": [
            "assumeRoles"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "runtimeEngine",
        "entrypoint",
        "runtime",
        "memorySize"
      ],
      "additionalProperties": false
    },
    "service": {
      "type": "object",
      "properties": {
        "region": {
          "type": "string"
        },
        "type": {
          "enum": [
            "automation",
            "api"
          ],
          "type": "string"
        },
        "uuid": {
          "type": "string"
        }
      },
      "required": [
        "type",
        "uuid"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "service",
    "package",
    "configuration"
  ],
  "additionalProperties": false
}
