Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit c0b914f

Browse files
committed
List and get Compute image metadata.
1 parent 231898e commit c0b914f

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

openstack/compute/v2/images/requests_test.go

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ func TestListImages(t *testing.T) {
5050
"minDisk": 0,
5151
"progress": 100,
5252
"minRam": 0,
53-
"metadata": {}
53+
"metadata": {
54+
"string": "string",
55+
"true": true,
56+
"nil": null
57+
}
5458
}
5559
]
5660
}
@@ -82,6 +86,7 @@ func TestListImages(t *testing.T) {
8286
MinRAM: 0,
8387
Progress: 100,
8488
Status: "ACTIVE",
89+
Metadata: map[string]interface{}{},
8590
},
8691
Image{
8792
ID: "f90f6034-2570-4974-8351-6b49732ef2eb",
@@ -92,6 +97,11 @@ func TestListImages(t *testing.T) {
9297
MinRAM: 0,
9398
Progress: 100,
9499
Status: "ACTIVE",
100+
Metadata: map[string]interface{}{
101+
"string": "string",
102+
"true": true,
103+
"nil": nil,
104+
},
95105
},
96106
}
97107

@@ -131,7 +141,12 @@ func TestGetImage(t *testing.T) {
131141
"minDisk": 0,
132142
"progress": 100,
133143
"minRam": 0,
134-
"metadata": {}
144+
"metadata": {
145+
"string": "string",
146+
"true": true,
147+
"nil": null
148+
}
149+
135150
}
136151
}
137152
`)
@@ -151,6 +166,11 @@ func TestGetImage(t *testing.T) {
151166
MinDisk: 0,
152167
Progress: 100,
153168
MinRAM: 0,
169+
Metadata: map[string]interface{}{
170+
"string": "string",
171+
"true": true,
172+
"nil": nil,
173+
},
154174
}
155175

156176
if !reflect.DeepEqual(expected, actual) {

openstack/compute/v2/images/results.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ type Image struct {
3838

3939
Created string
4040

41+
Metadata map[string]interface{}
42+
4143
// MinDisk and MinRAM specify the minimum resources a server must provide to be able to install the image.
4244
MinDisk int
4345
MinRAM int

0 commit comments

Comments
 (0)