2018-05-03 19:20:23 +00:00
|
|
|
require 'swagger/blocks'
|
|
|
|
|
|
|
|
module EventApiDoc
|
|
|
|
include Swagger::Blocks
|
|
|
|
|
|
|
|
# Swagger documentation for Event model
|
2018-05-08 17:38:04 +00:00
|
|
|
swagger_schema :Event do
|
2018-05-03 19:20:23 +00:00
|
|
|
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
|
2018-05-04 22:08:33 +00:00
|
|
|
property :critical, type: :boolean
|
2018-05-03 19:20:23 +00:00
|
|
|
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
|
2018-05-04 22:08:33 +00:00
|
|
|
key :description, 'The attributes to assign to the event.'
|
2018-05-03 19:20:23 +00:00
|
|
|
key :required, true
|
|
|
|
schema do
|
2018-05-08 17:38:04 +00:00
|
|
|
property :workspace, type: :string, required: true
|
|
|
|
property :name, type: :string
|
|
|
|
property :host, type: :string, format: :ipv4
|
|
|
|
property :critical, type: :boolean
|
|
|
|
property :username, type: :string
|
|
|
|
property :info do
|
|
|
|
key :type, :object
|
|
|
|
property :revision, type: :string
|
|
|
|
end
|
2018-05-03 19:20:23 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
response 200 do
|
|
|
|
key :description, 'Successful operation'
|
|
|
|
schema do
|
|
|
|
key :type, :object
|
2018-05-08 17:38:04 +00:00
|
|
|
key :'$ref', :Event
|
2018-05-03 19:20:23 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|