First pass at Event API doc

GSoC/Meterpreter_Web_Console
James Barnett 2018-05-03 14:20:23 -05:00
parent 249db505c8
commit a11c7220b6
No known key found for this signature in database
GPG Key ID: 647983861A4EC5EA
3 changed files with 52 additions and 1 deletions

View File

@ -0,0 +1,48 @@
require 'swagger/blocks'
module EventApiDoc
include Swagger::Blocks
# Swagger documentation for Event model
swagger_schema :Event do
key :required, [:id, :name]
property :id, type: :integer, format: :int32
property :created_at, type: :string, format: :date_time
property :updated_at, type: :string, format: :date_time
property :workspace_id, type: :integer, format: :int32
property :name, type: :string
property :critical, type: :string
property :seen, type: :string
property :username, type: :string
property :info do
key :type, :object
property :revision, type: :string
end
end
swagger_path '/api/v1/events' do
# Swagger documentation for /api/v1/events POST
operation :post do
key :description, 'Create a host.'
key :tags, [ 'event' ]
parameter do
key :in, :body
key :name, :body
key :description, 'The attributes to assign to the host'
key :required, true
schema do
key :'$ref', :Event
end
end
response 200 do
key :description, 'Successful operation'
schema do
key :type, :object
key :'$ref', :Event
end
end
end
end
end

View File

@ -8,7 +8,7 @@ module RootApiDoc
info do
key :version, '1.0.0'
key :title, 'Metasploit API'
key :description, 'An API for interacting with Metasploit\'s data models'
key :description, 'An API for interacting with Metasploit\'s data models.'
license do
key :name, 'BSD-3-clause'
end
@ -24,6 +24,7 @@ module RootApiDoc
#################################
tag name: 'credential', description: 'Credential operations.'
tag name: 'db_export', description: 'Endpoint for generating and retrieving a database backup.'
tag name: 'event', description: 'Event operations.'
tag name: 'exploit', description: 'Exploit operations.'
tag name: 'host', description: 'Host operations.'
tag name: 'loot', description: 'Loot operations.'

View File

@ -2,6 +2,7 @@ require 'swagger/blocks'
load 'documentation/api/v1/root_api_doc.rb'
load 'documentation/api/v1/credential_api_doc.rb'
load 'documentation/api/v1/db_export_api_doc.rb'
load 'documentation/api/v1/event_api_doc.rb'
load 'documentation/api/v1/exploit_api_doc.rb'
load 'documentation/api/v1/host_api_doc.rb'
load 'documentation/api/v1/loot_api_doc.rb'
@ -39,6 +40,7 @@ module ApiDocsServlet
RootApiDoc,
CredentialApiDoc,
DbExportApiDoc,
EventApiDoc,
ExploitApiDoc,
HostApiDoc,
LootApiDoc,