scylla

package
v1.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultClassifier retrier.Classifier = &RetryStrategy{
	RetryStatus: []int{
		http.StatusBadGateway,
		http.StatusServiceUnavailable,
		http.StatusGatewayTimeout,

		http.StatusTooManyRequests,
		http.StatusRequestTimeout,
		http.StatusTooEarly,
		http.StatusLocked,
	},
	RetryCode: []string{
		"000001",
	},
	RetryMessage: []string{
		"connection reset",
		"use of closed network connection",
		"broken pipe",
		"transport connection broken",
		"connection refused",
	},
	FailMessage: []string{
		"certificate is not trusted",
		"unsupported protocol scheme",
		"net/http: request canceled",
		"net/http: request canceled while waiting for connection",
	},
}

Functions

func IsDeletedErr added in v1.3.0

func IsDeletedErr(err error) bool

Types

type APIError

type APIError struct {
	URL        string
	Code       string
	Message    string
	Method     string
	StatusCode int
}

APIError represents an error that occurred while calling the API.

func (*APIError) Error

func (err *APIError) Error() string

type Client

type Client struct {
	Meta *Cloudmeta

	// Headers holds headers that will be set for all http requests.
	Headers http.Header

	// API endpoint
	Endpoint *url.URL

	// ErrCodes provides a human-readable translation of ScyllaDB API errors.
	ErrCodes map[string]string // code -> message

	// HTTPClient is the underlying HTTP client used to run the requests.
	// It may be overloaded but a default one is provided in “NewClient“ by default.
	HTTPClient *http.Client

	// AccountID holds the account ID used in requests to the API.
	AccountID int64

	Retry *retrier.Retrier // Retrier is used to retry requests to the API.
}

Client represents a client to call the Scylla Cloud API

func NewClient added in v1.3.1

func NewClient() (*Client, error)

func (*Client) Auth

func (c *Client) Auth(ctx context.Context, token string) error

NewClient represents a new client to call the API

func (*Client) Bundle added in v1.2.0

func (c *Client) Bundle(ctx context.Context, clusterID int64) ([]byte, error)

func (*Client) Connect

func (c *Client) Connect(ctx context.Context, clusterID int64) (*model.ClusterConnection, error)

func (*Client) CreateAllowlistRule

func (c *Client) CreateAllowlistRule(ctx context.Context, clusterID int64, address string) ([]model.AllowedIP, error)

func (*Client) CreateCluster

func (c *Client) CreateCluster(ctx context.Context, req *model.ClusterCreateRequest) (*model.ClusterRequest, error)

func (*Client) CreateClusterVPCPeering

func (c *Client) CreateClusterVPCPeering(ctx context.Context, clusterID int64, req *model.VPCPeeringRequest) (*model.VPCPeering, error)

func (*Client) DeleteAllowlistRule

func (c *Client) DeleteAllowlistRule(ctx context.Context, clusterID, ruleID int64) error

func (*Client) DeleteCluster

func (c *Client) DeleteCluster(ctx context.Context, clusterID int64, clusterName string) (*model.ClusterRequest, error)

func (*Client) DeleteClusterVPCPeering

func (c *Client) DeleteClusterVPCPeering(ctx context.Context, clusterID, peerID int64) error

func (*Client) GetCluster

func (c *Client) GetCluster(ctx context.Context, clusterID int64) (*model.Cluster, error)

func (*Client) GetClusterRequest

func (c *Client) GetClusterRequest(ctx context.Context, requestID int64) (model.ClusterRequest, error)

func (*Client) GetClusterVPCPeering

func (c *Client) GetClusterVPCPeering(ctx context.Context, clusterID, peerID int64) (*model.VPCPeering, error)

func (*Client) ListAllowlistRules

func (c *Client) ListAllowlistRules(ctx context.Context, clusterID int64) ([]model.AllowedIP, error)

func (*Client) ListCloudProviderInstances

func (c *Client) ListCloudProviderInstances(ctx context.Context, providerID int64) ([]model.CloudProviderInstance, error)

func (*Client) ListCloudProviderRegions

func (c *Client) ListCloudProviderRegions(ctx context.Context, providerID int64) (*model.CloudProviderRegions, error)

func (*Client) ListCloudProviders

func (c *Client) ListCloudProviders(ctx context.Context) ([]model.CloudProvider, error)

func (*Client) ListClusterNodes

func (c *Client) ListClusterNodes(ctx context.Context, clusterID int64) ([]model.Node, error)

func (*Client) ListClusterRequest

func (c *Client) ListClusterRequest(ctx context.Context, clusterID int64, typ string) ([]model.ClusterRequest, error)

func (*Client) ListClusterVPCPeerings

func (c *Client) ListClusterVPCPeerings(ctx context.Context, clusterID int64) ([]model.VPCPeering, error)

func (*Client) ListClusters

func (c *Client) ListClusters(ctx context.Context) ([]model.Cluster, error)

func (*Client) ListDataCenters

func (c *Client) ListDataCenters(ctx context.Context, clusterID int64) ([]model.Datacenter, error)

func (*Client) ListScyllaVersions

func (c *Client) ListScyllaVersions(ctx context.Context) (*model.ScyllaVersions, error)

type CloudProvider

type CloudProvider struct {
	CloudProvider        *model.CloudProvider
	CloudProviderRegions *model.CloudProviderRegions
}

func (*CloudProvider) InstanceByID

func (p *CloudProvider) InstanceByID(id int64) *model.CloudProviderInstance

func (*CloudProvider) InstanceByName

func (p *CloudProvider) InstanceByName(name string) *model.CloudProviderInstance

func (*CloudProvider) InstanceByNameAndDiskSize added in v1.6.0

func (p *CloudProvider) InstanceByNameAndDiskSize(name string, diskSize int) *model.CloudProviderInstance

func (*CloudProvider) RegionByID

func (p *CloudProvider) RegionByID(id int64) *model.CloudProviderRegion

func (*CloudProvider) RegionByName

func (p *CloudProvider) RegionByName(name string) *model.CloudProviderRegion

type Cloudmeta

type Cloudmeta struct {
	CloudProviders []CloudProvider
	ScyllaVersions *model.ScyllaVersions
	GCPBlocks      map[string]string // region -> cidr block
}

func BuildCloudmeta

func BuildCloudmeta(ctx context.Context, c *Client) (*Cloudmeta, error)

func (*Cloudmeta) DefaultVersion

func (m *Cloudmeta) DefaultVersion() *model.ScyllaVersion

func (*Cloudmeta) ProviderByID

func (m *Cloudmeta) ProviderByID(id int64) *CloudProvider

func (*Cloudmeta) ProviderByName

func (m *Cloudmeta) ProviderByName(name string) *CloudProvider

func (*Cloudmeta) VersionByID

func (m *Cloudmeta) VersionByID(id int64) *model.ScyllaVersion

func (*Cloudmeta) VersionByName

func (m *Cloudmeta) VersionByName(name string) *model.ScyllaVersion

type RetryStrategy added in v1.6.0

type RetryStrategy struct {
	RetryStatus  []int
	RetryCode    []string
	RetryMessage []string
	FailMessage  []string
}

func (*RetryStrategy) Classify added in v1.6.0

func (rs *RetryStrategy) Classify(err error) retrier.Action

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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