github.com/gophercloud/gophercloud@v1.11.0/openstack/imageservice/v2/imageimport/results.go (about)

     1  package imageimport
     2  
     3  import "github.com/gophercloud/gophercloud"
     4  
     5  type 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.
    11  type 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.
    17  type CreateResult struct {
    18  	gophercloud.ErrResult
    19  }
    20  
    21  // ImportInfo represents information data for the Import API.
    22  type ImportInfo struct {
    23  	ImportMethods ImportMethods `json:"import-methods"`
    24  }
    25  
    26  // ImportMethods contains information about available Import API methods.
    27  type 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.
    34  func (r commonResult) Extract() (*ImportInfo, error) {
    35  	var s *ImportInfo
    36  	err := r.ExtractInto(&s)
    37  	return s, err
    38  }