class HostParameters(BaseSchema): """All the parameters for the hosts list. Examples: >>> p = HostParameters() >>> p.load({})['columns'] [Column(hosts.name: string)] >>> p.load({})['sites'] [] """ sites = fields.List( gui_fields.SiteField(), description="Restrict the query to this particular site.", load_default=[], ) query = gui_fields.query_field(Hosts, required=False) columns = gui_fields.column_field(Hosts, mandatory=[Hosts.name], example=["name"])
definition on GitHub. """ from cmk.utils.livestatus_helpers.expressions import And from cmk.utils.livestatus_helpers.queries import Query from cmk.utils.livestatus_helpers.tables import Services from cmk.gui import fields, sites from cmk.gui.plugins.openapi.restful_objects import constructors, Endpoint, response_schemas from cmk.gui.plugins.openapi.restful_objects.constructors import object_action_href from cmk.gui.plugins.openapi.restful_objects.parameters import HOST_NAME, OPTIONAL_HOST_NAME from cmk.gui.plugins.openapi.utils import problem PARAMETERS = [{ 'sites': fields.List( fields.SiteField(), description="Restrict the query to this particular site.", missing=list, ), 'query': fields.query_field( Services, required=False, example='{"op": "=", "left": "host_name", "right": "example.com"}', ), 'columns': fields.column_field( Services, mandatory=[ Services.host_name, Services.description,
from cmk.gui.plugins.openapi.restful_objects.parameters import HOST_NAME, OPTIONAL_HOST_NAME from cmk.gui.plugins.openapi.utils import problem from cmk import fields PERMISSIONS = permissions.Ignore( permissions.AnyPerm([ permissions.Perm("general.see_all"), permissions.Perm("bi.see_all"), permissions.Perm("mkeventd.seeall"), ])) PARAMETERS = [{ "sites": fields.List( gui_fields.SiteField(), description="Restrict the query to this particular site.", load_default=list, ), "query": gui_fields.query_field( Services, required=False, example='{"op": "=", "left": "host_name", "right": "example.com"}', ), "columns": gui_fields.column_field( Services, mandatory=[ Services.host_name, Services.description,
def openapi_field(self) -> fields.Field: return fields.SiteField( description="The site that should monitor this host.")