github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/compute/v2/extensions/rescueunrescue/results.go (about)

     1  package rescueunrescue
     2  
     3  import "github.com/huaweicloud/golangsdk"
     4  
     5  type commonResult struct {
     6  	golangsdk.Result
     7  }
     8  
     9  // RescueResult is the response from a Rescue operation. Call its Extract
    10  // method to retrieve adminPass for a rescued server.
    11  type RescueResult struct {
    12  	commonResult
    13  }
    14  
    15  // UnrescueResult is the response from an UnRescue operation. Call its ExtractErr
    16  // method to determine if the call succeeded or failed.
    17  type UnrescueResult struct {
    18  	golangsdk.ErrResult
    19  }
    20  
    21  // Extract interprets any RescueResult as an AdminPass, if possible.
    22  func (r RescueResult) Extract() (string, error) {
    23  	var s struct {
    24  		AdminPass string `json:"adminPass"`
    25  	}
    26  	err := r.ExtractInto(&s)
    27  	return s.AdminPass, err
    28  }