-
Notifications
You must be signed in to change notification settings - Fork 46
/
interface.go
26 lines (19 loc) · 1.01 KB
/
interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package client
import (
"context"
"net/http"
"github.com/hashicorp/go-azure-sdk/sdk/odata"
)
type BaseClient interface {
Execute(ctx context.Context, req *Request) (*Response, error)
ExecutePaged(ctx context.Context, req *Request) (*Response, error)
NewRequest(ctx context.Context, input RequestOptions) (*Request, error)
}
// RequestRetryFunc is a function that determines whether an HTTP request has failed due to eventual consistency and should be retried
type RequestRetryFunc func(*http.Response, *odata.OData) (bool, error)
// RequestMiddleware can manipulate or log a request before it is sent
type RequestMiddleware func(*http.Request) (*http.Request, error)
// ResponseMiddleware can manipulate or log a response before it is parsed and returned
type ResponseMiddleware func(*http.Request, *http.Response) (*http.Response, error)
// ValidStatusFunc is a function that tests whether an HTTP response is considered valid for the particular request.
type ValidStatusFunc func(*http.Response, *odata.OData) bool