github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/networking/v2/extensions/elb/job.go (about)

     1  package elb
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  )
     6  
     7  type Job struct {
     8  	Uri   string `json:"uri"`
     9  	JobId string `json:"job_id"`
    10  }
    11  
    12  type JobResult struct {
    13  	golangsdk.Result
    14  }
    15  
    16  func (r JobResult) Extract() (*Job, error) {
    17  	j := &Job{}
    18  	err := r.ExtractInto(j)
    19  	return j, err
    20  }
    21  
    22  type JobInfo struct {
    23  	Status     string                 `json:"status"`
    24  	Entities   map[string]interface{} `json:"entities"`
    25  	JobId      string                 `json:"job_id"`
    26  	JobType    string                 `json:"job_type"`
    27  	BeginTime  string                 `json:"begin_time"`
    28  	EndTime    string                 `json:"end_time"`
    29  	ErrorCode  string                 `json:"error_code"`
    30  	FailReason string                 `json:"fail_reason"`
    31  	Message    string                 `json:"message"`
    32  	Code       string                 `json:"code"`
    33  	SubJobs    []JobInfo              `json:"sub_jobs"`
    34  }
    35  
    36  type JobInfoResult struct {
    37  	golangsdk.Result
    38  }
    39  
    40  func (r JobInfoResult) Extract() (*JobInfo, error) {
    41  	j := &JobInfo{}
    42  	err := r.ExtractInto(j)
    43  	return j, err
    44  }
    45  
    46  func QueryJobInfo(c *golangsdk.ServiceClient, jobId string) (r JobInfoResult) {
    47  	e := c.ResourceBaseURL()
    48  	e = e + c.ProjectID + "/jobs/" + jobId
    49  	_, r.Err = c.Get(e, &r.Body, nil)
    50  	return
    51  }