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

     1  package evacuate
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  )
     6  
     7  // EvacuateResult is the response from an Evacuate operation.
     8  //Call its ExtractAdminPass method to retrieve the admin password of the instance.
     9  //The admin password will be an empty string if the cloud is not configured to inject admin passwords..
    10  type EvacuateResult struct {
    11  	golangsdk.Result
    12  }
    13  
    14  func (r EvacuateResult) ExtractAdminPass() (string, error) {
    15  	var s struct {
    16  		AdminPass string `json:"adminPass"`
    17  	}
    18  	err := r.ExtractInto(&s)
    19  	if err != nil && err.Error() == "EOF" {
    20  		return "", nil
    21  	}
    22  	return s.AdminPass, err
    23  }