Add docstrings for Metric resources

This also adds a file to get metric.v1.resource included

Change-Id: I37673c6ce0d2a57e30f52d916a0d75804cefedf8
This commit is contained in:
Brian Curtin 2015-07-06 11:17:19 -05:00
parent c1b6b903d5
commit 0062d68ae7
5 changed files with 31 additions and 0 deletions

View File

@ -7,3 +7,4 @@ Metric Resources
v1/archive_policy v1/archive_policy
v1/capabilities v1/capabilities
v1/metric v1/metric
v1/resource

View File

@ -0,0 +1,12 @@
openstack.metric.v1.resource
============================
.. automodule:: openstack.metric.v1.resource
The Generic Class
-----------------
The ``Generic`` class inherits from :class:`~openstack.resource.Resource`.
.. autoclass:: openstack.metric.v1.resource.Generic
:members:

View File

@ -27,7 +27,11 @@ class ArchivePolicy(resource.Resource):
id_attribute = "name" id_attribute = "name"
# Properties # Properties
#: The name of this policy
name = resource.prop('name') name = resource.prop('name')
#: The definition of this policy
definition = resource.prop('definition', type=list) definition = resource.prop('definition', type=list)
#: The window of time older than the period that archives can be requested
back_window = resource.prop('back_window') back_window = resource.prop('back_window')
#: A list of the aggregation methods supported
aggregation_methods = resource.prop("aggregation_methods", type=list) aggregation_methods = resource.prop("aggregation_methods", type=list)

View File

@ -25,9 +25,15 @@ class Metric(resource.Resource):
allow_list = True allow_list = True
# Properties # Properties
#: The name of the archive policy
archive_policy_name = resource.prop('archive_policy_name') archive_policy_name = resource.prop('archive_policy_name')
#: The archive policy
archive_policy = resource.prop('archive_policy') archive_policy = resource.prop('archive_policy')
#: The ID of the user who created this metric
created_by_user_id = resource.prop('created_by_user_id') created_by_user_id = resource.prop('created_by_user_id')
#: The ID of the project this metric was created under
created_by_project_id = resource.prop('created_by_project_id') created_by_project_id = resource.prop('created_by_project_id')
#: The identifier of this metric
resource_id = resource.prop('resource_id') resource_id = resource.prop('resource_id')
#: The name of this metric
name = resource.prop('name') name = resource.prop('name')

View File

@ -26,15 +26,23 @@ class Generic(resource.Resource):
allow_update = True allow_update = True
# Properties # Properties
#: The identifier of this resource
id = resource.prop('id', alias="resource_id") id = resource.prop('id', alias="resource_id")
#: The ID of the user who created this resource
created_by_user_id = resource.prop('created_by_user_id') created_by_user_id = resource.prop('created_by_user_id')
#: The ID of the project this resource was created under
created_by_project_id = resource.prop('created_by_project_id') created_by_project_id = resource.prop('created_by_project_id')
#: The ID of the user
user_id = resource.prop('user_id') user_id = resource.prop('user_id')
#: The ID of the project
project_id = resource.prop('project_id') project_id = resource.prop('project_id')
#: Timestamp when this resource was started
started_at = resource.prop('started_at', started_at = resource.prop('started_at',
type=resource_types.ISO8601Datetime) type=resource_types.ISO8601Datetime)
#: Timestamp when this resource was ended
ended_at = resource.prop('ended_at', ended_at = resource.prop('ended_at',
type=resource_types.ISO8601Datetime) type=resource_types.ISO8601Datetime)
#: A dictionary of metrics collected on this resource
metrics = resource.prop('metrics', type=dict) metrics = resource.prop('metrics', type=dict)
def create(self, session): def create(self, session):