v1

package
v0.0.0-...-ddfb4b1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PendingToRunningTimeout    = 20 * time.Minute
	RunningToStoppedTimeout    = 10 * time.Minute
	StoppedToRunningTimeout    = 20 * time.Minute
	RunningToTerminatedTimeout = 20 * time.Minute
)
View Source
const RunningSSHTimeout = 10 * time.Minute

Variables

View Source
var (
	ErrBytesInvalidUnit = errors.New("invalid unit")
	ErrBytesNotAnInt64  = errors.New("byte count is not an int64")
	ErrBytesNotAnInt32  = errors.New("byte count is not an int32")
)
View Source
var (
	Byte = BytesUnit{/* contains filtered or unexported fields */}

	// Base 10
	Kilobyte = BytesUnit{/* contains filtered or unexported fields */}
	Megabyte = BytesUnit{/* contains filtered or unexported fields */}
	Gigabyte = BytesUnit{/* contains filtered or unexported fields */}
	Terabyte = BytesUnit{/* contains filtered or unexported fields */}
	Petabyte = BytesUnit{/* contains filtered or unexported fields */}
	Exabyte  = BytesUnit{/* contains filtered or unexported fields */}

	// Base 2
	Kibibyte = BytesUnit{/* contains filtered or unexported fields */}
	Mebibyte = BytesUnit{/* contains filtered or unexported fields */}
	Gibibyte = BytesUnit{/* contains filtered or unexported fields */}
	Tebibyte = BytesUnit{/* contains filtered or unexported fields */}
	Pebibyte = BytesUnit{/* contains filtered or unexported fields */}
	Exbibyte = BytesUnit{/* contains filtered or unexported fields */}
)
View Source
var (
	ErrInsufficientResources = errors.New("zone has insufficient resources to fulfill the request, InsufficientCapacity")
	ErrOutOfQuota            = errors.New("out of quota in the region fulfill the request, InsufficientQuota")
	ErrImageNotFound         = errors.New("image not found")
	ErrDuplicateFirewallRule = errors.New("duplicate firewall rule")
	ErrInstanceNotFound      = errors.New("instance not found")
	ErrResourceNotFound      = errors.New("resource not found")
	ErrServiceUnavailable    = errors.New("api is temporarily unavailable")
)
View Source
var (
	ErrRefIDRequired                                            = errors.New("refID is required")
	ErrNameRequired                                             = errors.New("name is required")
	ErrNodeGroupInvalidStatus                                   = errors.New("invalid node group status")
	ErrClusterInvalidStatus                                     = errors.New("invalid cluster status")
	ErrClusterUserClusterNameRequired                           = errors.New("clusterName is required")
	ErrClusterUserClusterCertificateAuthorityDataBase64Required = errors.New("clusterCertificateAuthorityDataBase64 is required")
	ErrClusterUserClusterServerURLRequired                      = errors.New("clusterServerURL is required")
	ErrClusterUserUsernameRequired                              = errors.New("username is required")
	ErrClusterUserUserClientCertificateDataBase64Required       = errors.New("userClientCertificateDataBase64 is required")
	ErrClusterUserUserClientKeyDataBase64Required               = errors.New("userClientKeyDataBase64 is required")
	ErrClusterUserKubeconfigBase64Required                      = errors.New("kubeconfigBase64 is required")
)
View Source
var (
	ClusterStatusUnknown   = ClusterStatus{/* contains filtered or unexported fields */}
	ClusterStatusPending   = ClusterStatus{/* contains filtered or unexported fields */}
	ClusterStatusAvailable = ClusterStatus{/* contains filtered or unexported fields */}
	ClusterStatusDeleting  = ClusterStatus{/* contains filtered or unexported fields */}
	ClusterStatusFailed    = ClusterStatus{/* contains filtered or unexported fields */}
)
View Source
var (
	NodeGroupStatusUnknown   = NodeGroupStatus{/* contains filtered or unexported fields */}
	NodeGroupStatusPending   = NodeGroupStatus{/* contains filtered or unexported fields */}
	NodeGroupStatusAvailable = NodeGroupStatus{/* contains filtered or unexported fields */}
	NodeGroupStatusDeleting  = NodeGroupStatus{/* contains filtered or unexported fields */}
	NodeGroupStatusFailed    = NodeGroupStatus{/* contains filtered or unexported fields */}
)
View Source
var All = []string{"all"}
View Source
var ErrNotImplemented = errors.New("not implemented")

Functions

func HashSensitiveString

func HashSensitiveString(s string) (string, error)

func ValidateClusterNodeGroups

func ValidateClusterNodeGroups(ctx context.Context, client CloudMaintainKubernetes, attrs GetClusterArgs, nodeGroup NodeGroup) error

ValidateClusterNodeGroups validates that the GetCluster functionality works correctly.

func ValidateDeleteKubernetesCluster

func ValidateDeleteKubernetesCluster(ctx context.Context, client CloudMaintainKubernetes, attrs DeleteClusterArgs) error

ValidateDeleteKubernetesCluster validates that the DeleteCluster functionality works correctly.

func ValidateDeleteKubernetesNodeGroup

func ValidateDeleteKubernetesNodeGroup(ctx context.Context, client CloudMaintainKubernetes, attrs DeleteNodeGroupArgs) error

ValidateDeleteKubernetesNodeGroup validates that the DeleteNodeGroup functionality works correctly.

func ValidateDeleteVPC

func ValidateDeleteVPC(ctx context.Context, client CloudMaintainVPC, attrs DeleteVPCArgs) error

ValidateDeleteVPC validates that the DeleteVPC functionality works correctly.

func ValidateGetInstanceTypes

func ValidateGetInstanceTypes(ctx context.Context, client CloudInstanceType) error

ValidateGetInstanceTypes validates that the GetInstanceTypes functionality works correctly by testing that filtering by specific instance types returns the expected results

func ValidateGetLocations

func ValidateGetLocations(ctx context.Context, client CloudLocation) error

ValidateGetLocations validates that the CloudLocation implementation returns at least one available location without error.

func ValidateInstanceImage

func ValidateInstanceImage(ctx context.Context, instance Instance, privateKey string) error

func ValidateInstanceSSHAccessible

func ValidateInstanceSSHAccessible(ctx context.Context, client CloudInstanceReader, instance *Instance, privateKey string) error

func ValidateListCreatedInstance

func ValidateListCreatedInstance(ctx context.Context, client CloudCreateTerminateInstance, i *Instance) error

func ValidateLocationalInstanceTypes

func ValidateLocationalInstanceTypes(ctx context.Context, client CloudInstanceType) error

ValidateLocationalInstanceTypes validates that locational filtering works correctly by comparing locational results with all-location results using CloudLocation capabilities

func ValidateMergeInstanceForUpdate

func ValidateMergeInstanceForUpdate(client UpdateHandler, currInst Instance, newInst Instance) error

func ValidateModifyKubernetesNodeGroup

func ValidateModifyKubernetesNodeGroup(ctx context.Context, client CloudMaintainKubernetes, attrs ModifyNodeGroupArgs) error

ValidateModifyKubernetesNodeGroup validates that the ModifyNodeGroup functionality works correctly.

func ValidateStableInstanceTypeIDs

func ValidateStableInstanceTypeIDs(ctx context.Context, client CloudInstanceType, stableIDs []InstanceTypeID) error

ValidateStableInstanceTypeIDs validates that the provided stable instance type IDs are valid and stable This function ensures that stable IDs exist in the current instance types and have required properties

func ValidateStopStartInstance

func ValidateStopStartInstance(ctx context.Context, client CloudStopStartInstance, instance *Instance) error

func ValidateTerminateInstance

func ValidateTerminateInstance(ctx context.Context, client CloudCreateTerminateInstance, instance *Instance) error

Types

type APIType

type APIType string
const (
	APITypeLocational APIType = "locational"
	APITypeGlobal     APIType = "global"
)

type AddFirewallRulesToInstanceArgs

type AddFirewallRulesToInstanceArgs struct {
	InstanceID    CloudProviderInstanceID
	FirewallRules FirewallRules
}

type Architecture

type Architecture string
const (
	ArchitectureX86_64  Architecture = "x86_64"
	ArchitectureARM64   Architecture = "arm64"
	ArchitectureUnknown Architecture = "unknown"
)

func GetArchitecture

func GetArchitecture(architecture string) Architecture

type ArchitectureFilter

type ArchitectureFilter struct {
	// If IncludeArchitectures is provided, only the architectures in the list will be included
	IncludeArchitectures []Architecture

	// If ExcludeArchitectures is provided, the architectures in the list will be excluded
	ExcludeArchitectures []Architecture
}

ArchitectureFilter allows for filtering of instance types by architecture.

func (*ArchitectureFilter) IsAllowed

func (f *ArchitectureFilter) IsAllowed(architecture Architecture) bool

type Bytes

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

Bytes represents a number of some unit of bytes

func NewBytes

func NewBytes(value BytesValue, unit BytesUnit) Bytes

NewBytes creates a new Bytes with the given value and unit.

func (Bytes) ByteCount

func (b Bytes) ByteCount() *big.Int

ByteCount is the total number of bytes in the Bytes

func (Bytes) ByteCountInUnit

func (b Bytes) ByteCountInUnit(unit BytesUnit) *big.Float

ByteCountInUnit is the number of bytes in the Bytes of the given unit. For example, if the Bytes is 1000 MB, then:

	1000 MB -> B  = 1000000
	1000 MB -> KB = 1000
	1000 MB -> MB = 1
    1000 MB -> GB = .001

etc.

func (Bytes) ByteCountInUnitInt32

func (b Bytes) ByteCountInUnitInt32(unit BytesUnit) (int32, error)

ByteCountInUnitInt32 attempts to convert the result of ByteCountInUnit to an int32. If this conversion would result in an overflow, it returns an ErrBytesNotAnInt32 error.

func (Bytes) ByteCountInUnitInt64

func (b Bytes) ByteCountInUnitInt64(unit BytesUnit) (int64, error)

ByteCountInUnitInt64 attempts to convert the result of ByteCountInUnit to an int64. If this conversion would result in an overflow, it returns an ErrBytesNotAnInt64 error. If the byte count is not an integer, the value is truncated towards zero.

func (Bytes) Equal

func (b Bytes) Equal(other Bytes) bool

Equal returns true if the Bytes is equal to the other Bytes

func (Bytes) GreaterThan

func (b Bytes) GreaterThan(other Bytes) bool

GreaterThan returns true if the Bytes is greater than the other Bytes

func (Bytes) LessThan

func (b Bytes) LessThan(other Bytes) bool

LessThan returns true if the Bytes is less than the other Bytes

func (Bytes) MarshalJSON

func (b Bytes) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (Bytes) String

func (b Bytes) String() string

String returns the string representation of the Bytes

func (Bytes) Unit

func (b Bytes) Unit() BytesUnit

Unit is the unit of the byte value

func (*Bytes) UnmarshalJSON

func (b *Bytes) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

func (Bytes) Value

func (b Bytes) Value() BytesValue

Value is the whole non-negative number of bytes of the specified unit

type BytesUnit

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

BytesUnit is a unit of measurement for bytes. Note for maintainers: this is defined as a struct rather than a type alias to ensure stronger compile-time type checking and to avoid the need for a validation function.

func (BytesUnit) String

func (u BytesUnit) String() string

String returns the string representation of the BytesUnit

type BytesValue

type BytesValue int64

type Capabilities

type Capabilities []Capability

func (Capabilities) IsCapable

func (c Capabilities) IsCapable(cc Capability) bool

type Capability

type Capability string
const (
	CapabilityCreateInstance           Capability = "create-instance"
	CapabilityCreateIdempotentInstance Capability = "create-instance-idempotent"
	CapabilityTerminateInstance        Capability = "terminate-instance"
	CapabilityCreateTerminateInstance  Capability = "create-terminate-instance"
	CapabilityInstanceUserData         Capability = "instance-userdata" // specify user data when creating an instance in CreateInstanceAttrs // should be in instance type
	CapabilityTags                     Capability = "tags"
	CapabilityRebootInstance           Capability = "reboot-instance"
	CapabilityResizeInstanceVolume     Capability = "resize-instance-volume"
	CapabilityStopStartInstance        Capability = "stop-start-instance"
	CapabilityMachineImage             Capability = "machine-image"
	CapabilityModifyFirewall           Capability = "modify-firewall"
	CapabilityVPC                      Capability = "vpc"
	CapabilityManagedKubernetes        Capability = "managed-kubernetes"
)

type CloudAPI

type CloudAPI interface {
	GetAPIType() APIType
	GetCapabilities(ctx context.Context) (Capabilities, error)
	GetCloudProviderID() CloudProviderID
}

type CloudBase

type CloudBase interface {
	CloudCreateTerminateInstance
}

type CloudChangeInstanceType

type CloudChangeInstanceType interface {
	ChangeInstanceType(ctx context.Context, instanceID CloudProviderInstanceID, instanceType string) error
}

type CloudCreateTerminateInstance

type CloudCreateTerminateInstance interface {
	// CreateInstance expects an instance object to exist if successful, and no instance to exist if there is ANY error
	//      CloudClient Implementers: ensure that the instance is terminated if there is an error
	// Public ip is not always returned from create, but will exist when instance is in running state
	CreateInstance(ctx context.Context, attrs CreateInstanceAttrs) (*Instance, error)
	TerminateInstance(ctx context.Context, instanceID CloudProviderInstanceID) error // may or may not be locationally scoped
	GetMaxCreateRequestsPerMinute() int
	CloudInstanceType
	CloudInstanceReader
}

type CloudCredential

type CloudCredential interface {
	MakeClient(ctx context.Context, location string) (CloudClient, error)
	GetTenantID() (string, error)
	GetReferenceID() string
	CloudAPI
}

type CloudFilter

type CloudFilter struct {
	// If IncludeClouds is provided, only the clouds in the list will be included
	IncludeClouds []string

	// If ExcludeClouds is provided, the clouds in the list will be excluded
	ExcludeClouds []string
}

CloudFilter allows for filtering of instance types by cloud.

func (*CloudFilter) IsAllowed

func (f *CloudFilter) IsAllowed(cloud string) bool

type CloudInstanceReader

type CloudInstanceReader interface {
	GetInstance(ctx context.Context, id CloudProviderInstanceID) (*Instance, error)
	ListInstances(ctx context.Context, args ListInstancesArgs) ([]Instance, error)
}

type CloudInstanceTags

type CloudInstanceTags interface {
	UpdateInstanceTags(ctx context.Context, args UpdateInstanceTagsArgs) error
}

type CloudInstanceType

type CloudInstanceType interface {
	GetInstanceTypes(ctx context.Context, args GetInstanceTypeArgs) ([]InstanceType, error)
	GetInstanceTypePollTime() time.Duration
	CloudLocation
}

type CloudLocation

type CloudLocation interface {
	GetLocations(ctx context.Context, args GetLocationsArgs) ([]Location, error)
}

type CloudMachineImage

type CloudMachineImage interface {
	GetImages(ctx context.Context, args GetImageArgs) ([]Image, error)
}

type CloudMaintainKubernetes

type CloudMaintainKubernetes interface {
	// Create a new Kubernetes cluster.
	CreateCluster(ctx context.Context, args CreateClusterArgs) (*Cluster, error)

	// Get a Kubernetes cluster identified by the provided args.
	GetCluster(ctx context.Context, args GetClusterArgs) (*Cluster, error)

	// Idempotently set a user into a Kubernetes cluster.
	SetClusterUser(ctx context.Context, args SetClusterUserArgs) (*ClusterUser, error)

	// Create a new Kubernetes node group.
	CreateNodeGroup(ctx context.Context, args CreateNodeGroupArgs) (*NodeGroup, error)

	// Get a Kubernetes node group identified by the provided args.
	GetNodeGroup(ctx context.Context, args GetNodeGroupArgs) (*NodeGroup, error)

	// Modify a Kubernetes node group.
	ModifyNodeGroup(ctx context.Context, args ModifyNodeGroupArgs) error

	// Delete a Kubernetes node group identified by the provided args.
	DeleteNodeGroup(ctx context.Context, args DeleteNodeGroupArgs) error

	// Delete a Kubernetes cluster identified by the provided args.
	DeleteCluster(ctx context.Context, args DeleteClusterArgs) error
}

type CloudMaintainVPC

type CloudMaintainVPC interface {
	// Create a new VPC.
	CreateVPC(ctx context.Context, args CreateVPCArgs) (*VPC, error)

	// Get a VPC identified by the provided args.
	GetVPC(ctx context.Context, args GetVPCArgs) (*VPC, error)

	// Delete a VPC identified by the provided args.
	DeleteVPC(ctx context.Context, args DeleteVPCArgs) error
}

type CloudModifyFirewall

type CloudModifyFirewall interface {
	AddFirewallRulesToInstance(ctx context.Context, args AddFirewallRulesToInstanceArgs) error
	RevokeSecurityGroupRules(ctx context.Context, args RevokeSecurityGroupRuleArgs) error
}

type CloudProviderID

type CloudProviderID string // aws, gcp, azure, etc.

type CloudProviderInstanceID

type CloudProviderInstanceID string

type CloudProviderResourceID

type CloudProviderResourceID string

type CloudQuota

type CloudQuota interface {
	GetInstanceTypeQuotas(ctx context.Context, args GetInstanceTypeQuotasArgs) (Quota, error)
}

type CloudRebootInstance

type CloudRebootInstance interface {
	RebootInstance(ctx context.Context, instanceID CloudProviderInstanceID) error
}

type CloudResizeInstanceVolume

type CloudResizeInstanceVolume interface {
	ResizeInstanceVolume(ctx context.Context, args ResizeInstanceVolumeArgs) error
}

type CloudStopStartInstance

type CloudStopStartInstance interface {
	StopInstance(ctx context.Context, instanceID CloudProviderInstanceID) error
	StartInstance(ctx context.Context, instanceID CloudProviderInstanceID) error
}

type Cluster

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

Cluster represents the complete specification of a Brev Kubernetes cluster.

func NewCluster

func NewCluster(settings ClusterSettings) (*Cluster, error)

NewCluster creates a new Cluster from the provided settings.

func ValidateCreateKubernetesCluster

func ValidateCreateKubernetesCluster(ctx context.Context, client CloudMaintainKubernetes, attrs CreateClusterArgs) (*Cluster, error)

ValidateCreateKubernetesCluster validates that the CreateCluster functionality works correctly.

func ValidateGetKubernetesCluster

func ValidateGetKubernetesCluster(ctx context.Context, client CloudMaintainKubernetes, attrs GetClusterArgs) (*Cluster, error)

ValidateGetKubernetesCluster validates that the GetCluster functionality works correctly.

func (*Cluster) GetAPIEndpoint

func (c *Cluster) GetAPIEndpoint() string

func (*Cluster) GetCloud

func (c *Cluster) GetCloud() string

func (*Cluster) GetClusterCACertificateBase64

func (c *Cluster) GetClusterCACertificateBase64() string

func (*Cluster) GetID

func (c *Cluster) GetID() CloudProviderResourceID

func (*Cluster) GetKubernetesVersion

func (c *Cluster) GetKubernetesVersion() string

func (*Cluster) GetLocation

func (c *Cluster) GetLocation() string

func (*Cluster) GetName

func (c *Cluster) GetName() string

func (*Cluster) GetNodeGroups

func (c *Cluster) GetNodeGroups() []*NodeGroup

func (*Cluster) GetProvider

func (c *Cluster) GetProvider() string

func (*Cluster) GetRefID

func (c *Cluster) GetRefID() string

func (*Cluster) GetStatus

func (c *Cluster) GetStatus() ClusterStatus

func (*Cluster) GetSubnetIDs

func (c *Cluster) GetSubnetIDs() []CloudProviderResourceID

func (*Cluster) GetTags

func (c *Cluster) GetTags() Tags

func (*Cluster) GetVPCID

func (c *Cluster) GetVPCID() CloudProviderResourceID

func (*Cluster) MarshalJSON

func (c *Cluster) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*Cluster) UnmarshalJSON

func (c *Cluster) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

type ClusterSettings

type ClusterSettings struct {
	// The ID assigned by the cloud provider to the cluster.
	ID CloudProviderResourceID

	// The name of the cluster, displayed on clients.
	Name string

	// The unique ID used to associate with this cluster.
	RefID string

	// The cloud provider that manages the cluster.
	Provider string

	// The cloud that hosts the cluster.
	Cloud string

	// The location of the cluster.
	Location string

	// The ID of the VPC that the cluster is associated with.
	VPCID CloudProviderResourceID

	// The subnet IDs that the cluster's nodes are deployed into.
	SubnetIDs []CloudProviderResourceID

	// The version of Kubernetes that the cluster is running.
	KubernetesVersion string

	// The status of the cluster.
	Status ClusterStatus

	// The API endpoint of the cluster.
	APIEndpoint string

	// The CA certificate of the cluster, in base64.
	ClusterCACertificateBase64 string

	// The node groups associated with the cluster.
	NodeGroups []*NodeGroup

	// The tags associated with the cluster.
	Tags Tags
}

ClusterSettings represents the settings for a Kubernetes cluster. This is the input to the NewCluster function.

type ClusterStatus

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

ClusterStatus represents the status of a Kubernetes cluster. Note for maintainers: this is defined as a struct rather than a type alias to ensure stronger compile-time type checking and to avoid the need for a validation function.

func (ClusterStatus) String

func (s ClusterStatus) String() string

type ClusterUser

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

ClusterUser represents the complete specification of a Brev Kubernetes cluster user.

func NewClusterUser

func NewClusterUser(settings ClusterUserSettings) (*ClusterUser, error)

NewClusterUser creates a new ClusterUser from the provided settings.

func ValidateSetKubernetesClusterUser

func ValidateSetKubernetesClusterUser(ctx context.Context, client CloudMaintainKubernetes, attrs SetClusterUserArgs) (*ClusterUser, error)

ValidateSetKubernetesClusterUser validates that the SetClusterUser functionality works correctly.

func (*ClusterUser) GetClusterCertificateAuthorityDataBase64

func (c *ClusterUser) GetClusterCertificateAuthorityDataBase64() string

func (*ClusterUser) GetClusterName

func (c *ClusterUser) GetClusterName() string

func (*ClusterUser) GetClusterServerURL

func (c *ClusterUser) GetClusterServerURL() string

func (*ClusterUser) GetKubeconfigBase64

func (c *ClusterUser) GetKubeconfigBase64() string

func (*ClusterUser) GetUserClientCertificateDataBase64

func (c *ClusterUser) GetUserClientCertificateDataBase64() string

func (*ClusterUser) GetUserClientKeyDataBase64

func (c *ClusterUser) GetUserClientKeyDataBase64() string

func (*ClusterUser) GetUsername

func (c *ClusterUser) GetUsername() string

type ClusterUserSettings

type ClusterUserSettings struct {
	// The name of the cluster that the user is associated with.
	ClusterName string

	// The CA certificate of the cluster, in base64.
	ClusterCertificateAuthorityDataBase64 string

	// The API endpoint of the cluster.
	ClusterServerURL string

	// The username of the user.
	Username string

	// The client certificate of the user, in base64.
	UserClientCertificateDataBase64 string

	// The client key of the user, in base64.
	UserClientKeyDataBase64 string

	// The kubeconfig of the user, in base64.
	KubeconfigBase64 string
}

ClusterUserSettings represents the settings for a Kubernetes cluster user. This is the input to the NewClusterUser function.

type CreateClusterArgs

type CreateClusterArgs struct {
	Name              string
	RefID             string
	VPCID             CloudProviderResourceID
	SubnetIDs         []CloudProviderResourceID
	KubernetesVersion string
	Tags              Tags
}

type CreateInstanceAttrs

type CreateInstanceAttrs struct {
	Location             string
	SubLocation          string
	Name                 string
	RefID                string // required also can be used for idempotency
	VPCID                string
	SubnetID             string
	PublicKey            string // must be in openssh format
	KeyPairName          *string
	ImageID              string
	InstanceType         string
	UserDataBase64       string
	DiskSize             units.Base2Bytes // TODO: deprecate in favor of DiskSizeByteValue
	DiskSizeBytes        Bytes
	Tags                 Tags
	FirewallRules        FirewallRules
	UseSpot              bool
	UsePersistentIP      bool
	UseMultiAttachVolume bool
	RetireTimeout        *time.Duration
	// Additional Environment Variables.
	// Note: As of May 2024, the only cloud provider we have this implemented for
	// is the Akash provider.
	AdditionalEnvVars map[string]string
	AdditionalDisks   []Disk
}

type CreateNodeGroupArgs

type CreateNodeGroupArgs struct {
	ClusterID    CloudProviderResourceID
	Name         string
	RefID        string
	MinNodeCount int
	MaxNodeCount int
	InstanceType string
	DiskSize     Bytes
	Tags         Tags
}

type CreateSubnetArgs

type CreateSubnetArgs struct {
	// The unique ID used to associate with this subnet.
	RefID string

	// The IPv4 network range for the subnet, in CIDR notation. For example, "10.0.0.0/24".
	CidrBlock string

	// The type of the subnet.
	Type SubnetType

	// The tags to associate with the subnet.
	Tags Tags
}

type CreateVPCArgs

type CreateVPCArgs struct {
	// The name of the VPC, displayed on clients.
	Name string

	// The unique ID used to associate with this VPC.
	RefID string

	// The IPv4 network range for the VPC, in CIDR notation. For example, "10.0.0.0/16".
	CidrBlock string

	// The subnets to create in the VPC.
	Subnets []CreateSubnetArgs

	// The tags to associate with the VPC.
	Tags Tags
}

type DeleteClusterArgs

type DeleteClusterArgs struct {
	ID CloudProviderResourceID
}

type DeleteNodeGroupArgs

type DeleteNodeGroupArgs struct {
	ClusterID CloudProviderResourceID
	ID        CloudProviderResourceID
}

type DeleteVPCArgs

type DeleteVPCArgs struct {
	// The ID of the VPC to delete.
	ID CloudProviderResourceID
}

type Disk

type Disk struct {
	Size      units.Base2Bytes // TODO: deprecate in favor of SizeByteValue
	SizeBytes Bytes
	Type      string
	MountPath string
}

type Field

type Field struct {
	Key   string
	Value any
}

func LogField

func LogField(key string, value any) Field

type FirewallRule

type FirewallRule struct {
	ID       string // ignored when creating a new rule
	FromPort int32
	ToPort   int32
	IPRanges []string
}

type FirewallRules

type FirewallRules struct {
	IngressRules []FirewallRule
	EgressRules  []FirewallRule
}

type GPU

type GPU struct {
	Count          int32
	Memory         units.Base2Bytes // TODO: deprecate in favor of MemoryByteValue
	MemoryBytes    Bytes
	MemoryDetails  string // "", "HBM", "GDDR", "DDR", etc.
	NetworkDetails string // "PCIe", "SXM4", "SXM5", etc.
	Manufacturer   Manufacturer
	Name           string
	Type           string
}

type GPUManufacturerFilter

type GPUManufacturerFilter struct {
	// If IncludeGPUManufacturers is provided, only the GPU manufacturers in the list will be included
	IncludeGPUManufacturers []Manufacturer

	// If ExcludeGPUManufacturers is provided, the GPU manufacturers in the list will be excluded
	ExcludeGPUManufacturers []Manufacturer
}

func (*GPUManufacturerFilter) IsAllowed

func (f *GPUManufacturerFilter) IsAllowed(manufacturer Manufacturer) bool

type GetClusterArgs

type GetClusterArgs struct {
	ID CloudProviderResourceID
}

type GetImageArgs

type GetImageArgs struct {
	Owners        []string // self, amazon, aws-marketplace, <account id>, project id for GCP
	Architectures []string // i386, x86_64, arm64
	NameFilters   []string // name of the image (wildcard permitted)
	ImageIDs      []string
}

type GetInstanceTypeArgs

type GetInstanceTypeArgs struct {
	Locations             LocationsFilter
	InstanceTypes         []string
	GPUManufactererFilter *GPUManufacturerFilter // nil means all GPU manufacturers are allowed
	CloudFilter           *CloudFilter           // nil means all clouds are allowed
	ArchitectureFilter    *ArchitectureFilter    // nil means all architectures are allowed
}

type GetInstanceTypeQuotasArgs

type GetInstanceTypeQuotasArgs struct {
	InstanceType string
}

type GetLocationsArgs

type GetLocationsArgs struct {
	IncludeUnavailable bool
}

type GetNodeGroupArgs

type GetNodeGroupArgs struct {
	ClusterID CloudProviderResourceID
	ID        CloudProviderResourceID
}

type GetVPCArgs

type GetVPCArgs struct {
	// The ID of the VPC to get.
	ID CloudProviderResourceID
}

type Image

type Image struct {
	ID           string
	Architecture string
	Description  string
	Name         string
	CreatedAt    time.Time
}

type InnerNotImplCloudClient

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

func (InnerNotImplCloudClient) AddFirewallRulesToInstance

func (c InnerNotImplCloudClient) AddFirewallRulesToInstance(_ context.Context, _ AddFirewallRulesToInstanceArgs) error

func (InnerNotImplCloudClient) ChangeInstanceType

func (c InnerNotImplCloudClient) ChangeInstanceType(_ context.Context, _ CloudProviderInstanceID, _ string) error

func (InnerNotImplCloudClient) CreateCluster

func (c InnerNotImplCloudClient) CreateCluster(_ context.Context, _ CreateClusterArgs) (*Cluster, error)

func (InnerNotImplCloudClient) CreateInstance

func (c InnerNotImplCloudClient) CreateInstance(_ context.Context, _ CreateInstanceAttrs) (*Instance, error)

func (InnerNotImplCloudClient) CreateNodeGroup

func (c InnerNotImplCloudClient) CreateNodeGroup(_ context.Context, _ CreateNodeGroupArgs) (*NodeGroup, error)

func (InnerNotImplCloudClient) CreateVPC

func (c InnerNotImplCloudClient) CreateVPC(_ context.Context, _ CreateVPCArgs) (*VPC, error)

func (InnerNotImplCloudClient) DeleteCluster

func (c InnerNotImplCloudClient) DeleteCluster(_ context.Context, _ DeleteClusterArgs) error

func (InnerNotImplCloudClient) DeleteNodeGroup

func (c InnerNotImplCloudClient) DeleteNodeGroup(_ context.Context, _ DeleteNodeGroupArgs) error

func (InnerNotImplCloudClient) DeleteVPC

func (c InnerNotImplCloudClient) DeleteVPC(_ context.Context, _ DeleteVPCArgs) error

func (InnerNotImplCloudClient) GetAPIType

func (c InnerNotImplCloudClient) GetAPIType() APIType

func (InnerNotImplCloudClient) GetCapabilities

func (c InnerNotImplCloudClient) GetCapabilities(_ context.Context) (Capabilities, error)

func (InnerNotImplCloudClient) GetCloudProviderID

func (c InnerNotImplCloudClient) GetCloudProviderID() CloudProviderID

func (InnerNotImplCloudClient) GetCluster

func (c InnerNotImplCloudClient) GetCluster(_ context.Context, _ GetClusterArgs) (*Cluster, error)

func (InnerNotImplCloudClient) GetImages

func (c InnerNotImplCloudClient) GetImages(_ context.Context, _ GetImageArgs) ([]Image, error)

func (InnerNotImplCloudClient) GetInstance

func (c InnerNotImplCloudClient) GetInstance(_ context.Context, _ CloudProviderInstanceID) (*Instance, error)

func (InnerNotImplCloudClient) GetInstanceTypePollTime

func (c InnerNotImplCloudClient) GetInstanceTypePollTime() time.Duration

func (InnerNotImplCloudClient) GetInstanceTypeQuotas

func (c InnerNotImplCloudClient) GetInstanceTypeQuotas(_ context.Context, _ GetInstanceTypeQuotasArgs) (Quota, error)

func (InnerNotImplCloudClient) GetInstanceTypes

func (c InnerNotImplCloudClient) GetInstanceTypes(_ context.Context, _ GetInstanceTypeArgs) ([]InstanceType, error)

func (InnerNotImplCloudClient) GetLocations

func (c InnerNotImplCloudClient) GetLocations(_ context.Context, _ GetLocationsArgs) ([]Location, error)

func (InnerNotImplCloudClient) GetMaxCreateRequestsPerMinute

func (c InnerNotImplCloudClient) GetMaxCreateRequestsPerMinute() int

func (InnerNotImplCloudClient) GetNodeGroup

func (c InnerNotImplCloudClient) GetNodeGroup(_ context.Context, _ GetNodeGroupArgs) (*NodeGroup, error)

func (InnerNotImplCloudClient) GetReferenceID

func (c InnerNotImplCloudClient) GetReferenceID() string

func (InnerNotImplCloudClient) GetTenantID

func (c InnerNotImplCloudClient) GetTenantID() (string, error)

func (InnerNotImplCloudClient) GetVPC

func (c InnerNotImplCloudClient) GetVPC(_ context.Context, _ GetVPCArgs) (*VPC, error)

func (InnerNotImplCloudClient) ListInstances

func (c InnerNotImplCloudClient) ListInstances(_ context.Context, _ ListInstancesArgs) ([]Instance, error)

func (InnerNotImplCloudClient) MakeClient

func (c InnerNotImplCloudClient) MakeClient(_ context.Context, _ string) (CloudClient, error)

func (InnerNotImplCloudClient) MergeInstanceForUpdate

func (c InnerNotImplCloudClient) MergeInstanceForUpdate(_, i Instance) Instance

func (InnerNotImplCloudClient) MergeInstanceTypeForUpdate

func (c InnerNotImplCloudClient) MergeInstanceTypeForUpdate(_, i InstanceType) InstanceType

func (InnerNotImplCloudClient) ModifyNodeGroup

func (c InnerNotImplCloudClient) ModifyNodeGroup(_ context.Context, _ ModifyNodeGroupArgs) error

func (InnerNotImplCloudClient) RebootInstance

func (c InnerNotImplCloudClient) RebootInstance(_ context.Context, _ CloudProviderInstanceID) error

func (InnerNotImplCloudClient) ResizeInstanceVolume

func (c InnerNotImplCloudClient) ResizeInstanceVolume(_ context.Context, _ ResizeInstanceVolumeArgs) error

func (InnerNotImplCloudClient) RevokeSecurityGroupRules

func (c InnerNotImplCloudClient) RevokeSecurityGroupRules(_ context.Context, _ RevokeSecurityGroupRuleArgs) error

func (InnerNotImplCloudClient) SetClusterUser

func (c InnerNotImplCloudClient) SetClusterUser(_ context.Context, _ SetClusterUserArgs) (*ClusterUser, error)

func (InnerNotImplCloudClient) StartInstance

func (c InnerNotImplCloudClient) StartInstance(_ context.Context, _ CloudProviderInstanceID) error

func (InnerNotImplCloudClient) StopInstance

func (c InnerNotImplCloudClient) StopInstance(_ context.Context, _ CloudProviderInstanceID) error

func (InnerNotImplCloudClient) TerminateInstance

func (c InnerNotImplCloudClient) TerminateInstance(_ context.Context, _ CloudProviderInstanceID) error

func (InnerNotImplCloudClient) UpdateInstanceTags

func (c InnerNotImplCloudClient) UpdateInstanceTags(_ context.Context, _ UpdateInstanceTagsArgs) error

type Instance

type Instance struct {
	Name                            string
	RefID                           string
	CloudCredRefID                  string // cloudCred used to create the Instance
	CreatedAt                       time.Time
	CloudID                         CloudProviderInstanceID
	IPAllocationID                  *string
	PublicIP                        string // Public ip is not always returned from create, but will exist when instance is in running state
	PublicDNS                       string
	PrivateIP                       string
	Hostname                        string
	ImageID                         string
	InstanceType                    string
	DiskSize                        units.Base2Bytes // TODO: deprecate in favor of DiskSizeByteValue
	DiskSizeBytes                   Bytes
	VolumeType                      string
	PubKeyFingerprint               string
	SSHUser                         string
	SSHPort                         int
	Status                          Status
	MetaEndpointEnabled             bool
	MetaTagsEnabled                 bool
	VPCID                           string
	SubnetID                        string
	Spot                            bool
	FirewallRules                   FirewallRules
	RetiredAt                       *time.Time
	RetireTimeout                   *time.Duration
	LastStopTransitionTime          *time.Time
	Location                        string
	SubLocation                     string
	Tags                            Tags
	Stoppable                       bool
	Rebootable                      bool
	IsContainer                     bool
	UserPrivilegeEscalationDisabled bool
	NotPrivileged                   bool
	InstanceTypeID                  InstanceTypeID
	AdditionalDisks                 []Disk

	// As of 08/26/2024 only used for Launchpad cloud.
	// Because there is port forwarding from a GPU node to Bastion node,
	// there is port mappings from the GPU node itself to the Bastion node.
	// i.e. Verb SSH port 2222 is mapped to 2022 on the Bastion node
	InternalPortMappings []PortMapping
}

func ValidateCreateInstance

func ValidateCreateInstance(ctx context.Context, client CloudCreateTerminateInstance, attrs CreateInstanceAttrs, selectedType InstanceType) (*Instance, error)

func WaitForInstanceLifecycleStatus

func WaitForInstanceLifecycleStatus(ctx context.Context,
	client CloudInstanceReader,
	instance *Instance,
	status LifecycleStatus,
	timeout time.Duration,
) (*Instance, error)

type InstanceType

type InstanceType struct {
	ID                              InstanceTypeID // this id should be unique across all regions and stable
	Location                        string
	AvailableAzs                    []string
	SubLocation                     string
	Type                            string
	SupportedGPUs                   []GPU
	SupportedStorage                []Storage
	ElasticRootVolume               bool
	SupportedUsageClasses           []string
	Memory                          units.Base2Bytes // TODO: deprecate in favor of MemoryByteValue
	MemoryBytes                     Bytes
	MaximumNetworkInterfaces        int32
	NetworkPerformance              string
	SupportedNumCores               []int32
	DefaultCores                    int32
	VCPU                            int32
	SupportedArchitectures          []Architecture
	ClockSpeedInGhz                 float64
	Quota                           InstanceTypeQuota
	Stoppable                       bool
	Rebootable                      bool
	VariablePrice                   bool
	Preemptible                     bool
	IsAvailable                     bool
	BasePrice                       *currency.Amount
	SubLocationTypeChangeable       bool
	IsContainer                     bool
	UserPrivilegeEscalationDisabled bool
	NotPrivileged                   bool
	EstimatedDeployTime             *time.Duration
	Provider                        string
	Cloud                           string
	CanModifyFirewallRules          bool
	ReservedInstancePoolID          string
}

type InstanceTypeID

type InstanceTypeID string

func MakeGenericInstanceTypeID

func MakeGenericInstanceTypeID(instanceType InstanceType) InstanceTypeID

func MakeGenericInstanceTypeIDFromInstance

func MakeGenericInstanceTypeIDFromInstance(instance Instance) InstanceTypeID

type InstanceTypeQuota

type InstanceTypeQuota struct {
	OnDemand Quota
	Spot     Quota
	Reserved Quota
}

type InstanceWaitNotFoundError

type InstanceWaitNotFoundError struct {
	InstanceID CloudProviderInstanceID
	Err        error
}

InstanceWaitNotFoundError is returned when the instance is not found during wait.

func (*InstanceWaitNotFoundError) Error

func (e *InstanceWaitNotFoundError) Error() string

func (*InstanceWaitNotFoundError) Unwrap

func (e *InstanceWaitNotFoundError) Unwrap() error

type InstanceWaitTimeoutError

type InstanceWaitTimeoutError struct {
	Instance *Instance
	Desired  LifecycleStatus
	Err      error
}

InstanceWaitTimeoutError is returned when waiting for an instance times out.

func (*InstanceWaitTimeoutError) Error

func (e *InstanceWaitTimeoutError) Error() string

func (*InstanceWaitTimeoutError) Unwrap

func (e *InstanceWaitTimeoutError) Unwrap() error

type LifecycleStatus

type LifecycleStatus string
const (
	LifecycleStatusPending     LifecycleStatus = "pending"
	LifecycleStatusRunning     LifecycleStatus = "running"
	LifecycleStatusStopping    LifecycleStatus = "stopping"
	LifecycleStatusStopped     LifecycleStatus = "stopped"
	LifecycleStatusSuspending  LifecycleStatus = "suspending"
	LifecycleStatusSuspended   LifecycleStatus = "suspended"
	LifecycleStatusTerminating LifecycleStatus = "terminating"
	LifecycleStatusTerminated  LifecycleStatus = "terminated"
	LifecycleStatusFailed      LifecycleStatus = "failed"
)

type ListInstancesArgs

type ListInstancesArgs struct {
	InstanceIDs []CloudProviderInstanceID
	TagFilters  map[string][]string
	Locations   LocationsFilter
}

type Location

type Location struct {
	Name        string // basically the id
	Description string
	Available   bool
	Endpoint    string
	Priority    int
	Country     string // ISO 3166-1 alpha-3 https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
}

type LocationsFilter

type LocationsFilter []string

func (LocationsFilter) IsAll

func (f LocationsFilter) IsAll() bool

func (LocationsFilter) IsAllowed

func (f LocationsFilter) IsAllowed(location string) bool

type Logger

type Logger interface {
	Debug(ctx context.Context, msg string, fields ...Field)
	Info(ctx context.Context, msg string, fields ...Field)
	Warn(ctx context.Context, msg string, args ...Field)
	Error(ctx context.Context, err error, fields ...Field)
}

type Manufacturer

type Manufacturer string
const (
	ManufacturerNVIDIA  Manufacturer = "NVIDIA"
	ManufacturerIntel   Manufacturer = "Intel"
	ManufacturerUnknown Manufacturer = "unknown"
)

func GetManufacturer

func GetManufacturer(manufacturer string) Manufacturer

type ModifyNodeGroupArgs

type ModifyNodeGroupArgs struct {
	ClusterID    CloudProviderResourceID
	ID           CloudProviderResourceID
	MinNodeCount int
	MaxNodeCount int
}

type NodeGroup

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

NodeGroup represents the complete specification of a Brev Kubernetes node group.

func NewNodeGroup

func NewNodeGroup(settings NodeGroupSettings) (*NodeGroup, error)

NewNodeGroup creates a new NodeGroup from the provided settings.

func ValidateCreateKubernetesNodeGroup

func ValidateCreateKubernetesNodeGroup(ctx context.Context, client CloudMaintainKubernetes, attrs CreateNodeGroupArgs) (*NodeGroup, error)

ValidateCreateKubernetesNodeGroup validates that the CreateNodeGroup functionality works correctly.

func (*NodeGroup) GetDiskSize

func (n *NodeGroup) GetDiskSize() Bytes

func (*NodeGroup) GetID

func (*NodeGroup) GetInstanceType

func (n *NodeGroup) GetInstanceType() string

func (*NodeGroup) GetMaxNodeCount

func (n *NodeGroup) GetMaxNodeCount() int

func (*NodeGroup) GetMinNodeCount

func (n *NodeGroup) GetMinNodeCount() int

func (*NodeGroup) GetName

func (n *NodeGroup) GetName() string

func (*NodeGroup) GetRefID

func (n *NodeGroup) GetRefID() string

func (*NodeGroup) GetStatus

func (n *NodeGroup) GetStatus() NodeGroupStatus

func (*NodeGroup) GetTags

func (n *NodeGroup) GetTags() Tags

func (*NodeGroup) MarshalJSON

func (n *NodeGroup) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*NodeGroup) UnmarshalJSON

func (n *NodeGroup) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

type NodeGroupSettings

type NodeGroupSettings struct {
	// The name of the node group, displayed on clients.
	Name string

	// The unique ID used to associate with this node group.
	RefID string

	// The ID assigned by the cloud provider to the node group.
	ID CloudProviderResourceID

	// The minimum number of nodes in the node group.
	MinNodeCount int

	// The maximum number of nodes in the node group.
	MaxNodeCount int

	// The instance type of the nodes in the node group.
	InstanceType string

	// The disk size of the nodes in the node group.
	DiskSize Bytes

	// The status of the node group.
	Status NodeGroupStatus

	// The tags associated with the node group.
	Tags Tags
}

NodeGroupSettings represents the settings for a Kubernetes node group. This is the input to the NewNodeGroup function.

type NodeGroupStatus

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

NodeGroupStatus represents the status of a Kubernetes node group. Note for maintainers: this is defined as a struct rather than a type alias to ensure stronger compile-time type checking and to avoid the need for a validation function.

func (NodeGroupStatus) String

func (s NodeGroupStatus) String() string

type NoopLogger

type NoopLogger struct{}

func (*NoopLogger) Debug

func (l *NoopLogger) Debug(_ context.Context, _ string, _ ...Field)

func (*NoopLogger) Error

func (l *NoopLogger) Error(_ context.Context, _ error, _ ...Field)

func (*NoopLogger) Info

func (l *NoopLogger) Info(_ context.Context, _ string, _ ...Field)

func (*NoopLogger) Warn

func (l *NoopLogger) Warn(_ context.Context, _ string, _ ...Field)

type NotImplCloudClient

type NotImplCloudClient struct {
	InnerNotImplCloudClient
}

func (NotImplCloudClient) AddFirewallRulesToInstance

func (c NotImplCloudClient) AddFirewallRulesToInstance(_ context.Context, _ AddFirewallRulesToInstanceArgs) error

func (NotImplCloudClient) ChangeInstanceType

func (c NotImplCloudClient) ChangeInstanceType(_ context.Context, _ CloudProviderInstanceID, _ string) error

func (NotImplCloudClient) CreateCluster

func (c NotImplCloudClient) CreateCluster(_ context.Context, _ CreateClusterArgs) (*Cluster, error)

func (NotImplCloudClient) CreateInstance

func (c NotImplCloudClient) CreateInstance(_ context.Context, _ CreateInstanceAttrs) (*Instance, error)

func (NotImplCloudClient) CreateNodeGroup

func (c NotImplCloudClient) CreateNodeGroup(_ context.Context, _ CreateNodeGroupArgs) (*NodeGroup, error)

func (NotImplCloudClient) CreateVPC

func (c NotImplCloudClient) CreateVPC(_ context.Context, _ CreateVPCArgs) (*VPC, error)

func (NotImplCloudClient) DeleteCluster

func (c NotImplCloudClient) DeleteCluster(_ context.Context, _ DeleteClusterArgs) error

func (NotImplCloudClient) DeleteNodeGroup

func (c NotImplCloudClient) DeleteNodeGroup(_ context.Context, _ DeleteNodeGroupArgs) error

func (NotImplCloudClient) DeleteVPC

func (c NotImplCloudClient) DeleteVPC(_ context.Context, _ DeleteVPCArgs) error

func (NotImplCloudClient) GetAPIType

func (c NotImplCloudClient) GetAPIType() APIType

func (NotImplCloudClient) GetCapabilities

func (c NotImplCloudClient) GetCapabilities(_ context.Context) (Capabilities, error)

func (NotImplCloudClient) GetCloudProviderID

func (c NotImplCloudClient) GetCloudProviderID() CloudProviderID

func (NotImplCloudClient) GetCluster

func (c NotImplCloudClient) GetCluster(_ context.Context, _ GetClusterArgs) (*Cluster, error)

func (NotImplCloudClient) GetImages

func (c NotImplCloudClient) GetImages(_ context.Context, _ GetImageArgs) ([]Image, error)

func (NotImplCloudClient) GetInstance

func (c NotImplCloudClient) GetInstance(_ context.Context, _ CloudProviderInstanceID) (*Instance, error)

func (NotImplCloudClient) GetInstanceTypePollTime

func (c NotImplCloudClient) GetInstanceTypePollTime() time.Duration

func (NotImplCloudClient) GetInstanceTypeQuotas

func (c NotImplCloudClient) GetInstanceTypeQuotas(_ context.Context, _ GetInstanceTypeQuotasArgs) (Quota, error)

func (NotImplCloudClient) GetInstanceTypes

func (c NotImplCloudClient) GetInstanceTypes(_ context.Context, _ GetInstanceTypeArgs) ([]InstanceType, error)

func (NotImplCloudClient) GetLocations

func (c NotImplCloudClient) GetLocations(_ context.Context, _ GetLocationsArgs) ([]Location, error)

func (NotImplCloudClient) GetMaxCreateRequestsPerMinute

func (c NotImplCloudClient) GetMaxCreateRequestsPerMinute() int

func (NotImplCloudClient) GetNodeGroup

func (c NotImplCloudClient) GetNodeGroup(_ context.Context, _ GetNodeGroupArgs) (*NodeGroup, error)

func (NotImplCloudClient) GetReferenceID

func (c NotImplCloudClient) GetReferenceID() string

func (NotImplCloudClient) GetTenantID

func (c NotImplCloudClient) GetTenantID() (string, error)

func (NotImplCloudClient) GetVPC

func (c NotImplCloudClient) GetVPC(_ context.Context, _ GetVPCArgs) (*VPC, error)

func (NotImplCloudClient) ListInstances

func (c NotImplCloudClient) ListInstances(_ context.Context, _ ListInstancesArgs) ([]Instance, error)

func (NotImplCloudClient) MakeClient

func (c NotImplCloudClient) MakeClient(_ context.Context, _ string) (CloudClient, error)

func (NotImplCloudClient) MergeInstanceForUpdate

func (c NotImplCloudClient) MergeInstanceForUpdate(_, i Instance) Instance

func (NotImplCloudClient) MergeInstanceTypeForUpdate

func (c NotImplCloudClient) MergeInstanceTypeForUpdate(_, i InstanceType) InstanceType

func (NotImplCloudClient) ModifyNodeGroup

func (c NotImplCloudClient) ModifyNodeGroup(_ context.Context, _ ModifyNodeGroupArgs) error

func (NotImplCloudClient) RebootInstance

func (c NotImplCloudClient) RebootInstance(_ context.Context, _ CloudProviderInstanceID) error

func (NotImplCloudClient) ResizeInstanceVolume

func (c NotImplCloudClient) ResizeInstanceVolume(_ context.Context, _ ResizeInstanceVolumeArgs) error

func (NotImplCloudClient) RevokeSecurityGroupRules

func (c NotImplCloudClient) RevokeSecurityGroupRules(_ context.Context, _ RevokeSecurityGroupRuleArgs) error

func (NotImplCloudClient) SetClusterUser

func (c NotImplCloudClient) SetClusterUser(_ context.Context, _ SetClusterUserArgs) (*ClusterUser, error)

func (NotImplCloudClient) StartInstance

func (c NotImplCloudClient) StartInstance(_ context.Context, _ CloudProviderInstanceID) error

func (NotImplCloudClient) StopInstance

func (c NotImplCloudClient) StopInstance(_ context.Context, _ CloudProviderInstanceID) error

func (NotImplCloudClient) TerminateInstance

func (c NotImplCloudClient) TerminateInstance(_ context.Context, _ CloudProviderInstanceID) error

func (NotImplCloudClient) UpdateInstanceTags

func (c NotImplCloudClient) UpdateInstanceTags(_ context.Context, _ UpdateInstanceTagsArgs) error

type PortMapping

type PortMapping struct {
	FromPort int
	ToPort   int
}

type Quota

type Quota struct {
	ID      string
	Name    string
	Maximum int    // maximum number of units
	Current int    // current number of units being used
	Unit    string // if gpu, will trigger https://github.com/brevdev/brev-deploy/blob/e8ad711e641794e0b2f7b582e301535826aca8b3/internal/routes/instance_types.go#L408
}

type ResizeInstanceVolumeArgs

type ResizeInstanceVolumeArgs struct {
	InstanceID        CloudProviderInstanceID
	Size              units.Base2Bytes // TODO: deprecate in favor of SizeByteValue
	SizeBytes         Bytes
	WaitForOptimizing bool
}

type RevokeSecurityGroupRuleArgs

type RevokeSecurityGroupRuleArgs struct {
	InstanceID           CloudProviderInstanceID
	SecurityGroupRuleIDs []string
}

type SetClusterUserArgs

type SetClusterUserArgs struct {
	ClusterID    CloudProviderResourceID
	Username     string
	RSAPEMBase64 string
	Role         string
}

type Status

type Status struct {
	LifecycleStatus LifecycleStatus
	Messages        []string
}

type Storage

type Storage struct {
	Count                   int32
	Size                    units.Base2Bytes // TODO: deprecate in favor of SizeByteValue
	SizeBytes               Bytes
	Type                    string
	MinSize                 *units.Base2Bytes // TODO: deprecate in favor of MinSizeByteValue
	MinSizeBytes            *Bytes
	MaxSize                 *units.Base2Bytes // TODO: deprecate in favor of MaxSizeByteValue
	MaxSizeBytes            *Bytes
	PricePerGBHr            *currency.Amount
	IsEphemeral             bool
	IsAdditionalDisk        bool
	RequiresVolumeMountPath bool
	IsElastic               bool
}

type Subnet

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

Subnet represents the complete specification of a Brev subnet.

func NewSubnet

func NewSubnet(settings SubnetSettings) (*Subnet, error)

NewSubnet creates a new Subnet from the provided settings.

func (*Subnet) GetCidrBlock

func (s *Subnet) GetCidrBlock() string

func (*Subnet) GetID

func (s *Subnet) GetID() CloudProviderResourceID

func (*Subnet) GetLocation

func (s *Subnet) GetLocation() string

func (*Subnet) GetName

func (s *Subnet) GetName() string

func (*Subnet) GetRefID

func (s *Subnet) GetRefID() string

func (*Subnet) GetSubnetType

func (s *Subnet) GetSubnetType() SubnetType

func (*Subnet) GetTags

func (s *Subnet) GetTags() Tags

func (*Subnet) GetVPCID

func (s *Subnet) GetVPCID() CloudProviderResourceID

type SubnetSettings

type SubnetSettings struct {
	// The name of the subnet, displayed on clients.
	Name string

	// The unique ID used to associate with this subnet.
	RefID string

	// The ID of the VPC that the subnet is associated with.
	VPCID CloudProviderResourceID

	// The ID assigned by the cloud provider to the subnet.
	ID CloudProviderResourceID

	// The location of the subnet. For example, "us-east-1".
	Location string

	// The IPv4 network range for the subnet, in CIDR notation. For example, "10.0.0.0/24".
	CidrBlock string

	// The type of the subnet.
	Type SubnetType

	// The tags associated with the subnet.
	Tags Tags
}

SubnetSettings represents the settings for a subnet. This is the input to the NewSubnet function.

type SubnetType

type SubnetType string
const (
	SubnetTypePublic  SubnetType = "public"
	SubnetTypePrivate SubnetType = "private"
)

type Tags

type Tags map[string]string

type UpdateHandler

type UpdateHandler interface {
	MergeInstanceForUpdate(currInst Instance, newInst Instance) Instance
	MergeInstanceTypeForUpdate(currIt InstanceType, newIt InstanceType) InstanceType
}

this is used by the control plane to efficiently update instances

type UpdateInstanceTagsArgs

type UpdateInstanceTagsArgs struct {
	InstanceID CloudProviderInstanceID
	Tags       Tags
}

type VPC

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

VPC represents the complete specification of a Brev VPC.

func NewVPC

func NewVPC(settings VPCSettings) (*VPC, error)

NewVPC creates a new VPC from the provided settings.

func ValidateCreateVPC

func ValidateCreateVPC(ctx context.Context, client CloudMaintainVPC, attrs CreateVPCArgs) (*VPC, error)

ValidateCreateVPC validates that the CreateVPC functionality works correctly.

func ValidateGetVPC

func ValidateGetVPC(ctx context.Context, client CloudMaintainVPC, attrs GetVPCArgs) (*VPC, error)

ValidateGetVPC validates that the GetVPC functionality works correctly.

func (*VPC) GetCidrBlock

func (v *VPC) GetCidrBlock() string

func (*VPC) GetCloud

func (v *VPC) GetCloud() string

func (*VPC) GetID

func (v *VPC) GetID() CloudProviderResourceID

func (*VPC) GetLocation

func (v *VPC) GetLocation() string

func (*VPC) GetName

func (v *VPC) GetName() string

func (*VPC) GetProvider

func (v *VPC) GetProvider() string

func (*VPC) GetRefID

func (v *VPC) GetRefID() string

func (*VPC) GetStatus

func (v *VPC) GetStatus() VPCStatus

func (*VPC) GetSubnets

func (v *VPC) GetSubnets() []*Subnet

func (*VPC) GetTags

func (v *VPC) GetTags() Tags

type VPCSettings

type VPCSettings struct {
	// The name of the VPC, displayed on clients.
	Name string

	// The unique ID used to associate with this VPC.
	RefID string

	// The cloud provider that manages the VPC. Unless the provider is a broker to other clouds, this will be the same as
	// the Cloud field. For example, "aws".
	Provider string

	// The cloud that hosts the VPC. For example, "aws".
	Cloud string

	// The ID assigned by the cloud provider to the VPC.
	ID CloudProviderResourceID

	// The location of the VPC. For example, "us-east-1".
	Location string

	// The IPv4 network range for the VPC, in CIDR notation. For example, "10.0.0.0/16".
	CidrBlock string

	// The status of the VPC.
	Status VPCStatus

	// The subnets associated with the VPC.
	Subnets []*Subnet

	// The tags associated with the VPC.
	Tags Tags
}

VPCSettings represents the settings for a VPC. This is the input to the NewVPC function.

type VPCStatus

type VPCStatus string
const (
	VPCStatusAvailable VPCStatus = "available"
	VPCStatusPending   VPCStatus = "pending"
	VPCStatusDeleting  VPCStatus = "deleting"
	VPCStatusUnknown   VPCStatus = "unknown"
)

Jump to

Keyboard shortcuts

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