def update(params): """Update a contact group""" name = params['name'] group = fetch_group(name, "contact") constructors.require_etag(constructors.etag_of_dict(group)) edit_group(name, 'contact', params['body']) group = fetch_group(name, "contact") return serve_group(group, serialize_group('contact_group_config'))
def update(params): """Update a host group""" name = params["name"] group = fetch_group(name, "host") constructors.require_etag(constructors.etag_of_dict(group)) edit_group(name, "host", updated_group_details(name, "host", params["body"])) group = fetch_group(name, "host") return serve_group(group, serialize_group("host_group_config"))
def update(params): """Update a service-group""" name = params['name'] group = fetch_group(name, "service") constructors.require_etag(constructors.etag_of_dict(group)) edit_group(name, group_type='service', extra_info=params['body']) group = fetch_group(name, "service") return serve_group(group, serialize_group('service_group_config'))
def update(params): """Update a host group""" name = params['name'] group = fetch_group(name, "host") constructors.require_etag(constructors.etag_of_dict(group)) edit_group(name, 'host', updated_group_details(name, 'host', params['body'])) group = fetch_group(name, "host") return serve_group(group, serialize_group('host_group_config'))
def update(params): """Update a contact group""" user.need_permission("wato.edit") name = params["name"] group = fetch_group(name, "contact") constructors.require_etag(constructors.etag_of_dict(group)) edit_group(name, "contact", updated_group_details(name, "contact", params["body"])) group = fetch_group(name, "contact") return serve_group(group, serialize_group("contact_group_config"))
def delete(params): """Delete a contact group""" name = params['name'] group = fetch_group(name, "contact") constructors.require_etag(constructors.etag_of_dict(group)) watolib.delete_group(name, 'contact') return Response(status=204)
def delete(params): """Delete a service-group""" name = params['name'] group = fetch_group(name, "service") constructors.require_etag(constructors.etag_of_dict(group)) watolib.delete_group(name, group_type='service') return Response(status=204)
def create(params): """Create a contact group""" body = params['body'] name = body['name'] alias = body.get('alias') add_group(name, 'contact', {'alias': alias}) group = fetch_group(name, "contact") return serve_group(group, serialize_group('contact_group_config'))
def create(params): """Create a service-group""" body = params['body'] name = body['name'] alias = body.get('alias') add_group(name, 'service', {'alias': alias}) group = fetch_group(name, "service") return serve_group(group, serialize_group('service_group_config'))
def create(params): """Create a contact group""" body = params['body'] name = body['name'] group_details = {"alias": body.get("alias")} if version.is_managed_edition(): group_details = update_customer_info(group_details, body["customer"]) add_group(name, 'contact', group_details) group = fetch_group(name, "contact") return serve_group(group, serialize_group('contact_group_config'))
def create(params): """Create a host group""" body = params["body"] name = body["name"] group_details = {"alias": body.get("alias")} if version.is_managed_edition(): group_details = update_customer_info(group_details, body["customer"]) add_group(name, "host", group_details) group = fetch_group(name, "host") return serve_group(group, serialize_group("host_group_config"))
def create(params): """Create a service group""" user.need_permission("wato.edit") body = params["body"] name = body["name"] group_details = {"alias": body.get("alias")} if version.is_managed_edition(): group_details = update_customer_info(group_details, body["customer"]) groups.add_group(name, "service", group_details) group = fetch_group(name, "service") return serve_group(group, serialize_group("service_group_config"))
def bulk_delete(params): """Bulk delete service groups""" entries = params['entries'] for group_name in entries: _group = fetch_group(group_name, "service", status=400, message="service group %s was not found" % group_name) for group_name in entries: watolib.delete_group(group_name, group_type='service') return Response(status=204)
def bulk_delete(params): """Bulk delete contact groups""" entries = params['entries'] for group_name in entries: _group = fetch_group( group_name, "contact", status=400, message=f"contact group {group_name} was not found", ) for group_name in entries: watolib.delete_group(group_name, 'contact') return Response(status=204)
def bulk_delete(params): """Bulk delete service groups""" user.need_permission("wato.edit") body = params["body"] entries = body["entries"] for group_name in entries: _group = fetch_group(group_name, "service", status=400, message="service group %s was not found" % group_name) for group_name in entries: groups.delete_group(group_name, group_type="service") return Response(status=204)
def bulk_delete(params): """Bulk delete host groups""" body = params["body"] entries = body["entries"] for group_name in entries: message = "host group %s was not found" % group_name _group = fetch_group( group_name, "host", status=400, message=message, ) for group_name in entries: watolib.delete_group(group_name, "host") return Response(status=204)
def bulk_delete(params): """Bulk delete host groups""" # TODO: etag implementation entries = params['entries'] for group_name in entries: message = "host group %s was not found" % group_name _group = fetch_group( group_name, "host", status=400, message=message, ) # TODO: etag check should be done here for group_name in entries: watolib.delete_group(group_name, 'host') return Response(status=204)
def bulk_delete(params): """Bulk delete contact groups""" body = params["body"] entries = body["entries"] for group_name in entries: _group = fetch_group( group_name, "contact", status=400, message=f"contact group {group_name} was not found", ) with endpoint.do_not_track_permissions(), SuperUserContext(): for group_name in entries: # We need to supress this, because a lot of dashboard permissions are checked for # various reasons. delete_group(group_name, "contact") return Response(status=204)
def get(params): """Show a host group""" user.need_permission("wato.groups") name = params["name"] group = fetch_group(name, "host") return serve_group(group, serialize_group("host_group_config"))
def get(params): """Show a host group""" name = params["name"] group = fetch_group(name, "host") return serve_group(group, serialize_group("host_group_config"))
def get(params): """Show a host-group""" name = params['name'] group = fetch_group(name, "host") return serve_group(group, serialize_group('host_group_config'))
def show_group(params): """Show a service-group""" name = params['name'] group = fetch_group(name, "service") return serve_group(group, serialize_group('service_group_config'))
def show_group(params): """Show a service group""" user.need_permission("wato.groups") name = params["name"] group = fetch_group(name, "service") return serve_group(group, serialize_group("service_group_config"))
def show_group(params): """Show a service group""" name = params["name"] group = fetch_group(name, "service") return serve_group(group, serialize_group("service_group_config"))
def show(params): """Show a contact group""" name = params['name'] group = fetch_group(name, "contact") return serve_group(group, serialize_group('contact_group_config'))