configurations

package
v0.0.52 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: MIT Imports: 20 Imported by: 4

Documentation

Index

Constants

View Source
const (
	ApplicationKind              = "application"
	ApplicationConfigurationName = "application.codefly.yaml"
)
View Source
const (
	Unknown = "unknown"
	Grpc    = "grpc"
	Rest    = "rest"
	TCP     = "tcp"
)
View Source
const AgentConfigurationName = "agent.codefly.yaml"
View Source
const EndpointPrefix = "CODEFLY_ENDPOINT__"
View Source
const FactoryServiceAgent = "codefly:service:factory"
View Source
const InfoConfigurationName = "info.codefly.yaml"
View Source
const ProjectConfigurationName = "project.codefly.yaml"
View Source
const RestRoutePrefix = "CODEFLY-RESTROUTE_"
View Source
const RuntimeServiceAgent = "codefly:service:runtime"
View Source
const ServiceAgent = AgentKind("codefly:service")
View Source
const ServiceConfigurationName = "service.codefly.yaml"
View Source
const WorkspaceConfigurationName = "codefly.yaml"

Variables

This section is empty.

Functions

func ApplicationMode added in v0.0.51

func ApplicationMode() bool

func AsEndpointEnvironmentVariable added in v0.0.13

func AsEndpointEnvironmentVariable(app string, service string, endpoint *Endpoint, addresses []string) string

func AsEndpointEnvironmentVariableKey added in v0.0.13

func AsEndpointEnvironmentVariableKey(app string, service string, endpoint *Endpoint) string

func ConfigurationFile added in v0.0.42

func ConfigurationFile[C Configuration]() string

func ContainsRoute added in v0.0.28

func ContainsRoute(routes []*RestRoute, r *RestRoute) bool

func ExistsAtDir

func ExistsAtDir[C Configuration](dir string) bool

func ExtendDomain

func ExtendDomain(domain string, extension string) string

func ExtraValidOrganizationName added in v0.0.51

func ExtraValidOrganizationName(name string) bool

func FindUp

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

FindUp looks for a configuration in the active directory and up

func HomeDir

func HomeDir() string

func InPartialMode added in v0.0.15

func InPartialMode() bool

func IsInitialized added in v0.0.51

func IsInitialized(_ context.Context) bool

func LoadFromBytes added in v0.0.13

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

func LoadFromDir

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

func LoadFromFs added in v0.0.42

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

func LoadFromPath

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

func LoadSpec

func LoadSpec(content []byte, obj any) error

func MakeActive added in v0.0.51

func MakeActive(entry string) string

func MakeInactive added in v0.0.51

func MakeInactive(entry string) string

func OverridePath added in v0.0.51

func OverridePath(name string, path string) *string

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

func ParseAgent added in v0.0.23

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

func ParseEndpointEnvironmentVariableKey added in v0.0.13

func ParseEndpointEnvironmentVariableKey(key string) (string, error)

func ParseRestRouteEnvironmentVariable added in v0.0.13

func ParseRestRouteEnvironmentVariable(env string) (string, []string)

func Path

func Path[C Configuration](dir string) string

func ReferenceMatch added in v0.0.51

func ReferenceMatch(entry string, name string) bool

func RegisterAgent added in v0.0.51

func RegisterAgent(kind AgentKind, protoKind basev1.Agent_Kind)

func RestRouteAsEnvironmentVariable added in v0.0.13

func RestRouteAsEnvironmentVariable(reference string, addresses []string) string

func SaveToDir

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

func SerializeAddresses

func SerializeAddresses(addresses []string) string

func SerializeSpec

func SerializeSpec(spec any) ([]byte, error)

func SetLoadWorkspaceUnsafe added in v0.0.51

func SetLoadWorkspaceUnsafe(w *Workspace)

func SetMode added in v0.0.15

func SetMode(m Mode)

func SolveDir

func SolveDir(dir string) string

func SolveDirOrCreate

func SolveDirOrCreate(dir string) string

func SupportedAPI added in v0.0.51

func SupportedAPI(kind string) error

func ToOrganizationDomain added in v0.0.51

func ToOrganizationDomain(name string) string

func TypeName

func TypeName[C Configuration]() string

func ValidOrganization added in v0.0.51

func ValidOrganization(org *basev1.Organization) error

func ValidOrganizationDomain added in v0.0.51

func ValidOrganizationDomain(domain string) bool

func ValidateAgent added in v0.0.51

func ValidateAgent(agent *basev1.Agent) error

func ValidateDomain

func ValidateDomain()

func Version added in v0.0.42

func Version() (string, error)

func WorkspaceConfigurationDir added in v0.0.51

func WorkspaceConfigurationDir() string

WorkspaceConfigurationDir returns the directory where the Workspace configuration is stored Initialized to the default user folder

Types

type Agent added in v0.0.23

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

func AgentFromProto added in v0.0.51

func AgentFromProto(agent *basev1.Agent) *Agent

func LoadAgent added in v0.0.51

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

func (*Agent) Identifier added in v0.0.23

func (p *Agent) Identifier() string

func (*Agent) IsService added in v0.0.51

func (p *Agent) IsService() bool

func (*Agent) Key added in v0.0.23

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

func (*Agent) Of added in v0.0.23

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

func (*Agent) Patch added in v0.0.23

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

func (*Agent) Path added in v0.0.23

func (p *Agent) Path() (string, error)

func (*Agent) String added in v0.0.23

func (p *Agent) String() string

func (*Agent) Unique added in v0.0.23

func (p *Agent) Unique() string

type AgentKind added in v0.0.51

type AgentKind string

func AgentKindFromProto added in v0.0.51

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

type Application

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

	Project     string `yaml:"project"`
	Domain      string `yaml:"domain"`
	Description string `yaml:"description,omitempty"`

	Services []*ServiceReference `yaml:"services"`
	// contains filtered or unexported fields
}

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

func LoadApplicationFromDirUnsafe added in v0.0.51

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

func LoadApplicationFromPath added in v0.0.51

func LoadApplicationFromPath(ctx context.Context) (*Application, error)

LoadApplicationFromPath loads an application from a path

func ReloadApplication added in v0.0.51

func ReloadApplication(ctx context.Context, app *Application) (*Application, error)

func (*Application) ActiveService added in v0.0.51

func (app *Application) ActiveService(_ context.Context) *string

func (*Application) AddService

func (app *Application) AddService(_ context.Context, service *Service) error

func (*Application) DeleteService added in v0.0.51

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

DeleteService deletes a service from an application

func (*Application) Dir

func (app *Application) Dir() string

Dir returns the directory of the application

func (*Application) ExistsService added in v0.0.51

func (app *Application) ExistsService(name string) bool

ExistsService returns true if the service exists in the application

func (*Application) GetServiceReferences

func (app *Application) GetServiceReferences(name string) (*ServiceReference, error)

func (*Application) LoadActiveService added in v0.0.51

func (app *Application) LoadActiveService(ctx context.Context) (*Service, error)

func (*Application) LoadServiceFromName added in v0.0.13

func (app *Application) LoadServiceFromName(ctx context.Context, name string) (*Service, error)

func (*Application) LoadServiceFromReference added in v0.0.36

func (app *Application) LoadServiceFromReference(ctx context.Context, ref *ServiceReference) (*Service, error)

func (*Application) LoadServices added in v0.0.51

func (app *Application) LoadServices(ctx context.Context) ([]*Service, error)

func (*Application) NewService added in v0.0.51

func (app *Application) NewService(ctx context.Context, action *actionsv1.AddService) (*Service, error)

NewService creates a service in an application

func (*Application) Proto added in v0.0.51

func (app *Application) Proto() *basev1.Application

func (*Application) Reference added in v0.0.15

func (app *Application) Reference() *ApplicationReference

func (*Application) Save

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

func (*Application) SaveToDir added in v0.0.51

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

func (*Application) ServiceDomain

func (app *Application) ServiceDomain(name string) string

func (*Application) ServicePath added in v0.0.51

func (app *Application) ServicePath(_ context.Context, ref *ServiceReference) string

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

func (*Application) SetActiveService added in v0.0.51

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

type ApplicationReference added in v0.0.9

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

An ApplicationReference

func (*ApplicationReference) IsActive added in v0.0.51

func (ref *ApplicationReference) IsActive() (*ApplicationReference, bool)

IsActive returns true if the project is marked as active

func (*ApplicationReference) MarkAsActive added in v0.0.51

func (ref *ApplicationReference) MarkAsActive()

MarkAsActive marks a project as active

type ApplicationRestRoute added in v0.0.13

type ApplicationRestRoute struct {
	ServiceRestRoutes []*ServiceRestRoute
	Name              string
}

func (*ApplicationRestRoute) Save added in v0.0.13

func (r *ApplicationRestRoute) Save(ctx context.Context, dir string) error

Save as folder structure

type ClientEntry

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

func (*ClientEntry) Validate

func (c *ClientEntry) Validate() error

type Configuration

type Configuration interface{}

type DockerImage added in v0.0.26

type DockerImage struct {
	Repository string
	Name       string
	Tag        string
}

type Endpoint

type Endpoint struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description,omitempty"`
	Visibility  string `yaml:"scope,omitempty"`
	API         string `yaml:"api,omitempty"`
	// FailOver indicates that this endpoint should fail over to another endpoint
	FailOver *Endpoint `yaml:"fail-over,omitempty"`
}

Endpoint is the fundamental entity that standardize communication between services.

func (*Endpoint) AsReference added in v0.0.51

func (e *Endpoint) AsReference() *EndpointReference

func (*Endpoint) Unique added in v0.0.13

func (e *Endpoint) Unique(app string, service string) string

type EndpointInstance added in v0.0.13

type EndpointInstance struct {
	Unique    string
	Addresses []string
}

func ParseEndpointEnvironmentVariable added in v0.0.13

func ParseEndpointEnvironmentVariable(env string) (*EndpointInstance, error)

type EndpointReference added in v0.0.9

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

An EndpointReference

type Environment added in v0.0.17

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

Environment is a configuration for an environment

func LoadEnvironmentFromReference added in v0.0.31

func LoadEnvironmentFromReference(ref *EnvironmentReference) (*Environment, error)

func Local added in v0.0.17

func Local() *Environment

Local is a local environment that is always available

type EnvironmentExistsError added in v0.0.51

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

func (*EnvironmentExistsError) Error added in v0.0.51

func (err *EnvironmentExistsError) Error() string

type EnvironmentReference added in v0.0.31

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

An EnvironmentReference at the Project level

func (*EnvironmentReference) String added in v0.0.51

func (ref *EnvironmentReference) String() string

type ExtendedRestRoute added in v0.0.13

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

	Extension T `yaml:"extension"`
}

func LoadApplicationExtendedRoutes added in v0.0.13

func LoadApplicationExtendedRoutes[T any](_ context.Context, dir string) ([]*ExtendedRestRoute[T], error)

func LoadExtendedRestRoute added in v0.0.13

func LoadExtendedRestRoute[T any](p string, app string, service string) (*ExtendedRestRoute[T], error)

func LoadExtendedRoutes added in v0.0.13

func LoadExtendedRoutes[T any](dir string, app string, service string) ([]*ExtendedRestRoute[T], error)

func LoadServiceExtendedRoutes added in v0.0.13

func LoadServiceExtendedRoutes[T any](dir string, app string) ([]*ExtendedRestRoute[T], error)

func NewExtendedRestRoute added in v0.0.13

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

type HTTPMethod added in v0.0.51

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 ConvertMethod added in v0.0.28

func ConvertMethod(m basev1.HTTPMethod) HTTPMethod

func ConvertMethods added in v0.0.28

func ConvertMethods(methods []basev1.HTTPMethod) []HTTPMethod

type Info added in v0.0.42

type Info struct {
	Version string `yaml:"version"`
}

type Mode added in v0.0.15

type Mode = string
const (
	ModeApplication Mode = "application"
	ModePartial     Mode = "partial"
	ModeService     Mode = "service"
)

type NoApplicationError

type NoApplicationError struct {
	Project string
}

func (NoApplicationError) Error

func (e NoApplicationError) Error() string

type Organization added in v0.0.51

type Organization struct {
	Name   string `yaml:"name"`
	Domain string `yaml:"domain"`
}

func OrganizationFromProto added in v0.0.51

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

func (*Organization) Proto added in v0.0.51

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

type Partial added in v0.0.13

type Partial struct {
	Name    string `yaml:"name"`
	Project string `yaml:"project"`
	// Applications in the partial of the project
	Applications []string `yaml:"applications"`
}

type Project

type Project struct {
	Name         string  `yaml:"name"`
	PathOverride *string `yaml:"path,omitempty"`

	Organization Organization `yaml:"organization"`
	Domain       string       `yaml:"domain,omitempty"`
	Description  string       `yaml:"description,omitempty"`

	// Applications in the project
	Applications []*ApplicationReference `yaml:"applications"`

	// Partials are a convenient way to run several applications
	Partials []*Partial `yaml:"partials"`

	// Providers in the project
	Providers []*ProviderReference `yaml:"providers"`

	// Environments in the project
	Environments []*EnvironmentReference `yaml:"environments"`
	// contains filtered or unexported fields
}

func ActiveDefaultProject added in v0.0.51

func ActiveDefaultProject(ctx context.Context) (*Project, error)

func LoadProjectFromDirUnsafe added in v0.0.51

func LoadProjectFromDirUnsafe(ctx context.Context, dir string) (*Project, error)

LoadProjectFromDirUnsafe loads a Project configuration from a directory

func LoadProjectFromPath added in v0.0.51

func LoadProjectFromPath(ctx context.Context) (*Project, error)

func (*Project) ActiveApplication added in v0.0.51

func (project *Project) ActiveApplication() *string

ActiveApplication returns the active application

func (*Project) AddApplication added in v0.0.9

func (project *Project) AddApplication(app *ApplicationReference) error

AddApplication adds an application to the project

func (*Project) AddPartial added in v0.0.13

func (project *Project) AddPartial(partial Partial) error

func (*Project) ApplicationPath added in v0.0.51

func (project *Project) ApplicationPath(_ context.Context, ref *ApplicationReference) string

ApplicationPath returns the absolute path of an application Cases for Reference.Path nil: relative path to project with name rel: relative path /abs: absolute path

func (*Project) ApplicationsNames added in v0.0.51

func (project *Project) ApplicationsNames() []string

ApplicationsNames returns the names of the applications in the project

func (*Project) DeleteApplication added in v0.0.51

func (project *Project) DeleteApplication(ctx context.Context, name string) error

DeleteApplication deletes an application from the project

func (*Project) Dir

func (project *Project) Dir() string

Dir is the directory of the project

func (*Project) ExistsApplication added in v0.0.51

func (project *Project) ExistsApplication(name string) bool

ExistsApplication returns true if the application exists in the project

func (*Project) FindEnvironment added in v0.0.31

func (project *Project) FindEnvironment(environment string) (*Environment, error)

func (*Project) GetPartial added in v0.0.13

func (project *Project) GetPartial(name string) (*Partial, error)

func (*Project) LoadActiveApplication added in v0.0.51

func (project *Project) LoadActiveApplication(ctx context.Context) (*Application, error)

LoadActiveApplication decides which application is active: - only 1: it is active - more than 1: use the activeApplication internal field

func (*Project) LoadApplicationFromName added in v0.0.51

func (project *Project) LoadApplicationFromName(ctx context.Context, name string) (*Application, error)

LoadApplicationFromName loads an application from a name

func (*Project) LoadApplicationFromReference added in v0.0.13

func (project *Project) LoadApplicationFromReference(ctx context.Context, ref *ApplicationReference) (*Application, error)

LoadApplicationFromReference loads an application from a reference

func (*Project) LoadApplications added in v0.0.51

func (project *Project) LoadApplications(ctx context.Context) ([]*Application, error)

LoadApplications returns the applications in the project

func (*Project) NewApplication added in v0.0.51

func (project *Project) NewApplication(ctx context.Context, action *actionsv1.AddApplication) (*Application, error)

NewApplication creates an application in a project

func (*Project) NewEnvironment added in v0.0.51

func (project *Project) NewEnvironment(_ context.Context, input *actionsv1.AddEnvironment) (*Environment, error)

func (*Project) Proto added in v0.0.51

func (project *Project) Proto() *basev1.Project

func (*Project) Save

func (project *Project) Save(ctx context.Context) error

func (*Project) SaveToDirUnsafe added in v0.0.51

func (project *Project) SaveToDirUnsafe(ctx context.Context, dir string) error

func (*Project) SetActiveApplication added in v0.0.51

func (project *Project) SetActiveApplication(_ context.Context, name string) error

SetActiveApplication sets the active application

func (*Project) Unique

func (project *Project) Unique() string

Unique returns the unique name of the project Currently, we don't insure uniqueness across workspaces

type ProjectReference

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

ProjectReference is a reference to a project used by Workspace configuration

func (*ProjectReference) IsActive added in v0.0.51

func (ref *ProjectReference) IsActive() (*ProjectReference, bool)

IsActive returns true if the project is marked as active and return the clean reference for Loading

func (*ProjectReference) MarkAsActive added in v0.0.51

func (ref *ProjectReference) MarkAsActive()

MarkAsActive marks a project as active using the * convention

func (*ProjectReference) MarkAsInactive added in v0.0.51

func (ref *ProjectReference) MarkAsInactive()

MarkAsInactive marks a project as inactive using the * convention

func (*ProjectReference) String added in v0.0.51

func (ref *ProjectReference) String() string

type ProviderReference added in v0.0.9

type ProviderReference struct {
	Name                 string  `yaml:"name"`
	RelativePathOverride *string `yaml:"relative-path,omitempty"`
}

A ProviderReference

type Readme added in v0.0.26

type Readme struct {
	Content string
}

type RestRoute added in v0.0.13

type RestRoute struct {
	Path        string
	Methods     []HTTPMethod
	Application string `yaml:"-"`
	Service     string `yaml:"-"`
}

func ConvertRoutes added in v0.0.28

func ConvertRoutes(routes []*basev1.RestRoute, app string, service string) []*RestRoute

func DetectNewRoutes added in v0.0.28

func DetectNewRoutes(known []*RestRoute, routes []*RestRoute) []*RestRoute

func LoadApplicationRoutes added in v0.0.13

func LoadApplicationRoutes(ctx context.Context, dir string) ([]*RestRoute, error)

func LoadRoute added in v0.0.13

func LoadRoute(ctx context.Context, p string, app string, service string) (*RestRoute, error)

func LoadRoutes added in v0.0.13

func LoadRoutes(ctx context.Context, dir string, app string, service string) ([]*RestRoute, error)

func LoadServiceRoutes added in v0.0.13

func LoadServiceRoutes(ctx context.Context, dir string, app string) ([]*RestRoute, error)

func UnwrapRoute added in v0.0.32

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

func UnwrapRoutes added in v0.0.13

func UnwrapRoutes[T any](routes []*ExtendedRestRoute[T]) []*RestRoute

func (*RestRoute) Delete added in v0.0.32

func (r *RestRoute) Delete(ctx context.Context, dir string) error

Delete a route

func (*RestRoute) FilePath added in v0.0.32

func (r *RestRoute) FilePath(ctx context.Context, dir string) (string, error)

func (*RestRoute) Save added in v0.0.13

func (r *RestRoute) Save(ctx context.Context, dir string) error

Save a route: The path is inferred from the configuration

func (*RestRoute) String added in v0.0.13

func (r *RestRoute) 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 Application running

type Service

type Service struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description,omitempty"`
	Version     string `yaml:"version"`
	Application string `yaml:"application"`
	Domain      string `yaml:"domain"`
	Namespace   string `yaml:"namespace"`

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

	Agent        *Agent               `yaml:"agent"`
	Dependencies []*ServiceDependency `yaml:"dependencies"`
	Endpoints    []*Endpoint          `yaml:"endpoints"`
	Spec         map[string]any       `yaml:"spec"`
	// contains filtered or unexported fields
}

A Service

func LoadServiceFromDirUnsafe added in v0.0.51

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

LoadServiceFromDirUnsafe loads a service from a directory

func LoadServiceFromPath added in v0.0.51

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

LoadServiceFromPath loads an service from a path

func ReloadService added in v0.0.51

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

ReloadService from directory

func (*Service) AddDependency added in v0.0.51

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

AddDependency adds a dependency to the service

func (*Service) Dir

func (s *Service) Dir() string

func (*Service) Endpoint

func (s *Service) Endpoint() string

func (*Service) EndpointsFromNames added in v0.0.51

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

EndpointsFromNames return matching endpoints

func (*Service) ExistsDependency added in v0.0.51

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

func (*Service) HasEndpoints added in v0.0.51

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

func (*Service) Identity added in v0.0.51

func (s *Service) Identity() *basev1.ServiceIdentity

Identity is the proto version of Unique

func (*Service) LoadSettingsFromSpec added in v0.0.15

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

func (*Service) Proto added in v0.0.51

func (s *Service) Proto() *basev1.Service

func (*Service) Reference

func (s *Service) Reference() (*ServiceReference, error)

func (*Service) Save

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

func (*Service) SaveAtDir

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

func (*Service) Unique

func (s *Service) Unique() string

Unique identifies a service within a project We use a REST like convention rather then a subdomain one

func (*Service) UpdateSpecFromSettings added in v0.0.15

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

type ServiceDependency

type ServiceDependency struct {
	Name        string `yaml:"name"`
	Application string `yaml:"application,omitempty"`

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

func (*ServiceDependency) AsReference

func (s *ServiceDependency) AsReference() *ServiceReference

func (*ServiceDependency) String added in v0.0.13

func (s *ServiceDependency) String() string

func (*ServiceDependency) Unique added in v0.0.13

func (s *ServiceDependency) Unique() string

func (*ServiceDependency) UpdateEndpoints added in v0.0.51

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

type ServiceIdentity

type ServiceIdentity struct {
	Name        string
	Application string
	Namespace   string
	Domain      string
}

ServiceIdentity defines exactly the scope of the service Name: the name of the service It will be unique within an application Application: the name of the application the service belongs to Recall that application names are unique within a project This is a logical partitioning Namespace: the namespace the service belongs to This is a resource partitioning Domain: the domain of the service belongs to This is a responsibility partitioning

func Identity

func Identity(conf *Service) *ServiceIdentity

type ServiceReference

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

ServiceReference is a reference to a service used by Application configuration

func ParseServiceReference added in v0.0.15

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

func (*ServiceReference) String added in v0.0.15

func (ref *ServiceReference) String() string

type ServiceRestRoute added in v0.0.13

type ServiceRestRoute struct {
	Routes      []*RestRoute
	Name        string
	Application string `yaml:"-"`
}

func (*ServiceRestRoute) Save added in v0.0.13

func (r *ServiceRestRoute) Save(ctx context.Context, dir string) error

type ServiceWithCase added in v0.0.26

type ServiceWithCase struct {
	Name      shared.Case
	Unique    shared.Case
	Domain    string
	Namespace string
}

func ToServiceWithCase added in v0.0.26

func ToServiceWithCase(svc *Service) *ServiceWithCase

type Workspace

type Workspace struct {
	Name         string       `yaml:"name"`
	Organization Organization `yaml:"organization,omitempty"`
	Domain       string       `yaml:"domain,omitempty"`

	// Projects in the Workspace configuration
	Projects []*ProjectReference `yaml:"projects"`

	// Configuration
	ProjectsRoot string `yaml:"projects-root"`
	// contains filtered or unexported fields
}

Workspace configuration for codefly CLI

func LoadWorkspace added in v0.0.51

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

LoadWorkspace returns the active Workspace configuration

func LoadWorkspaceFromDirUnsafe added in v0.0.51

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

LoadWorkspaceFromDirUnsafe loads a Workspace configuration from a directory

func NewWorkspace added in v0.0.51

func NewWorkspace(ctx context.Context, action *actionsv1.AddWorkspace) (*Workspace, error)

NewWorkspace creates a new workspace

func ReloadWorkspace added in v0.0.51

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

ReloadWorkspace a project configuration

func (*Workspace) ActiveProject added in v0.0.51

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

func (*Workspace) DeleteProject added in v0.0.37

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

func (*Workspace) Dir

func (workspace *Workspace) Dir() string

Dir returns the absolute path to the Workspace configuration directory

func (*Workspace) ExistsProject added in v0.0.51

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

ExistsProject returns true if the project exists

func (*Workspace) FindProjectReference added in v0.0.51

func (workspace *Workspace) FindProjectReference(name string) (*ProjectReference, error)

FindProjectReference finds a project reference by name

func (*Workspace) LoadActiveProject added in v0.0.51

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

LoadActiveProject loads the active project

func (*Workspace) LoadProjectFromDir added in v0.0.51

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

LoadProjectFromDir loads a project from a directory

func (*Workspace) LoadProjectFromName added in v0.0.51

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

LoadProjectFromName loads a project from a name

func (*Workspace) LoadProjectFromReference added in v0.0.51

func (workspace *Workspace) LoadProjectFromReference(ctx context.Context, ref *ProjectReference) (*Project, error)

LoadProjectFromReference loads a project from a reference

func (*Workspace) LoadProjects added in v0.0.51

func (workspace *Workspace) LoadProjects(ctx context.Context) ([]*Project, error)

LoadProjects loads all the projects in the Workspace

func (*Workspace) NewProject added in v0.0.51

func (workspace *Workspace) NewProject(ctx context.Context, action *actionsv1.AddProject) (*Project, error)

NewProject creates a new project in a workspace

func (*Workspace) ProjectNames added in v0.0.51

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

ProjectNames returns the names of the projects in the Workspace configuration

func (*Workspace) ProjectPath added in v0.0.51

func (workspace *Workspace) ProjectPath(_ context.Context, ref *ProjectReference) string

ProjectPath returns the absolute path of a project Cases for Reference.Path nil: relative path to workspace with name rel: relative path /abs: absolute path

func (*Workspace) ProjectRoot added in v0.0.51

func (workspace *Workspace) ProjectRoot() string

ProjectRoot returns the absolute path to the Workspace project root

func (*Workspace) ReloadProject added in v0.0.51

func (workspace *Workspace) ReloadProject(ctx context.Context, project *Project) (*Project, error)

ReloadProject a project configuration

func (*Workspace) Save added in v0.0.51

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

Save Workspaces

func (*Workspace) SetProjectActive added in v0.0.51

func (workspace *Workspace) SetProjectActive(ctx context.Context, input *actionsv1.SetProjectActive) error

SetProjectActive sets the active project

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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