task

package
v1.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2024 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAutoscalerTask

func GetAutoscalerTask(connectorWrapper *connector.Wrapper, taskID string) (model.Task, error)

GetAutoscalerTask polls autoscalerapi for task with specified ID and converts it to model.Task

func GetDraasTask

func GetDraasTask(connectorWrapper *connector.Wrapper, taskID string) (model.Task, error)

GetDraasTask polls draas API for task with specified ID and converts it to model.Task

func GetTask

func GetTask(connectorWrapper *connector.Wrapper, taskID string) (model.Task, error)

GetTask returns a model.Task with specified ID

func GetV2Task added in v1.12.0

func GetV2Task(connectorWrapper *connector.Wrapper, taskID string) (model.Task, error)

GetV2Task returns an adapted model.Task with specified ID

func RetryTaskUntilFinished

func RetryTaskUntilFinished(authenticator connector.Authenticator,
	taskSupplier func() (model.Task, error),
	errorMessage string,
	finishCallback func(task model.Task)) *resource.RetryError

RetryTaskUntilFinished function that will poll (using provided task supplier) for a task state until a non-recoverable error is encountered, like task failure or authentication error or until the task finishes. An option to execute a callback after task finish (either successfully or not) is provided.

Types

type HTTPClient added in v1.12.0

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient an interface, that is implemented by the http.DefaultClient, intended to enable stubbing for testing purposes

type KeyedMutex

type KeyedMutex struct {
	// contains filtered or unexported fields
}

KeyedMutex Mutex that operates multiple locks, based on a string key.

func (*KeyedMutex) Lock

func (keyedMutex *KeyedMutex) Lock(key string) func()

Lock Locks on a key, allowing multiple threads to operate on separate keys. Returns a function, that clients should use to unlock the locks they've obtained.

type V2Client added in v1.12.0

type V2Client interface {
	connector.Authenticator
	GetTask(taskID string) (V2Task, error)
}

type V2ClientImpl added in v1.12.0

type V2ClientImpl struct {
	HTTPClient HTTPClient
	// contains filtered or unexported fields
}

func NewV2ClientImpl added in v1.12.0

func NewV2ClientImpl(wrapper connector.Wrapper) *V2ClientImpl

func (*V2ClientImpl) Authenticate added in v1.12.0

func (client *V2ClientImpl) Authenticate() error

Authenticate grab an access token and set it into the V2Client instance for later use

func (*V2ClientImpl) GetTask added in v1.12.0

func (client *V2ClientImpl) GetTask(taskID string) (V2Task, error)

type V2State added in v1.12.0

type V2State struct {
	Name string `json:"name"`
}

type V2Task added in v1.12.0

type V2Task struct {
	ID           string  `json:"id"`
	TaskState    V2State `json:"state"`
	TaskType     string  `json:"type"`
	ErrorMessage string  `json:"error_message"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL