cli

package
v0.0.0-...-30ebec9 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2025 License: MIT Imports: 52 Imported by: 2

Documentation

Index

Constants

View Source
const (
	RFC3339Milli = "2006-01-02T15:04:05.000Z07:00" // like RFC3339Nano but with 3 digits of precision
)

Variables

View Source
var ErrDoNotComposeDown = errors.New("user did not want to compose down")
View Source
var ErrNothingToMonitor = errors.New("no services to monitor")
View Source
var ErrSampleNotFound = errors.New("sample not found")
View Source
var P = track.P
View Source
var SupportedLanguages = []string{"Nodejs", "Golang", "Python"}

Functions

func BootstrapCommand

func BootstrapCommand(ctx context.Context, projectName string, verbose bool, provider client.Provider, cmd string) error

func BootstrapLocalList

func BootstrapLocalList(ctx context.Context, provider client.Provider) error

func CanMonitorService

func CanMonitorService(service compose.ServiceConfig) bool

func ComposeDown

func ComposeDown(ctx context.Context, projectName string, fabric client.FabricClient, provider client.Provider, names ...string) (types.ETag, error)

func ComposeUp

ComposeUp validates a compose project and uploads the services using the client

func ConfigDelete

func ConfigDelete(ctx context.Context, projectName string, provider client.Provider, names ...string) error

func ConfigList

func ConfigList(ctx context.Context, projectName string, provider client.Provider) error

func ConfigSet

func ConfigSet(ctx context.Context, projectName string, provider client.Provider, name string, value string) error

func Connect

func Connect(ctx context.Context, addr string) (*client.GrpcClient, error)

func DebugDeployment

func DebugDeployment(ctx context.Context, client client.FabricClient, debugConfig DebugConfig) error

func Delete

func Delete(ctx context.Context, projectName string, c client.FabricClient, provider client.Provider, names ...string) (types.ETag, error)

func DeploymentsList

func DeploymentsList(ctx context.Context, listType defangv1.DeploymentType, projectName string, client client.FabricClient, limit uint32) error

func EnableUTCMode

func EnableUTCMode()

EnableUTCMode sets the local time zone to UTC.

func GenerateLetsEncryptCert

func GenerateLetsEncryptCert(ctx context.Context, project *compose.Project, client client.FabricClient, provider client.Provider) error

func GeneratePreview

func GeneratePreview(ctx context.Context, project *compose.Project, client client.FabricClient, previewProvider client.Provider, estimateProviderID client.ProviderID, mode defangv1.DeploymentMode, region string) (string, error)

func GenerateWithAI

func GenerateWithAI(ctx context.Context, client client.FabricClient, args GenerateArgs) ([]string, error)

func GetServices

func GetServices(ctx context.Context, projectName string, provider client.Provider, long bool) error

func GetVersion

func GetVersion(ctx context.Context, client client.FabricClient) (string, error)

func InitFromSamples

func InitFromSamples(ctx context.Context, dir string, names []string) error

InitFromSamples copies the sample(s) into the given directory, aborting if any files already exist.

func InteractiveComposeDown

func InteractiveComposeDown(ctx context.Context, provider client.Provider, projectName string) (types.ETag, error)

func InteractiveDebugDeployment

func InteractiveDebugDeployment(ctx context.Context, client client.FabricClient, debugConfig DebugConfig) error

func InteractiveDebugForClientError

func InteractiveDebugForClientError(ctx context.Context, client client.FabricClient, project *compose.Project, clientErr error) error

func IsProjectFile

func IsProjectFile(basename string) bool

func Logout

func Logout(ctx context.Context, client client.FabricClient) error

func MarshalPretty

func MarshalPretty(root string, data proto.Message) ([]byte, error)

func MixinFromSample

func MixinFromSample(ctx context.Context, dir string, name string) error

MixinFromSamples copies the sample files into the given directory, skipping existing files.

func NewProvider

func NewProvider(ctx context.Context, providerID client.ProviderID, fabricClient client.FabricClient) (client.Provider, error)

func ParseTimeOrDuration

func ParseTimeOrDuration(str string, now time.Time) (time.Time, error)

ParseTimeOrDuration parses a time string or duration string (e.g. 1h30m) and returns a time.Time. At a minimum, this function supports RFC3339Nano, Go durations, and our own TimestampFormat (local).

func Preview

func Preview(ctx context.Context, project *compose.Project, fabric cliClient.FabricClient, provider cliClient.Provider, mode defangv1.DeploymentMode) error

func PrintEstimate

func PrintEstimate(mode defangv1.DeploymentMode, estimate *defangv1.EstimateResponse)

func PrintObject

func PrintObject(root string, data proto.Message) error

func RunEstimate

func RunEstimate(ctx context.Context, project *compose.Project, client client.FabricClient, previewProvider client.Provider, estimateProviderID client.ProviderID, region string, mode defangv1.DeploymentMode) (*defangv1.EstimateResponse, error)

func SendMsg

func SendMsg(ctx context.Context, client client.FabricClient, subject, _type, id string, data []byte, contenttype string) error

func SplitProjectStack

func SplitProjectStack(name string) (projectName string, stackName string)

func Tail

func Tail(ctx context.Context, provider client.Provider, projectName string, options TailOptions) error

func TailAndWaitForCD

func TailAndWaitForCD(ctx context.Context, provider client.Provider, projectName string, tailOptions TailOptions) error

func TearDown

func TearDown(ctx context.Context, provider client.Provider, force bool) error

func Token

func Token(ctx context.Context, client client.FabricClient, tenant types.TenantName, dur time.Duration, s scope.Scope) error

func Upgrade

func Upgrade(ctx context.Context) error

func WaitForCdTaskExit

func WaitForCdTaskExit(ctx context.Context, provider client.Provider) error

Types

type CancelError

type CancelError struct {
	TailOptions
	ProjectName string
	// contains filtered or unexported fields
}

func (CancelError) Error

func (cerr CancelError) Error() string

func (CancelError) Unwrap

func (cerr CancelError) Unwrap() error

type ComposeError

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

func (ComposeError) Unwrap

func (e ComposeError) Unwrap() error

type DNSResult

type DNSResult struct {
	IPs    []net.IPAddr
	Expiry time.Time
}

type DebugConfig

type DebugConfig struct {
	Deployment     types.ETag
	FailedServices []string
	ModelId        string
	Project        *compose.Project
	Provider       client.Provider
	Since          time.Time
	Until          time.Time
}

func (DebugConfig) String

func (dc DebugConfig) String() string

type ErrNoServices

type ErrNoServices struct {
	ProjectName string // may be empty
}

func (ErrNoServices) Error

func (e ErrNoServices) Error() string

type EstimateLineItemTableItem

type EstimateLineItemTableItem struct {
	Cost        string
	Quantity    string
	Service     string
	Description string
}

type GenerateArgs

type GenerateArgs struct {
	Description string
	Folder      string
	Language    string
	ModelId     string
}

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type LogEntryHandler

type LogEntryHandler func(*defangv1.LogEntry, *TailOptions) error

type PrintConfig

type PrintConfig struct {
	Name string
}

type PrintDeployment

type PrintDeployment struct {
	AccountId   string
	Deployment  string
	DeployedAt  string
	ProjectName string
	Provider    string
	Region      string
}

type Sample

type Sample struct {
	Name             string   `json:"name"`
	Title            string   `json:"title"`
	Category         string   `json:"category"` // Deprecated: use Languages instead
	Readme           string   `json:"readme"`   // unused
	DirectoryName    string   `json:"directoryName"`
	ShortDescription string   `json:"shortDescription"`
	Tags             []string `json:"tags"`
	Languages        []string `json:"languages"`
	Configs          []string `json:"configs"`
}

func FetchSamples

func FetchSamples(ctx context.Context) ([]Sample, error)

type ServiceStates

type ServiceStates = map[string]defangv1.ServiceState

func TailAndMonitor

func TailAndMonitor(ctx context.Context, project *compose.Project, provider client.Provider, waitTimeout time.Duration, tailOptions TailOptions) (ServiceStates, error)

func WaitServiceState

func WaitServiceState(
	ctx context.Context,
	provider client.Provider,
	targetState defangv1.ServiceState,
	projectName string,
	etag types.ETag,
	services []string,
) (ServiceStates, error)

type ShowAccountData

type ShowAccountData struct {
	client.AccountInfo
	SubscriberTier defangv1.SubscriptionTier
	Tenant         string
	TenantID       string
}

func Whoami

func Whoami(ctx context.Context, fabric client.FabricClient, provider client.Provider) (ShowAccountData, error)

type TailDetectStopEventFunc deprecated

type TailDetectStopEventFunc func(eventLog *defangv1.LogEntry) error

Deprecated: use Subscribe instead #851

type TailOptions

type TailOptions struct {
	EndEventDetectFunc TailDetectStopEventFunc // Deprecated: use Subscribe and GetDeploymentStatus instead #851
	Deployment         types.ETag
	Filter             string
	LogType            logs.LogType
	Raw                bool
	Services           []string
	Since              time.Time
	Until              time.Time
	Verbose            bool
}

func (TailOptions) String

func (to TailOptions) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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