Documentation ¶
Index ¶
- Variables
- func FormatPingOneError(sdkMethod string, v model.P1Error) (summaryText, detailText string)
- func ParseResponse(ctx context.Context, f SDKInterfaceFunc, sdkMethod string, ...) (interface{}, diag.Diagnostics)
- func ParseResponseWithCustomTimeout(ctx context.Context, f SDKInterfaceFunc, sdkMethod string, ...) (interface{}, diag.Diagnostics)
- func RetryWrapper(ctx context.Context, timeout time.Duration, f SDKInterfaceFunc, ...) (interface{}, *http.Response, error)
- type CustomError
- type Retryable
- type SDKInterfaceFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultRetryable = func(ctx context.Context, r *http.Response, p1error *model.P1Error) bool { return false } DefaultCreateReadRetryable = func(ctx context.Context, r *http.Response, p1error *model.P1Error) bool { if p1error != nil { var err error m, err := regexp.MatchString("^The actor attempting to perform the request is not authorized.", p1error.GetMessage()) if err == nil && m { tflog.Warn(ctx, "Insufficient PingOne privileges detected") return true } if err != nil { tflog.Warn(ctx, "Cannot match error string for retry") return false } } return false } )
View Source
var ( DefaultCustomError = func(error model.P1Error) diag.Diagnostics { return nil } CustomErrorResourceNotFoundWarning = func(error model.P1Error) diag.Diagnostics { var diags diag.Diagnostics if error.GetCode() == "NOT_FOUND" { diags = append(diags, diag.Diagnostic{ Severity: diag.Warning, Summary: error.GetMessage(), }) return diags } return nil } CustomErrorInvalidValue = func(error model.P1Error) diag.Diagnostics { var diags diag.Diagnostics if details, ok := error.GetDetailsOk(); ok && details != nil && len(details) > 0 { if target, ok := details[0].GetTargetOk(); ok && details[0].GetCode() == "INVALID_VALUE" && *target == "name" { diags = diag.FromErr(fmt.Errorf("%s", details[0].GetMessage())) return diags } } return nil } )
Functions ¶
func FormatPingOneError ¶ added in v1.0.0
func ParseResponse ¶
func ParseResponse(ctx context.Context, f SDKInterfaceFunc, sdkMethod string, customError CustomError, customRetryConditions Retryable) (interface{}, diag.Diagnostics)
func ParseResponseWithCustomTimeout ¶ added in v0.4.0
func ParseResponseWithCustomTimeout(ctx context.Context, f SDKInterfaceFunc, sdkMethod string, customError CustomError, customRetryConditions Retryable, timeout time.Duration) (interface{}, diag.Diagnostics)
Types ¶
type CustomError ¶
type CustomError func(model.P1Error) diag.Diagnostics
Click to show internal directories.
Click to hide internal directories.