Documentation
¶
Index ¶
- func ErrorCode(err error) string
- func HandleCredentialError(ctx context.Context, invalidator environs.CredentialInvalidator, err error) (bool, error)
- func HasDenialStatusCode(err error) bool
- func IsAuthorisationFailure(err error) bool
- func IsConflictError(err error) bool
- func IsForbiddenError(err error) bool
- func IsNotFoundError(err error) bool
- func MaybeHypervisorGenNotSupportedError(err error) (error, bool)
- func MaybeQuotaExceededError(err error) (error, bool)
- func SimpleError(err error) error
- func StatusCode(err error) int
- type RequestError
- type ServiceError
- type ServiceErrorDetail
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleCredentialError ¶
func HandleCredentialError(ctx context.Context, invalidator environs.CredentialInvalidator, err error) (bool, error)
HandleCredentialError determines if given error relates to invalid credential. If it is, the credential is invalidated. Original error is returned untouched.
func HasDenialStatusCode ¶
HasDenialStatusCode returns true of the error has a status code meaning that the credential is invalid.
func IsAuthorisationFailure ¶
IsAuthorisationFailure returns true if the error is caused by an authorisation failure.
func IsConflictError ¶
IsConflictError returns true if the error is caused by a deployment Conflict.
func IsForbiddenError ¶
IsForbiddenError returns true if the error is caused by a forbidden error.
func IsNotFoundError ¶
IsNotFoundError returns true if the error is caused by a not found error.
func MaybeHypervisorGenNotSupportedError ¶
MaybeHypervisorGenNotSupportedError returns the relevant error message and true if the error is caused by a Hypervisor Generation not supported for the selected VM size. Azure does not give a specific error code for this issue, so we have to check the error message. Example error message:
&errorutils.serviceError{ Code: "DeploymentFailed", Message: "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.", Details: { {Code:"BadRequest", Message:"{ "error": { "code": "BadRequest", "message": "The selected VM size 'Standard_D2_v2' cannot boot Hypervisor Generation '2'. If this was a Create operation please check that the Hypervisor Generation of the Image matches the Hypervisor Generation of the selected VM Size. If this was an Update operation please select a Hypervisor Generation '2' VM Size. For more information, see https://aka.ms/azuregen2vm" } }"}, }, }
func MaybeQuotaExceededError ¶
MaybeQuotaExceededError returns the relevant error message and true if the error is caused by a Quota Exceeded issue.
func SimpleError ¶
SimpleError returns an error with the "interesting" content from a ResponseError.
func StatusCode ¶
StatusCode returns the top level status code if the error is a ResponseError.
Types ¶
type RequestError ¶
type RequestError struct {
ServiceError *ServiceError `json:"error"`
}
RequestError represents an error response from Azure.
type ServiceError ¶
type ServiceError struct { Code string `json:"code"` Message string `json:"message"` Details []ServiceErrorDetail `json:"details"` }
ServiceError represents an error response from Azure.
type ServiceErrorDetail ¶
ServiceErrorDetail represents an error detail from Azure.