client

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 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_all_services.graphql
	GetAllServicesQuery string
	//go:embed queries/get_service.graphql
	GetServiceQuery string
	//go:embed queries/vpcs.graphql
	GetVPCsQuery string
	//go:embed queries/products.graphql
	ProductsQuery string
	//go:embed queries/jwt_cc.graphql
	JWTFromCCQuery string
	//go:embed queries/attach_service_to_vpc.graphql
	AttachServiceToVPCMutation string
	//go:embed queries/detach_service_from_vpc.graphql
	DetachServiceFromVPCMutation string
	//go:embed queries/set_replica_count.graphql
	SetReplicaCountMutation 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) AttachServiceToVpc added in v0.3.2

func (c *Client) AttachServiceToVpc(ctx context.Context, serviceID string, vpcID int64) error

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) DetachServiceFromVpc added in v0.3.2

func (c *Client) DetachServiceFromVpc(ctx context.Context, serviceID string, vpcID int64) error

func (*Client) GetAllServices added in v1.2.0

func (c *Client) GetAllServices(ctx context.Context) ([]*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) GetVPCs added in v0.2.1

func (c *Client) GetVPCs(ctx context.Context) ([]*VPC, 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

func (*Client) SetReplicaCount added in v0.3.2

func (c *Client) SetReplicaCount(ctx context.Context, serviceID string, replicaCount int) error

type CreateServiceRequest

type CreateServiceRequest struct {
	Name         string
	MilliCPU     string
	MemoryGB     string
	RegionCode   string
	ReplicaCount string
	VpcID        int64
	ForkConfig   *ForkConfig
}

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 ForkConfig added in v1.2.0

type ForkConfig struct {
	ProjectID string `json:"projectID"`
	ServiceID string `json:"serviceID"`
	IsStandby bool   `json:"isStandby"`
}

type ForkSpec added in v1.2.0

type ForkSpec struct {
	ProjectID string `json:"projectId"`
	ServiceID string `json:"serviceId"`
	IsStandby bool   `json:"isStandby"`
}

type GetAllServicesResponse added in v1.2.0

type GetAllServicesResponse struct {
	Services []*Service `json:"getAllServices"`
}

type GetServiceResponse

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

type JWTFromCCResponse

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

type PeerVpc added in v0.2.1

type PeerVpc struct {
	ID         string `json:"id"`
	CIDR       string `json:"cidr"`
	AccountID  string `json:"accountId"`
	RegionCode string `json:"regionCode"`
}

type PeeringConnection added in v0.2.1

type PeeringConnection struct {
	ID           string     `json:"id"`
	VpcID        string     `json:"vpcId"`
	Status       string     `json:"status"`
	ErrorMessage string     `json:"errorMessage"`
	PeerVpcs     []*PeerVpc `json:"peerVpc"`
}

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
	MemoryGB     string
	ReplicaCount string
}

type ResourceSpec

type ResourceSpec struct {
	ID   string `json:"id"`
	Spec struct {
		MilliCPU int64 `json:"milliCPU"`
		MemoryGB int64 `json:"memoryGB"`
	} `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"`
	ProjectID         string `json:"projectId"`
	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"`
	ReplicaStatus string         `json:"replicaStatus"`
	VpcEndpoint   *VpcEndpoint   `json:"vpcEndpoint"`
	ForkSpec      *ForkSpec      `json:"forkedFromId"`
}

type ServiceSpec

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

type VPC added in v0.2.1

type VPC struct {
	ID                 string               `json:"id"`
	ProvisionedID      string               `json:"provisionedId"`
	ProjectID          string               `json:"projectId"`
	CIDR               string               `json:"cidr"`
	Name               string               `json:"name"`
	RegionCode         string               `json:"regionCode"`
	Status             string               `json:"status"`
	ErrorMessage       string               `json:"errorMessage"`
	Created            string               `json:"created"`
	Updated            string               `json:"updated"`
	PeeringConnections []*PeeringConnection `json:"peeringConnections"`
}

type VpcEndpoint added in v0.3.1

type VpcEndpoint struct {
	Host  string `json:"host"`
	Port  int64  `json:"port"`
	VpcId string `json:"vpcId"`
}

type VpcsResponse added in v0.2.1

type VpcsResponse struct {
	Vpcs []*VPC `json:"getAllVpcs"`
}

Jump to

Keyboard shortcuts

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