Skip to content

Commit

Permalink
Fixed time format to match API response
Browse files Browse the repository at this point in the history
  • Loading branch information
ezilber-akamai committed Nov 27, 2024
1 parent 702773b commit 4082f44
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 22 deletions.
22 changes: 21 additions & 1 deletion object_storage_buckets.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,32 @@ type ObjectStorageBucketContent struct {
// ObjectStorageBucketContentData holds the data of the content of an ObjectStorageBucket
type ObjectStorageBucketContentData struct {
Etag string `json:"etag"`
LastModified *time.Time `json:"-"`
LastModified *time.Time `json:"last_modified"`
Name string `json:"name"`
Owner string `json:"owner"`
Size int `json:"size"`
}

//// UnmarshalJSON implements the json.Unmarshaler interface
//func (d *ObjectStorageBucketContentData) UnmarshalJSON(b []byte) error {

Check failure on line 55 in object_storage_buckets.go

View workflow job for this annotation

GitHub Actions / lint-tidy

commentFormatting: put a space between `//` and comment text (gocritic)
// type Mask ObjectStorageBucketContentData
//
// p := struct {
// *Mask
// LastModified *parseabletime.ParseableTime `json:"last_modified"`
// }{
// Mask: (*Mask)(d),
// }
//
// if err := json.Unmarshal(b, &p); err != nil {
// return err
// }
//
// d.LastModified = (*time.Time)(p.LastModified)
//
// return nil
//}

// UnmarshalJSON implements the json.Unmarshaler interface
func (i *ObjectStorageBucket) UnmarshalJSON(b []byte) error {
type Mask ObjectStorageBucket
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ interactions:
body: ""
form: {}
headers: {}
url: https://us-east-1.linodeobjects.com:443/go-bucket-test-def/test?Signature=gksQV4gasjlqHmPgfFuhJ1OCIWE%3D&Expires=1732658402&AWSAccessKeyID=SANITIZED
url: https://us-east-1.linodeobjects.com:443/go-bucket-test-def/test?Signature=IRuyHRdpyXWhh2aQjNZwsCI4Zw0%3D&Expires=1732717668&AWSAccessKeyID=SANITIZED
method: DELETE
response:
body: ""
headers:
Connection:
- keep-alive
X-Amz-Request-Id:
- tx00000a41cad539cfe8a29-006746437a-f1fed6ce-default
- tx00000a853072ba4ae0eeb-0067472afc-ef83577d-default
status: 204 No Content
code: 204
duration: ""
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interactions:
headers:
Content-Type:
- text/plain
url: https://us-east-1.linodeobjects.com:443/go-bucket-test-def/test?Signature=2hta9srwrUWmNKyy3hyslnB2Qqw%3D&Expires=1732658396&AWSAccessKeyID=SANITIZED
url: https://us-east-1.linodeobjects.com:443/go-bucket-test-def/test?Signature=k0XyLLvzmzaHLogj2FDHySorg6E%3D&Expires=1732717660&AWSAccessKeyID=SANITIZED
method: PUT
response:
body: ""
Expand All @@ -21,7 +21,7 @@ interactions:
Etag:
- '"7f2ababa423061c509f4923dd04b6cf1"'
X-Amz-Request-Id:
- tx0000075aece07f7f76744-0067464375-f3ff40d9-default
- tx00000640ed2ef823b369b-0067472af5-f0b7e689-default
status: 200 OK
code: 200
duration: ""
22 changes: 11 additions & 11 deletions test/integration/fixtures/TestObjectStorageObject_Smoke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Tue, 26 Nov 2024 21:53:55 GMT
- Wed, 27 Nov 2024 14:21:38 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -77,7 +77,7 @@ interactions:
url: https://api.linode.com/v4beta/object-storage/buckets/us-east-1/go-bucket-test-def/object-url
method: POST
response:
body: '{"url": "https://us-east-1.linodeobjects.com:443/go-bucket-test-def/test?Signature=2hta9srwrUWmNKyy3hyslnB2Qqw%3D&Expires=1732658396&AWSAccessKeyID=SANITIZED",
body: '{"url": "https://us-east-1.linodeobjects.com:443/go-bucket-test-def/test?Signature=k0XyLLvzmzaHLogj2FDHySorg6E%3D&Expires=1732717660&AWSAccessKeyID=SANITIZED",
"exists": false}'
headers:
Access-Control-Allow-Credentials:
Expand All @@ -103,7 +103,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Tue, 26 Nov 2024 21:53:57 GMT
- Wed, 27 Nov 2024 14:21:40 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -165,7 +165,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Tue, 26 Nov 2024 21:53:58 GMT
- Wed, 27 Nov 2024 14:21:42 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -202,7 +202,7 @@ interactions:
url: https://api.linode.com/v4beta/object-storage/buckets/us-east-1/go-bucket-test-def/object-list
method: GET
response:
body: '{"data": [{"name": "test", "size": 10, "last_modified": "2018-01-02T03:04:05.281Z",
body: '{"data": [{"name": "test", "size": 10, "last_modified": "2018-01-02T03:04:05.263Z",
"etag": "7f2ababa423061c509f4923dd04b6cf1", "owner": "640757b5-ebe9-45b1-abd5-581f215ef89e"}],
"next_marker": null, "is_truncated": false}'
headers:
Expand All @@ -229,7 +229,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Tue, 26 Nov 2024 21:53:59 GMT
- Wed, 27 Nov 2024 14:21:43 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -291,7 +291,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Tue, 26 Nov 2024 21:54:00 GMT
- Wed, 27 Nov 2024 14:21:44 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -354,7 +354,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Tue, 26 Nov 2024 21:54:01 GMT
- Wed, 27 Nov 2024 14:21:46 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -391,7 +391,7 @@ interactions:
url: https://api.linode.com/v4beta/object-storage/buckets/us-east-1/go-bucket-test-def/object-url
method: POST
response:
body: '{"url": "https://us-east-1.linodeobjects.com:443/go-bucket-test-def/test?Signature=gksQV4gasjlqHmPgfFuhJ1OCIWE%3D&Expires=1732658402&AWSAccessKeyID=SANITIZED",
body: '{"url": "https://us-east-1.linodeobjects.com:443/go-bucket-test-def/test?Signature=IRuyHRdpyXWhh2aQjNZwsCI4Zw0%3D&Expires=1732717668&AWSAccessKeyID=SANITIZED",
"exists": true}'
headers:
Access-Control-Allow-Credentials:
Expand All @@ -417,7 +417,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Tue, 26 Nov 2024 21:54:02 GMT
- Wed, 27 Nov 2024 14:21:48 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -478,7 +478,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Tue, 26 Nov 2024 21:54:13 GMT
- Wed, 27 Nov 2024 14:21:54 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down
12 changes: 6 additions & 6 deletions test/unit/fixtures/object_storage_buckets_object_list.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"data": [
{
"etag": "9f254c71e28e033bf9e0e5262e3e72ab",
"last_modified": "2019-01-01T01:23:45",
"name": "example",
"owner": "bfc70ab2-e3d4-42a4-ad55-83921822270c",
"size": 123
"size": 123,
"last_modified": "2018-01-02T03:04:05.757Z",
"etag": "9f254c71e28e033bf9e0e5262e3e72ab",
"owner": "bfc70ab2-e3d4-42a4-ad55-83921822270c"
}
],
"is_truncated": false,
"next_marker": null
"next_marker": null,
"is_truncated": false
}

0 comments on commit 4082f44

Please sign in to comment.