Swagger Policies examples

A PowerSC policy represents a unique collection of attributes that are collectively managed and added to the endpoints in a group. PowerSC policies reduce the administrative overhead that is required to manage security profiles in a system.

Swagger GET /policies example

Perform the following steps to get the policy list:
  1. Expand the Policies section.
  2. Click GET /policies.
  3. Click Try it Out.
  4. Select the media type from the drop-down menu. This controls the header accept type in the curl command. Possible values are application/json and application/xml.
  5. Click Execute.
    Swagger UI submits the request and shows the curl command that was submitted. If successful, the Responses section shows the response with an HTTP status code of 200 OK.
    Response body
    {
      "policyList": []
    }

Swagger GET /policies/{policyName} example

Perform the following steps to get the specified policy name:
  1. Expand the Policies section.
  2. Click GET /policies{policyName}.
  3. Click Try it Out.
  4. Enter the policy name in the policyName field.
  5. Select the media type from the drop-down menu. This controls the header accept type in the curl command. Possible values are application/json and application/xml.
  6. Click Execute.
    Swagger UI submits the request and shows the curl command that was submitted. If successful, the Responses section shows the response with an HTTP status code of 200 OK.
    Response body
    {
      "compliance": {
        "operation": "simulate",
        "profileName": "Linux_CISv1.xml",
        "report": {
          "subject": "",
          "toList": [
            ""
          ]
        },
        "reportEnabled": false,
        "schedule": {
          "dayOffset": 0,
          "hour": 0,
          "minute": 0,
          "scheduleType": "daily",
          "year": 2024
        },
        "scheduleEnabled": true
      },
      "complianceEnabled": true,
      "created": 1722612444299,
      "groupName": "PolTest",
      "owner": "user",
      "policyName": "test4",
      "updated": 1722612444299
    }

Swagger POST /policies/{policyName} example

Perform the following steps to create a policy. See Working with policy management for more information and guidelines.
  1. Expand the Policies section.
  2. Click POST /policies{policyName}.
  3. Click Try it Out.
  4. Enter the policy name in the policyName field.
  5. Select the media type from the drop-down menu. This controls the header accept type in the curl command. Possible values are application/json and application/xml.
  6. Supply the request body in the following format. The example uses an example policy for demonstration purposes only.
    {
      "policyName": "test4",
      "groupName": "PolTest",
      "complianceEnabled": true,
      "compliance": {
        "operation": "simulate",
        "profileName": "Linux_CISv1.xml",
        "reportEnabled": false, 
        "scheduleEnabled": true,
        "schedule": {
          "dayOffset": 216,
          "hour": 0,
          "minute": 0,
          "year": 2024,
          "scheduleType": "daily"
        }
      }
    }
  7. Click Execute.

    Swagger UI submits the request and shows the curl command that was submitted. If successful, the Responses section shows the response with an HTTP status code of 200 OK.

  8. Use Swagger GET /policies/{policyName} example to verify the policy.

Swagger PUT /policies/{policyName} example

Perform the following steps to edit a policy. See Working with policy management for more information and guidelines.
  1. Expand the Policies section.
  2. Click PUT /policies{policyName}.
  3. Click Try it Out.
  4. Enter the policy name you want to edit in the policyName field.
  5. Select the media type from the drop-down menu. This controls the header accept type in the curl command. Possible values are application/json and application/xml.
  6. Supply the request body in the following format.
    {
      "policyName": "string",
      "groupName": "string",
      "complianceEnabled": true,
      "compliance": {
        "operation": "check",
        "profileName": "string",
        "reportEnabled": true,
        "report": {
          "subject": "string",
          "toList": [
            "string"
          ]
        },
        "scheduleEnabled": true,
        "schedule": {
          "dayOffset": 0,
          "hour": 0,
          "minute": 0,
          "year": 0,
          "scheduleType": "oneTime"
        }
      }
    }
  7. Click Execute.

    Swagger UI submits the request and shows the curl command that was submitted. If successful, the Responses section shows the response with an HTTP status code of 200 OK.

  8. Use Swagger GET /policies/{policyName} example to verify the policy edits.

Swagger DELETE /policies/{policyName} example

Perform the following steps to delete a policy. See Working with policy management for more information and guidelines.
  1. Expand the Policies section.
  2. Click DELETE /policies{policyName}.
  3. Click Try it Out.
  4. Enter the policy name you want to delete in the policyName field.
  5. Select the media type from the drop-down menu. This controls the header accept type in the curl command. Possible values are application/json and application/xml.
  6. Click Execute.

    Swagger UI submits the request and shows the curl command that was submitted. If successful, the Responses section shows the response with an HTTP status code of 200 OK.

  7. Use Swagger GET /policies example to verify that the policy was deleted.

Swagger POST /policies/{policyName}/associate example

Perform the following steps to associate a policy with systems. See Working with policy management for more information and guidelines.
  1. Expand the Policies section.
  2. Click POST /policies{policyName}/associate.
  3. Click Try it Out.
  4. Enter the policy name you want to associate with systems in the policyName field.
  5. Select the media type from the drop-down menu. This controls the header accept type in the curl command. Possible values are application/json and application/xml.
  6. Specify a UID or hostname to associate with the policy in the text box. Click Add item to specify additional systems.
  7. Click Execute.

    Swagger UI submits the request and shows the curl command that was submitted. If successful, the Responses section shows the response with an HTTP status code of 200 OK.

    {
      "groups": [
        {
          "1722610444332": 1722610444332
        }
      ]
    }
  8. Use Swagger GET /policies/{policyName} example to verify the association.

Swagger POST /policies/{policyName}/disassociate example

Perform the following steps to exclude systems from a policy. See Working with policy management for more information and guidelines.
  1. Expand the Policies section.
  2. Click POST /policies{policyName}/disassociate.
  3. Click Try it Out.
  4. Enter the policy name from which you want to exclude systems in the policyName field.
  5. Select the media type from the drop-down menu. This controls the header accept type in the curl command. Possible values are application/json and application/xml.
  6. Specify a UID or hostname to exclude from the policy in the text box. Click Add item to specify additional systems.
  7. Click Execute.

    Swagger UI submits the request and shows the curl command that was submitted. If successful, the Responses section shows the response with an HTTP status code of 200 OK.

    {
      "groups": [
        {
          "1722610444334": 1722610444334
        }
      ]
    }
  8. Use Swagger GET /policies/{policyName} example to verify the exclusion.