1package imageimport 2 3import "github.com/gophercloud/gophercloud" 4 5type commonResult struct { 6 gophercloud.Result 7} 8 9// GetResult represents the result of a get operation. Call its Extract method 10// to interpret it as ImportInfo. 11type GetResult struct { 12 commonResult 13} 14 15// CreateResult is the result of import Create operation. Call its ExtractErr 16// method to determine if the request succeeded or failed. 17type CreateResult struct { 18 gophercloud.ErrResult 19} 20 21// ImportInfo represents information data for the Import API. 22type ImportInfo struct { 23 ImportMethods ImportMethods `json:"import-methods"` 24} 25 26// ImportMethods contains information about available Import API methods. 27type ImportMethods struct { 28 Description string `json:"description"` 29 Type string `json:"type"` 30 Value []string `json:"value"` 31} 32 33// Extract is a function that accepts a result and extracts ImportInfo. 34func (r commonResult) Extract() (*ImportInfo, error) { 35 var s *ImportInfo 36 err := r.ExtractInto(&s) 37 return s, err 38} 39