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

Commit 33be7e3

Browse files
author
Samuel Ortiz
committed
imageservice: Specific types for Visibility, MemberStatus and Status
Those fields are restricted to a few possible values, so we define specific types for them. Signed-off-by: Samuel Ortiz <[email protected]>
1 parent 2a977d5 commit 33be7e3

File tree

1 file changed

+36
-10
lines changed

1 file changed

+36
-10
lines changed

openstack/imageservice/v2/images/requests.go

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,32 @@ import (
99
"github.com/rackspace/gophercloud/pagination"
1010
)
1111

12+
type Visibility string
13+
type MemberStatus string
14+
type Status string
15+
16+
const (
17+
Accepted MemberStatus = "accepted"
18+
Pending = "pending"
19+
Rejected = "rejected"
20+
All = "all"
21+
)
22+
23+
const (
24+
Public Visibility = "public"
25+
Private = "private"
26+
Shared = "shared"
27+
)
28+
29+
const (
30+
Queued Status = "queued"
31+
Saving = "saving"
32+
Active = "active"
33+
Killed = "killed"
34+
Deleted = "deleted"
35+
PendingDelete = "pending_delete"
36+
)
37+
1238
// ListOptsBuilder allows extensions to add additional parameters to the
1339
// List request.
1440
type ListOptsBuilder interface {
@@ -27,16 +53,16 @@ type ListOpts struct {
2753
// UUID of the server at which you want to set a marker.
2854
Marker string `q:"marker"`
2955

30-
Name string `q:"name"`
31-
Visibility string `q:"visibility"`
32-
MemberStatus string `q:"member_status"`
33-
Owner string `q:"owner"`
34-
Status string `q:"status"`
35-
SizeMin int64 `q:"size_min"`
36-
SizeMax int64 `q:"size_max"`
37-
SortKey string `q:"sort_key"`
38-
SortDir string `q:"sort_dir"`
39-
Tag string `q:"tag"`
56+
Name string `q:"name"`
57+
Visibility Visibility `q:"visibility"`
58+
MemberStatus MemberStatus `q:"member_status"`
59+
Owner string `q:"owner"`
60+
Status Status `q:"status"`
61+
SizeMin int64 `q:"size_min"`
62+
SizeMax int64 `q:"size_max"`
63+
SortKey string `q:"sort_key"`
64+
SortDir string `q:"sort_dir"`
65+
Tag string `q:"tag"`
4066
}
4167

4268
// ToImageListQuery formats a ListOpts into a query string.

0 commit comments

Comments
 (0)