kraftcloud

package module
v0.5.9 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: BSD-3-Clause Imports: 12 Imported by: 2

README

KraftCloud Go SDK

This SDK is an early version of a Go-based client designed to interface with the KraftCloud API.

📖 Documentation

For a comprehensive list of all API endpoints and detailed usage, refer to the official KraftCloud documentation.

Requirements

Quick start

package main

import (
	"fmt"
	"context"

	kraftcloud "sdk.kraft.cloud"
)

func main() {
	client := kraftcloud.NewClient(
		kraftcloud.WithToken("token"),
	)

	images, err := client.Images().List(context.Background())
	if err != nil {
		fmt.Printf("failed: %v", err)
		return
	}

	for _, i := range images {
		fmt.Println(i.Digest)
	}
}

Examples

For additional practical implementations, check out the examples directory:

This example lists all images in your project

Here, you'll learn how to create an instance and display its console output. Subsequent actions include stopping and starting the instance, listing all instances in the project, and, ultimately, deleting the created instance.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAutoscaleClient added in v0.4.3

func NewAutoscaleClient(opts ...Option) scale.AutoscaleService

NewAutoscaleClient instantiates a client which interfaces with KraftCloud's autoscale API.

func NewCertificatesClient added in v0.5.1

func NewCertificatesClient(opts ...Option) certificates.CertificatesService

NewCertificatesClient instantiates a client which interfaces with KraftCloud's certificates API.

func NewDefaultOptions

func NewDefaultOptions(opts ...Option) *options.Options

NewDefaultOptions is a constructor method for instantiation a new set of default options for underlying requests to the KraftCloud API.

func NewImagesClient added in v0.3.0

func NewImagesClient(opts ...Option) images.ImagesService

NewImagesClient instantiates a new image services client based on the provided options.

func NewInstancesClient added in v0.3.0

func NewInstancesClient(opts ...Option) instances.InstancesService

NewInstancesClient instantiates a client which interfaces with KraftCloud's instances API.

func NewMetrosClient added in v0.5.1

func NewMetrosClient(opts ...Option) metros.MetrosService

NewMetrosClient instantiates a client which interfaces with KraftCloud's metros API.

func NewServicesClient added in v0.3.0

func NewServicesClient(opts ...Option) services.ServicesService

NewServicesClient instantiates a client which interfaces with KraftCloud's volumes API.

func NewUsersClient added in v0.3.0

func NewUsersClient(opts ...Option) users.UsersService

NewUsersClient instantiates a client which interfaces with KraftCloud's users API.

func NewVolumesClient added in v0.3.0

func NewVolumesClient(opts ...Option) volumes.VolumesService

NewVolumesClient instantiates a client which interfaces with KraftCloud's volumes API.

Types

type Client added in v0.3.0

type Client struct {
	// contains filtered or unexported fields
}

Client provides access to the KraftCloud API.

func (*Client) Autoscale added in v0.4.3

func (client *Client) Autoscale() scale.AutoscaleService

Autoscale returns AutoscaleService.

func (*Client) Certificates added in v0.5.1

func (client *Client) Certificates() certificates.CertificatesService

Certificates returns CertificatesService.

func (*Client) Images added in v0.3.0

func (client *Client) Images() images.ImagesService

Images returns ImagesService.

func (*Client) Instances added in v0.3.0

func (client *Client) Instances() instances.InstancesService

Instances returns InstancesService.

func (*Client) Metros added in v0.5.1

func (client *Client) Metros() metros.MetrosService

Metros returns MetrosService.

func (*Client) Services added in v0.3.0

func (client *Client) Services() services.ServicesService

Services returns ServicesService.

func (*Client) Users added in v0.3.0

func (client *Client) Users() users.UsersService

Users returns UsersService.

func (*Client) Volumes added in v0.3.0

func (client *Client) Volumes() volumes.VolumesService

Volumes returns VolumesService.

type KraftCloud added in v0.3.0

type KraftCloud interface {
	Autoscale() scale.AutoscaleService
	Certificates() certificates.CertificatesService
	Instances() instances.InstancesService
	Images() images.ImagesService
	Metros() metros.MetrosService
	Services() services.ServicesService
	Users() users.UsersService
	Volumes() volumes.VolumesService
}

KraftCloud are the public endpoint categories for the KraftCloud API.

func NewClient added in v0.3.0

func NewClient(copts ...Option) KraftCloud

NewClient is the top-level KraftCloud Services client used to speak with the API.

func NewClientFromOptions added in v0.3.0

func NewClientFromOptions(opts *options.Options) KraftCloud

NewClientFromOptions is the top-level KraftCloud Services client used to speak with the API with pre-defined options.

type Option

type Option func(*options.Options)

Option is an option function used during initialization of a client.

func WithDefaultMetro

func WithDefaultMetro(metro string) Option

WithDefaultMetro sets a KraftCloud metro, e.g. `fra0` which is based in Frankfurt.

func WithHTTPClient

func WithHTTPClient(httpClient httpclient.HTTPClient) Option

WithHTTPClient sets the HTTP client that's used to customize the connection to KraftCloud's API.

func WithToken

func WithToken(token string) Option

WithToken sets the access token of the client connecting to KraftCloud.

Directories

Path Synopsis
Package certificates manages TLS certificates on KraftCloud.
Package certificates manages TLS certificates on KraftCloud.
Package client provides the underlying structures, interfaces and methods for peforming requests against KraftCloud's API.
Package client provides the underlying structures, interfaces and methods for peforming requests against KraftCloud's API.
httpclient
Package httpclient provides an interface for enabling manipulating the underelying HTTP request performed by a client.
Package httpclient provides an interface for enabling manipulating the underelying HTTP request performed by a client.
options
Package options provides the structure representing the instantiated client options.
Package options provides the structure representing the instantiated client options.
Package images manages application images on KraftCloud.
Package images manages application images on KraftCloud.
Package instances manages instances on KraftCloud.
Package instances manages instances on KraftCloud.
Package uuid allows inspecting RFC 4122 UUIDs.
Package uuid allows inspecting RFC 4122 UUIDs.

Jump to

Keyboard shortcuts

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