commoncloudavenue

package
v0.21.3 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(e error) bool

IsNotFound - Returns true if the error is a 404.

func ToError

func ToError(e *APIErrorResponse) error

ToError - Converts an APIErrorResponse to an error.

Types

type APIErrorResponse

type APIErrorResponse struct {
	Code    string `json:"code"`
	Reason  string `json:"reason"`
	Message string `json:"message"`
}

func (*APIErrorResponse) FormatError

func (e *APIErrorResponse) FormatError() string

FormatError - Formats the error.

type JobCreatedAPIResponse

type JobCreatedAPIResponse struct {
	Message string `json:"message"`
	JobID   string `json:"jobId"`
}

JobCreatedAPIResponse - This is the response structure for the JobCreatedAPIResponse.

func (*JobCreatedAPIResponse) GetJobStatus

func (j *JobCreatedAPIResponse) GetJobStatus() (response *JobStatus, err error)

GetJobStatus - Returns the status of a job.

type JobStatus

type JobStatus struct {
	JobID   string `json:"jobId,omitempty"`
	Actions []struct {
		Name    string `json:"name"`
		Status  string `json:"status"`
		Details string `json:"details"`
	} `json:"actions"`
	Description string           `json:"description"`
	Name        string           `json:"name"`
	Status      JobStatusMessage `json:"status"`
}

JobStatus - This is the response structure for the JobStatus.

func (*JobStatus) IsDone

func (j *JobStatus) IsDone() bool

IsDone - Returns true if the job is done with a success.

func (*JobStatus) OnError added in v0.11.0

func (j *JobStatus) OnError() bool

OnError - Returns true if the job is done with an error.

func (*JobStatus) Refresh

func (j *JobStatus) Refresh() error

Refresh - Refreshes the job status.

func (*JobStatus) Wait

func (j *JobStatus) Wait(refreshInterval, timeout int) error

Wait - Waits for the job to be done refreshInterval - The interval in seconds between each refresh timeout - The timeout in seconds.

func (*JobStatus) WaitWithContext added in v0.11.0

func (j *JobStatus) WaitWithContext(ctx context.Context, refreshInterval int) error

WaitWithContext - Waits for the job to be done refreshInterval - The interval in seconds between each refresh.

type JobStatusMessage

type JobStatusMessage string

JobStatusMessage is a type for job status.

const (
	// DONE is the done status message.
	DONE JobStatusMessage = "DONE"
	// FAILED is the failed status message.
	FAILED JobStatusMessage = "FAILED"
	// CREATED is the created status message.
	CREATED JobStatusMessage = "CREATED"
	// PENDING is the pending status message.
	PENDING JobStatusMessage = "PENDING"
	// INPROGRESS is the in progress status message.
	INPROGRESS JobStatusMessage = "IN_PROGRESS"
	// ERROR is the error status message.
	ERROR JobStatusMessage = "ERROR"
)

Jump to

Keyboard shortcuts

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