api

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SortById   = "id"
	SortByName = "name"
)

Variables

This section is empty.

Functions

func CheckResourceNotFoundError

func CheckResourceNotFoundError(err error) (bool, string)

CheckResourceNotFoundError is used to check if an error is of type api.Error and whether the error is resource not found.

Note: If the error is other than not found, the error string will be returned along with a bool value of false.

func GetPaginated

func GetPaginated[DataSchema ~[]T, T any](
	ctx context.Context,
	client *Client,
	token string,
	cfg EndpointCfg,
	sortBy sortParameter,
) (DataSchema, error)

GetPaginated is a generic function used to handle pagination. It executes a get request according to the supplied url parameter. It then iterates through remaining pages to flatten paginated responses into a single slice of responses.

func ParseError

func ParseError(err error) string

ParseError is used to check if an error is of type api.Error error and return it as a string.

Types

type Access

type Access struct {
	// Resources is the level at which the above privileges are defined.
	// Ex: Access of read/write privilege can be defined at the bucket level or scope level resource.
	// Leaving this empty will grant access to all buckets.
	Resources *AccessibleResources `json:"resources,omitempty"`

	// Privileges defines the privileges field in this API represents the privilege level for users.
	// It accepts one of the following values:
	// data_reader
	// data_writer
	// read: Equivalent to data_reader.
	// write: Equivalent to data_writer.
	Privileges []string `json:"privileges"`
}

Access defines the level of access that the database credential will have across buckets and scopes. This access is currently defined for all buckets and all scopes in the cluster.

type AccessibleResources

type AccessibleResources struct {
	// Buckets contains the details of all buckets with scope and collection level information to which the access applies.
	Buckets []Bucket `json:"buckets"`
}

AccessibleResources is the level at which the above privileges are defined. Ex: Access of read/write privilege can be defined at the bucket level or scope level resource.

type AuditFilterableEvent added in v1.2.0

type AuditFilterableEvent struct {
	Description string `json:"description"`
	Id          int32  `json:"id"`
	Module      string `json:"module"`
	Name        string `json:"name"`
}

type AuditSettingsDisabledUser added in v1.2.0

type AuditSettingsDisabledUser struct {
	// Domain Specifies whether the user is local or external.
	Domain *string `json:"domain,omitempty"`

	// Name The user name.
	Name *string `json:"name,omitempty"`
}

type AuditSettingsDisabledUsers added in v1.2.0

type AuditSettingsDisabledUsers = []AuditSettingsDisabledUser

AuditSettingsDisabledUsers List of users whose filterable events will not be logged.

type Bucket

type Bucket struct {
	// Name is the name of the bucket.
	Name string `json:"name"`
	// Scopes is the details of the scopes inside the bucket to which we want to apply access privileges.
	Scopes []Scope `json:"scopes,omitempty"`
}

Bucket contains the details of a single bucket with scope and collection level information. Scopes can be a subset of all scopes inside the bucket, since this is defined only to govern the access.

type Client

type Client struct {
	*http.Client
}

Client is responsible for constructing and executing HTTP requests.

func NewClient

func NewClient(timeout time.Duration) *Client

NewClient instantiates a new Client with the provided timeout.

func (*Client) Execute

func (c *Client) Execute(
	endpointCfg EndpointCfg,
	payload any,
	authToken string,
	headers map[string]string,
) (response *Response, err error)

Execute is used to construct and execute a HTTP request. It then returns the response.

func (*Client) ExecuteWithRetry

func (c *Client) ExecuteWithRetry(
	ctx context.Context,
	endpointCfg EndpointCfg,
	payload any,
	authToken string,
	headers map[string]string,
) (response *Response, err error)

ExecuteWithRetry is used to construct and execute a HTTP request with retry. It then returns the response.

type CouchbaseAuditData

type CouchbaseAuditData struct {
	// CreatedAt The RFC3339 timestamp associated with when the resource was initially
	// created.
	CreatedAt time.Time `json:"createdAt"`

	// CreatedBy The user who created the resource; this will be a UUID4 ID for standard
	// users and will be a string such as "internal-support" for internal
	// Couchbase support users.
	CreatedBy string `json:"createdBy"`

	// ModifiedAt The RFC3339 timestamp associated with when the resource was last modified.
	ModifiedAt time.Time `json:"modifiedAt"`

	// ModifiedBy The user who last modified the resource; this will be a UUID4 ID for
	// standard users and wilmal be a string such as "internal-support" for
	// internal Couchbase support users.
	ModifiedBy string `json:"modifiedBy"`

	// Version The version of the document. This value is incremented each time the
	// resource is modified.
	Version int `json:"version"`
}

CouchbaseAuditData contains all audit-related fields.

type CreateAllowListRequest

type CreateAllowListRequest struct {
	// Cidr is the trusted CIDR to allow the database connections from.
	// To add a single IP address, use a subnet mask of 32.
	Cidr string `json:"cidr"`

	// Comment is a short description of the allowed CIDR.
	Comment string `json:"comment,omitempty"`

	// ExpiresAt is an RFC3339 timestamp determining when the allowed CIDR should expire.
	// If this field is empty/omitted then the allowed CIDR is permanent and will never automatically expire.
	ExpiresAt string `json:"expiresAt,omitempty"`
}

CreateAllowListRequest is the payload sent to the Capella V4 Public API when asked to add an allowlist to gain access to a Capella cluster. Couchbase Capella only allows trusted IP addresses to connect to databases. Each database has a configurable Allowed IP list that can include up to 75 entries. Each entry can be a single IP address or an IP address space. Any IP address you add to this list can have a user-specified expiration time for temporary access, or be permanent. Capella automatically denies any connection attempts to and from an IP not in the allowed IP list.

In order to access this endpoint, the provided API key must have at least one of the following roles:

Organization Owner Project Owner Project Manager To learn more, see https://docs.couchbase.com/cloud/organizations/organization-projects-overview.html

type CreateAllowListResponse

type CreateAllowListResponse struct {
	// ID is the ID of the AllowList
	Id uuid.UUID `json:"id"`
}

CreateAllowListResponse is the response received from the Capella V4 Public API when asked to add an allowlist to gain access to a Capella cluster.

type CreateApiKeyRequest

type CreateApiKeyRequest struct {
	// AllowedCIDRs is the list of inbound CIDRs for the API key.
	// The system making a request must come from one of the allowed CIDRs.
	AllowedCIDRs *[]string `json:"allowedCIDRs,omitempty"`

	// Description is the description for the API key.
	Description *string `json:"description,omitempty"`

	// Expiry is the expiry of the API key in number of days.
	// If set to -1, the token will not expire.
	Expiry *float32 `json:"expiry,omitempty"`

	// Resources are the resource level permissions associated with the API key.
	// To learn more about Organization Roles, see
	// [Organization Roles](https://docs.couchbase.com/cloud/organizations/organization-user-roles.html).
	Resources *Resources `json:"resources,omitempty"`

	// Name is the name of the API key.
	Name string `json:"name"`

	// OrganizationRoles are the organization level roles granted to the API key.
	OrganizationRoles []string `json:"organizationRoles"`
}

CreateApiKeyRequest is the payload sent to the Capella V4 Public API when asked to create an API key in the organization. Organization Owners can create Organization and Project scoped API keys.

Project Owner and Project Creator can create project scoped keys.

To learn more, see https://docs.couchbase.com/cloud/organizations/organization-projects-overview.html

type CreateApiKeyResponse

type CreateApiKeyResponse struct {
	// Id The id is a unique identifier for an apiKey.
	Id string `json:"id"`

	// Token The Token is a confidential piece of information that is used to authorize requests made to v4 endpoints.
	Token string `json:"token"`
}

CreateApiKeyResponse is the response received from the Capella V4 Public API when asked to create an API key in the organization.

type CreateAzurePrivateEndpointCommandRequest added in v1.3.0

type CreateAzurePrivateEndpointCommandRequest struct {
	// ResourceGroupName The name of your resource group
	ResourceGroupName string `json:"resourceGroupName"`

	// VirtualNetwork The virtual network and subnet name
	VirtualNetwork string `json:"virtualNetwork"`
}

CreateAzurePrivateEndpointCommandRequest is a request to get the CLI to create an Azure private endpoint.

type CreateClusterAuditLogExportRequest added in v1.2.0

type CreateClusterAuditLogExportRequest struct {
	// End Specifies the audit log's end date and time.
	End time.Time `json:"end"`

	// Start Specifies the audit log's start date and time.
	Start time.Time `json:"start"`
}

CreateClusterAuditLogExportRequest is the payload sent to the Capella V4 Public API when creating export job request. In order to access this endpoint, the provided API key must have at least one of the following roles: - Organization Owner - Project Owner - Project Manager

To learn more, see [Organization, Project, and Database Access Overview](https://docs.couchbase.com/cloud/organizations/organization-projects-overview.html).

type CreateClusterAuditLogExportResponse added in v1.2.0

type CreateClusterAuditLogExportResponse struct {
	// ExportId The export ID of the export job.
	ExportId string `json:"exportId"`
}

CreateClusterAuditLogExportResponse is the response received from the Capella V4 Public API after creating export job request.

type CreateClusterOnOffScheduleRequest added in v1.1.0

type CreateClusterOnOffScheduleRequest struct {
	// Timezone for the schedule
	// Enum: "Pacific/Midway" "US/Hawaii" "US/Alaska" "US/Pacific" "US/Mountain" "US/Central" "US/Eastern"
	// "America/Puerto_Rico" "Canada/Newfoundland" "America/Argentina/Buenos_Aires" "Atlantic/Cape_Verde"
	// "Europe/London" "Europe/Amsterdam" "Europe/Athens" "Africa/Nairobi" "Asia/Tehran" "Indian/Mauritius"
	// "Asia/Karachi" "Asia/Calcutta" "Asia/Dhaka" "Asia/Bangkok" "Asia/Hong_Kong" "Asia/Tokyo" "Australia/North"
	// "Australia/Sydney" "Pacific/Ponape" "Antarctica/South_Pole"
	Timezone string `json:"timezone"`

	// Days is an array of day-wise schedule to manage the cluster on/off state.
	Days []DayItem `json:"days"`
}

CreateClusterOnOffScheduleRequest is the request payload sent to the Capella V4 Public API in order to create a new cluster on/off schedule. In order to access this endpoint, the provided API key must have at least one of the roles referenced below:

Organization Owner Project Owner.

type CreateClusterOnRequest added in v1.1.0

type CreateClusterOnRequest struct {
	// TurnOnLinkedAppService Set this value to true if you want to turn on the app service linked with the cluster, false if not.
	// If set to true, the app service, if present, will turn on with the cluster.
	// Default value for this is false, which means the linked app service will be kept off.
	TurnOnLinkedAppService bool `json:"turnOnLinkedAppService"`
}

CreateClusterOnRequest is the payload passed to V4 Capella Public API to turn on the cluster. Turn cluster on.

In order to access this endpoint, the provided API key must have at least one of the roles referenced below: - Organization Owner - Project Owner

To learn more, see [Organization, Project, and Database Access Overview](https://docs.couchbase.com/cloud/organizations/organization-projects-overview.html).

type CreateCollectionRequest added in v1.1.0

type CreateCollectionRequest struct {
	// Name The name of the collection. The name should adhere to the following rules:
	//
	// 1. The name must be between 1 and 251 characters in length.
	//
	// 2. The name can contain only the characters A-Z, a-z, 0-9, and the symbols _, -, and %.
	//
	// 3. The name cannot start with _ or %.
	//
	// Note that scope and collection names are case-sensitive.
	Name string `json:"name"`

	// MaxTTL Specify the time to live (TTL) value in seconds. Defines the duration (Seconds) for which the documents in a collection are kept before automatic removal from the database. -  For server versions < 7.6.0, this is a non-negative value. Set to 0 to use the bucket's maxTTL value. -  For server versions >= 7.6.0, this value should be >= -1. Set to -1 to disable expiry for that collection. Set to 0 to use the bucket's maxTTL value. -  The maximum value that can be set for maxTTL is 2147483647.
	MaxTTL *int64 `json:"maxTTL,omitempty"`
}

CreateCollectionRequest is the payload passed to V4 Capella Public API to create a collection in a scope. Creates a new collection in a scope.

To learn more about scopes and collections, see [Buckets, Scopes, and Collections](https://docs.couchbase.com/cloud/clusters/data-service/about-buckets-scopes-collections.html).

In order to access this endpoint, the provided API key must have at least one of the following roles: - Organization Owner - Project Owner - Project Manager

To learn more, see [Organization, Project, and Database Access Overview](https://docs.couchbase.com/cloud/organizations/organization-projects-overview.html).

type CreateDatabaseCredentialRequest

type CreateDatabaseCredentialRequest struct {
	// Name is Username for the database credential. The name should be according to the following rules:
	// The name must be between 2 & 128 characters.
	// The name cannot contain spaces.
	// The name cannot contain the following characters - ) ( > < , ; : " \ / ] [ ? = } {
	// The name cannot begin with @ character.
	Name string `json:"name"`

	// Password is the password associated with the database credential.
	// If this field is left empty, a password will be auto-generated.
	// The password should be according to the following rules:
	// Password should have at least 8 or more characters.
	// Characters used for the password should contain at least one uppercase (A-Z), one lowercase (a-z), one numerical (0-9), and one special character.
	// Forbidden special characters for the password are: < > ; . * & | £
	Password string `json:"password,omitempty"`

	// Access describes the access information of the database credential.
	Access []Access `json:"access"`
}

CreateDatabaseCredentialRequest represents the schema for the POST Capella V4 API request that creates the database credential. Password is an optional field, if not passed, the password for the database credential is auto-generated. In order to access this endpoint, the provided API key must have at least one of the following roles:

Organization Owner Project Owner To learn more, see https://docs.couchbase.com/cloud/organizations/organization-projects-overview.html

type CreateDatabaseCredentialResponse

type CreateDatabaseCredentialResponse struct {
	Password string    `json:"password"`
	Id       uuid.UUID `json:"id"`
}

CreateDatabaseCredentialResponse represents the schema for the POST Capella V4 API response that creates the database credential.

type CreatePrivateEndpointCommandResponse added in v1.3.0

type CreatePrivateEndpointCommandResponse struct {
	// Command The CLI command or script used to create private endpoint within your CSP.
	Command string `json:"command"`
}

type CreateProjectRequest

type CreateProjectRequest struct {
	// Description A short description about the project.
	Description string `json:"description,omitempty"`

	// Name The name of the project.
	Name string `json:"name"`
}

CreateProjectRequest is the payload sent to the Capella V4 Public API when asked to create a project in the organization.

In order to access this endpoint, the provided API key must have at least one of the following roles:

Organization Owner Project Creator To learn more, see https://docs.couchbase.com/cloud/organizations/organization-projects-overview.html

type CreateProjectResponse

type CreateProjectResponse struct {
	// Id The ID of the project created.
	Id uuid.UUID `json:"id"`
}

CreateProjectResponse is the response received from the Capella V4 Public API when asked to create a project in the organization.

type CreateUserRequest

type CreateUserRequest struct {
	// Name represents the name of the user.
	Name *string `json:"name"`

	// Email represents the email of the user.
	Email string `json:"email"`

	// OrganizationRoles is an array of strings representing the roles granted to the user.
	OrganizationRoles []string `json:"organizationRoles"`

	// Resources is an array of objects representing the resources the user has access to.
	Resources []Resource `json:"resources"`
}

CreateUserRequest is the request payload sent to the Capella V4 Public API when asked to invite a new user to an organization. This request simply invites a new user under the organization. An invitation email is triggered and sent to the user. Upon receiving the invitation email, the user is required to click on a provided URL, which will redirect them to a page with a user interface (UI) where they can set their username and password.

The modification of any personal information related to a user can only be performed by the user through the UI. Similarly, the user can solely conduct password updates through the UI.

The "caller" possessing Organization Owner access rights retains the exclusive user creation capability. They hold the authority to assign roles at the organization and project levels. At present, our support is limited to the resourceType of "project" exclusively.

In order to access this endpoint, the provided API key must have the following role: Organization Owner To learn more, see https://docs.couchbase.com/cloud/organizations/organization-user-roles.html

type CreateUserResponse

type CreateUserResponse struct {
	// ID is the ID of the user
	Id uuid.UUID `json:"id"`
}

CreateUserResponse is the response received from the Capella V4 Public API when asked to invite a new user to an organization.

type CreateVPCEndpointCommandRequest added in v1.3.0

type CreateVPCEndpointCommandRequest struct {
	SubnetIDs *[]string `json:"subnetIDs,omitempty"`

	// VpcID The ID of your virtual network
	VpcID string `json:"vpcID"`
}

CreateVPCEndpointCommandRequest is a request to get the CLI to create an AWS VPC endpoint.

type Cursor

type Cursor struct {
	Hrefs HRefs `json:"hrefs"`
	Pages Pages `json:"pages"`
}

Cursor represents pagination metadata for navigating through large data sets.

type DayItem added in v1.1.0

type DayItem struct {
	// State to be set for the cluster (on, off, or custom).
	//
	// On state turns the cluster on (healthy state) for the whole day.
	// Off state turns the cluster off for the whole day.
	// Custom state should be used for the days when a cluster needs to be in the turned on (healthy) state
	// during the specified time window instead of all day.
	State string `json:"state"`

	// Day of the week for scheduling on/off.
	//
	// The days of the week should be in proper sequence starting from Monday and ending with Sunday.
	// The On/Off schedule requires 7 days for the schedule, one for each day of the week.
	// There cannot be more or less than 7 days in the schedule.
	// Clusters cannot be scheduled to be off for the entire day for every day of the week.
	// Enum: "monday" "tuesday" "wednesday" "thursday" "friday" "saturday" "sunday"
	Day string `json:"day"`

	// From is the starting time boundary for the cluster on/off schedule.
	// The time boundary should be according to the following rules:
	//
	// If the schedule is a non-custom day - with state on or off, it cannot contain a time boundary.
	// If the schedule is a custom day -
	// It should contain the from time boundary. If the to time boundary is not specified then
	// the default value of 0 hour 0 minute is set and the cluster will be turned on for the entire day
	// from the time set in from time boundary.
	//
	// Time boundary should have a valid hour value. The valid hour values are from 0 to 23 inclusive.
	// Time boundary should have a valid minute value. The valid minute values are 0 and 30.
	// The from time boundary should not be later than the to time boundary.
	//
	// If the hour and minute values are not provided for the time boundaries,
	// it is set to a default value of 0 for both. (0 hour 0 minute)
	From *OnTimeBoundary `json:"from"`

	// To is the ending time boundary for the cluster on/off schedule.
	To *OnTimeBoundary `json:"to"`
}

DayItem is an array of Days.

type EndpointCfg

type EndpointCfg struct {
	// Url is url of the endpoint to be contacted
	Url string

	// Method is the HTTP method to be requested.
	Method string

	// SuccessStatus represents the HTTP status code associated
	// with a successful response from the endpoint.
	SuccessStatus int
}

EndpointCfg is used to encapsulate request details to endpoints.

type Error

type Error struct {
	Hint           string `json:"hint"`
	Message        string `json:"message"`
	Code           int    `json:"code"`
	HttpStatusCode int    `json:"httpStatusCode"`
}

Error tracks the error structure received from Capella V4 APIs.

func (Error) CompleteError

func (e Error) CompleteError() string

func (*Error) Error

func (e *Error) Error() string

type GetAllowListResponse

type GetAllowListResponse struct {
	// Comment is a short description of the allowed CIDR.
	Comment *string `json:"comment"`

	// ExpiresAt is an RFC3339 timestamp determining when the allowed CIDR should expire.
	ExpiresAt *string `json:"expiresAt"`

	// Cidr is the trusted CIDR to allow the database connections from.
	// To add a single IP address, use a subnet mask of 32.
	Cidr string `json:"cidr"`

	// Audit contains all audit-related fields.
	Audit CouchbaseAuditData `json:"audit"`

	// ID is the ID of the AllowList
	Id uuid.UUID `json:"id"`
}

GetAllowListResponse is the response received from the Capella V4 Public API when asked to fetch details of a particular allowlist.

In order to access this endpoint, the provided API key must have at least one of the following roles:

Organization Owner Project Owner Project Manager Project Viewer Database Data Reader/Writer Database Data Reader To learn more, see https://docs.couchbase.com/cloud/organizations/organization-projects-overview.html

type GetApiKeyResponse

type GetApiKeyResponse struct {
	// Description is the description for the API key.
	Description string `json:"description"`

	// Id is the id is a unique identifier for an apiKey.
	Id string `json:"id"`

	// Name is the name of the API key.
	Name  string             `json:"name"`
	Audit CouchbaseAuditData `json:"audit"`

	// AllowedCIDRs is the list of inbound CIDRs for the API key.
	// The system making a request must come from one of the allowed CIDRs.
	AllowedCIDRs []string `json:"allowedCIDRs"`

	// OrganizationRoles are the organization level roles granted to the API key.
	OrganizationRoles []string `json:"organizationRoles"`

	// Resources is the resources are the resource level permissions
	// associated with the API key. To learn more about Organization Roles, see
	// [Organization Roles](https://docs.couchbase.com/cloud/organizations/organization-user-roles.html).
	Resources Resources `json:"resources"`

	// Expiry is the expiry of the API key in number of days.
	// If set to -1, the token will not expire.
	Expiry float32 `json:"expiry"`
}

GetApiKeyResponse is the response received from the Capella V4 Public API when asked to fetch an API key in an organization.

Organization Owners can get any API key inside the Organization. Organization Members and Project Creator can get any Project scoped API key for which they are Project Owner. To learn more, see https://docs.couchbase.com/cloud/organizations/organization-projects-overview.html

type GetAuditLogEventIDsResponse added in v1.2.0

type GetAuditLogEventIDsResponse struct {
	Events []AuditFilterableEvent `json:"events"`
}

type GetCertificateResponse

type GetCertificateResponse struct {
	// Certificate is the certificate of the capella cluster
	Certificate string `json:"certificate"`
}

GetCertificateResponse is the response received from the Capella V4 Public API when asked to get the certificate details for a Capella cluster.

In order to access this endpoint, the provided API key must have at least one of the following roles:

Organization Owner Project Owner Project Manager Project Viewer Database Data Reader/Writer Database Data Reader

To learn more, see https://docs.couchbase.com/cloud/organizations/organization-projects-overview.html

type GetClusterAuditLogExportResponse added in v1.2.0

type GetClusterAuditLogExportResponse struct {
	// AuditLogDownloadURL Pre-signed URL to download cluster audit logs.
	AuditLogDownloadURL *string `json:"auditLogDownloadURL,omitempty"`

	// AuditLogExportId The export ID of the audit log export job.
	AuditLogExportId string `json:"auditLogExportId"`

	// CreatedAt The timestamp when the audit logs were exported.
	CreatedAt time.Time `json:"createdAt"`

	// End The timestamp of when audit logs should end.
	End time.Time `json:"end"`

	// Expiration The timestamp when the download link expires.
	Expiration *time.Time `json:"expiration,omitempty"`

	// Start The timestamp of when audit logs should start.
	Start time.Time `json:"start"`

	// Status Indicates status of audit log creation. When status is complete, the compressed file can be manually downloaded.
	Status string `json:"status"`
}

GetClusterAuditLogExportResponse is the response received from the Capella V4 Public API when asked to fetch details of an export job.

type GetClusterAuditSettingsResponse added in v1.2.0

type GetClusterAuditSettingsResponse struct {
	DisabledUsers   AuditSettingsDisabledUsers `json:"disabledUsers"`
	EnabledEventIDs []int32                    `json:"enabledEventIDs"`
	AuditEnabled    bool                       `json:"auditEnabled"`
}

GetClusterAuditSettingsResponse is the response received from the Capella V4 Public API when retrieving cluster audit log settings.

type GetClusterOnOffScheduleResponse added in v1.1.0

type GetClusterOnOffScheduleResponse struct {
	Timezone string    `json:"timezone"`
	Days     []DayItem `json:"days"`
}

GetClusterOnOffScheduleResponse is the API response received from the Capella V4 Public API while attempting to fetch the on/off schedule for a cluster. In order to access this endpoint, the provided API key must have at least one of the roles referenced below:

Organization Owner Project Owner.

type GetCollectionResponse added in v1.1.0

type GetCollectionResponse struct {
	// MaxTTL is the Max TTL of the collection.
	MaxTTL *int64 `json:"maxTTL,omitempty"`

	// Name is the Name of the collection.
	Name *string `json:"name,omitempty"`
}

GetCollectionResponse is the response received from Capella V4 Public API on requesting to information about an existing collection. Fetches the details of the given collection.

To learn more about scopes and collections, see [Buckets, Scopes, and Collections](https://docs.couchbase.com/cloud/clusters/data-service/about-buckets-scopes-collections.html).

In order to access this endpoint, the provided API key must have at least one of the following roles: - Organization Owner - Project Owner - Project Manager - Project Viewer - Database Data Reader/Writer - Database Data Reader

To learn more, see [Organization, Project, and Database Access Overview](https://docs.couchbase.com/cloud/organizations/organization-projects-overview.html).

type GetCollectionsResponse added in v1.1.0

type GetCollectionsResponse struct {
	Data []GetCollectionResponse `json:"data"`
}

GetCollectionsResponse is the response received from the Capella V4 Public API when asked to list all collections. Lists all the collections in a scope.

To learn more about scopes and collections, see [Buckets, Scopes, and Collections](https://docs.couchbase.com/cloud/clusters/data-service/about-buckets-scopes-collections.html).

In order to access this endpoint, the provided API key must have at least one of the following roles: - Organization Owner - Project Owner - Project Manager - Project Viewer - Database Data Reader/Writer - Database Data Reader

To learn more, see [Organization, Project, and Database Access Overview](https://docs.couchbase.com/cloud/organizations/organization-projects-overview.html).

type GetDatabaseCredentialResponse

type GetDatabaseCredentialResponse struct {
	Name           string             `json:"name"`
	Password       string             `json:"password"`
	OrganizationId string             `json:"organizationId"`
	ProjectId      string             `json:"projectId"`
	ClusterId      string             `json:"clusterId"`
	Audit          CouchbaseAuditData `json:"audit"`
	Access         []Access           `json:"access"`
	Id             uuid.UUID          `json:"id"`
}

GetDatabaseCredentialResponse represents the schema for the GET Capella V4 API request that fetches the database credential details.

type GetEventResponse added in v1.3.0

type GetEventResponse struct {
	// AlertKey Populated on demand based on the Event.Key and select labels in KV.
	AlertKey *string `json:"alertKey,omitempty"`

	// AppServiceId SyncGatewayID this Event refers to.
	AppServiceId *uuid.UUID `json:"appServiceId,omitempty"`

	// AppServiceName Name of the sync gateway at the time of event emission.
	AppServiceName *string `json:"appServiceName,omitempty"`

	// ClusterId ClusterID this Event refers to.
	ClusterId *uuid.UUID `json:"clusterId,omitempty"`

	// ClusterName Name of the cluster at the time of event emission.
	ClusterName *string `json:"clusterName,omitempty"`

	// Id UUID for this instance of an Event.
	Id uuid.UUID `json:"id"`

	// ImageURL Rendered chart image to display for an Alert Event.
	ImageURL *string `json:"imageURL,omitempty"`

	// IncidentIds Group events related to an alert incident.
	IncidentIds *[]uuid.UUID `json:"incidentIds,omitempty"`

	// Key Defines the specific kind of Event.
	Key string `json:"key"`

	// Kv Key-value pairs for additional event data.
	Kv *map[string]interface{} `json:"kv,omitempty"`

	// OccurrenceCount Number of times the alert has fired within this "incident".
	OccurrenceCount *int `json:"occurrenceCount,omitempty"`

	// ProjectId ProjectID this Event refers to.
	ProjectId *uuid.UUID `json:"projectId,omitempty"`

	// ProjectName Name of the project at the time of event emission.
	ProjectName *string `json:"projectName,omitempty"`

	// RequestId RequestID for an Event.
	RequestId *uuid.UUID `json:"requestId,omitempty"`

	// SessionId User that initiated the request for this Event.
	SessionId *uuid.UUID `json:"sessionId,omitempty"`

	// Severity Severity of the event.
	Severity string `json:"severity"`

	// Source Identifies the originator of the event.
	Source string `json:"source"`

	// Summary Metadata.SummaryTemplate rendered for this event.
	Summary *string `json:"summary,omitempty"`

	// Timestamp Time when the event was emitted.
	Timestamp time.Time `json:"timestamp"`

	// UserEmail Email of the associated user at the time of event emission.
	UserEmail *string `json:"userEmail,omitempty"`

	// UserId User id that initiated the request for this Event.
	UserId *string `json:"userId,omitempty"`

	// UserName Name of the associated user at the time of event emission.
	UserName *string `json:"userName,omitempty"`
}

GetEventResponse defines model for GetEventResponse.

type GetEventsResponse added in v1.3.0

type GetEventsResponse struct {
	Cursor Cursor             `json:"cursor"`
	Data   []GetEventResponse `json:"data"`
}

GetEventsResponse defines model for GetEventsResponse.

type GetPrivateEndpointResponse added in v1.3.0

type GetPrivateEndpointResponse struct {
	// Id is the endpoint id.
	Id string `json:"id"`
	// Status is the endpoint status.  Possible values are failed, linked, pending, pendingAcceptance, rejected and unrecognized.
	Status string `json:"status"`
}

GetPrivateEndpointResponse defines model for a CSP's private endpoint.

type GetPrivateEndpointServiceStatusResponse added in v1.3.0

type GetPrivateEndpointServiceStatusResponse struct {
	Enabled bool `json:"enabled"`
}

GetPrivateEndpointServiceStatusResponse is the response received from the Capella V4 Public API when getting private endpoint service status.

type GetPrivateEndpointsResponse added in v1.3.0

type GetPrivateEndpointsResponse struct {
	Endpoints []GetPrivateEndpointResponse `json:"endpoints"`
}

GetPrivateEndpointsResponse is a list of private endpoints.

type GetProjectResponse

type GetProjectResponse struct {
	Description string `json:"description"`
	Name        string `json:"name"`
	Etag        string
	Audit       CouchbaseAuditData `json:"audit"`
	Id          uuid.UUID          `json:"id"`
}

GetProjectResponse is the response received from the Capella V4 Public API when asked to get project details in an organization.

In order to access this endpoint, the provided API key must have at least one of the following roles:

Organization Owner Project Owner Project Manager Project Viewer Database Data Reader/Writer Database Data Reader To learn more, see https://docs.couchbase.com/cloud/organizations/organization-projects-overview.html

type GetUserResponse

type GetUserResponse struct {
	Name              *string            `json:"name"`
	TimeZone          string             `json:"timeZone"`
	Email             string             `json:"email"`
	Status            string             `json:"status"`
	LastLogin         string             `json:"lastLogin"`
	Region            string             `json:"region"`
	ExpiresAt         string             `json:"expiresAt"`
	Audit             CouchbaseAuditData `json:"audit"`
	OrganizationRoles []string           `json:"organizationRoles"`
	Resources         []Resource         `json:"resources"`
	OrganizationId    uuid.UUID          `json:"organizationId"`
	Id                uuid.UUID          `json:"id"`
	// Inactive depicts whether the user has accepted the invite for the organization.
	Inactive            bool `json:"inactive"`
	EnableNotifications bool `json:"enableNotifications"`
}

GetUserResponse is the response received from the Capella V4 Public API when asked to get existing user's details.

In order to access this endpoint, the provided API key must have at least one of the following roles:

Organization Owner Organization Member Project Creator The results are always limited by the role and scope of the caller's privileges.

When performing a GET request for a user with an organization owner role, the response will exclude project-level permissions for that user. This is because organization owners have access to all resources at the organization level, rendering project-level permissions unnecessary for them.

To learn more about the roles, see: Organization Roles: https://docs.couchbase.com/cloud/organizations/organization-user-roles.html Project Roles: https://docs.couchbase.com/cloud/projects/project-roles.html

type HRefs

type HRefs struct {
	// First is the base URL, endpoint, and path parameters required to fetch the first page of results.
	First string `json:"first"`

	// Last is the the base URL, endpoint, and path parameters required to fetch the last page of results.
	Last string `json:"last"`

	// Previous is the base URL, endpoint, and path parameters required to fetch the previous page of results. Empty if there is no previous page.
	Previous string `json:"pages"`

	// Next is the base URL, endpoint, and path parameters required to fetch the next page of results. Empty if there is no next page.
	Next string `json:"next"`
}

Hrefs contains the hyperlinks for navigation through the paginated data set.

type OnTimeBoundary added in v1.1.0

type OnTimeBoundary struct {
	// Hour of the time boundary.
	// Default: 0
	Hour int64 `json:"hour"`

	// Minute of the time boundary.
	// Default: 0
	Minute int64 `json:"minute"`
}

OnTimeBoundary corresponds to "from" and "to" time boundaries for when the cluster needs to be in the turned on (healthy) state on a day with "custom" scheduling timings.

type Op

type Op string
const (
	Add    Op = "add"
	Remove Op = "remove"
)

type Pages

type Pages struct {
	// Page is the current page of results, starting from page 1.
	Page int `json:"page"`

	// Next is the number of the next page of results. Not set on the last page.
	Next int `json:"next"`

	// Previous is the of the previous page of results. Not set on the first page.
	Previous int `json:"previous"`

	// Last is the number of the last page of results.
	Last int `json:"last"`

	// PerPage is the number of items displayed in each page.
	PerPage int `json:"perPage"`

	// TotalItems is the total items found by the given query.
	TotalItems int `json:"totalItems"`
}

Pages represents the pagination details of the data set.

type PatchEntry

type PatchEntry struct {
	// Value represents the value to be amended by the patch. It may take an array
	// of OrganizationRoles (strings), an Array of ProjectRoles (strings) or a Resource (object)
	Value interface{} `json:"value,omitempty"`

	// Op is the type of operation
	//
	// Enum: "add" "remove"
	Op string `json:"op"`

	// Path is the path of the resource that needs to be updated
	//
	// Organization Roles: /organizationRoles
	// Resources: /resources/{resourceId}
	// Resource Roles: /resources/{resourceId}/roles
	Path string `json:"path"`
}

type PutDatabaseCredentialRequest

type PutDatabaseCredentialRequest struct {
	// Password is an optional field, if not passed, the existing password is not updated.
	Password string `json:"password,omitempty"`
	// Access describes the access information of the database credential.
	Access []Access `json:"access"`
}

PutDatabaseCredentialRequest represents the schema for the PUT Capella V4 API request that updates an existing database credential.

type PutProjectRequest

type PutProjectRequest struct {
	// Description represents a short description of the project.
	Description string `json:"description,omitempty"`

	// Name is the name of the project.
	Name string `json:"name"`
}

PutProjectRequest is the payload sent to the Capella V4 Public API when asked to update a project in an organization.

In order to access this endpoint, the provided API key must have at least one of the following roles:

Organization Owner Project Owner To learn more, see https://docs.couchbase.com/cloud/organizations/organization-projects-overview.html

type PutUserRequest

type PutUserRequest struct {
	Name string `json:"name"`
}

type Resource

type Resource struct {
	// Id is a GUID4 identifier of the resource.
	Id string `json:"id"`

	// Type is the type of the resource.
	Type *string `json:"type"`

	// Roles is an array of strings representing a users project roles
	Roles []string `json:"roles"`
}

Resource defines either a project or cluster to which the newly invited user should have access.

type Resources

type Resources = []ResourcesItems

Resources are the resource level permissions associated with the API key. To learn more about Organization Roles, see [Organization Roles](https://docs.couchbase.com/cloud/organizations/organization-user-roles.html).

type ResourcesItems

type ResourcesItems struct {
	// Type is the type of the resource.
	Type *string `json:"type,omitempty"`

	// Roles are the project roles associated with the API key.
	// To learn more about Project Roles, see
	//[Project Roles](https://docs.couchbase.com/cloud/projects/project-roles.html).
	Roles []string `json:"roles"`

	// Id is the id of the project.
	Id uuid.UUID `json:"id"`
}

ResourcesItems the individual item that is part of Resources. These items define the set of roles or access that can be had on a single type of resource.

type Response

type Response struct {
	Response *http.Response
	Body     []byte
}

Response struct is used to encapsulate the response details.

type RotateApiKeyRequest

type RotateApiKeyRequest struct {
	// Secret represents the secret associated with an API key.
	// One has to follow the secret key policy, such as allowed characters and a length of 64 characters.
	// If this field is left empty, a secret will be auto-generated.
	Secret *string `json:"secret,omitempty"`
}

RotateApiKeyRequest is the payload sent to the Capella V4 Public API when asked to rotate an API key.

Organization Owners can rotate any API key inside the Organization. To learn more, see https://docs.couchbase.com/cloud/organizations/organization-projects-overview.html

type RotateApiKeyResponse

type RotateApiKeyResponse struct {
	// SecretKey is a confidential token that is paired with the Access key.
	// The API key is made of an Access key and a Secret key.
	SecretKey string `json:"secretKey"`
}

RotateApiKeyResponse is the response received from the Capella V4 Public API when asked to rotate an API key.

type Scope

type Scope struct {
	// Name is the name of the scope.
	Name string `json:"name"`
	// Collections is the set of collections that are present in the provided scope to which the database credential should have access.
	Collections []string `json:"collections,omitempty"`
}

Scope is the details of a single scope inside the bucket, and it contains the collections details too. This collections can be a subset of all collections inside the scope, since this is defined only to govern the access.

type UpdateClusterAuditSettingsRequest added in v1.2.0

type UpdateClusterAuditSettingsRequest struct {
	DisabledUsers   AuditSettingsDisabledUsers `json:"disabledUsers"`
	EnabledEventIDs []int32                    `json:"enabledEventIDs"`
	AuditEnabled    bool                       `json:"auditEnabled"`
}

UpdateClusterAuditSettingsRequest is the payload sent to the Capella V4 Public API when configuring audit log settings.

In order to access this endpoint, the provided API key must have at least one of the following roles:
- Organization Owner
- Project Owner
- Project Manager
To learn more, see [Organization, Project, and Database Access Overview](https://docs.couchbase.com/cloud/organizations/organization-projects-overview.html).

type UpdateClusterOnOffScheduleRequest added in v1.1.0

type UpdateClusterOnOffScheduleRequest struct {
	Timezone string    `json:"timezone"`
	Days     []DayItem `json:"days"`
}

UpdateClusterOnOffScheduleRequest is the request payload sent to the Capella V4 Public API in order to create a update a cluster's on/off schedule. In order to access this endpoint, the provided API key must have at least one of the roles referenced below:

Organization Owner Project Owner.

type UpdateCollectionRequest added in v1.1.0

type UpdateCollectionRequest struct {
	// MaxTTL Specify the new time to live (TTL) value in seconds.
	//  -  This value should be >= -1. Set to -1 to disable expiry for that collection.
	//  -  Set to 0 to use the bucket's maxTTL value.
	//  -  The maximum value that can be set for maxTTL is 2147483647.
	MaxTTL int64 `json:"maxTTL"`
}

UpdateCollectionRequest is the payload sent to the Capella V4 Public API when asked to update an existing collection. Updates an existing collection.

This operation is only allowed for a cluster with server version >= 7.6.0. A collection cannot be updated for the server versions lower than this.

This allows to update the maxTTL of the given collection.

To learn more about scopes and collections, see [Buckets, Scopes, and Collections](https://docs.couchbase.com/cloud/clusters/data-service/about-buckets-scopes-collections.html).

In order to access this endpoint, the provided API key must have at least one of the following roles: - Organization Owner - Project Owner - Project Manager

To learn more, see [Organization, Project, and Database Access Overview](https://docs.couchbase.com/cloud/organizations/organization-projects-overview.html).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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