internal

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToString

func ToString(o interface{}) string

Types

type Api added in v0.4.0

type Api interface {
	// WaitForResourceId will poll the Task, waiting for the Task to finish processing, where it will then return.
	// An error will be returned if the Task couldn't be retrieved or the Task was not processed successfully.
	//
	// The Task will be continuously polled until the Task either fails or succeeds - cancellation can be achieved
	// by cancelling the context.
	WaitForResourceId(ctx context.Context, id string) (int, error)

	// Wait will poll the Task, waiting for the Task to finish processing, where it will then return.
	// An error will be returned if the Task couldn't be retrieved or the Task was not processed successfully.
	//
	// The Task will be continuously polled until the Task either fails or succeeds - cancellation can be achieved
	// by cancelling the context.
	Wait(ctx context.Context, id string) error

	// WaitForResource will poll the Task, waiting for the Task to finish processing, where it will then marshal the
	// returned resource into the value pointed to be `resource`.
	//
	// The Task will be continuously polled until the Task either fails or succeeds - cancellation can be achieved
	// by cancelling the context.
	WaitForResource(ctx context.Context, id string, resource interface{}) error

	// WaitForTask will poll the Task, waiting for it to enter a terminal state (i.e Done or Error). This Task
	// will then be returned, or an error in case it cannot be retrieved.
	WaitForTask(ctx context.Context, id string) (*Task, error)
}

func NewAPI

func NewAPI(client *HttpClient, logger Log) Api

type Error

type Error struct {
	Type        *string `json:"type,omitempty"`
	Description *string `json:"description,omitempty"`
	Status      *string `json:"status,omitempty"`
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) StatusCode

func (e *Error) StatusCode() string

func (Error) String

func (o Error) String() string

type HTTPError

type HTTPError struct {
	Name       string
	StatusCode int
	Body       []byte
}

func (*HTTPError) Error

func (h *HTTPError) Error() string

type HttpClient

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

func NewHttpClient

func NewHttpClient(client *http.Client, baseUrl string) (*HttpClient, error)

func (*HttpClient) Delete

func (c *HttpClient) Delete(ctx context.Context, name, path string, responseBody interface{}) error

func (*HttpClient) DeleteWithQuery added in v0.1.11

func (c *HttpClient) DeleteWithQuery(ctx context.Context, name, path string, requestBody interface{}, responseBody interface{}) error

func (*HttpClient) Get

func (c *HttpClient) Get(ctx context.Context, name, path string, responseBody interface{}) error

func (*HttpClient) GetWithQuery

func (c *HttpClient) GetWithQuery(ctx context.Context, name, path string, query url.Values, responseBody interface{}) error

func (*HttpClient) Post

func (c *HttpClient) Post(ctx context.Context, name, path string, requestBody interface{}, responseBody interface{}) error

func (*HttpClient) Put

func (c *HttpClient) Put(ctx context.Context, name, path string, requestBody interface{}, responseBody interface{}) error

type Log

type Log interface {
	Println(v ...interface{})
}

type Task added in v0.9.0

type Task struct {
	CommandType *string   `json:"commandType,omitempty"`
	Description *string   `json:"description,omitempty"`
	Status      *string   `json:"status,omitempty"`
	ID          *string   `json:"taskId,omitempty"`
	Response    *response `json:"response,omitempty"`
}

func (Task) String added in v0.9.0

func (o Task) String() string

type TaskResponse added in v0.5.0

type TaskResponse struct {
	ID *string `json:"taskId,omitempty"`
}

TaskResponse is the high-level response when a Create/Update/Delete operation is in progress.

func (TaskResponse) String added in v0.5.0

func (o TaskResponse) String() string

Jump to

Keyboard shortcuts

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