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

     1  package elbaas
     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  	ErrorCode  string                 `json:"error_code"`
    28  	FailReason string                 `json:"fail_reason"`
    29  }
    30  
    31  type JobInfoResult struct {
    32  	golangsdk.Result
    33  }
    34  
    35  func (r JobInfoResult) Extract() (*JobInfo, error) {
    36  	j := &JobInfo{}
    37  	err := r.ExtractInto(j)
    38  	return j, err
    39  }
    40  
    41  func QueryJobInfo(c *golangsdk.ServiceClient, jobId string) (r JobInfoResult) {
    42  	_, r.Err = c.Get(c.ServiceURL("jobs", jobId), &r.Body, nil)
    43  	return
    44  }