resources

package
v0.1.156 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 42 Imported by: 8

README

Conventions for environment variables

Key

CODEFLY_{TYPE}{APP}{SVC}___{KEY}

Documentation

Index

Constants

View Source
const (
	ModuleKind              = "module"
	ModuleConfigurationName = "module.codefly.yaml"
)
View Source
const (
	RuntimeContextNative    = "native"
	RuntimeContextNix       = "nix"
	RuntimeContextContainer = "container"
	RuntimeContextFree      = "free"

	NetworkAccessContainer = "container"
	NetworkAccessNative    = "native"
	NetworkAccessPublic    = "public"
)
View Source
const (
	AGENT = "agent"

	WORKSPACE = "workspace"
	MODULE    = "module"
	SERVICE   = "service"
	ENDPOINT  = "endpoint"
)
View Source
const AgentConfigurationName = "agent.codefly.yaml"
View Source
const ApplicationAgent = AgentKind("codefly:application")

ApplicationAgent is the agent kind for applications

View Source
const ApplicationConfigurationName = "application.codefly.yaml"
View Source
const BuilderServiceAgent = "codefly:service:builder"
View Source
const CodeServiceAgent = "codefly:service:code"
View Source
const CodeflyHomeEnv = "CODEFLY_HOME"

CodeflyHomeEnv overrides the default ~/.codefly home directory. Set via the --plugin-path CLI flag or by exporting CODEFLY_HOME. Useful for testing alternate plugin sets or running multiple codefly installations side-by-side.

View Source
const ConfigurationWorkspace = "_workspace_origin"
View Source
const EndpointPrefix = "CODEFLY__ENDPOINT"
View Source
const EnvironmentPrefix = "CODEFLY__ENVIRONMENT"
View Source
const FixturePrefix = "CODEFLY__FIXTURE"
View Source
const GRPCRouteFileSuffix = ".grpc.codefly.yaml"
View Source
const JobAgent = AgentKind("codefly:job")

JobAgent is the agent kind for jobs

View Source
const JobConfigurationName = "job.codefly.yaml"
View Source
const LibraryConfigurationName = "library.codefly.yaml"
View Source
const ModuleAgent = AgentKind("codefly:module")

ModuleAgent is the agent kind for module templates

View Source
const ModulePrefix = "CODEFLY__MODULE"
View Source
const RestRouteFileSuffix = ".rest.codefly.yaml"
View Source
const RestRoutePrefix = "CODEFLY__REST_ROUTE"
View Source
const RunningPrefix = "CODEFLY__RUNNING"
View Source
const RuntimeContextPrefix = "CODEFLY__RUNTIME_CONTEXT"
View Source
const RuntimeServiceAgent = "codefly:service:runtime"
View Source
const ServiceAgent = AgentKind("codefly:service")
View Source
const ServiceConfigurationName = "service.codefly.yaml"
View Source
const ServiceConfigurationPrefix = "CODEFLY__SERVICE_CONFIGURATION"
View Source
const ServicePrefix = "CODEFLY__SERVICE"
View Source
const ServiceSecretConfigurationPrefix = "CODEFLY__SERVICE_SECRET_CONFIGURATION"
View Source
const VersionPrefix = "CODEFLY__SERVICE_VERSION"
View Source
const WorkspaceConfigurationName = "workspace.codefly.yaml"
View Source
const WorkspaceConfigurationPrefix = "CODEFLY__WORKSPACE_CONFIGURATION"
View Source
const WorkspacePrefix = "CODEFLY__WORKSPACE"
View Source
const WorkspaceSecretConfigurationPrefix = "CODEFLY__WORKSPACE_SECRET_CONFIGURATION"

#nosec G101

Variables

View Source
var ErrUnknownHTTPMethod = fmt.Errorf("unknown HTTP method")

ErrUnknownHTTPMethod is returned when an HTTP method cannot be converted

Functions

func APIString

func APIString(api *basev0.API) string

func AgentBase added in v0.1.109

func AgentBase(ctx context.Context) string

func CodeflyDir

func CodeflyDir() string

CodeflyDir returns the directory where the Workspace configuration is stored

func CodeflyHomeDir added in v0.1.155

func CodeflyHomeDir() string

CodeflyHomeDir returns the global home directory for agents, containers, and other global resources. Resolution order:

  1. $CODEFLY_HOME env var (set by --plugin-path or manually)
  2. ~/.codefly (user home)
  3. workspace-local .codefly/ (fallback)

func ConfigurationEnvironmentKeyPrefix

func ConfigurationEnvironmentKeyPrefix(conf *basev0.Configuration) string

func ConfigurationFile

func ConfigurationFile[C Configuration]() string

func ConfigurationHash

func ConfigurationHash(conf *basev0.Configuration) string

func ConfigurationInformationHash

func ConfigurationInformationHash(info *basev0.ConfigurationInformation) string

func ConfigurationInformationsHash

func ConfigurationInformationsHash(infos ...*basev0.ConfigurationInformation) (string, error)

func ConfigurationValue added in v0.1.141

func ConfigurationValue(_ context.Context, confInfo *basev0.ConfigurationInformation, key string) (string, error)

ConfigurationValue returns the value of the configuration key. If the configuration or the key is not found, it returns an error.

func ConfigurationsHash

func ConfigurationsHash(confs ...*basev0.Configuration) string

func ConvertHTTPMethodToProto

func ConvertHTTPMethodToProto(m HTTPMethod) (basev0.HTTPMethod, error)

func ConvertSpec

func ConvertSpec(spec map[string]any) (*basev0.Specs, error)

func ConvertToAnyPb

func ConvertToAnyPb(value any) (*anypb.Any, error)

func EndpointAsEnvironmentVariableKey

func EndpointAsEnvironmentVariableKey(info *EndpointInformation) string

func EndpointAsEnvironmentVariableKeyBase

func EndpointAsEnvironmentVariableKeyBase(info *EndpointInformation) string

func EndpointDestination

func EndpointDestination(e *basev0.Endpoint) string

func EndpointHash

func EndpointHash(ctx context.Context, endpoints ...*basev0.Endpoint) (string, error)

func EndpointRestAPI

func EndpointRestAPI(endpoint *basev0.Endpoint) *basev0.RestAPI

func EnvironmentVariableAsStrings

func EnvironmentVariableAsStrings(envs []*EnvironmentVariable) []string

func ExistsAtDir

func ExistsAtDir[C Configuration](dir string) bool

func ExtendDomain

func ExtendDomain(domain string, extension string) string

func ExtractConfiguration

func ExtractConfiguration(configurations []*basev0.Configuration, runtimeContext *basev0.RuntimeContext) (*basev0.Configuration, error)

func FilePathForGRPC

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

func FilePathForRest

func FilePathForRest(ctx context.Context, dir string, unique string, routePath string) (string, error)

func FilterConfigurationInformation added in v0.1.127

func FilterConfigurationInformation(_ context.Context, name string, infos ...*basev0.ConfigurationInformation) (*basev0.ConfigurationInformation, error)

FilterConfigurationInformation returns the first configuration information that matches the name. If no configuration information is found, it returns nil.

func FilterConfigurations

func FilterConfigurations(configurations []*basev0.Configuration, runtimeContext *basev0.RuntimeContext) []*basev0.Configuration

func FilterNetworkInstance added in v0.1.123

func FilterNetworkInstance(_ context.Context, instances []*basev0.NetworkInstance, networkAccess *basev0.NetworkAccess) *basev0.NetworkInstance

func FindConfigDir added in v0.1.109

func FindConfigDir() (*string, error)

func FindConfigurations

func FindConfigurations(configurations []*basev0.Configuration, runtime *basev0.RuntimeContext) []*basev0.Configuration

func FindConnectEndpoint added in v0.1.155

func FindConnectEndpoint(_ context.Context, endpoints []*basev0.Endpoint) (*basev0.Endpoint, error)

func FindEndpointForGRPCRoute

func FindEndpointForGRPCRoute(ctx context.Context, endpoints []*basev0.Endpoint, route *GRPCRoute) *basev0.Endpoint

FindEndpointForGRPCRoute finds the info that matches the route rpcs

func FindEndpointForRestRoute

func FindEndpointForRestRoute(ctx context.Context, endpoints []*basev0.Endpoint, route *RestRouteGroup) *basev0.Endpoint

FindEndpointForRestRoute finds the info that matches the route rpcs

func FindGRPCEndpoint

func FindGRPCEndpoint(ctx context.Context, endpoints []*basev0.Endpoint) (*basev0.Endpoint, error)

func FindGRPCEndpointFromService added in v0.1.121

func FindGRPCEndpointFromService(ctx context.Context, service *ServiceDependency, endpoints []*basev0.Endpoint) (*basev0.Endpoint, error)

func FindHTTPEndpoint

func FindHTTPEndpoint(ctx context.Context, endpoints []*basev0.Endpoint) (*basev0.Endpoint, error)

func FindNetworkInstanceInNetworkMappings

func FindNetworkInstanceInNetworkMappings(ctx context.Context, mappings []*basev0.NetworkMapping, endpoint *basev0.Endpoint, networkAccess *basev0.NetworkAccess) (*basev0.NetworkInstance, error)

func FindNetworkMapping

func FindNetworkMapping(ctx context.Context, mappings []*basev0.NetworkMapping, endpoint *basev0.Endpoint) (*basev0.NetworkMapping, error)

func FindRestEndpoint

func FindRestEndpoint(ctx context.Context, endpoints []*basev0.Endpoint) (*basev0.Endpoint, error)

func FindRestEndpointFromService added in v0.1.155

func FindRestEndpointFromService(ctx context.Context, service *ServiceDependency, endpoints []*basev0.Endpoint) (*basev0.Endpoint, error)

func FindServiceConfiguration added in v0.1.114

func FindServiceConfiguration(_ context.Context, confs []*basev0.Configuration, runtimeContext *basev0.RuntimeContext, unique string) (*basev0.Configuration, error)

func FindTCPEndpoint

func FindTCPEndpoint(ctx context.Context, endpoints []*basev0.Endpoint) (*basev0.Endpoint, error)

func FindTCPEndpointWithName

func FindTCPEndpointWithName(ctx context.Context, name string, endpoints []*basev0.Endpoint) (*basev0.Endpoint, error)

func FindUp

func FindUp[C Configuration](ctx context.Context) (*string, error)

FindUp looks for a configuration in the active directory and up

func FindValueInEnvironmentVariables

func FindValueInEnvironmentVariables(ctx context.Context, key string, envs []string) (string, error)

func FindWorkspaceConfiguration added in v0.1.123

func FindWorkspaceConfiguration(_ context.Context, confs []*basev0.Configuration, name string) (*basev0.Configuration, error)

func FromAnyPb

func FromAnyPb[T any](v *anypb.Any) (*T, error)

func GetConfigurationInformation added in v0.1.126

func GetConfigurationInformation(ctx context.Context, conf *basev0.Configuration, name string) (*basev0.ConfigurationInformation, error)

GetConfigurationInformation returns the configuration information that matches the name. If no configuration information is found, it returns nil.

func GetConfigurationValue

func GetConfigurationValue(ctx context.Context, conf *basev0.Configuration, name string, key string) (string, error)

GetConfigurationValue returns the value of the configuration key. If the configuration or the key is not found, it returns an empty string.

func GroupKey

func GroupKey(endpoint *basev0.Endpoint, group *basev0.RestRouteGroup) string

func HasConfigurationInformation

func HasConfigurationInformation(_ context.Context, conf *basev0.Configuration, name string) bool

func HasPublicEndpoints

func HasPublicEndpoints(endpoints []*basev0.Endpoint) bool

func Hash

func Hash(data []byte) string

func HashString

func HashString(s string) string

func HomeDir

func HomeDir() (string, error)

func InPartialMode

func InPartialMode() bool

func Init

func Init(ctx context.Context) (bool, error)

func IsGRPC

func IsGRPC(_ context.Context, endpoint *basev0.Endpoint) *basev0.GrpcAPI

func IsHTTP

func IsHTTP(_ context.Context, endpoint *basev0.Endpoint) *basev0.HttpAPI

func IsLocal

func IsLocal(environment *basev0.Environment) bool

func IsRest

func IsRest(_ context.Context, endpoint *basev0.Endpoint) *basev0.RestAPI

func IsTCP

func IsTCP(_ context.Context, endpoint *basev0.Endpoint) *basev0.TcpAPI

func Light

func Light(e *basev0.Endpoint) *basev0.Endpoint

func LightAPI

func LightAPI(api *basev0.API) *basev0.API

func LoadFromBytes

func LoadFromBytes[C Configuration](content []byte) (*C, error)

func LoadFromDir

func LoadFromDir[C Configuration](ctx context.Context, dir string) (*C, error)

func LoadFromFs

func LoadFromFs[C Configuration](fs shared.FileSystem) (*C, error)

func LoadFromPath

func LoadFromPath[C Configuration](ctx context.Context, p string) (*C, error)

func LoadGrpcAPI

func LoadGrpcAPI(_ context.Context, f *string) (*basev0.GrpcAPI, error)

func LoadHTTPAPI

func LoadHTTPAPI(_ context.Context) (*basev0.HttpAPI, error)

func LoadModuleAndServiceFromCurrentPath added in v0.1.128

func LoadModuleAndServiceFromCurrentPath(ctx context.Context) (*Module, *Service, error)

func LoadRestAPI

func LoadRestAPI(ctx context.Context, f *string) (*basev0.RestAPI, error)

func LoadSpec

func LoadSpec(ctx context.Context, content []byte, obj any) error

func LoadTCPAPI

func LoadTCPAPI(_ context.Context) (*basev0.TcpAPI, error)

func LocalizeNetworkMapping

func LocalizeNetworkMapping(mappings []*basev0.NetworkMapping, hostname string) []*basev0.NetworkMapping

func MakeConfigurationInformationSummary

func MakeConfigurationInformationSummary(info *basev0.ConfigurationInformation) string

func MakeConfigurationSummary

func MakeConfigurationSummary(conf *basev0.Configuration) string

func MakeConfigurationValueSummary

func MakeConfigurationValueSummary(value *basev0.ConfigurationValue) string

func MakeDNSSummary

func MakeDNSSummary(dns *basev0.DNS) string

func MakeEndpointAccessSummary added in v0.1.93

func MakeEndpointAccessSummary(endpointAccess *EndpointAccess) string

func MakeEndpointSummary

func MakeEndpointSummary(endpoint *basev0.Endpoint) string

func MakeManyConfigurationSummary

func MakeManyConfigurationSummary(confs []*basev0.Configuration) string

func MakeManyDNSSummary

func MakeManyDNSSummary(dns []*basev0.DNS) string

func MakeManyEndpointAccessSummary added in v0.1.93

func MakeManyEndpointAccessSummary(endpointAccesses []*EndpointAccess) string

func MakeManyNetworkMappingSummary

func MakeManyNetworkMappingSummary(mappings []*basev0.NetworkMapping) string

func MakeManyServicesSummary

func MakeManyServicesSummary(services []*ServiceIdentity) string

func MakeNetworkInstanceSummary added in v0.1.93

func MakeNetworkInstanceSummary(instance *basev0.NetworkInstance) string

func MakeNetworkMappingSummary

func MakeNetworkMappingSummary(mapping *basev0.NetworkMapping) string

func Match added in v0.1.141

func Match(s, other string) bool

func Method added in v0.1.133

func Method(item spec.PathItem) string

func ModuleMode

func ModuleMode() bool

func NameToKey

func NameToKey(name string) string

func NetworkAccessFromRuntimeContext

func NetworkAccessFromRuntimeContext(runtimeContext *basev0.RuntimeContext) *basev0.NetworkAccess

NetworkAccessFromRuntimeContext returns a NetworkAccess from a runtime context. Both native and nix run on the host, so they map to native network access.

func NetworkInstanceSummary

func NetworkInstanceSummary(value *basev0.NetworkInstance) string

func NetworkMappingHash

func NetworkMappingHash(networkMappings ...*basev0.NetworkMapping) string

func NewAPI

func NewAPI(_ context.Context, endpoint *Endpoint, api *basev0.API) (*basev0.Endpoint, error)

func NewContainerNetworkAccess

func NewContainerNetworkAccess() *basev0.NetworkAccess

func NewHTTPNetworkInstance

func NewHTTPNetworkInstance(hostname string, port uint16, secured bool) *basev0.NetworkInstance

func NewNativeNetworkAccess

func NewNativeNetworkAccess() *basev0.NetworkAccess

func NewNetworkInstance

func NewNetworkInstance(hostname string, port uint16) *basev0.NetworkInstance

func NewPublicNetworkAccess

func NewPublicNetworkAccess() *basev0.NetworkAccess

func NewRuntimeContext

func NewRuntimeContext(runtimeContext string) (*basev0.RuntimeContext, error)

func NewRuntimeContextContainer

func NewRuntimeContextContainer() *basev0.RuntimeContext

func NewRuntimeContextFree

func NewRuntimeContextFree() *basev0.RuntimeContext

func NewRuntimeContextNative

func NewRuntimeContextNative() *basev0.RuntimeContext

func NewRuntimeContextNix added in v0.1.155

func NewRuntimeContextNix() *basev0.RuntimeContext

func OverridePath

func OverridePath(defaultPath string, path string) *string

OverridePath is nil if the name is the same as the desired relative path

func ParseOpenAPI

func ParseOpenAPI(spec []byte) (*openapispec.Swagger, error)

func Path

func Path[C Configuration](ctx context.Context, dir string) (string, error)

func PortFromAddress

func PortFromAddress(address string) (uint16, error)

func ReferenceMatch

func ReferenceMatch(entry string, name string) bool

func RegisterAgent

func RegisterAgent(kind AgentKind, protoKind basev0.Agent_Kind)

func RestRouteEnvironmentVariableKey

func RestRouteEnvironmentVariableKey(info *EndpointInformation, route *basev0.RestRoute) (string, error)

func RestRoutes

func RestRoutes(rest *basev0.RestAPI) string

func RouteKey added in v0.1.133

func RouteKey(path string, method string) string

func RuntimeContextFromEnv added in v0.1.131

func RuntimeContextFromEnv() *basev0.RuntimeContext

RuntimeContextFromEnv returns a runtime context from the environment variable.

func RuntimeContextFromInstance

func RuntimeContextFromInstance(instance *basev0.NetworkInstance) *basev0.RuntimeContext

RuntimeContextFromInstance returns a runtime context from a network instance.

func RuntimeContexts

func RuntimeContexts() []string

func SaveToDir

func SaveToDir[C Configuration](ctx context.Context, c *C, dir string) error

func SerializeSpec

func SerializeSpec(ctx context.Context, spec any) ([]byte, error)

func ServiceConfigurationEnvironmentKeyPrefixFromUnique

func ServiceConfigurationEnvironmentKeyPrefixFromUnique(unique string) string

func ServiceConfigurationKey

func ServiceConfigurationKey(service *ServiceIdentity, name string, key string) string

func ServiceConfigurationKeyFromUnique

func ServiceConfigurationKeyFromUnique(unique string, name string, key string) string

func ServiceSecretConfigurationEnvironmentKeyPrefixFromUnique

func ServiceSecretConfigurationEnvironmentKeyPrefixFromUnique(unique string) string

func ServiceSecretConfigurationKey

func ServiceSecretConfigurationKey(service *ServiceIdentity, name string, key string) string

func ServiceSecretConfigurationKeyFromUnique

func ServiceSecretConfigurationKeyFromUnique(unique string, name string, key string) string

func ServiceUnique

func ServiceUnique(module string, service string) string

func ServiceUniqueFromEndpoint

func ServiceUniqueFromEndpoint(endpoint *basev0.Endpoint) string

func SetMode

func SetMode(m Mode)

func SplitPublicNetworkMappings added in v0.1.141

func SplitPublicNetworkMappings(ctx context.Context, mappings []*basev0.NetworkMapping) ([]*basev0.NetworkMapping, []*basev0.NetworkMapping, error)

func SplitUnique added in v0.1.155

func SplitUnique(unique string) (module, name string)

SplitUnique splits a unique identifier (module/name) into module and name parts

func ToGrpcAPI

func ToGrpcAPI(grpc *basev0.GrpcAPI) *basev0.API

func ToHTTPAPI

func ToHTTPAPI(http *basev0.HttpAPI) *basev0.API

func ToOrganizationName

func ToOrganizationName(svc string) string

func ToOrganizationSourceVersionControl

func ToOrganizationSourceVersionControl(name string) string

func ToRestAPI

func ToRestAPI(rest *basev0.RestAPI) *basev0.API

func ToTCPAPI

func ToTCPAPI(tcp *basev0.TcpAPI) *basev0.API

func TypeName

func TypeName[C Configuration]() string

func UniqueToKey

func UniqueToKey(origin string) string

func ValidOrganization

func ValidOrganization(org *basev0.Organization) error

func Validate

func Validate(req proto.Message) error

func ValidateAgent

func ValidateAgent(agent *basev0.Agent) error

func ValidateDomain

func ValidateDomain()

func ValidateRuntimeContext added in v0.1.109

func ValidateRuntimeContext(rc string) error

Types

type Agent

type Agent struct {
	Kind      AgentKind `yaml:"kind" json:"kind"`
	Name      string    `yaml:"name" json:"name"`
	Version   string    `yaml:"version" json:"version"`
	Publisher string    `yaml:"publisher" json:"publisher"`
}
var CLI *Agent

func AgentFromProto

func AgentFromProto(agent *basev0.Agent) *Agent

func LoadAgent

func LoadAgent(ctx context.Context, action *basev0.Agent) (*Agent, error)

func ParseAgent

func ParseAgent(ctx context.Context, k AgentKind, s string) (*Agent, error)

func (*Agent) AsResource

func (p *Agent) AsResource() *wool.Resource

func (*Agent) Identifier

func (p *Agent) Identifier() string

func (*Agent) IsApplication added in v0.1.155

func (p *Agent) IsApplication() bool

func (*Agent) IsModule added in v0.1.155

func (p *Agent) IsModule() bool

IsModule returns true if this agent is a module agent

func (*Agent) IsService

func (p *Agent) IsService() bool

func (*Agent) Key

func (p *Agent) Key(kind AgentKind, unique string) string

func (*Agent) Of

func (p *Agent) Of(kind AgentKind) *Agent

func (*Agent) Patch

func (p *Agent) Patch() (*Agent, error)

func (*Agent) Path

func (p *Agent) Path(ctx context.Context) (string, error)

func (*Agent) Proto

func (p *Agent) Proto() *basev0.Agent

func (*Agent) String

func (p *Agent) String() string

func (*Agent) Unique

func (p *Agent) Unique() string

type AgentKind

type AgentKind string

func AgentKindFromProto

func AgentKindFromProto(kind basev0.Agent_Kind) (*AgentKind, error)

type Application added in v0.1.155

type Application struct {
	Kind        string `yaml:"kind"`
	Name        string `yaml:"name"`
	Description string `yaml:"description,omitempty"`
	Version     string `yaml:"version"`

	PathOverride *string `yaml:"path,omitempty"`

	Agent *Agent `yaml:"agent"`

	// Dependencies
	ServiceDependencies                []*ServiceDependency     `yaml:"service-dependencies,omitempty"`
	ApplicationDependencies            []*ApplicationDependency `yaml:"application-dependencies,omitempty"`
	LibraryDependencies                []*LibraryDependency     `yaml:"library-dependencies,omitempty"`
	WorkspaceConfigurationDependencies []string                 `yaml:"workspace-configuration-dependencies,omitempty"`

	// Build outputs
	Artifacts []*Artifact `yaml:"artifacts,omitempty"`

	// Application-specific settings
	Spec map[string]any `yaml:"spec,omitempty"`
	// contains filtered or unexported fields
}

Application represents an end-user facing program (CLI, desktop app, etc.)

func FindApplicationsInDir added in v0.1.155

func FindApplicationsInDir(ctx context.Context, dir string) ([]*Application, error)

FindApplicationsInDir finds all applications in a directory

func LoadApplicationFromDir added in v0.1.155

func LoadApplicationFromDir(ctx context.Context, dir string) (*Application, error)

LoadApplicationFromDir loads an application from a directory

func NewApplication added in v0.1.155

func NewApplication(ctx context.Context, name string) (*Application, error)

NewApplication creates a new Application

func (*Application) AddApplicationDependency added in v0.1.155

func (app *Application) AddApplicationDependency(name string, module string)

AddApplicationDependency adds a dependency on another application

func (*Application) AddServiceDependency added in v0.1.155

func (app *Application) AddServiceDependency(name string, module string)

AddServiceDependency adds a dependency on a service

func (*Application) Dir added in v0.1.155

func (app *Application) Dir() string

Dir returns the application directory

func (*Application) GetApplicationDependencies added in v0.1.155

func (app *Application) GetApplicationDependencies() []*ApplicationDependency

GetApplicationDependencies returns all application dependencies

func (*Application) GetServiceDependencies added in v0.1.155

func (app *Application) GetServiceDependencies() []*ServiceDependency

GetServiceDependencies returns all service dependencies

func (*Application) HasApplicationDependency added in v0.1.155

func (app *Application) HasApplicationDependency(name string, module string) bool

HasApplicationDependency checks if an application has a dependency on another application

func (*Application) HasServiceDependency added in v0.1.155

func (app *Application) HasServiceDependency(name string, module string) bool

HasServiceDependency checks if an application has a dependency on a service

func (*Application) Identity added in v0.1.155

func (app *Application) Identity() (*ApplicationIdentity, error)

Identity returns the application identity

func (*Application) Local added in v0.1.155

func (app *Application) Local(p ...string) string

Local returns a path relative to the application directory

func (*Application) Module added in v0.1.155

func (app *Application) Module() string

Module returns the module name

func (*Application) Proto added in v0.1.155

func (app *Application) Proto(_ context.Context) (*basev0.Application, error)

Proto converts to protobuf representation

func (*Application) RemoveApplicationDependency added in v0.1.155

func (app *Application) RemoveApplicationDependency(name string, module string)

RemoveApplicationDependency removes a dependency on another application

func (*Application) RemoveServiceDependency added in v0.1.155

func (app *Application) RemoveServiceDependency(name string, module string)

RemoveServiceDependency removes a dependency on a service

func (*Application) ResolveAllApplicationDependencies added in v0.1.155

func (app *Application) ResolveAllApplicationDependencies(ctx context.Context, workspace *Workspace) ([]*Application, error)

ResolveAllApplicationDependencies resolves all application dependencies

func (*Application) ResolveApplicationDependency added in v0.1.155

func (app *Application) ResolveApplicationDependency(ctx context.Context, dep *ApplicationDependency, workspace *Workspace) (*Application, error)

ResolveApplicationDependency resolves an application dependency to an actual Application

func (*Application) Save added in v0.1.155

func (app *Application) Save(ctx context.Context) error

Save saves the application configuration to its directory

func (*Application) SaveToDir added in v0.1.155

func (app *Application) SaveToDir(ctx context.Context, dir string) error

SaveToDir saves the application configuration to a directory

func (*Application) SetDir added in v0.1.155

func (app *Application) SetDir(dir string)

SetDir sets the application directory

func (*Application) SetModule added in v0.1.155

func (app *Application) SetModule(module string)

SetModule sets the module name

func (*Application) Unique added in v0.1.155

func (app *Application) Unique() string

Unique returns the unique identifier for the application

type ApplicationDependency added in v0.1.155

type ApplicationDependency struct {
	Name   string `yaml:"name"`
	Module string `yaml:"module,omitempty"`
}

ApplicationDependency represents a dependency on another application

func (*ApplicationDependency) String added in v0.1.155

func (dep *ApplicationDependency) String() string

String returns a string representation of the application dependency

func (*ApplicationDependency) Unique added in v0.1.155

func (dep *ApplicationDependency) Unique() string

Unique returns the unique identifier for an application dependency

type ApplicationIdentity added in v0.1.155

type ApplicationIdentity struct {
	Name    string
	Module  string
	Version string
}

ApplicationIdentity represents the identity of an application

func (*ApplicationIdentity) Unique added in v0.1.155

func (id *ApplicationIdentity) Unique() string

Unique returns the unique identifier

type ApplicationReference added in v0.1.155

type ApplicationReference struct {
	Name string `yaml:"name"`
}

ApplicationReference is used in module configuration

type Artifact added in v0.1.155

type Artifact struct {
	Name     string `yaml:"name"`
	Type     string `yaml:"type"`               // "binary", "bundle", "package"
	Platform string `yaml:"platform,omitempty"` // "darwin-arm64", "linux-amd64", etc.
	Path     string `yaml:"path,omitempty"`
}

Artifact represents a build output from an application

type ClientEntry

type ClientEntry struct {
	Name string   `yaml:"name"`
	APIs []string `yaml:"apis"`
}

func (*ClientEntry) Validate

func (c *ClientEntry) Validate() error

type Configuration

type Configuration interface{}

type DockerImage

type DockerImage struct {
	Repository string
	Name       string
	Tag        string
}

func NewDockerImage

func NewDockerImage(s string) *DockerImage

func ParsePinnedImage added in v0.1.155

func ParsePinnedImage(s string) (*DockerImage, error)

ParsePinnedImage parses a "name:tag" image reference for a plugin's runtimeImage override. Unlike NewDockerImage, it REJECTS untagged references ("foo") and explicit ":latest" tags — our mode-consistency policy requires every runtime image pin to be a specific version so builds are reproducible. Callers typically feed this a value from a plugin's Settings.DockerImage field.

Accepts: "codeflydev/python:0.0.1", "my.registry/foo:1.2.3" Rejects: "foo" (no tag), "foo:latest" (floating), "foo:1:2" (malformed)

func (*DockerImage) FullName

func (image *DockerImage) FullName() string

type Endpoint

type Endpoint struct {
	Name        string `yaml:"name"`
	Service     string `yaml:"service,omitempty"`
	Module      string `yaml:"module,omitempty"`
	Description string `yaml:"description,omitempty"`
	Visibility  string `yaml:"visibility,omitempty"`
	API         string `yaml:"api,omitempty"`
}

Endpoint is the fundamental entity that standardize communication between services.

func EndpointFromProto

func EndpointFromProto(e *basev0.Endpoint) *Endpoint

func FromProtoEndpoints

func FromProtoEndpoints(es ...*basev0.Endpoint) ([]*Endpoint, error)

func (*Endpoint) AsReference

func (endpoint *Endpoint) AsReference() *EndpointReference

func (*Endpoint) Information

func (endpoint *Endpoint) Information() *EndpointInformation

func (*Endpoint) Proto

func (endpoint *Endpoint) Proto() (*basev0.Endpoint, error)

func (*Endpoint) ServiceUnique

func (endpoint *Endpoint) ServiceUnique() string

func (*Endpoint) Unique

func (endpoint *Endpoint) Unique() string

type EndpointAccess

type EndpointAccess struct {
	Endpoint        *basev0.Endpoint
	NetworkInstance *basev0.NetworkInstance
	// contains filtered or unexported fields
}

type EndpointInformation

type EndpointInformation struct {
	Module  string
	Service string
	Name    string
	API     string
}

func EndpointInformationFromProto

func EndpointInformationFromProto(endpoint *basev0.Endpoint) *EndpointInformation

func ParseEndpoint

func ParseEndpoint(unique string) (*EndpointInformation, error)

func (*EndpointInformation) Identifier

func (endpoint *EndpointInformation) Identifier() string

Identifier satisfies this format: - name::api if name != api - api if name == api or name == ""

func (*EndpointInformation) UnknownAPI

func (endpoint *EndpointInformation) UnknownAPI() bool

type EndpointReference

type EndpointReference struct {
	API  string `yaml:"api"`
	Name string `yaml:"name"`
}

An EndpointReference

func (*EndpointReference) GetAPI added in v0.1.123

func (e *EndpointReference) GetAPI() string

type EndpointSummary

type EndpointSummary struct {
	Count   int
	Uniques []string
}

func MakeManyEndpointSummary

func MakeManyEndpointSummary(endpoints []*basev0.Endpoint) EndpointSummary

type Environment

type Environment struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description,omitempty"`
	NamingScope string `yaml:"naming-scope,omitempty"`
}

Environment is a configuration for an environment

func EnvironmentFromProto

func EnvironmentFromProto(env *basev0.Environment) *Environment

func LocalEnvironment

func LocalEnvironment() *Environment

LocalEnvironment is a local environment that is always available

func (*Environment) Local

func (env *Environment) Local() bool

func (*Environment) Proto

func (env *Environment) Proto() (*basev0.Environment, error)

type EnvironmentExistsError

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

func (*EnvironmentExistsError) Error

func (err *EnvironmentExistsError) Error() string

type EnvironmentReference

type EnvironmentReference struct {
	Name string `yaml:"name"`
}

An EnvironmentReference at the level

func (*EnvironmentReference) String

func (ref *EnvironmentReference) String() string

type EnvironmentVariable

type EnvironmentVariable struct {
	Key   string
	Value any
}

func ConfigurationAsEnvironmentVariables

func ConfigurationAsEnvironmentVariables(conf *basev0.Configuration, secret bool) []*EnvironmentVariable

ConfigurationAsEnvironmentVariables converts a configuration to a list of environment variables the secret flag decides if we return secret or regular values

func ConfigurationAsRawEnvironmentVariables added in v0.1.133

func ConfigurationAsRawEnvironmentVariables(conf *basev0.Configuration) []*EnvironmentVariable

ConfigurationAsEnvironmentVariables converts a configuration to a list of environment variables the secret flag decides if we return secret or regular values

func EndpointAsEnvironmentVariable

func EndpointAsEnvironmentVariable(endpointAccess *EndpointAccess) *EnvironmentVariable

func Env

func Env(key string, value any) *EnvironmentVariable

func EnvironmentAsEnvironmentVariable

func EnvironmentAsEnvironmentVariable(env *basev0.Environment) *EnvironmentVariable

func FixtureAsEnvironmentVariable added in v0.1.122

func FixtureAsEnvironmentVariable(fixture string) *EnvironmentVariable

func ModuleAsEnvironmentVariable

func ModuleAsEnvironmentVariable(module string) *EnvironmentVariable

func ParseEnv added in v0.1.114

func ParseEnv(env string) *EnvironmentVariable

func RestRoutesAsEnvironmentVariable

func RestRoutesAsEnvironmentVariable(restRoute *RestRouteAccess) (*EnvironmentVariable, error)

func RuntimeContextAsEnvironmentVariable

func RuntimeContextAsEnvironmentVariable(runtimeContext *basev0.RuntimeContext) *EnvironmentVariable

func ServiceAsEnvironmentVariable

func ServiceAsEnvironmentVariable(service string) *EnvironmentVariable

func VersionAsEnvironmentVariable

func VersionAsEnvironmentVariable(version string) *EnvironmentVariable

func WorkspaceAsEnvironmentVariable

func WorkspaceAsEnvironmentVariable(workspace string) *EnvironmentVariable

func (EnvironmentVariable) String

func (v EnvironmentVariable) String() string

func (EnvironmentVariable) ValueAsEncodedString

func (v EnvironmentVariable) ValueAsEncodedString() string

func (EnvironmentVariable) ValueAsString

func (v EnvironmentVariable) ValueAsString() string

type EnvironmentVariableManager

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

func NewEnvironmentVariableManager

func NewEnvironmentVariableManager() *EnvironmentVariableManager

func (*EnvironmentVariableManager) AddConfigurations

func (holder *EnvironmentVariableManager) AddConfigurations(_ context.Context, configurations ...*basev0.Configuration) error

func (*EnvironmentVariableManager) AddEndpoints

func (holder *EnvironmentVariableManager) AddEndpoints(ctx context.Context, mappings []*basev0.NetworkMapping, networkAccess *basev0.NetworkAccess, opts ...EnvironmentVariableOption) error

func (*EnvironmentVariableManager) AddEnvironmentVariable added in v0.1.141

func (holder *EnvironmentVariableManager) AddEnvironmentVariable(ctx context.Context, key string, value string)

AddEnvironmentVariable adds an environment variable to the manager

func (*EnvironmentVariableManager) AddRawConfigurations added in v0.1.133

func (holder *EnvironmentVariableManager) AddRawConfigurations(_ context.Context, configurations ...*basev0.Configuration) error

func (*EnvironmentVariableManager) AddRestRoutes

func (holder *EnvironmentVariableManager) AddRestRoutes(ctx context.Context, mappings []*basev0.NetworkMapping, networkAccess *basev0.NetworkAccess, opts ...EnvironmentVariableOption) error

func (*EnvironmentVariableManager) All

func (*EnvironmentVariableManager) Configurations

func (holder *EnvironmentVariableManager) Configurations() ([]*EnvironmentVariable, error)

func (*EnvironmentVariableManager) Endpoints added in v0.1.93

func (holder *EnvironmentVariableManager) Endpoints() []*EndpointAccess

func (*EnvironmentVariableManager) Secrets

func (holder *EnvironmentVariableManager) Secrets() []*EnvironmentVariable

func (*EnvironmentVariableManager) SetEnvironment

func (holder *EnvironmentVariableManager) SetEnvironment(environment *basev0.Environment)

func (*EnvironmentVariableManager) SetFixture added in v0.1.122

func (holder *EnvironmentVariableManager) SetFixture(fixture string)

func (*EnvironmentVariableManager) SetIdentity

func (holder *EnvironmentVariableManager) SetIdentity(identity *basev0.ServiceIdentity)

func (*EnvironmentVariableManager) SetRunning

func (holder *EnvironmentVariableManager) SetRunning()

func (*EnvironmentVariableManager) SetRuntimeContext

func (holder *EnvironmentVariableManager) SetRuntimeContext(runtimeContext *basev0.RuntimeContext)

type EnvironmentVariableOption added in v0.1.141

type EnvironmentVariableOption func(*EnvironmentVariableOptions)

func WithNonPublicEnvironmentVariablePrefix added in v0.1.141

func WithNonPublicEnvironmentVariablePrefix(prefix string) EnvironmentVariableOption

func WithPublicEnvironmentVariablePrefix added in v0.1.141

func WithPublicEnvironmentVariablePrefix(prefix string) EnvironmentVariableOption

type EnvironmentVariableOptions added in v0.1.141

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

type ExtendedGRPCRoute

type ExtendedGRPCRoute[T any] struct {
	GRPCRoute `yaml:",inline"`

	Extension T `yaml:"extension"`
}

func LoadExtendedGRPCRoute

func LoadExtendedGRPCRoute[T any](ctx context.Context, p string) (*ExtendedGRPCRoute[T], error)

func (*ExtendedGRPCRoute[T]) Save

func (g *ExtendedGRPCRoute[T]) Save(ctx context.Context, dir string) error

type ExtendedGRPCRouteLoader

type ExtendedGRPCRouteLoader[T any] struct {
	// contains filtered or unexported fields
}

ExtendedGRPCRouteLoader will return all GRPC route groups in a directory

func NewExtendedGRPCRouteLoader

func NewExtendedGRPCRouteLoader[T any](ctx context.Context, dir string) (*ExtendedGRPCRouteLoader[T], error)

func (*ExtendedGRPCRouteLoader[T]) Add

func (loader *ExtendedGRPCRouteLoader[T]) Add(route *ExtendedGRPCRoute[T])

func (*ExtendedGRPCRouteLoader[T]) All

func (loader *ExtendedGRPCRouteLoader[T]) All() []*ExtendedGRPCRoute[T]

func (*ExtendedGRPCRouteLoader[T]) Load

func (loader *ExtendedGRPCRouteLoader[T]) Load(ctx context.Context) error

func (*ExtendedGRPCRouteLoader[T]) Save

func (loader *ExtendedGRPCRouteLoader[T]) Save(ctx context.Context) error

type ExtendedRestRoute

type ExtendedRestRoute[T any] struct {
	RestRoute `yaml:",inline"`

	Extension T `yaml:"extension"`
}

func NewExtendedRestRoute

func NewExtendedRestRoute[T any](rest RestRoute, value T) *ExtendedRestRoute[T]

type ExtendedRestRouteGroup

type ExtendedRestRouteGroup[T any] struct {
	Path    string                  `yaml:"path"`
	Routes  []*ExtendedRestRoute[T] `yaml:"routes"`
	Module  string                  `yaml:"-"`
	Service string                  `yaml:"-"`
}

func LoadExtendedRestRouteGroup

func LoadExtendedRestRouteGroup[T any](ctx context.Context, p string) (*ExtendedRestRouteGroup[T], error)

func (*ExtendedRestRouteGroup[T]) Add

func (g *ExtendedRestRouteGroup[T]) Add(route ExtendedRestRoute[T])

func (*ExtendedRestRouteGroup[T]) Save

func (g *ExtendedRestRouteGroup[T]) Save(ctx context.Context, dir string) error

func (*ExtendedRestRouteGroup[T]) ServiceUnique

func (g *ExtendedRestRouteGroup[T]) ServiceUnique() string

type ExtendedRouteLoader

type ExtendedRouteLoader[T any] struct {
	// contains filtered or unexported fields
}

ExtendedRouteLoader will return all rest route groups in a directory

func NewExtendedRestRouteLoader

func NewExtendedRestRouteLoader[T any](ctx context.Context, dir string) (*ExtendedRouteLoader[T], error)

func (*ExtendedRouteLoader[T]) AddGroup

func (loader *ExtendedRouteLoader[T]) AddGroup(group *ExtendedRestRouteGroup[T])

func (*ExtendedRouteLoader[T]) All

func (loader *ExtendedRouteLoader[T]) All() []*ExtendedRestRoute[T]

func (*ExtendedRouteLoader[T]) GroupFor

func (loader *ExtendedRouteLoader[T]) GroupFor(unique string, routePath string) *ExtendedRestRouteGroup[T]

func (*ExtendedRouteLoader[T]) Groups

func (loader *ExtendedRouteLoader[T]) Groups() []*ExtendedRestRouteGroup[T]

func (*ExtendedRouteLoader[T]) GroupsFor

func (loader *ExtendedRouteLoader[T]) GroupsFor(unique string) []*ExtendedRestRouteGroup[T]

func (*ExtendedRouteLoader[T]) Load

func (loader *ExtendedRouteLoader[T]) Load(ctx context.Context) error

func (*ExtendedRouteLoader[T]) Save

func (loader *ExtendedRouteLoader[T]) Save(ctx context.Context) error

type FlatLayout

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

func NewFlatLayout

func NewFlatLayout(ctx context.Context, root string, conf []byte) (*FlatLayout, error)

func (FlatLayout) ModulePath

func (f FlatLayout) ModulePath(string) string

func (FlatLayout) ModulesRoot

func (f FlatLayout) ModulesRoot() string

func (FlatLayout) ServicePath

func (f FlatLayout) ServicePath(_ string, name string) string

func (FlatLayout) ServicesRoot

func (f FlatLayout) ServicesRoot(string) string

type GRPCRoute

type GRPCRoute struct {
	Name        string `yaml:"name"`
	Package     string `yaml:"package"`
	ServiceName string `yaml:"service-name"`
	Module      string `yaml:"-"`
	Service     string `yaml:"-"`
}

func DetectNewGRPCRoutesFromEndpoints

func DetectNewGRPCRoutesFromEndpoints(ctx context.Context, endpoints []*basev0.Endpoint, known []*GRPCRoute) []*GRPCRoute

func GRPCRouteFromProto

func GRPCRouteFromProto(e *basev0.Endpoint, grpc *basev0.GrpcAPI, rpc *basev0.RPC) *GRPCRoute

func LoadGRPCRoute

func LoadGRPCRoute(ctx context.Context, p string) (*GRPCRoute, error)

func UnwrapGRPCRoute

func UnwrapGRPCRoute[T any](route *ExtendedGRPCRoute[T]) *GRPCRoute

func (*GRPCRoute) Delete

func (g *GRPCRoute) Delete(ctx context.Context, dir string) error

func (*GRPCRoute) Route

func (g *GRPCRoute) Route() string

A Route in gRPC is defined as: /package.Service/Method

func (*GRPCRoute) Save

func (g *GRPCRoute) Save(ctx context.Context, dir string) error

func (*GRPCRoute) ServiceUnique

func (g *GRPCRoute) ServiceUnique() string

type GRPCRouteLoader

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

GRPCRouteLoader will return all GRPC route groups in a directory

func NewGRPCRouteLoader

func NewGRPCRouteLoader(ctx context.Context, dir string) (*GRPCRouteLoader, error)

func (*GRPCRouteLoader) All

func (loader *GRPCRouteLoader) All() []*GRPCRoute

func (*GRPCRouteLoader) Load

func (loader *GRPCRouteLoader) Load(ctx context.Context) error

func (*GRPCRouteLoader) Save

func (loader *GRPCRouteLoader) Save(ctx context.Context) error

type GitConfig added in v0.1.155

type GitConfig struct {
	Remote string `yaml:"remote,omitempty"` // Git remote URL
	Branch string `yaml:"branch,omitempty"` // Default branch
	Commit string `yaml:"commit,omitempty"` // Pinned commit
	Tag    string `yaml:"tag,omitempty"`    // Version tag
}

GitConfig for libraries that are git repositories

type HTTPAPI

type HTTPAPI struct{}

func (*HTTPAPI) Proto

func (h *HTTPAPI) Proto() (*basev0.API, error)

type HTTPMethod

type HTTPMethod string
const (
	HTTPMethodGet     HTTPMethod = "GET"
	HTTPMethodPut     HTTPMethod = "PUT"
	HTTPMethodPost    HTTPMethod = "POST"
	HTTPMethodDelete  HTTPMethod = "DELETE"
	HTTPMethodPatch   HTTPMethod = "PATCH"
	HTTPMethodOptions HTTPMethod = "OPTIONS"
	HTTPMethodHead    HTTPMethod = "HEAD"
)

func ConvertHTTPMethodFromProto

func ConvertHTTPMethodFromProto(m basev0.HTTPMethod) (HTTPMethod, error)

type Hasher

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

func NewHasher

func NewHasher() *Hasher

func (*Hasher) Add

func (h *Hasher) Add(s string)

func (*Hasher) Hash

func (h *Hasher) Hash() string

type InterfaceEndpoint added in v0.1.155

type InterfaceEndpoint struct {
	Service    string `yaml:"service"`
	Endpoint   string `yaml:"endpoint"`
	Visibility string `yaml:"visibility,omitempty"` // "module" or "public"; defaults to "module"
}

InterfaceEndpoint declares a single endpoint that the module exposes to other modules.

type Job added in v0.1.155

type Job struct {
	Kind        string `yaml:"kind"`
	Name        string `yaml:"name"`
	Description string `yaml:"description,omitempty"`
	Version     string `yaml:"version"`

	// Execution configuration
	Execution *JobExecution `yaml:"execution,omitempty"`

	// Agent for running the job
	Agent *Agent `yaml:"agent,omitempty"`

	// Dependencies
	ServiceDependencies                []*ServiceDependency `yaml:"service-dependencies,omitempty"`
	JobDependencies                    []*JobDependency     `yaml:"job-dependencies,omitempty"`
	LibraryDependencies                []*LibraryDependency `yaml:"library-dependencies,omitempty"`
	WorkspaceConfigurationDependencies []string             `yaml:"workspace-configuration-dependencies,omitempty"`

	// Job-specific settings
	Spec map[string]any `yaml:"spec,omitempty"`
	// contains filtered or unexported fields
}

Job represents an ephemeral execution unit for scheduled or one-shot tasks

func LoadJobFromDir added in v0.1.155

func LoadJobFromDir(ctx context.Context, dir string) (*Job, error)

LoadJobFromDir loads a job from a directory

func NewJob added in v0.1.155

func NewJob(ctx context.Context, name string) (*Job, error)

NewJob creates a new Job

func (*Job) Dir added in v0.1.155

func (job *Job) Dir() string

Dir returns the job directory

func (*Job) Identity added in v0.1.155

func (job *Job) Identity() *JobIdentity

Identity returns the job identity

func (*Job) IsOneShot added in v0.1.155

func (job *Job) IsOneShot() bool

IsOneShot returns true if the job is one-shot

func (*Job) IsScheduled added in v0.1.155

func (job *Job) IsScheduled() bool

IsScheduled returns true if the job is scheduled

func (*Job) IsTriggered added in v0.1.155

func (job *Job) IsTriggered() bool

IsTriggered returns true if the job is triggered

func (*Job) Module added in v0.1.155

func (job *Job) Module() string

Module returns the job's module name

func (*Job) Proto added in v0.1.155

func (job *Job) Proto(_ context.Context) map[string]any

Proto converts to a map representation

func (*Job) Save added in v0.1.155

func (job *Job) Save(ctx context.Context) error

Save saves the job configuration

func (*Job) SaveToDir added in v0.1.155

func (job *Job) SaveToDir(ctx context.Context, dir string) error

SaveToDir saves the job to a specific directory

func (*Job) SetModule added in v0.1.155

func (job *Job) SetModule(module string)

SetModule sets the job's module

func (*Job) Unique added in v0.1.155

func (job *Job) Unique() string

Unique returns a unique identifier for the job

func (*Job) WithDir added in v0.1.155

func (job *Job) WithDir(dir string)

WithDir sets the job directory

type JobDependency added in v0.1.155

type JobDependency struct {
	Name   string `yaml:"name"`
	Module string `yaml:"module,omitempty"`
}

JobDependency represents a dependency on another job

type JobExecution added in v0.1.155

type JobExecution struct {
	Type       JobExecutionType `yaml:"type"`
	Schedule   string           `yaml:"schedule,omitempty"`    // cron expression for scheduled jobs
	Timeout    string           `yaml:"timeout,omitempty"`     // e.g., "5m", "1h"
	Retries    int              `yaml:"retries,omitempty"`     // retry count on failure
	RetryDelay string           `yaml:"retry-delay,omitempty"` // delay between retries
}

JobExecution configures how a job runs

func (*JobExecution) GetRetryDelay added in v0.1.155

func (e *JobExecution) GetRetryDelay() time.Duration

GetRetryDelay returns the retry delay as a duration

func (*JobExecution) GetTimeout added in v0.1.155

func (e *JobExecution) GetTimeout() time.Duration

GetTimeout returns the timeout as a duration

type JobExecutionType added in v0.1.155

type JobExecutionType string

JobExecutionType defines how a job is executed

const (
	JobExecutionOneShot   JobExecutionType = "one-shot"
	JobExecutionScheduled JobExecutionType = "scheduled"
	JobExecutionTriggered JobExecutionType = "triggered"
)

type JobIdentity added in v0.1.155

type JobIdentity struct {
	Name      string
	Module    string
	Workspace string
	Version   string
}

JobIdentity uniquely identifies a job

func (*JobIdentity) Unique added in v0.1.155

func (j *JobIdentity) Unique() string

Unique returns a unique identifier for the job

type JobReference added in v0.1.155

type JobReference struct {
	Name         string  `yaml:"name"`
	Module       string  `yaml:"-"`
	PathOverride *string `yaml:"path,omitempty"`
}

JobReference is used by modules to reference jobs

func DiscoverJobs added in v0.1.155

func DiscoverJobs(ctx context.Context, moduleDir string) ([]*JobReference, error)

DiscoverJobs discovers jobs in a module directory

type LanguageExport added in v0.1.155

type LanguageExport struct {
	Name    string   `yaml:"name"`    // "go", "python", "typescript"
	Agent   string   `yaml:"agent"`   // Library agent identifier
	Path    string   `yaml:"path"`    // Relative path to language code
	Exports []string `yaml:"exports"` // Package/module names exported
}

LanguageExport defines how a library is exported for a specific language

type Layout

type Layout interface {
	ModulesRoot() string
	ModulePath(name string) string

	ServicesRoot(module string) string
	ServicePath(module string, name string) string
}

func NewLayout

func NewLayout(ctx context.Context, root string, kind string, conf []byte) (Layout, error)

type LayoutKind

type LayoutKind = string
const (
	LayoutKindFlat    LayoutKind = "flat"
	LayoutKindModules LayoutKind = "modules"
)

type Library added in v0.1.155

type Library struct {
	Kind        string              `yaml:"kind"`
	Name        string              `yaml:"name"`
	Description string              `yaml:"description,omitempty"`
	Version     string              `yaml:"version"`
	Languages   []*LanguageExport   `yaml:"languages,omitempty"`
	Git         *GitConfig          `yaml:"git,omitempty"`
	LibraryDeps []*LibraryReference `yaml:"library-dependencies,omitempty"`
	// contains filtered or unexported fields
}

Library represents internal shared code that can be used by services

func LoadLibraryFromDir added in v0.1.155

func LoadLibraryFromDir(ctx context.Context, dir string) (*Library, error)

LoadLibraryFromDir loads a library from a directory

func NewLibrary added in v0.1.155

func NewLibrary(ctx context.Context, name string) (*Library, error)

NewLibrary creates a new Library

func (*Library) AddLanguage added in v0.1.155

func (lib *Library) AddLanguage(ctx context.Context, name, agent, relPath string) error

AddLanguage adds a language export to the library

func (*Library) CreateGitTag added in v0.1.155

func (lib *Library) CreateGitTag(ctx context.Context) error

CreateGitTag creates a git tag for the current version

func (*Library) Dir added in v0.1.155

func (lib *Library) Dir() string

Dir returns the library directory

func (*Library) GetGitVersion added in v0.1.155

func (lib *Library) GetGitVersion(ctx context.Context) (string, error)

GetGitVersion returns the current git tag/version if available

func (*Library) GetLanguage added in v0.1.155

func (lib *Library) GetLanguage(name string) *LanguageExport

GetLanguage returns a language export by name

func (*Library) Identity added in v0.1.155

func (lib *Library) Identity() *LibraryIdentity

Identity returns the library identity

func (*Library) IsGitSubmodule added in v0.1.155

func (lib *Library) IsGitSubmodule(ctx context.Context) bool

IsGitSubmodule checks if the library is a git submodule

func (*Library) LanguagePath added in v0.1.155

func (lib *Library) LanguagePath(lang *LanguageExport) string

LanguagePath returns the absolute path to a language's code

func (*Library) Proto added in v0.1.155

func (lib *Library) Proto(_ context.Context) map[string]any

Proto converts to a map representation (proto will be generated later)

func (*Library) Save added in v0.1.155

func (lib *Library) Save(ctx context.Context) error

Save saves the library configuration

func (*Library) SaveToDir added in v0.1.155

func (lib *Library) SaveToDir(ctx context.Context, dir string) error

SaveToDir saves the library to a specific directory

func (*Library) Unique added in v0.1.155

func (lib *Library) Unique() string

Unique returns a unique identifier for the library

func (*Library) WithDir added in v0.1.155

func (lib *Library) WithDir(dir string)

WithDir sets the library directory

type LibraryDependency added in v0.1.155

type LibraryDependency struct {
	Name      string   `yaml:"name"`
	Version   string   `yaml:"version"`   // Semver constraint
	Languages []string `yaml:"languages"` // Which language exports needed
}

LibraryDependency is used when a service depends on a library

type LibraryIdentity added in v0.1.155

type LibraryIdentity struct {
	Name      string
	Workspace string
	Version   string
	Path      string
}

LibraryIdentity uniquely identifies a library

type LibraryMount added in v0.1.155

type LibraryMount struct {
	LibraryName string
	Language    string
	SourcePath  string   // Absolute path on host
	TargetPath  string   // Path in container
	ModulePath  []string // Package/module paths (for Go replace, etc.)
}

LibraryMount represents a mount specification for Docker

type LibraryReference added in v0.1.155

type LibraryReference struct {
	Name    string `yaml:"name"`
	Version string `yaml:"version"` // Semver constraint
}

LibraryReference is used for dependencies between libraries

type LibraryResolver added in v0.1.155

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

LibraryResolver handles library dependency resolution and setup

func NewLibraryResolver added in v0.1.155

func NewLibraryResolver(workspace *Workspace) *LibraryResolver

NewLibraryResolver creates a new library resolver for a workspace

func (*LibraryResolver) CleanupLocalDevelopment added in v0.1.155

func (r *LibraryResolver) CleanupLocalDevelopment(ctx context.Context, svc *Service) error

CleanupLocalDevelopment removes local development setup (for production builds)

func (*LibraryResolver) GetLibraryMounts added in v0.1.155

func (r *LibraryResolver) GetLibraryMounts(ctx context.Context, svc *Service) ([]LibraryMount, error)

GetLibraryMounts returns mount specifications for Docker builds

func (*LibraryResolver) ResolveVersion added in v0.1.155

func (r *LibraryResolver) ResolveVersion(ctx context.Context, name, constraint string) (*Library, string, error)

ResolveVersion finds the best matching version for a constraint

func (*LibraryResolver) SetupLocalDevelopment added in v0.1.155

func (r *LibraryResolver) SetupLocalDevelopment(ctx context.Context, svc *Service) error

SetupLocalDevelopment configures a service for local library development

type Mode

type Mode = string
const (
	ModeModule  Mode = "module"
	ModePartial Mode = "partial"
	ModeService Mode = "service"
)

type Module

type Module struct {
	Kind         string  `yaml:"kind"`
	Name         string  `yaml:"name"`
	PathOverride *string `yaml:"path,omitempty"`

	Description string `yaml:"description,omitempty"`

	// Module interface: the formal contract for what this module exposes
	Interface *ModuleInterface `yaml:"interface,omitempty"`

	// Module template agent (if this module was created from a template)
	Agent *Agent `yaml:"agent,omitempty"`

	ServiceReferences     []*ServiceReference     `yaml:"services"`
	JobReferences         []*JobReference         `yaml:"jobs,omitempty"`
	ApplicationReferences []*ApplicationReference `yaml:"applications,omitempty"`
	// contains filtered or unexported fields
}

An Module is a collection of services that are deployed together.

func LoadModuleFromCurrentPath added in v0.1.137

func LoadModuleFromCurrentPath(ctx context.Context) (*Module, error)

LoadModuleFromCurrentPath loads an module from a path

func LoadModuleFromDir added in v0.1.128

func LoadModuleFromDir(ctx context.Context, dir string) (*Module, error)

func ReloadModule

func ReloadModule(ctx context.Context, app *Module) (*Module, error)

func (*Module) AddApplicationReference added in v0.1.155

func (mod *Module) AddApplicationReference(_ context.Context, ref *ApplicationReference) error

AddApplicationReference adds an application reference to the module

func (*Module) AddJobReference added in v0.1.155

func (mod *Module) AddJobReference(ctx context.Context, ref *JobReference) error

AddJobReference adds a job reference to the module

func (*Module) AddServiceReference

func (mod *Module) AddServiceReference(_ context.Context, ref *ServiceReference) error

func (*Module) ApplicationPath added in v0.1.155

func (mod *Module) ApplicationPath(_ context.Context, ref *ApplicationReference) string

ApplicationPath returns the absolute path of an Application

func (*Module) ApplicationsDir added in v0.1.155

func (mod *Module) ApplicationsDir() string

ApplicationsDir returns the applications directory of the module

func (*Module) DeleteApplication added in v0.1.155

func (mod *Module) DeleteApplication(ctx context.Context, name string) error

DeleteApplication deletes an application from a module

func (*Module) DeleteService

func (mod *Module) DeleteService(ctx context.Context, name string) error

DeleteService deletes a service from an module

func (*Module) DeleteServiceDependencies

func (mod *Module) DeleteServiceDependencies(ctx context.Context, ref *ServiceReference) error

func (*Module) Dir

func (mod *Module) Dir() string

Dir returns the directory of the module

func (*Module) ExistsApplication added in v0.1.155

func (mod *Module) ExistsApplication(ctx context.Context, name string) bool

ExistsApplication returns true if the application exists in the module

func (*Module) ExistsService

func (mod *Module) ExistsService(ctx context.Context, name string) bool

ExistsService returns true if the service exists in the module

func (*Module) ExposedEndpoints added in v0.1.155

func (mod *Module) ExposedEndpoints(ctx context.Context) ([]*basev0.Endpoint, error)

ExposedEndpoints returns the endpoints declared in the module interface. Unlike PublicEndpoints which scans all services, this only returns formally declared exports.

func (*Module) GetServiceReferences

func (mod *Module) GetServiceReferences(name string) (*ServiceReference, error)

func (*Module) HasInterface added in v0.1.155

func (mod *Module) HasInterface() bool

HasInterface returns true if the module has a declared interface

func (*Module) LoadApplicationFromName added in v0.1.155

func (mod *Module) LoadApplicationFromName(ctx context.Context, name string) (*Application, error)

LoadApplicationFromName loads an application from a module by name

func (*Module) LoadApplicationFromReference added in v0.1.155

func (mod *Module) LoadApplicationFromReference(ctx context.Context, ref *ApplicationReference) (*Application, error)

LoadApplicationFromReference loads an application from a reference

func (*Module) LoadApplications added in v0.1.155

func (mod *Module) LoadApplications(ctx context.Context) ([]*Application, error)

LoadApplications loads all applications in the module

func (*Module) LoadJobFromName added in v0.1.155

func (mod *Module) LoadJobFromName(ctx context.Context, name string) (*Job, error)

LoadJobFromName loads a job by name from a module

func (*Module) LoadJobFromReference added in v0.1.155

func (mod *Module) LoadJobFromReference(ctx context.Context, ref *JobReference) (*Job, error)

LoadJobFromReference loads a job from a reference

func (*Module) LoadJobs added in v0.1.155

func (mod *Module) LoadJobs(ctx context.Context) ([]*Job, error)

LoadJobs loads all jobs from a module

func (*Module) LoadServiceFromName

func (mod *Module) LoadServiceFromName(ctx context.Context, name string) (*Service, error)

LoadServiceFromName loads a service from a module returns ResourceNotFound error if not found

func (*Module) LoadServiceFromReference

func (mod *Module) LoadServiceFromReference(ctx context.Context, ref *ServiceReference) (*Service, error)

func (*Module) LoadServices

func (mod *Module) LoadServices(ctx context.Context) ([]*Service, error)

func (*Module) NewApplication added in v0.1.155

func (mod *Module) NewApplication(ctx context.Context, action *actionsv0.AddApplication) (*Application, error)

NewApplication creates an application in a module

func (*Module) NewJob added in v0.1.155

func (mod *Module) NewJob(ctx context.Context, name string) (*Job, error)

NewJob creates a new job in the module

func (*Module) NewService

func (mod *Module) NewService(ctx context.Context, action *actionsv0.AddService) (*Service, error)

NewService creates a service in an module

func (*Module) Proto

func (mod *Module) Proto(_ context.Context) (*basev0.Module, error)

func (*Module) PublicEndpoints

func (mod *Module) PublicEndpoints(ctx context.Context) ([]*basev0.Endpoint, error)

func (*Module) Reference

func (mod *Module) Reference() *ModuleReference

func (*Module) Save

func (mod *Module) Save(ctx context.Context) error

func (*Module) SaveToDir

func (mod *Module) SaveToDir(ctx context.Context, dir string) error

func (*Module) ServicePath

func (mod *Module) ServicePath(_ context.Context, ref *ServiceReference) string

ServicePath returns the absolute path of an Service Cases for Reference.Dir nil: relative path to module with name rel: relative path /abs: absolute path

func (*Module) ServicesDir added in v0.1.155

func (mod *Module) ServicesDir() string

ServicesDir returns the services directory of the module

func (*Module) Unique

func (mod *Module) Unique() string

func (*Module) ValidateInterface added in v0.1.155

func (mod *Module) ValidateInterface(ctx context.Context) error

ValidateInterface checks that all interface endpoints reference valid services and endpoints with appropriate visibility (must be "module" or "public", not "private").

func (*Module) WithDir

func (mod *Module) WithDir(dir string)

type ModuleInterface added in v0.1.155

type ModuleInterface struct {
	Endpoints []*InterfaceEndpoint `yaml:"endpoints,omitempty"`
}

ModuleInterface declares the contract of a module: what it exposes to the outside world.

type ModuleReference

type ModuleReference struct {
	Name          string              `yaml:"name"`
	PathOverride  *string             `yaml:"path,omitempty"`
	Services      []*ServiceReference `yaml:"services,omitempty"`
	ActiveService string              `yaml:"active-service,omitempty"`
}

An ModuleReference

func (*ModuleReference) AddService

func (ref *ModuleReference) AddService(_ context.Context, service *ServiceReference) error

func (*ModuleReference) GetActive

func (ref *ModuleReference) GetActive(ctx context.Context) (*ServiceReference, error)

func (*ModuleReference) GetActiveService

func (ref *ModuleReference) GetActiveService(ctx context.Context) (*ServiceReference, error)

func (*ModuleReference) GetServiceFromName

func (ref *ModuleReference) GetServiceFromName(ctx context.Context, serviceName string) (*ServiceReference, error)

func (*ModuleReference) String

func (ref *ModuleReference) String() string

type ModuleWithCase added in v0.1.116

type ModuleWithCase struct {
	Name shared.Case
}

func ToModuleWithCase added in v0.1.116

func ToModuleWithCase(svc *ServiceIdentity) *ModuleWithCase

type ModulesLayout

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

func NewModulesLayout

func NewModulesLayout(ctx context.Context, root string, conf []byte) (*ModulesLayout, error)

func (ModulesLayout) ModulePath

func (f ModulesLayout) ModulePath(module string) string

func (ModulesLayout) ModulesRoot

func (f ModulesLayout) ModulesRoot() string

func (ModulesLayout) ServicePath

func (f ModulesLayout) ServicePath(module string, name string) string

func (ModulesLayout) ServicesRoot

func (f ModulesLayout) ServicesRoot(module string) string

type MustServiceUnique added in v0.1.127

type MustServiceUnique struct {
	*Service
}

func WithUnique added in v0.1.127

func WithUnique(s *Service) *MustServiceUnique

func (*MustServiceUnique) Unique added in v0.1.127

func (m *MustServiceUnique) Unique() string

type NetworkInstance

type NetworkInstance struct {
	Port     uint16
	Hostname string
	Host     string
	Address  string
}

func DefaultNetworkInstance

func DefaultNetworkInstance(api string) *NetworkInstance

func FindNetworkInstanceInEnvironmentVariables

func FindNetworkInstanceInEnvironmentVariables(ctx context.Context, endpointInfo *EndpointInformation, envs []string) (*NetworkInstance, error)

func ParseAddress

func ParseAddress(address string) (*NetworkInstance, error)

type NewModuleInput

type NewModuleInput struct {
	Name string
}

type NoModuleError

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

func (NoModuleError) Error

func (e NoModuleError) Error() string

type NonUniqueServiceNameError

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

func (NonUniqueServiceNameError) Error

type OpenAPICombinator

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

func NewOpenAPICombinator

func NewOpenAPICombinator(ctx context.Context, target *Endpoint, endpoints ...*basev0.Endpoint) (*OpenAPICombinator, error)

func (*OpenAPICombinator) Combine

func (c *OpenAPICombinator) Combine(ctx context.Context) (*basev0.RestAPI, error)

func (*OpenAPICombinator) LoadEndpoints

func (c *OpenAPICombinator) LoadEndpoints(ctx context.Context, endpoints ...*basev0.Endpoint) error

func (*OpenAPICombinator) Only

func (c *OpenAPICombinator) Only(unique string, path string, method string)

func (*OpenAPICombinator) WithDestination

func (c *OpenAPICombinator) WithDestination(filename string)

func (*OpenAPICombinator) WithVersion

func (c *OpenAPICombinator) WithVersion(version string)

type Organization

type Organization struct {
	// ID must be globally unique
	ID string `yaml:"id"`

	Name string `yaml:"name"`
}

func OrganizationFromProto

func OrganizationFromProto(_ context.Context, m *basev0.Organization) (*Organization, error)

func (*Organization) Proto

func (organization *Organization) Proto() *basev0.Organization

type Readme

type Readme struct {
	Content string
}

type RestRoute

type RestRoute struct {
	Path   string
	Method HTTPMethod
}

func RestRouteFromProto

func RestRouteFromProto(r *basev0.RestRoute) (*RestRoute, error)

func UnwrapRestRoute

func UnwrapRestRoute[T any](route *ExtendedRestRoute[T]) *RestRoute

func (*RestRoute) Proto

func (route *RestRoute) Proto() (*basev0.RestRoute, error)

type RestRouteAccess

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

func ExtractRestRoutes added in v0.1.95

func ExtractRestRoutes(ctx context.Context, mappings []*basev0.NetworkMapping, networkAccess *basev0.NetworkAccess, opts ...EnvironmentVariableOption) ([]*RestRouteAccess, error)

type RestRouteGroup

type RestRouteGroup struct {
	// HTTP Path
	Path string `yaml:"path"`
	// Routes for each HTTP Method
	Routes  []*RestRoute `yaml:"routes"`
	Module  string       `yaml:"-"`
	Service string       `yaml:"-"`
}

RestRouteGroup holds all the routes corresponding to the SAME path Each Route corresponds to a DIFFERENT HTTP method HTTP methods correspond to individual routes

func DetectNewRoutesFromEndpoints

func DetectNewRoutesFromEndpoints(ctx context.Context, endpoints []*basev0.Endpoint, known []*RestRouteGroup) ([]*RestRouteGroup, error)

func LoadRestRouteGroup

func LoadRestRouteGroup(ctx context.Context, p string) (*RestRouteGroup, error)

func UnwrapRestRouteGroup

func UnwrapRestRouteGroup[T any](group *ExtendedRestRouteGroup[T]) *RestRouteGroup

func (*RestRouteGroup) Delete

func (g *RestRouteGroup) Delete(ctx context.Context, dir string) error

Delete a route

func (*RestRouteGroup) Save

func (g *RestRouteGroup) Save(ctx context.Context, dir string) error

func (*RestRouteGroup) ServiceUnique

func (g *RestRouteGroup) ServiceUnique() string

type RestRouteLoader

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

RestRouteLoader will return all rest route groups in a directory

func NewRestRouteLoader

func NewRestRouteLoader(ctx context.Context, dir string) (*RestRouteLoader, error)

func (*RestRouteLoader) All

func (loader *RestRouteLoader) All() []*RestRoute

func (*RestRouteLoader) GroupFor

func (loader *RestRouteLoader) GroupFor(unique string, routePath string) *RestRouteGroup

func (*RestRouteLoader) Groups

func (loader *RestRouteLoader) Groups() []*RestRouteGroup

func (*RestRouteLoader) GroupsFor

func (loader *RestRouteLoader) GroupsFor(unique string) []*RestRouteGroup

func (*RestRouteLoader) Load

func (loader *RestRouteLoader) Load(ctx context.Context) error

type RouteUnique

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

func (RouteUnique) String

func (r RouteUnique) String() string

type RunningOptions

type RunningOptions struct {
	Quiet       bool `yaml:"quiet,omitempty"`
	Persistence bool `yaml:"persistence,omitempty"`
}

RunningOptions of the ServiceReference can tweak running behavior of service Note: this is not a part of the Service configuration but part of the Module running

type Service

type Service struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description,omitempty"`
	Version     string `yaml:"version"`

	PathOverride *string `yaml:"path,omitempty"`

	Agent *Agent `yaml:"agent"`

	// ServiceDependencies are the other services required
	ServiceDependencies []*ServiceDependency `yaml:"service-dependencies,omitempty"`

	// LibraryDependencies are the internal libraries required
	LibraryDependencies []*LibraryDependency `yaml:"library-dependencies,omitempty"`

	// Dependencies
	WorkspaceConfigurationDependencies []string `yaml:"workspace-configuration-dependencies,omitempty"`

	// Endpoints exposed by the service
	Endpoints []*Endpoint `yaml:"endpoints,omitempty"`

	// Spec is the specialized configuration of the service
	Spec map[string]any `yaml:"spec,omitempty"`
	// contains filtered or unexported fields
}

A Service

func LoadServiceFromCurrentPath added in v0.1.134

func LoadServiceFromCurrentPath(ctx context.Context) (*Service, error)

LoadServiceFromCurrentPath loads an service from a path

func LoadServiceFromDir

func LoadServiceFromDir(ctx context.Context, dir string) (*Service, error)

LoadServiceFromDir loads a service from a directory

func ReloadService

func ReloadService(ctx context.Context, service *Service) (*Service, error)

ReloadService from directory

func (*Service) AddDependency

func (s *Service) AddDependency(ctx context.Context, requirement *ServiceIdentity, requiredEndpoints []*Endpoint) error

AddDependency adds a dependency to the service

func (*Service) DeleteServiceDependencies

func (s *Service) DeleteServiceDependencies(ctx context.Context, ref *ServiceReference) error

func (*Service) Dir

func (s *Service) Dir() string

func (*Service) EndpointsFromNames

func (s *Service) EndpointsFromNames(endpoints []string) ([]*Endpoint, error)

EndpointsFromNames return matching endpoints

func (*Service) ExistsDependency

func (s *Service) ExistsDependency(requirement *ServiceIdentity) (*ServiceDependency, bool)

func (*Service) HasEndpoints

func (s *Service) HasEndpoints(_ context.Context, endpoints []string) ([]string, error)

func (*Service) Identity

func (s *Service) Identity() (*ServiceIdentity, error)

Identity is the proto version of Unique

func (*Service) LoadEndpoints

func (s *Service) LoadEndpoints(ctx context.Context) ([]*basev0.Endpoint, error)

func (*Service) LoadSettingsFromSpec

func (s *Service) LoadSettingsFromSpec(t any) error

func (*Service) Local

func (s *Service) Local(_ context.Context, f string) string

func (*Service) LocalOrNil

func (s *Service) LocalOrNil(ctx context.Context, f string) *string

func (*Service) MustUnique added in v0.1.127

func (s *Service) MustUnique() string

func (*Service) Proto

func (s *Service) Proto(_ context.Context) (*basev0.Service, error)

func (*Service) Reference

func (s *Service) Reference() *ServiceReference

func (*Service) Save

func (s *Service) Save(ctx context.Context) error

func (*Service) SaveAtDir

func (s *Service) SaveAtDir(ctx context.Context, dir string) error

func (*Service) UpdateSpecFromSettings

func (s *Service) UpdateSpecFromSettings(spec any) error

func (*Service) WithDir

func (s *Service) WithDir(dir string)

func (*Service) WithModule added in v0.1.127

func (s *Service) WithModule(mod string)

type ServiceDependency

type ServiceDependency struct {
	Name   string `yaml:"name,omitempty"`
	Module string `yaml:"module,omitempty"`

	Endpoints []*EndpointReference `yaml:"endpoints,omitempty"`
}

func (*ServiceDependency) AsReference

func (s *ServiceDependency) AsReference() *ServiceReference

func (*ServiceDependency) String

func (s *ServiceDependency) String() string

func (*ServiceDependency) Unique

func (s *ServiceDependency) Unique() string

func (*ServiceDependency) UpdateEndpoints

func (s *ServiceDependency) UpdateEndpoints(ctx context.Context, endpoints []*Endpoint) error

type ServiceIdentity

type ServiceIdentity struct {
	Name                string
	Version             string
	Module              string
	Workspace           string
	WorkspacePath       string
	RelativeToWorkspace string
}

ServiceIdentity defines exactly the scope of the service Name: the name of the service It will be unique within an module Module: the name of the module the service belongs to Recall that module names are unique within a workspace Workspace: the name of the workspace the service belongs to

func ServiceIdentityFromProto

func ServiceIdentityFromProto(proto *basev0.ServiceIdentity) *ServiceIdentity

func (*ServiceIdentity) AsAgentResource

func (s *ServiceIdentity) AsAgentResource() *wool.Resource

func (*ServiceIdentity) AsResource

func (s *ServiceIdentity) AsResource() *wool.Resource

func (*ServiceIdentity) BaseEndpoint added in v0.1.127

func (s *ServiceIdentity) BaseEndpoint(name string) *Endpoint

func (*ServiceIdentity) Clone

func (s *ServiceIdentity) Clone() *ServiceIdentity

func (*ServiceIdentity) Proto added in v0.1.144

func (*ServiceIdentity) Unique

func (s *ServiceIdentity) Unique() string

func (*ServiceIdentity) UniqueWithWorkspace added in v0.1.127

func (s *ServiceIdentity) UniqueWithWorkspace(workspace string) string

func (*ServiceIdentity) UniqueWithWorkspaceAndScope added in v0.1.127

func (s *ServiceIdentity) UniqueWithWorkspaceAndScope(workspace string, scope string) string

type ServiceReference

type ServiceReference struct {
	Name         string  `yaml:"name"`
	Module       string  `yaml:"module,omitempty"`
	PathOverride *string `yaml:"path,omitempty"`
}

ServiceReference is a reference to a service used by Module configuration

func ParseServiceReference

func ParseServiceReference(input string) (*ServiceReference, error)

func (*ServiceReference) String

func (ref *ServiceReference) String() string

type ServiceWithCase

type ServiceWithCase struct {
	Name   shared.Case
	Unique shared.Case
}

func ToServiceWithCase

func ToServiceWithCase(svc *ServiceIdentity) *ServiceWithCase

type ServiceWithModule

type ServiceWithModule struct {
	Name   string
	Module string
}

func ParseServiceWithOptionalModule

func ParseServiceWithOptionalModule(input string) (*ServiceWithModule, error)

func (ServiceWithModule) String

func (s ServiceWithModule) String() string

func (ServiceWithModule) Unique

func (s ServiceWithModule) Unique() string

type TCP

type TCP struct{}

func NewTCP

func NewTCP() (*TCP, error)

func (*TCP) Proto

func (*TCP) Proto() (*basev0.API, error)

type Visibility

type Visibility = string
const (
	// VisibilityExternal represents an endpoint that exists outside the system
	VisibilityExternal Visibility = "external"
	// VisibilityPublic represents a deployed endpoint that is accessible from outside the system
	VisibilityPublic Visibility = "public"
	// VisibilityModule represents an endpoint from other modules inside the system
	VisibilityModule Visibility = "module"
	// VisibilityPrivate represents an endpoint that is only accessible within the module
	VisibilityPrivate Visibility = "private"
)

type Workspace

type Workspace struct {
	Name string `yaml:"name"`

	Description string `yaml:"description,omitempty"`

	Layout string `yaml:"layout"`

	// Modules in the Workspace (used for non-flat layouts)
	Modules []*ModuleReference `yaml:"modules,omitempty"`

	// Services in flat layout (embedded directly, replaces module.codefly.yaml)
	Services []*ServiceReference `yaml:"services,omitempty"`

	// Jobs in flat layout (embedded directly, replaces module.codefly.yaml)
	Jobs []*JobReference `yaml:"jobs,omitempty"`

	Path string `yaml:"path,omitempty"`
	// contains filtered or unexported fields
}

func CreateWorkspace

func CreateWorkspace(ctx context.Context, action *actionsv0.NewWorkspace) (*Workspace, error)

CreateWorkspace creates a new Workspace

func FindWorkspaceUp

func FindWorkspaceUp(ctx context.Context) (*Workspace, error)

func LoadWorkspaceFromDir

func LoadWorkspaceFromDir(ctx context.Context, dir string) (*Workspace, error)

LoadWorkspaceFromDir loads a Workspace configuration from a directory

func NewWorkspace

func NewWorkspace(ctx context.Context, name string, layout string) (*Workspace, error)

func Reload

func Reload(ctx context.Context, workspace *Workspace) (*Workspace, error)

func (*Workspace) AddLibraryAsSubmodule added in v0.1.155

func (workspace *Workspace) AddLibraryAsSubmodule(ctx context.Context, name, remote, branch string) (*Library, error)

AddLibraryAsSubmodule adds an external library as a git submodule

func (*Workspace) AddModuleReference

func (workspace *Workspace) AddModuleReference(modRef *ModuleReference) error

AddModuleReference adds an module to the

func (*Workspace) Clone

func (workspace *Workspace) Clone() *Workspace

Clone returns a copy of the workspace

func (*Workspace) CreateLibrary added in v0.1.155

func (workspace *Workspace) CreateLibrary(ctx context.Context, name string, languages []string) (*Library, error)

CreateLibrary creates a new library in the workspace

func (*Workspace) DeleteModule

func (workspace *Workspace) DeleteModule(ctx context.Context, name string) error

DeleteModule deletes an module from the

func (*Workspace) DeleteServiceDependencies

func (workspace *Workspace) DeleteServiceDependencies(ctx context.Context, ref *ServiceReference) error

DeleteServiceDependencies deletes all service dependencies from a

func (*Workspace) Dir

func (workspace *Workspace) Dir() string

Dir is the directory of the

func (*Workspace) ExistsModule

func (workspace *Workspace) ExistsModule(name string) bool

ExistsModule returns true if the module exists in the

func (*Workspace) FindJobByName added in v0.1.155

func (workspace *Workspace) FindJobByName(ctx context.Context, name string) (*Job, error)

FindJobByName finds a job by name across all modules

func (*Workspace) FindUniqueModuleServiceByName added in v0.1.127

func (workspace *Workspace) FindUniqueModuleServiceByName(ctx context.Context, name string) (*Service, *Module, error)

FindUniqueModuleServiceByName finds a service by name returns ResourceNotFound error if not found

func (*Workspace) FindUniqueServiceAndModuleByName

func (workspace *Workspace) FindUniqueServiceAndModuleByName(ctx context.Context, name string) (*ServiceWithModule, error)

FindUniqueServiceAndModuleByName finds a service by name returns ResourceNotFound error if not found

func (*Workspace) FindUniqueServiceByName

func (workspace *Workspace) FindUniqueServiceByName(ctx context.Context, name string) (*Service, error)

FindUniqueServiceByName finds a service by name returns ResourceNotFound error if not found

func (*Workspace) LoadAllJobs added in v0.1.155

func (workspace *Workspace) LoadAllJobs(ctx context.Context) ([]*Job, error)

LoadAllJobs loads all jobs from all modules in the workspace

func (*Workspace) LoadJobFromUnique added in v0.1.155

func (workspace *Workspace) LoadJobFromUnique(ctx context.Context, unique string) (*Job, error)

LoadJobFromUnique loads a job by its unique identifier (module/job)

func (*Workspace) LoadLibraries added in v0.1.155

func (workspace *Workspace) LoadLibraries(ctx context.Context) ([]*Library, error)

LoadLibraries loads all libraries in the workspace

func (*Workspace) LoadLibraryFromName added in v0.1.155

func (workspace *Workspace) LoadLibraryFromName(ctx context.Context, name string) (*Library, error)

LoadLibraryFromName loads a library by name from a workspace

func (*Workspace) LoadModuleFromName

func (workspace *Workspace) LoadModuleFromName(ctx context.Context, name string) (*Module, error)

LoadModuleFromName loads an module from a name

func (*Workspace) LoadModuleFromReference

func (workspace *Workspace) LoadModuleFromReference(ctx context.Context, ref *ModuleReference) (*Module, error)

LoadModuleFromReference loads an module from a reference

func (*Workspace) LoadModules

func (workspace *Workspace) LoadModules(ctx context.Context) ([]*Module, error)

LoadModules returns the modules in the

func (*Workspace) LoadService

func (workspace *Workspace) LoadService(ctx context.Context, input *ServiceWithModule) (*Service, error)

LoadService loads a service from a reference

func (*Workspace) LoadServiceWithModules

func (workspace *Workspace) LoadServiceWithModules(ctx context.Context) ([]*ServiceWithModule, error)

func (*Workspace) LoadServices

func (workspace *Workspace) LoadServices(ctx context.Context) ([]*Service, error)

func (*Workspace) ModulePath

func (workspace *Workspace) ModulePath(ctx context.Context, ref *ModuleReference) string

ModulePath returns the absolute path of an module Cases for Reference.Dir nil: relative path to with name rel: relative path /abs: absolute path

func (*Workspace) ModulesNames

func (workspace *Workspace) ModulesNames() []string

ModulesNames returns the names of the modules in the

func (*Workspace) NewModule

func (workspace *Workspace) NewModule(ctx context.Context, action *actionsv0.NewModule) (*Module, error)

NewModule creates an module in a workspace

func (*Workspace) Proto

func (workspace *Workspace) Proto(_ context.Context) (*basev0.Workspace, error)

func (*Workspace) RelativeDir added in v0.1.109

func (workspace *Workspace) RelativeDir(service *Service) (string, error)

func (*Workspace) RootModule

func (workspace *Workspace) RootModule(ctx context.Context) (*Module, error)

RootModule only applies to Flat layout

func (*Workspace) Save

func (workspace *Workspace) Save(ctx context.Context) error

func (*Workspace) SaveToDirUnsafe

func (workspace *Workspace) SaveToDirUnsafe(ctx context.Context, dir string) error

func (*Workspace) SyncLibrarySubmodules added in v0.1.155

func (workspace *Workspace) SyncLibrarySubmodules(ctx context.Context) error

SyncLibrarySubmodules syncs all library submodules

func (*Workspace) Valid

func (workspace *Workspace) Valid() error

Valid checks if the workspace is valid

func (*Workspace) WithDir

func (workspace *Workspace) WithDir(dir string)

WithDir sets the directory of the workspace

func (*Workspace) WithRootModule

func (workspace *Workspace) WithRootModule(ctx context.Context) (*Module, error)

WithRootModule creates the module in Flat layout

type WrapperSwagger

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

Jump to

Keyboard shortcuts

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