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

     1  package extendedstatus
     2  
     3  type PowerState int
     4  
     5  type ServerExtendedStatusExt struct {
     6  	TaskState  string     `json:"OS-EXT-STS:task_state"`
     7  	VmState    string     `json:"OS-EXT-STS:vm_state"`
     8  	PowerState PowerState `json:"OS-EXT-STS:power_state"`
     9  }
    10  
    11  const (
    12  	NOSTATE = iota
    13  	RUNNING
    14  	_UNUSED1
    15  	PAUSED
    16  	SHUTDOWN
    17  	_UNUSED2
    18  	CRASHED
    19  	SUSPENDED
    20  )
    21  
    22  func (r PowerState) String() string {
    23  	switch r {
    24  	case NOSTATE:
    25  		return "NOSTATE"
    26  	case RUNNING:
    27  		return "RUNNING"
    28  	case PAUSED:
    29  		return "PAUSED"
    30  	case SHUTDOWN:
    31  		return "SHUTDOWN"
    32  	case CRASHED:
    33  		return "CRASHED"
    34  	case SUSPENDED:
    35  		return "SUSPENDED"
    36  	case _UNUSED1, _UNUSED2:
    37  		return "_UNUSED"
    38  	default:
    39  		return "N/A"
    40  	}
    41  }