v1

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package v1 provides a library to work with the Selectel Managed Kubernetes Service API V1.

Index

Constants

View Source
const (
	ResourceURLCluster             = "clusters"
	ResourceURLKubeversion         = "kubeversions"
	ResourceURLKubeconfig          = "kubeconfig"
	ResourceURLRotateCerts         = "rotate-certs"
	ResourceURLUpgradePatchVersion = "upgrade-patch-version"
	ResourceURLUpgradeMinorVersion = "upgrade-minor-version"
	ResourceURLTask                = "tasks"
	ResourceURLNodegroup           = "nodegroups"
	ResourceURLResize              = "resize"
	ResourceURLReinstall           = "reinstall"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrGeneric

type ErrGeneric struct {
	Error struct {
		// Message of the error.
		Message string `json:"message"`
	} `json:"error"`
}

ErrGeneric represents a generic error of an HTTP response.

type ErrNotFound

type ErrNotFound struct {
	Error struct {
		// Object ID.
		ID string `json:"id"`

		// Message of the error.
		Message string `json:"message"`
	} `json:"error"`
}

ErrNotFound represents 'not found' error of an HTTP response.

type ResponseResult

type ResponseResult struct {
	*http.Response

	*ErrNotFound

	*ErrGeneric

	// Err contains an error that can be provided to a caller.
	Err error
}

ResponseResult represents a result of an HTTP request. It embeds standard http.Response and adds custom API error representations.

func (*ResponseResult) ExtractRaw

func (result *ResponseResult) ExtractRaw() ([]byte, error)

ExtractRaw extracts ResponseResult body into the slice of bytes without unmarshalling.

func (*ResponseResult) ExtractResult

func (result *ResponseResult) ExtractResult(to interface{}) error

ExtractResult allows to provide an object into which ResponseResult body will be extracted.

type ServiceClient

type ServiceClient struct {
	// HTTPClient represents an initialized HTTP client that will be used to do requests.
	HTTPClient *http.Client

	// TokenID is a client authentication token.
	TokenID string

	// Endpoint represents an endpoint that will be used in all requests.
	Endpoint string

	// UserAgent contains user agent that will be used in all requests.
	UserAgent string
}

ServiceClient stores details that are needed to work with Selectel Managed Kubernetes Service API.

func NewMKSClientV1

func NewMKSClientV1(tokenID, endpoint string) *ServiceClient

NewMKSClientV1 initializes a new MKS client for the V1 API.

func NewMKSClientV1WithCustomHTTP added in v0.7.0

func NewMKSClientV1WithCustomHTTP(customHTTPClient *http.Client, tokenID, endpoint string) *ServiceClient

NewMKSClientV1WithCustomHTTP initializes a new MKS client for the V1 API using custom HTTP client. If custom HTTP client is nil - default HTTP client will be used.

func (*ServiceClient) DoRequest

func (client *ServiceClient) DoRequest(ctx context.Context, method, path string, body io.Reader) (*ResponseResult, error)

DoRequest performs the HTTP request with the current ServiceClient's HTTPClient. Authentication and optional headers will be added automatically.

Directories

Path Synopsis
Package cluster provides the ability to retrieve and manage Kubernetes clusters through the MKS V1 API.
Package cluster provides the ability to retrieve and manage Kubernetes clusters through the MKS V1 API.
Package kubeversion provides the ability to retrieve all supported Kubernetes versions through the MKS V1 API.
Package kubeversion provides the ability to retrieve all supported Kubernetes versions through the MKS V1 API.
Package node provides the ability to retrieve and manage Kubernetes nodes of a cluster nodegroup through the MKS V1 API.
Package node provides the ability to retrieve and manage Kubernetes nodes of a cluster nodegroup through the MKS V1 API.
Package nodegroup provides the ability to retrieve and manage cluster nodegroups through the MKS V1 API.
Package nodegroup provides the ability to retrieve and manage cluster nodegroups through the MKS V1 API.
Package task provides the ability to retrieve cluster tasks through the MKS V1 API.
Package task provides the ability to retrieve cluster tasks through the MKS V1 API.

Jump to

Keyboard shortcuts

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