@@ -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 )
0 commit comments