4.4. Managing Settings

Administrators can create and manage settings, in particular, to toggle actions available to users, both on the web panel and in the API.

Settings can be created and managed with the vzapi setting commands.

4.4.1. Listing Settings

To list settings, use the vzapi setting list command. For example:

# vzapi setting list
[
    {
        "applies_to": {
            "instance_type": "all",
            "module_type": "all"
        },
        "created_at": "2021-03-11T14:35:58.000000",
        "param": "instance.action.change_password",
        "updated_at": null,
        "value": "0"
    },
    {
        "applies_to": {
            "instance_type": "ct",
            "module_type": "ui"
        },
        "created_at": "2021-03-11T14:36:30.000000",
        "param": "instance.action.reinstall",
        "updated_at": null,
        "value": "0"
    }
]

4.4.2. Creating Settings

To create a setting, specify a user action to toggle and the value of which 0 disables and 1 enables the setting. You can also narrow the setting down to affect only VMs or containers and only the web panel or API.

For a list of the currently supported user actions and other parameters, see Creating Settings.

For example, to completely disable the change password action, run

# vzapi setting create --param instance.action.change_password --value 0
{
 "applies_to": {
     "instance_type": "all",
     "module_type": "all"
 },
 "created_at": "2021-03-11T14:35:58.993419",
 "param": "instance.action.change_password",
 "updated_at": null,
 "value": "0"
}

To disable the reinstall action only in the web panel (i.e. hide the button), run

# vzapi setting create --param instance.action.reinstall --module-type ui --value 0
{
 "applies_to": {
     "instance_type": "all",
     "module_type": "ui"
 },
 "created_at": "2021-03-11T14:36:30.086787",
 "param": "instance.action.reinstall",
 "updated_at": null,
 "value": "0"
}

The action is only available for containers, so even though instance_type is set to all by default, only containers will be affected.

4.4.3. Showing Setting Details

To show the details of a setting, use the vzapi setting show command. For example:

# vzapi setting show instance.action.reinstall
{
    "applies_to": {
        "instance_type": "ct",
        "module_type": "ui"
    },
    "created_at": "2021-03-11T14:36:30.000000",
    "param": "instance.action.reinstall",
    "updated_at": null,
    "value": "0"
}

4.4.4. Updating Settings

To update a setting, use the vzapi setting update command. For example:

# vzapi setting update instance.action.reinstall --module-type api
{
    "applies_to": {
        "instance_type": "all",
        "module_type": "api"
    },
    "created_at": "2021-03-11T14:36:30.000000",
    "param": "instance.action.reinstall",
    "updated_at": null,
    "value": "0"
}

The next time you request this setting’s details, the updated_at field will contain the timestamp of the update.

4.4.5. Deleting Settings

To delete a setting, use the vzapi setting delete command. For example:

# vzapi setting delete instance.action.reinstall