Skip to content

cockroachdb/cockroach-cloud-sdk-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API client for client

This is an early access, experimental version of the Cloud API. The interface and output is subject to change, and there may be bugs.

Authentication

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: 2022-03-31
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://support.cockroachlabs.com

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import "./client"

Example Client Usage

// Create a default Configuration object.
clientConfig := client.NewConfiguration(apiKey)

// Create a new client.
client := client.NewClient(clientConfig)

// Create a new service.
service := client.NewService(client)

requiredPathParam = "a_cluster_id"
requiredRequest := &client.OperationRequest{...}
optionalParams := &client.OperationOptions{...}

// Execute the request
apiResponse, httpResponse, err := := service.Operation(
	context.Background(), 
	requiredPathParam, 
	requiredRequest, 
	optionalParams,
)
if err != nil {
	// Process error
}

if apiResponse != nil {
	respJSON, err := apiResponse.MarshalJSON()
	if err != nil {
		// Process error
	}
	fmt.Println(string(respJSON))
}

Documentation for API Endpoints

All URIs are relative to https://cockroachlabs.cloud

Class Method HTTP request Description
CockroachCloudApi AddAllowlistEntry Post /api/v1/clusters/{cluster_id}/networking/allowlist Add a new CIDR address to the IP allowlist.
CockroachCloudApi AddAllowlistEntry2 Put /api/v1/clusters/{cluster_id}/networking/allowlist/{entry.cidr_ip}/{entry.cidr_mask} Add a new CIDR address to the IP allowlist.
CockroachCloudApi CreateCluster Post /api/v1/clusters Create and initialize a new cluster.
CockroachCloudApi CreateSQLUser Post /api/v1/clusters/{cluster_id}/sql-users Create a new SQL user.
CockroachCloudApi DeleteAllowlistEntry Delete /api/v1/clusters/{cluster_id}/networking/allowlist/{cidr_ip}/{cidr_mask} Delete an IP allowlist entry.
CockroachCloudApi DeleteCluster Delete /api/v1/clusters/{cluster_id} Delete a cluster and all of its data.
CockroachCloudApi DeleteSQLUser Delete /api/v1/clusters/{cluster_id}/sql-users/{name} Delete a SQL user.
CockroachCloudApi EnableCMEK Post /api/v1/clusters/{cluster_id}/cmek Enable CMEK for a cluster.
CockroachCloudApi GetCMEKClusterInfo Get /api/v1/clusters/{cluster_id}/cmek Get CMEK-related information for a cluster.
CockroachCloudApi GetCluster Get /api/v1/clusters/{cluster_id} Get extended information about a cluster.
CockroachCloudApi ListAllowlistEntries Get /api/v1/clusters/{cluster_id}/networking/allowlist Get the IP allowlist and propagation status for a cluster.
CockroachCloudApi ListAvailableRegions Get /api/v1/clusters/available-regions List the regions available for new clusters and nodes.
CockroachCloudApi ListClusterNodes Get /api/v1/clusters/{cluster_id}/nodes List nodes for a cluster.
CockroachCloudApi ListClusters Get /api/v1/clusters List clusters owned by an organization.
CockroachCloudApi ListSQLUsers Get /api/v1/clusters/{cluster_id}/sql-users List SQL users for a cluster.
CockroachCloudApi UpdateAllowlistEntry Patch /api/v1/clusters/{cluster_id}/networking/allowlist/{entry.cidr_ip}/{entry.cidr_mask} Update an IP allowlist entry.
CockroachCloudApi UpdateCMEKStatus Patch /api/v1/clusters/{cluster_id}/cmek Update the CMEK-related status for a cluster.
CockroachCloudApi UpdateCluster Patch /api/v1/clusters/{cluster_id} Scale or edit a cluster.
CockroachCloudApi UpdateSQLUserPassword Put /api/v1/clusters/{cluster_id}/sql-users/{name}/password Update a SQL user's password.

Author

support@cockroachlabs.com