configurations

package
v0.1.88 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 40 Imported by: 4

README

Conventions for environment variables

Key

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

Documentation

Index

Constants

View Source
const (
	ApplicationKind              = "application"
	ApplicationConfigurationName = "application.codefly.yaml"
)
View Source
const (
	AGENT = "agent"

	PROJECT     = "project"
	APPLICATION = "application"
	SERVICE     = "service"
	ENDPOINT    = "info"
)
View Source
const AgentConfigurationName = "agent.codefly.yaml"
View Source
const BuilderServiceAgent = "codefly:service:builder"
View Source
const ConfigurationPrefix = "CODEFLY__CONFIGURATION"
View Source
const ConfigurationProjectOrigin = "_project.configuration"
View Source
const EndpointPrefix = "CODEFLY__ENDPOINT"
View Source
const EnvironmentPrefix = "CODEFLY_ENVIRONMENT"
View Source
const GRPCRouteFileSuffix = ".grpc.codefly.yaml"
View Source
const LocalWorkspace = "local"
View Source
const ProjectConfigurationName = "project.codefly.yaml"
View Source
const ProjectConfigurationPrefix = "CODEFLY__PROJECT_CONFIGURATION"
View Source
const ProjectSecretConfigurationPrefix = "CODEFLY__PROJECT_SECRET_CONFIGURATION"
View Source
const RestRouteFileSuffix = ".rest.codefly.yaml"
View Source
const RestRoutePrefix = "CODEFLY__REST_ROUTE"
View Source
const RunningPrefix = "CODEFLY__RUNNING"
View Source
const RuntimeServiceAgent = "codefly:service:runtime"
View Source
const ServiceAgent = AgentKind("codefly:service")
View Source
const ServiceConfigurationName = "service.codefly.yaml"
View Source
const ServiceConfigurationPrefix = "CODEFLY__SERVICE_CONFIGURATION"
View Source
const ServiceSecretConfigurationPrefix = "CODEFLY__SERVICE_SECRET_CONFIGURATION"
View Source
const WorkspaceConfigurationName = "workspace.codefly.yaml"

Variables

This section is empty.

Functions

func APIString added in v0.1.62

func APIString(api *basev0.API) string

func ApplicationMode added in v0.0.51

func ApplicationMode() bool

func ConfigurationEnvironmentKeyPrefix added in v0.1.62

func ConfigurationEnvironmentKeyPrefix(conf *basev0.Configuration) string

func ConfigurationFile added in v0.0.42

func ConfigurationFile[C Configuration]() string

func ConfigurationHash added in v0.1.87

func ConfigurationHash(conf *basev0.Configuration) string

func ConfigurationInformationHash added in v0.1.62

func ConfigurationInformationHash(info *basev0.ConfigurationInformation) string

func ConfigurationInformationsHash added in v0.1.62

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

func ConfigurationsHash added in v0.1.87

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

func ConvertHTTPMethodToProto added in v0.1.37

func ConvertHTTPMethodToProto(m HTTPMethod) basev0.HTTPMethod

func ConvertSpec added in v0.1.50

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

func ConvertToAnyPb added in v0.1.50

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

func EndpointAsEnvironmentVariableKey added in v0.1.64

func EndpointAsEnvironmentVariableKey(info *EndpointInformation) string

func EndpointAsEnvironmentVariableKeyBase added in v0.1.81

func EndpointAsEnvironmentVariableKeyBase(info *EndpointInformation) string

func EndpointDestination added in v0.0.81

func EndpointDestination(e *basev0.Endpoint) string

func EndpointHash added in v0.1.20

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

func EndpointRestAPI added in v0.1.14

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

func EnvironmentVariableAsStrings added in v0.1.81

func EnvironmentVariableAsStrings(envs []EnvironmentVariable) []string

func ExistsAtDir

func ExistsAtDir[C Configuration](dir string) bool

func ExtendDomain

func ExtendDomain(domain string, extension string) string

func FilePathForGRPC added in v0.1.35

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

func FilePathForRest added in v0.1.35

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

func FilterConfigurations added in v0.1.64

func FilterConfigurations(configurations []*basev0.Configuration, scope basev0.NetworkScope) []*basev0.Configuration

func FindConfigurations added in v0.1.62

func FindConfigurations(configurations []*basev0.Configuration, scope basev0.NetworkScope) []*basev0.Configuration

func FindEndpointForGRPCRoute added in v0.1.35

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

FindEndpointForGRPCRoute finds the info that matches the route rpcs

func FindEndpointForRestRoute added in v0.1.35

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

FindEndpointForRestRoute finds the info that matches the route rpcs

func FindGRPCEndpoint added in v0.1.81

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

func FindHTTPEndpoint added in v0.1.64

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

func FindNetworkInstanceInNetworkMappings added in v0.1.81

func FindNetworkInstanceInNetworkMappings(_ context.Context, mappings []*basev0.NetworkMapping, endpoint *basev0.Endpoint, scope basev0.NetworkScope) (*basev0.NetworkInstance, error)

func FindNetworkMapping added in v0.1.55

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

func FindRestEndpoint added in v0.1.62

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

func FindTCPEndpoint added in v0.1.62

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

func FindTCPEndpointWithName added in v0.1.63

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

func FindUp

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

FindUp looks for a configuration in the active directory and up

func FindValueInEnvironmentVariables added in v0.1.81

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

func FromAnyPb added in v0.1.50

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

func GetConfigurationValue added in v0.1.62

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

func GroupKey added in v0.1.53

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

func HasConfigurationInformation added in v0.1.82

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

func HasPublicEndpoints added in v0.1.81

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

func Hash added in v0.1.20

func Hash(data []byte) string

func HashString added in v0.1.20

func HashString(s string) string

func HomeDir

func HomeDir() (string, error)

func InPartialMode added in v0.0.15

func InPartialMode() bool

func IsGRPC added in v0.1.31

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

func IsHTTP added in v0.1.43

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

func IsInitialized added in v0.0.51

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

func IsLocal added in v0.1.25

func IsLocal(environment *basev0.Environment) bool

func IsRest added in v0.1.31

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

func IsTCP added in v0.1.62

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

func Light added in v0.0.65

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

func LightAPI added in v0.0.65

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

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 Configuration](fs shared.FileSystem) (*C, error)

func LoadFromPath

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

func LoadGrpcAPI added in v0.1.62

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

func LoadHTTPAPI added in v0.1.62

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

func LoadRestAPI added in v0.1.62

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

func LoadSpec

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

func LoadTCPAPI added in v0.1.62

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

func LocalProto added in v0.1.33

func LocalProto() *basev0.Environment

func LocalizeNetworkMapping added in v0.1.83

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

func MakeConfigurationInformationSummary added in v0.1.62

func MakeConfigurationInformationSummary(info *basev0.ConfigurationInformation) string

func MakeConfigurationSummary added in v0.1.62

func MakeConfigurationSummary(conf *basev0.Configuration) string

func MakeConfigurationValueSummary added in v0.1.62

func MakeConfigurationValueSummary(value *basev0.ConfigurationValue) string

func MakeEndpointSummary added in v0.0.81

func MakeEndpointSummary(endpoint *basev0.Endpoint) string

func MakeManyConfigurationSummary added in v0.1.62

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

func MakeManyNetworkMappingSummary added in v0.1.62

func MakeManyNetworkMappingSummary(mappings []*basev0.NetworkMapping) string
func BuildMappingInstance(mapping *basev0.NetworkMapping) (*MappingInstance, error) {
	address := mapping.Address
	port, err := PortFromAddress(address)
	if err != nil {
		return nil, fmt.Errorf("invalid network port")
	}
	return &MappingInstance{
		Address: address,
		Port:    port,
	}, nil
}

func MakeNetworkMappingSummary added in v0.1.20

func MakeNetworkMappingSummary(mapping *basev0.NetworkMapping) string

func NameToKey added in v0.1.62

func NameToKey(name string) string

func NetworkInstanceSummary added in v0.1.69

func NetworkInstanceSummary(value *basev0.NetworkInstance) string

func NetworkMappingHash added in v0.1.20

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

func NewAPI added in v0.1.62

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

func NewHTTPNetworkInstance added in v0.1.71

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

func NewNetworkInstance added in v0.1.64

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

func OverridePath added in v0.0.51

func OverridePath(defaultPath string, path string) *string

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

func ParseOpenAPI added in v0.1.14

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

func Path

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

func PortFromAddress added in v0.1.43

func PortFromAddress(address string) (uint16, error)

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 basev0.Agent_Kind)

func RestRouteEnvironmentVariableKey added in v0.0.91

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

func RestRoutes added in v0.1.75

func RestRoutes(rest *basev0.RestAPI) string

func SaveToDir

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

func ScopeAsString added in v0.1.69

func ScopeAsString(scope basev0.NetworkScope) string

func ScopeString added in v0.1.62

func ScopeString(scope basev0.NetworkScope) string

func SerializeSpec

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

func ServiceConfigurationEnvironmentKeyPrefixFromUnique added in v0.1.69

func ServiceConfigurationEnvironmentKeyPrefixFromUnique(unique string) string

func ServiceConfigurationKey added in v0.1.69

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

func ServiceConfigurationKeyFromUnique added in v0.1.81

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

func ServiceSecretConfigurationEnvironmentKeyPrefixFromUnique added in v0.1.69

func ServiceSecretConfigurationEnvironmentKeyPrefixFromUnique(unique string) string

func ServiceSecretConfigurationKey added in v0.1.69

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

func ServiceSecretConfigurationKeyFromUnique added in v0.1.81

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

func ServiceUnique added in v0.0.81

func ServiceUnique(app string, service string) string

func ServiceUniqueFromEndpoint added in v0.1.31

func ServiceUniqueFromEndpoint(endpoint *basev0.Endpoint) string

func SetLoadWorkspaceUnsafe added in v0.0.51

func SetLoadWorkspaceUnsafe(w *Workspace)

func SetMode added in v0.0.15

func SetMode(m Mode)

func ToGrpcAPI added in v0.1.62

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

func ToHTTPAPI added in v0.1.62

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

func ToOrganizationName added in v0.1.18

func ToOrganizationName(svc string) string

func ToOrganizationSourceVersionControl added in v0.1.38

func ToOrganizationSourceVersionControl(name string) string

func ToRestAPI added in v0.1.62

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

func ToTCPAPI added in v0.1.62

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

func TypeName

func TypeName[C Configuration]() string

func UniqueToKey added in v0.1.62

func UniqueToKey(origin string) string

func ValidOrganization added in v0.0.51

func ValidOrganization(org *basev0.Organization) error

func Validate added in v0.1.18

func Validate(req proto.Message) error

func ValidateAgent added in v0.0.51

func ValidateAgent(agent *basev0.Agent) error

func ValidateDomain

func ValidateDomain()

func WorkspaceConfigurationDir added in v0.0.51

func WorkspaceConfigurationDir() string

WorkspaceConfigurationDir returns the directory where the Workspace configuration is stored

Types

type Agent added in v0.0.23

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

func AgentFromProto(agent *basev0.Agent) *Agent

func LoadAgent added in v0.0.51

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

func ParseAgent added in v0.0.23

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

func (*Agent) AsResource added in v0.0.55

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

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) Proto added in v0.0.55

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

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 basev0.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"`
	Description string `yaml:"description,omitempty"`

	ServiceReferences []*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) AddServiceReference added in v0.1.38

func (app *Application) AddServiceReference(_ context.Context, ref *ServiceReference) 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) DeleteServiceDependencies added in v0.0.91

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

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(ctx context.Context, 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) 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 *actionsv0.AddService) (*Service, error)

NewService creates a service in an application

func (*Application) Proto added in v0.0.51

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

func (*Application) PublicEndpoints added in v0.0.65

func (app *Application) PublicEndpoints(ctx context.Context) ([]*basev0.Endpoint, error)

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) 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.Dir nil: relative path to application with name rel: relative path /abs: absolute path

func (*Application) Unique

func (app *Application) Unique() string

func (*Application) Validate added in v0.1.18

func (app *Application) Validate() error

type ApplicationReference added in v0.0.9

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

An ApplicationReference

func (*ApplicationReference) AddService added in v0.1.18

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

func (*ApplicationReference) GetActive added in v0.1.18

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

func (*ApplicationReference) GetActiveService added in v0.1.18

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

func (*ApplicationReference) GetServiceFromName added in v0.1.18

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

func (*ApplicationReference) String added in v0.1.48

func (ref *ApplicationReference) String() string

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
}

func NewDockerImage added in v0.1.84

func NewDockerImage(s string) *DockerImage

func (*DockerImage) FullName added in v0.1.1

func (image *DockerImage) FullName() string

type Endpoint

type Endpoint struct {
	Name        string `yaml:"name"`
	Service     string `yaml:"service,omitempty"`
	Application string `yaml:"application,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 added in v0.1.22

func EndpointFromProto(e *basev0.Endpoint) *Endpoint

func FromProtoEndpoints added in v0.0.65

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

func (*Endpoint) AsReference added in v0.0.51

func (endpoint *Endpoint) AsReference() *EndpointReference

func (*Endpoint) Information added in v0.1.53

func (endpoint *Endpoint) Information() *EndpointInformation

func (*Endpoint) Proto added in v0.1.37

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

func (*Endpoint) ServiceUnique added in v0.1.14

func (endpoint *Endpoint) ServiceUnique() string

func (*Endpoint) Unique added in v0.0.13

func (endpoint *Endpoint) Unique() string

type EndpointAccess added in v0.1.64

type EndpointAccess struct {
	*basev0.Endpoint
	*basev0.NetworkInstance
}

type EndpointInformation added in v0.1.53

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

func EndpointInformationFromProto added in v0.1.64

func EndpointInformationFromProto(endpoint *basev0.Endpoint) *EndpointInformation

func ParseEndpoint added in v0.1.6

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

func (*EndpointInformation) Identifier added in v0.1.53

func (endpoint *EndpointInformation) Identifier() string

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

func (*EndpointInformation) UnknownAPI added in v0.1.53

func (endpoint *EndpointInformation) UnknownAPI() bool

type EndpointReference added in v0.0.9

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

An EndpointReference

type EndpointSummary added in v0.0.81

type EndpointSummary struct {
	Count   int
	Uniques []string
}

func MakeManyEndpointSummary added in v0.1.62

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

type Environment added in v0.0.17

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

	LoadBalancer string `yaml:"loadBalancer,omitempty"`
}

Environment is a configuration for an environment

func EnvironmentFromProto added in v0.1.20

func EnvironmentFromProto(env *basev0.Environment) *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

func (*Environment) Local added in v0.1.83

func (env *Environment) Local() bool

func (*Environment) Proto added in v0.1.20

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

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 EnvironmentVariable added in v0.1.81

type EnvironmentVariable struct {
	Key   string
	Value any
}

func AsRestRouteEnvironmentVariable added in v0.0.91

func AsRestRouteEnvironmentVariable(ctx context.Context, endpoint *basev0.Endpoint) []EnvironmentVariable

func ConfigurationAsEnvironmentVariables added in v0.1.62

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 EndpointAsEnvironmentVariable added in v0.1.64

func EndpointAsEnvironmentVariable(endpoint *basev0.Endpoint, instance *basev0.NetworkInstance) EnvironmentVariable

func Env added in v0.1.81

func Env(key string, value any) EnvironmentVariable

func EnvironmentAsEnvironmentVariable added in v0.1.20

func EnvironmentAsEnvironmentVariable(env *basev0.Environment) EnvironmentVariable

func RestRoutesAsEnvironmentVariable added in v0.0.91

func RestRoutesAsEnvironmentVariable(endpoint *basev0.Endpoint, route *basev0.RestRoute) EnvironmentVariable

func (EnvironmentVariable) String added in v0.1.81

func (v EnvironmentVariable) String() string

func (EnvironmentVariable) ValueAsEncodedString added in v0.1.82

func (v EnvironmentVariable) ValueAsEncodedString() string

func (EnvironmentVariable) ValueAsString added in v0.1.81

func (v EnvironmentVariable) ValueAsString() string

type EnvironmentVariableManager added in v0.1.6

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

func NewEnvironmentVariableManager added in v0.1.6

func NewEnvironmentVariableManager() *EnvironmentVariableManager

func (*EnvironmentVariableManager) AddConfigurations added in v0.1.62

func (holder *EnvironmentVariableManager) AddConfigurations(configurations ...*basev0.Configuration) error

func (*EnvironmentVariableManager) AddEndpoints added in v0.1.73

func (holder *EnvironmentVariableManager) AddEndpoints(ctx context.Context, mappings []*basev0.NetworkMapping, scope basev0.NetworkScope) error

func (*EnvironmentVariableManager) AddRestRoutes added in v0.1.73

func (holder *EnvironmentVariableManager) AddRestRoutes(ctx context.Context, mappings []*basev0.NetworkMapping, scope basev0.NetworkScope) error

func (*EnvironmentVariableManager) All added in v0.1.64

func (*EnvironmentVariableManager) Configurations added in v0.1.64

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

func (*EnvironmentVariableManager) Secrets added in v0.1.64

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

func (*EnvironmentVariableManager) SetEnvironment added in v0.1.62

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

func (*EnvironmentVariableManager) SetNetworkScope added in v0.1.69

func (holder *EnvironmentVariableManager) SetNetworkScope(scope basev0.NetworkScope)

func (*EnvironmentVariableManager) SetRunning added in v0.1.64

func (holder *EnvironmentVariableManager) SetRunning(b bool)

type ExtendedGRPCRoute added in v0.1.35

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

	Extension T `yaml:"extension"`
}

func LoadExtendedGRPCRoute added in v0.1.35

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

func (*ExtendedGRPCRoute[T]) Save added in v0.1.35

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

type ExtendedGRPCRouteLoader added in v0.1.35

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

ExtendedGRPCRouteLoader will return all GRPC route groups in a directory

func NewExtendedGRPCRouteLoader added in v0.1.35

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

func (*ExtendedGRPCRouteLoader[T]) Add added in v0.1.35

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

func (*ExtendedGRPCRouteLoader[T]) All added in v0.1.35

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

func (*ExtendedGRPCRouteLoader[T]) Load added in v0.1.35

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

func (*ExtendedGRPCRouteLoader[T]) Save added in v0.1.35

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

type ExtendedRestRoute added in v0.0.13

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

	Extension T `yaml:"extension"`
}

func NewExtendedRestRoute added in v0.0.13

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

type ExtendedRestRouteGroup added in v0.1.18

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

func LoadExtendedRestRouteGroup added in v0.1.18

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

func (*ExtendedRestRouteGroup[T]) Add added in v0.1.18

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

func (*ExtendedRestRouteGroup[T]) Save added in v0.1.18

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

func (*ExtendedRestRouteGroup[T]) ServiceUnique added in v0.1.18

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

type ExtendedRouteLoader added in v0.1.18

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

ExtendedRouteLoader will return all rest route groups in a directory

func NewExtendedRestRouteLoader added in v0.1.35

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

func (*ExtendedRouteLoader[T]) AddGroup added in v0.1.18

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

func (*ExtendedRouteLoader[T]) All added in v0.1.18

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

func (*ExtendedRouteLoader[T]) GroupFor added in v0.1.18

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

func (*ExtendedRouteLoader[T]) Groups added in v0.1.18

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

func (*ExtendedRouteLoader[T]) GroupsFor added in v0.1.18

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

func (*ExtendedRouteLoader[T]) Load added in v0.1.18

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

func (*ExtendedRouteLoader[T]) Save added in v0.1.18

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

type Forwarding added in v0.0.65

type Forwarding interface {
	Forward(r *RestRoute) (*RestRoute, error)
}

type GRPCRoute added in v0.1.35

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

func DetectNewGRPCRoutesFromEndpoints added in v0.1.35

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

func GRPCRouteFromProto added in v0.1.35

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

func LoadGRPCRoute added in v0.1.35

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

func UnwrapGRPCRoute added in v0.1.35

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

func (*GRPCRoute) Delete added in v0.1.35

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

func (*GRPCRoute) Route added in v0.1.35

func (g *GRPCRoute) Route() string

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

func (*GRPCRoute) Save added in v0.1.35

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

func (*GRPCRoute) ServiceUnique added in v0.1.35

func (g *GRPCRoute) ServiceUnique() string

type GRPCRouteLoader added in v0.1.35

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

GRPCRouteLoader will return all GRPC route groups in a directory

func NewGRPCRouteLoader added in v0.1.35

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

func (*GRPCRouteLoader) All added in v0.1.35

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

func (*GRPCRouteLoader) Load added in v0.1.35

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

func (*GRPCRouteLoader) Save added in v0.1.35

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

type HTTPAPI added in v0.0.81

type HTTPAPI struct{}

func (*HTTPAPI) Proto added in v0.0.81

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

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 ConvertHTTPMethodFromProto added in v0.1.37

func ConvertHTTPMethodFromProto(m basev0.HTTPMethod) HTTPMethod

type Hasher added in v0.1.20

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

func NewHasher added in v0.1.20

func NewHasher() *Hasher

func (*Hasher) Add added in v0.1.20

func (h *Hasher) Add(s string)

func (*Hasher) Hash added in v0.1.20

func (h *Hasher) Hash() string

type Mode added in v0.0.15

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

type NetworkInstance added in v0.1.81

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

func DefaultNetworkInstance added in v0.1.81

func DefaultNetworkInstance(api string) *NetworkInstance

func FindNetworkInstanceInEnvironmentVariables added in v0.1.81

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

func ParseAddress added in v0.1.81

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

type NewApplicationInput added in v0.1.38

type NewApplicationInput struct {
	Name string
}

type NoApplicationError

type NoApplicationError struct {
	Project string
}

func (NoApplicationError) Error

func (e NoApplicationError) Error() string

type NonUniqueServiceNameError added in v0.1.78

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

func (NonUniqueServiceNameError) Error added in v0.1.78

type OpenAPICombinator added in v0.1.14

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

func NewOpenAPICombinator added in v0.1.14

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

func (*OpenAPICombinator) Combine added in v0.1.14

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

func (*OpenAPICombinator) LoadEndpoints added in v0.1.14

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

func (*OpenAPICombinator) Only added in v0.1.14

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

func (*OpenAPICombinator) WithDestination added in v0.1.14

func (c *OpenAPICombinator) WithDestination(filename string)

func (*OpenAPICombinator) WithVersion added in v0.1.14

func (c *OpenAPICombinator) WithVersion(version string)

type Organization added in v0.0.51

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

	Name string `yaml:"name"`
}

func OrganizationFromProto added in v0.0.51

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

func (*Organization) Proto added in v0.0.51

func (organization *Organization) Proto() *basev0.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"`
	// ID must be globally unique
	ID string `yaml:"id,omitempty"`

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

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

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

func CreateProject added in v0.1.53

func CreateProject(ctx context.Context, action *actionsv0.NewProject) (*Project, error)

CreateProject creates a new project

func LoadProjectFromDir

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

LoadProjectFromDir loads a Project configuration from a directory

func LoadProjectFromPath added in v0.0.51

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

func NewProject

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

func ReloadProject added in v0.1.18

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

func (*Project) AddApplicationReference added in v0.1.38

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

AddApplicationReference adds an application to the project

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.Dir 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) DeleteServiceDependencies added in v0.0.91

func (project *Project) DeleteServiceDependencies(ctx context.Context, ref *ServiceReference) error

DeleteServiceDependencies deletes all service dependencies from a 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) FindUniqueService added in v0.1.78

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

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) LoadService added in v0.1.31

func (project *Project) LoadService(ctx context.Context, input *ServiceWithApplication) (*Service, error)

func (*Project) LoadServices added in v0.1.62

func (project *Project) LoadServices(ctx context.Context) ([]*Service, error)

func (*Project) NewApplication added in v0.0.51

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

NewApplication creates an application in a project

func (*Project) NewEnvironment added in v0.0.51

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

func (*Project) Proto added in v0.0.51

func (project *Project) Proto() (*basev0.Project, error)

func (*Project) Reference added in v0.1.18

func (project *Project) Reference() *ProjectReference

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) 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"`
	Path              string                  `yaml:"path"`
	Applications      []*ApplicationReference `yaml:"applications"`
	ActiveApplication string                  `yaml:"active-application"`
}

ProjectReference is a reference to a project used by Workspace configuration

func (*ProjectReference) AddApplication added in v0.1.18

func (ref *ProjectReference) AddApplication(ctx context.Context, application *ApplicationReference) error

func (*ProjectReference) GetActiveApplication added in v0.1.18

func (ref *ProjectReference) GetActiveApplication(ctx context.Context) (*ApplicationReference, error)

GetActiveApplication returns the active application returns nil if no active application

func (*ProjectReference) GetApplicationFromName added in v0.1.18

func (ref *ProjectReference) GetApplicationFromName(ctx context.Context, applicationName string) (*ApplicationReference, error)

func (*ProjectReference) String added in v0.0.51

func (ref *ProjectReference) String() string

type Readme added in v0.0.26

type Readme struct {
	Content string
}

type RestRoute added in v0.0.13

type RestRoute struct {
	Path   string
	Method HTTPMethod
}

func RestRouteFromProto added in v0.1.18

func RestRouteFromProto(r *basev0.RestRoute) *RestRoute

func UnwrapRestRoute added in v0.1.35

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

func (*RestRoute) Proto added in v0.1.37

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

type RestRouteAccess added in v0.1.64

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

type RestRouteGroup added in v0.1.18

type RestRouteGroup struct {
	// HTTP Path
	Path string `yaml:"path"`
	// Routes for each HTTP Method
	Routes      []*RestRoute `yaml:"routes"`
	Application 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 added in v0.0.91

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

func LoadRestRouteGroup added in v0.1.18

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

func UnwrapRestRouteGroup added in v0.1.35

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

func (*RestRouteGroup) Delete added in v0.1.18

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

Delete a route

func (*RestRouteGroup) Save added in v0.1.18

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

func (*RestRouteGroup) ServiceUnique added in v0.1.18

func (g *RestRouteGroup) ServiceUnique() string

type RestRouteLoader added in v0.1.35

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

RestRouteLoader will return all rest route groups in a directory

func NewRestRouteLoader added in v0.1.35

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

func (*RestRouteLoader) All added in v0.1.35

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

func (*RestRouteLoader) GroupFor added in v0.1.35

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

func (*RestRouteLoader) Groups added in v0.1.35

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

func (*RestRouteLoader) GroupsFor added in v0.1.35

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

func (*RestRouteLoader) Load added in v0.1.35

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

type RouteUnique added in v0.0.91

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

func (RouteUnique) String added in v0.1.18

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 Application running

type Service

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

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

	Agent *Agent `yaml:"agent"`

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

	// ProjectDependencies
	ProjectConfigurationDependencies []string `yaml:"project-configuration-dependencies"`

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

	// Spec is the specialized configuration of the service
	Spec map[string]any `yaml:"spec"`

	// RuntimeSpec are additional specs passed on by the runtime
	RuntimeSpec map[string]any `yaml:"-"`
	// contains filtered or unexported fields
}

A Service

func LoadServiceFromDir

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

LoadServiceFromDir 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) BaseEndpoint added in v0.1.55

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

func (*Service) DeleteServiceDependencies added in v0.0.91

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

func (*Service) Dir

func (s *Service) Dir() 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() *ServiceIdentity

Identity is the proto version of Unique

func (*Service) LoadEndpoints added in v0.1.62

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

func (*Service) LoadSettingsFromSpec added in v0.0.15

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

func (*Service) Local added in v0.1.62

func (s *Service) Local(f string) string

func (*Service) LocalOrNil added in v0.1.84

func (s *Service) LocalOrNil(f string) *string

func (*Service) Proto added in v0.0.51

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

func (*Service) ProviderDirectory added in v0.1.48

func (s *Service) ProviderDirectory(ctx context.Context, env *Environment) (string, error)

func (*Service) Reference

func (s *Service) Reference() *ServiceReference

func (*Service) Save

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

func (*Service) SaveAtDir

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

func (*Service) 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) UniqueWithProject added in v0.1.84

func (s *Service) UniqueWithProject() string

func (*Service) UpdateSpecFromSettings added in v0.0.15

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

func (*Service) Validate added in v0.1.18

func (s *Service) Validate() error

func (*Service) WithDir added in v0.1.50

func (s *Service) WithDir(dir string)

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 ServiceForwarding added in v0.0.65

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

func (ServiceForwarding) Forward added in v0.0.65

func (s ServiceForwarding) Forward(r *RestRoute) (*RestRoute, error)

type ServiceIdentity

type ServiceIdentity struct {
	Name        string
	Application string
	Project     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 Project the service belongs to

func ServiceIdentityFromProto added in v0.0.71

func ServiceIdentityFromProto(proto *basev0.ServiceIdentity) *ServiceIdentity

func (*ServiceIdentity) AsAgentResource added in v0.1.83

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

func (*ServiceIdentity) AsResource added in v0.0.55

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

func (*ServiceIdentity) Clone added in v0.1.33

func (s *ServiceIdentity) Clone() *ServiceIdentity

func (*ServiceIdentity) Unique added in v0.0.55

func (s *ServiceIdentity) Unique() string

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 ServiceWithApplication added in v0.0.81

type ServiceWithApplication struct {
	Name        string
	Application string
}

func ParseService added in v0.1.1

func ParseService(input string) (*ServiceWithApplication, error)

func ParseServiceUnique added in v0.0.81

func ParseServiceUnique(unique string) (*ServiceWithApplication, error)

ParseServiceUnique returns a Service/Application pair from a unique or an error

func (ServiceWithApplication) Unique added in v0.0.81

func (s ServiceWithApplication) Unique() string

type ServiceWithCase added in v0.0.26

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

func ToServiceWithCase added in v0.0.26

func ToServiceWithCase(svc *Service) *ServiceWithCase

type TCP added in v0.0.51

type TCP struct{}

func NewTCP added in v0.0.65

func NewTCP() (*TCP, error)

func (*TCP) Proto added in v0.0.65

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

type Visibility added in v0.0.91

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"
	// VisibilityApplication represents an endpoint from other applications inside the system
	VisibilityApplication Visibility = "application"
	// VisibilityPrivate represents an endpoint that is only accessible within the application
	VisibilityPrivate Visibility = "private"
)

type Workspace

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

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

	ActiveProject string `yaml:"active-project,omitempty"`
	// contains filtered or unexported fields
}

Workspace configuration for codefly CLI

func LoadWorkspace added in v0.0.51

func LoadWorkspace(ctx context.Context, name string) (*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 *actionsv0.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) AddApplicationReference added in v0.1.38

func (workspace *Workspace) AddApplicationReference(ctx context.Context, projectName string, application *ApplicationReference) error

func (*Workspace) AddProjectReference added in v0.0.60

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

func (*Workspace) AddService added in v0.1.18

func (workspace *Workspace) AddService(ctx context.Context, projectName string, applicationName string, service *ServiceReference) error

func (*Workspace) DeleteApplication added in v0.1.33

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

func (*Workspace) DeleteProject added in v0.0.37

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

func (*Workspace) DeleteService added in v0.1.33

func (workspace *Workspace) DeleteService(ctx context.Context, projectName string, appName string, name string) error

func (*Workspace) Dir

func (workspace *Workspace) Dir() string

Dir returns the absolute path to the Workspace configuration directory

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) GetActiveProject added in v0.1.18

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

GetActiveProject returns the active project If no projects in workspace, returns nil

func (*Workspace) HasProject added in v0.1.38

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

HasProject returns true if the project exists

func (*Workspace) LoadActiveApplication added in v0.1.18

func (workspace *Workspace) LoadActiveApplication(ctx context.Context, projectName string) (*Application, error)

LoadActiveApplication loads the active application If no active application, returns nil

func (*Workspace) LoadActiveProject added in v0.0.51

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

LoadActiveProject load the active project if exists returns nil if no active project

func (*Workspace) LoadActiveService added in v0.1.18

func (workspace *Workspace) LoadActiveService(ctx context.Context, projectName string, applicationName string) (*Service, error)

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) ProjectNames added in v0.0.51

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

ProjectNames returns the names of the projects in the Workspace configuration

func (*Workspace) Save added in v0.0.51

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

Save Workspaces

func (*Workspace) SetActiveService added in v0.1.18

func (workspace *Workspace) SetActiveService(ctx context.Context, projectName string, applicationName string, serviceName string) error

func (*Workspace) SetApplicationActive added in v0.1.38

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

func (*Workspace) SetProjectActive added in v0.0.51

func (workspace *Workspace) SetProjectActive(ctx context.Context, project string) error

SetProjectActive sets the active project

func (*Workspace) Unique added in v0.0.55

func (workspace *Workspace) Unique() string

type WrapperSwagger added in v0.1.14

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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