1package tags 2 3import "github.com/gophercloud/gophercloud" 4 5// ServerTagsExt is an extension to the base Server object. 6type ServerTagsExt struct { 7 // Tags contains a list of server tags. 8 Tags []string `json:"tags"` 9} 10 11type commonResult struct { 12 gophercloud.Result 13} 14 15// Extract is a function that accepts a result and extracts a tags resource. 16func (r commonResult) Extract() ([]string, error) { 17 var s struct { 18 Tags []string `json:"tags"` 19 } 20 err := r.ExtractInto(&s) 21 return s.Tags, err 22} 23 24type ListResult struct { 25 commonResult 26} 27 28// CheckResult is the result from the Check operation. 29type CheckResult struct { 30 gophercloud.Result 31} 32 33func (r CheckResult) Extract() (bool, error) { 34 exists := r.Err == nil 35 36 if r.Err != nil { 37 if _, ok := r.Err.(gophercloud.ErrDefault404); ok { 38 r.Err = nil 39 } 40 } 41 42 return exists, r.Err 43} 44 45// ReplaceAllResult is the result from the ReplaceAll operation. 46type ReplaceAllResult struct { 47 commonResult 48} 49 50// AddResult is the result from the Add operation. 51type AddResult struct { 52 gophercloud.ErrResult 53} 54 55// DeleteResult is the result from the Delete operation. 56type DeleteResult struct { 57 gophercloud.ErrResult 58} 59