Merge "Add api-ref urls for some volume v2 APIs"

This commit is contained in:
Jenkins 2017-06-26 09:07:51 +00:00 committed by Gerrit Code Review
commit 9ef109d999
4 changed files with 45 additions and 12 deletions

View File

@ -50,9 +50,9 @@ class EncryptionTypesClient(rest_client.RestClient):
def create_encryption_type(self, volume_type_id, **kwargs):
"""Create encryption type.
TODO: Current api-site doesn't contain this API description.
After fixing the api-site, we need to fix here also for putting
the link to api-site.
For a full list of available parameters, please refer to the official
API reference:
https://developer.openstack.org/api-ref/block-storage/v2/#create-an-encryption-type-for-v2
"""
url = "/types/%s/encryption" % volume_type_id
post_body = json.dumps({'encryption': kwargs})
@ -71,9 +71,9 @@ class EncryptionTypesClient(rest_client.RestClient):
def update_encryption_type(self, volume_type_id, **kwargs):
"""Update an encryption type for an existing volume type.
TODO: Current api-site doesn't contain this API description.
After fixing the api-site, we need to fix here also for putting
the link to api-site.
For a full list of available parameters, please refer to the official
API reference:
https://developer.openstack.org/api-ref/block-storage/v2/#update-an-encryption-type-for-v2
"""
url = "/types/%s/encryption/provider" % volume_type_id
put_body = json.dumps({'encryption': kwargs})

View File

@ -24,8 +24,12 @@ class HostsClient(rest_client.RestClient):
api_version = "v2"
def list_hosts(self, **params):
"""Lists all hosts."""
"""Lists all hosts.
For a full list of available parameters, please refer to the official
API reference:
https://developer.openstack.org/api-ref/block-storage/v2/#list-all-hosts
"""
url = 'os-hosts'
if params:
url += '?%s' % urllib.urlencode(params)

View File

@ -124,7 +124,12 @@ class SnapshotsClient(rest_client.RestClient):
return rest_client.ResponseBody(resp, body)
def create_snapshot_metadata(self, snapshot_id, metadata):
"""Create metadata for the snapshot."""
"""Create metadata for the snapshot.
For a full list of available parameters, please refer to the official
API reference:
http://developer.openstack.org/api-ref/block-storage/v2/#create-snapshot-metadata
"""
put_body = json.dumps({'metadata': metadata})
url = "snapshots/%s/metadata" % snapshot_id
resp, body = self.post(url, put_body)

View File

@ -72,6 +72,10 @@ class VolumesClient(rest_client.RestClient):
"""List all the volumes created.
Params can be a string (must be urlencoded) or a dictionary.
For a full list of available parameters, please refer to the official
API reference:
http://developer.openstack.org/api-ref/block-storage/v2/#list-volumes-with-details
http://developer.openstack.org/api-ref/block-storage/v2/#list-volumes
"""
url = 'volumes'
if detail:
@ -155,7 +159,12 @@ class VolumesClient(rest_client.RestClient):
return rest_client.ResponseBody(resp, body)
def set_bootable_volume(self, volume_id, **kwargs):
"""set a bootable flag for a volume - true or false."""
"""Set a bootable flag for a volume - true or false.
For a full list of available parameters, please refer to the official
API reference:
http://developer.openstack.org/api-ref/block-storage/v2/#update-volume-bootable-status
"""
post_body = json.dumps({'os-set_bootable': kwargs})
url = 'volumes/%s/action' % (volume_id)
resp, body = self.post(url, post_body)
@ -239,7 +248,12 @@ class VolumesClient(rest_client.RestClient):
return rest_client.ResponseBody(resp, body)
def create_volume_metadata(self, volume_id, metadata):
"""Create metadata for the volume."""
"""Create metadata for the volume.
For a full list of available parameters, please refer to the official
API reference:
http://developer.openstack.org/api-ref/block-storage/v2/#create-volume-metadata
"""
put_body = json.dumps({'metadata': metadata})
url = "volumes/%s/metadata" % volume_id
resp, body = self.post(url, put_body)
@ -256,7 +270,12 @@ class VolumesClient(rest_client.RestClient):
return rest_client.ResponseBody(resp, body)
def update_volume_metadata(self, volume_id, metadata):
"""Update metadata for the volume."""
"""Update metadata for the volume.
For a full list of available parameters, please refer to the official
API reference:
http://developer.openstack.org/api-ref/block-storage/v2/#update-volume-metadata
"""
put_body = json.dumps({'metadata': metadata})
url = "volumes/%s/metadata" % volume_id
resp, body = self.put(url, put_body)
@ -281,7 +300,12 @@ class VolumesClient(rest_client.RestClient):
return rest_client.ResponseBody(resp, body)
def retype_volume(self, volume_id, **kwargs):
"""Updates volume with new volume type."""
"""Updates volume with new volume type.
For a full list of available parameters, please refer to the official
API reference:
https://developer.openstack.org/api-ref/block-storage/v2/#retype-volume
"""
post_body = json.dumps({'os-retype': kwargs})
resp, body = self.post('volumes/%s/action' % volume_id, post_body)
self.expected_success(202, resp.status)