summaryrefslogtreecommitdiff
path: root/troveclient/v1/management.py
diff options
context:
space:
mode:
Diffstat (limited to 'troveclient/v1/management.py')
-rw-r--r--troveclient/v1/management.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/troveclient/v1/management.py b/troveclient/v1/management.py
index 38923ad..478d086 100644
--- a/troveclient/v1/management.py
+++ b/troveclient/v1/management.py
@@ -21,6 +21,7 @@ from troveclient import common
from troveclient.v1 import clusters
from troveclient.v1 import configurations
from troveclient.v1 import datastores
+from troveclient.v1 import flavors
from troveclient.v1 import instances
@@ -149,6 +150,44 @@ class MgmtClusters(base.ManagerWithFind):
self._action(cluster_id, body)
+class MgmtFlavors(base.ManagerWithFind):
+ """Manage :class:`Flavor` resources."""
+ resource_class = flavors.Flavor
+
+ def __repr__(self):
+ return "<Flavors Manager at %s>" % id(self)
+
+ # Appease the abc gods
+ def list(self):
+ pass
+
+ def create(self, name, ram, disk, vcpus,
+ flavorid="auto", ephemeral=None, swap=None, rxtx_factor=None,
+ service_type=None):
+ """Create a new flavor."""
+ body = {"flavor": {
+ "flavor_id": flavorid,
+ "name": name,
+ "ram": ram,
+ "disk": disk,
+ "vcpu": vcpus,
+ "ephemeral": 0,
+ "swap": 0,
+ "rxtx_factor": "1.0",
+ "is_public": "True"
+ }}
+ if ephemeral:
+ body["flavor"]["ephemeral"] = ephemeral
+ if swap:
+ body["flavor"]["swap"] = swap
+ if rxtx_factor:
+ body["flavor"]["rxtx_factor"] = rxtx_factor
+ if service_type:
+ body["flavor"]["service_type"] = service_type
+
+ return self._create("/mgmt/flavors", body, "flavor")
+
+
class MgmtConfigurationParameters(configurations.ConfigurationParameters):
def create(self, version, name, restart_required, data_type,
max_size=None, min_size=None):