{
  "swagger": "2.0",
  "info": {
    "title": "${title}",
    "version": "${version}"
  },
  "host": "${api_url}",
  "schemes": [
    "https"
  ],
  "paths": {
    "/": {
      "get": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "X-Transaction-Id",
            "in": "header",
            "required": false,
            "type": "string"
          },
          {
            "name": "X-Transaction-Status",
            "in": "header",
            "required": false,
            "type": "string"
          },
          {
            "name": "X-DynamoDB-Skip",
            "in": "header",
            "required": false,
            "type": "string"
          },
          {
            "name": "X-S3-Skip",
            "in": "header",
            "required": false,
            "type": "string"
          },
          {
            "name": "X-SQS-Skip",
            "in": "header",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "schema": {
              "$ref": "#/definitions/Empty"
            },
            "headers": {
              "Access-Control-Allow-Origin": {
                "type": "string"
              }
            }
          },
          "400": {
            "description": "400 response",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          },
          "500": {
            "description": "500 response",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        },
        "x-amazon-apigateway-integration": {
          "uri": "${lambda_health}",
          "httpMethod": "POST",
          "responses": {
            "default": {
              "statusCode": "200"
            }
          },
          "passthroughBehavior": "when_no_match",
          "contentHandling": "CONVERT_TO_TEXT",
          "type": "aws_proxy"
        }
      },
      "options": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "schema": {
              "$ref": "#/definitions/Empty"
            },
            "headers": {
              "Access-Control-Allow-Origin": {
                "type": "string"
              },
              "Access-Control-Allow-Methods": {
                "type": "string"
              },
              "Access-Control-Allow-Headers": {
                "type": "string"
              }
            }
          }
        },
        "x-amazon-apigateway-integration": {
          "responses": {
            "default": {
              "statusCode": "200",
              "responseParameters": {
                "method.response.header.Access-Control-Allow-Methods": "'GET,OPTIONS'",
                "method.response.header.Access-Control-Allow-Headers": "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'",
                "method.response.header.Access-Control-Allow-Origin": "'*'"
              }
            }
          },
          "requestTemplates": {
            "application/json": "{\"statusCode\": 200}"
          },
          "passthroughBehavior": "when_no_match",
          "type": "mock"
        }
      }
    },
    "/inbox": {
      "post": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "X-Transaction-Id",
            "in": "header",
            "required": true,
            "type": "string"
          },
          {
            "name": "X-Message-Type",
            "in": "header",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "302": {
            "description": "302 response",
            "schema": {
              "$ref": "#/definitions/Empty"
            },
            "headers": {
              "Location": {
                "type": "string"
              }
            },
            "content": {}
          }
        },
        "security": [
          {
            "${cognito_key}": [
              "rp2/write"
            ]
          }
        ],
        "x-amazon-apigateway-integration": {
          "responses": {
            "default": {
              "statusCode": "302",
              "responseParameters": {
                "method.response.header.Location": "'${failover_url}/inbox'"
              }
            }
          },
          "requestTemplates": {
            "application/json": "{\"statusCode\": 200}"
          },
          "passthroughBehavior": "when_no_match",
          "type": "mock"
        }
      },
      "options": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "schema": {
              "$ref": "#/definitions/Empty"
            },
            "headers": {
              "Access-Control-Allow-Origin": {
                "type": "string"
              },
              "Access-Control-Allow-Methods": {
                "type": "string"
              },
              "Access-Control-Allow-Headers": {
                "type": "string"
              }
            }
          }
        },
        "x-amazon-apigateway-integration": {
          "responses": {
            "default": {
              "statusCode": "200",
              "responseParameters": {
                "method.response.header.Access-Control-Allow-Methods": "'GET,OPTIONS'",
                "method.response.header.Access-Control-Allow-Headers": "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'",
                "method.response.header.Access-Control-Allow-Origin": "'*'"
              }
            }
          },
          "requestTemplates": {
            "application/json": "{\"statusCode\": 200}"
          },
          "passthroughBehavior": "when_no_match",
          "type": "mock"
        }
      }
    },
    "/outbox": {
      "post": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "X-Transaction-Id",
            "in": "header",
            "required": true,
            "type": "string"
          },
          {
            "name": "X-Message-Type",
            "in": "header",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "302": {
            "description": "302 response",
            "schema": {
              "$ref": "#/definitions/Empty"
            },
            "headers": {
              "Location": {
                "type": "string"
              }
            },
            "content": {}
          }
        },
        "security": [
          {
            "${cognito_key}": [
              "rp2/write"
            ]
          }
        ],
        "x-amazon-apigateway-integration": {
          "responses": {
            "default": {
              "statusCode": "302",
              "responseParameters": {
                "method.response.header.Location": "'${failover_url}/outbox'"
              }
            }
          },
          "requestTemplates": {
            "application/json": "{\"statusCode\": 200}"
          },
          "passthroughBehavior": "when_no_match",
          "type": "mock"
        }
      },
      "options": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "schema": {
              "$ref": "#/definitions/Empty"
            },
            "headers": {
              "Access-Control-Allow-Origin": {
                "type": "string"
              },
              "Access-Control-Allow-Methods": {
                "type": "string"
              },
              "Access-Control-Allow-Headers": {
                "type": "string"
              }
            }
          }
        },
        "x-amazon-apigateway-integration": {
          "responses": {
            "default": {
              "statusCode": "200",
              "responseParameters": {
                "method.response.header.Access-Control-Allow-Methods": "'GET,OPTIONS'",
                "method.response.header.Access-Control-Allow-Headers": "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'",
                "method.response.header.Access-Control-Allow-Origin": "'*'"
              }
            }
          },
          "requestTemplates": {
            "application/json": "{\"statusCode\": 200}"
          },
          "passthroughBehavior": "when_no_match",
          "type": "mock"
        }
      }
    },
    "/uuid": {
      "get": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "X-Message-Type",
            "in": "header",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "302": {
            "description": "302 response",
            "schema": {
              "$ref": "#/definitions/Empty"
            },
            "headers": {
              "Location": {
                "type": "string"
              }
            },
            "content": {}
          }
        },
        "security": [
          {
            "${cognito_key}": [
              "rp2/read"
            ]
          }
        ],
        "x-amazon-apigateway-integration": {
          "responses": {
            "default": {
              "statusCode": "302",
              "responseParameters": {
                "method.response.header.Location": "'${failover_url}/uuid'"
              }
            }
          },
          "requestTemplates": {
            "application/json": "{\"statusCode\": 200}"
          },
          "passthroughBehavior": "when_no_match",
          "type": "mock"
        }
      },
      "options": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "schema": {
              "$ref": "#/definitions/Empty"
            },
            "headers": {
              "Access-Control-Allow-Origin": {
                "type": "string"
              },
              "Access-Control-Allow-Methods": {
                "type": "string"
              },
              "Access-Control-Allow-Headers": {
                "type": "string"
              }
            }
          }
        },
        "x-amazon-apigateway-integration": {
          "responses": {
            "default": {
              "statusCode": "200",
              "responseParameters": {
                "method.response.header.Access-Control-Allow-Methods": "'GET,OPTIONS'",
                "method.response.header.Access-Control-Allow-Headers": "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'",
                "method.response.header.Access-Control-Allow-Origin": "'*'"
              }
            }
          },
          "requestTemplates": {
            "application/json": "{\"statusCode\": 200}"
          },
          "passthroughBehavior": "when_no_match",
          "type": "mock"
        }
      }
    }
  },
  "securityDefinitions": {
    "${cognito_key}": {
      "type": "apiKey",
      "name": "Authorization",
      "in": "header",
      "x-amazon-apigateway-authtype": "cognito_user_pools",
      "x-amazon-apigateway-authorizer": {
        "providerARNs": [
          "${cognito_arn}"
        ],
        "type": "cognito_user_pools"
      }
    }
  },
  "definitions": {
    "Empty": {
      "type": "object",
      "title": "Empty Schema"
    },
    "Error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      },
      "title": "Error Schema"
    }
  }
}