Skip to main content

assignPolicy

Use this method to assign a policy to one or more endpoints. This method works on all endpoint types, including containers. The policy is not assigned to targets that have an enforced policy.

Parameters

Parameter

Description

Included in request

Type

Values

targetIds

The IDs of the endpoints you want to assign the policy to.

Mandatory

Array of Strings

No additional requirements.

inheritFromAbove

If true, the target endpoints will inherit the policy of the parent containers. If a specific endpoint does not have a parent or the parent does not have any specific policy assigned, it will receive the default policy.

You can not use this parameter if policyId or forcePolicyInheritance is present in the request.

Optional

Boolean

Default value: true.

policyId

The ID of the policy you want to assign.

If not included in the request, the inheritFromAbove must be present in the request and set to true.

Optional

String

No additional requirements.

forcePolicyInheritance

If true, the policy is also assigned to all the child endpoints of the selected targets.

To use this parameter, policyId must be included in the request.

Optional

Boolean

Default value: false.

Return value

Attribute

Type

Description

result

Boolean

Indicates if the operation was successful and the policy was successfully assigned to one or more targets.

Examples

Request

 {
      "params": {
          "targetIds": [
              "56728d66b1a43de92c7****",
              "69738d66b1a43de92c71****"
          ],
          "inheritFromAbove": false,
          "policyId": "55828d66b1a43de92c71****",
          "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
 }