{
  "swagger": "2.0",
  "info": {
    "title": "gRPC for our DBaaS central service",
    "description": "notably uses gRPC-Gateway with OpenAPI",
    "version": "0.1"
  },
  "tags": [
    {
      "name": "ClusterService"
    },
    {
      "name": "TenantService"
    },
    {
      "name": "TestTokenService"
    }
  ],
  "schemes": ["https"],
  "consumes": ["application/json"],
  "produces": ["application/json"],
  "paths": {
    "/api/v1/orgs/{org_id}/projects/{project_id}/aws-cmek": {
      "get": {
        "operationId": "GetAwsCmek",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/centralGetAwsCmekResp"
            }
          }
        },
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "type": "string",
            "format": "uint64"
          },
          {
            "name": "project_id",
            "in": "path",
            "required": true,
            "type": "string",
            "format": "uint64"
          },
          {
            "name": "region_name",
            "in": "query",
            "required": false,
            "type": "string"
          }
        ],
        "tags": ["ClusterService"]
      },
      "post": {
        "operationId": "CreateAwsCmek",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/centralCreateAwsCmekResp"
            }
          }
        },
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "type": "string",
            "format": "uint64"
          },
          {
            "name": "project_id",
            "in": "path",
            "required": true,
            "type": "string",
            "format": "uint64"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "properties": {
                "specs": {
                  "type": "array",
                  "items": {
                    "$ref": "#/definitions/centralAwsCmekSpec"
                  }
                }
              }
            }
          }
        ],
        "tags": ["ClusterService"]
      }
    },
    "/api/v1/orgs/{org_id}/projects/{project_id}/aws_account": {
      "get": {
        "summary": "CMEK related APIs",
        "operationId": "GetProjectAWSAccount",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/centralProjectAWSAccount"
            }
          }
        },
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "type": "string",
            "format": "uint64"
          },
          {
            "name": "project_id",
            "in": "path",
            "required": true,
            "type": "string",
            "format": "uint64"
          }
        ],
        "tags": ["ClusterService"]
      }
    }
  },
  "definitions": {
    "centralGetAwsCmekResp": {
      "type": "object",
      "properties": {
        "cmeks": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/centralAwsCmek"
          }
        },
        "base_resp": {
          "$ref": "#/definitions/centralBaseResp"
        }
      }
    },
    "centralAwsCmek": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uint64"
        },
        "project_id": {
          "type": "string",
          "format": "uint64"
        },
        "region_name": {
          "type": "string"
        },
        "kms_arn": {
          "type": "string"
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "centralBaseResp": {
      "type": "object",
      "properties": {
        "err_code": {
          "type": "string",
          "format": "int64"
        },
        "err_msg": {
          "type": "string"
        }
      }
    },
    "centralAwsCmekSpec": {
      "type": "object",
      "properties": {
        "region_name": {
          "type": "string"
        },
        "kms_arn": {
          "type": "string"
        }
      }
    },
    "centralCreateAwsCmekResp": {
      "type": "object",
      "properties": {
        "base_resp": {
          "$ref": "#/definitions/centralBaseResp"
        }
      }
    },
    "centralProjectAWSAccount": {
      "type": "object",
      "properties": {
        "aws_account": {
          "type": "string"
        },
        "base_resp": {
          "$ref": "#/definitions/centralBaseResp"
        }
      }
    }
  },
  "securityDefinitions": {
    "bearer": {
      "type": "apiKey",
      "description": "Authentication token, prefixed by Bearer: Bearer \u003ctoken\u003e",
      "name": "Authorization",
      "in": "header"
    }
  },
  "security": [
    {
      "bearer": []
    }
  ],
  "externalDocs": {
    "description": "DBaaS central",
    "url": "https://github.com/tidbcloud/core-svc"
  }
}
