Exemplo n.º 1
0
        "id":
        "host",
        "domainType":
        "host_config",
        "value":
        [serialize_host(host, effective_attributes=False) for host in hosts],
        "links": [
            constructors.link_rel("self",
                                  constructors.collection_href("host_config"))
        ],
    }
    return constructors.serve_json(_hosts)


@Endpoint(
    constructors.object_property_href("host_config", "{host_name}", "nodes"),
    ".../property",
    method="put",
    path_params=[{
        "host_name":
        gui_fields.HostField(
            description="A cluster host.",
            should_be_cluster=True,
        ),
    }],
    etag="both",
    request_schema=request_schemas.UpdateNodes,
    response_schema=response_schemas.ObjectProperty,
    permissions_required=permissions.Perm("wato.all_folders"),
)
def update_nodes(params):
Exemplo n.º 2
0
                domain_type='host_config',
                obj={
                    'title': host.name(),
                    'id': host.id()
                },
            ) for host in hosts
        ],
        'links': [
            constructors.link_rel('self',
                                  constructors.collection_href('host_config'))
        ],
    }
    return constructors.serve_json(_hosts)


@Endpoint(constructors.object_property_href('host_config', '{host_name}',
                                            'nodes'),
          '.../property',
          method='put',
          path_params=[{
              'host_name':
              fields.HostField(
                  description="A cluster host.",
                  should_be_cluster=True,
              ),
          }],
          etag='both',
          request_schema=request_schemas.UpdateNodes,
          response_schema=response_schemas.ObjectProperty)
def update_nodes(params):
    """Update the nodes of a cluster host"""
    host_name = params['host_name']