diff --git a/doc/source/users/resources/metric/index.rst b/doc/source/users/resources/metric/index.rst index 9329ec36d..1bfa667db 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 000000000..748fb47cf --- /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 0b684aae9..df2524603 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 3efa72d9d..3fb095ee9 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 6d29aee3b..baf858f60 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):