package
2.0.4
Repository: https://github.com/couchbase/tools-common.git
Documentation: pkg.go.dev

# Functions

IsEndpointNotFound returns a boolean indicating whether the given error is an 'EndpointNotFoundError'.
IsServiceNotAvailable returns a boolean indicating whether the given error is a 'ServiceNotAvailableError'.
NewAuthProvider creates a new 'AuthProvider' using the provided credentials.
NewClient creates a new REST client which will connection to the provided cluster using the given credentials.
NewClusterConfigManager returns a new cluster config manager which will not immediately trigger a cluster config update.
NewTestCluster creates a new test cluster using the provided options.
NewTestHandler creates the most basic type of handler which will respond with the provided status/body.
NewTestHandlerWithEOF creates a handler which will cause an EOF error when attempting to read the body.
NewTestHandlerWithHijack creates a handler which will hijack the connection an immediately close it; this is simulating a socket closed in flight error.
NewTestHandlerWithRetries builds upon the basic handler by simulating a flaky/busy endpoint which forces retries a configurable number of times before providing a valid response.
NewTestHandlerWithStream creates a handler which will respond with a streaming response writing the provided body a given number of times.
NewTestHandlerWithStreamHijack creates a handler which will respond with a streaming response which will be immediately closed.
NewTestHandlerWithValue creates a handler which reads and stores the request body in the provided interface.

# Constants

ConnectionModeDefault is the standard connection mode, connections use HTTP/HTTPS depending on the given connection string, and REST requests may be dispatched to any node in the cluster.
ConnectionModeLoopback is equivalent to 'ConnectionModeThisNodeOnly with the added requirement that all requests are sent unencrypted, via loopback (127.0.0.1).
ConnectionModeThisNodeOnly means connections use HTTP/HTTPS depending on the given connection string, and REST requests will only be dispatched to the given node.
ContentTypeJSON - Indicates that the body of this request is json encoded.
ContentTypeURLEncoded - Indicates that the body of this request is url encoded.
DefaultCCMaxAge is the maximum amount of time a cluster config will be in use before the client begins to try to update the cluster config.
DefaultClientTimeout is the timeout for client connection/single operations i.e.
DefaultDialerKeepAlive is the default net.Dialer KeepAlive value for transport of the HTTP client.
DefaultDialerTimeout is the default net.Dialer Timeout value for transport of the HTTP client.
DefaultPollTimeout is the default timeout for polling operations e.g.
DefaultRequestRetries is the number of times to attempt a REST request for known failure scenarios.
DefaultRequestTimeout is the default timeout for REST requests, note that this includes retries.
DefaultResponseHeaderTimeout is the default ResponseHeaderTimeout value for transport of the HTTP client.
DefaultTLSHandshakeTimeout is the default TLSHandshakeTimeout value for transport of the HTTP client.
DefaultTransportContinueTimeout is the default ContinueTimeout value for transport of the HTTP client.
DefaultTransportIdleConnTimeout is the default IdleConnTimeout value for transport of the HTTP client.
EndpointBucket represents the endpoint for interacting with a specific named bucket.
EndpointBucketManifest represents the bucket collections manifest endpoint, can be used to get/update the collection manifest for a bucket.
EndpointBuckets represents the 'ns_server' endpoint used to interact with the buckets on the cluster.
EndpointNodesServices is used during the bootstrapping process to fetch a list of all the nodes in the cluster.
EndpointPools is the root of the 'ns_server' REST API.
EndpointPoolsDefault represents the default cluster (i.e.
ServiceAnalytics represents the Analytics Service.
ServiceBackup represents hosts accepting requests for the Backup Service.
ServiceData represents the KV/Data Service.
ServiceEventing represents the cluster level Eventing Service.
ServiceGSI represents the Indexing Service.
ServiceManagement represents 'ns_server' e.g.
ServiceQuery represents the Query Service e.g.
ServiceSearch represents the Search/Full Text Search Service.
ServiceViews represents hosts accepting requests for Views.
TimeoutsEnvVar is the environment variable that should be used to supply configurable timeouts for a REST HTTP client.

# Variables

ErrConnectionModeRequiresNonTLS is returned if the user attempts to connect using TLS when the connection mode requires non-TLS communication.
ErrExhaustedClusterNodes is returned if we've failed to update the clients cluster config and have run out of nodes.
ErrInvalidNetwork is returned if the user supplies an invalid value for the 'network' query parameter.
ErrNodeUninitialized is returned if the user attempts to interact with a node which has not been initialized.
ErrNotBootstrapped is returned when attempting to retrieve hosts from an auth provider which has not been bootstrapped; this error shouldn't be returned when using the 'Client' since the constructor performs bootstrapping.
ErrStreamWithTimeout is returned if the user attempts to execute a stream with a non-zero timeout.
ErrThisNodeOnlyExpectsASingleAddress is returned if the user attempts to connect to a single node, but provides more than one node in the connection string.
SupportedConnectionModes is a slice of the supported connection modes, this should be considered as read only.

# Structs

AlternateAddresses represents the 'alternateAddresses' payload sent the 'nodeServices' endpoint.
AuthenticationError is returned if we received a 401 status code from the cluster i.e.
AuthorizationError is returned if we receive a 403 status code from the cluster which means the credentials are correct but they don't have the needed permissions.
AuthProvider is the auth provider for the REST client which handles providing credentials/hosts required to execute REST requests.
AuthProviderOptions encapsulates the options for creating a new REST AuthProvider.
BootstrapFailureError is returned to the user if we've failed to bootstrap the REST client.
Client is a REST client used to retrieve/send information to/from a Couchbase Cluster.
ClientOptions encapsulates the options for creating a new REST client.
ClusterConfig represents the payload sent by 'ns_server' when hitting the '/pools/default/nodeServices' endpoint.
ClusterConfigManager is a utility wrapper around the current cluster config which provides utility functions required when periodically updating the REST clients cluster config.
EndpointNotFoundError is returned if we received a 404 status code from the cluster.
External is similar to the 'Node' structure but encapsulates all the alternative addressing information.
InternalServerError is returned if we received a 500 status code from the cluster.
Node encapsulates the addressing information for a single node in a Couchbase Cluster.
OldClusterConfigError is returned when the client attempts to bootstrap against a node which returns a cluster config which is older than the one we already have.
Request encapsulates the parameters/options which are required when sending a REST request.
Response represents a REST response from the Couchbase Cluster.
RetriesExhaustedError is returned if the REST request was retried the maximum number of times.
ServiceNotAvailableError is returned if the requested service is is unavailable i.e.
Services encapsulates the ports that are active on this cluster node.
SocketClosedInFlightError is returned if the client socket was closed during an active request.
StreamingResponse encapsulates a single streaming response payload/error.
TestBucket represents a bucket that will exist in the test cluster.
TestCluster is a mock Couchbase cluster used for unit testing functionaility which relies on the REST client.
TestClusterOptions encapsulates the options which can be passed when creating a new test cluster.
TestNode encapsulates the options which can be used to configure a single node in a test cluster.
UnexpectedEndOfBodyError is returned if the length of the request body does not match the expected length.
UnexpectedStatusCodeError returned if a request was executed successfully, however, we received a response status code which was unexpected.
UnknownAuthorityError is returned when the dispatched REST request receives an 'UnknownAuthorityError'.
UnknownX509Error is returned when the dispatched REST request receives a generic (unhandled) x509 error.

# Type aliases

ConnectionMode is a connection mode which slightly changes the behavior of the REST client.
ContentType - Convenience wrapper around the content type of a request.
Endpoint represents a single REST endpoint.
Header is a readability wrapper around key/value pairs which will be set in the REST request header.
Method is a readability wrapper around the method for a given REST request; only the methods defined in the 'http' module should be used.
Nodes is a wrapper around a slice of nodes which allows custom unmarshalling.
PollFunc is a readbility wrapper around the function which will be polled by the built in polling functionaility.
Service represents a service which can be running on a Couchbase node.
TestBuckets is a readbility alias around a map of buckets.
TestHandlers is a readbility wrapper around the endpoint handlers for a test cluster.
TestNodes is a readbility wrapper around a slice of test nodes.