github.com/gophercloud/gophercloud@v1.11.0/openstack/networking/v2/extensions/layer3/extraroutes/results.go (about)

     1  package extraroutes
     2  
     3  import (
     4  	"github.com/gophercloud/gophercloud"
     5  	"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/routers"
     6  )
     7  
     8  // Extract is a function that accepts a result and extracts a router.
     9  func (r commonResult) Extract() (*routers.Router, error) {
    10  	var s struct {
    11  		Router *routers.Router `json:"router"`
    12  	}
    13  	err := r.ExtractInto(&s)
    14  	return s.Router, err
    15  }
    16  
    17  type commonResult struct {
    18  	gophercloud.Result
    19  }
    20  
    21  // AddResult represents the result of an extra routes add operation. Call its
    22  // Extract method to interpret it as a *routers.Router.
    23  type AddResult struct {
    24  	commonResult
    25  }
    26  
    27  // RemoveResult represents the result of an extra routes remove operation. Call
    28  // its Extract method to interpret it as a *routers.Router.
    29  type RemoveResult struct {
    30  	commonResult
    31  }