~cue-drivers/python-cueclient/master

« back to all changes in this revision

Viewing changes to cueclient/v1/clusters.py

  • Committer: Andreas Jaeger
  • Date: 2018-03-09 08:39:43 UTC
  • Revision ID: git-v1:64dbf807aeca473f607602aa395df8519d7274cf
Retire cue

Cue has been retired in mid 2016 as official project and did not
continue developement, it's time to retire it completely.

Remove everything, update README.

Depends-On: https://review.openstack.org/551202
Change-Id: I4092bb5feac88235eae52895a57ce3d01f347638

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2014 Hewlett-Packard Development Company, L.P.
2
 
#
3
 
# Author: Endre Karlson <endre.karlson@hp.com>
4
 
#
5
 
# Licensed under the Apache License, Version 2.0 (the "License"); you may
6
 
# not use this file except in compliance with the License. You may obtain
7
 
# a copy of the License at
8
 
#
9
 
#      http://www.apache.org/licenses/LICENSE-2.0
10
 
#
11
 
# Unless required by applicable law or agreed to in writing, software
12
 
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
 
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
 
# License for the specific language governing permissions and limitations
15
 
# under the License.
16
 
from cueclient import controller
17
 
from cueclient import utils
18
 
from cueclient import warlock
19
 
 
20
 
Cluster = warlock.model_factory(utils.load_schema('v1', 'cluster'))
21
 
 
22
 
 
23
 
class ClusterController(controller.Controller):
24
 
    """Cluster Controller to manages operations."""
25
 
    def create(self, name, nic, flavor, size, volume_size, auth_type, username,
26
 
               password):
27
 
        """Create Cluster"""
28
 
        auth = {'type': auth_type,
29
 
                'token': {'username': username,
30
 
                          'password': password}}
31
 
 
32
 
        data = {
33
 
            "network_id": nic.split(","),
34
 
            "name": name,
35
 
            "flavor": flavor,
36
 
            "size": size,
37
 
            "volume_size": volume_size,
38
 
            "authentication": auth,
39
 
        }
40
 
        url = self.build_url("/clusters")
41
 
 
42
 
        return Cluster(self._post(url, json=data))
43
 
 
44
 
    def list(self, marker=None, limit=None, params=None):
45
 
        """List Clusters"""
46
 
        url = self.build_url("/clusters", marker, limit, params)
47
 
 
48
 
        response = self._get(url, "clusters")
49
 
        return [Cluster(i) for i in response]
50
 
 
51
 
    def get(self, cluster_id):
52
 
        """Show Cluster"""
53
 
        url = self.build_url("/clusters/%s" % cluster_id)
54
 
 
55
 
        return Cluster(self._get(url))
56
 
 
57
 
    def update(self, cluster_id, values):
58
 
        data = {
59
 
            "cluster": values
60
 
        }
61
 
 
62
 
        url = self.build_url("/clusters/%s" % cluster_id)
63
 
 
64
 
        return self._patch(url, data=data)
65
 
 
66
 
    def delete(self, cluster_id):
67
 
        """Delete Cluster"""
68
 
        url = self.build_url("/clusters/%s" % cluster_id)
69
 
 
70
 
        return self._delete(url)