github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/drs/v3/public/BatchListTaskStatus.go (about)

     1  package public
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     7  )
     8  
     9  func BatchListTaskStatus(client *golangsdk.ServiceClient, opts BatchQueryTaskOpts) (*BatchListTaskStatusResponse, error) {
    10  	b, err := build.RequestBody(opts, "")
    11  	if err != nil {
    12  		return nil, err
    13  	}
    14  
    15  	// POST /v3/{project_id}/jobs/batch-status
    16  	raw, err := client.Post(client.ServiceURL("jobs", "batch-status"), b, nil, &golangsdk.RequestOpts{
    17  		OkCodes: []int{200}})
    18  	if err != nil {
    19  		return nil, err
    20  	}
    21  
    22  	var res BatchListTaskStatusResponse
    23  	err = extract.Into(raw.Body, &res)
    24  	return &res, err
    25  }
    26  
    27  type BatchListTaskStatusResponse struct {
    28  	Results []QueryJobStatusResp `json:"results,omitempty"`
    29  	Count   int                  `json:"count,omitempty"`
    30  }
    31  
    32  type QueryJobStatusResp struct {
    33  	// Task ID.
    34  	Id string `json:"id,omitempty"`
    35  	// Task status. Values:
    36  	// CREATING: The task is being created.
    37  	// CREATE_FAILED: The task fails to be created.
    38  	// CONFIGURATION: The task is being configured.
    39  	// STARTJOBING: The task is being started.
    40  	// WAITING_FOR_START: The task is waiting to be started.
    41  	// START_JOB_FAILED: The task fails to be started.
    42  	// PAUSEING: The task is being paused.
    43  	// FULL_TRANSFER_STARTED: Full migration is in progress, and the DR scenario is initialized.
    44  	// FULL_TRANSFER_FAILED: Full migration failed. Initialization failed in the DR scenario.
    45  	// FULL_TRANSFER_COMPLETE: Full migration is complete, and the initialization is complete in the DR scenario.
    46  	// INCRE_TRANSFER_STARTED: Incremental migration is being performed, and the DR task is in progress.
    47  	// INCRE_TRANSFER_FAILED: Incremental migration fails and a DR exception occurs.
    48  	// RELEASE_RESOURCE_STARTED: The task is being stopped.
    49  	// RELEASE_RESOURCE_FAILED: Stop task failed.
    50  	// RELEASE_RESOURCE_COMPLETE: The task is stopped.
    51  	// CHANGE_JOB_STARTED: The task is being changed.
    52  	// CHANGE_JOB_FAILED: Change task failed.
    53  	// CHILD_TRANSFER_STARTING: The subtask is being started.
    54  	// CHILD_TRANSFER_STARTED: The subtask is being migrated.
    55  	// CHILD_TRANSFER_COMPLETE: The subtask migration is complete.
    56  	// CHILD_TRANSFER_FAILED: Migrate subtask failed.
    57  	// RELEASE_CHILD_TRANSFER_STARTED: The subtask is being stopped.
    58  	// RELEASE_CHILD_TRANSFER_COMPLETE: The subtask is complete.
    59  	Status string `json:"status,omitempty"`
    60  
    61  	ErrorCode    string `json:"error_code,omitempty"`
    62  	ErrorMessage string `json:"error_message,omitempty"`
    63  }