Documentation ¶
Index ¶
Constants ¶
const ( // UserAgent specifies the HTTP user-agent string for the SDK // clients. UserAgent = "privx-sdk-go" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Authorizer ¶
Authorizer provides access token for REST API client
type CURL ¶
type CURL interface { // Query defines URI parameters of the request Query(interface{}) CURL // Header defines request header Header(string, string) CURL // Status evalutes the request Status(...int) (http.Header, error) Get(interface{}) (http.Header, error) Put(interface{}, ...interface{}) (http.Header, error) Post(interface{}, ...interface{}) (http.Header, error) Delete(...interface{}) (http.Header, error) Fetch() ([]byte, error) Download(string) error }
CURL is HTTP request
type Certificate ¶
type Certificate struct {
X509 *x509.Certificate
}
Certificate specifies a trusted CA certificate for the REST endpoint.
func (Certificate) MarshalText ¶
func (cert Certificate) MarshalText() (text []byte, err error)
MarshalText implements the encoding.TextMarshaler interface.
func (*Certificate) UnmarshalText ¶
func (cert *Certificate) UnmarshalText(text []byte) error
UnmarshalText unmarshals certificate from a configuration file PEM block.
type Connector ¶
type Connector interface { // URL creates a request/response session URL(string, ...interface{}) CURL }
Connector is HTTP connector for api
type ErrorDetail ¶
type ErrorDetail struct { ErrorCode string `json:"error_code"` ErrorMessage string `json:"error_message,omitempty"` Property string `json:"property,omitempty"` }
ErrorDetail contains detailed error information, linked with the error response.
type ErrorResponse ¶
type ErrorResponse struct { ErrorCode string `json:"error_code"` ErrorMessage string `json:"error_message,omitempty"` Property string `json:"property,omitempty"` Details []ErrorDetail `json:"details,omitempty"` }
ErrorResponse contains REST endpoint error response information.
type Option ¶
type Option func(*tClient) *tClient
Option is configuration applied to the client
func TrustAnchor ¶
func TrustAnchor(cert *x509.Certificate) Option
TrustAnchor setups X509 certificates to trust TLS connections
func UseConfigFile ¶
UseConfigFile setup rest client from toml file
func UseEnvironment ¶
func UseEnvironment() Option
UseEnvironment setups rest client using environment variables
type WriteCounter ¶ added in v0.6.0
type WriteCounter struct {
Total uint64
}
WriteCounter count bytes for a file download