Add support for updated_at field for volume snapshots

Change-Id: Iba4aaa8a0aeec775d2ecfa17ff0ce065c6ffdaea
This commit is contained in:
Christian Rohmann 2022-09-16 17:29:09 +02:00
parent 44089c11d6
commit 8034f84459
6 changed files with 12 additions and 0 deletions

View File

@ -45,6 +45,8 @@ class Snapshot(resource.Resource, metadata.MetadataMixin):
#: The current status of this snapshot. Potential values are creating,
#: available, deleting, error, and error_deleting.
status = resource.Body("status")
#: The date and time when the resource was updated.
updated_at = resource.Body("updated_at")
#: The ID of the volume this snapshot was taken of.
volume_id = resource.Body("volume_id")

View File

@ -50,6 +50,8 @@ class Snapshot(resource.Resource, metadata.MetadataMixin):
#: The current status of this snapshot. Potential values are creating,
#: available, deleting, error, and error_deleting.
status = resource.Body("status")
#: The date and time when the resource was updated.
updated_at = resource.Body("updated_at")
#: The ID of the volume this snapshot was taken of.
volume_id = resource.Body("volume_id")

View File

@ -374,6 +374,7 @@ class FakeVolumeSnapshot:
self.description = description
self.size = size
self.created_at = '1900-01-01 12:34:56'
self.updated_at = None
self.volume_id = '12345'
self.metadata = {}

View File

@ -23,6 +23,7 @@ SNAPSHOT = {
"status": "creating",
"description": "Daily backup",
"created_at": "2015-03-09T12:14:57.233772",
"updated_at": None,
"metadata": {},
"volume_id": "5aa119a8-d25b-45a7-8d1b-88e127885635",
"size": 1,
@ -67,6 +68,7 @@ class TestSnapshot(base.TestCase):
self.assertEqual(SNAPSHOT["id"], sot.id)
self.assertEqual(SNAPSHOT["status"], sot.status)
self.assertEqual(SNAPSHOT["created_at"], sot.created_at)
self.assertEqual(SNAPSHOT["updated_at"], sot.updated_at)
self.assertEqual(SNAPSHOT["metadata"], sot.metadata)
self.assertEqual(SNAPSHOT["volume_id"], sot.volume_id)
self.assertEqual(SNAPSHOT["size"], sot.size)

View File

@ -23,6 +23,7 @@ SNAPSHOT = {
"status": "creating",
"description": "Daily backup",
"created_at": "2015-03-09T12:14:57.233772",
"updated_at": None,
"metadata": {},
"volume_id": "5aa119a8-d25b-45a7-8d1b-88e127885635",
"size": 1,
@ -62,6 +63,7 @@ class TestSnapshot(base.TestCase):
self.assertEqual(SNAPSHOT["id"], sot.id)
self.assertEqual(SNAPSHOT["status"], sot.status)
self.assertEqual(SNAPSHOT["created_at"], sot.created_at)
self.assertEqual(SNAPSHOT["updated_at"], sot.updated_at)
self.assertEqual(SNAPSHOT["metadata"], sot.metadata)
self.assertEqual(SNAPSHOT["volume_id"], sot.volume_id)
self.assertEqual(SNAPSHOT["size"], sot.size)

View File

@ -0,0 +1,3 @@
---
features:
- Added support for the updated_at attribute for volume snapshots.