Exemple #1
0
class HostParameters(BaseSchema):
    """All the parameters for the hosts list.

    Examples:

        >>> p = HostParameters()
        >>> p.load({})['columns']
        ['name']

        >>> p.load({})['sites']
        []

    """
    sites = fields.List(
        fields.SiteField(),
        description="Restrict the query to this particular site.",
        missing=[],
    )
    query = fields.query_field(Hosts, required=False)
    columns = fields.List(
        fields.LiveStatusColumn(
            table=Hosts,
            mandatory=[Hosts.name.name],
            required=True,
        ),
        description=("The desired columns of the hosts table. "
                     "If left empty, only the name column is used."),
        missing=[Hosts.name.name],
        required=False,
    )
Exemple #2
0
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(
        fields.SiteField(),
        description="Restrict the query to this particular site.",
        missing=[],
    )
    query = fields.query_field(Hosts, required=False)
    columns = fields.column_field(Hosts, mandatory=[Hosts.name])
Exemple #3
0
"""
from cmk.gui import sites
from cmk.gui.plugins.openapi import fields
from cmk.gui.plugins.openapi.endpoints.utils import verify_columns
from cmk.gui.plugins.openapi.livestatus_helpers.queries import Query
from cmk.gui.plugins.openapi.livestatus_helpers.tables import Services
from cmk.gui.plugins.openapi.restful_objects import (
    Endpoint,
    constructors,
    response_schemas,
)
from cmk.gui.plugins.openapi.restful_objects.parameters import HOST_NAME, OPTIONAL_HOST_NAME

PARAMETERS = [{
    'site': fields.String(description="Restrict the query to this particular site."),
    'query': fields.query_field(Services, required=False),
    'columns': fields.List(
        fields.LiveStatusColumn(
            table=Services,
            mandatory=[Services.host_name.name, Services.description.name],
        ),
        required=False,
        description="The desired columns of the services table. If left empty, a default set"
        " of columns is used.",
        missing=[
            Services.host_name.name,
            Services.description.name,
        ],
    ),
}]
Exemple #4
0
 class QuerySchema(Schema):
     q = fields.query_field(Hosts, required=True)
Exemple #5
0
class DowntimeParameter(BaseSchema):
    query = fields.query_field(Downtimes, required=False)
Exemple #6
0
    constructors,
    response_schemas,
)
from cmk.gui.plugins.openapi.restful_objects.parameters import HOST_NAME, OPTIONAL_HOST_NAME
from cmk.gui.plugins.openapi.restful_objects.constructors import object_action_href
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,
        ],
    )
}]


@Endpoint(object_action_href('host', '{host_name}', 'show_service'),
          'cmk/show',
          method='get',