579 lines
14 KiB
JSON
579 lines
14 KiB
JSON
{
|
|
"openapi": "3.0.3",
|
|
"info": {
|
|
"title": "Exdns Zone API",
|
|
"version": "0.1.0"
|
|
},
|
|
"servers": [
|
|
{
|
|
"url": "http://localhost:8080"
|
|
}
|
|
],
|
|
"components": {
|
|
"securitySchemes": {
|
|
"BearerAuth": {
|
|
"type": "http",
|
|
"scheme": "bearer",
|
|
"bearerFormat": "token"
|
|
}
|
|
},
|
|
"schemas": {
|
|
"ZoneList": {
|
|
"type": "object",
|
|
"properties": {
|
|
"zones": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"required": ["zones"]
|
|
},
|
|
"Zone": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"records": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/Record"
|
|
}
|
|
}
|
|
},
|
|
"required": ["name", "records"]
|
|
},
|
|
"ZoneWrite": {
|
|
"type": "object",
|
|
"properties": {
|
|
"records": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/Record"
|
|
}
|
|
}
|
|
},
|
|
"required": ["records"]
|
|
},
|
|
"Record": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Fully qualified name; defaults to zone name when omitted. Use @ for zone apex, * for wildcard."
|
|
},
|
|
"type": {
|
|
"type": "string",
|
|
"enum": ["a", "aaaa", "cname", "txt", "mx", "srv", "caa", "soa", "ns"]
|
|
},
|
|
"class": {
|
|
"type": "integer",
|
|
"default": 1
|
|
},
|
|
"ttl": {
|
|
"type": "integer",
|
|
"default": 0
|
|
},
|
|
"rdata": {
|
|
"$ref": "#/components/schemas/RData"
|
|
}
|
|
},
|
|
"required": ["type", "rdata"]
|
|
},
|
|
"RData": {
|
|
"oneOf": [
|
|
{
|
|
"title": "A",
|
|
"type": "object",
|
|
"properties": {
|
|
"address": {
|
|
"type": "string",
|
|
"example": "1.2.3.4"
|
|
}
|
|
},
|
|
"required": ["address"]
|
|
},
|
|
{
|
|
"title": "AAAA",
|
|
"type": "object",
|
|
"properties": {
|
|
"address": {
|
|
"type": "string",
|
|
"example": "2001:db8::1"
|
|
}
|
|
},
|
|
"required": ["address"]
|
|
},
|
|
{
|
|
"title": "CNAME",
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": ["name"]
|
|
},
|
|
{
|
|
"title": "NS",
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": ["name"]
|
|
},
|
|
{
|
|
"title": "TXT",
|
|
"type": "object",
|
|
"properties": {
|
|
"strings": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"required": ["strings"]
|
|
},
|
|
{
|
|
"title": "MX",
|
|
"type": "object",
|
|
"properties": {
|
|
"preference": {
|
|
"type": "integer"
|
|
},
|
|
"exchange": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": ["preference", "exchange"]
|
|
},
|
|
{
|
|
"title": "SRV",
|
|
"type": "object",
|
|
"properties": {
|
|
"priority": {
|
|
"type": "integer"
|
|
},
|
|
"weight": {
|
|
"type": "integer"
|
|
},
|
|
"port": {
|
|
"type": "integer"
|
|
},
|
|
"target": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": ["priority", "weight", "port", "target"]
|
|
},
|
|
{
|
|
"title": "CAA",
|
|
"type": "object",
|
|
"properties": {
|
|
"flags": {
|
|
"type": "integer"
|
|
},
|
|
"tag": {
|
|
"type": "string"
|
|
},
|
|
"value": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": ["flags", "tag", "value"]
|
|
},
|
|
{
|
|
"title": "SOA",
|
|
"type": "object",
|
|
"properties": {
|
|
"mname": {
|
|
"type": "string"
|
|
},
|
|
"rname": {
|
|
"type": "string"
|
|
},
|
|
"serial": {
|
|
"type": "integer"
|
|
},
|
|
"refresh": {
|
|
"type": "integer"
|
|
},
|
|
"retry": {
|
|
"type": "integer"
|
|
},
|
|
"expire": {
|
|
"type": "integer"
|
|
},
|
|
"minimum": {
|
|
"type": "integer"
|
|
}
|
|
},
|
|
"required": ["mname", "rname", "serial", "refresh", "retry", "expire", "minimum"]
|
|
}
|
|
]
|
|
},
|
|
"Error": {
|
|
"type": "object",
|
|
"properties": {
|
|
"error": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": ["error"]
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"paths": {
|
|
"/zones": {
|
|
"get": {
|
|
"summary": "List zones",
|
|
"responses": {
|
|
"200": {
|
|
"description": "List of zones",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ZoneList"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/zones/{name}": {
|
|
"parameters": [
|
|
{
|
|
"name": "name",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"get": {
|
|
"summary": "Get zone",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Zone details",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Zone"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not found",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"summary": "Create zone",
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ZoneWrite"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"201": {
|
|
"description": "Created",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"status": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": ["status"]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad request",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "Already exists",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Storage error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"put": {
|
|
"summary": "Update zone",
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ZoneWrite"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Updated",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"status": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": ["status"]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad request",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not found",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Storage error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"summary": "Delete zone",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Deleted",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"status": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": ["status"]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Storage error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/zones/{name}/records": {
|
|
"parameters": [
|
|
{
|
|
"name": "name",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"delete": {
|
|
"summary": "Delete records",
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ZoneWrite"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Deleted",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"status": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": ["status"]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad request",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not found",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Storage error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|