cli

package
v0.0.0-...-dd44de9 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: MIT Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MiB              = 1024 * 1024
	ContextFileLimit = 10
	ContextSizeLimit = 10 * MiB
)
View Source
const DefaultCluster = "fabric-prod1.defang.dev"
View Source
const (
	RFC3339Micro = "2006-01-02T15:04:05.000000Z07:00" // like RFC3339Nano but with 6 digits of precision
)

Variables

View Source
var (
	DoDryRun = false

	ErrDryRun = errors.New("dry run")
)
View Source
var (
	DoVerbose = false
)
View Source
var ErrTermsNotAgreed = errors.New("You must agree to the Defang terms of service to use this tool")

Functions

func BootstrapCommand

func BootstrapCommand(ctx context.Context, client client.Client, command string) error

func BootstrapLocalList

func BootstrapLocalList(ctx context.Context, client client.Client) error

func ComposeDown

func ComposeDown(ctx context.Context, client client.Client) (types.ETag, error)

func ComposeRestart

func ComposeRestart(ctx context.Context, client client.Client) (types.ETag, error)

func ComposeStart

func ComposeStart(ctx context.Context, c client.Client, force bool) (*defangv1.DeployResponse, error)

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

func ComposeStop

func ComposeStop(ctx context.Context, client client.Client) (types.ETag, error)

func ConfigDelete

func ConfigDelete(ctx context.Context, client client.Client, names ...string) error

func ConfigList

func ConfigList(ctx context.Context, client client.Client) error

func ConfigSet

func ConfigSet(ctx context.Context, client client.Client, name string, value string) error

func Connect

func Connect(cluster string, loader client.ProjectLoader) (client.GrpcClient, types.TenantID)

func Delete deprecated

func Delete(ctx context.Context, client client.Client, names ...string) (types.ETag, error)

Deprecated: Use ComposeStop instead.

func GenerateLetsEncryptCert

func GenerateLetsEncryptCert(ctx context.Context, client cliClient.Client) error

func GenerateWithAI

func GenerateWithAI(ctx context.Context, client client.Client, language string, description string) ([]string, error)

func GetExistingToken

func GetExistingToken(fabric string) string

func GetServices

func GetServices(ctx context.Context, client client.Client, long bool) error

func GetTenantID deprecated

func GetTenantID(cluster string) types.TenantID

Deprecated: should use grpc to get the tenant ID

func GetVersion

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

func InitFromSample

func InitFromSample(ctx context.Context, name string) error

func InteractiveAgreeToS

func InteractiveAgreeToS(ctx context.Context, client client.Client) error

func InteractiveLogin

func InteractiveLogin(ctx context.Context, client client.Client, gitHubClientId, fabric string) error

func Logout

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

func MarshalPretty

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

func NewClient

func NewClient(cluster string, provider client.Provider, loader client.ProjectLoader) client.Client

func NonInteractiveAgreeToS

func NonInteractiveAgreeToS(ctx context.Context, client client.Client) error

func NonInteractiveLogin

func NonInteractiveLogin(ctx context.Context, client client.Client, fabric string) error

func NormalizeServiceName

func NormalizeServiceName(s string) string

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 PrintObject

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

func Restart

func Restart(ctx context.Context, client client.Client, names ...string) (types.ETag, error)

func SendMsg

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

func SplitTenantHost

func SplitTenantHost(cluster string) (types.TenantID, string)

func Subscribe

func Subscribe(ctx context.Context, client client.Client, services []string) (<-chan *map[string]string, error)

func Tail

func Tail(ctx context.Context, client client.Client, params TailOptions) error

func TearDown

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

func Token

func Token(ctx context.Context, client client.Client, clientId string, tenant types.TenantID, dur time.Duration, scope scope.Scope) error

func Whoami

func Whoami(ctx context.Context, client client.Client) error

Types

type CancelError

type CancelError struct {
	Services []string
	Etag     string
	Last     time.Time
	// 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 ComposeLoader

type ComposeLoader struct {
	ComposeFilePath string
}

func (ComposeLoader) LoadWithDefaultProjectName

func (c ComposeLoader) LoadWithDefaultProjectName(name string) (*compose.Project, error)

func (ComposeLoader) LoadWithProjectName

func (c ComposeLoader) LoadWithProjectName(name string) (*compose.Project, error)

type EndLogConditional

type EndLogConditional struct {
	Service  string
	Host     string
	EventLog string
}

type HTTPClient

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

type P

type P = client.Property // shorthand for tracking properties

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"`
}

func FetchSamples

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

type ServiceStatus

type ServiceStatus string
const (
	ServiceDeploymentStarting   ServiceStatus = "STARTING"
	ServiceDeploymentInProgress ServiceStatus = "IN_PROGRESS"
	ServiceStarted              ServiceStatus = "COMPLETED"
	ServiceStopping             ServiceStatus = "STOPPING"
	ServiceStopped              ServiceStatus = "STOPPED"
	ServiceDeactivating         ServiceStatus = "DEACTIVATING"
	ServiceDeprovisioning       ServiceStatus = "DEPROVISIONING"
	ServiceFailed               ServiceStatus = "FAILED"
	ServiceUnknown              ServiceStatus = "UNKNOWN"
)

type TailDetectStopEventFunc

type TailDetectStopEventFunc func(services []string, host string, eventlog string) bool

func CreateEndLogEventDetectFunc

func CreateEndLogEventDetectFunc(conditionals []EndLogConditional) TailDetectStopEventFunc

type TailOptions

type TailOptions struct {
	Services           []string
	Etag               types.ETag
	Since              time.Time
	Raw                bool
	EndEventDetectFunc TailDetectStopEventFunc
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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