Documentation ¶
Index ¶
- Constants
- func GetRollbackRetriesLimit(rollbackRetriesLimit *int32) int32
- func IsHTTPError(statusCode int) bool
- func IsHTTPSuccess(statusCode int) bool
- func IsRequestValid(method string, url string) error
- func IsUrlValid(input string) bool
- func NormalizeWhitespace(input string) string
- func RetriesLimitReached(statusFailed int32, rollbackRetriesLimit *int32) bool
- func RollBackEnabled(rollbackRetriesLimit *int32) bool
- func SetRequestResourceStatus(rr RequestResource, statusFuncs ...SetRequestStatusFunc) error
- func ShouldRetry(rollbackRetriesLimit *int32, statusFailed int32) bool
- func WaitTimeout(timeout *v1.Duration) time.Duration
- type CacheSetter
- type ErrorSetter
- type LastReconcileTimeSetter
- type RequestDetailsSetter
- type RequestResource
- func (rr *RequestResource) ResetFailures() SetRequestStatusFunc
- func (rr *RequestResource) SetBody() SetRequestStatusFunc
- func (rr *RequestResource) SetCache() SetRequestStatusFunc
- func (rr *RequestResource) SetError(err error) SetRequestStatusFunc
- func (rr *RequestResource) SetHeaders() SetRequestStatusFunc
- func (rr *RequestResource) SetLastReconcileTime() SetRequestStatusFunc
- func (rr *RequestResource) SetRequestDetails() SetRequestStatusFunc
- func (rr *RequestResource) SetStatusCode() SetRequestStatusFunc
- func (rr *RequestResource) SetSynced() SetRequestStatusFunc
- type ResetFailures
- type ResponseSetter
- type SetRequestStatusFunc
- type SyncedSetter
Constants ¶
const ( ErrInvalidURL = "invalid url %s" ErrStatusCode = "HTTP %s request failed with status code: %s" )
const (
ErrFailedToSetStatus = "failed to update status"
)
Variables ¶
This section is empty.
Functions ¶
func GetRollbackRetriesLimit ¶
GetRollbackRetriesLimit returns the rollback retries limit.
func IsHTTPError ¶
IsHTTPError checks if an HTTP status code indicates an error.
func IsHTTPSuccess ¶
IsHTTPSuccess checks if an HTTP status code indicates success.
func IsRequestValid ¶
IsRequestValid checks if an HTTP request is valid.
func IsUrlValid ¶
func NormalizeWhitespace ¶ added in v1.0.5
NormalizeWhitespace removes extra whitespace from a string.
func RetriesLimitReached ¶
RetriesLimitReached determines if the rollback retries limit has been reached.
func RollBackEnabled ¶
RollBackEnabled determines if the rollback retries limit is enabled.
func SetRequestResourceStatus ¶
func SetRequestResourceStatus(rr RequestResource, statusFuncs ...SetRequestStatusFunc) error
SetRequestResourceStatus sets the status of a resource.
func ShouldRetry ¶
ShouldRetry determines if the request should be retried based on the status of the request and the rollback retries limit.
Types ¶
type CacheSetter ¶
CacheSetter is an interface that defines the method to set the cache of a resource.
type ErrorSetter ¶
type ErrorSetter interface {
SetError(err error)
}
ErrorSetter is an interface that defines the method to set the error of a resource.
type LastReconcileTimeSetter ¶ added in v1.0.2
type LastReconcileTimeSetter interface {
SetLastReconcileTime()
}
LastReconcileTimeSetter is an interface that defines the method to set the last reconcile time of a resource.
type RequestDetailsSetter ¶
type RequestDetailsSetter interface {
SetRequestDetails(url, method, body string, headers map[string][]string)
}
RequestDetailsSetter is an interface that defines the method to set the request details of a resource.
type RequestResource ¶
type RequestResource struct { Resource client.Object RequestContext context.Context HttpResponse httpClient.HttpResponse HttpRequest httpClient.HttpRequest LocalClient client.Client }
RequestResource is a struct that holds the resource, request context, http response, http request, and local client.
func (*RequestResource) ResetFailures ¶
func (rr *RequestResource) ResetFailures() SetRequestStatusFunc
func (*RequestResource) SetBody ¶
func (rr *RequestResource) SetBody() SetRequestStatusFunc
func (*RequestResource) SetCache ¶
func (rr *RequestResource) SetCache() SetRequestStatusFunc
func (*RequestResource) SetError ¶
func (rr *RequestResource) SetError(err error) SetRequestStatusFunc
func (*RequestResource) SetHeaders ¶
func (rr *RequestResource) SetHeaders() SetRequestStatusFunc
func (*RequestResource) SetLastReconcileTime ¶ added in v1.0.2
func (rr *RequestResource) SetLastReconcileTime() SetRequestStatusFunc
func (*RequestResource) SetRequestDetails ¶
func (rr *RequestResource) SetRequestDetails() SetRequestStatusFunc
func (*RequestResource) SetStatusCode ¶
func (rr *RequestResource) SetStatusCode() SetRequestStatusFunc
func (*RequestResource) SetSynced ¶
func (rr *RequestResource) SetSynced() SetRequestStatusFunc
type ResetFailures ¶
type ResetFailures interface {
ResetFailures()
}
ResetFailures is an interface that defines the method to reset the failures of a resource.
type ResponseSetter ¶
type ResponseSetter interface { SetStatusCode(statusCode int) SetHeaders(headers map[string][]string) SetBody(body string) }
ResponseSetter is an interface that defines the methods to set the status code, headers, and body of a resource.
type SetRequestStatusFunc ¶
type SetRequestStatusFunc func()
SetRequestStatusFunc is a function that sets the status of a resource.
type SyncedSetter ¶
type SyncedSetter interface {
SetSynced(synced bool)
}
SyncedSetter is an interface that defines the method to set the synced status of a resource.