nomilo/api.yml

437 lines
9.4 KiB
YAML
Raw Normal View History

2022-03-04 12:08:47 +00:00
openapi: '3.0.0'
info:
description: ''
version: 0.1.0-dev
title: Nomilo
components:
securitySchemes:
ApiToken:
type: http
scheme: bearer
bearerFormat: JWT
parameters:
ZoneName:
name: zone
in: path
schema:
type: string
required: true
schemas:
UserRequest:
type: object
required:
- username
- password
- email
properties:
username:
type: string
password:
type: string
email:
type: string
role:
type: string
enum:
- admin
- zoneadmin
TokenRequest:
type: object
required:
- username
- password
properties:
username:
type: string
password:
type: string
TokenResponse:
type: object
required:
- token
properties:
token:
type: string
AddZoneMemberRequest:
type: object
required:
- id
properties:
id:
type: string
CreateZoneRequest:
type: object
required:
- name
properties:
name:
type: string
Zone:
type: object
required:
- name
properties:
name:
type: string
ZoneList:
type: array
items:
$ref: '#/components/schemas/Zone'
RecordBase:
type: object
required:
- Name
- Class
- TTL
- Type
properties:
Name:
type: string
Class:
type: string
enum:
- IN
- CH
- HS
- NONE
- ANY
TTL:
type: integer
Type:
type: string
RecordTypeA:
type: object
allOf:
- $ref: '#/components/schemas/RecordBase'
- type: object
required:
- Address
properties:
Address:
type: string
RecordTypeAAAA:
type: object
allOf:
- $ref: '#/components/schemas/RecordBase'
- type: object
required:
- Address
properties:
Address:
type: string
RecordTypeCAA:
type: object
allOf:
- $ref: '#/components/schemas/RecordBase'
required:
- IssuerCritical
- Value
- PropertyTag
properties:
IssuerCritical:
type: boolean
Value:
type: string
PropertyTag:
type: string
RecordTypeCNAME:
type: object
allOf:
- $ref: '#/components/schemas/RecordBase'
- type: object
required:
- Target
properties:
Target:
type: string
RecordTypeMX:
type: object
allOf:
- $ref: '#/components/schemas/RecordBase'
- type: object
required:
- Preference
- MailExchanger
properties:
Preference:
type: integer
MailExchanger:
type: string
RecordTypeNS:
type: object
allOf:
- $ref: '#/components/schemas/RecordBase'
- type: object
required:
- Target
properties:
Target:
type: string
RecordTypePTR:
type: object
allOf:
- $ref: '#/components/schemas/RecordBase'
- type: object
required:
- Target
properties:
Target:
type: string
RecordTypeSOA:
type: object
allOf:
- $ref: '#/components/schemas/RecordBase'
- type: object
required:
- MasterServerName
- MaintainerName
- Refresh
- Retry
- Expire
- Minimum
- Serial
properties:
MasterServerName:
type: string
MaintainerName:
type: string
Refresh:
type: integer
Retry:
type: integer
Expire:
type: integer
Minimum:
type: integer
Serial:
type: integer
RecordTypeSRV:
type: object
allOf:
- $ref: '#/components/schemas/RecordBase'
- type: object
required:
- Server
- Port
- Priority
- Weight
properties:
Server:
type: string
Port:
type: integer
Priority:
type: integer
Weight:
type: integer
RecordTypeSSHFP:
type: object
allOf:
- $ref: '#/components/schemas/RecordBase'
- type: object
required:
- Algorithm
- DigestType
- Fingerprint
properties:
Algorithm:
type: integer
DigestType:
type: integer
Fingerprint:
type: string
RecordTypeTXT:
type: object
allOf:
- $ref: '#/components/schemas/RecordBase'
- type: object
required:
- Text
properties:
Text:
type: string
Record:
type: object
oneOf:
- $ref: '#/components/schemas/RecordTypeA'
- $ref: '#/components/schemas/RecordTypeAAAA'
- $ref: '#/components/schemas/RecordTypeCAA'
- $ref: '#/components/schemas/RecordTypeCNAME'
- $ref: '#/components/schemas/RecordTypeMX'
- $ref: '#/components/schemas/RecordTypeNS'
- $ref: '#/components/schemas/RecordTypePTR'
- $ref: '#/components/schemas/RecordTypeSOA'
- $ref: '#/components/schemas/RecordTypeSRV'
- $ref: '#/components/schemas/RecordTypeSSHFP'
- $ref: '#/components/schemas/RecordTypeTXT'
discriminator:
propertyName: Type
mapping:
A: '#/components/schemas/RecordTypeA'
AAAA: '#/components/schemas/RecordTypeAAAA'
CAA: '#/components/schemas/RecordTypeCAA'
CNAME: '#/components/schemas/RecordTypeCNAME'
MX: '#/components/schemas/RecordTypeMX'
NS: '#/components/schemas/RecordTypeNS'
PTR: '#/components/schemas/RecordTypePTR'
SOA: '#/components/schemas/RecordTypeSOA'
SRV: '#/components/schemas/RecordTypeSRV'
SSHFP: '#/components/schemas/RecordTypeSSHFP'
TXT: '#/components/schemas/RecordTypeTXT'
RecordList:
type: array
items:
$ref: '#/components/schemas/Record'
2022-03-04 20:55:27 +00:00
UpdateRecordsRequest:
type: object
required:
- oldRecords
- newRecords
properties:
oldRecords:
$ref: '#/components/schemas/RecordList'
newRecords:
$ref: '#/components/schemas/RecordList'
2022-03-04 12:08:47 +00:00
paths:
'/users':
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UserRequest'
responses:
'201':
description: ''
'/users/me/token':
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/TokenRequest'
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/TokenResponse'
'/zones':
get:
security:
- ApiToken: []
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/ZoneList'
post:
security:
- ApiToken: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateZoneRequest'
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Zone'
'/zones/{zone}/members':
parameters:
- $ref: '#/components/parameters/ZoneName'
post:
security:
- ApiToken: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AddZoneMemberRequest'
responses:
'201':
description: ''
'/zones/{zone}/records':
parameters:
- $ref: '#/components/parameters/ZoneName'
get:
security:
- ApiToken: []
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/RecordList'
post:
security:
- ApiToken: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RecordList'
responses:
'200':
description: ''
2022-03-04 20:55:27 +00:00
put:
security:
- ApiToken: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateRecordsRequest'
responses:
'200':
description: ''
2022-03-05 12:07:51 +00:00
delete:
security:
- ApiToken: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RecordList'
responses:
'200':
description: ''