github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/evs/v1/jobs/results.go (about)

     1  package jobs
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  )
     6  
     7  // Job object contains the response to a Get request
     8  type Job struct {
     9  	Status     string    `json:"status"`
    10  	Entities   JobEntity `json:"entities"`
    11  	JobID      string    `json:"job_id"`
    12  	JobType    string    `json:"job_type"`
    13  	ErrorCode  string    `json:"error_code"`
    14  	FailReason string    `json:"fail_reason"`
    15  	Error      ErrorInfo `json:"error"`
    16  	BeginTime  string    `json:"begin_time"`
    17  	EndTime    string    `json:"end_time"`
    18  }
    19  
    20  // JobEntity contains the response to the job task
    21  type JobEntity struct {
    22  	Name       string `json:"name"`
    23  	Size       int    `json:"size"`
    24  	VolumeID   string `json:"volume_id"`
    25  	VolumeType string `json:"volume_type"`
    26  	SubJobs    []Job  `json:"sub_jobs"`
    27  }
    28  
    29  // ErrorInfo contains the error message returned when an error occurs
    30  type ErrorInfo struct {
    31  	Message string `json:"message"`
    32  	Code    string `json:"code"`
    33  }
    34  
    35  // GetResult contains the response body and error from a Get request
    36  type GetResult struct {
    37  	golangsdk.Result
    38  }
    39  
    40  // ExtractJob will get the *Job object out of the GetResult
    41  func (r GetResult) ExtractJob() (*Job, error) {
    42  	var job Job
    43  	err := r.ExtractInto(&job)
    44  	return &job, err
    45  }