func GetRetriableError(err error) *Error {
	return &Error{
		Retriable: true,
		RawError:  err,
	}
}
GetRetriableError gets new retriable Error.
package retry
import (
	"bytes"
	"fmt"
	"io/ioutil"
	"net/http"
	"strconv"
	"strings"
	"time"
	"k8s.io/klog/v2"
)
const (
	RetryAfterHeaderKey = "Retry-After"
)
var (
	now = time.Now
	StatusCodesForRetry = []int{
		http.StatusRequestTimeout,       
		http.StatusInternalServerError,  
		http.StatusBadGateway,           
		http.StatusServiceUnavailable,   
		http.StatusGatewayTimeout,       
	}
)
type Error struct {
	Retriable bool
	HTTPStatusCode int
	RetryAfter time.Time
	RawError error
}
func (err *Error) Error() error {
	if err == nil {
		return nil
	}
	retryAfterSeconds := 0
	curTime := now()
	if err.RetryAfter.After(curTime) {
		retryAfterSeconds = int(err.RetryAfter.Sub(curTime) / time.Second)
	}
	return fmt.Errorf("Retriable: %v, RetryAfter: %ds, HTTPStatusCode: %d, RawError: %w",
		err.Retriable, retryAfterSeconds, err.HTTPStatusCode, err.RawError)
}
func (err *Error) IsThrottled() bool {
	if err == nil {
		return false
	}
	return err.HTTPStatusCode == http.StatusTooManyRequests || err.RetryAfter.After(now())
}
func (err *Error) IsNotFound() bool {
	if err == nil {
		return false
	}
	return err.HTTPStatusCode == http.StatusNotFound
}
func NewError(retriable bool, err error) *Error {
	return &Error{
		Retriable: retriable,
		RawError:  err,
	}
}