assignPolicy
This method assigns a policy to a list of endpoints or containers.
Note
The method uses the default view type. For VMWare integrations it is Hosts and Clusters view. For Citrix XenServer integrations it is Server view. If you are using other views, you must include in targetIds
the IDs of the target endpoints and containers.
Services
This method requires you to place the {service}
name in the API URL. The allowed services are:
computers
, for "Computers and Virtual Machines"virtualmachines
, for "Virtual Machines"
For example, the request URL for the virtual machines
service is:
https://YOUR-HOSTNAME/api/v1.0/jsonrpc/network/virtualmachines
Parameters
Parameter | Type | Optional | Description |
---|---|---|---|
| Array | No | A list with the IDs of the policy targets. The target ID can designate an endpoint or a container. |
| Boolean | Yes | A boolean specifying whether the given targets shoud inherit the policy of the parent container. Targets without a parent container receive the default policy. Use this parameter only in conjuction with the |
| String | Yes | A string specifying the ID of the policy to be assigned. When this parameter is missing the |
| Boolean | Yes | A boolean specifying whether the policy should be assigned to child entities of the given targets. By default, the parameter is set to |
Return value
This method returns a Boolean which is True, when the policy was successfully assigned to one or more targets. The policy is not assigned to targets that have enforced policy.
Example
Request:
{ "params": { "targetIds": [ "56728d66b1a43de92c712346", "69738d66b1a43de92c712346" ], "inheritFromAbove": false, "policyId": "55828d66b1a43de92c712345", "forcePolicyInheritance": true }, "jsonrpc": "2.0", "method": "assignPolicy", "id": "787b5e36-89a8-4353-88b9-6b7a32e9c87f" }
Response:
{ "id": "787b5e36-89a8-4353-88b9-6b7a32e9c87f", "jsonrpc":"2.0", "result": True }