Basic resource.prop for ID attributes (telemetry)

This patch set updates all telemetry resource objects to use basic
properties for ID attributes. In particular, the following changes
were made:
  - Use basic *_id resource.prop for ID attributes
  - Clarify documentation for ID attributes

Change-Id: I8d78e5bd7aa94667501e0037ee84a1fea4d2c62a
Partial-Bug: #1461200
This commit is contained in:
Richard Theis
2016-02-10 14:48:10 -06:00
parent 545ff5bd8e
commit 7c9e4c3acc
6 changed files with 18 additions and 18 deletions

View File

@@ -31,7 +31,7 @@ class Alarm(resource.Resource):
# Properties
#: The actions to do when alarm state changes to alarm
alarm_actions = resource.prop('alarm_actions')
#: The UUID of the alarm
#: The ID of the alarm
alarm_id = resource.prop('alarm_id')
# TODO(briancurtin): undocumented
combination_rule = resource.prop('combination_rule')
@@ -45,7 +45,7 @@ class Alarm(resource.Resource):
name = resource.prop('name')
#: The actions to do when alarm state change to ok
ok_actions = resource.prop('ok_actions')
#: The ID of the project or tenant that owns the alarm
#: The ID of the project that owns the alarm
project_id = resource.prop('project_id')
#: The actions should be re-triggered on each evaluation cycle
repeat_actions = resource.prop('repeat_actions', type=bool)

View File

@@ -25,14 +25,14 @@ class AlarmChange(resource.Resource):
allow_list = True
# Properties
#: The UUID of the alarm
#: The ID of the alarm
alarm_id = resource.prop('alarm_id')
#: Data describing the change
detail = resource.prop('detail')
#: The UUID of the change event
#: The ID of the change event
event_id = resource.prop('event_id')
#: The tenant on behalf of which the change is being made
on_behalf_of = resource.prop('on_behalf_of')
#: The project ID on behalf of which the change is being made
on_behalf_of_id = resource.prop('on_behalf_of')
#: The project ID of the initiating identity
project_id = resource.prop('project_id')
#: The time/date of the alarm change

View File

@@ -25,15 +25,15 @@ class Meter(resource.Resource):
allow_list = True
# Properties
#: The unique identifier for the meter
#: The ID of the meter
meter_id = resource.prop('meter_id')
#: The unique name for the meter
name = resource.prop('name')
#: The ID of the project or tenant that owns the resource
#: The ID of the project that owns the resource
project_id = resource.prop('project_id')
#: The ID of the resource for which the measurements are taken
resource_id = resource.prop('resource_id')
#: The ID of the source that identifies where the meter comes from
#: The name of the source where the meter comes from
source = resource.prop('source')
#: The meter type
type = resource.prop('type')

View File

@@ -33,11 +33,11 @@ class Resource(resource.Resource):
links = resource.prop('links')
#: Arbitrary metadata associated with the resource
metadata = resource.prop('metadata')
#: The ID of the owning project or tenant
#: The ID of the owning project
project_id = resource.prop('project_id')
#: The unique identifier for the resource
#: The ID for the resource
resource_id = resource.prop('resource_id')
#: The source where the resource comes from
#: The name of the source where the resource comes from
source = resource.prop('source')
#: The ID of the user who created the resource or updated it last
user_id = resource.prop('user_id')

View File

@@ -28,13 +28,13 @@ class Sample(resource.Resource):
metadata = resource.prop('metadata', alias='resource_metadata')
#: The meter name this sample is for
counter_name = resource.prop('meter', alias='counter_name')
#: The project this sample was taken for
#: The ID of the project this sample was taken for
project_id = resource.prop('project_id')
#: When the sample has been recorded
recorded_at = resource.prop('recorded_at')
#: The Resource this sample was taken for
#: The ID of the resource this sample was taken for
resource_id = resource.prop('resource_id')
#: The source that identifies where the sample comes from
#: The name of the source that identifies where the sample comes from
source = resource.prop('source')
#: When the sample has been generated
generated_at = resource.prop('timestamp')
@@ -42,7 +42,7 @@ class Sample(resource.Resource):
type = resource.prop('type', alias='counter_type')
#: The unit of measure
unit = resource.prop('unit', alias='counter_unit')
#: The user this sample was taken for
#: The ID of the user this sample was taken for
user_id = resource.prop('user_id')
#: The metered value
volume = resource.prop('volume', alias='counter_volume')

View File

@@ -48,7 +48,7 @@ class TestAlarmChange(testtools.TestCase):
self.assertEqual(EXAMPLE['alarm_id'], sot.alarm_id)
self.assertEqual(EXAMPLE['detail'], sot.detail)
self.assertEqual(IDENTIFIER, sot.event_id)
self.assertEqual(EXAMPLE['on_behalf_of'], sot.on_behalf_of)
self.assertEqual(EXAMPLE['on_behalf_of'], sot.on_behalf_of_id)
self.assertEqual(EXAMPLE['project_id'], sot.project_id)
self.assertEqual(EXAMPLE['timestamp'], sot.triggered_at)
self.assertEqual(EXAMPLE['type'], sot.type)
@@ -67,7 +67,7 @@ class TestAlarmChange(testtools.TestCase):
self.assertEqual(EXAMPLE['alarm_id'], first.alarm_id)
self.assertEqual(EXAMPLE['detail'], first.detail)
self.assertEqual(IDENTIFIER, first.event_id)
self.assertEqual(EXAMPLE['on_behalf_of'], first.on_behalf_of)
self.assertEqual(EXAMPLE['on_behalf_of'], first.on_behalf_of_id)
self.assertEqual(EXAMPLE['project_id'], first.project_id)
self.assertEqual(EXAMPLE['timestamp'], first.triggered_at)
self.assertEqual(EXAMPLE['type'], first.type)