]> granicus.if.org Git - pdns/commitdiff
Auth: Generate API documentation based on swagger file
authorPieter Lexis <pieter.lexis@powerdns.com>
Tue, 21 Nov 2017 17:09:30 +0000 (18:09 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Tue, 5 Dec 2017 17:47:57 +0000 (18:47 +0100)
17 files changed:
docs/conf.py
docs/http-api/cryptokey.rst [new file with mode: 0644]
docs/http-api/cryptokeyitem.rst [deleted file]
docs/http-api/endpoint-cryptokeys.rst [deleted file]
docs/http-api/endpoint-search.rst [deleted file]
docs/http-api/endpoint-zone-metadata.rst [deleted file]
docs/http-api/endpoint-zones.rst [deleted file]
docs/http-api/index.rst
docs/http-api/metadata.rst [new file with mode: 0644]
docs/http-api/search.rst [new file with mode: 0644]
docs/http-api/server.rst [new file with mode: 0644]
docs/http-api/statistics.rst [new file with mode: 0644]
docs/http-api/swagger/authoritative-api-swagger.yaml
docs/http-api/zone.rst
docs/http-api/zonemetadata.rst [deleted file]
docs/requirements.txt
docs/settings.rst

index ca7be80a8c52b6e9dd578778357158a0b84c21ea..2e59afd8a5a96adb89e59b1977d1b1d6128ba4fc 100644 (file)
@@ -34,7 +34,7 @@ import guzzle_sphinx_theme
 # ones.
 #extensions = []
 #extensions = ['redjack.sphinx.lua', 'sphinxcontrib.httpdomain', 'sphinxjsondomain']
-extensions = ['sphinxcontrib.httpdomain', 'sphinxjsondomain',
+extensions = ['sphinxcontrib.openapi',
               'sphinxcontrib.fulltoc', 'changelog']
 
 # Add any paths that contain templates here, relative to this directory.
@@ -77,7 +77,7 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store',
                     '.venv',
                     'security-advisories/security-policy.rst',
                     'common/secpoll.rst',
-                    'common/api/zone.rst']
+                    'common/api/*']
 
 # The name of the Pygments (syntax highlighting) style to use.
 pygments_style = 'sphinx'
diff --git a/docs/http-api/cryptokey.rst b/docs/http-api/cryptokey.rst
new file mode 100644 (file)
index 0000000..14c711a
--- /dev/null
@@ -0,0 +1,15 @@
+Cryptokeys
+==========
+.. versionadded:: 4.1.0
+
+Allows for modifying DNSSEC key material via the API.
+
+Endpoints
+---------
+.. openapi:: swagger/authoritative-api-swagger.yaml
+  :paths: /servers/{server_id}/zones/{zone_id}/cryptokeys /servers/{server_id}/zones/{zone_id}/cryptokeys/{cryptokey_id}
+
+Objects
+-------
+.. openapi:: swagger/authoritative-api-swagger.yaml
+  :definitions: Cryptokey
diff --git a/docs/http-api/cryptokeyitem.rst b/docs/http-api/cryptokeyitem.rst
deleted file mode 100644 (file)
index 80951d1..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-Cryptokeys
-==========
-
-CryptoKey
----------
-
-.. json:object:: CryptoKey
-
-  Represents a DNSSEC crypto key
-
-  :param string type: "Cryptokey"
-  :param int id: The internal identifier, read only
-  :param string keytype: One of the following: ``ksk``, ``zsk``, ``csk``
-  :param bool active: Whether or not the key is in active use
-  :param string dnskey: The DNSKEY record for this key
-  :param [string] ds: An array of DS records for this key
-  :param string privatekey: The private key in ISC format
-  :param string algorithm: The key's algorithm
-  :param int bit: The bitsize of this key
diff --git a/docs/http-api/endpoint-cryptokeys.rst b/docs/http-api/endpoint-cryptokeys.rst
deleted file mode 100644 (file)
index 021abb4..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-CryptoKeys endpoint
-===================
-
-.. versionadded:: 4.1.0
-
-These endpoints allow for the manipulation of DNSSEC crypto material.
-
-.. http:get:: /api/v1/servers/:server_id/zones/:zone_id/cryptokeys
-
-  Get all :json:object:`CryptoKeys <CryptoKey>` for a zone, except the privatekey
-
-  :param server_id: The name of the server
-  :param zone_id: The id value of the :json:object:`Zone`
-
-.. http:post:: /api/v1/servers/:server_id/zones/:zone_id/cryptokeys
-
-  This method adds a new key to a zone, POST data should be a :json:object:`CryptoKey`.
-  But not all fields needs to be present:
-
-  The key can either be generated or imported by supplying the ``privatekey`` parameter.
-
-  if ``privatekey``, ``bits`` and ``algorithm`` are null, a key will be generated based
-  on the :ref:`setting-default-ksk-algorithm` and :ref:`setting-default-ksk-size`
-  settings for a KSK and the :ref:`setting-default-zsk-algorithm` and :ref:`setting-default-zsk-size`
-  options for a ZSK.
-
-  :param server_id: The name of the server
-  :param zone_id: The id value of the :json:object:`Zone`
-  :statuscode 201: Everything was fine, returns all public data as a :json:object:`CryptoKey`.
-  :statuscode 422: Returned when something is wrong with the content of the request.
-                   Contains an error message
-  :resjson string error: Has the error message
-
-.. http:get:: /api/v1/servers/:server_id/zones/:zone_name/cryptokeys/:cryptokey_id
-
-  Returns all data about the :json:object:`CryptoKey`, including the ``privatekey``.
-
-  :param string server_id: The name of the server
-  :param string zone_id: The id value of the :json:object:`Zone`
-  :param string cryptokey_id: The id value of the :json:object:`CryptoKey`
-
-.. http:put:: /api/v1/servers/:server_id/zones/:zone_name/cryptokeys/:cryptokey_id
-
-  This method changes a key from ``zone_name`` specified by ``cryptokey_id``.
-  At this time, only changing the ``active`` parameter is supported.
-
-  :param string server_id: The name of the server
-  :param string zone_id: The id value of the :json:object:`Zone`
-  :param string cryptokey_id: The id value of the :json:object:`CryptoKey`
-  :reqjson bool active: The new 'active' status of the key
-  :statuscode 204: Everything was fine, the key with ``cryptokey_id`` is de/activated.
-  :statuscode 422: Returned when something is wrong with the content of the request.
-                   Contains an error message
-  :resjson string error: Has the error message
-
-.. http:delete:: /api/v1/servers/:server_id/zones/:zone_name/cryptokeys/:cryptokey_id
-
-  This method deletes a key from ``zone_name`` specified by ``cryptokey_id``.
-
-  :param string server_id: The name of the server
-  :param string zone_id: The id value of the :json:object:`Zone`
-  :param string cryptokey_id: The id value of the :json:object:`CryptoKey`
-  :statuscode 200: Everything was fine, the key with ``cryptokey_id`` is gone
-  :statuscode 422: Returned when the key could not be removed.
-                   Contains an error message
-  :resjson string error: Has the error message
diff --git a/docs/http-api/endpoint-search.rst b/docs/http-api/endpoint-search.rst
deleted file mode 100644 (file)
index 773cdd0..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-Data Search Endpoint
-====================
-
-.. http:get:: /api/v1/servers/:server_id/search-data?q=:search_term&max=:max_results
-
-  Search the data inside PowerDNS for ``search_term`` and return at most
-  ``max_results``. This includes zones, records and comments. The ``*``
-  character can be used in ``search_term`` as a wildcard character and the
-  ``?`` character can be used as a wildcard for a single character.
-
-  :param server_id: The name of the server
-  :query string search_term: The term to search for
-  :query int max_results: Maximum number of entries to return
-
-  Response body is an array of one or more of the following objects:
-
-  .. code-block:: http
-
-    HTTP/1.1 200 OK
-    Content-Type: application/json
-
-    [
-      {
-        "name": "example.com.",
-        "object_type": "zone",
-        "zone_id": "example.com."
-      }
-    ]
-
-
-  For a record:
-
-  .. code-block:: http
-
-    HTTP/1.1 200 OK
-    Content-Type: application/json
-
-    [
-      {
-        "content": "192.0.2.1",
-        "disabled": false,
-        "name": "www.example.com",
-        "object_type": "record",
-        "ttl": 1200,
-        "type": "A",
-        "zone": "example.com.",
-        "zone_id": "example.com."
-      }
-    ]
-
-  For a comment:
-
-  .. code-block:: http
-
-    HTTP/1.1 200 OK
-    Content-Type: application/json
-
-    [
-      {
-        "object_type": "comment",
-        "name": "www.example.com",
-        "content": "An awesome comment",
-        "zone": "example.com.",
-        "zone_id": "example.com."
-      }
-    ]
diff --git a/docs/http-api/endpoint-zone-metadata.rst b/docs/http-api/endpoint-zone-metadata.rst
deleted file mode 100644 (file)
index ace6544..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-Zone Metadata endpoints
-=======================
-
-.. versionadded:: 4.1.0
-
-.. http:get:: /api/v1/servers/:server_id/zones/:zone_id/metadata
-
-  Get all the :json:object:`MetaData` associated with the zone.
-
-  :param server_id: The name of the server
-  :param zone_id: The id number of the :json:object:`Zone`
-
-.. http:post:: /api/v1/servers/:server_id/zones/:zone_id/metadata
-
-  Creates a set of metadata entries of given kind for the zone.
-  Existing metadata entries for the zone with the same kind are not overwritten.
-
-  :param server_id: The name of the server
-  :param zone_id: The id number of the :json:object:`Zone`
-
-.. http:get:: /api/v1/servers/:server_id/zones/:zone_name/metadata/:metadata_kind
-
-  Get the content of a single kind of :doc:`domain metadata <../domainmetadata>` as a list of :json:object:`MetaData` objects.
-
-  :param server_id: The name of the server
-  :param zone_id: The id number of the :json:object:`Zone`
-  :param metadata_kind: The name of the metadata to retrieve
-
-.. http:put:: /api/v1/servers/:server_id/zones/:zone_name/metadata/:metadata_kind
-
-  Modify the content of a single kind of :doc:`domain metadata <../domainmetadata>`.
-
-  :param server_id: The name of the server
-  :param zone_id: The id number of the :json:object:`Zone`
-  :param metadata_kind: The name of the metadata to edit
-  :reqjson MetaData data: The list of :json:object:`MetaData` to set.
-
-.. http:delete:: /api/v1/servers/:server_id/zones/:zone_name/metadata/:metadata_kind
-
-  Delete all items of a single kind of :doc:`domain metadata <../domainmetadata>`.
-
-  :param server_id: The name of the server
-  :param zone_id: The id number of the :json:object:`Zone`
-  :param metadata_kind: The name of the metadata to delete
diff --git a/docs/http-api/endpoint-zones.rst b/docs/http-api/endpoint-zones.rst
deleted file mode 100644 (file)
index 6dddc1e..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-Zones endpoint
-==============
-.. http:get:: /api/v1/servers/:server_id/zones
-
-  Get all zones from the server.
-
-  :param server_id: The name of the server
-
-.. http:post:: /api/v1/servers/:server_id/zones
-
-  Creates a new domain, returns the :json:object:`Zone` on creation.
-
-  :param server_id: The name of the server
-  :query rrsets: "true" (default) or "false", whether to include the "rrsets" in the response :json:object:`Zone` object.
-  :statuscode 201: The zone was successfully created
-
-  A :json:object:`Zone` MUST be sent in the request body.
-
-  -  ``dnssec``, ``nsec3narrow``, ``presigned``, ``nsec3param``, ``api_rectify``, ``active-keys`` are OPTIONAL.
-  -  ``dnssec``, ``nsec3narrow``, ``presigned``, ``api_rectify`` default to ``false``.
-
-  The server MUST create a SOA record.
-  The created SOA record SHOULD have serial set to the value given as ``serial`` (or 0 if missing), use the nameserver name, email, TTL values as specified in the PowerDNS configuration (``default-soa-name``, ``default-soa-mail``, etc).
-  These default values can be overridden by supplying a custom SOA record in the records list.
-  If ``soa_edit_api`` is set, the SOA record is edited according to the SOA-EDIT-API rules before storing it (also applies to custom SOA records).
-
-.. http:get:: /api/v1/servers/:server_id/zones/:zone_id
-
-  Returns zone information.
-
-  :param server_id: The name of the server
-  :param zone_id: The id number of the :json:object:`Zone`
-  :query rrsets: "true" (default) or "false", whether to include the "rrsets" in the response :json:object:`Zone` object.
-
-.. http:delete:: /api/v1/servers/:server_id/zones/:zone_id
-
-  Deletes this zone, all attached metadata and rrsets.
-
-  :param server_id: The name of the server
-  :param zone_id: The id number of the :json:object:`Zone`
-
-.. http:patch:: /api/v1/servers/:server_id/zones/:zone_id
-
-  Modifies present RRsets and comments. Returns ``204 No Content`` on success.
-
-  The new and old zone serials will be returned in `X-PDNS-New-Serial` and `X-PDNS-Old-Serial` headers (auth 4.1+).
-
-  :param server_id: The name of the server
-  :param zone_id: The id number of the :json:object:`Zone`
-
-  Example client body for PATCH:
-
-  .. code-block:: json
-
-    { "rrsets":
-      [
-        {
-          "name": "www.example.com.",
-          "type": "A",
-          "ttl": 3600,
-          "changetype": "REPLACE",
-          "records":
-            [
-              {
-                "content": "192.0.2.15",
-                "disabled": false,
-                "set-ptr": false
-              }
-            ],
-        }
-      ]
-    }
-
-.. http:put:: /api/v1/servers/:server_id/zones/:zone_id
-
-  Modifies basic zone data (metadata).
-
-  :param server_id: The name of the server
-  :param zone_id: The id number of the :json:object:`Zone`
-
-  Allowed fields in client body: all except ``id``, ``url`` and ``name``.
-  Returns ``204 No Content`` on success.
-
-.. http:put:: /api/v1/servers/:server_id/zones/:zone_id/notify
-
-  Send a DNS NOTIFY to all slaves.
-
-  :param server_id: The name of the server
-  :param zone_id: The id number of the :json:object:`Zone`
-
-  Fails when zone kind is not ``Master`` or ``Slave``, or ``master`` and ``slave`` are disabled in the configuration.
-  Only works for ``Slave`` if renotify is on.
-
-  Clients MUST NOT send a body.
-
-.. http:put:: /api/v1/servers/:server_id/zones/:zone_id/axfr-retrieve
-
-  Retrieves the zone from the master.
-
-  :param server_id: The name of the server
-  :param zone_id: The id number of the :json:object:`Zone`
-
-  Fails when zone kind is not ``Slave``, or ``slave`` is disabled in PowerDNS configuration.
-
-
-.. http:get:: /api/v1/servers/:server_id/zones/:zone_id/export
-
-  Returns the zone in AXFR format.
-
-  :param server_id: The name of the server
-  :param zone_id: The id number of the :json:object:`Zone`
-
-.. http:get:: /api/v1/servers/:server_id/zones/:zone_id/check
-
-  Verify zone contents/configuration.
-
-  Return format:
-
-  .. code-block: json
-
-    {
-      "zone": "<zone_name>",
-      "errors": ["error message1"],
-      "warnings": ["warning message1"]
-    }
-
-  :param server_id: The name of the server
-  :param zone_id: The id number of the :json:object:`Zone`
-
-.. http:put:: /api/v1/servers/:server_id/zones/:zone_id/rectify
-
-  Rectify the zone data. This does not take into account the :ref:`metadata-api-rectify` metadata.
-
-  :param server_id: The name of the server
-  :param zone_id: The id number of the :json:object:`Zone`
-
-  Fails on slave zones and zones that do not have DNSSEC.
index 4ff18556c1a70e7a1b6ecf7a37b0a5a1c8c8afdf..7a159a8e2a55f6fca75e0659d3c9a36eb38194b3 100644 (file)
@@ -2,7 +2,7 @@ Built-in Webserver and HTTP API
 ===============================
 
 The PowerDNS Authoritative Server features a built-in built-in webserver that exposes a JSON/REST API.
-This API allows for controlling several functions and reading statistics.
+This API allows for controlling several functions, reading statistics and modifying zone content, metadata and DNSSEC key material.
 
 Webserver
 ---------
@@ -26,48 +26,80 @@ Enabling the API
 To enable the API, the webserver and the HTTP API need to be enabled.
 Add these lines to the ``pdns.conf``::
 
-    api=yes
-    api-key=changeme
-    webserver=yes
-    webserver-port=8081
+  api=yes
+  api-key=changeme
 
-The API endpoints run off of the same webserver, but the :ref:`setting-api` is required to enable API access. Setting :ref:`setting-api` also implicitly enables the webserver v4.1.x onwards.
+.. versionchanged:: 4.1.0
+
+  Setting :ref:`setting-api` also implicitly enables the webserver.
 
 And restart, the following examples should start working::
 
-    curl -v -H 'X-API-Key: changeme' http://127.0.0.1:8081/api/v1/servers/localhost | jq .
-    curl -v -H 'X-API-Key: changeme' http://127.0.0.1:8081/api/v1/servers/localhost/zones | jq .
+  curl -v -H 'X-API-Key: changeme' http://127.0.0.1:8081/api/v1/servers/localhost | jq .
+  curl -v -H 'X-API-Key: changeme' http://127.0.0.1:8081/api/v1/servers/localhost/zones | jq .
 
-JSON Objects
-------------
+Working with the API
+--------------------
 
-The following documents describe the JSON objects available in the API:
+This chapter describes the PowerDNS Authoritative API.
+When creating an API wrapper (for instance when fronting multiple API's), it is recommended to stick to this API specification.
+The API is described in the `OpenAPI format <https://www.openapis.org/>`_, also known as "Swagger", and this description is `available <https://raw.githubusercontent.com/PowerDNS/pdns/master/docs/http-api/swagger/authoritative-api-swagger.yaml>`_.
 
-.. toctree::
-    :maxdepth: 1
+Authentication
+~~~~~~~~~~~~~~
+
+The PowerDNS daemons accept a static API Key, configured with the :ref:`setting-api-key` option, which has to be sent in the ``X-API-Key`` header.
+
+Errors
+~~~~~~
+
+Response code ``4xx`` or ``5xx``, depending on the situation.
+
+-  Invalid JSON body from client: ``400 Bad Request``
+-  Input validation failed: ``422 Unprocessable Entity``
+-  JSON body from client not a hash: ``400 Bad Request``
+
+Error responses have a JSON body of this format:
+
+.. code-block:: json
+
+    {
+      "error": "short error message",
+      "errors": [
+        {  },
+      ]
+    }
+
+Where ``errors`` is optional, and the contents are error-specific.
+
+Data format
+~~~~~~~~~~~
+
+The API accepts and emits :rfc:`JSON <7159>`.
+The ``Accept:`` header determines the output format.
+An unknown value or ``*/*`` will cause a ``400 Bad Request``.
+
+All text is UTF-8 and HTTP headers will reflect this.
+
+Data types:
+
+-  empty fields: ``null`` but present
+-  Regex: implementation defined
+-  Dates: ISO 8601
 
-    ../common/api/dataformat
-    ../common/api/server
-    zone
-    ../common/api/configsetting
-    ../common/api/statisticitem
-    cryptokeyitem
-    zonemetadata
+Endpoints and Objects in the API
+--------------------------------
 
-URL Endpoints
--------------
+The API has the basepath ``/api/v1`` and all URLs in this documentation are relative to this basepath.
 
-All API endpoints for the PowerDNS Recursor are documented here:
+The API exposes several endpoints and objects:
 
 .. toctree::
   :maxdepth: 1
 
-  ../common/api/endpoint-api
-  ../common/api/endpoint-servers
-  ../common/api/endpoint-servers-config
-  ../common/api/endpoint-statistics
-  ../common/api/endpoint-logging
-  endpoint-search
-  endpoint-zones
-  endpoint-zone-metadata
-  endpoint-cryptokeys
+  server
+  zone
+  cryptokey
+  metadata
+  search
+  statistics
diff --git a/docs/http-api/metadata.rst b/docs/http-api/metadata.rst
new file mode 100644 (file)
index 0000000..8c3d96c
--- /dev/null
@@ -0,0 +1,12 @@
+Metadata
+========
+
+Endpoints
+---------
+.. openapi:: swagger/authoritative-api-swagger.yaml
+  :paths: /servers/{server_id}/zones/{zone_id}/metadata /servers/{server_id}/zones/{zone_id}/metadata/{metadata_kind}
+
+Objects
+-------
+.. openapi:: swagger/authoritative-api-swagger.yaml
+  :definitions: Metadata
diff --git a/docs/http-api/search.rst b/docs/http-api/search.rst
new file mode 100644 (file)
index 0000000..b790f53
--- /dev/null
@@ -0,0 +1,15 @@
+Searching
+=========
+
+The API allows searching for data in :json:object:`Zone`\ s, :json:object:`Comment`\ s and :json:object:`RRSet`\ s.
+
+Endpoints
+---------
+
+.. openapi:: swagger/authoritative-api-swagger.yaml
+  :paths: /servers/{server_id}/search-data /servers/{server_id}/search-log
+
+Objects
+-------
+.. openapi:: swagger/authoritative-api-swagger.yaml
+  :definitions: SearchResult
diff --git a/docs/http-api/server.rst b/docs/http-api/server.rst
new file mode 100644 (file)
index 0000000..ce64211
--- /dev/null
@@ -0,0 +1,17 @@
+Servers
+=======
+
+The server endpoint is the 'basis' for all other API operations.
+In the PowerDNS Authoritative Server, the ``server_id`` is always ``localhost``.
+However, the API is written in a way that a proxy could be in front of many servers, each with their own ``server_id``.
+
+Endpoints
+---------
+
+.. openapi:: swagger/authoritative-api-swagger.yaml
+  :paths: /servers /servers/{server_id}
+
+Objects
+-------
+.. openapi:: swagger/authoritative-api-swagger.yaml
+  :definitions: Server
diff --git a/docs/http-api/statistics.rst b/docs/http-api/statistics.rst
new file mode 100644 (file)
index 0000000..c17e1d0
--- /dev/null
@@ -0,0 +1,14 @@
+Statistics
+==========
+
+Endpoints
+---------
+
+.. openapi:: swagger/authoritative-api-swagger.yaml
+  :paths: /servers/{server_id}/statistics
+
+Objects
+-------
+.. openapi:: swagger/authoritative-api-swagger.yaml
+  :definitions: StatisticItem
+
index da8e0acda207df1246eade41144955aee52adb6b..59360f0c73a7c8d764486a444241385c42e88473 100644 (file)
@@ -696,6 +696,7 @@ paths:
 
 definitions:
   Server:
+    title: Server
     properties:
       type:
         type: string
@@ -725,6 +726,8 @@ definitions:
       $ref: '#/definitions/Server'
 
   Zone:
+    title: Zone
+    description: This represents an authoritative DNS Zone.
     properties:
       id:
         type: string
@@ -800,6 +803,8 @@ definitions:
       $ref: '#/definitions/Zone'
 
   RRSet:
+    title: RRSet
+    description: This represents a Resource Record Set (all records with the same name and type).
     required:
       - name
       - type
@@ -831,6 +836,8 @@ definitions:
           $ref: '#/definitions/Comment'
 
   Record:
+    title: Record
+    description: The RREntry object represents a single record.
     required:
       - content
       - disabled # PatchZone endpoint complains if this is missing
@@ -846,6 +853,8 @@ definitions:
         description: 'If set to true, the server will find the matching reverse zone and create a PTR there. Existing PTR records are replaced. If no matching reverse Zone, an error is thrown. Only valid in client bodies, only valid for A and AAAA types. Not returned by the server.'
 
   Comment:
+    title: Comment
+    description: A comment about an RRSet.
     properties:
       content:
         type: string
@@ -858,6 +867,7 @@ definitions:
         description: 'Timestamp of the last change to the comment'
 
   ConfigSetting:
+    title: ConfigSetting
     properties:
       name:
         type: string
@@ -870,6 +880,7 @@ definitions:
         description: 'The value of setting name'
 
   StatisticItem:
+    title: StatisticItem
     properties:
       name:
         type: string
@@ -882,6 +893,7 @@ definitions:
         description: 'The value of item'
 
   SearchResultZone:
+    title: SearchResultZone
     properties:
       name:
         type: string
@@ -892,6 +904,7 @@ definitions:
         type: string
 
   SearchResultRecord:
+    title: SearchResultRecord
     properties:
       content:
         type: string
@@ -912,6 +925,7 @@ definitions:
         type: integer
 
   SearchResultComment:
+    title: SearchResultComment
     properties:
       content:
         type: string
@@ -934,6 +948,7 @@ definitions:
 
 # Since we can't do 'anyOf' at the moment, we create a 'superset object'
   SearchResult:
+    title: SearchResult
     properties:
       content:
         type: string
@@ -959,6 +974,8 @@ definitions:
       $ref: '#/definitions/SearchResult'
 
   Metadata:
+    title: Metadata
+    description: Represents zone metadata
     properties:
       kind:
         type: string
@@ -970,6 +987,8 @@ definitions:
         description: 'Array with all values for this metadata kind.'
 
   Cryptokey:
+    title: Cryptokey
+    description: 'Describes a DNSSEC cryptographic key'
     properties:
       type:
         type: string
index 3324291c8b60590d771d5fe9b4c5f260371a202f..ebce32910a0181a15032373b8c1882dfe0070933 100644 (file)
@@ -1,8 +1,16 @@
 Zones
 =====
 
-Zone
-----
+Manipulating zones is the primary use of the API.
+
+Zone Endpoints
+--------------
+
+.. openapi:: swagger/authoritative-api-swagger.yaml
+  :paths: /servers/{server_id}/zones /servers/{server_id}/zones/{zone_id} /servers/{server_id}/zones/{zone_id}/axfr-retrieve /servers/{server_id}/zones/{zone_id}/notify /servers/{server_id}/zones/{zone_id}/export /servers/{server_id}/zones/{zone_id}/check /servers/{server_id}/zones/{zone_id}/rectify
+
+Objects
+-------
 
 A Zone object represents an authoritative DNS Zone.
 
@@ -10,29 +18,8 @@ A Resource Record Set (below as "RRset") are all records for a given name and ty
 
 Comments are per-RRset.
 
-.. json:object:: Zone
-
-  Represents a configured zone in the PowerDNS server.
-
-  :property string id: Opaque zone id (string), assigned by the server, should not be interpreted by the application. Guaranteed to be safe for embedding in URLs.
-  :property string name: Name of the zone (e.g. "example.com.") MUST have a trailing dot
-  :property string type: Set to "Zone"
-  :property string url: API endpoint for this zone
-  :property string kind: Zone kind, one of "Native", "Master", "Slave"
-  :property [RRSet] rrsets: RRSets in this zone
-  :property integer serial: The SOA serial number
-  :property integer notified_serial: The SOA serial notifications have been sent out for
-  :property [str] masters: List of IP addresses configured as a master for this zone ("Slave" type zones only)
-  :property bool dnssec: Whether or not this zone is DNSSEC signed (inferred from presigned being true XOR presence of at least one cryptokey with active being true)
-  :property string nsec3param: The NSEC3PARAM record
-  :property bool nsec3narrow: Whether or not the zone uses NSEC3 narrow
-  :property bool presigned: Whether or not the zone is pre-signed
-  :property string soa_edit: The :ref:`metadata-soa-edit` metadata item
-  :property string soa_edit_api: The :ref:`metadata-soa-edit-api` metadata item
-  :property bool api_rectify: Whether or not the zone will be rectified on data changes via the API
-  :property string zone: MAY contain a BIND-style zone file when creating a zone
-  :property str account: MAY be set. Its value is defined by local policy
-  :property [str] nameservers: MAY be sent in client bodies during creation, and MUST NOT be sent by the server. Simple list of strings of nameserver names, including the trailing dot. Not required for slave zones.
+.. openapi:: swagger/authoritative-api-swagger.yaml
+  :definitions: Zone RRSet Record Comment
 
 .. note::
 
@@ -57,5 +44,3 @@ These things are not supported through the API.
 
 When creating a slave zone, it is recommended to not set any of
 ``nameservers``, ``rrsets`` or ``zone``.
-
-.. include:: ../common/api/zone.rst
diff --git a/docs/http-api/zonemetadata.rst b/docs/http-api/zonemetadata.rst
deleted file mode 100644 (file)
index 3e5cba4..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-Zone Metadata
-=============
-
-.. versionadded:: 4.1.0.
-
-.. json:object:: Metadata
-
-  Represents zone metadata :doc:`../domainmetadata`
-
-  :property string kind: Name of the metadata
-  :property [string] metadata: Array with all values for this metadata kind.
-
-  Clients MUST NOT modify ``NSEC3PARAM``, ``NSEC3NARROW``, ``PRESIGNED`` and ``LUA-AXFR-SCRIPT`` through this interface.
-  The server rejects updates to these metadata.
-  Modifications to custom metadata kinds starting with ``X-`` is allowed as well.
index e72a1aebc0a069fe73b8acf7ab5a082051ca03b4..6c3db82d6577dded8a3558b58f9d81f78d6cd522 100644 (file)
@@ -1,6 +1,6 @@
 Sphinx>=1.5.0
+git+https://github.com/pieterlexis/sphinxcontrib-openapi@use-jsondomain
 git+https://github.com/pieterlexis/sphinx-jsondomain@no-type-links
 git+https://github.com/pieterlexis/sphinx-changelog@render-tags
-sphinxcontrib-httpdomain
 sphinxcontrib-fulltoc
 guzzle_sphinx_theme
index a429bc9392a4788f79405098544f96cf8c25d97e..ea11a9dee7735de5de9b8bcc98efe46568ec7364 100644 (file)
@@ -285,7 +285,7 @@ Operate as a daemon.
   Renamed from ``default-ksk-algorithms``. No longer supports multiple algorithm names.
 
 The algorithm that should be used for the KSK when running
-:doc:`pdnsutil secure-zone <manpages/pdnsutil.1>` or using the :doc:`Zone API endpoint <http-api/endpoint-zones>`
+:doc:`pdnsutil secure-zone <manpages/pdnsutil.1>` or using the :doc:`Zone API endpoint <http-api/cryptokey>`
 to enable DNSSEC. Must be one of:
 
 * rsamd5
@@ -381,7 +381,7 @@ TTL to use when none is provided.
   Renamed from ``default-zsk-algorithms``. Does no longer support multiple algorithm names.
 
 The algorithm that should be used for the ZSK when running
-:doc:`pdnsutil secure-zone <manpages/pdnsutil.1>` or using the :doc:`Zone API endpoint <http-api/endpoint-zones>`
+:doc:`pdnsutil secure-zone <manpages/pdnsutil.1>` or using the :doc:`Zone API endpoint <http-api/cryptokey>`
 to enable DNSSEC. Must be one of:
 
 * rsamd5