helpers

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package helpers provides api errors helpers for the CloudAvenue Terraform Provider.

Package helpers provides auth helpers for the CloudAvenue Terraform Provider.

Package helpers provides configuration helpers for Terraform Provider.

Package helpers provides helpers for the CloudAvenue Terraform Provider.

Index

Constants

View Source
const (
	// ForceNewDescription is the description for ForceNew.
	ForceNewDescription = "Changes to this field will force a new resource to be created."
)

Variables

This section is empty.

Functions

func GetAuthContextWithTO

func GetAuthContextWithTO(apiCtx, tfCtx context.Context) (context.Context, error)

GetAuthContextWithTO is a helper function to create the auth context with the token api and the terraform context with timeout.

func JobStateDone

func JobStateDone() []string

JobStateDone is a helper function to return an array of done states.

func JobStatePending

func JobStatePending() []string

JobStatePending is a helper function to return an array of pending states.

Types

type APIError

type APIError struct {
	cloudavenue.ApiError
	// contains filtered or unexported fields
}

APIError is an error returned by the CloudAvenue API.

func CheckAPIError

func CheckAPIError(err error, httpR *http.Response) *APIError

CheckAPIError checks the HTTP response for errors and returns an APIError with statusCode and model is the error is a cloudavenue.GenericSwaggerError type or only the error if not.

func (*APIError) Error

func (e *APIError) Error() string

Error returns the error message.

func (*APIError) GetDetail

func (e *APIError) GetDetail() string

GetDetail returns a detailed description of the error.

func (*APIError) GetStatusCode

func (e *APIError) GetStatusCode() int

GetStatusCode returns the HTTP status code.

func (*APIError) GetSummary

func (e *APIError) GetSummary() string

GetSummary returns a summary of the error.

func (*APIError) GetTerraformDiagnostic

func (e *APIError) GetTerraformDiagnostic() diag.Diagnostic

GetTerraformDiagnostic returns a Terraform Diagnostic for the error.

func (*APIError) IsNotFound

func (e *APIError) IsNotFound() bool

IsNotFound returns true if the error is a 404 Not Found error.

func (*APIError) Unwrap

func (e *APIError) Unwrap() error

Unwrap returns the underlying error.

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"
)

func GetJobStatus

func GetJobStatus(
	ctx context.Context,
	client *client.CloudAvenue,
	jobID string,
) (JobStatusMessage, error)

GetJobStatus is a helper function to get the status of a job.

func (JobStatusMessage) IsDone

func (j JobStatusMessage) IsDone() bool

IsDone is a helper function to check if a job is done.

func (JobStatusMessage) String

func (j JobStatusMessage) String() string

String is a stringer interface for jobStatus.

Jump to

Keyboard shortcuts

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