Document compute/v2 resources

This change adds documentation to be picked up by autodoc for resources
under the compute/v2 namespace. LimitsAbsolute isn't in there because
it's part of another change, but doesn't need to be dependent here.

Change-Id: I262bf985de041160d5ceaf7b2b21e3b726c6cf9f
This commit is contained in:
Brian Curtin
2015-01-31 21:52:41 -06:00
parent a08666418f
commit 199153562c
10 changed files with 80 additions and 6 deletions

View File

@@ -24,9 +24,16 @@ class Extension(resource.Resource):
allow_list = True
# Properties
#: A short name by which this extension is also known.
alias = resource.prop('alias')
#: Text describing this extension's purpose.
description = resource.prop('description')
#: Links pertaining to this extension. This is a list of dictionaries,
#: each including keys ``href`` and ``rel``.
links = resource.prop('links')
#: The name of the extension.
name = resource.prop('name')
#: A URL pointing to the namespace for this extension.
namespace = resource.prop('namespace')
# Timestamp when this extension was last updated.
updated = resource.prop('updated')

View File

@@ -28,9 +28,17 @@ class Flavor(resource.Resource):
allow_list = True
# Properties
#: Size of the disk this flavor offers. *Type: int*
disk = resource.prop('disk', type=int)
#: ``True`` if this is a publicly visible flavor. ``False`` if this is
#: a private image. *Type: bool*
is_public = resource.prop('os-flavor-access:is_public', type=bool)
#: Links pertaining to this flavor. This is a list of dictionaries,
#: each including keys ``href`` and ``rel``.
links = resource.prop('links')
#: The name of this flavor.
name = resource.prop('name')
#: The amount of RAM (in MB) this flavor offers. *Type: int*
ram = resource.prop('ram', type=int)
#: The number of virtual CPUs this flavor offers. *Type: int*
vcpus = resource.prop('vcpus', type=int)

View File

@@ -28,12 +28,23 @@ class Image(resource.Resource):
allow_list = True
# Properties
#: Timestamp when the image was created.
created = resource.prop('created')
#: Links pertaining to this image. This is a list of dictionaries,
#: each including keys ``href`` and ``rel``, and optionally ``type``.
links = resource.prop('links')
#: Metadata pertaining to this image. *Type: dict*
metadata = resource.prop('metadata', type=dict)
#: The mimimum disk size. *Type: int*
min_disk = resource.prop('minDisk', type=int)
#: The minimum RAM size. *Type: int*
min_ram = resource.prop('minRam', type=int)
#: The name of this image.
name = resource.prop('name')
#: If this image is still building, its progress is represented here.
#: Once an image is created, progres will be 100. *Type: int*
progress = resource.prop('progress', type=int)
#: The status of this image.
status = resource.prop('status')
#: Timestamp when the image was updated.
updated = resource.prop('updated')

View File

@@ -31,9 +31,14 @@ class Keypair(resource.Resource):
allow_list = True
# Properties
#: The short fingerprint associated with the ``public_key`` for
#: this keypair.
fingerprint = resource.prop('fingerprint')
#: A name identifying the keypair
name = resource.prop('name')
#: The private key for the keypair
private_key = resource.prop('private_key')
#: The SSH public key that is paired with the server.
public_key = resource.prop('public_key')
def __init__(self, attrs=None, loaded=False):

View File

@@ -35,18 +35,47 @@ class Server(resource.Resource):
# Properties
access_ipv4 = resource.prop('accessIPv4')
access_ipv6 = resource.prop('accessIPv6')
#: A dictionary of addresses this server can be accessed through.
#: The dictionary contains keys such as ``private`` and ``public``,
#: each containing a list of dictionaries for addresses of that type.
#: The addresses are contained in a dictionary with keys ``addr``
#: and ``version``, which is either 4 or 6 depending on the protocol
#: of the IP address. *Type: dict*
addresses = resource.prop('addresses', type=dict)
#: Timestamp of when the server was created.
created = resource.prop('created')
flavor = resource.prop('flavorRef', alias='flavor')
#: A dictionary with details on the flavor this server is running.
#: The dictionary includes a key for the ``id`` of the flavor, as well
#: as a ``links`` key, which includes a list of relevant links for this
#: flavor. *Type: dict*
flavor = resource.prop('flavorRef', alias='flavor', type=dict)
#: An ID representing the host of this server.
host_id = resource.prop('hostId')
image = resource.prop('imageRef', alias='image')
#: A dictionary with details on the image this server is running.
#: The dictionary includes a key for ``id`` of the image, as well
#: as a ``links`` key, which includes a list of relevant links for this
#: image. *Type: dict*
image = resource.prop('imageRef', alias='image', type=dict)
#: A list of dictionaries holding links relevant to this server.
links = resource.prop('links')
metadata = resource.prop('metadata')
#: Metadata stored for this server. *Type: dict*
metadata = resource.prop('metadata', type=dict)
#: The name of this server.
name = resource.prop('name')
#: While the server is building, this value represents the percentage
#: of completion. Once it is completed, it will be 100. *Type: int*
progress = resource.prop('progress', type=int)
#: The project this server is associated with.
project_id = resource.prop('tenant_id')
#: The state this server is in. Valid values include ``ACTIVE``,
#: ``BUILDING``, ``DELETED``, ``ERROR``, ``HARD_REBOOT``, ``PASSWORD``,
#: ``PAUSED``, ``REBOOT``, ``REBUILD``, ``RESCUED``, ``RESIZED``,
#: ``REVERT_RESIZE``, ``SHUTOFF``, ``SOFT_DELETED``, ``STOPPED``,
#: ``SUSPENDED``, ``UNKNOWN``, or ``VERIFY_RESIZE``.
status = resource.prop('status')
#: Timestamp of when this server was last updated.
updated = resource.prop('updated')
#: The user ID associated with this server.
user_id = resource.prop('user_id')
def ips(self, session):

View File

@@ -29,9 +29,15 @@ class ServerInterface(resource.Resource):
allow_list = True
# Properties
#: Fixed IP addresses with subnet IDs.
fixed_ips = resource.prop('fixed_ips')
#: The MAC address.
mac_addr = resource.prop('mac_addr')
#: The network ID.
net_id = resource.prop('net_id')
#: The ID of the port for which you want to create an interface.
port_id = resource.prop('port_id')
#: The port state.
port_state = resource.prop('port_state')
#: The UUID for the server.
server_id = resource.prop('server_id')

View File

@@ -27,9 +27,13 @@ class ServerIP(resource.Resource):
allow_list = True
# Properties
#: The IP address. The format of the address depends on :attr:`version`
addr = resource.prop('addr')
#: The network label, such as public or private.
network_label = resource.prop('network_label')
#: The UUID for the server.
server_id = resource.prop('server_id')
# Version of the IP protocol. Currently either 4 or 6.
version = resource.prop('version')
@classmethod

View File

@@ -31,8 +31,11 @@ class ServerMeta(resource.Resource):
allow_list = True
# Properties
#: The metadata key.
key = resource.prop('key')
#: The ID of a server.
server_id = resource.prop('server_id')
#: The metadata value.
value = resource.prop('value')
@classmethod

View File

@@ -26,6 +26,7 @@ class ServerMetadata(resource.Resource):
allow_update = True
# Properties
#: The ID of a server.
server_id = resource.prop('server_id')
@classmethod

View File

@@ -22,12 +22,12 @@ EXAMPLE = {
'accessIPv6': '2',
'addresses': {'region': '3'},
'created': '4',
'flavorRef': 5,
'flavorRef': {'id': 5},
'hostId': '6',
'id': IDENTIFIER,
'imageRef': 8,
'imageRef': {'id': 8},
'links': '9',
'metadata': '10',
'metadata': {'key': '10'},
'name': '11',
'progress': 12,
'tenant_id': '13',