﻿{
  "swagger": "2.0",
  "info": {
    "version": "v1",
    "title": "AdcsBridge"
  },
  "host": "localhost:59626",
  "schemes": [
    "http"
  ],
  "paths": {
    "/api/v{version}/certificate/request": {
      "post": {
        "tags": [
          "Certificate"
        ],
        "operationId": "Certificate_CreateCertificate",
        "consumes": [
          "application/json",
          "text/json"
        ],
        "produces": [
          "application/json",
          "text/json"
        ],
        "parameters": [
          {
            "name": "certificateRequest",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/CreateCertificateRequest"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/CreateCertificateResponse"
            }
          }
        }
      }
    },
    "/api/v{version}/certificate/retrieve": {
      "post": {
        "tags": [
          "Certificate"
        ],
        "operationId": "Certificate_GetCertificate",
        "consumes": [
          "application/json",
          "text/json"
        ],
        "produces": [
          "application/json",
          "text/json"
        ],
        "parameters": [
          {
            "name": "request",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/RetrieveCertificateRequest"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/RetrieveCertificateResponse"
            }
          }
        }
      }
    },
    "/api/v{version}/certificate/revoke": {
      "post": {
        "tags": [
          "Certificate"
        ],
        "operationId": "Certificate_RevokeCertificates",
        "consumes": [
          "application/json",
          "text/json"
        ],
        "produces": [
          "application/json",
          "text/json"
        ],
        "parameters": [
          {
            "name": "request",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/RevokeCertificatesRequest"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/RevokeCertificatesResponse"
            }
          }
        }
      }
    },
    "/api/v{version}/version": {
      "get": {
        "tags": [
          "Version"
        ],
        "operationId": "Version_Get",
        "consumes": [],
        "produces": [
          "application/json",
          "text/json"
        ],
        "parameters": [
          {
            "name": "version",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  },
  "definitions": {
    "CreateCertificateRequest": {
      "required": [
        "pkcs10",
        "config"
      ],
      "type": "object",
      "properties": {
        "pkcs10": {
          "type": "string"
        },
        "template": {
          "type": "string"
        },
        "config": {
          "$ref": "#/definitions/AdcsConfig"
        }
      }
    },
    "AdcsConfig": {
      "required": [
        "dc",
        "ca"
      ],
      "type": "object",
      "properties": {
        "dc": {
          "type": "string"
        },
        "ca": {
          "type": "string"
        }
      }
    },
    "CreateCertificateResponse": {
      "type": "object",
      "properties": {
        "request-status": {
          "$ref": "#/definitions/RequestStatus"
        },
        "request-id": {
          "format": "int32",
          "type": "integer"
        }
      }
    },
    "RequestStatus": {
      "required": [
        "message"
      ],
      "type": "object",
      "properties": {
        "status": {
          "enum": [
            "CR_DISP_INCOMPLETE",
            "CR_DISP_ERROR",
            "CR_DISP_DENIED",
            "CR_DISP_ISSUED",
            "CR_DISP_ISSUED_OUT_OF_BAND",
            "CR_DISP_UNDER_SUBMISSION",
            "INTERNAL_ERROR"
          ],
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    },
    "RetrieveCertificateRequest": {
      "required": [
        "request-id",
        "config"
      ],
      "type": "object",
      "properties": {
        "request-id": {
          "format": "int32",
          "type": "integer"
        },
        "config": {
          "$ref": "#/definitions/AdcsConfig"
        }
      }
    },
    "RetrieveCertificateResponse": {
      "type": "object",
      "properties": {
        "request-status": {
          "$ref": "#/definitions/RequestStatus"
        },
        "x509": {
          "type": "string"
        }
      }
    },
    "RevokeCertificatesRequest": {
      "required": [
        "serial-numbers",
        "config"
      ],
      "type": "object",
      "properties": {
        "serial-numbers": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "reason": {
          "enum": [
            "CRL_REASON_UNSPECIFIED",
            "CRL_REASON_KEY_COMPROMISE",
            "CRL_REASON_CA_COMPROMISE",
            "CRL_REASON_AFFILIATION_CHANGED",
            "CRL_REASON_SUPERSEDED",
            "CRL_REASON_CESSATION_OF_OPERATION",
            "CRL_REASON_CERTIFICATE_HOLD",
            "REINSTATE"
          ],
          "type": "string"
        },
        "config": {
          "$ref": "#/definitions/AdcsConfig"
        }
      }
    },
    "RevokeCertificatesResponse": {
      "type": "object",
      "properties": {
        "failures": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/RevokeCertificateResponse"
          }
        }
      }
    },
    "RevokeCertificateResponse": {
      "type": "object",
      "properties": {
        "serial-number": {
          "type": "string"
        },
        "result": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    }
  }
}
