Ssh user mutation examples

All SSH users must be connected to exactly one host.

A password is optional, even if the user doesn't exist yet. A new user should always contain a username.

If the delete flag is set to true the user should be deleted entirely. The API should throw an exception if the ssh user is still connected to one, or multiple domains. When userId is left empty and delete flag is set to true the API should trow an exception.

Add / change ssh user

For all add / change examples we use the same CreateSshUser query:

mutation CreateUser($user: UserInput!) {
    User(entity: $user, delete: false) {
        id
        username
        password
        passwordEnabled
        host {
            id
        }
    }
}

New ssh user to host

var variables = {
    "user": {
        "username": "user1",
        "enablePassword": false,
        "host": 123
    }
}

Change user password

var variables = {
    "user": {
        "id": 1234,
        "password": "password"
    }
}

Delete ssh user

For all delete examples we use the DeleteSshUser query:

mutation DeleteUser($user: UserInput!) {
    User(entity: $user, delete: true) {
        id
        __typename
    }
}

Delete ssh user

var variables = {
    "user": {
        "id": 1234
    }
}