cbmgr

package module
v0.0.0-...-248d258 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

README

GoDoc

This repository is unmaintained and part of Operator until 2.1. Please delete when it goes out of support. Note it was also used on legacy versions of Cloud, so see them first!

Documentation

Index

Constants

View Source
const (
	ContentTypeUrlEncoded string = "application/x-www-form-urlencoded"
	ContentTypeJSON       string = "application/json"

	HeaderAuthorization string = "Authorization"
	HeaderContentType   string = "Content-Type"
	HeaderUserAgent     string = "User-Agent"
)
View Source
const (
	DeltaRecoveryNotPossible = "deltaRecoveryNotPossible"
	EmptyKnownNodes          = "empty_known_nodes"
	Mismatch                 = "mismatch"
)

Errors resulting from sending BadRequests to rebalance API

View Source
const (
	IoPriorityTypeLow         IoPriorityType        = "low"
	IoPriorityTypeHigh        IoPriorityType        = "high"
	IoPriorityThreadCountLow  IoPriorityThreadCount = 3
	IoPriorityThreadCountHigh IoPriorityThreadCount = 8
)
View Source
const (
	LDAPEncryptionNone     LDAPEncryption = "None"
	LDAPEncryptionStartTLS                = "StartTLSExtension"
	LDAPEncryptionTLS                     = "TLS"
)

Variables

View Source
var (
	ErrorNodeUninitialized error = fmt.Errorf("node uninitialized")
)

Functions

func BoolAsStr

func BoolAsStr(b bool) string

func BoolToInt

func BoolToInt(b bool) int

func BoolToStr

func BoolToStr(b bool) string

func ErrCompare

func ErrCompare(e1, e2 error) bool

Returns true if two errors are equal

func HasErrorOccured

func HasErrorOccured(err error, key string) bool

Check for a specific error key within an arbitrary error type

func HasServerError

func HasServerError(err error, key string) bool

Check if a specific error has occurred within the map of ServerErrors

func IntToStr

func IntToStr(i int) string

func IsServerError

func IsServerError(err error, code int) bool

IsServerError returns true if all errors are the same code

func NewErrorBucketNotReady

func NewErrorBucketNotReady(name, reason string) error

func NewErrorClusterNodeNotFound

func NewErrorClusterNodeNotFound(name string) error

func NewErrorDeleteBucket

func NewErrorDeleteBucket(name string, err error) error

func NewErrorHealthyTimedOut

func NewErrorHealthyTimedOut(url string) error

func NewErrorInvalidLogList

func NewErrorInvalidLogList() error

func NewErrorWaitNodeTimeout

func NewErrorWaitNodeTimeout(hostname string) error

func NewErrorWaitNodeUnexpected

func NewErrorWaitNodeUnexpected(hostname string) error

func RolesToStr

func RolesToStr(userRoles []UserRole) []string

RoleToStr translates roles to string array

Types

type AddressFamily

type AddressFamily string

AddressFamily The address family to apply the settings.

const (
	AddressFamilyIPV4 AddressFamily = "ipv4"

	AddressFamilyIPV6 AddressFamily = "ipv6"
)

type AlternateAddresses

type AlternateAddresses struct {
	External *AlternateAddressesExternal `json:"external,omitempty"`
}

type AlternateAddressesExternal

type AlternateAddressesExternal struct {
	// Hostname is the host name to connect to (typically a L3 address)
	Hostname string `url:"hostname" json:"hostname"`
	// Ports is the map of service to external ports
	Ports *AlternateAddressesExternalPorts `url:"" json:"ports,omitempty"`
}

AlternateAddresses defines a K8S node address and port mapping for use by clients outside of the pod network. Hostname must be set, ports are ignored if zero.

type AlternateAddressesExternalPorts

type AlternateAddressesExternalPorts struct {
	// AdminPort is the admin service K8S node port (mapped to 8091)
	AdminServicePort int32 `url:"mgmt,omitempty" json:"mgmt"`
	// AdminPortSSL is the admin service K8S node port (mapped to 18091)
	AdminServicePortTLS int32 `url:"mgmtSSL,omitempty" json:"mgmtSSL"`
	// IndexServicePort is the view service K8S node port (mapped to 8092)
	IndexServicePort int32 `url:"capi,omitempty" json:"capi"`
	// IndexServicePortSSL is the view service K8S node port (mapped to 8092)
	IndexServicePortTLS int32 `url:"capiSSL,omitempty" json:"capiSSL"`
	// QueryServicePort is the query service K8S node port (mapped to 8093)
	QueryServicePort int32 `url:"n1ql,omitempty" json:"n1ql"`
	// QueryServicePortTLS is the query service K8S node port (mapped to 18093)
	QueryServicePortTLS int32 `url:"n1qlSSL,omitempty" json:"n1qlSSL"`
	// SearchServicePort is the full text search service K8S node port (mapped to 8094)
	SearchServicePort int32 `url:"fts,omitempty" json:"fts"`
	// SearchServicePortTLS is the full text search service K8S node port (mapped to 18094)
	SearchServicePortTLS int32 `url:"ftsSSL,omitempty" json:"ftsSSL"`
	// AnalyticsServicePort is the analytics service K8S node port (mapped to 8095)
	AnalyticsServicePort int32 `url:"cbas,omitempty" json:"cbas"`
	// AnalyticsServicePortTLS is the analytics service K8S node port (mapped to 18095)
	AnalyticsServicePortTLS int32 `url:"cbasSSL,omitempty" json:"cbasSSL"`
	// EventingServicePort is the eventing service K8S node port (mapped to 8096)
	EventingServicePort int32 `url:"eventingAdminPort,omitempty" json:"eventingAdminPort"`
	// EventingServicePortTLS is the eventing service K8S node port (mapped to 18096)
	EventingServicePortTLS int32 `url:"eventingSSL,omitempty" json:"eventingSSL"`
	// DataServicePort is the data service K8S node port (mapped to 11210)
	DataServicePort int32 `url:"kv,omitempty" json:"kv"`
	// DataServicePortTLS is the data service K8S node port (mapped to 11207)
	DataServicePortTLS int32 `url:"kvSSL,omitempty" json:"kvSSL"`
}

type AuthDomain

type AuthDomain string
const (
	InternalAuthDomain AuthDomain = "local"
	LDAPAuthDomain     AuthDomain = "external"
)

type AutoCompactionAutoCompactionSettings

type AutoCompactionAutoCompactionSettings struct {
	DatabaseFragmentationThreshold AutoCompactionDatabaseFragmentationThreshold `json:"databaseFragmentationThreshold" url:""`
	ViewFragmentationThreshold     AutoCompactionViewFragmentationThreshold     `json:"viewFragmentationThreshold" url:""`
	ParallelDBAndViewCompaction    bool                                         `json:"parallelDBAndViewCompaction" url:"parallelDBAndViewCompaction"`
	IndexCompactionMode            string                                       `json:"indexCompactionMode" url:"indexCompactionMode"`
	IndexCircularCompaction        AutoCompactionIndexCircularCompaction        `json:"indexCircularCompaction" url:""`
}

type AutoCompactionDatabaseFragmentationThreshold

type AutoCompactionDatabaseFragmentationThreshold struct {
	Percentage int   `json:"percentage" url:"databaseFragmentationThreshold[percentage],omitempty"`
	Size       int64 `json:"size" url:"databaseFragmentationThreshold[size],omitempty"`
}

AutoCompactionDatabaseFragmentationThreshold indicates the percentage or size before a bucket compaction is triggered.

func (*AutoCompactionDatabaseFragmentationThreshold) UnmarshalJSON

UnmarshalJSON handles some *&$^ing moron's decision to have size as either an integer or "undefined". Way to go!

type AutoCompactionIndexCircularCompaction

type AutoCompactionIndexCircularCompaction struct {
	DaysOfWeek string                 `json:"daysOfWeek" url:"indexCircularCompaction[daysOfWeek]"`
	Interval   AutoCompactionInterval `json:"interval" url:""`
}

type AutoCompactionInterval

type AutoCompactionInterval struct {
	FromHour     int  `json:"fromHour" url:"indexCircularCompaction[interval][fromHour]"`
	FromMinute   int  `json:"fromMinute" url:"indexCircularCompaction[interval][fromMinute]"`
	ToHour       int  `json:"toHour" url:"indexCircularCompaction[interval][toHour]"`
	ToMinute     int  `json:"toMinute" url:"indexCircularCompaction[interval][toMinute]"`
	AbortOutside bool `json:"abortOutside" url:"indexCircularCompaction[interval][abortOutside]"`
}

type AutoCompactionSettings

type AutoCompactionSettings struct {
	AutoCompactionSettings AutoCompactionAutoCompactionSettings `json:"autoCompactionSettings" url:""`
	PurgeInterval          float64                              `json:"purgeInterval" url:"purgeInterval"`
}

AutoCompactionSettings is the cluster wide auto-compaction settings for a Couchbase cluster.

type AutoCompactionViewFragmentationThreshold

type AutoCompactionViewFragmentationThreshold struct {
	Percentage int   `json:"percentage" url:"viewFragmentationThreshold[percentage],omitempty"`
	Size       int64 `json:"size" url:"viewFragmentationThreshold[size],omitempty"`
}

AutoCompactionViewFragmentationThreshold indicates the percentage or size before a view compaction is triggered.

func (*AutoCompactionViewFragmentationThreshold) UnmarshalJSON

func (r *AutoCompactionViewFragmentationThreshold) UnmarshalJSON(b []byte) error

UnmarshalJSON handles some *&$^ing moron's decision to have size as either an integer or "undefined". Way to go!

type AutoFailoverSettings

type AutoFailoverSettings struct {
	Enabled                  bool                          `url:"enabled" json:"enabled"`
	Timeout                  int64                         `url:"timeout" json:"timeout"`
	Count                    uint8                         `json:"count"`
	FailoverOnDataDiskIssues FailoverOnDiskFailureSettings `url:"" json:"failoverOnDataDiskIssues"`
	FailoverServerGroup      bool                          `url:"failoverServerGroup" json:"failoverServerGroup"`
	MaxCount                 uint64                        `url:"maxCount" json:"maxCount"`
}

type AvailableStorageInfo

type AvailableStorageInfo map[AvailableStorageType][]StorageInfo

type AvailableStorageType

type AvailableStorageType string
const (
	StorageTypeHDD AvailableStorageType = "hdd"
	StorageTypeSSD AvailableStorageType = "ssd"
)

type Bucket

type Bucket struct {
	BucketName         string          `json:"name"`
	BucketType         string          `json:"type"`
	BucketMemoryQuota  int64           `json:"memoryQuota"`
	BucketReplicas     int             `json:"replicas"`
	IoPriority         IoPriorityType  `json:"ioPriority"`
	EvictionPolicy     string          `json:"evictionPolicy"`
	ConflictResolution string          `json:"conflictResolution"`
	EnableFlush        bool            `json:"enableFlush"`
	EnableIndexReplica bool            `json:"enableIndexReplica"`
	BucketPassword     string          `json:"password"`
	CompressionMode    CompressionMode `json:"compressionMode"`
}

func (*Bucket) FormEncode

func (b *Bucket) FormEncode() []byte

func (*Bucket) UnmarshalJSON

func (b *Bucket) UnmarshalJSON(data []byte) error

Unmarshall from json representation of type Bucket or BucketStatus

type BucketBasicStats

type BucketBasicStats struct {
	DataUsed         int     `json:"dataUsed"`
	DiskFetches      float64 `json:"diskFetches"`
	DiskUsed         int     `json:"diskUsed"`
	ItemCount        int     `json:"itemCount"`
	MemUsed          int     `json:"memUsed"`
	OpsPerSec        float64 `json:"opsPerSec"`
	QuotaPercentUsed float64 `json:"quotaPercentUsed"`
}

type BucketStatus

type BucketStatus struct {
	Nodes                  []NodeInfo            `json:"nodes"`
	BucketName             string                `json:"name"`
	BucketType             string                `json:"bucketType"`
	EvictionPolicy         string                `json:"evictionPolicy"`
	ConflictResolution     string                `json:"conflictResolutionType"`
	EnableIndexReplica     bool                  `json:"replicaIndex"`
	AutoCompactionSettings interface{}           `json:"autoCompactionSettings"`
	ReplicaNumber          int                   `json:"replicaNumber"`
	ThreadsNumber          IoPriorityThreadCount `json:"threadsNumber"`
	Controllers            map[string]string     `json:"controllers"`
	Quota                  map[string]int64      `json:"quota"`
	Stats                  map[string]string     `json:"stats"`
	VBServerMap            VBucketServerMap      `json:"vBucketServerMap"`
	CompressionMode        CompressionMode       `json:"compressionMode"`
	BasicStats             BucketBasicStats      `json:"basicStats"`
}

func (*BucketStatus) GetIoPriority

func (s *BucketStatus) GetIoPriority() IoPriorityType

type BulkError

type BulkError struct {
	// contains filtered or unexported fields
}

func (BulkError) Error

func (e BulkError) Error() string

type ClientCertAuth

type ClientCertAuth struct {
	// Must be 'disable', 'enable', 'mandatory'
	State string `json:"state"`
	// Maximum of 10
	Prefixes []ClientCertAuthPrefix `json:"prefixes"`
}

Client certificate authentication settings All fields must be specified, so no "omitempty" tags.

type ClientCertAuthPrefix

type ClientCertAuthPrefix struct {
	Path      string `json:"path"`
	Prefix    string `json:"prefix"`
	Delimiter string `json:"delimiter"`
}

Client certificate authentication prefixes, used to extract the user name All fields must be specified, so no "omitempty" tags.

type ClientError

type ClientError struct {
	// contains filtered or unexported fields
}

func (ClientError) Error

func (e ClientError) Error() string

type ClusterEncryptionLevel

type ClusterEncryptionLevel string

ClusterEncryptionLevel is used to fully encrypt everything.

const (
	// Encrypt all traffic.
	ClusterEncryptionAll ClusterEncryptionLevel = "all"

	// Encrypt only the control plane, allowing all your data to be evesdropped.
	// The implication here is performance sucks, so use with caution!
	ClusterEncryptionControl ClusterEncryptionLevel = "control"
)

type ClusterInfo

type ClusterInfo struct {
	SearchMemoryQuotaMB    int64      `json:"ftsMemoryQuota"`
	IndexMemoryQuotaMB     int64      `json:"indexMemoryQuota"`
	DataMemoryQuotaMB      int64      `json:"memoryQuota"`
	EventingMemoryQuotaMB  int64      `json:"eventingMemoryQuota"`
	AnalyticsMemoryQuotaMB int64      `json:"cbasMemoryQuota"`
	Nodes                  []NodeInfo `json:"nodes"`
	RebalanceStatus        string     `json:"rebalanceStatus"`
	ClusterName            string     `json:"clusterName"`
	Balanced               bool       `json:"balanced"`
}

func (*ClusterInfo) PoolsDefaults

func (c *ClusterInfo) PoolsDefaults() *PoolsDefaults

PoolsDefaults returns a struct which could be used with the /pools/default API

type CompressionMode

type CompressionMode string
const (
	CompressionModeOff     CompressionMode = "off"
	CompressionModePassive CompressionMode = "passive"
	CompressionModeActive  CompressionMode = "active"
)

type Couchbase

type Couchbase struct {
	// contains filtered or unexported fields
}

Couchbase is a structure which encapsulates HTTP API access to a Couchbase cluster

func New

func New(username, password string) *Couchbase

New creates a new Couchbase HTTP(S) API client and initializes the HTTP connection pool.

func (*Couchbase) AddNode

func (c *Couchbase) AddNode(hostname, username, password string, services ServiceList) error

func (*Couchbase) BucketReady

func (c *Couchbase) BucketReady(name string) (bool, error)

Determine wether bucket is ready based on status resolving to healthy across all nodes

func (*Couchbase) CancelAddBackNode

func (c *Couchbase) CancelAddBackNode(hostname string) error

func (*Couchbase) CancelAddNode

func (c *Couchbase) CancelAddNode(hostname string) error

func (*Couchbase) CloseIdleConnections

func (c *Couchbase) CloseIdleConnections()

func (*Couchbase) ClusterInfo

func (c *Couchbase) ClusterInfo() (*ClusterInfo, error)

func (*Couchbase) ClusterInitialize

func (c *Couchbase) ClusterInitialize(username, password string, defaults *PoolsDefaults,
	port int, services []ServiceName, mode IndexStorageMode) error

func (*Couchbase) ClusterUUID

func (c *Couchbase) ClusterUUID() (string, error)

func (*Couchbase) CompareRebalanceStatus

func (c *Couchbase) CompareRebalanceStatus(expectedStatus RebalanceStatus) (bool, error)

Compare status of rebalance with an expected status

func (*Couchbase) CreateBucket

func (c *Couchbase) CreateBucket(bucket *Bucket) error

func (*Couchbase) CreateGroup

func (c *Couchbase) CreateGroup(group *Group) error

func (*Couchbase) CreateRemoteCluster

func (c *Couchbase) CreateRemoteCluster(r *RemoteCluster) error

func (*Couchbase) CreateReplication

func (c *Couchbase) CreateReplication(r *Replication) error

func (*Couchbase) CreateServerGroup

func (c *Couchbase) CreateServerGroup(name string) error

func (*Couchbase) CreateUser

func (c *Couchbase) CreateUser(user *User) error

func (*Couchbase) DeleteAlternateAddressesExternal

func (c *Couchbase) DeleteAlternateAddressesExternal() error

func (*Couchbase) DeleteBucket

func (c *Couchbase) DeleteBucket(name string) error

func (*Couchbase) DeleteGroup

func (c *Couchbase) DeleteGroup(group *Group) error

func (*Couchbase) DeleteRemoteCluster

func (c *Couchbase) DeleteRemoteCluster(r *RemoteCluster) error

func (*Couchbase) DeleteReplication

func (c *Couchbase) DeleteReplication(r *Replication) error

func (*Couchbase) DeleteUser

func (c *Couchbase) DeleteUser(user *User) error

func (*Couchbase) DisableExternalListener

func (c *Couchbase) DisableExternalListener(s *NodeNetworkConfiguration) error

func (*Couchbase) EditBucket

func (c *Couchbase) EditBucket(bucket *Bucket) error

func (*Couchbase) EnableExternalListener

func (c *Couchbase) EnableExternalListener(s *NodeNetworkConfiguration) error

func (*Couchbase) Failover

func (c *Couchbase) Failover(nodesToRemove []string) error

func (*Couchbase) GetAlternateAddressesExternal

func (c *Couchbase) GetAlternateAddressesExternal() (*AlternateAddressesExternal, error)

func (*Couchbase) GetAutoCompactionSettings

func (c *Couchbase) GetAutoCompactionSettings() (*AutoCompactionSettings, error)

func (*Couchbase) GetAutoFailoverSettings

func (c *Couchbase) GetAutoFailoverSettings() (*AutoFailoverSettings, error)

func (*Couchbase) GetBucket

func (c *Couchbase) GetBucket(bucketName string) (*Bucket, error)

func (*Couchbase) GetBucketStatus

func (c *Couchbase) GetBucketStatus(name string) (*BucketStatus, error)

func (*Couchbase) GetBuckets

func (c *Couchbase) GetBuckets() ([]*Bucket, error)

func (*Couchbase) GetClientCertAuth

func (c *Couchbase) GetClientCertAuth() (*ClientCertAuth, error)

func (*Couchbase) GetClusterCACert

func (c *Couchbase) GetClusterCACert() ([]byte, error)

GetClusterCACert returns CA certificate from couchbase cluster. Since cluster version >= 7.1 there could be multiple CA certificates. In such cases, it will return the last certificate. If all certificates are needed then use the api GetClusterCACertAll

func (*Couchbase) GetClusterCACertAll

func (c *Couchbase) GetClusterCACertAll() ([]TrustedCA, error)

GetClusterCACertAll returns CA certificates from couchbase cluster. For cluster version < v7.1 a single certificate is returned and for version >= v7.1 all CA certificates are returned. If there are no certificates are found then it will return an error.

func (*Couchbase) GetGroup

func (c *Couchbase) GetGroup(id string) (*Group, error)

func (*Couchbase) GetGroups

func (c *Couchbase) GetGroups() ([]*Group, error)

func (*Couchbase) GetIndexSettings

func (c *Couchbase) GetIndexSettings() (*IndexSettings, error)

func (*Couchbase) GetLDAPConnectivityStatus

func (c *Couchbase) GetLDAPConnectivityStatus() (*LDAPStatus, error)

func (*Couchbase) GetLDAPSettings

func (c *Couchbase) GetLDAPSettings() (*LDAPSettings, error)

func (*Couchbase) GetLogs

func (c *Couchbase) GetLogs() ([]*LogMessage, error)

func (*Couchbase) GetNodeInfo

func (c *Couchbase) GetNodeInfo() (*NodeInfo, error)

func (*Couchbase) GetNodeNetworkConfiguration

func (c *Couchbase) GetNodeNetworkConfiguration() (*NodeNetworkConfiguration, error)

func (*Couchbase) GetSecuritySettings

func (c *Couchbase) GetSecuritySettings() (*SecuritySettings, error)

func (*Couchbase) GetServerGroups

func (c *Couchbase) GetServerGroups() (*ServerGroups, error)

func (*Couchbase) GetTLS

func (c *Couchbase) GetTLS() *TLSAuth

GetTLS returns the TLS configuration in use by the client.

func (*Couchbase) GetUpdatesEnabled

func (c *Couchbase) GetUpdatesEnabled() (bool, error)

func (*Couchbase) GetUser

func (c *Couchbase) GetUser(id string, domain AuthDomain) (*User, error)

func (*Couchbase) GetUsers

func (c *Couchbase) GetUsers() ([]*User, error)

func (*Couchbase) InsertDoc

func (c *Couchbase) InsertDoc(bucketObj *Bucket, docKey string, data []byte) error

func (*Couchbase) IsEnterprise

func (c *Couchbase) IsEnterprise() (bool, error)

func (*Couchbase) ListRemoteClusters

func (c *Couchbase) ListRemoteClusters() (RemoteClusters, error)

func (*Couchbase) ListReplications

func (c *Couchbase) ListReplications() ([]Replication, error)

func (*Couchbase) LogClientError

func (c *Couchbase) LogClientError(msg string) error

func (*Couchbase) NewRebalanceProgress

func (c *Couchbase) NewRebalanceProgress() RebalanceProgress

NewRebalanceProgress creates a new RebalanceProgress object and starts a go routine to periodically poll for updates.

func (*Couchbase) NodeInitialize

func (c *Couchbase) NodeInitialize(hostname, dataPath, indexPath string, analyticsPaths []string) error

func (*Couchbase) Rebalance

func (c *Couchbase) Rebalance(nodesToRemove []string) error

func (*Couchbase) ReloadNodeCert

func (c *Couchbase) ReloadNodeCert() error

func (*Couchbase) ResetFailoverCounter

func (c *Couchbase) ResetFailoverCounter() error

func (*Couchbase) SetAlternateAddressesExternal

func (c *Couchbase) SetAlternateAddressesExternal(addresses *AlternateAddressesExternal) error

func (*Couchbase) SetAutoCompactionSettings

func (c *Couchbase) SetAutoCompactionSettings(r *AutoCompactionSettings) error

func (*Couchbase) SetAutoFailoverSettings

func (c *Couchbase) SetAutoFailoverSettings(settings *AutoFailoverSettings) error

func (*Couchbase) SetClientCertAuth

func (c *Couchbase) SetClientCertAuth(settings *ClientCertAuth) error

func (*Couchbase) SetEndpoints

func (c *Couchbase) SetEndpoints(endpoints []string)

SetEndpoints sets the current working set of endpoints to try API requests against in the event of failure. The endpoint host and port will be used to lookup a persistent connection in the http.Client.

func (*Couchbase) SetIndexSettings

func (c *Couchbase) SetIndexSettings(settings *IndexSettings) error

func (*Couchbase) SetLDAPSettings

func (c *Couchbase) SetLDAPSettings(settings *LDAPSettings) error

func (*Couchbase) SetLogLevel

func (c *Couchbase) SetLogLevel(level string) error

func (*Couchbase) SetNodeNetworkConfiguration

func (c *Couchbase) SetNodeNetworkConfiguration(s *NodeNetworkConfiguration) error

func (*Couchbase) SetPoolsDefault

func (c *Couchbase) SetPoolsDefault(defaults *PoolsDefaults) error

func (*Couchbase) SetRecoveryType

func (c *Couchbase) SetRecoveryType(hostname string, recoveryType RecoveryType) error

func (*Couchbase) SetSecuritySettings

func (c *Couchbase) SetSecuritySettings(s *SecuritySettings) error

func (*Couchbase) SetTLS

func (c *Couchbase) SetTLS(tls *TLSAuth)

SetTLS updates the client TLS settings. Creates a new client object to flush existing persistent connections.

func (*Couchbase) SetUUID

func (c *Couchbase) SetUUID(uuid string)

SetUUID updates the cluster UUID to check new connections against. Creates a new client object to flush existing persistent connections.

func (*Couchbase) SetUpdatesEnabled

func (c *Couchbase) SetUpdatesEnabled(enabled bool) error

func (*Couchbase) SetUserAgent

func (c *Couchbase) SetUserAgent(userAgent *UserAgent)

SetUserAgent sets the User-Agent header to be sent in subsequent HTTP requests

func (*Couchbase) StopRebalance

func (c *Couchbase) StopRebalance() error

func (*Couchbase) UpdateReplication

func (c *Couchbase) UpdateReplication(r *Replication) error

func (*Couchbase) UpdateServerGroups

func (c *Couchbase) UpdateServerGroups(revision string, groups *ServerGroupsUpdate) error

func (*Couchbase) UploadClusterCACert

func (c *Couchbase) UploadClusterCACert(pem []byte) error

type FailoverOnDiskFailureSettings

type FailoverOnDiskFailureSettings struct {
	Enabled    bool  `url:"failoverOnDataDiskIssues[enabled]" json:"enabled"`
	TimePeriod int64 `url:"failoverOnDataDiskIssues[timePeriod]" json:"timePeriod"`
}

type Group

type Group struct {
	ID           string     `json:"id"`
	Roles        []UserRole `json:"roles"`
	Description  string     `json:"description"`
	LDAPGroupRef string     `json:"ldap_group_ref"`
}

type IndexLogLevel

type IndexLogLevel string
const (
	IndexLogLevelDebug   IndexLogLevel = "debug"
	IndexLogLevelError   IndexLogLevel = "error"
	IndexLogLevelFatal   IndexLogLevel = "fatal"
	IndexLogLevelInfo    IndexLogLevel = "info"
	IndexLogLevelSilent  IndexLogLevel = "silent"
	IndexLogLevelTiming  IndexLogLevel = "timing"
	IndexLogLevelTrace   IndexLogLevel = "trace"
	IndexLogLevelVerbose IndexLogLevel = "verbose"
	IndexLogLevelWarn    IndexLogLevel = "warn"
)

type IndexSettings

type IndexSettings struct {
	StorageMode        IndexStorageMode `json:"storageMode"`
	Threads            int              `json:"indexerThreads"`
	MemSnapInterval    int              `json:"memorySnapshotInterval"`
	StableSnapInterval int              `json:"stableSnapshotInterval"`
	MaxRollbackPoints  int              `json:"maxRollbackPoints"`
	LogLevel           IndexLogLevel    `json:"logLevel"`
}

type IndexStorageMode

type IndexStorageMode string
const (
	IndexStorageNone   IndexStorageMode = ""
	IndexStoragePlasma IndexStorageMode = "plasma"
	IndexStorageMOI    IndexStorageMode = "memory_optimized"
)

type IoPriorityThreadCount

type IoPriorityThreadCount int

type IoPriorityType

type IoPriorityType string

type LDAPEncryption

type LDAPEncryption string

type LDAPSettings

type LDAPSettings struct {
	// Enables using LDAP to authenticate users.
	AuthenticationEnabled bool `json:"authenticationEnabled"`
	// Enables use of LDAP groups for authorization.
	AuthorizationEnabled bool `json:"authorizationEnabled"`
	// List of LDAP hosts.
	Hosts []string `json:"hosts"`
	// LDAP port
	Port int `json:"port"`
	// Encryption method to communicate with LDAP servers.
	// Can be StartTLSExtension, TLS, or false.
	Encryption LDAPEncryption `json:"encryption,omitempty"`
	// Whether server certificate validation be enabled
	EnableCertValidation bool `json:"serverCertValidation"`
	// Certificate in PEM format to be used in LDAP server certificate validation
	CACert string `json:"cacert"`
	// LDAP query, to get the users' groups by username in RFC4516 format.
	GroupsQuery string `json:"groupsQuery,omitempty"`
	// DN to use for searching users and groups synchronization.
	BindDN string `json:"bindDN,omitempty"`
	// Password for query_dn user.
	BindPass string `json:"bindPass,omitempty"`
	// User to distinguished name (DN) mapping. If none is specified,
	// the username is used as the user’s distinguished name.
	UserDNMapping LDAPUserDNMapping `json:"userDNMapping,omitempty"`
	// If enabled Couchbase server will try to recursively search for groups
	// for every discovered ldap group. groupsQuery will be user for the search.
	NestedGroupsEnabled bool `json:"nestedGroupsEnabled,omitempty"`
	// Maximum number of recursive groups requests the server is allowed to perform.
	// Requires NestedGroupsEnabled.  Values between 1 and 100: the default is 10.
	NestedGroupsMaxDepth uint64 `json:"nestedGroupsMaxDepth,omitempty"`
	// Lifetime of values in cache in milliseconds. Default 300000 ms.
	CacheValueLifetime uint64 `json:"cacheValueLifetime,omitempty"`
}

func (*LDAPSettings) FormEncode

func (s *LDAPSettings) FormEncode() ([]byte, error)

func (*LDAPSettings) UnmarshalJSON

func (s *LDAPSettings) UnmarshalJSON(data []byte) error

Normal unmarshlling doesn't work because LDAP DN Mapping returns a string when unset

type LDAPStatus

type LDAPStatus struct {
	Result LDAPStatusResult `json:result`
	Reason string           `json:reason`
}

type LDAPStatusResult

type LDAPStatusResult string
const (
	LDAPStatusResultSuccess LDAPStatusResult = "success"
	LDAPStatusResultError   LDAPStatusResult = "error"
)

type LDAPUserDNMapping

type LDAPUserDNMapping struct {
	Template string `json:"template"`
}

type LogList

type LogList []*LogMessage

func (LogList) Len

func (li LogList) Len() int

func (LogList) Less

func (li LogList) Less(i, j int) bool

func (LogList) Swap

func (li LogList) Swap(i, j int)

type LogMessage

type LogMessage struct {
	Node       string `json:"node"`
	Type       string `json:"type"`
	Code       uint8  `json:"code"`
	Module     string `json:"module"`
	Tstamp     uint64 `json:"tstamp"`
	ShortText  string `json:"shortText"`
	Text       string `json:"text"`
	ServerTime string `json:"serverTime"`
}

type NetworkError

type NetworkError struct {
	// contains filtered or unexported fields
}

func (NetworkError) Error

func (e NetworkError) Error() string

type NodeInfo

type NodeInfo struct {
	ThisNode             bool                 `json:"thisNode"`
	Uptime               string               `json:"uptime"`
	Membership           string               `json:"clusterMembership"`
	RecoveryType         string               `json:"recoveryType"`
	Status               string               `json:"status"`
	OTPNode              string               `json:"otpNode"`
	HostName             string               `json:"hostname"`
	Services             []string             `json:"services"`
	AvailableStorage     AvailableStorageInfo `json:"storage"`
	AlternateAddresses   *AlternateAddresses  `json:"alternateAddresses,omitempty"`
	NodeEncryption       bool                 `json:"nodeEncryption"`
	ClusterCompatibility int                  `json:"clusterCompatibility"`
}

type NodeNetworkConfiguration

type NodeNetworkConfiguration struct {
	// AddressFamily is the family of addresses to affect (IPv4 or IPv6 presumably).
	AddressFamily AddressFamily `json:"afamiliy" url:"afamily,omitempty"`

	// NodeEncryption is whether encyryption is enabled for a node.
	NodeEncryption OnOrOff `json:"nodeEncryption" url:"nodeEncryption"`
}

NodeNetworkConfiguration allows configuration of node networking for a specific address family. I can only guess this default to IPv4, which is fine.

type NodeService

type NodeService struct {
	ThisNode           bool                `json:"thisNode"`
	AlternateAddresses *AlternateAddresses `json:"alternateAddresses,omitempty"`
}

type NodeServices

type NodeServices struct {
	NodesExt []NodeService `json:"nodesExt"`
}

NodeServices is returned by the /pools/default/nodeServices API

type OnOrOff

type OnOrOff string

I'm not even going to comment on this...

const (
	On OnOrOff = "on"

	Off OnOrOff = "off"
)

type PoolsDefaults

type PoolsDefaults struct {
	ClusterName          string `url:"clusterName,omitempty"`
	DataMemoryQuota      int64  `url:"memoryQuota,omitempty"`
	IndexMemoryQuota     int64  `url:"indexMemoryQuota,omitempty"`
	SearchMemoryQuota    int64  `url:"ftsMemoryQuota,omitempty"`
	EventingMemoryQuota  int64  `url:"eventingMemoryQuota,omitempty"`
	AnalyticsMemoryQuota int64  `url:"cbasMemoryQuota,omitempty"`
}

PoolsDefaults is the data that may be posted via the /pools/default API

type PoolsInfo

type PoolsInfo struct {
	Enterprise bool        `json:"isEnterprise"`
	UUID       interface{} `json:"uuid"`
}

type RebalanceProgress

type RebalanceProgress interface {
	// Status is a channel that is periodically updated with the rebalance
	// status and progress.  This channel is closed once the rebalance task
	// is no longer running or an error was detected.
	Status() <-chan *RebalanceStatusEntry
	// Error is used to check the error status when the Status channel has
	// been closed.
	Error() error
	// Cancel allows the client to stop the go routine before a rebalance has
	// completed.
	Cancel()
}

RebalanceProgress is a type used to monitor rebalance status.

type RebalanceStatus

type RebalanceStatus string
const (
	RebalanceStatusNotRunning RebalanceStatus = "notRunning"
	RebalanceStatusRunning    RebalanceStatus = "running"
	RebalanceStatusUnknown    RebalanceStatus = "unknown"
	RebalanceStatusNone       RebalanceStatus = "none"
)

type RebalanceStatusEntry

type RebalanceStatusEntry struct {
	// Status is the status of a rebalance.
	Status RebalanceStatus
	// Progress is how far the rebalance has progressed, only valid when
	// the status is RebalanceStatusRunning.
	Progress float64
}

RebalanceProgressEntry is the type communicated to clients periodically over a channel.

type RecoveryType

type RecoveryType string
const (
	RecoveryTypeDelta RecoveryType = "delta"
	RecoveryTypeFull  RecoveryType = "full"
)

type RemoteCluster

type RemoteCluster struct {
	Name       string `json:"name" url:"name"`
	Hostname   string `json:"hostname"  url:"hostname"`
	Username   string `json:"username"  url:"username"`
	Password   string `json:"password"  url:"password"`
	UUID       string `json:"uuid"  url:"uuid"`
	Deleted    bool   `json:"deleted"`
	SecureType string `json:"secureType" url:"secureType,omitempty"`

	// These are here for convenience and should only be populated
	// after comparison as they are not supplied by the API.
	CA          string `json:"-" url:"certificate,omitempty"`
	Certificate string `json:"-" url:"clientCertificate,omitempty"`
	Key         string `json:"-" url:"clientKey,omitempty"`
}

RemoteCluster describes an XDCR remote cluster.

type RemoteClusters

type RemoteClusters []RemoteCluster

RemoteClusters is returned by

GET /pools/default/remoteClusters

type Replication

type Replication struct {
	FromBucket       string `url:"fromBucket"`
	ToCluster        string `url:"toCluster"`
	ToBucket         string `url:"toBucket"`
	Type             string `url:"type"`
	ReplicationType  string `url:"replicationType"`
	CompressionType  string `url:"compressionType,omitempty"`
	FilterExpression string `url:"filterExpression,omitempty"`
	PauseRequested   bool   `url:"pauseRequested"`
}

Replication describes an XDCR replication as set with

POST /controller/createReplication

type ReplicationSettings

type ReplicationSettings struct {
	CompressionType string `json:"compressionType" url:"compressionType,omitempty"`
	PauseRequested  bool   `json:"pauseRequested" url:"pauseRequested"`
}

ReplicationSettings describes an XDCR replication settings as returned by

GET /settings/replications/<remote UUID>/<local bucket>/<remote bucket>

type SecuritySettings

type SecuritySettings struct {
	// Disallow access to web APIs over 8091.
	DisableUIOverHTTP bool `json:"disableUIOverHttp" url:"disableUIOverHttp,omitempty"`

	// Disallow access to web APIs over 18091.
	DisableUIOverHTTPS bool `json:"disableUIOverHttps" url:"disableUIOverHttps,omitempty"`

	// Set the minimum TLS version, should always be 1.2.
	TLSMinVersion TLSVersion `json:"tlsMinVersion" url:"tlsMinVersion,omitempty"`

	// Cipher suites is a list of OpenSSL suites (openssl ciphers -v)
	CipherSuites []string `json:"cipherSuites" url:"cipherSuites"`

	// Choose the first suite that the client accepts.  This goes against
	// standard security practice in that you should always use the most
	// secure.  When in the hands of users this isn't the case...
	HonorCipherOrder bool `json:"honorCipherOrder" url:"honorCipherOrder,omitempty"`

	// Enable cluster level encryption.
	ClusterEncryptionLevel ClusterEncryptionLevel `json:"clusterEncryptionLevel" url:"clusterEncryptionLevel,omitempty"`
}

Security settings for the cluster.

type ServerError

type ServerError struct {
	// contains filtered or unexported fields
}

func (ServerError) Error

func (e ServerError) Error() string

type ServerGroup

type ServerGroup struct {
	// Name is the human readable server group name
	Name string `json:"name"`
	// Nodes is a list of nodes who are members of the server group
	Nodes []NodeInfo `json:"nodes"`
	// URI is used to refer to a server group
	URI string `json:"uri"`
}

ServerGroup is a map from name to a list of nodes

type ServerGroupUpdate

type ServerGroupUpdate struct {
	// Name is the group name and must match the existing one
	Name string `json:"name,omitempty"`
	// URI is the same as returned in ServerGroup
	URI string `json:"uri"`
	// Nodes is a list of OTP nodes
	Nodes []ServerGroupUpdateOTPNode `json:"nodes"`
}

ServerGroupUpdate defines a server group and its nodes

type ServerGroupUpdateOTPNode

type ServerGroupUpdateOTPNode struct {
	OTPNode string `json:"otpNode"`
}

ServerGroupUpdateOTPNode defines a single node is OTP notation

type ServerGroups

type ServerGroups struct {
	// Groups is a list of ServerGroup objects
	Groups []ServerGroup `json:"groups"`
	// URI is the URI used to update server groups
	URI string `json:"uri"`
}

ServerGroups is returned by /nodes/default/serverGroups

func (ServerGroups) GetRevision

func (groups ServerGroups) GetRevision() string

GetRevision returns the server group revision ID (for CAS)

func (ServerGroups) GetServerGroup

func (groups ServerGroups) GetServerGroup(name string) *ServerGroup

GetServerGroup looks up a server group by name

type ServerGroupsUpdate

type ServerGroupsUpdate struct {
	Groups []ServerGroupUpdate `json:"groups"`
}

ServerGroupsUpdate is used to move nodes between server groups

type ServiceList

type ServiceList []ServiceName

func ServiceListFromStringArray

func ServiceListFromStringArray(arr []string) (ServiceList, error)

func (ServiceList) String

func (s ServiceList) String() string

type ServiceName

type ServiceName string
const (
	DataService      ServiceName = "kv"
	IndexService     ServiceName = "index"
	QueryService     ServiceName = "n1ql"
	SearchService    ServiceName = "fts"
	EventingService  ServiceName = "eventing"
	AnalyticsService ServiceName = "cbas"
)

type SettingsStats

type SettingsStats struct {
	// SendStats actually indicates whether to perform software update checks
	SendStats bool `json:"sendStats"`
}

SettingsStats is the data structure returned by /settings/stats

type StorageInfo

type StorageInfo struct {
	Path      string `json:"path"`
	IndexPath string `json:"index_path"`
}

type TLSAuth

type TLSAuth struct {
	// PEM encoded CA certificate
	CACert []byte
	// Optional client authentication
	ClientAuth *TLSClientAuth
}

TLS Authentication parameters

type TLSClientAuth

type TLSClientAuth struct {
	// PEM encoded certificate
	Cert []byte
	// PEM encoded private key
	Key []byte
}

Certificate and key used by TLS client authentication

type TLSVersion

type TLSVersion string

TLSVersion is a TLS version, as understood by the security API.

const (
	// Insecure, do not use.
	TLS10 TLSVersion = "tls1"

	// Insecure, do not use.
	TLS11 TLSVersion = "tls1.1"

	// Obsolete, use 1.3... which isn't supported :D
	TLS12 TLSVersion = "tls1.2"
)

type Task

type Task struct {
	// Common attributes.
	Type   string `json:"type"`
	Status string `json:"status"`

	// Rebalance attributes.
	Progress float64 `json:"progress"`
	Stale    bool    `json:"statusIsStale"`
	Timeout  bool    `json:"masterRequestTimedOut"`

	// Replication attributes.
	Source           string `json:"source"`
	Target           string `json:"target"`
	ReplicationType  string `url:"replicationType"`
	FilterExpression string `url:"filterExpression"`
}

Task is a base object to describe the very unfriendly polymorphic task struct.

type TrustedCA

type TrustedCA struct {
	PEM string `json:"pem"`
}

type User

type User struct {
	Name     string     `json:"name"`
	Password string     `json:"password"`
	Domain   AuthDomain `json:"domain"`
	ID       string     `json:"id"`
	Roles    []UserRole `json:"roles"`
	Groups   []string   `json:"groups"`
}

func (*User) FormEncode

func (u *User) FormEncode() []byte

FormEncode represents user type in api compatible form

type UserAgent

type UserAgent struct {
	// Name is the unique name of the client e.g. couchbase-operator
	Name string
	// Version is the release version of the client
	Version string
	// UUID is a unique identifier of the client to differentiate it from
	// other clients of the same Name e.g. a FQDN.  This field is optional
	UUID string
}

UserAgent defines the HTTP User-Agent header string

type UserRole

type UserRole struct {
	Role       string `json:"role"`
	BucketName string `json:"bucket_name"`
}

type VBucketMap

type VBucketMap [][]int

type VBucketServerMap

type VBucketServerMap struct {
	ServerList []string   `json:"serverList"`
	VBMap      VBucketMap `json:"vBucketMap"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL