class InstalledVersions(BaseSchema): site = fields.String( description="The site where this API call was made on.", example="production" ) group = fields.String( description="The Apache WSGI application group this call was made on.", example="de" ) rest_api = fields.Dict(description="The REST-API version", example={"revision": "1.0.0"}) versions = fields.Dict(description="Some version numbers", example={"checkmk": "1.8.0p1"}) edition = fields.String(description="The Checkmk edition.", example="raw") demo = fields.Bool(description="Whether this is a demo version or not.", example=False)
class HostExtensions(BaseSchema): folder = fields.FolderField( description="The folder, in which this host resides.", ) attributes = fields.attributes_field( "host", "update", description="Attributes of this host.", example={"ipaddress": "192.168.0.123"}, ) effective_attributes = fields.Dict( description= "All attributes of this host and all parent folders. Format may change!", allow_none=True, example={"tag_snmp_ds": None}, ) is_cluster = fields.Boolean( description= "If this is a cluster host, i.e. a container for other hosts.", ) is_offline = fields.Boolean(description="Whether the host is offline", ) cluster_nodes = fields.List( fields.HostField(), allow_none=True, missing=None, description= "In the case this is a cluster host, these are the cluster nodes.", )
class ObjectActionMember(ObjectMemberBase): memberType = fields.Constant("action") parameters = fields.Dict() name = fields.String(example="frobnicate_foo") title = fields.String( description="A human readable title of this object. Can be used for " "user interfaces.", )
class DomainObject(Linkable): domainType: fields.Field = fields.String( required=True, description='The "domain-type" of the object.', ) # Generic things to ease development. Should be changed for more concrete schemas. id = fields.String( description="The unique identifier for this domain-object type.", ) title = fields.String( description="A human readable title of this object. Can be used for " "user interfaces.", ) members: fields.Field = fields.Dict( description="The container for external resources, like linked foreign objects or actions.", ) extensions: fields.Field = fields.Dict(description="All the attributes of the domain object.")
class ActionResultBase(Linkable): resultType: fields.Field = fields.String( enum=["object", "scalar"], description="The type of the result.", ) extensions = fields.Dict( example={"some": "values"}, description="Some attributes alongside the result.", )
class ObjectProperty(Linkable): id = fields.String(description="The unique name of this property, local to this domain type.") value = fields.List( fields.String(), description="The value of the property. In this case a list.", ) extensions = fields.Dict( description="Additional attributes alongside the property.", )
class ActionResultBase(Linkable): resultType: fields.Field = fields.String( enum=['object', 'scalar'], description="The type of the result.", ) extensions = fields.Dict( example={'some': 'values'}, description="Some attributes alongside the result.", )
class LinkSchema(BaseSchema): """A Link representation according to A-24 (2.7)""" domainType = fields.Constant("link", required=True) rel = fields.String( description=( "Indicates the nature of the relationship of the related resource to the " "resource that generated this representation" ), required=True, example="self", ) href = fields.String( description=( "The (absolute) address of the related resource. Any characters that are " "invalid in URLs must be URL encoded." ), required=True, example="https://.../api_resource", ) method = fields.String( description="The HTTP method to use to traverse the link (get, post, put or delete)", required=True, pattern="GET|PUT|POST|DELETE", example="GET", ) type = fields.String( description="The content-type that the linked resource will return", required=True, example="application/json", ) title = fields.String( description=( "string that the consuming application may use to render the link without " "having to traverse the link in advance" ), allow_none=True, example="The object itself", ) body_params = fields.Dict( description=( "A map of values that shall be sent in the request body. If this is present," "the request has to be sent with a content-type of 'application/json'." ), required=False, )
class DomainObjectCollection(Linkable): id = fields.String( description="The name of this collection.", load_default="all", ) domainType: fields.Field = fields.String( description="The domain type of the objects in the collection." ) title = fields.String( description="A human readable title of this object. Can be used for " "user interfaces.", ) value: fields.Field = fields.Nested( CollectionItem, description="The collection itself. Each entry in here is part of the collection.", many=True, ) extensions = fields.Dict(description="Additional attributes alongside the collection.")
class ActionResultObject(ActionResultBase): result = fields.Nested( Schema.from_dict( { "links": fields.List( fields.Nested(LinkSchema), required=True, ), "value": fields.Dict( required=True, example={"duration": "5 seconds."}, ), }, name="ActionResultObjectValue", ), description="The result of the action. In this case, an object.", )
class ActionResultObject(ActionResultBase): result = fields.Nested( Schema.from_dict( { 'links': fields.List( fields.Nested(LinkSchema), required=True, ), 'value': fields.Dict( required=True, example={'duration': '5 seconds.'}, ) }, name='ActionResultObjectValue', ), description="The result of the action. In this case, an object.", )
class ApiError(BaseSchema): code = fields.Integer( description="The HTTP status code.", required=True, example=404, ) message = fields.Str( description="Detailed information on what exactly went wrong.", required=True, example="The resource could not be found.", ) title = fields.Str( description="A summary of the problem.", required=True, example="Not found", ) _fields = fields.Dict( data_key="fields", # mypy keys=fields.String(description="The field name"), values=fields.List(fields.String(description="The error messages")), description="Detailed error messages on all fields failing validation.", required=False, )
class SiteStateMembers(BaseSchema): sites = fields.Dict()
def openapi_field(self) -> fields.Field: return fields.Dict(description=self.help(), )