Documentation ¶
Overview ¶
Package clients provides clients for working with MarkLogic.
Index ¶
- Constants
- func ApplyAuth(c RESTClient, req *http.Request)
- type AdminClient
- type BasicClient
- func (bc *BasicClient) AuthType() int
- func (bc *BasicClient) Base() string
- func (bc *BasicClient) ConnectionInfo() *Connection
- func (bc *BasicClient) Database() string
- func (bc *BasicClient) DigestHeaders() *digestAuth.DigestHeaders
- func (bc *BasicClient) Do(req *http.Request) (*http.Response, error)
- func (bc *BasicClient) HTTPClient() *http.Client
- func (bc *BasicClient) SetBase(base string)
- func (bc *BasicClient) Userinfo() *url.Userinfo
- type Client
- type Connection
- type ManagementClient
- type RESTClient
Constants ¶
const ( BasicAuth = iota DigestAuth None )
Authentication options
Variables ¶
This section is empty.
Functions ¶
func ApplyAuth ¶
func ApplyAuth(c RESTClient, req *http.Request)
ApplyAuth adds the neccessary headers for authentication
Types ¶
type AdminClient ¶
type AdminClient struct {
*BasicClient
}
AdminClient is used for connecting to the MarkLogic Management API.
func NewAdminClient ¶
func NewAdminClient(connection *Connection) (*AdminClient, error)
NewAdminClient creates the Client struct used for managing admin features, etc.
type BasicClient ¶
type BasicClient struct {
// contains filtered or unexported fields
}
BasicClient is the basic parts that compose both
func ClientBuilder ¶
func ClientBuilder(connection *Connection, base string) (*BasicClient, error)
ClientBuilder is a factory for MarkLogic clients
func (*BasicClient) AuthType ¶
func (bc *BasicClient) AuthType() int
AuthType returns the int that represents an authentication type (BasicAuth, DigestAuth)
func (*BasicClient) Base ¶
func (bc *BasicClient) Base() string
Base provides the base of the REST calls that will be made
func (*BasicClient) ConnectionInfo ¶
func (bc *BasicClient) ConnectionInfo() *Connection
ConnectionInfo returns the information on the connection
func (*BasicClient) Database ¶
func (bc *BasicClient) Database() string
Database returns the database the client is targeting
func (*BasicClient) DigestHeaders ¶
func (bc *BasicClient) DigestHeaders() *digestAuth.DigestHeaders
DigestHeaders returns the digest headers that need updated with each DigestAuth call
func (*BasicClient) HTTPClient ¶
func (bc *BasicClient) HTTPClient() *http.Client
HTTPClient returns the *http.Client to use to make the REST calls
func (*BasicClient) SetBase ¶
func (bc *BasicClient) SetBase(base string)
SetBase is to only be used for testing purposes. It is exported for subpackage test access.
func (*BasicClient) Userinfo ¶
func (bc *BasicClient) Userinfo() *url.Userinfo
Userinfo returns the credentials for the RESTClient
type Client ¶
type Client struct {
*BasicClient
}
Client is used for connecting to the MarkLogic REST API.
func NewClient ¶
func NewClient(connection *Connection) (*Client, error)
NewClient creates the Client struct used for searching, etc.
type Connection ¶
type Connection struct { Host string Port int64 Username string Password string AuthenticationType int Database string }
Connection contains the information needed for a proper MarkLogic connection
type ManagementClient ¶
type ManagementClient struct {
*BasicClient
}
ManagementClient is used for connecting to the MarkLogic Management API.
func NewManagementClient ¶
func NewManagementClient(connection *Connection) (*ManagementClient, error)
NewManagementClient creates the Client struct used for managing databases, etc.
type RESTClient ¶
type RESTClient interface { Base() string Userinfo() *url.Userinfo AuthType() int HTTPClient() *http.Client Do(*http.Request) (*http.Response, error) DigestHeaders() *digestAuth.DigestHeaders }
RESTClient is an inteface the different REST Clients (Client and ManagementClient)