yunion.io/x/cloudmux@v0.3.10-0-alpha.1/pkg/multicloud/nutanix/task.go (about) 1 // Copyright 2019 Yunion 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package nutanix 16 17 type MetaRequest struct { 18 MethodName string `json:"method_name"` 19 } 20 21 type EntityList struct { 22 EntityID string `json:"entity_id"` 23 EntityType string `json:"entity_type"` 24 EntityName interface{} `json:"entity_name"` 25 } 26 27 type MetaResponse struct { 28 ErrorCode int `json:"error_code"` 29 ErrorDetail string `json:"error_detail"` 30 } 31 32 type STask struct { 33 UUID string `json:"uuid"` 34 MetaRequest MetaRequest `json:"meta_request"` 35 MetaResponse MetaResponse `json:"meta_response,omitempty"` 36 CreateTimeUsecs int64 `json:"create_time_usecs"` 37 StartTimeUsecs int64 `json:"start_time_usecs"` 38 CompleteTimeUsecs int64 `json:"complete_time_usecs"` 39 LastUpdatedTimeUsecs int64 `json:"last_updated_time_usecs"` 40 EntityList []EntityList `json:"entity_list,omitempty"` 41 OperationType string `json:"operation_type"` 42 Message string `json:"message"` 43 PercentageComplete int `json:"percentage_complete"` 44 ProgressStatus string `json:"progress_status"` 45 ClusterUUID string `json:"cluster_uuid"` 46 SubtaskUUIDList []string `json:"subtask_uuid_list,omitempty"` 47 } 48 49 func (self *SRegion) GetTasks() ([]STask, error) { 50 tasks := []STask{} 51 return tasks, self.post("tasks/list", nil, &tasks) 52 } 53 54 func (self *SRegion) GetTask(id string) (*STask, error) { 55 return self.cli.getTask(id) 56 }