Documentation
¶
Overview ¶
Package resources defines the codefly resource model — the typed hierarchy that every other package operates on.
The resource hierarchy is:
Workspace → Module → Service → Endpoint │ │ │ │ │ │ │ └── API kind (gRPC, REST, HTTP, TCP, …) │ │ └── Managed by an Agent │ └── Logical grouping of services └── Root (one per project)
Each level is backed by a YAML file (workspace.codefly.yaml, module.codefly.yaml, service.codefly.yaml) and validated against a proto schema (see core/generated/go/codefly/base/v0). Loaders in this package read the YAML, populate the Go struct, and verify the proto contract.
External consumers typically interact with this package via:
- LoadWorkspaceFromDir / FindWorkspaceUp — pick up the active workspace.
- Workspace.LoadModules / LoadServices — walk the hierarchy.
- Service.LoadEndpoints + FindGRPCEndpoint / FindHTTPEndpoint — endpoint discovery.
- Environment + Workspace.FindEnvironment — declared deploy targets.
All loader functions are read-only; they don't mutate the on-disk YAML. Mutators (CreateWorkspace, AddModuleReference, Save) are the explicit write path.
Index ¶
- Constants
- Variables
- func APIString(api *basev0.API) string
- func AgentBase(ctx context.Context) string
- func BuildCanonicalRegistry(toolboxes ...*Toolbox) (*policy.CanonicalRegistry, error)
- func CodeflyDir() string
- func CodeflyHomeDir() string
- func ConfigurationEnvironmentKeyPrefix(conf *basev0.Configuration) string
- func ConfigurationFile[C Configuration]() string
- func ConfigurationHash(conf *basev0.Configuration) string
- func ConfigurationInformationHash(info *basev0.ConfigurationInformation) string
- func ConfigurationInformationsHash(infos ...*basev0.ConfigurationInformation) (string, error)
- func ConfigurationValue(_ context.Context, confInfo *basev0.ConfigurationInformation, key string) (string, error)
- func ConfigurationsHash(confs ...*basev0.Configuration) string
- func ConvertHTTPMethodToProto(m HTTPMethod) (basev0.HTTPMethod, error)
- func ConvertSpec(spec map[string]any) (*basev0.Specs, error)
- func ConvertToAnyPb(value any) (*anypb.Any, error)
- func EndpointAsEnvironmentVariableKey(info *EndpointInformation) string
- func EndpointAsEnvironmentVariableKeyBase(info *EndpointInformation) string
- func EndpointDestination(e *basev0.Endpoint) string
- func EndpointHash(ctx context.Context, endpoints ...*basev0.Endpoint) (string, error)
- func EndpointRestAPI(endpoint *basev0.Endpoint) *basev0.RestAPI
- func EnvironmentVariableAsStrings(envs []*EnvironmentVariable) []string
- func ExistsAtDir[C Configuration](dir string) bool
- func ExtendDomain(domain string, extension string) string
- func ExtractConfiguration(configurations []*basev0.Configuration, runtimeContext *basev0.RuntimeContext) (*basev0.Configuration, error)
- func FilePathForGRPC(ctx context.Context, dir string, unique string, name string) (string, error)
- func FilePathForRest(ctx context.Context, dir string, unique string, routePath string) (string, error)
- func FilterConfigurationInformation(_ context.Context, name string, infos ...*basev0.ConfigurationInformation) (*basev0.ConfigurationInformation, error)
- func FilterConfigurations(configurations []*basev0.Configuration, runtimeContext *basev0.RuntimeContext) []*basev0.Configuration
- func FilterNetworkInstance(_ context.Context, instances []*basev0.NetworkInstance, ...) *basev0.NetworkInstance
- func FindConfigDir() (*string, error)
- func FindConfigurations(configurations []*basev0.Configuration, runtime *basev0.RuntimeContext) []*basev0.Configuration
- func FindConnectEndpoint(_ context.Context, endpoints []*basev0.Endpoint) (*basev0.Endpoint, error)
- func FindEndpointForGRPCRoute(ctx context.Context, endpoints []*basev0.Endpoint, route *GRPCRoute) *basev0.Endpoint
- func FindEndpointForRestRoute(ctx context.Context, endpoints []*basev0.Endpoint, route *RestRouteGroup) *basev0.Endpoint
- func FindGRPCEndpoint(ctx context.Context, endpoints []*basev0.Endpoint) (*basev0.Endpoint, error)
- func FindGRPCEndpointFromService(ctx context.Context, service *ServiceDependency, endpoints []*basev0.Endpoint) (*basev0.Endpoint, error)
- func FindHTTPEndpoint(ctx context.Context, endpoints []*basev0.Endpoint) (*basev0.Endpoint, error)
- func FindNetworkInstanceInNetworkMappings(ctx context.Context, mappings []*basev0.NetworkMapping, ...) (*basev0.NetworkInstance, error)
- func FindNetworkMapping(ctx context.Context, mappings []*basev0.NetworkMapping, ...) (*basev0.NetworkMapping, error)
- func FindRestEndpoint(ctx context.Context, endpoints []*basev0.Endpoint) (*basev0.Endpoint, error)
- func FindRestEndpointFromService(ctx context.Context, service *ServiceDependency, endpoints []*basev0.Endpoint) (*basev0.Endpoint, error)
- func FindServiceConfiguration(_ context.Context, confs []*basev0.Configuration, ...) (*basev0.Configuration, error)
- func FindTCPEndpoint(ctx context.Context, endpoints []*basev0.Endpoint) (*basev0.Endpoint, error)
- func FindTCPEndpointWithName(ctx context.Context, name string, endpoints []*basev0.Endpoint) (*basev0.Endpoint, error)
- func FindUp[C Configuration](ctx context.Context) (*string, error)
- func FindValueInEnvironmentVariables(ctx context.Context, key string, envs []string) (string, error)
- func FindWorkspaceConfiguration(_ context.Context, confs []*basev0.Configuration, name string) (*basev0.Configuration, error)
- func FromAnyPb[T any](v *anypb.Any) (*T, error)
- func GetConfigurationInformation(ctx context.Context, conf *basev0.Configuration, name string) (*basev0.ConfigurationInformation, error)
- func GetConfigurationValue(ctx context.Context, conf *basev0.Configuration, name string, key string) (string, error)
- func GroupKey(endpoint *basev0.Endpoint, group *basev0.RestRouteGroup) string
- func HasConfigurationInformation(_ context.Context, conf *basev0.Configuration, name string) bool
- func HasPublicEndpoints(endpoints []*basev0.Endpoint) bool
- func Hash(data []byte) string
- func HashString(s string) string
- func HomeDir() (string, error)
- func InPartialMode() bool
- func Init(ctx context.Context) (bool, error)
- func IsGRPC(_ context.Context, endpoint *basev0.Endpoint) *basev0.GrpcAPI
- func IsHTTP(_ context.Context, endpoint *basev0.Endpoint) *basev0.HttpAPI
- func IsLocal(environment *basev0.Environment) bool
- func IsRest(_ context.Context, endpoint *basev0.Endpoint) *basev0.RestAPI
- func IsTCP(_ context.Context, endpoint *basev0.Endpoint) *basev0.TcpAPI
- func Light(e *basev0.Endpoint) *basev0.Endpoint
- func LightAPI(api *basev0.API) *basev0.API
- func LoadFromBytes[C Configuration](content []byte) (*C, error)
- func LoadFromDir[C Configuration](ctx context.Context, dir string) (*C, error)
- func LoadFromFs[C Configuration](fs shared.FileSystem) (*C, error)
- func LoadFromPath[C Configuration](ctx context.Context, p string) (*C, error)
- func LoadGrpcAPI(_ context.Context, f *string) (*basev0.GrpcAPI, error)
- func LoadHTTPAPI(_ context.Context) (*basev0.HttpAPI, error)
- func LoadModuleAndServiceFromCurrentPath(ctx context.Context) (*Module, *Service, error)
- func LoadRestAPI(ctx context.Context, f *string) (*basev0.RestAPI, error)
- func LoadSpec(ctx context.Context, content []byte, obj any) error
- func LoadTCPAPI(_ context.Context) (*basev0.TcpAPI, error)
- func LocalizeNetworkMapping(mappings []*basev0.NetworkMapping, hostname string) []*basev0.NetworkMapping
- func MakeConfigurationInformationSummary(info *basev0.ConfigurationInformation) string
- func MakeConfigurationSummary(conf *basev0.Configuration) string
- func MakeConfigurationValueSummary(value *basev0.ConfigurationValue) string
- func MakeDNSSummary(dns *basev0.DNS) string
- func MakeEndpointAccessSummary(endpointAccess *EndpointAccess) string
- func MakeEndpointSummary(endpoint *basev0.Endpoint) string
- func MakeManyConfigurationSummary(confs []*basev0.Configuration) string
- func MakeManyDNSSummary(dns []*basev0.DNS) string
- func MakeManyEndpointAccessSummary(endpointAccesses []*EndpointAccess) string
- func MakeManyNetworkMappingSummary(mappings []*basev0.NetworkMapping) string
- func MakeManyServicesSummary(services []*ServiceIdentity) string
- func MakeNetworkInstanceSummary(instance *basev0.NetworkInstance) string
- func MakeNetworkMappingSummary(mapping *basev0.NetworkMapping) string
- func Match(s, other string) bool
- func Method(item spec.PathItem) string
- func ModuleMode() bool
- func NameToKey(name string) string
- func NetworkAccessFromRuntimeContext(runtimeContext *basev0.RuntimeContext) *basev0.NetworkAccess
- func NetworkInstanceSummary(value *basev0.NetworkInstance) string
- func NetworkMappingHash(networkMappings ...*basev0.NetworkMapping) string
- func NewAPI(_ context.Context, endpoint *Endpoint, api *basev0.API) (*basev0.Endpoint, error)
- func NewContainerNetworkAccess() *basev0.NetworkAccess
- func NewHTTPNetworkInstance(hostname string, port uint16, secured bool) *basev0.NetworkInstance
- func NewNativeNetworkAccess() *basev0.NetworkAccess
- func NewNetworkInstance(hostname string, port uint16) *basev0.NetworkInstance
- func NewPublicNetworkAccess() *basev0.NetworkAccess
- func NewRuntimeContext(runtimeContext string) (*basev0.RuntimeContext, error)
- func NewRuntimeContextContainer() *basev0.RuntimeContext
- func NewRuntimeContextFree() *basev0.RuntimeContext
- func NewRuntimeContextNative() *basev0.RuntimeContext
- func NewRuntimeContextNix() *basev0.RuntimeContext
- func OverridePath(defaultPath string, path string) *string
- func ParseOpenAPI(spec []byte) (*openapispec.Swagger, error)
- func Path[C Configuration](ctx context.Context, dir string) (string, error)
- func PortFromAddress(address string) (uint16, error)
- func ReferenceMatch(entry string, name string) bool
- func RegisterAgent(kind AgentKind, protoKind basev0.Agent_Kind)
- func RestRouteEnvironmentVariableKey(info *EndpointInformation, route *basev0.RestRoute) (string, error)
- func RestRoutes(rest *basev0.RestAPI) string
- func RouteKey(path string, method string) string
- func RuntimeContextFromEnv() *basev0.RuntimeContext
- func RuntimeContextFromInstance(instance *basev0.NetworkInstance) *basev0.RuntimeContext
- func RuntimeContexts() []string
- func SaveToDir[C Configuration](ctx context.Context, c *C, dir string) error
- func SerializeSpec(ctx context.Context, spec any) ([]byte, error)
- func ServiceConfigurationEnvironmentKeyPrefixFromUnique(unique string) string
- func ServiceConfigurationKey(service *ServiceIdentity, name string, key string) string
- func ServiceConfigurationKeyFromUnique(unique string, name string, key string) string
- func ServiceSecretConfigurationEnvironmentKeyPrefixFromUnique(unique string) string
- func ServiceSecretConfigurationKey(service *ServiceIdentity, name string, key string) string
- func ServiceSecretConfigurationKeyFromUnique(unique string, name string, key string) string
- func ServiceUnique(module string, service string) string
- func ServiceUniqueFromEndpoint(endpoint *basev0.Endpoint) string
- func SetMode(m Mode)
- func SplitPublicNetworkMappings(ctx context.Context, mappings []*basev0.NetworkMapping) ([]*basev0.NetworkMapping, []*basev0.NetworkMapping, error)
- func SplitUnique(unique string) (module, name string)
- func ToGrpcAPI(grpc *basev0.GrpcAPI) *basev0.API
- func ToHTTPAPI(http *basev0.HttpAPI) *basev0.API
- func ToOrganizationName(svc string) string
- func ToOrganizationSourceVersionControl(name string) string
- func ToRestAPI(rest *basev0.RestAPI) *basev0.API
- func ToTCPAPI(tcp *basev0.TcpAPI) *basev0.API
- func TypeName[C Configuration]() string
- func UniqueToKey(origin string) string
- func ValidOrganization(org *basev0.Organization) error
- func Validate(req proto.Message) error
- func ValidateAgent(agent *basev0.Agent) error
- func ValidateDomain()
- func ValidateRuntimeContext(rc string) error
- type Agent
- func (p *Agent) AsResource() *wool.Resource
- func (p *Agent) Identifier() string
- func (p *Agent) IsApplication() bool
- func (p *Agent) IsModule() bool
- func (p *Agent) IsService() bool
- func (p *Agent) IsToolbox() bool
- func (p *Agent) Key(kind AgentKind, unique string) string
- func (p *Agent) Of(kind AgentKind) *Agent
- func (p *Agent) Patch() (*Agent, error)
- func (p *Agent) Path(ctx context.Context) (string, error)
- func (p *Agent) Proto() *basev0.Agent
- func (p *Agent) String() string
- func (p *Agent) Unique() string
- type AgentKind
- type Application
- func (app *Application) AddApplicationDependency(name string, module string)
- func (app *Application) AddServiceDependency(name string, module string)
- func (app *Application) Dir() string
- func (app *Application) GetApplicationDependencies() []*ApplicationDependency
- func (app *Application) GetServiceDependencies() []*ServiceDependency
- func (app *Application) HasApplicationDependency(name string, module string) bool
- func (app *Application) HasServiceDependency(name string, module string) bool
- func (app *Application) Identity() (*ApplicationIdentity, error)
- func (app *Application) Local(p ...string) string
- func (app *Application) Module() string
- func (app *Application) Proto(_ context.Context) (*basev0.Application, error)
- func (app *Application) RemoveApplicationDependency(name string, module string)
- func (app *Application) RemoveServiceDependency(name string, module string)
- func (app *Application) ResolveAllApplicationDependencies(ctx context.Context, workspace *Workspace) ([]*Application, error)
- func (app *Application) ResolveApplicationDependency(ctx context.Context, dep *ApplicationDependency, workspace *Workspace) (*Application, error)
- func (app *Application) Save(ctx context.Context) error
- func (app *Application) SaveToDir(ctx context.Context, dir string) error
- func (app *Application) SetDir(dir string)
- func (app *Application) SetModule(module string)
- func (app *Application) Unique() string
- type ApplicationDependency
- type ApplicationIdentity
- type ApplicationReference
- type Artifact
- type ClientEntry
- type Configuration
- type DockerImage
- type Endpoint
- type EndpointAccess
- type EndpointInformation
- type EndpointReference
- type EndpointSummary
- type Environment
- type EnvironmentCluster
- type EnvironmentExistsError
- type EnvironmentReference
- type EnvironmentRegistry
- type EnvironmentVariable
- func ConfigurationAsEnvironmentVariables(conf *basev0.Configuration, secret bool) []*EnvironmentVariable
- func ConfigurationAsRawEnvironmentVariables(conf *basev0.Configuration) []*EnvironmentVariable
- func EndpointAsEnvironmentVariable(endpointAccess *EndpointAccess) *EnvironmentVariable
- func Env(key string, value any) *EnvironmentVariable
- func EnvironmentAsEnvironmentVariable(env *basev0.Environment) *EnvironmentVariable
- func FixtureAsEnvironmentVariable(fixture string) *EnvironmentVariable
- func ModuleAsEnvironmentVariable(module string) *EnvironmentVariable
- func ParseEnv(env string) *EnvironmentVariable
- func RestRoutesAsEnvironmentVariable(restRoute *RestRouteAccess) (*EnvironmentVariable, error)
- func RuntimeContextAsEnvironmentVariable(runtimeContext *basev0.RuntimeContext) *EnvironmentVariable
- func ServiceAsEnvironmentVariable(service string) *EnvironmentVariable
- func VersionAsEnvironmentVariable(version string) *EnvironmentVariable
- func WorkspaceAsEnvironmentVariable(workspace string) *EnvironmentVariable
- type EnvironmentVariableManager
- func (holder *EnvironmentVariableManager) AddConfigurations(_ context.Context, configurations ...*basev0.Configuration) error
- func (holder *EnvironmentVariableManager) AddEndpoints(ctx context.Context, mappings []*basev0.NetworkMapping, ...) error
- func (holder *EnvironmentVariableManager) AddEnvironmentVariable(ctx context.Context, key string, value string)
- func (holder *EnvironmentVariableManager) AddRawConfigurations(_ context.Context, configurations ...*basev0.Configuration) error
- func (holder *EnvironmentVariableManager) AddRestRoutes(ctx context.Context, mappings []*basev0.NetworkMapping, ...) error
- func (holder *EnvironmentVariableManager) All() ([]*EnvironmentVariable, error)
- func (holder *EnvironmentVariableManager) Configurations() ([]*EnvironmentVariable, error)
- func (holder *EnvironmentVariableManager) Endpoints() []*EndpointAccess
- func (holder *EnvironmentVariableManager) Secrets() []*EnvironmentVariable
- func (holder *EnvironmentVariableManager) SetEnvironment(environment *basev0.Environment)
- func (holder *EnvironmentVariableManager) SetFixture(fixture string)
- func (holder *EnvironmentVariableManager) SetIdentity(identity *basev0.ServiceIdentity)
- func (holder *EnvironmentVariableManager) SetRunning()
- func (holder *EnvironmentVariableManager) SetRuntimeContext(runtimeContext *basev0.RuntimeContext)
- type EnvironmentVariableOption
- type EnvironmentVariableOptions
- type ExtendedGRPCRoute
- type ExtendedGRPCRouteLoader
- type ExtendedRestRoute
- type ExtendedRestRouteGroup
- type ExtendedRouteLoader
- func (loader *ExtendedRouteLoader[T]) AddGroup(group *ExtendedRestRouteGroup[T])
- func (loader *ExtendedRouteLoader[T]) All() []*ExtendedRestRoute[T]
- func (loader *ExtendedRouteLoader[T]) GroupFor(unique string, routePath string) *ExtendedRestRouteGroup[T]
- func (loader *ExtendedRouteLoader[T]) Groups() []*ExtendedRestRouteGroup[T]
- func (loader *ExtendedRouteLoader[T]) GroupsFor(unique string) []*ExtendedRestRouteGroup[T]
- func (loader *ExtendedRouteLoader[T]) Load(ctx context.Context) error
- func (loader *ExtendedRouteLoader[T]) Save(ctx context.Context) error
- type FlatLayout
- type GRPCRoute
- func DetectNewGRPCRoutesFromEndpoints(ctx context.Context, endpoints []*basev0.Endpoint, known []*GRPCRoute) []*GRPCRoute
- func GRPCRouteFromProto(e *basev0.Endpoint, grpc *basev0.GrpcAPI, rpc *basev0.RPC) *GRPCRoute
- func LoadGRPCRoute(ctx context.Context, p string) (*GRPCRoute, error)
- func UnwrapGRPCRoute[T any](route *ExtendedGRPCRoute[T]) *GRPCRoute
- type GRPCRouteLoader
- type GitConfig
- type HTTPAPI
- type HTTPMethod
- type Hasher
- type InterfaceEndpoint
- type Job
- func (job *Job) Dir() string
- func (job *Job) Identity() *JobIdentity
- func (job *Job) IsOneShot() bool
- func (job *Job) IsScheduled() bool
- func (job *Job) IsTriggered() bool
- func (job *Job) Module() string
- func (job *Job) Proto(_ context.Context) map[string]any
- func (job *Job) Save(ctx context.Context) error
- func (job *Job) SaveToDir(ctx context.Context, dir string) error
- func (job *Job) SetModule(module string)
- func (job *Job) Unique() string
- func (job *Job) WithDir(dir string)
- type JobDependency
- type JobExecution
- type JobExecutionType
- type JobIdentity
- type JobReference
- type LanguageExport
- type Layout
- type LayoutKind
- type Library
- func (lib *Library) AddLanguage(ctx context.Context, name, agent, relPath string) error
- func (lib *Library) CreateGitTag(ctx context.Context) error
- func (lib *Library) Dir() string
- func (lib *Library) GetGitVersion(ctx context.Context) (string, error)
- func (lib *Library) GetLanguage(name string) *LanguageExport
- func (lib *Library) Identity() *LibraryIdentity
- func (lib *Library) IsGitSubmodule(ctx context.Context) bool
- func (lib *Library) LanguagePath(lang *LanguageExport) string
- func (lib *Library) Proto(_ context.Context) map[string]any
- func (lib *Library) Save(ctx context.Context) error
- func (lib *Library) SaveToDir(ctx context.Context, dir string) error
- func (lib *Library) Unique() string
- func (lib *Library) WithDir(dir string)
- type LibraryDependency
- type LibraryIdentity
- type LibraryMount
- type LibraryReference
- type LibraryResolver
- func (r *LibraryResolver) CleanupLocalDevelopment(ctx context.Context, svc *Service) error
- func (r *LibraryResolver) GetLibraryMounts(ctx context.Context, svc *Service) ([]LibraryMount, error)
- func (r *LibraryResolver) ResolveVersion(ctx context.Context, name, constraint string) (*Library, string, error)
- func (r *LibraryResolver) SetupLocalDevelopment(ctx context.Context, svc *Service) error
- type Mode
- type Module
- func (mod *Module) AddApplicationReference(_ context.Context, ref *ApplicationReference) error
- func (mod *Module) AddJobReference(ctx context.Context, ref *JobReference) error
- func (mod *Module) AddServiceReference(_ context.Context, ref *ServiceReference) error
- func (mod *Module) ApplicationPath(_ context.Context, ref *ApplicationReference) string
- func (mod *Module) ApplicationsDir() string
- func (mod *Module) DeleteApplication(ctx context.Context, name string) error
- func (mod *Module) DeleteService(ctx context.Context, name string) error
- func (mod *Module) DeleteServiceDependencies(ctx context.Context, ref *ServiceReference) error
- func (mod *Module) Dir() string
- func (mod *Module) ExistsApplication(ctx context.Context, name string) bool
- func (mod *Module) ExistsService(ctx context.Context, name string) bool
- func (mod *Module) ExposedEndpoints(ctx context.Context) ([]*basev0.Endpoint, error)
- func (mod *Module) GetServiceReferences(name string) (*ServiceReference, error)
- func (mod *Module) HasInterface() bool
- func (mod *Module) LoadApplicationFromName(ctx context.Context, name string) (*Application, error)
- func (mod *Module) LoadApplicationFromReference(ctx context.Context, ref *ApplicationReference) (*Application, error)
- func (mod *Module) LoadApplications(ctx context.Context) ([]*Application, error)
- func (mod *Module) LoadJobFromName(ctx context.Context, name string) (*Job, error)
- func (mod *Module) LoadJobFromReference(ctx context.Context, ref *JobReference) (*Job, error)
- func (mod *Module) LoadJobs(ctx context.Context) ([]*Job, error)
- func (mod *Module) LoadServiceFromName(ctx context.Context, name string) (*Service, error)
- func (mod *Module) LoadServiceFromReference(ctx context.Context, ref *ServiceReference) (*Service, error)
- func (mod *Module) LoadServices(ctx context.Context) ([]*Service, error)
- func (mod *Module) NewApplication(ctx context.Context, action *actionsv0.AddApplication) (*Application, error)
- func (mod *Module) NewJob(ctx context.Context, name string) (*Job, error)
- func (mod *Module) NewService(ctx context.Context, action *actionsv0.AddService) (*Service, error)
- func (mod *Module) Proto(_ context.Context) (*basev0.Module, error)
- func (mod *Module) PublicEndpoints(ctx context.Context) ([]*basev0.Endpoint, error)
- func (mod *Module) Reference() *ModuleReference
- func (mod *Module) Save(ctx context.Context) error
- func (mod *Module) SaveToDir(ctx context.Context, dir string) error
- func (mod *Module) ServicePath(_ context.Context, ref *ServiceReference) string
- func (mod *Module) ServicesDir() string
- func (mod *Module) Unique() string
- func (mod *Module) ValidateInterface(ctx context.Context) error
- func (mod *Module) WithDir(dir string)
- type ModuleInterface
- type ModuleReference
- func (ref *ModuleReference) AddService(_ context.Context, service *ServiceReference) error
- func (ref *ModuleReference) GetActive(ctx context.Context) (*ServiceReference, error)
- func (ref *ModuleReference) GetActiveService(ctx context.Context) (*ServiceReference, error)
- func (ref *ModuleReference) GetServiceFromName(ctx context.Context, serviceName string) (*ServiceReference, error)
- func (ref *ModuleReference) String() string
- type ModuleWithCase
- type ModulesLayout
- type MustServiceUnique
- type NetworkInstance
- type NewModuleInput
- type NoModuleError
- type NonUniqueServiceNameError
- type OpenAPICombinator
- func (c *OpenAPICombinator) Combine(ctx context.Context) (*basev0.RestAPI, error)
- func (c *OpenAPICombinator) LoadEndpoints(ctx context.Context, endpoints ...*basev0.Endpoint) error
- func (c *OpenAPICombinator) Only(unique string, path string, method string)
- func (c *OpenAPICombinator) WithDestination(filename string)
- func (c *OpenAPICombinator) WithVersion(version string)
- type Organization
- type Readme
- type RestRoute
- type RestRouteAccess
- type RestRouteGroup
- type RestRouteLoader
- func (loader *RestRouteLoader) All() []*RestRoute
- func (loader *RestRouteLoader) GroupFor(unique string, routePath string) *RestRouteGroup
- func (loader *RestRouteLoader) Groups() []*RestRouteGroup
- func (loader *RestRouteLoader) GroupsFor(unique string) []*RestRouteGroup
- func (loader *RestRouteLoader) Load(ctx context.Context) error
- type RouteUnique
- type RunningOptions
- type Service
- func (s *Service) AddDependency(ctx context.Context, requirement *ServiceIdentity, ...) error
- func (s *Service) DeleteServiceDependencies(ctx context.Context, ref *ServiceReference) error
- func (s *Service) Dir() string
- func (s *Service) EndpointsFromNames(endpoints []string) ([]*Endpoint, error)
- func (s *Service) ExistsDependency(requirement *ServiceIdentity) (*ServiceDependency, bool)
- func (s *Service) HasEndpoints(_ context.Context, endpoints []string) ([]string, error)
- func (s *Service) Identity() (*ServiceIdentity, error)
- func (s *Service) LoadEndpoints(ctx context.Context) ([]*basev0.Endpoint, error)
- func (s *Service) LoadSettingsFromSpec(t any) error
- func (s *Service) Local(_ context.Context, f string) string
- func (s *Service) LocalOrNil(ctx context.Context, f string) *string
- func (s *Service) MustUnique() string
- func (s *Service) Proto(_ context.Context) (*basev0.Service, error)
- func (s *Service) Reference() *ServiceReference
- func (s *Service) Save(ctx context.Context) error
- func (s *Service) SaveAtDir(ctx context.Context, dir string) error
- func (s *Service) UpdateSpecFromSettings(spec any) error
- func (s *Service) WithDir(dir string)
- func (s *Service) WithModule(mod string)
- type ServiceDependency
- type ServiceIdentity
- func (s *ServiceIdentity) AsAgentResource() *wool.Resource
- func (s *ServiceIdentity) AsResource() *wool.Resource
- func (s *ServiceIdentity) BaseEndpoint(name string) *Endpoint
- func (s *ServiceIdentity) Clone() *ServiceIdentity
- func (s *ServiceIdentity) Proto() (*basev0.ServiceIdentity, error)
- func (s *ServiceIdentity) Unique() string
- func (s *ServiceIdentity) UniqueWithWorkspace(workspace string) string
- func (s *ServiceIdentity) UniqueWithWorkspaceAndScope(workspace string, scope string) string
- type ServiceReference
- type ServiceWithCase
- type ServiceWithModule
- type TCP
- type Toolbox
- type Visibility
- type Workspace
- func CreateWorkspace(ctx context.Context, action *actionsv0.NewWorkspace) (*Workspace, error)
- func FindWorkspaceUp(ctx context.Context) (*Workspace, error)
- func LoadWorkspaceFromDir(ctx context.Context, dir string) (*Workspace, error)
- func NewWorkspace(ctx context.Context, name string, layout string) (*Workspace, error)
- func Reload(ctx context.Context, workspace *Workspace) (*Workspace, error)
- func (workspace *Workspace) AddLibraryAsSubmodule(ctx context.Context, name, remote, branch string) (*Library, error)
- func (workspace *Workspace) AddModuleReference(modRef *ModuleReference) error
- func (workspace *Workspace) Clone() *Workspace
- func (workspace *Workspace) CreateLibrary(ctx context.Context, name string, languages []string) (*Library, error)
- func (workspace *Workspace) DeleteModule(ctx context.Context, name string) error
- func (workspace *Workspace) DeleteServiceDependencies(ctx context.Context, ref *ServiceReference) error
- func (workspace *Workspace) Dir() string
- func (workspace *Workspace) ExistsModule(name string) bool
- func (workspace *Workspace) FindEnvironment(name string) *Environment
- func (workspace *Workspace) FindJobByName(ctx context.Context, name string) (*Job, error)
- func (workspace *Workspace) FindUniqueModuleServiceByName(ctx context.Context, name string) (*Service, *Module, error)
- func (workspace *Workspace) FindUniqueServiceAndModuleByName(ctx context.Context, name string) (*ServiceWithModule, error)
- func (workspace *Workspace) FindUniqueServiceByName(ctx context.Context, name string) (*Service, error)
- func (workspace *Workspace) LoadAllJobs(ctx context.Context) ([]*Job, error)
- func (workspace *Workspace) LoadJobFromUnique(ctx context.Context, unique string) (*Job, error)
- func (workspace *Workspace) LoadLibraries(ctx context.Context) ([]*Library, error)
- func (workspace *Workspace) LoadLibraryFromName(ctx context.Context, name string) (*Library, error)
- func (workspace *Workspace) LoadModuleFromName(ctx context.Context, name string) (*Module, error)
- func (workspace *Workspace) LoadModuleFromReference(ctx context.Context, ref *ModuleReference) (*Module, error)
- func (workspace *Workspace) LoadModules(ctx context.Context) ([]*Module, error)
- func (workspace *Workspace) LoadService(ctx context.Context, input *ServiceWithModule) (*Service, error)
- func (workspace *Workspace) LoadServiceWithModules(ctx context.Context) ([]*ServiceWithModule, error)
- func (workspace *Workspace) LoadServices(ctx context.Context) ([]*Service, error)
- func (workspace *Workspace) ModulePath(ctx context.Context, ref *ModuleReference) string
- func (workspace *Workspace) ModulesNames() []string
- func (workspace *Workspace) NewModule(ctx context.Context, action *actionsv0.NewModule) (*Module, error)
- func (workspace *Workspace) Proto(_ context.Context) (*basev0.Workspace, error)
- func (workspace *Workspace) RelativeDir(service *Service) (string, error)
- func (workspace *Workspace) RootModule(ctx context.Context) (*Module, error)
- func (workspace *Workspace) Save(ctx context.Context) error
- func (workspace *Workspace) SaveToDirUnsafe(ctx context.Context, dir string) error
- func (workspace *Workspace) SyncLibrarySubmodules(ctx context.Context) error
- func (workspace *Workspace) Valid() error
- func (workspace *Workspace) WithDir(dir string)
- func (workspace *Workspace) WithRootModule(ctx context.Context) (*Module, error)
- type WorkspaceGitops
- type WrapperSwagger
Constants ¶
const ( ModuleKind = "module" ModuleConfigurationName = "module.codefly.yaml" )
const ( RuntimeContextNative = "native" RuntimeContextNix = "nix" RuntimeContextContainer = "container" RuntimeContextFree = "free" NetworkAccessContainer = "container" NetworkAccessNative = "native" NetworkAccessPublic = "public" )
const ( AGENT = "agent" WORKSPACE = "workspace" MODULE = "module" SERVICE = "service" ENDPOINT = "endpoint" )
const AgentConfigurationName = "agent.codefly.yaml"
const ApplicationAgent = AgentKind("codefly:application")
ApplicationAgent is the agent kind for applications
const ApplicationConfigurationName = "application.codefly.yaml"
const BuilderServiceAgent = "codefly:service:builder"
const CodeServiceAgent = "codefly:service:code"
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.
const ConfigurationWorkspace = "_workspace_origin"
const EndpointPrefix = "CODEFLY__ENDPOINT"
const EnvironmentPrefix = "CODEFLY__ENVIRONMENT"
const FixturePrefix = "CODEFLY__FIXTURE"
const GRPCRouteFileSuffix = ".grpc.codefly.yaml"
const JobAgent = AgentKind("codefly:job")
JobAgent is the agent kind for jobs
const JobConfigurationName = "job.codefly.yaml"
const LibraryConfigurationName = "library.codefly.yaml"
const ModuleAgent = AgentKind("codefly:module")
ModuleAgent is the agent kind for module templates
const ModulePrefix = "CODEFLY__MODULE"
const RestRouteFileSuffix = ".rest.codefly.yaml"
const RestRoutePrefix = "CODEFLY__REST_ROUTE"
const RunningPrefix = "CODEFLY__RUNNING"
const RuntimeContextPrefix = "CODEFLY__RUNTIME_CONTEXT"
const RuntimeServiceAgent = "codefly:service:runtime"
const ServiceAgent = AgentKind("codefly:service")
const ServiceConfigurationName = "service.codefly.yaml"
const ServiceConfigurationPrefix = "CODEFLY__SERVICE_CONFIGURATION"
const ServicePrefix = "CODEFLY__SERVICE"
const ServiceSecretConfigurationPrefix = "CODEFLY__SERVICE_SECRET_CONFIGURATION"
const ToolboxAgent = AgentKind("codefly:toolbox")
ToolboxAgent is the AgentKind tag for toolbox plugins.
const ToolboxConfigurationName = "toolbox.codefly.yaml"
ToolboxConfigurationName is the manifest filename a toolbox plugin's directory must contain. Mirrors service.codefly.yaml / module.codefly.yaml / agent.codefly.yaml.
const VersionPrefix = "CODEFLY__SERVICE_VERSION"
const WorkspaceConfigurationName = "workspace.codefly.yaml"
const WorkspaceConfigurationPrefix = "CODEFLY__WORKSPACE_CONFIGURATION"
const WorkspacePrefix = "CODEFLY__WORKSPACE"
const WorkspaceSecretConfigurationPrefix = "CODEFLY__WORKSPACE_SECRET_CONFIGURATION"
#nosec G101
Variables ¶
var ErrUnknownHTTPMethod = fmt.Errorf("unknown HTTP method")
ErrUnknownHTTPMethod is returned when an HTTP method cannot be converted
Functions ¶
func BuildCanonicalRegistry ¶ added in v0.1.157
func BuildCanonicalRegistry(toolboxes ...*Toolbox) (*policy.CanonicalRegistry, error)
BuildCanonicalRegistry composes a registry from a set of loaded toolbox manifests. The conventional entry point at workspace-load time: load every plugin under agents/toolboxes/ and pass them in; the result is a frozen registry the runtime consults on every bash invocation.
The order plugins are passed in matters for collision diagnostics only — the second-claimer's error names the first as the existing owner, so reproducible loading produces reproducible error messages.
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:
- $CODEFLY_HOME env var (set by --plugin-path or manually)
- ~/.codefly (user home)
- 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 EndpointAsEnvironmentVariableKey ¶
func EndpointAsEnvironmentVariableKey(info *EndpointInformation) string
func EndpointAsEnvironmentVariableKeyBase ¶
func EndpointAsEnvironmentVariableKeyBase(info *EndpointInformation) string
func EndpointDestination ¶
func EndpointHash ¶
func EnvironmentVariableAsStrings ¶
func EnvironmentVariableAsStrings(envs []*EnvironmentVariable) []string
func ExistsAtDir ¶
func ExistsAtDir[C Configuration](dir string) bool
func ExtendDomain ¶
func ExtractConfiguration ¶
func ExtractConfiguration(configurations []*basev0.Configuration, runtimeContext *basev0.RuntimeContext) (*basev0.Configuration, error)
func FilePathForGRPC ¶
func FilePathForRest ¶
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 FindConfigurations ¶
func FindConfigurations(configurations []*basev0.Configuration, runtime *basev0.RuntimeContext) []*basev0.Configuration
func FindConnectEndpoint ¶ added in v0.1.155
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 FindGRPCEndpointFromService ¶ added in v0.1.121
func FindHTTPEndpoint ¶
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 FindRestEndpointFromService ¶ added in v0.1.155
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 FindTCPEndpointWithName ¶
func FindUp ¶
func FindUp[C Configuration](ctx context.Context) (*string, error)
FindUp looks for a configuration in the active directory and up
func FindWorkspaceConfiguration ¶ added in v0.1.123
func FindWorkspaceConfiguration(_ context.Context, confs []*basev0.Configuration, name string) (*basev0.Configuration, 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 HasPublicEndpoints ¶
func HashString ¶
func InPartialMode ¶
func InPartialMode() bool
func IsLocal ¶
func IsLocal(environment *basev0.Environment) bool
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 LoadModuleAndServiceFromCurrentPath ¶ added in v0.1.128
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 MakeEndpointAccessSummary ¶ added in v0.1.93
func MakeEndpointAccessSummary(endpointAccess *EndpointAccess) string
func MakeEndpointSummary ¶
func MakeManyConfigurationSummary ¶
func MakeManyConfigurationSummary(confs []*basev0.Configuration) string
func MakeManyDNSSummary ¶
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 ModuleMode ¶
func ModuleMode() bool
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 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 ¶
OverridePath is nil if the name is the same as the desired relative path
func ParseOpenAPI ¶
func ParseOpenAPI(spec []byte) (*openapispec.Swagger, error)
func PortFromAddress ¶
func ReferenceMatch ¶
func RegisterAgent ¶
func RegisterAgent(kind AgentKind, protoKind basev0.Agent_Kind)
func RestRouteEnvironmentVariableKey ¶
func RestRouteEnvironmentVariableKey(info *EndpointInformation, route *basev0.RestRoute) (string, error)
func RestRoutes ¶
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 ServiceConfigurationKey ¶
func ServiceConfigurationKey(service *ServiceIdentity, name string, key string) string
func ServiceSecretConfigurationKey ¶
func ServiceSecretConfigurationKey(service *ServiceIdentity, name string, key string) string
func ServiceUnique ¶
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
SplitUnique splits a unique identifier (module/name) into module and name parts
func ToOrganizationName ¶
func TypeName ¶
func TypeName[C Configuration]() string
func UniqueToKey ¶
func ValidOrganization ¶
func ValidOrganization(org *basev0.Organization) error
func ValidateAgent ¶
func ValidateDomain ¶
func ValidateDomain()
func ValidateRuntimeContext ¶ added in v0.1.109
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 (*Agent) AsResource ¶
func (*Agent) Identifier ¶
func (*Agent) IsApplication ¶ added in v0.1.155
func (*Agent) IsToolbox ¶ added in v0.1.157
IsToolbox reports whether this agent is a toolbox plugin (canonical owner of one or more binaries; runs as a host-spawned gRPC server with the codefly.services.toolbox.v0.Toolbox contract). Toolboxes resolve under <home>/agents/toolboxes/<identifier>, alongside services/, applications/, and modules/.
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
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 ¶
func (*ClientEntry) Validate ¶
func (c *ClientEntry) Validate() error
type Configuration ¶
type Configuration interface{}
type DockerImage ¶
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 (*Endpoint) AsReference ¶
func (endpoint *Endpoint) AsReference() *EndpointReference
func (*Endpoint) Information ¶
func (endpoint *Endpoint) Information() *EndpointInformation
func (*Endpoint) ServiceUnique ¶
type EndpointAccess ¶
type EndpointAccess struct {
Endpoint *basev0.Endpoint
NetworkInstance *basev0.NetworkInstance
// contains filtered or unexported fields
}
type EndpointInformation ¶
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 ¶
An EndpointReference
func (*EndpointReference) GetAPI ¶ added in v0.1.123
func (e *EndpointReference) GetAPI() string
type EndpointSummary ¶
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"`
// Deploy-target overrides (CLI-side; not serialized to proto).
// Empty values fall back to legacy defaults (local k3d, ~/.kube/config,
// the default namespace, the --org flag's hardcoded registry) so
// existing workspace YAMLs keep working unchanged.
Cluster *EnvironmentCluster `yaml:"cluster,omitempty"`
Registry *EnvironmentRegistry `yaml:"registry,omitempty"`
Namespace string `yaml:"namespace,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) IsK3d ¶ added in v0.1.157
func (env *Environment) IsK3d() bool
IsK3d reports whether the environment targets a k3d cluster. Used to decide whether to import freshly-built images into the cluster (k3d-only — EKS/GKE pull from a registry instead).
func (*Environment) Local ¶
func (env *Environment) Local() bool
func (*Environment) Proto ¶
func (env *Environment) Proto() (*basev0.Environment, error)
type EnvironmentCluster ¶ added in v0.1.157
type EnvironmentCluster struct {
Kind string `yaml:"kind,omitempty"`
Kubeconfig string `yaml:"kubeconfig,omitempty"`
Context string `yaml:"context,omitempty"`
}
EnvironmentCluster declares which Kubernetes cluster an environment targets. Lets `codefly deploy --env <name>` route kubectl to the right kubeconfig instead of string-matching env names in CLI source.
Kind: cluster category — "k3d", "kind", "minikube", "eks", "gke", "aks",
or "external". Drives behavior decisions (image-import for k3d
is a no-op on EKS, ECR auth only matters on EKS, etc.).
Kubeconfig: path to the kubeconfig file. Tilde expansion is supported.
If empty, defaults to $KUBECONFIG or ~/.kube/config.
Context: optional kubectl context within the kubeconfig.
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 EnvironmentRegistry ¶ added in v0.1.157
type EnvironmentRegistry struct {
URL string `yaml:"url,omitempty"`
Auth string `yaml:"auth,omitempty"`
}
EnvironmentRegistry declares the container image registry an environment pushes to. Was previously a CLI `--org` flag with a hardcoded ECR URL.
URL: registry base — "localhost:5001", "ghcr.io/myorg",
"621829027644.dkr.ecr.us-east-1.amazonaws.com/myrepo".
Auth: how to authenticate before push — "" (anonymous / docker-creds),
"ecr" (run `aws ecr get-login-password`), "gcr" / "gar" (gcloud
access token), "ghcr" (GITHUB_TOKEN env). The CLI handles auth
side-effects based on this value.
type EnvironmentVariable ¶
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 (holder *EnvironmentVariableManager) All() ([]*EnvironmentVariable, error)
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 ¶
func LoadExtendedGRPCRoute ¶
type ExtendedGRPCRouteLoader ¶
type ExtendedGRPCRouteLoader[T any] struct { // contains filtered or unexported fields }
ExtendedGRPCRouteLoader will return all GRPC route groups in a directory
func (*ExtendedGRPCRouteLoader[T]) Add ¶
func (loader *ExtendedGRPCRouteLoader[T]) Add(route *ExtendedGRPCRoute[T])
func (*ExtendedGRPCRouteLoader[T]) All ¶
func (loader *ExtendedGRPCRouteLoader[T]) All() []*ExtendedGRPCRoute[T]
type ExtendedRestRoute ¶
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 (*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 (*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]
type FlatLayout ¶
type FlatLayout struct {
// contains filtered or unexported fields
}
func NewFlatLayout ¶
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 GRPCRouteFromProto ¶
func UnwrapGRPCRoute ¶
func UnwrapGRPCRoute[T any](route *ExtendedGRPCRoute[T]) *GRPCRoute
func (*GRPCRoute) ServiceUnique ¶
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
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 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 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
LoadJobFromDir loads a job from a directory
func (*Job) Identity ¶ added in v0.1.155
func (job *Job) Identity() *JobIdentity
Identity returns the job identity
func (*Job) IsScheduled ¶ added in v0.1.155
IsScheduled returns true if the job is scheduled
func (*Job) IsTriggered ¶ added in v0.1.155
IsTriggered returns true if the job is triggered
type JobDependency ¶ added in v0.1.155
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
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 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
LoadLibraryFromDir loads a library from a directory
func NewLibrary ¶ added in v0.1.155
NewLibrary creates a new Library
func (*Library) AddLanguage ¶ added in v0.1.155
AddLanguage adds a language export to the library
func (*Library) CreateGitTag ¶ added in v0.1.155
CreateGitTag creates a git tag for the current version
func (*Library) GetGitVersion ¶ added in v0.1.155
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
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
Proto converts to a map representation (proto will be generated later)
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
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 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
LoadModuleFromCurrentPath loads an module from a path
func LoadModuleFromDir ¶ added in v0.1.128
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
ApplicationsDir returns the applications directory of the module
func (*Module) DeleteApplication ¶ added in v0.1.155
DeleteApplication deletes an application from a module
func (*Module) DeleteService ¶
DeleteService deletes a service from an module
func (*Module) DeleteServiceDependencies ¶
func (mod *Module) DeleteServiceDependencies(ctx context.Context, ref *ServiceReference) error
func (*Module) ExistsApplication ¶ added in v0.1.155
ExistsApplication returns true if the application exists in the module
func (*Module) ExistsService ¶
ExistsService returns true if the service exists in the module
func (*Module) ExposedEndpoints ¶ added in v0.1.155
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
HasInterface returns true if the module has a declared interface
func (*Module) LoadApplicationFromName ¶ added in v0.1.155
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
LoadJobFromName loads a job by name from a module
func (*Module) LoadJobFromReference ¶ added in v0.1.155
LoadJobFromReference loads a job from a reference
func (*Module) LoadServiceFromName ¶
LoadServiceFromName loads a service from a module returns ResourceNotFound error if not found
func (*Module) LoadServiceFromReference ¶
func (*Module) LoadServices ¶
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) NewService ¶
NewService creates a service in an module
func (*Module) PublicEndpoints ¶
func (*Module) Reference ¶
func (mod *Module) Reference() *ModuleReference
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
ServicesDir returns the services directory of the module
func (*Module) ValidateInterface ¶ added in v0.1.155
ValidateInterface checks that all interface endpoints reference valid services and endpoints with appropriate visibility (must be "module" or "public", not "private").
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
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 (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 ¶
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 ¶
func (n NonUniqueServiceNameError) Error() string
type OpenAPICombinator ¶
type OpenAPICombinator struct {
// contains filtered or unexported fields
}
func NewOpenAPICombinator ¶
func (*OpenAPICombinator) LoadEndpoints ¶
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 RestRoute ¶
type RestRoute struct {
Path string
Method HTTPMethod
}
func UnwrapRestRoute ¶
func UnwrapRestRoute[T any](route *ExtendedRestRoute[T]) *RestRoute
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) 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
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
LoadServiceFromCurrentPath loads an service from a path
func LoadServiceFromDir ¶
LoadServiceFromDir loads a service from a directory
func ReloadService ¶
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) EndpointsFromNames ¶
EndpointsFromNames return matching endpoints
func (*Service) ExistsDependency ¶
func (s *Service) ExistsDependency(requirement *ServiceIdentity) (*ServiceDependency, bool)
func (*Service) HasEndpoints ¶
func (*Service) Identity ¶
func (s *Service) Identity() (*ServiceIdentity, error)
Identity is the proto version of Unique
func (*Service) LoadEndpoints ¶
func (*Service) LoadSettingsFromSpec ¶
func (*Service) MustUnique ¶ added in v0.1.127
func (*Service) Reference ¶
func (s *Service) Reference() *ServiceReference
func (*Service) UpdateSpecFromSettings ¶
func (*Service) WithModule ¶ added in v0.1.127
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 (s *ServiceIdentity) Proto() (*basev0.ServiceIdentity, error)
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 ¶
func ToServiceWithCase ¶
func ToServiceWithCase(svc *ServiceIdentity) *ServiceWithCase
type ServiceWithModule ¶
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 Toolbox ¶ added in v0.1.157
type Toolbox struct {
Name string `yaml:"name"`
Description string `yaml:"description,omitempty"`
Version string `yaml:"version"`
Agent *Agent `yaml:"agent"`
// Sandbox declares the OS-level confinement this toolbox's
// processes run under. Translated to a sandbox.Sandbox at
// runtime via policy.SandboxPolicy.Apply. Empty/missing block
// means "deny network, no writes outside cwd" defaults — secure
// by default.
Sandbox policy.SandboxPolicy `yaml:"sandbox,omitempty"`
// CanonicalFor lists binaries this toolbox claims as the canonical
// owner. Bash toolbox + policy.CanonicalRegistry consult this list
// at registry-build time; any agent's bash that tries to invoke one
// of these binaries is refused with a hint pointing here.
//
// Conflicts (two plugins claiming the same binary) are load-time
// errors, surfaced when the registry is built.
CanonicalFor []string `yaml:"canonical_for,omitempty"`
// Spec is the toolbox-specific configuration. Mirrors Service.Spec.
Spec map[string]any `yaml:"spec,omitempty"`
// contains filtered or unexported fields
}
Toolbox is a narrow, capability-focused plugin.
Toolboxes (Code, Git, Docker, Nix, Bash, Web, gRPC) are codefly's vocabulary for cross-cutting operations that agents need to perform. Each one is its own permission boundary: the Git toolbox declares `canonical_for: [git]` and from that moment no agent's bash can invoke `git` directly — they MUST call the typed RPCs.
Distinct from Service:
- Service plugins ship user-deployable processes (the API, the auth-sidecar, the postgres instance, etc.).
- Toolboxes are platform utilities. They run as codefly-internal gRPC servers exposing MCP-shape Tool/Resource/Prompt primitives.
Manifest example (Git toolbox):
# toolbox.codefly.yaml
name: git
version: 0.0.1
description: Git repository operations as typed RPCs.
agent:
kind: codefly:toolbox
name: git
publisher: codefly.dev
version: 0.0.1
sandbox:
read_paths: ["${WORKSPACE}"]
write_paths: ["${WORKSPACE}"]
network: deny
canonical_for: [git]
func LoadToolboxFromDir ¶ added in v0.1.157
LoadToolboxFromDir reads a Toolbox manifest from `<dir>/toolbox.codefly.yaml`. Returns a useful error when the file is missing — toolboxes are expected to ship the manifest at the root of their plugin directory.
func (*Toolbox) Dir ¶ added in v0.1.157
Dir returns the directory the toolbox manifest was loaded from. Returns "" if the toolbox was constructed in-memory (e.g. tests).
func (*Toolbox) Identity ¶ added in v0.1.157
Identity is the (name, version) pair used for log lines and registry diagnostics. Format mirrors Service.Identity for grep uniformity.
func (*Toolbox) RegisterCanonical ¶ added in v0.1.157
func (t *Toolbox) RegisterCanonical(reg *policy.CanonicalRegistry) error
RegisterCanonical contributes this toolbox's CanonicalFor binaries to the given registry, with this toolbox's Name as the owner.
Returns the same error as policy.CanonicalRegistry.Claim — most notably, a load-time conflict when two plugins both claim the same binary. That conflict surfaces here, BEFORE any agent invocation, which is exactly when an operator can fix it (drop one of the plugins, or rename a manifest).
No-op when CanonicalFor is empty.
func (*Toolbox) Validate ¶ added in v0.1.157
Validate enforces the invariants the rest of the pipeline depends on. Surfaced at load time so a malformed toolbox doesn't fail halfway through registration.
Semantic checks beyond "is this field set":
- canonical_for entries are leaf names (`git`, not `/usr/bin/git`). The registry strips paths on lookup; allowing absolute paths in the manifest would let two toolboxes claim the same logical binary by writing it differently.
- canonical_for has no duplicates within one manifest. `[git, git]` is a typo (or a misunderstanding of the schema) — surface it at load time instead of letting the registry double-claim.
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"`
// Environments declares deploy targets the CLI knows about.
// Each entry can override cluster (kubeconfig), registry, namespace.
// Empty list = legacy behavior: env is name-only, kubeconfig/registry
// fall back to hardcoded defaults in cli/pkg/deployments + cli/cmd/build.
Environments []*Environment `yaml:"environments,omitempty"`
// Gitops declares where rendered manifests are committed for
// ArgoCD/Flux to sync from. Used by `codefly deploy --render-only`
// + the module-level scaffold to fill in Application repoURL fields.
// nil = no gitops flow declared; CLI tools fall back to placeholders.
Gitops *WorkspaceGitops `yaml:"gitops,omitempty"`
Path string `yaml:"path,omitempty"`
// contains filtered or unexported fields
}
func CreateWorkspace ¶
CreateWorkspace creates a new Workspace
func LoadWorkspaceFromDir ¶
LoadWorkspaceFromDir loads a Workspace configuration from a directory
func NewWorkspace ¶
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) 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 ¶
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) ExistsModule ¶
ExistsModule returns true if the module exists in the
func (*Workspace) FindEnvironment ¶ added in v0.1.157
func (workspace *Workspace) FindEnvironment(name string) *Environment
FindEnvironment looks up a declared environment by name. Returns nil if the workspace declares no environments or the name doesn't match.
Callers (cli/cmd/deploy, cli/cmd/build) treat a nil return as "fall back to legacy behavior" (bare-name env, hardcoded kubeconfig / registry defaults). That preserves backward-compat with workspace YAMLs that haven't been updated to declare environments.
"local" is returned synthetically (LocalEnvironment) when not declared, so single-env dev workspaces don't have to add YAML boilerplate just to keep working.
func (*Workspace) FindJobByName ¶ added in v0.1.155
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
LoadAllJobs loads all jobs from all modules in the workspace
func (*Workspace) LoadJobFromUnique ¶ added in v0.1.155
LoadJobFromUnique loads a job by its unique identifier (module/job)
func (*Workspace) LoadLibraries ¶ added in v0.1.155
LoadLibraries loads all libraries in the workspace
func (*Workspace) LoadLibraryFromName ¶ added in v0.1.155
LoadLibraryFromName loads a library by name from a workspace
func (*Workspace) LoadModuleFromName ¶
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 ¶
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) 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 ¶
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) RelativeDir ¶ added in v0.1.109
func (*Workspace) RootModule ¶
RootModule only applies to Flat layout
func (*Workspace) SaveToDirUnsafe ¶
func (*Workspace) SyncLibrarySubmodules ¶ added in v0.1.155
SyncLibrarySubmodules syncs all library submodules
type WorkspaceGitops ¶ added in v0.1.157
type WorkspaceGitops struct {
RepoURL string `yaml:"repo-url,omitempty"`
Path string `yaml:"path,omitempty"`
Branch string `yaml:"branch,omitempty"`
}
WorkspaceGitops declares the git target ArgoCD / Flux watches for rendered manifests. Optional — when nil, gitops-aware tooling falls back to placeholders and emits warnings.
RepoURL: full SSH or HTTPS git remote, e.g.
"git@github.com:my-org/saas-starter.git" or
"https://github.com/my-org/saas-starter.git".
Path: sub-tree within the repo where the rendered manifests
live. Empty = repo root. Use this when the workspace is
a sub-directory of a larger monorepo.
Branch: branch ArgoCD Applications target (defaults to main when
empty).
type WrapperSwagger ¶
type WrapperSwagger struct {
// contains filtered or unexported fields
}
Source Files
¶
- agent.go
- api.go
- application.go
- case.go
- configuration.go
- dns.go
- doc.go
- docker.go
- domain.go
- endpoint.go
- environment.go
- environment_variables_manager.go
- global.go
- grpc.go
- hash.go
- job.go
- layout.go
- library.go
- library_resolver.go
- loader.go
- marshalling.go
- modes.go
- module.go
- network.go
- network_mappings.go
- openapi.go
- organization.go
- readme.go
- references.go
- rest.go
- runtime.go
- service.go
- spec.go
- templates.go
- toolbox.go
- types.go
- validator.go
- workspace.go