API workflow for conditional origins

The following is the workflow you need to follow when creating a new Cloudlet policy that uses Conditional Origins.

  1. Using the Property Manager API (PAPI), set up the rules for any Cloudlets Origins that will support the Cloudlets policy.

  2. Run a GET request on the /cloudlets/api/v2/cloudlet-info endpoint to retrieve the ID (cloudletId) for the Cloudlet you are working with. You need the cloudletId when creating a new policy.

  3. Run a GET request on the /cloudlets/api/v2/group-info endpoint to retrieve information about which Cloudlets are associated with the groups you have edit privileges for. You will need the group IDs (groupId) returned when creating a Cloudlet policy.

  4. Using the /cloudlets/api/v2/policies endpoint, run a POST to create a Cloudlet policy using the cloudletId and groupId you retrieved from the previous steps. The policy created is version 1. However, this new version does not have a description and does not include match rules (matchRules) attributes.
    [block:callout]
    {
    "type": "info",
    "body": "You have the option of using query parameters to clone an existing policy."
    }
    [/block]

  5. Update the new policy version 1 by running a PUT request on the /cloudlets/api/v2/policies/{policyId}/versions/{version} endpoint that includes a version description and match rules. The policyId is returned in the response when the Cloudlet policy is created.

  6. If you are setting up a load balancing configuration for Application Load Balancer complete the following tasks:

    1. Make a POST request to /cloudlets/api/v2/origins.

    2. Make a POST request to /cloudlets/api/v2/origins/{originId}/versions.

  7. If you need to review the current property associations for the policy version before activating, run a GET request on the /cloudlets/api/v2/policies/{policyId}/properties endpoint.
    [block:callout]
    {
    "type": "info",
    "title": "",
    "body": "This operation also returns information about any Conditional Origins configured on an associated property."
    }
    [/block]

  8. Using the Property Manager API (PAPI), set up the behavior for each Cloudlet you are configuring:

  9. Using PAPI, activate the property version that includes your Cloudlets behavior changes.

  10. If you are setting up a load balancing configuration for Application Load Balancer, make a POST request to
    /cloudlets/api/v2/origins/{originId}/activations to activate the load balancing version.

  11. Activate the policy by executing a POST request to the /cloudlets/api/v2/policies/{policyId}/versions/{version}/activations endpoint.