client

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//go:embed queries/create_service.graphql
	CreateServiceMutation string
	//go:embed queries/rename_service.graphql
	RenameServiceMutation string
	//go:embed queries/resize_instance.graphql
	ResizeInstanceMutation string
	//go:embed queries/delete_service.graphql
	DeleteServiceMutation string
	//go:embed queries/get_service.graphql
	GetServiceQuery string
	//go:embed queries/products.graphql
	ProductsQuery string
	//go:embed queries/jwt_cc.graphql
	JWTFromCCQuery string
)

Functions

func JWTFromCC

func JWTFromCC(c *Client, accessKey, secretKey string) error

Types

type Client

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

func NewClient

func NewClient(token, projectID, env, terraformVersion string) *Client

func (*Client) CreateService

func (c *Client) CreateService(ctx context.Context, request CreateServiceRequest) (*CreateServiceResponse, error)

func (*Client) DeleteService

func (c *Client) DeleteService(ctx context.Context, id string) (*Service, error)

func (*Client) GetProducts

func (c *Client) GetProducts(ctx context.Context) ([]*Product, error)

func (*Client) GetService

func (c *Client) GetService(ctx context.Context, id string) (*Service, error)

func (*Client) RenameService

func (c *Client) RenameService(ctx context.Context, serviceID string, newName string) error

func (*Client) ResizeInstance

func (c *Client) ResizeInstance(ctx context.Context, serviceID string, config ResourceConfig) error

type CreateServiceRequest

type CreateServiceRequest struct {
	Name                     string
	EnableStorageAutoscaling bool
	MilliCPU                 string
	StorageGB                string
	MemoryGB                 string
	RegionCode               string
}

type CreateServiceResponse

type CreateServiceResponse struct {
	Service         Service `json:"service"`
	InitialPassword string  `json:"initialPassword"`
}

type CreateServiceResponseData

type CreateServiceResponseData struct {
	CreateServiceResponse CreateServiceResponse `json:"createService"`
}

type DeleteServiceResponse

type DeleteServiceResponse struct {
	Service Service `json:"deleteService"`
}

type Error

type Error struct {
	Message string `json:"message"`
}

func (*Error) Error

func (e *Error) Error() string

type GetServiceResponse

type GetServiceResponse struct {
	Service Service `json:"getService"`
}

type JWTFromCCResponse

type JWTFromCCResponse struct {
	Token string `json:"getJWTForClientCredentials"`
}

type Plan

type Plan struct {
	ID         string  `json:"id"`
	ProductID  string  `json:"productId"`
	RegionCode string  `json:"regionCode"`
	Price      float64 `json:"price"`
	MilliCPU   int64   `json:"milliCPU"`
	MemoryGB   int64   `json:"memoryGB"`
	StorageGB  int64   `json:"storageGB"`
}

type Product

type Product struct {
	ID          string  `json:"id"`
	Name        string  `json:"name"`
	Description string  `json:"description"`
	Plans       []*Plan `json:"plans"`
}

type ProductsResponse

type ProductsResponse struct {
	Products []*Product `json:"products"`
}

type ResourceConfig

type ResourceConfig struct {
	MilliCPU  string
	StorageGB string
	MemoryGB  string
}

type ResourceSpec

type ResourceSpec struct {
	ID   string `json:"id"`
	Spec struct {
		MilliCPU  int64 `json:"milliCPU"`
		MemoryGB  int64 `json:"memoryGB"`
		StorageGB int64 `json:"storageGB"`
	} `json:"spec"`
}

type Response

type Response[T any] struct {
	Data   *T       `json:"data"`
	Errors []*Error `json:"errors"`
}

type Service

type Service struct {
	ID                string `json:"id"`
	Name              string `json:"name"`
	AutoscaleSettings struct {
		Enabled bool `json:"enabled"`
	} `json:"autoscaleSettings"`
	Status      string         `json:"status"`
	RegionCode  string         `json:"regionCode"`
	ServiceSpec ServiceSpec    `json:"spec"`
	Resources   []ResourceSpec `json:"resources"`
	Created     string         `json:"created"`
}

type ServiceSpec

type ServiceSpec struct {
	Hostname string `json:"hostname"`
	Username string `json:"username"`
	Port     int64  `json:"port"`
}

Jump to

Keyboard shortcuts

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