Documentation
¶
Index ¶
- Constants
- func ExtractTasksInto(r pagination.Page, v interface{}) error
- func List(c *gcorecloud.ServiceClient) pagination.Pagerdeprecated
- func ListActive(c *gcorecloud.ServiceClient) pagination.Pager
- func ListWithOpts(c *gcorecloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- func WaitForStatus(client *gcorecloud.ServiceClient, id string, status TaskState, secs int, ...) error
- func WaitTaskAndProcessResult(client *gcorecloud.ServiceClient, task TaskID, stopOnTaskError bool, ...) error
- func WaitTaskAndReturnResult(client *gcorecloud.ServiceClient, task TaskID, stopOnTaskError bool, ...) (interface{}, error)
- type CheckTaskResult
- type CreateResult
- type DeleteResult
- type GetResult
- type ListOpts
- type ListOptsBuilder
- type Result
- type RetrieveTaskResult
- type Task
- type TaskID
- type TaskOrderByChoices
- type TaskPage
- type TaskResults
- type TaskState
- type Tasks
- type UpdateResult
Constants ¶
const ( TaskStateNew = TaskState("NEW") TaskStateRunning = TaskState("RUNNING") TaskStateFinished = TaskState("FINISHED") TaskStateError = TaskState("ERROR") TaskSortingOldFirst = TaskOrderByChoices("asc") TaskSortingToNewFirst = TaskOrderByChoices("desc") )
Variables ¶
This section is empty.
Functions ¶
func ExtractTasksInto ¶
func ExtractTasksInto(r pagination.Page, v interface{}) error
func List
deprecated
func List(c *gcorecloud.ServiceClient) pagination.Pager
List returns a Pager which allows you to iterate over a collection of active tasks.
Deprecated: Use ListActive for getting the active tasks or ListWithOpts for greater filtering flexibility.
func ListActive ¶ added in v0.13.0
func ListActive(c *gcorecloud.ServiceClient) pagination.Pager
ListActive returns a Pager which allows you to iterate over a collection of active tasks.
func ListWithOpts ¶ added in v0.13.0
func ListWithOpts(c *gcorecloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
ListWithOpts returns a Pager which allows you to iterate over a collection of tasks. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.
func WaitForStatus ¶
func WaitForStatus(client *gcorecloud.ServiceClient, id string, status TaskState, secs int, stopOnTaskError bool) error
WaitForStatus will continually poll the task resource, checking for a particular status. It will do this for the amount of seconds defined.
func WaitTaskAndProcessResult ¶
func WaitTaskAndProcessResult( client *gcorecloud.ServiceClient, task TaskID, stopOnTaskError bool, waitSeconds int, taskProcessor CheckTaskResult) error
WaitTaskAndProcessResult periodically check status state and invoke taskProcessor when when task is finished
func WaitTaskAndReturnResult ¶
func WaitTaskAndReturnResult( client *gcorecloud.ServiceClient, task TaskID, stopOnTaskError bool, waitSeconds int, taskProcessor RetrieveTaskResult) (interface{}, error)
WaitTaskAndReturnResult periodically check status state and return changed object when task is finished
Types ¶
type CheckTaskResult ¶
type CreateResult ¶
type CreateResult struct {
// contains filtered or unexported fields
}
CreateResult represents the result of a create operation. Call its Extract method to interpret it as a Network.
func (CreateResult) Extract ¶
Extract is a function that accepts a result and extracts a task resource.
func (CreateResult) ExtractInto ¶
func (r CreateResult) ExtractInto(v interface{}) error
type DeleteResult ¶
type DeleteResult struct {
gcorecloud.ErrResult
}
DeleteResult represents the result of a delete operation. Call its ExtractErr method to determine if the request succeeded or failed.
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
GetResult represents the result of a get operation. Call its Extract method to interpret it as a Network.
func Get ¶
func Get(c *gcorecloud.ServiceClient, id string) (r GetResult)
Get retrieves a specific cluster template based on its unique ID.
func (GetResult) Extract ¶
Extract is a function that accepts a result and extracts a task resource.
func (GetResult) ExtractInto ¶
func (r GetResult) ExtractInto(v interface{}) error
type ListOpts ¶ added in v0.13.0
type ListOpts struct { ProjectID *int `q:"project_id"` State []TaskState `q:"state"` TaskType *string `q:"task_type"` Sorting *TaskOrderByChoices `q:"sorting"` FromTimestamp *string `q:"from_timestamp"` }
ListOpts allows the filtering and sorting List API response.
func (ListOpts) ToTaskListQuery ¶ added in v0.13.0
ToTaskListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶ added in v0.13.0
ListOptsBuilder allows extensions to add additional parameters to the List request.
type Result ¶
type Result struct {
gcorecloud.Result
}
Result represents the operation result that returns tasks
func (Result) Extract ¶
func (r Result) Extract() (*TaskResults, error)
Extract is a function that accepts a result and extracts a task resource.
type RetrieveTaskResult ¶
type Task ¶
type Task struct { ID string `json:"id"` TaskType string `json:"task_type"` ProjectID int `json:"project_id,omitempty"` ClientID int `json:"client_id"` RegionID *int `json:"region_id"` UserID int `json:"user_id"` UserClientID int `json:"user_client_id"` State TaskState `json:"state"` CreatedOn gcorecloud.JSONRFC3339NoZ `json:"created_on"` UpdatedOn *gcorecloud.JSONRFC3339NoZ `json:"updated_on"` FinishedOn *gcorecloud.JSONRFC3339NoZ `json:"finished_on"` AcknowledgedAt *gcorecloud.JSONRFC3339NoZ `json:"acknowledged_at"` AcknowledgedBy *int `json:"acknowledged_by"` CreatedResources *map[string]interface{} `json:"created_resources"` RequestID *string `json:"request_id"` Error *string `json:"error"` Data *map[string]interface{} `json:"data"` }
func ListAll ¶ added in v0.13.0
func ListAll(c *gcorecloud.ServiceClient, opts ListOptsBuilder) ([]Task, error)
ListAll returns all Tasks. It accepts a ListOpts struct, which allows you to filter and sort the returned slice for greater efficiency.
type TaskOrderByChoices ¶ added in v0.13.0
type TaskOrderByChoices string
type TaskPage ¶
type TaskPage struct {
pagination.LinkedPageBase
}
ClusterPage is the page returned by a pager when traversing over a collection of tasks.
func (TaskPage) NextPageURL ¶
NextPageURL is invoked when a paginated collection of cluster has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.
type TaskResults ¶
type TaskResults struct {
Tasks []TaskID `json:"tasks"`
}
type Tasks ¶
type Tasks []Task
func ExtractTasks ¶
func ExtractTasks(r pagination.Page) (Tasks, error)
ExtractTasks accepts a Page struct, specifically a ClusterPage struct, and extracts the elements into a slice of Task structs. In other words, a generic collection is mapped into a relevant slice.
type UpdateResult ¶
type UpdateResult struct {
// contains filtered or unexported fields
}
UpdateResult represents the result of an update operation. Call its Extract method to interpret it as a Network.
func (UpdateResult) Extract ¶
Extract is a function that accepts a result and extracts a task resource.
func (UpdateResult) ExtractInto ¶
func (r UpdateResult) ExtractInto(v interface{}) error