{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--lb-web-service.json",
  "description": "Load Balanced Web Service manifest for AWS Copilot\n<https://aws.github.io/copilot-cli/docs/manifest/lb-web-service/>",
  "x-lintel": {
    "source": "https://sootyowl.github.io/aws-copilot-schemas/lb-web-service.json",
    "sourceSha256": "dcdb3b31fa6fdb35511f3e24beed91c898d3ac613ddd5808ad09f6f844751a4c"
  },
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "pattern": "^[a-zA-Z][a-zA-Z0-9-]*$",
      "description": "The name of your service."
    },
    "type": {
      "type": "string",
      "const": "Load Balanced Web Service",
      "description": "The architecture type for your service. A Load Balanced Web Service is an internet-facing service that's behind a load balancer, orchestrated by Amazon ECS on AWS Fargate."
    },
    "http": {
      "oneOf": [
        {
          "type": "boolean",
          "const": false,
          "description": "To disable the Application Load Balancer, specify http: false. Note that for a Load-Balanced Web Service, at least one of Application Load Balancer or Network Load Balancer must be enabled."
        },
        {
          "type": "object",
          "properties": {
            "path": {
              "type": "string",
              "pattern": "^/.*$",
              "description": "Requests to this path will be forwarded to your service. Each listener rule should listen on a unique path."
            },
            "alb": {
              "type": "string",
              "description": "The ARN or name of an existing public-facing ALB to import. Listener rules will be added to your listener(s). Copilot will not manage DNS-related resources like certificates."
            },
            "healthcheck": {
              "oneOf": [
                {
                  "type": "string",
                  "pattern": "^/.*$",
                  "description": "If you specify a string, Copilot interprets it as the path exposed in your container to handle target group health check requests. The default is \"/\"."
                },
                {
                  "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/http-healthcheck"
                }
              ]
            },
            "deregistration_delay": {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/duration",
              "description": "The amount of time to wait for targets to drain connections during deregistration. The default is 60s. Setting this to a larger value gives targets more time to gracefully drain connections, but increases the time required for new deployments. Range 0s-3600s."
            },
            "target_container": {
              "type": "string",
              "description": "A sidecar container that requests are routed to instead of the main service container. If the target container's port is set to 443, then the protocol is set to HTTPS so that the load balancer establishes TLS connections with the Fargate tasks using certificates that you install on the target container."
            },
            "target_port": {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/port-value",
              "description": "Optional. The container port that receives traffic. By default, this will be image.port if the target container is the main container, or sidecars.<n>.port if the target container is a sidecar."
            },
            "stickiness": {
              "type": "boolean",
              "description": "Indicates whether sticky sessions are enabled."
            },
            "allowed_source_ips": {
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/\\d{1,2}$"
              },
              "description": "CIDR IP addresses permitted to access your service."
            },
            "alias": {
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "hosted_zone": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "name"
                    ],
                    "additionalProperties": false
                  }
                }
              ],
              "description": "HTTPS domain alias of your service."
            },
            "hosted_zone": {
              "type": "string",
              "description": "ID of your existing hosted zone; can only be used with http.alias. If you have an environment with imported certificates, you can specify the hosted zone into which Copilot should insert the A record once the load balancer is created."
            },
            "redirect_to_https": {
              "type": "boolean",
              "default": true,
              "description": "Automatically redirect the Application Load Balancer from HTTP to HTTPS. By default it is true."
            },
            "version": {
              "type": "string",
              "enum": [
                "grpc",
                "http1",
                "http2"
              ],
              "description": "The HTTP(S) protocol version. Must be one of 'grpc', 'http1', or 'http2'. If omitted, then 'http1' is assumed. If using gRPC, please note that a domain must be associated with your application."
            },
            "additional_rules": {
              "type": "array",
              "items": {
                "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/http-additional-rule"
              },
              "description": "Configure multiple ALB listener rules."
            }
          },
          "additionalProperties": false
        }
      ],
      "description": "The http section contains parameters related to integrating your service with an Application Load Balancer."
    },
    "nlb": {
      "type": "object",
      "properties": {
        "port": {
          "type": "string",
          "pattern": "^\\d+(/(?:tcp|udp|tls))?$",
          "description": "Required. The port and protocol for the Network Load Balancer to listen on."
        },
        "healthcheck": {
          "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/nlb-healthcheck",
          "description": "Specify the health check configuration for your Network Load Balancer."
        },
        "target_container": {
          "type": "string",
          "description": "A sidecar container that takes the place of a service container."
        },
        "target_port": {
          "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/port-value",
          "description": "The container port that receives traffic. Specify this field if the container port is different from nlb.port, the listener port."
        },
        "ssl_policy": {
          "type": "string",
          "description": "The security policy that defines which protocols and ciphers are supported. To learn more, see this doc."
        },
        "stickiness": {
          "type": "boolean",
          "description": "Indicates whether sticky sessions are enabled."
        },
        "alias": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ],
          "description": "Domain aliases for your service."
        },
        "additional_listeners": {
          "type": "array",
          "items": {
            "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/nlb-additional-listener"
          },
          "description": "Configure multiple NLB listeners."
        }
      },
      "required": [
        "port"
      ],
      "description": "The nlb section contains parameters related to integrating your service with a Network Load Balancer.",
      "additionalProperties": false
    },
    "image": {
      "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/image-config",
      "description": "The image section contains parameters relating to the Docker build configuration or referring to an existing container image."
    },
    "cpu": {
      "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/cpu"
    },
    "memory": {
      "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/memory"
    },
    "platform": {
      "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/platform"
    },
    "count": {
      "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/count"
    },
    "exec": {
      "type": "boolean",
      "description": "Enable running commands in your container. The default is false. Required for $ copilot svc exec."
    },
    "deployment": {
      "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/deployment",
      "description": "The deployment section contains parameters to control how many tasks run during the deployment and the ordering of stopping and starting tasks."
    },
    "entrypoint": {
      "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/entrypoint"
    },
    "command": {
      "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/command"
    },
    "sidecars": {
      "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/sidecars"
    },
    "network": {
      "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/network",
      "description": "The network section contains parameters for connecting to AWS resources in a VPC."
    },
    "variables": {
      "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/environment-variables",
      "description": "Key-value pairs that represent environment variables that will be passed to your service. Copilot will include a number of environment variables by default for you."
    },
    "env_file": {
      "type": "string",
      "description": "The path to a file from the root of your workspace containing the environment variables to pass to the main container. For more information about the environment variable file, see Considerations for specifying environment variable files."
    },
    "secrets": {
      "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/secrets",
      "description": "Key-value pairs that represent secret values from AWS Systems Manager Parameter Store or AWS Secrets Manager that will be securely passed to your service as environment variables."
    },
    "storage": {
      "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/storage",
      "description": "The Storage section lets you specify external EFS volumes for your containers and sidecars to mount. This allows you to access persistent storage across availability zones in a region for data processing or CMS workloads. For more detail, see the storage page. You can also specify extensible ephemeral storage at the task level."
    },
    "publish": {
      "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/publish",
      "description": "The publish section allows services to publish messages to one or more SNS topics."
    },
    "logging": {
      "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/logging",
      "description": "The logging section contains log configuration. You can also configure parameters for your container's FireLens log driver in this section."
    },
    "observability": {
      "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/observability",
      "description": "The observability section lets you configure ways to measure your service's current state. Currently, only tracing configuration is supported."
    },
    "taskdef_overrides": {
      "type": "array",
      "items": {
        "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/taskdef-override"
      },
      "description": "The taskdef_overrides section allows users to apply overriding rules to their ECS Task Definitions."
    },
    "environments": {
      "$ref": "https://catalog.lintel.tools/schemas/schemastore/aws-copilot-manifest/_shared/latest--common-definitions.json#/$defs/environments",
      "description": "The environment section lets you override any value in your manifest based on the environment you're in."
    }
  },
  "required": [
    "name",
    "type"
  ],
  "additionalProperties": false
}
