From 0062d68ae721664ff6a272d06c74d2007acb5c47 Mon Sep 17 00:00:00 2001 From: Brian Curtin Date: Mon, 6 Jul 2015 11:17:19 -0500 Subject: [PATCH] Add docstrings for Metric resources This also adds a file to get metric.v1.resource included Change-Id: I37673c6ce0d2a57e30f52d916a0d75804cefedf8 --- doc/source/users/resources/metric/index.rst | 1 + doc/source/users/resources/metric/v1/resource.rst | 12 ++++++++++++ openstack/metric/v1/archive_policy.py | 4 ++++ openstack/metric/v1/metric.py | 6 ++++++ openstack/metric/v1/resource.py | 8 ++++++++ 5 files changed, 31 insertions(+) create mode 100644 doc/source/users/resources/metric/v1/resource.rst diff --git a/doc/source/users/resources/metric/index.rst b/doc/source/users/resources/metric/index.rst index 9329ec36..1bfa667d 100644 --- a/doc/source/users/resources/metric/index.rst +++ b/doc/source/users/resources/metric/index.rst @@ -7,3 +7,4 @@ Metric Resources v1/archive_policy v1/capabilities v1/metric + v1/resource diff --git a/doc/source/users/resources/metric/v1/resource.rst b/doc/source/users/resources/metric/v1/resource.rst new file mode 100644 index 00000000..748fb47c --- /dev/null +++ b/doc/source/users/resources/metric/v1/resource.rst @@ -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: diff --git a/openstack/metric/v1/archive_policy.py b/openstack/metric/v1/archive_policy.py index 0b684aae..df252460 100644 --- a/openstack/metric/v1/archive_policy.py +++ b/openstack/metric/v1/archive_policy.py @@ -27,7 +27,11 @@ class ArchivePolicy(resource.Resource): id_attribute = "name" # Properties + #: The name of this policy name = resource.prop('name') + #: The definition of this policy 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') + #: A list of the aggregation methods supported aggregation_methods = resource.prop("aggregation_methods", type=list) diff --git a/openstack/metric/v1/metric.py b/openstack/metric/v1/metric.py index 3efa72d9..3fb095ee 100644 --- a/openstack/metric/v1/metric.py +++ b/openstack/metric/v1/metric.py @@ -25,9 +25,15 @@ class Metric(resource.Resource): allow_list = True # Properties + #: The name of the archive policy archive_policy_name = resource.prop('archive_policy_name') + #: The 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') + #: The ID of the project this metric was created under created_by_project_id = resource.prop('created_by_project_id') + #: The identifier of this metric resource_id = resource.prop('resource_id') + #: The name of this metric name = resource.prop('name') diff --git a/openstack/metric/v1/resource.py b/openstack/metric/v1/resource.py index 6d29aee3..baf858f6 100644 --- a/openstack/metric/v1/resource.py +++ b/openstack/metric/v1/resource.py @@ -26,15 +26,23 @@ class Generic(resource.Resource): allow_update = True # Properties + #: The identifier of this resource 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') + #: The ID of the project this resource was created under created_by_project_id = resource.prop('created_by_project_id') + #: The ID of the user user_id = resource.prop('user_id') + #: The ID of the project project_id = resource.prop('project_id') + #: Timestamp when this resource was started started_at = resource.prop('started_at', type=resource_types.ISO8601Datetime) + #: Timestamp when this resource was ended ended_at = resource.prop('ended_at', type=resource_types.ISO8601Datetime) + #: A dictionary of metrics collected on this resource metrics = resource.prop('metrics', type=dict) def create(self, session):