Documentation ¶
Overview ¶
Package rest implements a REST client for communicating with remote services.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccessToken ¶ added in v0.25.0
type AccessToken struct { AccessToken string `json:"access_token"` ExpiresIn int64 `json:"expires_in"` TokenType string `json:"token_type"` }
AccessToken holds a GCP access token.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements an HTTP/REST client for communicating with remote services.
func (Client) WithBytes ¶
WithBytes returns a shallow copy of the client with the bytes set as the message body to include in the requests.
func (Client) WithHeader ¶
WithHeader returns a shallow copy of the client with a header to include the requests.
type Config ¶
type Config struct { Name string `json:"name"` URL string `json:"url"` Headers map[string]string `json:"headers"` AllowInsureTLS bool `json:"allow_insecure_tls,omitempty"` ResponseHeaderTimeoutSeconds *int64 `json:"response_header_timeout_seconds,omitempty"` Credentials struct { Bearer *bearerAuthPlugin `json:"bearer,omitempty"` OAuth2 *oauth2ClientCredentialsAuthPlugin `json:"oauth2,omitempty"` ClientTLS *clientTLSAuthPlugin `json:"client_tls,omitempty"` S3Signing *awsSigningAuthPlugin `json:"s3_signing,omitempty"` GCPMetadata *gcpMetadataAuthPlugin `json:"gcp_metadata,omitempty"` } `json:"credentials"` }
Config represents configuration for a REST client.
type HTTPAuthPlugin ¶ added in v0.12.0
type HTTPAuthPlugin interface { // implementations can assume NewClient will be called before Prepare NewClient(c Config) (*http.Client, error) Prepare(req *http.Request) error }
An HTTPAuthPlugin represents a mechanism to construct and configure HTTP authentication for a REST service
Click to show internal directories.
Click to hide internal directories.