{
  "openapi": "3.1.0",
  "info": {
    "title": "Gehirn DNS",
    "version": "1"
  },
  "components": {
    "schemas": {
      "Zone": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "format": "hostname"
          },
          "deletion_protection": {
            "type": "boolean",
            "default": false
          },
          "current_version_id": {
            "type": "string",
            "readOnly": true
          },
          "current_version": {
            "$ref": "#/components/schemas/Version",
            "readOnly": true
          }
        },
        "required": [
          "id",
          "name",
          "deletion_protection",
          "current_version_id",
          "current_version"
        ]
      },
      "CreateZoneRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "format": "hostname"
          },
          "deletion_protection": {
            "type": "boolean",
            "default": false
          }
        },
        "required": [
          "name"
        ]
      },
      "Version": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "readOnly": true
          },
          "name": {
            "type": "string"
          },
          "editable": {
            "type": "boolean",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "last_modified_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "version_kind": {
            "enum": [
              "TEMPLATE",
              "SNAPSHOT",
              "DELETED"
            ],
            "readOnly": true
          }
        },
        "required": [
          "id",
          "name",
          "editable",
          "created_at",
          "last_modified_at",
          "version_kind"
        ]
      },
      "CreateVersionRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "base": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ]
      },
      "RecordSet": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "format": "hostname"
          },
          "type": {
            "$ref": "#/components/schemas/RecordType"
          },
          "ttl": {
            "type": "integer",
            "format": "int32",
            "minimum": 30
          },
          "enable_alias": {
            "type": "boolean",
            "default": false
          },
          "alias_to": {
            "type": "string",
            "format": "hostname"
          },
          "records": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/RecordA"
                },
                {
                  "$ref": "#/components/schemas/RecordNS"
                },
                {
                  "$ref": "#/components/schemas/RecordCNAME"
                },
                {
                  "$ref": "#/components/schemas/RecordMX"
                },
                {
                  "$ref": "#/components/schemas/RecordTXT"
                },
                {
                  "$ref": "#/components/schemas/RecordAAAA"
                },
                {
                  "$ref": "#/components/schemas/RecordSRV"
                },
                {
                  "$ref": "#/components/schemas/RecordSVCB"
                },
                {
                  "$ref": "#/components/schemas/RecordCAA"
                }
              ]
            },
            "minItems": 0,
            "maxItems": 25
          }
        },
        "required": [
          "id",
          "name",
          "type",
          "ttl",
          "enable_alias"
        ]
      },
      "RecordA": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string",
            "format": "ipv4"
          }
        },
        "required": [
          "address"
        ]
      },
      "RecordNS": {
        "type": "object",
        "properties": {
          "nsdname": {
            "type": "string",
            "format": "hostname"
          }
        },
        "required": [
          "nsdname"
        ]
      },
      "RecordCNAME": {
        "type": "object",
        "properties": {
          "cname": {
            "type": "string",
            "format": "hostname"
          }
        },
        "required": [
          "cname"
        ]
      },
      "RecordMX": {
        "type": "object",
        "properties": {
          "prio": {
            "type": "integer",
            "minimum": 0,
            "maximum": 65535
          },
          "exchange": {
            "type": "string",
            "format": "hostname"
          }
        },
        "required": [
          "prio",
          "exchange"
        ]
      },
      "RecordTXT": {
        "type": "object",
        "properties": {
          "data": {
            "type": "string"
          }
        },
        "required": [
          "data"
        ]
      },
      "RecordAAAA": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string",
            "format": "ipv6"
          }
        },
        "required": [
          "address"
        ]
      },
      "RecordSRV": {
        "type": "object",
        "properties": {
          "prio": {
            "type": "integer",
            "minimum": 0,
            "maximum": 65535
          },
          "weight": {
            "type": "integer",
            "minimum": 0,
            "maximum": 65535
          },
          "port": {
            "type": "integer",
            "minimum": 0,
            "maximum": 65535
          },
          "target": {
            "type": "string",
            "format": "hostname"
          }
        },
        "required": [
          "prio",
          "weight",
          "port",
          "target"
        ]
      },
      "RecordSVCB": {
        "type": "object",
        "properties": {
          "prio": {
            "type": "integer",
            "minimum": 0,
            "maximum": 65535
          },
          "target": {
            "type": "string",
            "format": "hostname"
          },
          "params": {
            "type": "object",
            "properties": {
              "mandatory": {
                "type": "string"
              },
              "alpn": {
                "type": "string"
              },
              "no-default-alpn": {
                "type": "string"
              },
              "port": {
                "type": "string"
              },
              "ipv4hint": {
                "type": "string"
              },
              "ech": {
                "type": "string"
              },
              "ipv6hint": {
                "type": "string"
              }
            },
            "patternProperties": {
              "^key\\d+$": {
                "type": "string"
              }
            }
          }
        },
        "required": [
          "prio",
          "target"
        ]
      },
      "RecordCAA": {
        "type": "object",
        "properties": {
          "flags": {
            "type": "integer",
            "minimum": 0,
            "maximum": 255
          },
          "tag": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        },
        "required": [
          "flags",
          "tag",
          "value"
        ]
      },
      "RecordType": {
        "enum": [
          "A",
          "NS",
          "CNAME",
          "MX",
          "TXT",
          "AAAA",
          "SRV",
          "SVCB",
          "HTTPS",
          "CAA"
        ]
      },
      "CreateRecordSetRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "format": "hostname"
          },
          "type": {
            "$ref": "#/components/schemas/RecordType"
          },
          "ttl": {
            "type": "integer",
            "format": "int32",
            "minimum": 30
          },
          "enable_alias": {
            "type": "boolean",
            "default": false
          },
          "alias_to": {
            "type": "string",
            "format": "hostname"
          },
          "records": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/RecordA"
                },
                {
                  "$ref": "#/components/schemas/RecordNS"
                },
                {
                  "$ref": "#/components/schemas/RecordCNAME"
                },
                {
                  "$ref": "#/components/schemas/RecordMX"
                },
                {
                  "$ref": "#/components/schemas/RecordTXT"
                },
                {
                  "$ref": "#/components/schemas/RecordAAAA"
                },
                {
                  "$ref": "#/components/schemas/RecordSRV"
                },
                {
                  "$ref": "#/components/schemas/RecordSVCB"
                },
                {
                  "$ref": "#/components/schemas/RecordCAA"
                }
              ]
            },
            "minItems": 0,
            "maxItems": 25
          }
        },
        "required": [
          "name",
          "type",
          "ttl",
          "enable_alias"
        ]
      },
      "Preset": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "readOnly": true
          },
          "prev_version_id": {
            "type": "string",
            "readOnly": true
          },
          "next_version_id": {
            "type": "string",
            "readOnly": true
          },
          "snapshot_version_id": {
            "type": "string",
            "readOnly": true
          },
          "applied_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "is_completed": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "required": [
          "id",
          "name",
          "prev_version_id",
          "next_version_id",
          "snapshot_version_id",
          "applied_at",
          "completed_at",
          "created_at",
          "is_completed"
        ]
      },
      "CreatePresetRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "next_version_id": {
            "type": "string"
          },
          "applied_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "next_version_id"
        ]
      },
      "Task": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "procedure": {
            "$ref": "#/components/schemas/ProcedureName"
          },
          "state": {
            "enum": [
              1,
              2,
              3,
              4,
              5
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "result": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Version"
              },
              {
                "$ref": "#/components/schemas/ExportResponse"
              },
              {
                "$ref": "#/components/schemas/CompareResponse"
              }
            ]
          }
        },
        "required": [
          "id",
          "procedure",
          "state",
          "created_at"
        ]
      },
      "ProcedureName": {
        "enum": [
          "import",
          "export",
          "compare"
        ]
      },
      "CreateTaskRequest": {
        "type": "object",
        "properties": {
          "procedure": {
            "$ref": "#/components/schemas/ProcedureName"
          },
          "arguments": {
            "type": "object",
            "properties": {
              "self": {
                "type": "string",
                "format": "uri"
              }
            },
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false
              },
              {
                "$ref": "#/components/schemas/ImportRequest"
              },
              {
                "$ref": "#/components/schemas/CompareRequest"
              }
            ]
          }
        },
        "required": [
          "procedure",
          "arguments"
        ]
      },
      "ImportRequest": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string"
          }
        },
        "required": [
          "content"
        ]
      },
      "ExportResponse": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string"
          }
        },
        "required": [
          "content"
        ]
      },
      "CompareRequest": {
        "type": "object",
        "properties": {
          "base_version_id": {
            "type": "string"
          },
          "comparison_version_id": {
            "type": "string"
          }
        },
        "required": [
          "base_version_id",
          "comparison_version_id"
        ]
      },
      "CompareResponse": {
        "type": "object",
        "properties": {
          "deltas": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Delta"
            }
          }
        }
      },
      "Delta": {
        "type": "object",
        "properties": {
          "op": {
            "$ref": "#/components/schemas/DeltaOp"
          },
          "record": {
            "$ref": "#/components/schemas/RecordSet"
          }
        },
        "required": [
          "op",
          "record"
        ]
      },
      "DeltaOp": {
        "enum": [
          "ADDED",
          "DELETED",
          "UNCHANGED"
        ]
      }
    },
    "securitySchemes": {
      "static_token_basic": {
        "type": "http",
        "scheme": "basic"
      },
      "static_token_bearer": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "paths": {
    "/dns/v1/zones": {
      "post": {
        "operationId": "CreateZone",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateZoneRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Zone"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "ListZones",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Zone"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/dns/v1/zones/{zone_id}": {
      "parameters": [
        {
          "name": "zone_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "GetZone",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Zone"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "UpdateZone",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Zone"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Zone"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "DeleteZone",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Zone"
                }
              }
            }
          }
        }
      }
    },
    "/dns/v1/zones/{zone_id}/versions": {
      "parameters": [
        {
          "name": "zone_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "operationId": "CreateVersion",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateVersionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Version"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "ListVersions",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Version"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/dns/v1/zones/{zone_id}/versions/{version_id}": {
      "parameters": [
        {
          "name": "zone_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "version_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "GetVersion",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Version"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "UpdateVersion",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Version"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Version"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "DeleteVersion",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Version"
                }
              }
            }
          }
        }
      }
    },
    "/dns/v1/zones/{zone_id}/versions/{version_id}/records": {
      "parameters": [
        {
          "name": "zone_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "version_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "operationId": "CreateRecordSet",
        "deprecated": true,
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRecordSetRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordSet"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "ListRecordSets",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RecordSet"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/dns/v1/zones/{zone_id}/versions/{version_id}/records/{record_id}": {
      "parameters": [
        {
          "name": "zone_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "version_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "record_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "GetRecordSet",
        "deprecated": true,
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordSet"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "UpdateRecordSet",
        "deprecated": true,
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordSet"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordSet"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "DeleteRecordSet",
        "deprecated": true,
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordSet"
                }
              }
            }
          }
        }
      }
    },
    "/dns/v1/zones/{zone_id}/versions/{version_id}/records/{record_name}/IN/{record_type}": {
      "parameters": [
        {
          "name": "zone_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "version_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "record_name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "hostname"
          },
          "example": "www.example.net.",
          "description": "Fully qualified domain name in lowercase."
        },
        {
          "name": "record_type",
          "in": "path",
          "required": true,
          "schema": {
            "$ref": "#/components/schemas/RecordType"
          }
        }
      ],
      "get": {
        "operationId": "GetRecordSetByTuple",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordSet"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "UpdateRecordSetByTuple",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordSet"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordSet"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "DeleteRecordSetByTuple",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordSet"
                }
              }
            }
          }
        }
      }
    },
    "/dns/v1/zones/{zone_id}/presets": {
      "parameters": [
        {
          "name": "zone_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "operationId": "CreatePreset",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePresetRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Preset"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "ListPresets",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Preset"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/dns/v1/zones/{zone_id}/presets/{preset_id}": {
      "parameters": [
        {
          "name": "zone_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "preset_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "GetPreset",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Preset"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "DeletePreset",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Preset"
                }
              }
            }
          }
        }
      }
    },
    "/dns/v1/tasks": {
      "post": {
        "operationId": "CreateTask",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTaskRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          }
        }
      }
    },
    "/dns/v1/tasks/{task_id}": {
      "parameters": [
        {
          "name": "task_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "GetTask",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          }
        }
      }
    }
  },
  "security": [
    {
      "static_token_basic": []
    },
    {
      "static_token_bearer": []
    }
  ]
}