<commit_before>..
    Copyright 2015 Hewlett-Packard Development Company, L.P.

    Licensed under the Apache License, Version 2.0 (the "License"); you may
    not use this file except in compliance with the License. You may obtain
    a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
    License for the specific language governing permissions and limitations
    under the License.


========
Clusters
========

A Cluster is a representation of a collection of message broker nodes with
respective endpoints (e.g. RabbitMQ Cluster).


Create Cluster
==============

.. http:post:: /clusters

  Create a new Cluster.

  **Example request**:

  .. code-block:: http

     POST /clusters HTTP/1.1
     Host: example.com
     Accept: application/json
     Content-Type: application/json

     {
        "name": "Example Cluster",
        "size": 3,
        "flavor": "101",
        "volume_size": "1048576"
        "network_id": [
            "ea540512-4d4a-4c46-9ebd-4fafe4a54a2d"
        ]
     }


  **Example response**:

  .. code-block:: http

    HTTP/1.1 201 Created
    Location: http://127.0.0.1:8795/v1/clusters/2c3c66ba-721b-4443-bc81-55d986848c68
    Content-Type: application/json; charset=UTF-8

    {
        "status": "BUILDING",
        "name": "Example Cluster",
        "network_id": [
            "ea540512-4d4a-4c46-9ebd-4fafe4a54a2d"
        ],
        "created_at": "2015-06-03T21:49:49+00:00",
        "volume_size": 1048576,
        "endpoints": [],
        "flavor": "101",
        "id": "2c3c66ba-721b-4443-bc81-55d986848c68",
        "size": 3
    }

  :form status: status of the cluster
  :form name: name of the cluster
  :form network_id: a list of UUID of network id's
  :form created_at: create cluster request received timestamp
  :form volume_size: volume size used for each node
  :form endpoints: list of endpoints for each node
  :form flavor: node flavor
  :form id: the UUID of the cluster
  :form size: size of the cluster

  :statuscode 201: Created
  :statuscode 400: Bad Request
  :statuscode 401: Access Denied


Get Cluster
===========

.. http:get:: /clusters/(uuid:id)

  Get a specific Cluster using the Cluster's uuid id.

  **Example request**:
<commit_msg>Adding field for auth_credentials to API doc<commit_after>..
    Copyright 2015 Hewlett-Packard Development Company, L.P.

    Licensed under the Apache License, Version 2.0 (the "License"); you may
    not use this file except in compliance with the License. You may obtain
    a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
    License for the specific language governing permissions and limitations
    under the License.


========
Clusters
========

A Cluster is a representation of a collection of message broker nodes with
respective endpoints (e.g. RabbitMQ Cluster).


Create Cluster
==============

.. http:post:: /clusters

  Create a new Cluster.

  **Example request**:

  .. code-block:: http

     POST /clusters HTTP/1.1
     Host: example.com
     Accept: application/json
     Content-Type: application/json

     {
        "name": "Example Cluster",
        "size": 3,
        "flavor": "101",
        "volume_size": "1048576"
        "network_id": [
            "ea540512-4d4a-4c46-9ebd-4fafe4a54a2d"
        ]
        "auth_credential": {
            "type": "PLAIN",
            "token": {
                "username": "rabbit_user"
                "password": "<PASSWORD>"
            }
        }
     }


  **Example response**:

  .. code-block:: http

    HTTP/1.1 201 Created
    Location: http://127.0.0.1:8795/v1/clusters/2c3c66ba-721b-4443-bc81-55d986848c68
    Content-Type: application/json; charset=UTF-8

    {
        "status": "BUILDING",
        "name": "Example Cluster",
        "network_id": [
            "ea540512-4d4a-4c46-9ebd-4fafe4a54a2d"
        ],
        "created_at": "2015-06-03T21:49:49+00:00",
        "volume_size": 1048576,
        "endpoints": [],
        "flavor": "101",
        "id": "2c3c66ba-721b-4443-bc81-55d986848c68",
        "size": 3
    }

  :form status: status of the cluster
  :form name: name of the cluster
  :form network_id: a list of UUID of network id's
  :form created_at: create cluster request received timestamp
  :form volume_size: volume size used for each node
  :form endpoints: list of endpoints for each node
  :form flavor: node flavor
  :form id: the UUID of the cluster
  :form size: size of the cluster
  :form auth_credential: Authentication credentials

  :statuscode 201: Created
  :statuscode 400: Bad Request
  :statuscode 401: Access Denied


Get Cluster
===========

.. http:get:: /clusters/(uuid:id)

  Get a specific Cluster using the Cluster's uuid id.

  **Example request**:

{'fraction_non_alphanumeric': 0.1142527409117138, 'fraction_numerical': 0.06001154068090017, 'mean_word_length': 2.674911660777385, 'pattern_counts': {'":': 33, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5693432', 'n_tokens_mistral': 1817, 'n_tokens_neox': 1582, 'n_words': 524}