Documentation ¶
Overview ¶
Package task provides the ability to retrieve cluster tasks through the MKS V1 API.
Example of getting a single cluster task referenced by its id
clusterTask, _, err := task.Get(ctx, mksClient, clusterID, taskID) if err != nil { log.Fatal(err) } fmt.Printf("%+v\n", clusterTask)
Example of getting all cluster tasks
clusterTasks, _, err := task.List(ctx, mksClient, clusterID) if err != nil { log.Fatal(err) } for _, clusterTask := range clusterTasks { fmt.Printf("%+v\n", clusterTask) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Type ¶
type Type string
Type represents custom type for various task types.
const ( TypeCreateCluster Type = "CREATE_CLUSTER" TypeDeleteCluster Type = "DELETE_CLUSTER" TypeRotateCerts Type = "ROTATE_CERTS" // Task to rotate PKI-tree. TypeNodeGroupResize Type = "NODE_GROUP_RESIZE" // Task to resize nodes in a group. TypeNodeReinstall Type = "NODE_REINSTALL" // Task to reinstall a single node. TypeClusterResize Type = "CLUSTER_RESIZE" // Task to change amount of node-groups in a cluster. TypeUpgradePatchVersion Type = "UPGRADE_PATCH_VERSION" TypeUpgradeMinorVersion Type = "UPGRADE_MINOR_VERSION" TypeUpdateNodegroupLabels Type = "UPDATE_NODEGROUP_LABELS" TypeUpgradeMastersConfiguration Type = "UPGRADE_MASTERS_CONFIGURATION" TypeUnknown Type = "UNKNOWN" )
type View ¶
type View struct { // ID is the identifier of the task. ID string `json:"id"` // StartedAt is the timestamp in UTC timezone of when the task has been started. StartedAt *time.Time `json:"started_at"` // UpdatedAt is the timestamp in UTC timezone of when the task has been updated. UpdatedAt *time.Time `json:"updated_at"` // ClusterID contains cluster identifier. ClusterID string `json:"cluster_id"` // Status represents current status of the task. Status Status `json:"-"` // Task represents task's type. Type Type `json:"-"` }
View represents an unmarshalled cluster task body from an API response.
func Get ¶
func Get(ctx context.Context, client *v1.ServiceClient, clusterID, taskID string) (*View, *v1.ResponseResult, error)
Get returns a cluster task by its id.
func List ¶
func List(ctx context.Context, client *v1.ServiceClient, clusterID string) ([]*View, *v1.ResponseResult, error)
List gets a list of all cluster tasks.
func (*View) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.