示例#1
0
def update(server_id, name, model, client):
    """Update server."""

    return utils.update_model(server_id,
                              client.get_server,
                              client.update_server,
                              model,
                              name=name)
示例#2
0
def update(cluster_id, name, model, client):
    """Update cluster data."""

    return utils.update_model(
        cluster_id,
        client.get_cluster,
        client.update_cluster,
        model,
        name=name
    )
示例#3
0
def update(user_id, login, email, full_name, role_id, model, client):
    """Update user data.

    The logic is following: if 'model' parameter is set (full JSON dump
    of the model) is set, all other options will be ignored. Otherwise
    only certain parameters will be updated.
    """

    return utils.update_model(user_id,
                              client.get_user,
                              client.update_user,
                              model,
                              email=email,
                              login=login,
                              full_name=full_name,
                              role_id=role_id)
示例#4
0
def update(role_id, name, api_permissions, playbook_permissions, model,
           client):
    """Update role."""

    permissions = None
    if api_permissions or playbook_permissions:
        permissions = [{
            "name": "api",
            "permissions": api_permissions
        }, {
            "name": "playbook",
            "permissions": playbook_permissions
        }]

    return utils.update_model(role_id,
                              client.get_role,
                              client.update_role,
                              model,
                              name=name,
                              permissions=permissions)