Defining Cloudera Lakehouse Optimizer resources using REST APIs

When you use REST APIs to create or define a Cloudera Lakehouse Optimizer policy, you can use the default policy called "ClouderaAdaptive" as is, or you can create a new policy. When you create a new policy or override an existing policy, you define the policy in a new JEXL file, alternatively add the required constants in a new JSON file, and then upload the resources.

Perform the following steps to create a new policy or to override an existing policy by defining the policy in the new JEXL file. Alternatively you can add the constants in the new JSON file.
  1. Create the JEXL file, and optionally the JSON file. You can use the default policy resources as a template to create the files, or you can create the files from scratch.
    For more information about the JEXL file and JSON file, see Understanding policy resources.
  2. Upload the resources using the PUT /policies/resource API.
    Use the PATCH /policies/resource API to upload an updated policy resource.
    Use the following curl command to upload the resources:
    curl -X PUT --location '[***LAKEHOUSE OPTIMIZER ENDPOINT***]/cdp-proxy-token/clo/api/v1/policies/resource' --header 'Authorization: Bearer ey

    To construct the URI that you can use to fetch, upload, and update the policy resources, see URI to fetch, upload, and update policy resources when using REST APIs