예제 #1
0
class BulkInputHostGroup(BaseSchema):
    """Bulk creating host groups"""
    entries = fields.List(
        fields.Nested(InputHostGroup),
        example=[{
            'name': 'windows',
            'alias': 'Windows Servers',
        }],
        uniqueItems=True,
    )
예제 #2
0
class BulkInputServiceGroup(BaseSchema):
    """Bulk creating service groups"""
    entries = fields.List(
        fields.Nested(InputServiceGroup),
        example=[{
            "name": "environment",
            "alias": "Environment Sensors",
        }],
        uniqueItems=True,
    )
예제 #3
0
class BulkUpdateServiceGroup(BaseSchema):
    """Bulk update service groups"""
    entries = fields.List(fields.Nested(UpdateServiceGroup),
                          example=[{
                              'name': 'windows',
                              'attributes': {
                                  'name': 'windows updated',
                                  'alias': 'Windows Servers',
                              },
                          }])
예제 #4
0
class BulkCreateHost(BaseSchema):
    entries = fields.List(
        fields.Nested(CreateHost),
        example=[{
            "host_name": "example.com",
            "folder": "root",
            "attributes": {},
        }],
        uniqueItems=True,
    )
예제 #5
0
class BulkUpdateContactGroup(BaseSchema):
    """Bulk update contact groups"""
    entries = fields.List(fields.Nested(UpdateContactGroup),
                          example=[{
                              'name': 'OnCall',
                              'attributes': {
                                  'name': 'OnCall updated',
                                  'alias': 'Not on Sundays',
                              },
                          }])
예제 #6
0
class ConcreteTimePeriodException(BaseSchema):
    date = fields.Date(
        example="2020-01-01",
        description="The date of the time period exception."
        "8601 profile",
    )
    time_ranges = fields.List(
        fields.Nested(ConcreteTimeRange),
        example="[{'start': '14:00', 'end': '18:00'}]",
    )
예제 #7
0
class BulkDeleteDowntime(BaseSchema):
    host_name = MONITORED_HOST
    entries = fields.List(
        fields.Integer(
            required=True,
            description="The id for either a host downtime or service downtime",
            example=1120,
        ),
        required=True,
        example=[1120, 1121],
    )
예제 #8
0
class BulkDeleteContactGroup(BaseSchema):
    # TODO: addition of etag field
    entries = fields.List(
        fields.String(
            required=True,
            description="The name of the contact group config",
            example="windows",
        ),
        required=True,
        example=["windows", "panels"],
    )
예제 #9
0
class BulkInputContactGroup(BaseSchema):
    """Bulk creating contact groups"""
    # TODO: add unique entries attribute
    entries = fields.List(
        fields.Nested(InputContactGroup),
        example=[{
            "name": "OnCall",
            "alias": "Not on Sundays",
        }],
        uniqueItems=True,
    )
예제 #10
0
class ObjectProperty(Linkable):
    id = fields.String(
        description=
        "The unique name of this property, local to this domain type.")
    # FIXME: This is the only use-case right now. Needs to be expanded when this is used more.
    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.", )
예제 #11
0
class BulkCreateFolder(BaseSchema):
    entries = fields.List(
        fields.Nested(CreateFolder),
        example=[{
            "name": "production",
            "parent": "root",
            "attributes": {
                "foo": "bar"
            },
        }],
        uniqueItems=True,
    )
예제 #12
0
class ConcreteTimePeriod(BaseSchema):
    alias = fields.String(description="The alias of the time period",
                          example="alias")
    active_time_ranges = fields.List(
        fields.Nested(ConcreteTimeRangeActive),
        description="The days for which time ranges were specified",
        example=
        "{'day': 'all', 'time_ranges': [{'start': '12:00', 'end': '14:00'}",
    )
    exceptions = fields.List(
        fields.Nested(ConcreteTimePeriodException),
        description="Specific day exclusions with their list of time ranges",
        example=
        "[{'date': '2020-01-01', 'time_ranges': [{'start': '14:00', 'end': '18:00'}]}]",
    )
    exclude = fields.List(
        fields.String(description="Name of excluding time period",
                      example="holidays"),
        description=
        "The collection of time period aliases whose periods are excluded",
    )
예제 #13
0
class InputPassword(BaseSchema):
    ident = PasswordIdent(
        example="pass",
        description="An unique identifier for the password",
        should_exist=False,
    )
    title = fields.String(
        required=True,
        example="Kubernetes login",
        description="A title for the password",
    )
    comment = fields.String(required=False,
                            example="Kommentar",
                            description="A comment for the password",
                            missing="")

    documentation_url = fields.String(
        required=False,
        attribute="docu_url",
        example="localhost",
        description=
        "An optional URL pointing to documentation or any other page. You can use either global URLs (beginning with http://), absolute local urls (beginning with /) or relative URLs (that are relative to check_mk/).",
        missing="",
    )

    password = fields.String(
        required=True,
        example="password",
        description="The password string",
    )

    owner = PasswordOwner(
        example="admin",
        description=
        "Each password is owned by a group of users which are able to edit, delete and use existing passwords.",
        required=True,
        attribute="owned_by",
    )

    shared = fields.List(
        PasswordShare(
            example="all",
            description=
            "By default only the members of the owner contact group are permitted to use a a configured password. It is possible to share a password with other groups of users to make them able to use a password in checks.",
        ),
        example=["all"],
        description="The list of members to share the password with",
        required=False,
        attribute="shared_with",
        missing=[],
    )
예제 #14
0
class User(Linkable):
    userName = fields.Str(description="a unique user name")
    friendlyName = fields.Str(
        required=True,
        description=
        "(optional) the user's name in a form suitable to be rendered in a UI.",
    )
    email = fields.Str(
        description="(optional) the user's email address, if known")
    roles = fields.List(
        fields.Str(),
        description=
        "list of unique role names that apply to this user (can be empty).",
    )
예제 #15
0
class TimePeriodException(BaseSchema):
    date = fields.Date(
        required=True,
        example="2020-01-01",
        description="The date of the time period exception."
        "8601 profile",
    )
    time_ranges = fields.List(
        fields.Nested(TimeRange),
        required=False,
        example=[{
            'start': '14:00',
            'end': '18:00'
        }],
    )
예제 #16
0
class CreateServiceDowntime(CreateDowntimeBase):
    host_name = MONITORED_HOST
    service_descriptions = fields.List(
        fields.String(),
        uniqueItems=True,
        required=True,
        example=["CPU utilization", "Memory"],
        description=param_description(schedule_service_downtime.__doc__, 'service_description'),
    )
    duration = fields.Integer(
        required=False,
        description=param_description(schedule_service_downtime.__doc__, 'duration'),
        example=3600,
        missing=0,
    )
예제 #17
0
class ActionResultScalar(ActionResultBase):
    resultType = fields.Constant('scalar')
    result = fields.Nested(
        Schema.from_dict(
            {
                'links': fields.List(
                    fields.Nested(LinkSchema),
                    required=True,
                ),
                'value': fields.String(
                    required=True,
                    example="Done.",
                )
            },
            name='ActionResultScalarValue',
        ))
예제 #18
0
class ActionResultScalar(ActionResultBase):
    result = fields.Nested(
        Schema.from_dict(
            {
                'links': fields.List(
                    fields.Nested(LinkSchema),
                    required=True,
                ),
                'value': fields.String(
                    required=True,
                    example="Done.",
                )
            },
            name='ActionResultScalarValue',
        ),
        description="The scalar result of the action.",
    )
예제 #19
0
class ActivateChanges(BaseSchema):
    redirect = fields.Boolean(
        description=
        "Redirect immediately to the 'Wait for completion' endpoint.",
        required=False,
        missing=False,
        example=False,
    )
    sites = fields.List(
        fields.String(),
        description=
        ("On which sites the configuration shall be activated. An empty list "
         "means all sites which have pending changes."),
        required=False,
        missing=[],
        example=['production'],
    )
예제 #20
0
class ActionResultObject(ActionResultBase):
    resultType = fields.Constant('object')
    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',
        ))
예제 #21
0
class CreateClusterHost(BaseSchema):
    host_name = Hostname(
        description="The hostname of the cluster host.",
        required=True,
        should_exist=False,
    )
    folder = EXISTING_FOLDER
    attributes = AttributesField(
        description="Attributes to set on the newly created host.",
        example={'ipaddress': '192.168.0.123'},
        missing=dict,
    )
    nodes = fields.List(
        EXISTING_HOST_NAME,
        description="Nodes where the newly created host should be the cluster-container of.",
        required=True,
        example=["host1", "host2", "host3"],
    )
예제 #22
0
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.",
    )
예제 #23
0
파일: host.py 프로젝트: inettgmbh/checkmk
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])
예제 #24
0
class UpdateHost(BaseSchema):
    """Updating of a host

    Only the `attributes` and `nodes` values may be changed.

    Required attributes:

      * none

    Optional arguments:

      * `attributes`
      * `update_attributes`
      * `nodes`
    """
    attributes = AttributesField(
        description=
        ("Replace all currently set attributes on the host, with these attributes. "
         "Any previously set attributes which are not given here will be removed."
         ),
        example={'ipaddress': '192.168.0.123'},
        missing=dict,
        required=False,
    )
    update_attributes = AttributesField(
        description=
        ("Just update the hosts attributes with these attributes. The previously set "
         "attributes will not be touched."),
        example={'ipaddress': '192.168.0.123'},
        missing=dict,
        required=False,
    )
    remove_attributes = fields.List(
        fields.String(),
        description="A list of attributes which should be removed.",
        example=["tag_foobar"],
        missing=[],
        required=False,
    )
예제 #25
0
class UpdateHost(BaseSchema):
    """Updating of a host

    Only the `attributes` and `nodes` values may be changed.

    Required attributes:

      * none

    Optional arguments:

      * `attributes`
      * `update_attributes`
      * `nodes`
    """
    attributes = AttributesField(
        description=
        ("Replace all currently set attributes on the host, with these attributes. "
         "Any previously set attributes which are not given here will be removed."
         ),
        example={'ipaddress': '192.168.0.123'},
        missing=dict,
        required=False,
    )
    update_attributes = AttributesField(
        description=
        ("Just update the hosts attributes with these attributes. The previously set "
         "attributes will not be touched."),
        example={'ipaddress': '192.168.0.123'},
        missing=dict,
        required=False,
    )
    nodes = fields.List(
        EXISTING_HOST_NAME,
        description="Nodes where the host should be the cluster-container of.",
        example=["host1", "host2", "host3"],
        missing=list,
        required=False,
    )
예제 #26
0
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",
    )
    errors = fields.List(
        fields.String(),
        allow_none=True,
        description="Optionally a list of errors used for debugging.",
        example=None,
    )
예제 #27
0
class ConcretePassword(BaseSchema):
    ident = fields.String(
        example="pass",
        description="The unique identifier for the password",
    )
    title = fields.String(
        example="Kubernetes login",
        description="The title for the password",
    )
    comment = fields.String(
        example="Kommentar",
        description="A comment for the password",
    )

    documentation_url = fields.String(
        example="localhost",
        description="The URL pointing to documentation or any other page.",
    )

    password = fields.String(
        required=True,
        example="password",
        description="The password string",
    )

    owner = fields.String(
        example="admin",
        description=
        "The owner of the password who is able to edit, delete and use existing passwords."
    )

    shared = fields.List(
        fields.String(
            example="all",
            description="The member the password is shared with",
        ),
        example=["all"],
        description="The list of members the password is shared with",
    )
예제 #28
0
class HostTag(BaseSchema):
    ident = fields.String(required=False,
                          example="tag_id",
                          description="An unique id for the tag",
                          missing=None,
                          attribute="id")
    title = fields.String(
        required=True,
        example="Tag",
        description="The title of the tag",
    )
    aux_tags = fields.List(
        AuxTag(
            example="ip-v4",
            description="An auxiliary tag id",
            required=False,
        ),
        description=
        "The list of auxiliary tag ids. Built-in tags (ip-v4, ip-v6, snmp, tcp, ping) and custom defined tags are allowed.",
        example=["ip-v4, ip-v6"],
        required=False,
        missing=[],
    )
예제 #29
0
class UpdateHostEntry(BaseSchema):
    host_name = EXISTING_HOST_NAME
    attributes = AttributesField(
        description=("Replace all currently set attributes on the host, with these attributes. "
                     "Any previously set attributes which are not given here will be removed."),
        example={'ipaddress': '192.168.0.123'},
        missing=dict,
        required=False,
    )
    update_attributes = AttributesField(
        description=("Just update the hosts attributes with these attributes. The previously set "
                     "attributes will not be touched."),
        example={'ipaddress': '192.168.0.123'},
        missing=dict,
        required=False,
    )
    nodes = fields.List(
        EXISTING_HOST_NAME,
        description="Nodes where the host should be the cluster-container of.",
        example=["host1", "host2", "host3"],
        missing=list,
        required=False,
    )
예제 #30
0
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,
    )