---
swagger: "2.0"
info:
  description: "Frost APIs for storing, deleting and partial signing operations on cryptosats"
  version: "1.0.0"
  title: "frost"
schemes:
- "https"
paths:
  /frost/partial_sign:
    post:
      consumes:
      - "application/json"
      produces:
      - "application/json"
      parameters:
      - in: "body"
        name: "Empty"
        required: true
        schema:
          $ref: "#/definitions/Empty"
      responses:
        "200":
          description: "200 response"
          schema:
            $ref: "#/definitions/Empty"
      security:
      - api_key: []
      x-amazon-apigateway-request-validator: "Validate body"
      x-amazon-apigateway-integration:
        httpMethod: "POST"
        credentials: 
          Fn::Sub: ${ApiGatewayLambdaRole.Arn}
        uri: 
          Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${FrostPartialSignFunction.Arn}/invocations
        responses:
          default:
            statusCode: "200"
        requestTemplates:
          application/json: "##  See http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html\n\
            ##  This template will pass through all parameters including path, querystring,\
            \ header, stage variables, and context through to the integration endpoint\
            \ via the body/payload\n#set($allParams = $input.params())\n{\n\"body-json\"\
            \ : $input.json('$'),\n\"params\" : {\n#foreach($type in $allParams.keySet())\n\
            \    #set($params = $allParams.get($type))\n\"$type\" : {\n    #foreach($paramName\
            \ in $params.keySet())\n    \"$paramName\" : \"$util.escapeJavaScript($params.get($paramName))\"\
            \n        #if($foreach.hasNext),#end\n    #end\n}\n    #if($foreach.hasNext),#end\n\
            #end\n},\n\"stage-variables\" : {\n#foreach($key in $stageVariables.keySet())\n\
            \"$key\" : \"$util.escapeJavaScript($stageVariables.get($key))\"\n   \
            \ #if($foreach.hasNext),#end\n#end\n},\n\"context\" : {\n    \"account-id\"\
            \ : \"$context.identity.accountId\",\n    \"api-id\" : \"$context.apiId\"\
            ,\n    \"api-key\" : \"$context.identity.apiKey\",\n    \"authorizer-principal-id\"\
            \ : \"$context.authorizer.principalId\",\n    \"caller\" : \"$context.identity.caller\"\
            ,\n    \"cognito-authentication-provider\" : \"$context.identity.cognitoAuthenticationProvider\"\
            ,\n    \"cognito-authentication-type\" : \"$context.identity.cognitoAuthenticationType\"\
            ,\n    \"cognito-identity-id\" : \"$context.identity.cognitoIdentityId\"\
            ,\n    \"cognito-identity-pool-id\" : \"$context.identity.cognitoIdentityPoolId\"\
            ,\n    \"http-method\" : \"$context.httpMethod\",\n    \"stage\" : \"\
            $context.stage\",\n    \"source-ip\" : \"$context.identity.sourceIp\"\
            ,\n    \"user\" : \"$context.identity.user\",\n    \"user-agent\" : \"\
            $context.identity.userAgent\",\n    \"user-arn\" : \"$context.identity.userArn\"\
            ,\n    \"request-id\" : \"$context.requestId\",\n    \"resource-id\" :\
            \ \"$context.resourceId\",\n    \"resource-path\" : \"$context.resourcePath\"\
            ,\n    \"time-stamp\" : \"$context.requestTime\",\n    \"time-stamp-epoch\"\
            \ : \"$context.requestTimeEpoch\"\n    }\n}\n"
        passthroughBehavior: "when_no_templates"
        contentHandling: "CONVERT_TO_TEXT"
        type: "aws"
  /frost/private_key:
    post:
      consumes:
      - "application/json"
      produces:
      - "application/json"
      parameters:
      - in: "body"
        name: "Empty"
        required: true
        schema:
          $ref: "#/definitions/Empty"
      responses:
        "200":
          description: "200 response"
          schema:
            $ref: "#/definitions/Empty"
      security:
      - api_key: []
      x-amazon-apigateway-request-validator: "Validate body"
      x-amazon-apigateway-integration:
        httpMethod: "POST"
        credentials: 
          Fn::Sub: ${ApiGatewayLambdaRole.Arn}
        uri: 
          Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${FrostPrivateKeyStoreFunction.Arn}/invocations"
        responses:
          default:
            statusCode: "200"
        requestTemplates:
          application/json: "##  See http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html\n\
            ##  This template will pass through all parameters including path, querystring,\
            \ header, stage variables, and context through to the integration endpoint\
            \ via the body/payload\n#set($allParams = $input.params())\n{\n\"body-json\"\
            \ : $input.json('$'),\n\"params\" : {\n#foreach($type in $allParams.keySet())\n\
            \    #set($params = $allParams.get($type))\n\"$type\" : {\n    #foreach($paramName\
            \ in $params.keySet())\n    \"$paramName\" : \"$util.escapeJavaScript($params.get($paramName))\"\
            \n        #if($foreach.hasNext),#end\n    #end\n}\n    #if($foreach.hasNext),#end\n\
            #end\n},\n\"stage-variables\" : {\n#foreach($key in $stageVariables.keySet())\n\
            \"$key\" : \"$util.escapeJavaScript($stageVariables.get($key))\"\n   \
            \ #if($foreach.hasNext),#end\n#end\n},\n\"context\" : {\n    \"account-id\"\
            \ : \"$context.identity.accountId\",\n    \"api-id\" : \"$context.apiId\"\
            ,\n    \"api-key\" : \"$context.identity.apiKey\",\n    \"authorizer-principal-id\"\
            \ : \"$context.authorizer.principalId\",\n    \"caller\" : \"$context.identity.caller\"\
            ,\n    \"cognito-authentication-provider\" : \"$context.identity.cognitoAuthenticationProvider\"\
            ,\n    \"cognito-authentication-type\" : \"$context.identity.cognitoAuthenticationType\"\
            ,\n    \"cognito-identity-id\" : \"$context.identity.cognitoIdentityId\"\
            ,\n    \"cognito-identity-pool-id\" : \"$context.identity.cognitoIdentityPoolId\"\
            ,\n    \"http-method\" : \"$context.httpMethod\",\n    \"stage\" : \"\
            $context.stage\",\n    \"source-ip\" : \"$context.identity.sourceIp\"\
            ,\n    \"user\" : \"$context.identity.user\",\n    \"user-agent\" : \"\
            $context.identity.userAgent\",\n    \"user-arn\" : \"$context.identity.userArn\"\
            ,\n    \"request-id\" : \"$context.requestId\",\n    \"resource-id\" :\
            \ \"$context.resourceId\",\n    \"resource-path\" : \"$context.resourcePath\"\
            ,\n    \"time-stamp\" : \"$context.requestTime\",\n    \"time-stamp-epoch\"\
            \ : \"$context.requestTimeEpoch\"\n    }\n}\n"
        passthroughBehavior: "when_no_templates"
        contentHandling: "CONVERT_TO_TEXT"
        type: "aws"
    delete:
      consumes:
      - "application/json"
      produces:
      - "application/json"
      parameters:
      - in: "body"
        name: "Empty"
        required: true
        schema:
          $ref: "#/definitions/Empty"
      responses:
        "200":
          description: "200 response"
          schema:
            $ref: "#/definitions/Empty"
      security:
      - api_key: []
      x-amazon-apigateway-request-validator: "Validate body"
      x-amazon-apigateway-integration:
        httpMethod: "POST"
        credentials: 
          Fn::Sub: ${ApiGatewayLambdaRole.Arn}
        uri: 
          Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${FrostPrivateKeyDeleteFunction.Arn}/invocations
        responses:
          default:
            statusCode: "200"
        requestTemplates:
          application/json: "##  See http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html\n\
            ##  This template will pass through all parameters including path, querystring,\
            \ header, stage variables, and context through to the integration endpoint\
            \ via the body/payload\n#set($allParams = $input.params())\n{\n\"body-json\"\
            \ : $input.json('$'),\n\"params\" : {\n#foreach($type in $allParams.keySet())\n\
            \    #set($params = $allParams.get($type))\n\"$type\" : {\n    #foreach($paramName\
            \ in $params.keySet())\n    \"$paramName\" : \"$util.escapeJavaScript($params.get($paramName))\"\
            \n        #if($foreach.hasNext),#end\n    #end\n}\n    #if($foreach.hasNext),#end\n\
            #end\n},\n\"stage-variables\" : {\n#foreach($key in $stageVariables.keySet())\n\
            \"$key\" : \"$util.escapeJavaScript($stageVariables.get($key))\"\n   \
            \ #if($foreach.hasNext),#end\n#end\n},\n\"context\" : {\n    \"account-id\"\
            \ : \"$context.identity.accountId\",\n    \"api-id\" : \"$context.apiId\"\
            ,\n    \"api-key\" : \"$context.identity.apiKey\",\n    \"authorizer-principal-id\"\
            \ : \"$context.authorizer.principalId\",\n    \"caller\" : \"$context.identity.caller\"\
            ,\n    \"cognito-authentication-provider\" : \"$context.identity.cognitoAuthenticationProvider\"\
            ,\n    \"cognito-authentication-type\" : \"$context.identity.cognitoAuthenticationType\"\
            ,\n    \"cognito-identity-id\" : \"$context.identity.cognitoIdentityId\"\
            ,\n    \"cognito-identity-pool-id\" : \"$context.identity.cognitoIdentityPoolId\"\
            ,\n    \"http-method\" : \"$context.httpMethod\",\n    \"stage\" : \"\
            $context.stage\",\n    \"source-ip\" : \"$context.identity.sourceIp\"\
            ,\n    \"user\" : \"$context.identity.user\",\n    \"user-agent\" : \"\
            $context.identity.userAgent\",\n    \"user-arn\" : \"$context.identity.userArn\"\
            ,\n    \"request-id\" : \"$context.requestId\",\n    \"resource-id\" :\
            \ \"$context.resourceId\",\n    \"resource-path\" : \"$context.resourcePath\"\
            ,\n    \"time-stamp\" : \"$context.requestTime\",\n    \"time-stamp-epoch\"\
            \ : \"$context.requestTimeEpoch\"\n    }\n}\n"
        passthroughBehavior: "when_no_templates"
        contentHandling: "CONVERT_TO_TEXT"
        type: "aws"
  /queue/request:
    get:
      produces:
      - "application/json"
      parameters:
      - name: "request_id"
        in: "query"
        required: true
        type: "string"
      responses:
        "200":
          description: "200 response"
          schema:
            $ref: "#/definitions/Empty"
      security:
      - api_key: []
      x-amazon-apigateway-request-validator: "Validate query string parameters and\
        \ headers"
      x-amazon-apigateway-integration:
        httpMethod: "POST"
        credentials: 
          Fn::Sub: ${ApiGatewayLambdaRole.Arn}
        uri: 
          Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${FrostSingleRequestFunction.Arn}/invocations
        responses:
          default:
            statusCode: "200"
        passthroughBehavior: "when_no_match"
        contentHandling: "CONVERT_TO_TEXT"
        type: "aws_proxy"
    delete:
      produces:
      - "application/json"
      parameters:
      - name: "request_id"
        in: "query"
        required: true
        type: "string"
      responses:
        "200":
          description: "200 response"
          schema:
            $ref: "#/definitions/Empty"
      security:
      - api_key: []
      x-amazon-apigateway-request-validator: "Validate body, query string parameters,\
        \ and headers"
      x-amazon-apigateway-integration:
        httpMethod: "POST"
        credentials: 
          Fn::Sub: ${ApiGatewayLambdaRole.Arn}
        uri: 
          Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${FrostSingleRequestDeleteFunction.Arn}/invocations
        responses:
          default:
            statusCode: "200"
        passthroughBehavior: "when_no_match"
        contentHandling: "CONVERT_TO_TEXT"
        type: "aws_proxy"
  /queue/requests:
    get:
      produces:
      - "application/json"
      responses:
        "200":
          description: "200 response"
          schema:
            $ref: "#/definitions/Empty"
      security:
      - api_key: []
      x-amazon-apigateway-integration:
        httpMethod: "POST"
        credentials: 
          Fn::Sub: ${ApiGatewayLambdaRole.Arn}
        uri: 
          Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${FrostAllRequestsFunction.Arn}/invocations
        responses:
          default:
            statusCode: "200"
        passthroughBehavior: "when_no_match"
        contentHandling: "CONVERT_TO_TEXT"
        type: "aws_proxy"
securityDefinitions:
  api_key:
    type: "apiKey"
    name: "x-api-key"
    in: "header"
definitions:
  Empty:
    type: "object"
    title: "Empty Schema"
x-amazon-apigateway-request-validators:
  Validate body:
    validateRequestParameters: false
    validateRequestBody: true
  Validate query string parameters and headers:
    validateRequestParameters: true
    validateRequestBody: false
  Validate body, query string parameters, and headers:
    validateRequestParameters: true
    validateRequestBody: true
