Documentation
¶
Index ¶
- func CopyBody(req *http.Request) ([]byte, error)
- func Decode(body io.ReadCloser, v interface{}) error
- func ExponentialBackoff(retry int)
- func IsClosedConnectionErr(err error) bool
- func NewClientAssertion(tokenUrl string, clientId string, clientCert string, signingKey string, ...) (string, error)
- func NewHTTPClient(proxyUrl string) (*http.Client, error)
- func NewRequest(ctx context.Context, verb string, endpoint *url.URL, body interface{}, ...) (*http.Request, error)
- func ParseAud(accessToken string) (string, error)
- func ParseBody(accessToken string) (map[string]interface{}, error)
- type AuthStrategy
- type Authenticator
- type GenericAuthStrategy
- type IntOrStringInt
- type ManagedIdentityAuthStrategy
- type RestClient
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
func Decode(body io.ReadCloser, v interface{}) error
func ExponentialBackoff ¶ added in v2.1.9
func ExponentialBackoff(retry int)
func IsClosedConnectionErr ¶ added in v2.1.9
func NewClientAssertion ¶
func NewRequest ¶
Types ¶
type AuthStrategy ¶ added in v2.3.0
type AuthStrategy interface {
// contains filtered or unexported methods
}
AuthStrategy is an interface that defines the methods that an authentication strategy must implement
type Authenticator ¶ added in v2.3.0
type Authenticator struct {
// contains filtered or unexported fields
}
Authenticator manages the authentication process, using a specific AuthStrategy
func NewGenericAuthenticator ¶ added in v2.3.0
NewGenericAuthenticator creates a new Authenticator using the GenericAuthStrategy (The collection of pre-existing authentication methods)
func NewManagedIdentityAuthenticator ¶ added in v2.3.0
func NewManagedIdentityAuthenticator(config config.Config, auth *url.URL, api *url.URL, http *http.Client) *Authenticator
NewManagedIdentityAuthenticator creates a new Authenticator using the ManagedIdentityAuthStrategy
func (*Authenticator) AddAuthenticationToRequest ¶ added in v2.3.0
func (s *Authenticator) AddAuthenticationToRequest(restClient *restClient, req *http.Request) (*http.Request, error)
Authenticate if needed and add authentication to the request
type GenericAuthStrategy ¶ added in v2.3.0
type GenericAuthStrategy struct {
// contains filtered or unexported fields
}
GenericAuthStrategy is an authentication strategy that uses a bunch of pre-existing authentication methods (TODO: Break this up)
type IntOrStringInt ¶ added in v2.3.0
type IntOrStringInt int
Authentication response expires_in may be a string of digits or just an int
func (*IntOrStringInt) UnmarshalJSON ¶ added in v2.3.0
func (ios *IntOrStringInt) UnmarshalJSON(data []byte) error
type ManagedIdentityAuthStrategy ¶ added in v2.3.0
type ManagedIdentityAuthStrategy struct {
// contains filtered or unexported fields
}
ManagedIdentityAuthStrategy is an authentication strategy that uses Azure Managed Identity
type RestClient ¶
type RestClient interface { Delete(ctx context.Context, path string, body interface{}, params query.Params, headers map[string]string) (*http.Response, error) Get(ctx context.Context, path string, params query.Params, headers map[string]string) (*http.Response, error) Patch(ctx context.Context, path string, body interface{}, params query.Params, headers map[string]string) (*http.Response, error) Post(ctx context.Context, path string, body interface{}, params query.Params, headers map[string]string) (*http.Response, error) Put(ctx context.Context, path string, body interface{}, params query.Params, headers map[string]string) (*http.Response, error) Send(req *http.Request) (*http.Response, error) AddAuthenticationToRequest(req *http.Request) (*http.Request, error) CloseIdleConnections() }
func NewRestClient ¶
func NewRestClient(apiUrl string, config config.Config) (RestClient, error)