Documentation
¶
Index ¶
- Constants
- func HasNotFoundError(diags diag.Diagnostics) bool
- func NewBadRequestError(operation Operation, detail string) diag.ErrorDiagnostic
- func NewConflictError(operation Operation, detail string) diag.ErrorDiagnostic
- func NewDiagnosticFromAPIError(operation Operation, err error, apiScopes []scopes.Scope, ...) diag.Diagnostic
- func NewDiagnosticFromPayloadErrors(operation Operation, payloadErrors []*models.MsaAPIError) diag.Diagnostic
- func NewEmptyResponseError(operation Operation) diag.ErrorDiagnostic
- func NewForbiddenError(operation Operation, requiredScopes []scopes.Scope) diag.ErrorDiagnostic
- func NewNotFoundError(detail string) diag.ErrorDiagnostic
- func NewOperationError(operation Operation, err error) diag.ErrorDiagnostic
- func NewResourceNotFoundWarningDiagnostic() diag.Diagnostic
- func NewTooManyRequestsError(operation Operation, detail string) diag.ErrorDiagnostic
- type ErrorOption
- func WithBadRequestDetail(detail string) ErrorOption
- func WithConflictDetail(detail string) ErrorOption
- func WithDetail(detail string) ErrorOption
- func WithForbiddenDetail(detail string) ErrorOption
- func WithNotFoundDetail(detail string) ErrorOption
- func WithServerErrorDetail(detail string) ErrorOption
- func WithTooManyRequestsDetail(detail string) ErrorOption
- type Operation
Constants ¶
const NotFoundErrorSummary = "Resource Not Found"
NotFoundErrorSummary is the standard summary message for resource not found errors. This constant should be used when checking diagnostic summaries to detect not found errors.
Variables ¶
This section is empty.
Functions ¶
func HasNotFoundError ¶
func HasNotFoundError(diags diag.Diagnostics) bool
HasNotFoundError checks if diagnostics contains a not found error.
func NewBadRequestError ¶ added in v0.0.61
func NewBadRequestError(operation Operation, detail string) diag.ErrorDiagnostic
NewBadRequestError creates a diagnostic error for 400 Conflict responses.
func NewConflictError ¶ added in v0.0.60
func NewConflictError(operation Operation, detail string) diag.ErrorDiagnostic
NewConflictError creates a diagnostic error for 409 Conflict responses.
func NewDiagnosticFromAPIError ¶ added in v0.0.61
func NewDiagnosticFromAPIError(operation Operation, err error, apiScopes []scopes.Scope, options ...ErrorOption) diag.Diagnostic
NewDiagnosticFromAPIError converts a gofalcon API error into a Terraform diagnostic.
func NewDiagnosticFromPayloadErrors ¶ added in v0.0.62
func NewDiagnosticFromPayloadErrors(operation Operation, payloadErrors []*models.MsaAPIError) diag.Diagnostic
NewDiagnosticFromPayloadErrors converts API payload errors to a Terraform diagnostic. This function checks for application-level errors within the API response payload using falcon.AssertNoError to convert MsaAPIError list to golang errors. Returns nil if there are no payload errors.
func NewEmptyResponseError ¶ added in v0.0.48
func NewEmptyResponseError(operation Operation) diag.ErrorDiagnostic
NewEmptyResponseError creates a diagnostic error for when an API returns no data.
func NewForbiddenError ¶ added in v0.0.48
func NewForbiddenError(operation Operation, requiredScopes []scopes.Scope) diag.ErrorDiagnostic
NewForbiddenError creates a diagnostic error for 403 Forbidden responses.
func NewNotFoundError ¶
func NewNotFoundError(detail string) diag.ErrorDiagnostic
NewNotFoundError creates a diagnostic error for when a resource is not found.
func NewOperationError ¶ added in v0.0.48
func NewOperationError(operation Operation, err error) diag.ErrorDiagnostic
NewOperationError creates a diagnostic error for general operation failures.
func NewResourceNotFoundWarningDiagnostic ¶ added in v0.0.57
func NewResourceNotFoundWarningDiagnostic() diag.Diagnostic
func NewTooManyRequestsError ¶ added in v0.0.65
func NewTooManyRequestsError(operation Operation, detail string) diag.ErrorDiagnostic
NewTooManyRequestsError creates a diagnostic error for 429 Too Many Requests responses.
Types ¶
type ErrorOption ¶ added in v0.0.61
type ErrorOption func(*errorConfig)
ErrorOption configures optional behavior for NewDiagnosticFromAPIError.
func WithBadRequestDetail ¶ added in v0.0.61
func WithBadRequestDetail(detail string) ErrorOption
WithBadRequestDetail provides a custom detail message for 400 Bad Request errors.
func WithConflictDetail ¶ added in v0.0.61
func WithConflictDetail(detail string) ErrorOption
WithConflictDetail provides a custom detail message for 409 Conflict errors.
func WithDetail ¶ added in v0.0.61
func WithDetail(detail string) ErrorOption
WithDetail provides a custom detail message for all other errors.
func WithForbiddenDetail ¶ added in v0.0.61
func WithForbiddenDetail(detail string) ErrorOption
WithForbiddenDetail provides a custom detail message for 403 Forbidden errors. If not provided, defaults to the API scope requirements.
func WithNotFoundDetail ¶ added in v0.0.61
func WithNotFoundDetail(detail string) ErrorOption
WithNotFoundDetail provides a custom detail message for 404 Not Found errors.
func WithServerErrorDetail ¶ added in v0.0.61
func WithServerErrorDetail(detail string) ErrorOption
WithServerErrorDetail provides a custom detail message for 5xx server errors.
func WithTooManyRequestsDetail ¶ added in v0.0.65
func WithTooManyRequestsDetail(detail string) ErrorOption
WithTooManyRequestsDetail provides a custom detail message for 429 Too Many Requests errors.