func retryPolicy()

in cmd/root.go [330:347]


func retryPolicy() func(ctx context.Context, resp *http.Response, err error) (bool, error) {
	return func(ctx context.Context, resp *http.Response, err error) (bool, error) {
		shouldRetry, newErr := retryablehttp.DefaultRetryPolicy(ctx, resp, err)
		if newErr != nil || shouldRetry {
			return shouldRetry, newErr
		}

		// GCE returns 403 as a RateLimiting response code.
		if resp.StatusCode == 403 {
			body, err := ioutil.ReadAll(resp.Body)
			if err != nil {
				return true, err
			}
			return true, errors.New(string(body))
		}
		return false, nil
	}
}