Skip to content

Commit 235474f

Browse files
author
Brian Curtin
committed
Add docstrings for database resources
Closes-Bug: 1472781 Change-Id: I61f164c2d3c3765bafff67517709905050b6aa07
1 parent f276c84 commit 235474f

4 files changed

Lines changed: 41 additions & 0 deletions

File tree

openstack/database/v1/database.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ class Database(resource.Resource):
2727
allow_list = True
2828

2929
# Properties
30+
#: Set of symbols and encodings. The default character set is ``utf8``.
3031
character_set = resource.prop('character_set')
32+
#: Set of rules for comparing characters in a character set.
33+
#: The default value for collate is ``utf8_general_ci``.
3134
collate = resource.prop('collate')
35+
#: The ID of the instance
3236
instance_id = resource.prop('instance_id')
37+
#: The name of the database
3338
name = resource.prop('name')

openstack/database/v1/flavor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ class Flavor(resource.Resource):
2525
allow_retrieve = True
2626

2727
# Properties
28+
#: Links associated with the flavor
2829
links = resource.prop('links')
30+
#: The name of the flavor
2931
name = resource.prop('name')
32+
#: The size in MB of RAM the flavor has
3033
ram = resource.prop('ram')

openstack/database/v1/instance.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,63 @@ class Instance(resource.Resource):
2929
allow_list = True
3030

3131
# Properties
32+
#: The flavor of the instance
3233
flavor = resource.prop('flavor')
34+
#: Links associated with the instance
3335
links = resource.prop('links')
36+
#: The name of the instance
3437
name = resource.prop('name')
38+
#: The status of the instance
3539
status = resource.prop('status')
40+
#: The size of the volume
3641
volume = resource.prop('volume')
3742

3843
def enable_root_user(self, session):
44+
"""Enable login for the root user
45+
46+
This operation enables login from any host for the root user
47+
and provides the user with a generated root password.
48+
49+
:returns: A dictionary with keys ``name`` and ``password`` specifying
50+
the login credentials.
51+
"""
3952
url = utils.urljoin(self.base_path, self.id, 'root')
4053
resp = session.post(url, service=self.service).body
4154
return resp['user']
4255

4356
def is_root_enabled(self, session):
57+
"""Determine if root is enabled on an instance
58+
59+
:returns: ``True`` if root user is enabled for a specified database
60+
instance or ``False`` otherwise.
61+
"""
4462
url = utils.urljoin(self.base_path, self.id, 'root')
4563
resp = session.get(url, service=self.service).body
4664
return resp['rootEnabled']
4765

4866
def restart(self, session):
67+
"""Restart the database instance
68+
69+
:returns: ``None``
70+
"""
4971
body = {'restart': {}}
5072
url = utils.urljoin(self.base_path, self.id, 'action')
5173
session.post(url, service=self.service, json=body)
5274

5375
def resize(self, session, flavor_reference):
76+
"""Resize the database instance
77+
78+
:returns: ``None``
79+
"""
5480
body = {'resize': {'flavorRef': flavor_reference}}
5581
url = utils.urljoin(self.base_path, self.id, 'action')
5682
session.post(url, service=self.service, json=body)
5783

5884
def resize_volume(self, session, volume_size):
85+
"""Resize the volume attached to the instance
86+
87+
:returns: ``None``
88+
"""
5989
body = {'resize': {'volume': volume_size}}
6090
url = utils.urljoin(self.base_path, self.id, 'action')
6191
session.post(url, service=self.service, json=body)

openstack/database/v1/user.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ class User(resource.Resource):
3030
instance_id = resource.prop('instance_id')
3131

3232
# Properties
33+
#: Databases the user has access to
3334
databases = resource.prop('databases')
35+
#: The name of the user
3436
name = resource.prop('name')
37+
#: The password of the user
3538
password = resource.prop('password')
3639

3740
@classmethod

0 commit comments

Comments
 (0)