Resource URL: /platform/<<version=1>>/filepool/policies

    Overview: This resource represents your collection of filepool policies.
              Filepool policies let you apply storage actions (for example
              setting file protection level) to specified sets of files (for
              example all files above a certain size).

     Methods: GET, POST

********************************************************************************

Method GET: List all policies.

       URL: GET /platform/<<version=1>>/filepool/policies

Query arguments:

GET response body schema:
{
  "type": [
    {
      "additionalProperties": false, 
      "type": "object", 
      "description": "A list of errors that may be returned.", 
      "properties": {
        "errors": {
          "items": {
            "additionalProperties": false, 
            "type": "object", 
            "description": "An object describing a single error.", 
            "properties": {
              "field": {
                "type": "string", 
                "description": "The field with the error if applicable."
              }, 
              "message": {
                "type": "string", 
                "description": "The error message."
              }, 
              "code": {
                "type": "string", 
                "description": "The error code."
              }
            }
          }, 
          "type": "array"
        }
      }
    }, 
    {
      "additionalProperties": false, 
      "type": "object", 
      "properties": {
        "total": {
          "minimum": 0, 
          "type": "integer", 
          "description": "Total number of items available.", 
          "maximum": 4294967295
        }, 
        "policies": {
          "minItems": 0, 
          "items": {
            "type": "object", 
            "description": "A filepool policy object", 
            "properties": {
              "description": {
                "type": "string", 
                "description": "A description for this policy"
              }, 
              "birth_cluster_id": {
                "type": "string", 
                "description": "The guid assigned to the cluster on which the account was created"
              }, 
              "state": {
                "enum": [
                  "OK", 
                  "disabled"
                ], 
                "type": "string", 
                "description": "Indicates whether this policy is in a good state (\"OK\") or disabled (\"disabled\")"
              }, 
              "actions": {
                "items": {
                  "required": true, 
                  "type": "object", 
                  "description": "An action to apply to a file matching the policy", 
                  "properties": {
                    "action_param": {
                      "required": true, 
                      "type": [
                        "string", 
                        "boolean", 
                        "object", 
                        "null"
                      ], 
                      "description": "Varies according to action_type"
                    }, 
                    "action_type": {
                      "enum": [
                        "set_requested_protection", 
                        "set_data_access_pattern", 
                        "enable_coalescer", 
                        "apply_data_storage_policy", 
                        "apply_snapshot_storage_policy", 
                        "set_cloudpool_policy", 
                        "enable_packing"
                      ], 
                      "type": "string", 
                      "required": true
                    }
                  }
                }, 
                "type": "array", 
                "description": "A list of actions to be taken for matching files"
              }, 
              "state_details": {
                "type": "string", 
                "description": "Gives further information to describe the state of this policy"
              }, 
              "file_matching_pattern": {
                "type": "object", 
                "description": "The file matching rules for this policy", 
                "properties": {
                  "or_criteria": {
                    "items": {
                      "required": true, 
                      "type": "object", 
                      "properties": {
                        "and_criteria": {
                          "items": {
                            "required": true, 
                            "type": "object", 
                            "properties": {
                              "units": {
                                "type": "string", 
                                "description": "Size unit value. One of 'B','KB','MB','GB','TB','PB','EB' (valid only with 'type' = 'size')"
                              }, 
                              "use_relative_time": {
                                "type": "boolean", 
                                "description": "Whether time units refer to a calendar date and time (e.g., Jun 3, 2009) or a relative duration (e.g., 2 weeks) (valid only with 'type' in {accessed_time, birth_time, changed_time or metadata_changed_time}"
                              }, 
                              "value": {
                                "type": [
                                  "string", 
                                  "integer"
                                ], 
                                "description": "The value to be compared against a file attribute"
                              }, 
                              "case_sensitive": {
                                "type": "boolean", 
                                "description": "True to indicate case sensitivity when comparing file attributes (valid only with 'type' = 'name' or 'type' = 'path')"
                              }, 
                              "field": {
                                "type": "string", 
                                "description": "File attribute field name to be compared in a custom comparison (valid only with 'type' = 'custom_attribute')"
                              }, 
                              "attribute_exists": {
                                "type": "boolean", 
                                "description": "Indicates whether the existence of an attribute indicates a match (valid only with 'type' = 'custom_attribute')"
                              }, 
                              "operator": {
                                "enum": [
                                  "==", 
                                  "!=", 
                                  ">", 
                                  ">=", 
                                  "<", 
                                  "<=", 
                                  "!"
                                ], 
                                "type": "string", 
                                "description": "The comparison operator to use while comparing an attribute with its value"
                              }, 
                              "type": {
                                "enum": [
                                  "name", 
                                  "path", 
                                  "link_count", 
                                  "accessed_time", 
                                  "birth_time", 
                                  "changed_time", 
                                  "metadata_changed_time", 
                                  "size", 
                                  "file_type", 
                                  "custom_attribute"
                                ], 
                                "type": "string", 
                                "description": "The file attribute to be compared to a given value", 
                                "required": true
                              }, 
                              "begins_with": {
                                "type": "boolean", 
                                "description": "True to match files recursively under the given path. (valid only with 'type' = 'path')"
                              }
                            }
                          }, 
                          "required": true, 
                          "type": "array"
                        }
                      }
                    }, 
                    "required": true, 
                    "type": "array"
                  }
                }
              }, 
              "apply_order": {
                "type": "integer", 
                "description": "The order in which this policy should be applied (relative to other policies)"
              }, 
              "id": {
                "type": "integer", 
                "description": "A unique identifier for this policy"
              }, 
              "name": {
                "type": "string", 
                "description": "A unique name for this policy"
              }
            }
          }, 
          "type": "array", 
          "maxItems": 4294967295
        }, 
        "resume": {
          "minLength": 0, 
          "type": [
            "string", 
            "null"
          ], 
          "description": "Continue returning results from previous call using this token (token should come from the previous call, resume cannot be used with other options)."
        }
      }
    }
  ]
}

********************************************************************************

Method POST: Create a new policy.

        URL: POST /platform/<<version=1>>/filepool/policies

There are no query arguments for this method.

Required POST request body fields:
name, file_matching_pattern

POST request body schema:
{
  "type": "object", 
  "description": "A filepool policy object", 
  "properties": {
    "name": {
      "required": true, 
      "type": "string", 
      "description": "A unique name for this policy"
    }, 
    "apply_order": {
      "type": "integer", 
      "description": "The order in which this policy should be applied (relative to other policies)"
    }, 
    "description": {
      "type": "string", 
      "description": "A description for this policy"
    }, 
    "actions": {
      "items": {
        "required": true, 
        "type": "object", 
        "description": "An action to apply to a file matching the policy", 
        "properties": {
          "action_param": {
            "required": true, 
            "type": [
              "string", 
              "boolean", 
              "object", 
              "null"
            ], 
            "description": "Varies according to action_type"
          }, 
          "action_type": {
            "enum": [
              "set_requested_protection", 
              "set_data_access_pattern", 
              "enable_coalescer", 
              "apply_data_storage_policy", 
              "apply_snapshot_storage_policy", 
              "set_cloudpool_policy", 
              "enable_packing"
            ], 
            "type": "string", 
            "required": true
          }
        }
      }, 
      "type": "array", 
      "description": "A list of actions to be taken for matching files"
    }, 
    "file_matching_pattern": {
      "required": true, 
      "type": "object", 
      "description": "The file matching rules for this policy", 
      "properties": {
        "or_criteria": {
          "items": {
            "required": true, 
            "type": "object", 
            "properties": {
              "and_criteria": {
                "items": {
                  "required": true, 
                  "type": "object", 
                  "properties": {
                    "units": {
                      "type": "string", 
                      "description": "Size unit value. One of 'B','KB','MB','GB','TB','PB','EB' (valid only with 'type' = 'size')"
                    }, 
                    "use_relative_time": {
                      "type": "boolean", 
                      "description": "Whether time units refer to a calendar date and time (e.g., Jun 3, 2009) or a relative duration (e.g., 2 weeks) (valid only with 'type' in {accessed_time, birth_time, changed_time or metadata_changed_time}"
                    }, 
                    "value": {
                      "type": [
                        "string", 
                        "integer"
                      ], 
                      "description": "The value to be compared against a file attribute"
                    }, 
                    "case_sensitive": {
                      "type": "boolean", 
                      "description": "True to indicate case sensitivity when comparing file attributes (valid only with 'type' = 'name' or 'type' = 'path')"
                    }, 
                    "field": {
                      "type": "string", 
                      "description": "File attribute field name to be compared in a custom comparison (valid only with 'type' = 'custom_attribute')"
                    }, 
                    "attribute_exists": {
                      "type": "boolean", 
                      "description": "Indicates whether the existence of an attribute indicates a match (valid only with 'type' = 'custom_attribute')"
                    }, 
                    "operator": {
                      "enum": [
                        "==", 
                        "!=", 
                        ">", 
                        ">=", 
                        "<", 
                        "<=", 
                        "!"
                      ], 
                      "type": "string", 
                      "description": "The comparison operator to use while comparing an attribute with its value"
                    }, 
                    "type": {
                      "enum": [
                        "name", 
                        "path", 
                        "link_count", 
                        "accessed_time", 
                        "birth_time", 
                        "changed_time", 
                        "metadata_changed_time", 
                        "size", 
                        "file_type", 
                        "custom_attribute"
                      ], 
                      "type": "string", 
                      "description": "The file attribute to be compared to a given value", 
                      "required": true
                    }, 
                    "begins_with": {
                      "type": "boolean", 
                      "description": "True to match files recursively under the given path. (valid only with 'type' = 'path')"
                    }
                  }
                }, 
                "required": true, 
                "type": "array"
              }
            }
          }, 
          "required": true, 
          "type": "array"
        }
      }
    }
  }
}

POST response body schema:
{
  "type": [
    {
      "additionalProperties": false, 
      "type": "object", 
      "description": "A list of errors that may be returned.", 
      "properties": {
        "errors": {
          "items": {
            "additionalProperties": false, 
            "type": "object", 
            "description": "An object describing a single error.", 
            "properties": {
              "field": {
                "type": "string", 
                "description": "The field with the error if applicable."
              }, 
              "message": {
                "type": "string", 
                "description": "The error message."
              }, 
              "code": {
                "type": "string", 
                "description": "The error code."
              }
            }
          }, 
          "type": "array"
        }
      }
    }, 
    {
      "type": "object", 
      "properties": {
        "id": {
          "required": true, 
          "type": "string", 
          "description": "The name of the new policy"
        }
      }
    }
  ]
}
