cloud

package
v0.1.0-preview Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package cloud is the resource module for cloud-side provisioning.

These endpoints provision real resources in AWS/GCP/Azure, NOT on the SSH-into-VM path that install/ and deploy/ use. Examples:

  • S3 buckets, GCS buckets
  • IAM roles and policies
  • VPCs and subnets
  • EC2 / Compute Engine instances
  • RDS / Cloud SQL instances
  • Lambda / Cloud Functions
  • EKS / GKE clusters

Backed by /api/v2/tenant/provision/* on the tenant node, which in turn runs Terraform server-side.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionInput

type ActionInput struct {
	// InstanceID is the cloud provider's instance identifier. Required.
	InstanceID string
	// Action is one of "start", "stop", "restart", "reboot". Required.
	Action string
	// Cloud is the provider ("aws" | "gcp" | "azure"). Defaults to "aws".
	Cloud string
}

ActionInput describes a VM lifecycle action.

type Client

type Client struct {
	T              *transport.Transport
	NodeURL        string
	AuthedUsername string
}

Client is the cloud facade.

func (*Client) Database

func (c *Client) Database() *Database

Database returns the RDS / Cloud SQL sub-client.

func (*Client) IAM

func (c *Client) IAM() *IAM

IAM returns the IAM sub-client (roles + policies).

func (*Client) Kubernetes

func (c *Client) Kubernetes() *Kubernetes

Kubernetes returns the EKS / GKE sub-client.

func (*Client) Network

func (c *Client) Network() *Network

Network returns the VPC / network sub-client.

func (*Client) S3

func (c *Client) S3() *S3

S3 returns the S3 / object-storage sub-client.

func (*Client) Serverless

func (c *Client) Serverless() *Serverless

Serverless returns the Lambda / Cloud Functions sub-client.

func (*Client) VM

func (c *Client) VM() *VM

VM returns the EC2 / Compute-Engine sub-client.

type DBOpts

type DBOpts struct {
	Engine                  string // "postgres" | "postgresql" | "mysql" | "mariadb"
	EngineVersion           string
	InstanceClass           string
	StorageGB               int
	Username                string
	Password                string
	DBName                  string
	Port                    int
	VPCID                   string
	SubnetIDs               []string
	AllowedSecurityGroupIDs []string
	VPCSecurityGroupIDs     []string
	InstanceCount           int
	NodeType                string
	NumCacheNodes           int
	PubliclyAccessible      bool
	MultiAZ                 bool
	BackupRetention         int
	Encryption              bool
}

DBOpts describes a managed database provision request.

type Database

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

func (*Database) CreateAurora

func (d *Database) CreateAurora(ctx context.Context, name, region string, opts DBOpts) (*Result, error)

CreateAurora provisions an Aurora cluster. Pass at least two SubnetIDs.

func (*Database) CreateRDS

func (d *Database) CreateRDS(ctx context.Context, name, region string, opts DBOpts) (*Result, error)

CreateRDS provisions an RDS instance.

func (*Database) CreateRedis

func (d *Database) CreateRedis(ctx context.Context, name, region string, opts DBOpts) (*Result, error)

CreateRedis provisions an ElastiCache Redis cluster.

type IAM

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

func (*IAM) CreateKeypair

func (i *IAM) CreateKeypair(ctx context.Context, name, region string) (*Result, error)

CreateKeypair provisions an EC2 key pair. The private key is stored in the workspace vault under the given name; the public material is uploaded to AWS.

func (*IAM) CreatePolicy

func (i *IAM) CreatePolicy(ctx context.Context, name string, policyDocument string) (*Result, error)

CreatePolicy provisions an IAM policy. policyDocument is the inline JSON document; the SDK passes it through to the Terraform aws_iam_policy resource.

func (*IAM) CreateRole

func (i *IAM) CreateRole(ctx context.Context, name string, assumeRolePolicy string) (*Result, error)

CreateRole provisions an IAM role. assumeRolePolicy is the trust policy document.

type Kubernetes

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

func (*Kubernetes) CreateCluster

func (k *Kubernetes) CreateCluster(ctx context.Context, name, cloud, region string) (*Result, error)

CreateCluster provisions a managed Kubernetes cluster.

type Network

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

func (*Network) CreateVPC

func (n *Network) CreateVPC(ctx context.Context, name, cloud, region string) (*Result, error)

CreateVPC provisions a VPC.

type Result

type Result struct {
	SessionID        string                 `json:"session_id"`
	Status           string                 `json:"status,omitempty"`
	ResourceName     string                 `json:"resource_name,omitempty"`
	ARN              string                 `json:"arn,omitempty"`
	BucketName       string                 `json:"bucket_name,omitempty"`
	InstanceID       string                 `json:"instance_id,omitempty"`
	ExecutionTime    string                 `json:"execution_time,omitempty"`
	StatePath        string                 `json:"state_path,omitempty"`
	TerraformOutputs map[string]interface{} `json:"terraform_outputs,omitempty"`
}

Result is what every cloud provisioning endpoint returns.

type S3

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

func (*S3) CreateBucket

func (s *S3) CreateBucket(ctx context.Context, name, cloud, region string) (*Result, error)

CreateBucket provisions a bucket. Cloud may be "aws" (S3) or "gcp" (GCS) or "azure" (Blob); region is the cloud-specific region string.

type Serverless

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

func (*Serverless) CreateFunction

func (s *Serverless) CreateFunction(ctx context.Context, name, cloud, region, runtime string) (*Result, error)

CreateFunction provisions a serverless function.

type StatusInput

type StatusInput struct {
	// InstanceID is the cloud provider's instance identifier (e.g. an
	// AWS EC2 instance id). Required.
	InstanceID string
	// Cloud is the provider ("aws" | "gcp" | "azure"). Defaults to "aws".
	Cloud string
}

StatusInput describes a VM status lookup.

type VM

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

func (*VM) Action

func (v *VM) Action(ctx context.Context, input ActionInput) (map[string]any, error)

Action issues a lifecycle action against a previously-provisioned VM. Valid actions are "start", "stop", "restart", and "reboot" — anything else returns a ValidationError before any network round-trip.

Maps to POST {NodeURL}/api/v2/provision/vm/action.

func (*VM) Create

func (v *VM) Create(ctx context.Context, name, cloud, region string, opts VMOpts) (*Result, error)

Create provisions a VM.

func (*VM) Status

func (v *VM) Status(ctx context.Context, input StatusInput) (map[string]any, error)

Status returns the current power / lifecycle state of a previously- provisioned VM.

Maps to POST {NodeURL}/api/v2/provision/vm/status.

type VMOpts

type VMOpts struct {
	InstanceType string // e.g. t3.small
	VolumeSizeGB int
	Replicas     int
}

VMOpts describes a VM provision request.

Jump to

Keyboard shortcuts

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