Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeResponse ¶
DecodeResponse decodes response body into a map.
func DefaultServerURL ¶
DefaultServerURL converts a host, host:port, or URL string to the default base server API path to use with a Client at a given API version following the standard conventions for an HTTP API.
Types ¶
type Client ¶
Client defines a common JAC CMS API client.
func NewClient ¶
func NewClient(cfg *ClientConfig) (*Client, error)
NewClient returns a API server client, which is an HTTP client.
type ClientConfig ¶
type ClientConfig struct { // Host must be a host string, a host:port pair, or a URL to the base of the apiserver. Host string // APIPath is a sub-path that points to an API root. APIPath string // ContentConfig contains settings that affect how objects are transformed when // sent to the server. ContentConfig *ContentConfig // BearerToken is needed when server requires Bearer authentication (not refreshable). BearerToken string // BearerTokenTag defines what tag name to be used. // If not set, default 'bearer' will be set. BearerTokenTag string TLSClientConfig *TLSClientConfig // The maximum length of time to wait before giving up on a server request. A value of zero means no timeout. Timeout time.Duration }
ClientConfig defines a config for creating a REST client.
type ContentConfig ¶
type ContentConfig struct { // AcceptContentTypes specifies the types the client will accept and is optional. // If not set, ContentType will be used to define the Accept header AcceptContentTypes string // ContentType will be set as the Accept header on requests made to the server, and // as the default content type on any object sent to the server. If not set, // "application/json" is used. ContentType string }
ContentConfig contains settings that affect how objects are transformed when sent to the server.
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request allows for building up a request to a server in a chained fashion. Any errors are stored until the end of your call, so you only have to check once.
type TLSClientConfig ¶
type TLSClientConfig struct { // Server should be accessed without verifying the TLS certificate. For testing only. Insecure bool // ServerName is passed to the server for SNI and is used in the client to check server // certificates against. If ServerName is empty, the hostname used to contact the // server is used. ServerName string // Server requires TLS client certificate authentication CertFile string // Server requires TLS client certificate authentication KeyFile string // Trusted root certificates for server CAFile string // CertData holds PEM-encoded bytes (typically read from a client certificate file). // CertData takes precedence over CertFile CertData []byte // KeyData holds PEM-encoded bytes (typically read from a client certificate key file). // KeyData takes precedence over KeyFile KeyData []byte // CAData holds PEM-encoded bytes (typically read from a root certificates bundle). // CAData takes precedence over CAFile CAData []byte }
TLSClientConfig contains settings to enable transport layer security (TLS).
func (TLSClientConfig) GoString ¶
func (c TLSClientConfig) GoString() string
GoString implements fmt.GoStringer and sanitizes sensitive fields of TLSClientConfig to prevent accidental leaking via logs.
func (TLSClientConfig) String ¶
func (c TLSClientConfig) String() string
String implements fmt.Stringer and sanitizes sensitive fields of TLSClientConfig to prevent accidental leaking via logs.