Changes an existing rule.
CALL DBCloud.AlterRule ( rule_id=rule_id [, optional-parameters ] )
dbcloudcmd run AlterRule rule_id [ optional-parameters ]
The rule to alter. (Required)
Set to 1 for a strict rule and 0 for a weak rule. (When set to 1, the target_object_id or target_tag_id is required.) The default is the current value.
The search query that must hold for each target object, in quotes. The default is the current value.
The type of object the rule applies to. The default is the current value.
The following values are supported:
A cloud server.
A tenant database.
The object the rule applies to. Accepts a search query that identifies one object that is of the same type as that defined for the target_object_type parameter, for example an object name or ID. The default is the current value.
The tag the rule applies to. Accepts a search query that identifies one tag, for example a tag name or ID. The default is the current value.
The name for the rule. The default is the current value.
Internal use only. The default is NULL.
The last time the object was modified. If provided, the task fails if the object has changed since the specified time. The default is NULL.
This parameter specifies whether the rule is strict or weak. Strict rules apply to a single object or to a group of the same type of object with the same tag. When creating a strict rule, you must specify either target_object_id or target_tag_id. A rule can be strict only if the properties that it refers to are properties that can be controlled by the cloud.
The target_object_type parameter. Accepts a single object type. The rule applies to only the specified object type.
Specifies the syntax for the rule. Rules use the same syntax as searches.
To ensure that you are not over-writing another user's changes, run dbcloudcmd -v describe task to get the time the cloud was last modified. Specify this value as the object_updated parameter. If the cloud has been altered since the specified time, then the task fails with an error. If this occurs, run the task again after re-running dbcloudcmd -v describe task.
The AlterRule task requires that you specify the ID of the rule that you want to alter. Run the following command to find a rule ID: dbcloudcmd describe Rules.
The following command alters a weak rule that specifies that every host must have a tag indicating its country.
dbcloudcmd run AlterRule rule_id=RL-q4w5 is_strict=0 rule_definition="tag:Canada or tag:US or tag:Greece" target_object_type=Host
The following command alters a cloud rule:
dbcloudcmd run ExecuteTaskBatch "CALL DBCloud.AlterRule ('RL-l9b5',0,'tag:CloudyTag', 'myserver#3',)"