4.4. Managing Settings¶
Administrators can create and manage settings, in particular, to toggle actions available to users, both in the web panel and the API.
Settings can be created and managed with the vzapi setting
commands. Settings cannot be duplicated, however. Trying to create a setting that already exists will result in the HTTP status code 409 (conflict). You can either update the setting or delete it and create it anew.
4.4.1. Listing Settings¶
To list settings, use the vzapi setting list
command.
Note
If MFA is enabled, replace vzapi <cmd>
with vzapi --os-cloud local-credential <cmd>
. For more details, see Managing Multi-Factor Authentication.
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.
To create settings, use the vzapi setting create
command.
Note
If MFA is enabled, replace vzapi <cmd>
with vzapi --os-cloud local-credential <cmd>
. For more details, see Managing Multi-Factor Authentication.
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.
Note
If MFA is enabled, replace vzapi <cmd>
with vzapi --os-cloud local-credential <cmd>
. For more details, see Managing Multi-Factor Authentication.
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.
Note
If MFA is enabled, replace vzapi <cmd>
with vzapi --os-cloud local-credential <cmd>
. For more details, see Managing Multi-Factor Authentication.
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.
Note
If MFA is enabled, replace vzapi <cmd>
with vzapi --os-cloud local-credential <cmd>
. For more details, see Managing Multi-Factor Authentication.
For example:
# vzapi setting delete instance.action.reinstall