Documentation
¶
Index ¶
- Constants
- type AuthInitError
- type AuthPrepError
- type ClientError
- func IsChangesetInstanceMismatchError(err error) (*ClientError, bool)
- func IsDeployChangesetError(err error) (*ClientError, bool)
- func IsDestroyChangesetError(err error) (*ClientError, bool)
- func IsDriftBlockedError(err error) (*ClientError, bool)
- func IsInstanceAlreadyExistsError(err error) (*ClientError, bool)
- func IsNotFoundError(err error) (*ClientError, bool)
- func IsValidationError(err error) (*ClientError, bool)
- type DeserialiseError
- type RequestError
- type RequestPrepError
- type Response
- type SerialiseError
- type StreamError
- type ValidationError
Constants ¶
const ErrorCodeChangesetInstanceMismatch = "CHANGESET_INSTANCE_MISMATCH"
ErrorCodeChangesetInstanceMismatch is the error code returned with a 409 when a deploy or destroy uses a change set staged for a different target: another instance, a new instance when the target exists, or an existing instance when the request creates one. ClientError.ChangesetInstanceID and ClientError.InstanceID hold the two instances.
const ErrorCodeDeployChangeset = "DEPLOY_CHANGESET"
ErrorCodeDeployChangeset is the error code returned when attempting to destroy using a changeset that was created for a deploy operation.
const ErrorCodeDestroyChangeset = "DESTROY_CHANGESET"
ErrorCodeDestroyChangeset is the error code returned when attempting to deploy using a changeset that was created for a destroy operation.
const ErrorCodeInstanceAlreadyExists = "INSTANCE_ALREADY_EXISTS"
ErrorCodeInstanceAlreadyExists is the error code returned with a 409 when a request to create a blueprint instance names an instance that already exists. ClientError.InstanceID holds the ID of the existing instance when the engine found it, so a caller can update that instance instead.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthInitError ¶
type AuthInitError struct {
Message string
}
AuthInitError is an error type that indicates an issue with initialising auth configuration when creating a new deploy engine client.
func (*AuthInitError) Error ¶
func (e *AuthInitError) Error() string
type AuthPrepError ¶
type AuthPrepError struct {
Message string
}
AuthPrepError is an error type that indicates an issue with preparing authentication headers for a request.
func (*AuthPrepError) Error ¶
func (e *AuthPrepError) Error() string
type ClientError ¶
type ClientError struct {
StatusCode int
Message string
// Code is an optional error code that provides more specific information
// about the error type. This allows clients to handle specific errors
// programmatically without relying on message string matching.
Code string
// An optional list of validation errors that will usually
// be populated for 422 responses for input validation errors.
ValidationErrors []*ValidationError
// An optional list of diagnostics that provide additional information
// about validation errors related to failed attempts to load a blueprint
// document.
// This will usually be populated for 422 responses.
ValidationDiagnostics []*core.Diagnostic
// DriftBlockedResponse is populated for 409 responses when an operation
// is blocked due to drift detection. Contains the reconciliation result
// and changeset ID for continuing after reconciliation.
DriftBlockedResponse *types.DriftBlockedResponse
// InstanceID is set on a 409 to the instance the conflict involves. For
// ErrorCodeInstanceAlreadyExists, it is the instance that holds the requested name,
// and is empty when that instance was removed before the engine could look it up.
// The name has then most likely been freed, and as nothing was deployed, retrying
// the create is safe and may succeed.
// For ErrorCodeChangesetInstanceMismatch, it is the instance the change set was
// applied to, and is empty when the change set was applied to a new instance.
InstanceID string
// ChangesetInstanceID is set for ErrorCodeChangesetInstanceMismatch to the instance
// the change set was staged for, and is empty when it was staged for a new instance.
ChangesetInstanceID string
}
ClientError is an error type that indicates an unexpected response from the deploy engine client. This will usually wrap a non-2xx status code and an error message from the server.
func IsChangesetInstanceMismatchError ¶ added in v0.6.0
func IsChangesetInstanceMismatchError(err error) (*ClientError, bool)
IsChangesetInstanceMismatchError checks if the error is a client error indicating that a change set was used with an instance it wasn't staged for.
func IsDeployChangesetError ¶ added in v0.2.0
func IsDeployChangesetError(err error) (*ClientError, bool)
IsDeployChangesetError checks if the error is a client error indicating that a deploy changeset was used with a destroy operation.
func IsDestroyChangesetError ¶ added in v0.2.0
func IsDestroyChangesetError(err error) (*ClientError, bool)
IsDestroyChangesetError checks if the error is a client error indicating that a destroy changeset was used with a deploy operation.
func IsDriftBlockedError ¶ added in v0.2.0
func IsDriftBlockedError(err error) (*ClientError, bool)
IsDriftBlockedError checks if the error is a client error with a 409 status code, indicating that the operation is blocked due to drift detection. When true, the ClientError.DriftBlockedResponse field will contain the reconciliation result and changeset ID. This also returns the concrete client error that allows the caller access to more precise information about the error.
func IsInstanceAlreadyExistsError ¶ added in v0.6.0
func IsInstanceAlreadyExistsError(err error) (*ClientError, bool)
IsInstanceAlreadyExistsError checks if the error is a client error indicating that the instance name given to create a blueprint instance is in use.
func IsNotFoundError ¶
func IsNotFoundError(err error) (*ClientError, bool)
IsNotFoundError checks if the error is a client error with a 404 status code, indicating that the requested resource was not found. This also returns the concrete client error that allows the caller access to more precise information about the error.
func IsValidationError ¶
func IsValidationError(err error) (*ClientError, bool)
IsValidationError checks if the error is a client error with a 422 or 400 status code, indicating that one or more elements of the request failed validation. This also returns the concrete client error that allows the caller access to more precise information about the error.
func (*ClientError) Error ¶
func (e *ClientError) Error() string
type DeserialiseError ¶
type DeserialiseError struct {
Message string
}
DeserialiseError is an error type that indicates an issue with deserialising a request or response.
func (*DeserialiseError) Error ¶
func (e *DeserialiseError) Error() string
type RequestError ¶
type RequestError struct {
Err error
}
RequestError is an error type that indicates an issue with making a request to the deploy engine client. This will usually wrap a network or timeout error.
func (*RequestError) Error ¶
func (e *RequestError) Error() string
type RequestPrepError ¶
type RequestPrepError struct {
Message string
}
RequestPrepError is an error type that indicates an issue with preparing a request for the deploy engine client.
func (*RequestPrepError) Error ¶
func (e *RequestPrepError) Error() string
type Response ¶
type Response struct {
Message string `json:"message"`
Code string `json:"code,omitempty"`
Errors []*ValidationError `json:"errors,omitempty"`
Diagnostics []*core.Diagnostic `json:"validationDiagnostics,omitempty"`
// InstanceID and ChangesetInstanceID are set on 409 responses,
// as ClientError describes.
InstanceID string `json:"instanceId,omitempty"`
ChangesetInstanceID string `json:"changesetInstanceId,omitempty"`
}
Response is a struct that represents a JSON error response from the Deploy Engine API.
type SerialiseError ¶
type SerialiseError struct {
Message string
}
SerialiseError is an error type that indicates an issue with serialising a request or response.
func (*SerialiseError) Error ¶
func (e *SerialiseError) Error() string
type StreamError ¶
type StreamError struct {
Event *types.StreamErrorMessageEvent
}
StreamError is an error type that indicates an unexpected error during an operation that can be streamed.
func (*StreamError) Error ¶
func (e *StreamError) Error() string
type ValidationError ¶
type ValidationError struct {
Location string `json:"location"`
Message string `json:"message"`
Type string `json:"type"`
}
ValidationError is a struct that represents a validation error that can be returned in responses to clients.