| GET | /status |
|---|
# frozen_string_literal: true
# encoding: utf-8
require 'json'
require 'servicestack'
module HealthStatus
UNHEALTHY = 'Unhealthy'
DEGRADED = 'Degraded'
HEALTHY = 'Healthy'
end
class HealthCheckReportEntry
include ServiceStack::DTO
# @return [String]
attr_accessor :key
# @return [String]
attr_accessor :description
# @return [Time]
attr_accessor :duration
# @return [HealthStatus]
attr_accessor :status
# @return [String]
attr_accessor :error
def self.properties
{
key: { name: 'key' },
description: { name: 'description' },
duration: { name: 'duration' },
status: { name: 'status' },
error: { name: 'error' },
}
end
end
class HealthCheckReport
include ServiceStack::DTO
# @return [HealthStatus]
attr_accessor :status
# @return [Time]
attr_accessor :duration
# @return [String]
attr_accessor :version
# @return [String]
attr_accessor :build_date
# @return [ICollection]
attr_accessor :entries
def self.properties
{
status: { name: 'status' },
duration: { name: 'duration' },
version: { name: 'version' },
build_date: { name: 'buildDate' },
entries: { name: 'entries', type: [HealthCheckReportEntry] },
}
end
end
class HealthResponse
include ServiceStack::DTO
# @return [HealthCheckReport]
attr_accessor :result
def self.properties
{
result: { name: 'result', type: HealthCheckReport },
}
end
end
class HealthRequest
include ServiceStack::DTO
def response_type() = HealthResponse
def get_type_name() = 'HealthRequest'
end
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /status HTTP/1.1 Host: uat-api-vehicle-mgt-mb-dhc.rapp-customers.co.uk Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<HealthResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.SS.Plugins.HealthCheck.ServiceModel">
<Result xmlns:d2p1="http://schemas.datacontract.org/2004/07/Mercedes.SS.Plugins.HealthCheck.ServiceModel.Types">
<d2p1:BuildDate>String</d2p1:BuildDate>
<d2p1:Duration>PT0S</d2p1:Duration>
<d2p1:Entries i:nil="true" />
<d2p1:Status>Unhealthy</d2p1:Status>
<d2p1:Version>String</d2p1:Version>
</Result>
</HealthResponse>