예제 #1
0
def _get_api_call():
    action = html.request.var('action')
    for cls in api_call_collection_registry.values():
        api_call = cls().get_api_calls().get(action)
        if api_call:
            return api_call
    raise MKUserError(None, "Unknown API action %s" % html.attrencode(action))
예제 #2
0
파일: webapi.py 프로젝트: inettgmbh/checkmk
def _get_api_call():
    action = global_request.var('action')
    for cls in api_call_collection_registry.values():
        api_call = cls().get_api_calls().get(action)
        if api_call:
            return api_call
    raise MKUserError(None, "Unknown API action %s" % escaping.escape_attribute(action))
예제 #3
0
def _get_api_call() -> APICallDefinitionDict:
    action = request.get_str_input_mandatory("action")
    for cls in api_call_collection_registry.values():
        api_call = cls().get_api_calls().get(action)
        if api_call:
            return api_call
    raise MKUserError(None, "Unknown API action %s" % escaping.escape_attribute(action))
예제 #4
0
def test_registered_api_call_collections():
    registered_api_actions = (
        action  #
        for cls in api_call_collection_registry.values()  #
        for action in cls().get_api_calls().keys())

    expected_api_actions = [
        'activate_changes',
        'execute_remote_automation',
        'add_contactgroup',
        'add_folder',
        'add_host',
        'add_hostgroup',
        'add_hosts',
        'add_servicegroup',
        'add_users',
        'bulk_discovery_start',
        'bulk_discovery_status',
        'delete_contactgroup',
        'delete_folder',
        'delete_host',
        'delete_hostgroup',
        'delete_hosts',
        'delete_servicegroup',
        'delete_site',
        'delete_users',
        'discover_services',
        'edit_contactgroup',
        'edit_folder',
        'edit_host',
        'edit_hostgroup',
        'edit_hosts',
        'edit_servicegroup',
        'edit_users',
        'get_all_contactgroups',
        'get_all_folders',
        'get_all_hostgroups',
        'get_all_hosts',
        'get_all_servicegroups',
        'get_all_sites',
        'get_all_users',
        'get_bi_aggregations',
        'get_combined_graph_identifications',
        'get_folder',
        'get_graph_annotations',
        'get_graph_recipes',
        'get_host',
        'get_host_names',
        'get_hosttags',
        'get_inventory',
        'get_metrics_of_host',
        'get_ruleset',
        'get_rulesets_info',
        'get_site',
        'get_user_sites',
        'login_site',
        'logout_site',
        'set_all_sites',
        'set_hosttags',
        'set_ruleset',
        'set_site',
    ]

    if not cmk_version.is_raw_edition():
        expected_api_actions += [
            'bake_agents',
            'get_graph',
            'get_sla',
        ]

    assert sorted(registered_api_actions) == sorted(expected_api_actions)
예제 #5
0
def test_registered_api_call_collections():
    registered_api_actions = (
        action  #
        for cls in api_call_collection_registry.values()  #
        for action in cls().get_api_calls().keys())

    expected_api_actions = [
        "activate_changes",
        "execute_remote_automation",
        "add_contactgroup",
        "add_folder",
        "add_host",
        "add_hostgroup",
        "add_hosts",
        "add_servicegroup",
        "add_users",
        "bulk_discovery_start",
        "bulk_discovery_status",
        "delete_contactgroup",
        "delete_folder",
        "delete_host",
        "delete_hostgroup",
        "delete_hosts",
        "delete_servicegroup",
        "delete_site",
        "delete_users",
        "discover_services",
        "edit_contactgroup",
        "edit_folder",
        "edit_host",
        "edit_hostgroup",
        "edit_hosts",
        "edit_servicegroup",
        "edit_users",
        "get_all_contactgroups",
        "get_all_folders",
        "get_all_hostgroups",
        "get_all_hosts",
        "get_all_servicegroups",
        "get_all_sites",
        "get_all_users",
        "get_bi_aggregations",
        "get_combined_graph_identifications",
        "get_folder",
        "get_graph",
        "get_graph_annotations",
        "get_graph_recipes",
        "get_host",
        "get_host_names",
        "get_hosttags",
        "get_inventory",
        "get_metrics_of_host",
        "get_ruleset",
        "get_rulesets_info",
        "get_site",
        "get_user_sites",
        "login_site",
        "logout_site",
        "set_all_sites",
        "set_hosttags",
        "set_ruleset",
        "set_site",
    ]

    if not cmk_version.is_raw_edition():
        expected_api_actions += [
            "bake_agents",
            "get_sla",
        ]

    assert sorted(registered_api_actions) == sorted(expected_api_actions)