.. _lcm-cluster: Cluster ======= The cluster model is the parent (owner) of all other objects related to a DSE cluster, whether the cluster physically exists yet or not. In order to be valid for installation and/or configuration, the cluster must have the following: * A reference to :ref:`lcm-repository`. * A reference to :ref:`lcm-machine-credential`. * A reference to :ref:`lcm-config-profile`. .. container:: api-toc ============================ ==================================== :ref:`managing-clusters` URL ============================ ==================================== Get a cluster object by ID :http:method:`get-cluster-object` Get a list of clusters :http:method:`get-cluster-list` Create a cluster :http:method:`post-cluster-object` Update a cluster :http:method:`put-cluster-object` Delete a cluster :http:method:`delete-repository-object` ============================ ==================================== .. _managing-clusters: Managing Clusters ----------------- .. http:response:: Cluster :noindex: .. code-block:: js { "id" : , "name" : , "comment" : , "repository-id" : , "machine-credential-id" : , "config-profile-id" : , "ssh-management-port" : , "managed" : , "opsc-cluster-id" : , "last-job-id" : , "job-status" : , "has-default-password" : } ============================== ========================================= Property Description of Values ============================== ========================================= id A UUID for the Cluster. name The name of the Cassandra cluster. The normal rules for value Cassandra cluster names apply. ssh-management-port SSH port on managed nodes. This defaults to 22 and can be overridden at the :ref:`lcm-datacenter` and/or :ref:`lcm-node` level. config-profile-id The ID of the :ref:`lcm-config-profile` to use for this cluster. Can be overridden at the :ref:`lcm-datacenter` and/or :ref:`lcm-node` level. machine-credential-id The ID of the :ref:`lcm-machine-credential` to use for this cluster. Can be overridden at the :ref:`lcm-datacenter` and/or :ref:`lcm-node` level. repository-id The ID of the :ref:`lcm-repository` to use for this cluster. managed Does LCM manage this cluster and configuration file - should always be set to true. This is used by OpsCenter to support agent installation through LCM without using LCM for DSE installation or configuration. last-job-id The ID of the last job run on this cluster. See :ref:`lcm-jobs`. opsc-cluster-id A unique ID to link LCM's cluster model with OpsCenter's. This is read-only for API consumers, and is set internally at the tail end of the first install job. comment A generic field for user comments. ============================== ========================================= .. http:method:: GET /api/v1/lcm/clusters/{id} :label-name: get-cluster-object :title: GET /api/v1/lcm/clusters/{id} Get a specific cluster record by ID. :arg id: A :http:response:`cluster` ID. Returns a :http:response:`cluster` object. **Example**: .. code-block:: bash curl http://localhost:8888/api/v1/lcm/clusters/108f74ab-0c5c-4bf7-8527-695e3e630e1a Output: .. code-block:: js { "id" : "108f74ab-0c5c-4bf7-8527-695e3e630e1a", "name" : "test-cluster-01", "comment" : null, "repository-id" : "7db37bd2-c23a-4ea6-a415-e9faaeb2060f", "machine-credential-id" : "0f03dff7-1874-4c17-a823-ff79dba6e694", "config-profile-id" : "4ff7a9ae-257c-4a6c-bfb0-b47299f39795", "ssh-management-port" : 22 "managed" : true, "opsc-cluster-id" : null, "last-job-id" : null, "modified-on" : "2016-06-21T14:33:11.859Z", "type" : "cluster", "job-status" : null, "datacenter" : [], "created-on" : "2016-06-21T14:33:11.859Z", "created-by" : "system", "modified-by" : "system", "has-default-password" : true, "href" : "http://localhost:8888/api/v1/lcm/clusters/108f74ab-0c5c-4bf7-8527-695e3e630e1a", "related-resources" : { "datacenters" : "http://localhost:8888/api/v1/lcm/clusters/108f74ab-0c5c-4bf7-8527-695e3e630e1a/datacenters/" }, } .. http:method:: GET /api/v1/lcm/clusters/ :label-name: get-cluster-list :title: GET /api/v1/lcm/clusters/ Gets a paginated list of all :http:response:`cluster` records. See :ref:`lcm-pagination` for an overview of the query string parameters that can be used. **Example**: .. code-block:: bash curl http://localhost:8888/api/v1/lcm/clusters/ Output: .. code-block:: js { "last" : 1, "per-page" : 50, "previous" : null, "next" : null, "current" : 1, "count": 1, "results": [ { "type" : "cluster", "has-default-password" : true, "opsc-cluster-id" : null, "id" : "591ae107-2ef8-4c0f-b603-3b9f2d722d2f", "href" : "http://localhost:8888/api/v1/lcm/clusters/591ae107-2ef8-4c0f-b603-3b9f2d722d2f", "config-profile-id" : "4ff7a9ae-257c-4a6c-bfb0-b47299f39795", "managed" : true, "ssh-management-port" : 22, "job-status" : "COMPLETE", "modified-on" : "2016-06-06T17:12:00.738Z", "created-on" : "2016-06-02T14:33:59.700Z", "last-job-id" : "0370f668-3f53-478f-b29e-78d6bcc778d6", "related-resources" : { "datacenters" : "http://localhost:8888/api/v1/lcm/clusters/591ae107-2ef8-4c0f-b603-3b9f2d722d2f/datacenters/" } } ] } .. http:method:: POST /api/v1/lcm/clusters/ :label-name: post-cluster-object :title: POST /api/v1/lcm/clusters/ Create a new cluster record. :body: A :http:response:`cluster` object (with no ID property). Returns the newly created :http:response:`cluster` object. **Example**: .. code-block:: bash curl -X POST \ -d '{"name": "test-cluster-01", \ "machine-credential-id": "0f03dff7-1874-4c17-a823-ff79dba6e694", \ "repository-id": "7db37bd2-c23a-4ea6-a415-e9faaeb2060f", \ "config-profile-id": "4ff7a9ae-257c-4a6c-bfb0-b47299f39795"}' \ http://localhost:8888/api/v1/lcm/clusters/ Output: .. code-block:: js { "created-by": "system", "created-on": "2016-06-21T14:33:11.859Z", "datacenter": [], "type": "cluster", "has-default-password": true, "job-status": null, "config-profile-id": "4ff7a9ae-257c-4a6c-bfb0-b47299f39795", "modified-by": "system", "opsc-cluster-id": null, "ssh-management-port": 22, "managed": true, "repository-id": "7db37bd2-c23a-4ea6-a415-e9faaeb2060f", "modified-on": "2016-06-21T14:33:11.859Z", "machine-credential-id": "0f03dff7-1874-4c17-a823-ff79dba6e694", "name": "test-cluster-01", "comment": null, "last-job-id": null, "id": "108f74ab-0c5c-4bf7-8527-695e3e630e1a", "href": "http://localhost:8888/api/v1/lcm/clusters/108f74ab-0c5c-4bf7-8527-695e3e630e1a", "related-resources": {"datacenters": "http://localhost:8888/api/v1/lcm/clusters/108f74ab-0c5c-4bf7-8527-695e3e630e1a/datacenters/"} } .. http:method:: PUT /api/v1/lcm/clusters/{id} :label-name: put-cluster-object :title: PUT /api/v1/lcm/clusters/{id} Update an existing cluster record by ID. :arg id: A :http:response:`cluster` ID. Returns the updated :http:response:`cluster` object. **Example**: .. code-block:: bash curl -X PUT -d '{"comment": "This is my new comment."}' http://localhost:8888/api/v1/lcm/clusters/108f74ab-0c5c-4bf7-8527-695e3e630e1a Output: .. code-block:: js { "id": "108f74ab-0c5c-4bf7-8527-695e3e630e1a", "name": "test-cluster-01", "comment": "This is my new comment.", "repository-id": "7db37bd2-c23a-4ea6-a415-e9faaeb2060f", "machine-credential-id": "0f03dff7-1874-4c17-a823-ff79dba6e694", "config-profile-id": "4ff7a9ae-257c-4a6c-bfb0-b47299f39795", "datacenter": [], "type": "cluster", "job-status": null, "related-resources": { "datacenters": "http://localhost:8888/api/v1/lcm/clusters/108f74ab-0c5c-4bf7-8527-695e3e630e1a/datacenters/" }, "modified-by": "system", "created-on": "2016-06-21T14:33:11.859Z", "opsc-cluster-id": null, "ssh-management-port": 22, "managed": true, "modified-on": "2016-06-21T15:10:06.635Z", "last-job-id": null, "href": "http://localhost:8888/api/v1/lcm/clusters/108f74ab-0c5c-4bf7-8527-695e3e630e1a", "has-default-password": true, "created-by": "system" } .. http:method:: DELETE /api/v1/lcm/clusters/{id} :label-name: delete-cluster-object :title: DELETE /api/v1/lcm/clusters/{id} Delete an existing cluster record by ID. This is subject to foreign key constraint violations. :arg id: A :http:response:`cluster` ID. Returns the IDs of the deleted objects. **Example**: .. code-block:: bash curl -X DELETE http://localhost:8888/api/v1/lcm/clusters/108f74ab-0c5c-4bf7-8527-695e3e630e1a Output: .. code-block:: js {"deleted": {"cluster": ["108f74ab-0c5c-4bf7-8527-695e3e630e1a"]}}