change all time fields to have type time.Time (#190)
* add Volume.Unmarshal
* add volumetenants.VolumeExt.Unmarshal
* create servers.Server time.Time fields
* json.Unmarshal can correctly handle time.RFC3339 (Server time fields)
* add v3 Token UnmarshalJSON method
* check for empty string when unmarshaling time
* add Member UnmarshalJSON
* v3 tokens.Token ExtractInto
* v3 trust.Trust UnmarshalJSON
* time.Time fields swift response objects
* time.Time fields for orchestration response objects
* time.Time fields for shared file systems response objects
* if we don't use pointers for the custom time fields, we don't need to check if they're nil
* style guide fixes: 'r' for receiver, 's' for struct
* remove unnecessary pointers from UnmarshalJSON methods
diff --git a/openstack/compute/v2/servers/testing/fixtures.go b/openstack/compute/v2/servers/testing/fixtures.go
index adedb46..40d5ed2 100644
--- a/openstack/compute/v2/servers/testing/fixtures.go
+++ b/openstack/compute/v2/servers/testing/fixtures.go
@@ -4,6 +4,7 @@
"fmt"
"net/http"
"testing"
+ "time"
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
@@ -304,10 +305,12 @@
`
var (
+ herpTimeCreated, _ = time.Parse(time.RFC3339, "2014-09-25T13:10:02Z")
+ herpTimeUpdated, _ = time.Parse(time.RFC3339, "2014-09-25T13:10:10Z")
// ServerHerp is a Server struct that should correspond to the first result in ServerListBody.
ServerHerp = servers.Server{
Status: "ACTIVE",
- Updated: "2014-09-25T13:10:10Z",
+ Updated: herpTimeUpdated,
HostID: "29d3c8c896a45aa4c34e52247875d7fefc3d94bbcc9f622b5d204362",
Addresses: map[string]interface{}{
"private": []interface{}{
@@ -350,7 +353,7 @@
ID: "ef079b0c-e610-4dfb-b1aa-b49f07ac48e5",
UserID: "9349aff8be7545ac9d2f1d00999a23cd",
Name: "herp",
- Created: "2014-09-25T13:10:02Z",
+ Created: herpTimeCreated,
TenantID: "fcad67a6189847c4aecfa3c81a05783b",
Metadata: map[string]string{},
SecurityGroups: []map[string]interface{}{
@@ -360,10 +363,12 @@
},
}
+ derpTimeCreated, _ = time.Parse(time.RFC3339, "2014-09-25T13:04:41Z")
+ derpTimeUpdated, _ = time.Parse(time.RFC3339, "2014-09-25T13:04:49Z")
// ServerDerp is a Server struct that should correspond to the second server in ServerListBody.
ServerDerp = servers.Server{
Status: "ACTIVE",
- Updated: "2014-09-25T13:04:49Z",
+ Updated: derpTimeUpdated,
HostID: "29d3c8c896a45aa4c34e52247875d7fefc3d94bbcc9f622b5d204362",
Addresses: map[string]interface{}{
"private": []interface{}{
@@ -406,7 +411,7 @@
ID: "9e5476bd-a4ec-4653-93d6-72c93aa682ba",
UserID: "9349aff8be7545ac9d2f1d00999a23cd",
Name: "derp",
- Created: "2014-09-25T13:04:41Z",
+ Created: derpTimeCreated,
TenantID: "fcad67a6189847c4aecfa3c81a05783b",
Metadata: map[string]string{},
SecurityGroups: []map[string]interface{}{
@@ -416,10 +421,12 @@
},
}
+ merpTimeCreated, _ = time.Parse(time.RFC3339, "2014-09-25T13:04:41Z")
+ merpTimeUpdated, _ = time.Parse(time.RFC3339, "2014-09-25T13:04:49Z")
// ServerMerp is a Server struct that should correspond to the second server in ServerListBody.
ServerMerp = servers.Server{
Status: "ACTIVE",
- Updated: "2014-09-25T13:04:49Z",
+ Updated: merpTimeUpdated,
HostID: "29d3c8c896a45aa4c34e52247875d7fefc3d94bbcc9f622b5d204362",
Addresses: map[string]interface{}{
"private": []interface{}{
@@ -454,7 +461,7 @@
ID: "9e5476bd-a4ec-4653-93d6-72c93aa682bb",
UserID: "9349aff8be7545ac9d2f1d00999a23cd",
Name: "merp",
- Created: "2014-09-25T13:04:41Z",
+ Created: merpTimeCreated,
TenantID: "fcad67a6189847c4aecfa3c81a05783b",
Metadata: map[string]string{},
SecurityGroups: []map[string]interface{}{