Resource URL: /platform/<<version=4>>/performance/workload-categories

    Overview: This resource represents a collection of "workload categories". A
              workload category is a set of "elements" for which performance
              statistics will be collected.  These elements are aspects of the
              system whose performance you might be interested in, like
              "username" or "protocol".  The list of available elements can be
              found at the /performance/category-elements URI.  Creating a new
              workload category will cause new sets of statistics about the
              elements you specify to start being collected.  For example, when
              you create a workload category with elements "username" and
              "protocol", OneFS will start collecting statistics associated
              with all username/protocol combinations  .Statistics about the
              top resuorce-consuming element combinations for a given category
              are available at the URI
              /statistics/current?key=node.accounting.workloads.category.<category-id>.
              How many top-level combinations will be tracked independently can
              be configured with the "top_n_collection_count" setting at the
              /performance/settings URI.  In addition to tracking the top
              element combinations, you can create individual "workloads" to
              select specific instances of the elements you are particularly
              interested in, whether or not they are among the top resource
              consuming combinations.  See the
              /performance/workload-categories/<WORKLOAD-CATEGORY>/workloads
              URI for details.

     Methods: GET, POST

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

Method GET: List all workload categories.

       URL: GET /platform/<<version=4>>/performance/workload-categories

Query arguments:
  sort=<string> The field that will be used for sorting.
limit=<integer> Return no more than this many results at once (see resume).
     dir=<enum> Where <enum> is one of ASC, DESC.  The direction of the sort.
resume=<string> Continue returning results from previous call using this token
                (token should come from the previous call, resume cannot be
                used with other options).

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
        }, 
        "workload_categories": {
          "minItems": 0, 
          "items": {
            "type": "object", 
            "description": "A workload category can be configured to track different sets of workloads.", 
            "properties": {
              "category_elements": {
                "items": {
                  "enum": [
                    "zone_name", 
                    "protocol", 
                    "username", 
                    "local_address", 
                    "remote_address", 
                    "job_type", 
                    "system_name"
                  ], 
                  "type": "string", 
                  "description": "Elements that are used to define a workload category. This list includes elements reserved for the default system workload category."
                }, 
                "type": "array", 
                "description": "The category elements defining the workload category."
              }, 
              "creation_time": {
                "type": "integer", 
                "description": "Timestamp of when the workload category was created."
              }, 
              "statkey": {
                "type": "string", 
                "description": "Key for use in viewing associated raw statistics under the endpoints platform/1/statistics/history and platform/1/statistics/current."
              }, 
              "workload_count": {
                "type": "integer", 
                "description": "A count of the resource allocation tokens for this workload."
              }, 
              "id": {
                "type": "integer", 
                "description": "Identifies the configured workload category."
              }, 
              "name": {
                "type": "string", 
                "description": "The name of the workload category. If a name is not specified, then a default name is assigned. The default name will be an underscore separated list of the category elements.", 
                "maxLength": 80
              }
            }
          }, 
          "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 workload category.

        URL: POST /platform/<<version=4>>/performance/workload-categories

There are no query arguments for this method.

Required POST request body fields:
category_elements

POST request body schema:
{
  "type": "object", 
  "description": "A workload category can be configured to track different sets of workloads.", 
  "properties": {
    "category_elements": {
      "items": {
        "enum": [
          "zone_name", 
          "protocol", 
          "username", 
          "local_address", 
          "remote_address"
        ], 
        "type": "string", 
        "description": "Elements that can be used to configure a workload category."
      }, 
      "required": true, 
      "type": "array", 
      "description": "Category elements available for configuration of a workload category."
    }, 
    "name": {
      "type": "string", 
      "description": "The name of the workload category. If a name is not specified, then a default name is assigned. The default name will be an underscore separated list of the category elements.", 
      "maxLength": 80
    }
  }
}

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": {
        "stats_summary_uri": {
          "type": "string", 
          "description": "URI used to view associated summary statistics."
        }, 
        "statkey": {
          "type": "string", 
          "description": "Key for use in viewing associated raw statistics under the endpoints platform/1/statistics/history and platform/1/statistics/current."
        }, 
        "id": {
          "required": true, 
          "minimum": 0, 
          "type": "integer", 
          "description": "ID of created item that can be used to refer to item in the collection-item resource path.", 
          "maximum": 18446744073709551615
        }
      }
    }
  ]
}
