Categorygithub.com/couchbaselabs/couchbase-cloud-go-client
repositorypackage
1.4.0
Repository: https://github.com/couchbaselabs/couchbase-cloud-go-client.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

Go API client for couchbasecapella

Go Reference

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 2.0.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependency:

go get github.com/couchbaselabs/couchbase-cloud-go-client

Add the following in import:

import "github.com/couchbaselabs/couchbase-cloud-go-client"

Creating an API client

ctx := context.WithValue(
    context.Background(),
    couchbasecloud.ContextAPIKeys,
    map[string]couchbasecloud.APIKey{
        "accessKey": {
            Key: os.Getenv("CBC_ACCESS_KEY"),
        },
        "secretKey": {
            Key: os.Getenv("CBC_SECRET_KEY"),
        },
    },
)
configuration := couchbasecloud.NewConfiguration()
apiClient := couchbasecloud.NewAPIClient(configuration)

API usage - Retrieving a project

projectId := "39eidkdhe-48389-dk38-8e84-34038djsjks"
project, _, err := apiClient.ProjectsApi.ProjectsShow(ctx, projectId).Execute()

if err != nil {
    t.Fatalf("Error when calling `ProjectsApi.ProjectsShow(ctx)`: %v\n", err)
}

fmt.Fprintf(os.Stdout, "Response from `ProjectsApi.ProjectsShow(ctx)`: %v\n", project)

To use a proxy server, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), sw.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), sw.ContextServerVariables, map[string]string{
"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), sw.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})

Documentation for API Endpoints

All URIs are relative to https://cloudapi.cloud.couchbase.com

ClassMethodHTTP requestDescription
CloudsApiCloudsListGet /v2/cloudsList Clouds
CloudsApiCloudsShowGet /v2/clouds/{id}Get Cloud
ClustersApiClustersCreatePost /v2/clustersCreate cluster
ClustersApiClustersCreateAllowlistEntryPost /v2/clusters/{id}/allowlistAdds entry to allowlist
ClustersApiClustersCreateBucketPost /v2/clusters/{id}/bucketsCreate bucket in cluster
ClustersApiClustersCreateUserPost /v2/clusters/{id}/usersCreate Database User
ClustersApiClustersDeleteDelete /v2/clusters/{id}Delete cluster
ClustersApiClustersDeleteAllowlistEntryDelete /v2/clusters/{id}/allowlistDelete entry from allowlist
ClustersApiClustersDeleteBucketDelete /v2/clusters/{id}/bucketsDelete bucket in cluster
ClustersApiClustersDeleteSingleBucketDelete /v2/clusters/{id}/buckets/{bucketId}Delete an existing bucket
ClustersApiClustersDeleteUserDelete /v2/clusters/{id}/users/{username}Delete Database User
ClustersApiClustersGetAllowlistGet /v2/clusters/{id}/allowlistGet current allowlist
ClustersApiClustersGetCertificateGet /v2/clusters/{id}/certificateGet Cluster Certificate
ClustersApiClustersHealthGet /v2/clusters/{id}/healthGet Cluster Health
ClustersApiClustersListGet /v2/clustersList Clusters
ClustersApiClustersListBucketsGet /v2/clusters/{id}/bucketsList cluster buckets
ClustersApiClustersListUsersGet /v2/clusters/{id}/usersList Database Users
ClustersApiClustersShowGet /v2/clusters/{id}Get Cluster
ClustersApiClustersStatusGet /v2/clusters/{id}/statusGet Cluster Status
ClustersApiClustersUpdateAllowlistPut /v2/clusters/{id}/allowlistUpdate the allowlist for a cluster
ClustersApiClustersUpdateBucketPut /v2/clusters/{id}/bucketsUpdate bucket in cluster
ClustersApiClustersUpdateSingleBucketPut /v2/clusters/{id}/buckets/{bucketId}Update an existing bucket
ClustersApiClustersUpdateUserPut /v2/clusters/{id}/users/{username}Update Database User
ClustersV3ApiClustersV3createPost /v3/clustersCreate Cluster V3
ClustersV3ApiClustersV3createUserPost /v3/clusters/{id}/usersCreate cluster user
ClustersV3ApiClustersV3deleteDelete /v3/clusters/{id}Delete Cluster V3
ClustersV3ApiClustersV3listGet /v3/clustersList all clusters v3
ClustersV3ApiClustersV3showGet /v3/clusters/{id}Get Cluster Info V3
ClustersV3ApiClustersV3statusGet /v3/clusters/{id}/statusGet Cluster Status V3
ClustersV3ApiClustersV3updateMetaPut /v3/clusters/{id}/metaUpdate Cluster Metadata V3
ClustersV3ApiClustersV3updateServersPut /v3/clusters/{id}/serversUpdate Cluster Servers V3
ClustersV3ApiClustersV3updateSupportPut /v3/clusters/{id}/supportUpdate Cluster Support Package V3
ProjectsApiProjectsCreatePost /v2/projectsCreate project
ProjectsApiProjectsDeleteDelete /v2/projects/{id}Delete project
ProjectsApiProjectsListGet /v2/projectsList Projects
ProjectsApiProjectsShowGet /v2/projects/{id}Get project by ID
StatusApiStatusShowGet /v2/statusAPI status
UsersApiUsersListGet /v2/usersList Users

Documentation For Models

Documentation For Authorization

### token

        - **Type**: HTTP Bearer token authentication

        Example

        ```golang
        auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARERTOKENSTRING")
        r, err := client.Service.Operation(auth, args)
        ```

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author