Documentation
¶
Index ¶
- Constants
- func IsAuthRequiredError(err error) bool
- func IsCircuitBreakerError(err error) bool
- func IsNotFoundError(err error) bool
- func IsPermissionDeniedError(err error) bool
- func IsQuotaExceededError(err error) bool
- func IsRateLimitError(err error) bool
- func NewAppScript(ctx context.Context, email string) (*script.Service, error)
- func NewCalendar(ctx context.Context, email string) (*calendar.Service, error)
- func NewChat(ctx context.Context, email string) (*chat.Service, error)
- func NewClassroom(ctx context.Context, email string) (*classroom.Service, error)
- func NewCloudIdentityGroups(ctx context.Context, email string) (*cloudidentity.Service, error)
- func NewDocs(ctx context.Context, email string) (*docs.Service, error)
- func NewDrive(ctx context.Context, email string) (*drive.Service, error)
- func NewForms(ctx context.Context, email string) (*forms.Service, error)
- func NewGmail(ctx context.Context, email string) (*gmail.Service, error)
- func NewKeep(ctx context.Context, email string) (*keep.Service, error)
- func NewKeepWithServiceAccount(ctx context.Context, serviceAccountPath, impersonateEmail string) (*keep.Service, error)
- func NewPeopleContacts(ctx context.Context, email string) (*people.Service, error)
- func NewPeopleDirectory(ctx context.Context, email string) (*people.Service, error)
- func NewPeopleOtherContacts(ctx context.Context, email string) (*people.Service, error)
- func NewSheets(ctx context.Context, email string) (*sheets.Service, error)
- func NewSlides(ctx context.Context, email string) (*slides.Service, error)
- func NewTasks(ctx context.Context, email string) (*tasks.Service, error)
- type AuthRequiredError
- type CircuitBreaker
- type CircuitBreakerError
- type NotFoundError
- type PermissionDeniedError
- type QuotaExceededError
- type RateLimitError
- type RetryTransport
Constants ¶
const ( // CircuitBreakerThreshold is the number of consecutive failures to open the circuit CircuitBreakerThreshold = 5 // CircuitBreakerResetTime is how long to wait before attempting to close the circuit CircuitBreakerResetTime = 30 * time.Second )
const ( // MaxRateLimitRetries is the maximum number of retries on 429 responses. MaxRateLimitRetries = 3 // RateLimitBaseDelay is the initial delay for rate limit exponential backoff. RateLimitBaseDelay = 1 * time.Second // Max5xxRetries is the maximum retries for server errors. Max5xxRetries = 1 // ServerErrorRetryDelay is the delay before retrying on 5xx errors. ServerErrorRetryDelay = 1 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func IsAuthRequiredError ¶ added in v0.4.0
IsAuthRequiredError checks if the error is an auth required error
func IsCircuitBreakerError ¶ added in v0.4.0
IsCircuitBreakerError checks if the error is a circuit breaker error
func IsNotFoundError ¶ added in v0.4.0
IsNotFoundError checks if the error is a not found error
func IsPermissionDeniedError ¶ added in v0.4.0
IsPermissionDeniedError checks if the error is a permission denied error
func IsQuotaExceededError ¶ added in v0.4.0
IsQuotaExceededError checks if the error is a quota exceeded error
func IsRateLimitError ¶ added in v0.4.0
IsRateLimitError checks if the error is a rate limit error
func NewAppScript ¶ added in v0.11.0
func NewClassroom ¶ added in v0.7.0
func NewCloudIdentityGroups ¶ added in v0.5.0
NewCloudIdentityGroups creates a Cloud Identity service for reading groups. This API allows non-admin users to list groups they belong to and view group members.
func NewKeepWithServiceAccount ¶ added in v0.5.0
func NewPeopleContacts ¶
func NewPeopleDirectory ¶
func NewPeopleOtherContacts ¶
Types ¶
type AuthRequiredError ¶
func (*AuthRequiredError) Error ¶
func (e *AuthRequiredError) Error() string
func (*AuthRequiredError) Unwrap ¶
func (e *AuthRequiredError) Unwrap() error
type CircuitBreaker ¶ added in v0.4.0
type CircuitBreaker struct {
// contains filtered or unexported fields
}
func NewCircuitBreaker ¶ added in v0.4.0
func NewCircuitBreaker() *CircuitBreaker
func (*CircuitBreaker) IsOpen ¶ added in v0.4.0
func (cb *CircuitBreaker) IsOpen() bool
func (*CircuitBreaker) RecordFailure ¶ added in v0.4.0
func (cb *CircuitBreaker) RecordFailure() bool
func (*CircuitBreaker) RecordSuccess ¶ added in v0.4.0
func (cb *CircuitBreaker) RecordSuccess()
func (*CircuitBreaker) State ¶ added in v0.4.0
func (cb *CircuitBreaker) State() string
type CircuitBreakerError ¶ added in v0.4.0
type CircuitBreakerError struct{}
CircuitBreakerError indicates the circuit breaker is open
func (*CircuitBreakerError) Error ¶ added in v0.4.0
func (e *CircuitBreakerError) Error() string
type NotFoundError ¶ added in v0.4.0
NotFoundError indicates the requested resource was not found
func (*NotFoundError) Error ¶ added in v0.4.0
func (e *NotFoundError) Error() string
type PermissionDeniedError ¶ added in v0.4.0
PermissionDeniedError indicates insufficient permissions
func (*PermissionDeniedError) Error ¶ added in v0.4.0
func (e *PermissionDeniedError) Error() string
type QuotaExceededError ¶ added in v0.4.0
type QuotaExceededError struct {
Resource string
}
QuotaExceededError indicates API quota was exceeded
func (*QuotaExceededError) Error ¶ added in v0.4.0
func (e *QuotaExceededError) Error() string
type RateLimitError ¶ added in v0.4.0
RateLimitError indicates rate limit was exceeded
func (*RateLimitError) Error ¶ added in v0.4.0
func (e *RateLimitError) Error() string
type RetryTransport ¶ added in v0.4.0
type RetryTransport struct {
Base http.RoundTripper
MaxRetries429 int
MaxRetries5xx int
BaseDelay time.Duration
CircuitBreaker *CircuitBreaker
}
RetryTransport wraps an http.RoundTripper with retry logic for rate limits (429) and server errors (5xx).
func NewRetryTransport ¶ added in v0.4.0
func NewRetryTransport(base http.RoundTripper) *RetryTransport
NewRetryTransport creates a RetryTransport with sensible defaults.