Skip to content

Commit c17fe2c

Browse files
authored
Merge pull request #2482 from dkt26111/ironic_node_time
Add createdAt, updatedAt and provisionUpdatedAt fields in Baremetal V1 nodes
2 parents 2090f9c + 0f4183c commit c17fe2c

2 files changed

Lines changed: 31 additions & 6 deletions

File tree

openstack/baremetal/v1/nodes/results.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package nodes
22

33
import (
4+
"time"
5+
46
"github.com/gophercloud/gophercloud"
57
"github.com/gophercloud/gophercloud/pagination"
68
)
@@ -234,6 +236,15 @@ type Node struct {
234236

235237
// Static network configuration to use during deployment and cleaning.
236238
NetworkData map[string]interface{} `json:"network_data"`
239+
240+
// The UTC date and time when the resource was created, ISO 8601 format.
241+
CreatedAt time.Time `json:"created_at"`
242+
243+
// The UTC date and time when the resource was updated, ISO 8601 format. May be “null”.
244+
UpdatedAt time.Time `json:"updated_at"`
245+
246+
// The UTC date and time when the provision state was updated, ISO 8601 format. May be “null”.
247+
ProvisionUpdatedAt time.Time `json:"provision_updated_at"`
237248
}
238249

239250
// NodePage abstracts the raw results of making a List() request against

openstack/baremetal/v1/nodes/testing/fixtures.go

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"net/http"
66
"testing"
7+
"time"
78

89
"github.com/gophercloud/gophercloud/openstack/baremetal/v1/nodes"
910
th "github.com/gophercloud/gophercloud/testhelper"
@@ -143,7 +144,7 @@ const NodeListDetailBody = `
143144
"power_state": null,
144145
"properties": {},
145146
"provision_state": "enroll",
146-
"provision_updated_at": null,
147+
"provision_updated_at": "2019-02-15T17:21:29+00:00",
147148
"raid_config": {},
148149
"raid_interface": "no-raid",
149150
"rescue_interface": "no-rescue",
@@ -164,7 +165,7 @@ const NodeListDetailBody = `
164165
"target_provision_state": null,
165166
"target_raid_config": {},
166167
"traits": [],
167-
"updated_at": null,
168+
"updated_at": "2019-02-15T19:59:29+00:00",
168169
"uuid": "d2630783-6ec8-4836-b556-ab427c4b581e",
169170
"vendor_interface": "ipmitool",
170171
"volume": [
@@ -261,7 +262,7 @@ const NodeListDetailBody = `
261262
"target_provision_state": null,
262263
"target_raid_config": {},
263264
"traits": [],
264-
"updated_at": null,
265+
"updated_at": "2019-02-15T19:59:29+00:00",
265266
"uuid": "08c84581-58f5-4ea2-a0c6-dd2e5d2b3662",
266267
"vendor_interface": "ipmitool",
267268
"volume": [
@@ -358,7 +359,7 @@ const NodeListDetailBody = `
358359
"target_provision_state": null,
359360
"target_raid_config": {},
360361
"traits": [],
361-
"updated_at": null,
362+
"updated_at": "2019-02-15T19:59:29+00:00",
362363
"uuid": "c9afd385-5d89-4ecb-9e1c-68194da6b474",
363364
"vendor_interface": "ipmitool",
364365
"volume": [
@@ -447,7 +448,7 @@ const SingleNodeBody = `
447448
"power_state": null,
448449
"properties": {},
449450
"provision_state": "enroll",
450-
"provision_updated_at": null,
451+
"provision_updated_at": "2019-02-15T17:21:29+00:00",
451452
"raid_config": {},
452453
"raid_interface": "no-raid",
453454
"rescue_interface": "no-rescue",
@@ -468,7 +469,7 @@ const SingleNodeBody = `
468469
"target_provision_state": null,
469470
"target_raid_config": {},
470471
"traits": [],
471-
"updated_at": null,
472+
"updated_at": "2019-02-15T19:59:29+00:00",
472473
"uuid": "d2630783-6ec8-4836-b556-ab427c4b581e",
473474
"vendor_interface": "ipmitool",
474475
"volume": [
@@ -813,6 +814,12 @@ const NodeSetMaintenanceBody = `
813814
`
814815

815816
var (
817+
createdAtFoo, _ = time.Parse(time.RFC3339, "2019-01-31T19:59:28+00:00")
818+
createdAtBar, _ = time.Parse(time.RFC3339, "2019-01-31T19:59:29+00:00")
819+
createdAtBaz, _ = time.Parse(time.RFC3339, "2019-01-31T19:59:30+00:00")
820+
updatedAt, _ = time.Parse(time.RFC3339, "2019-02-15T19:59:29+00:00")
821+
provisonUpdatedAt, _ = time.Parse(time.RFC3339, "2019-02-15T17:21:29+00:00")
822+
816823
NodeFoo = nodes.Node{
817824
UUID: "d2630783-6ec8-4836-b556-ab427c4b581e",
818825
Name: "foo",
@@ -862,6 +869,9 @@ var (
862869
ConductorGroup: "",
863870
Protected: false,
864871
ProtectedReason: "",
872+
CreatedAt: createdAtFoo,
873+
UpdatedAt: updatedAt,
874+
ProvisionUpdatedAt: provisonUpdatedAt,
865875
}
866876

867877
NodeFooValidation = nodes.NodeValidation{
@@ -959,6 +969,8 @@ var (
959969
ConductorGroup: "",
960970
Protected: false,
961971
ProtectedReason: "",
972+
CreatedAt: createdAtBar,
973+
UpdatedAt: updatedAt,
962974
}
963975

964976
NodeBaz = nodes.Node{
@@ -1003,6 +1015,8 @@ var (
10031015
ConductorGroup: "",
10041016
Protected: false,
10051017
ProtectedReason: "",
1018+
CreatedAt: createdAtBaz,
1019+
UpdatedAt: updatedAt,
10061020
}
10071021

10081022
ConfigDriveMap = nodes.ConfigDrive{

0 commit comments

Comments
 (0)