resources

package
v0.1.112 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: MIT Imports: 39 Imported by: 3

README

Conventions for environment variables

Key

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

Documentation

Index

Constants

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

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

	WORKSPACE = "workspace"
	MODULE    = "module"
	SERVICE   = "service"
	ENDPOINT  = "endpoint"
)
View Source
const AgentConfigurationName = "agent.codefly.yaml"
View Source
const BuilderServiceAgent = "codefly:service:builder"
View Source
const ConfigurationWorkspace = "workspace"
View Source
const EndpointPrefix = "CODEFLY__ENDPOINT"
View Source
const EnvironmentPrefix = "CODEFLY__ENVIRONMENT"
View Source
const GRPCRouteFileSuffix = ".grpc.codefly.yaml"
View Source
const ModulePrefix = "CODEFLY__MODULE"
View Source
const RestRouteFileSuffix = ".rest.codefly.yaml"
View Source
const RestRoutePrefix = "CODEFLY__REST_ROUTE"
View Source
const RunningPrefix = "CODEFLY__RUNNING"
View Source
const RuntimeContextPrefix = "CODEFLY__RUNTIME_CONTEXT"
View Source
const RuntimeServiceAgent = "codefly:service:runtime"
View Source
const ServiceAgent = AgentKind("codefly:service")
View Source
const ServiceConfigurationName = "service.codefly.yaml"
View Source
const ServiceConfigurationPrefix = "CODEFLY__SERVICE_CONFIGURATION"
View Source
const ServicePrefix = "CODEFLY__SERVICE"
View Source
const ServiceSecretConfigurationPrefix = "CODEFLY__SERVICE_SECRET_CONFIGURATION"
View Source
const VersionPrefix = "CODEFLY__SERVICE_VERSION"
View Source
const WorkspaceConfigurationName = "workspace.codefly.yaml"
View Source
const WorkspaceConfigurationPrefix = "CODEFLY__WORKSPACE_CONFIGURATION"
View Source
const WorkspacePrefix = "CODEFLY__WORKSPACE"
View Source
const WorkspaceSecretConfigurationPrefix = "CODEFLY__WORKSPACE_SECRET_CONFIGURATION"

#nosec G101

Variables

This section is empty.

Functions

func APIString

func APIString(api *basev0.API) string

func AgentBase added in v0.1.109

func AgentBase(ctx context.Context) string

func CodeflyDir

func CodeflyDir() string

CodeflyDir returns the directory where the Workspace configuration is stored

func 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 ConfigurationsHash

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

func ConvertHTTPMethodToProto

func ConvertHTTPMethodToProto(m HTTPMethod) basev0.HTTPMethod

func ConvertSpec

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

func ConvertToAnyPb

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

func EndpointAsEnvironmentVariableKey

func EndpointAsEnvironmentVariableKey(info *EndpointInformation) string

func EndpointAsEnvironmentVariableKeyBase

func EndpointAsEnvironmentVariableKeyBase(info *EndpointInformation) string

func EndpointDestination

func EndpointDestination(e *basev0.Endpoint) string

func EndpointHash

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

func EndpointRestAPI

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

func EnvironmentVariableAsStrings

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

func ExistsAtDir

func ExistsAtDir[C Configuration](dir string) bool

func ExtendDomain

func ExtendDomain(domain string, extension string) string

func ExtractConfiguration

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

func FilePathForGRPC

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

func FilePathForRest

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

func FilterConfigurations

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

func FindConfigDir added in v0.1.109

func FindConfigDir() (*string, error)

func FindConfigurationValue

func FindConfigurationValue(conf *basev0.Configuration, name string, key string) (string, error)

func FindConfigurations

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

func FindEndpointForGRPCRoute

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

FindEndpointForGRPCRoute finds the info that matches the route rpcs

func FindEndpointForRestRoute

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

FindEndpointForRestRoute finds the info that matches the route rpcs

func FindGRPCEndpoint

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

func FindHTTPEndpoint

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

func FindNetworkInstanceInNetworkMappings

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

func FindNetworkMapping

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

func FindRestEndpoint

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

func FindTCPEndpoint

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

func FindTCPEndpointWithName

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

func FindUp

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

FindUp looks for a configuration in the active directory and up

func FindValueInEnvironmentVariables

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

func FromAnyPb

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

func GetConfigurationValue

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

func GroupKey

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

func HasConfigurationInformation

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

func HasPublicEndpoints

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

func Hash

func Hash(data []byte) string

func HashString

func HashString(s string) string

func HomeDir

func HomeDir() (string, error)

func InPartialMode

func InPartialMode() bool

func Init

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

func IsGRPC

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

func IsHTTP

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

func IsLocal

func IsLocal(environment *basev0.Environment) bool

func IsRest

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

func IsTCP

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

func Light

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

func LightAPI

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

func LoadFromBytes

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

func LoadFromDir

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

func LoadFromFs

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

func LoadFromPath

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

func LoadGrpcAPI

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

func LoadHTTPAPI

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

func LoadRestAPI

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

func LoadSpec

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

func LoadTCPAPI

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

func LocalizeNetworkMapping

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

func MakeConfigurationInformationSummary

func MakeConfigurationInformationSummary(info *basev0.ConfigurationInformation) string

func MakeConfigurationSummary

func MakeConfigurationSummary(conf *basev0.Configuration) string

func MakeConfigurationValueSummary

func MakeConfigurationValueSummary(value *basev0.ConfigurationValue) string

func MakeDNSSummary

func MakeDNSSummary(dns *basev0.DNS) string

func MakeEndpointAccessSummary added in v0.1.93

func MakeEndpointAccessSummary(endointAccess *EndpointAccess) string

func MakeEndpointSummary

func MakeEndpointSummary(endpoint *basev0.Endpoint) string

func MakeManyConfigurationSummary

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

func MakeManyDNSSummary

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

func MakeManyEndpointAccessSummary added in v0.1.93

func MakeManyEndpointAccessSummary(endpointAccesses []*EndpointAccess) string

func MakeManyNetworkMappingSummary

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

func MakeManyServicesSummary

func MakeManyServicesSummary(services []*Service) 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 NameToKey

func NameToKey(name string) string

func NetworkAccessFromRuntimeContext

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

NetworkAccessFromRuntimeContext returns a NetworkAccess from a runtime instance

func NetworkInstanceSummary

func NetworkInstanceSummary(value *basev0.NetworkInstance) string

func NetworkMappingHash

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

func NewAPI

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

func NewContainerNetworkAccess

func NewContainerNetworkAccess() *basev0.NetworkAccess

func NewHTTPNetworkInstance

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

func NewNativeNetworkAccess

func NewNativeNetworkAccess() *basev0.NetworkAccess

func NewNetworkInstance

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

func NewPublicNetworkAccess

func NewPublicNetworkAccess() *basev0.NetworkAccess

func NewRuntimeContext

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

func NewRuntimeContextContainer

func NewRuntimeContextContainer() *basev0.RuntimeContext

func NewRuntimeContextFree

func NewRuntimeContextFree() *basev0.RuntimeContext

func NewRuntimeContextNative

func NewRuntimeContextNative() *basev0.RuntimeContext

func OverridePath

func OverridePath(defaultPath string, path string) *string

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

func ParseOpenAPI

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

func Path

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

func PortFromAddress

func PortFromAddress(address string) (uint16, error)

func ReferenceMatch

func ReferenceMatch(entry string, name string) bool

func RegisterAgent

func RegisterAgent(kind AgentKind, protoKind basev0.Agent_Kind)

func RestRouteEnvironmentVariableKey

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

func RestRoutes

func RestRoutes(rest *basev0.RestAPI) string

func RuntimeContextFromInstance

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

RuntimeContextFromInstance returns a runtime context from a network instance.

func RuntimeContexts

func RuntimeContexts() []string

func SaveToDir

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

func SerializeSpec

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

func ServiceConfigurationEnvironmentKeyPrefixFromUnique

func ServiceConfigurationEnvironmentKeyPrefixFromUnique(unique string) string

func ServiceConfigurationKey

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

func ServiceConfigurationKeyFromUnique

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

func ServiceSecretConfigurationEnvironmentKeyPrefixFromUnique

func ServiceSecretConfigurationEnvironmentKeyPrefixFromUnique(unique string) string

func ServiceSecretConfigurationKey

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

func ServiceSecretConfigurationKeyFromUnique

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

func ServiceUnique

func ServiceUnique(app string, service string) string

func ServiceUniqueFromEndpoint

func ServiceUniqueFromEndpoint(endpoint *basev0.Endpoint) string

func SetMode

func SetMode(m Mode)

func ToGrpcAPI

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

func ToHTTPAPI

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

func ToOrganizationName

func ToOrganizationName(svc string) string

func ToOrganizationSourceVersionControl

func ToOrganizationSourceVersionControl(name string) string

func ToRestAPI

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

func ToTCPAPI

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

func TypeName

func TypeName[C Configuration]() string

func UniqueToKey

func UniqueToKey(origin string) string

func ValidOrganization

func ValidOrganization(org *basev0.Organization) error

func Validate

func Validate(req proto.Message) error

func ValidateAgent

func ValidateAgent(agent *basev0.Agent) error

func ValidateDomain

func ValidateDomain()

func ValidateRuntimeContext added in v0.1.109

func ValidateRuntimeContext(rc string) error

Types

type Agent

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

func AgentFromProto

func AgentFromProto(agent *basev0.Agent) *Agent

func LoadAgent

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

func ParseAgent

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

func (*Agent) AsResource

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

func (*Agent) Identifier

func (p *Agent) Identifier() string

func (*Agent) IsService

func (p *Agent) IsService() bool

func (*Agent) Key

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

func (*Agent) Of

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

func (*Agent) Patch

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

func (*Agent) Path

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

func (*Agent) Proto

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

func (*Agent) String

func (p *Agent) String() string

func (*Agent) Unique

func (p *Agent) Unique() string

type AgentKind

type AgentKind string

func AgentKindFromProto

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

type ClientEntry

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

func (*ClientEntry) Validate

func (c *ClientEntry) Validate() error

type Configuration

type Configuration interface{}

type DockerImage

type DockerImage struct {
	Repository string
	Name       string
	Tag        string
}

func NewDockerImage

func NewDockerImage(s string) *DockerImage

func (*DockerImage) FullName

func (image *DockerImage) FullName() string

type Endpoint

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

Endpoint is the fundamental entity that standardize communication between services.

func EndpointFromProto

func EndpointFromProto(e *basev0.Endpoint) *Endpoint

func FromProtoEndpoints

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

func (*Endpoint) AsReference

func (endpoint *Endpoint) AsReference() *EndpointReference

func (*Endpoint) Information

func (endpoint *Endpoint) Information() *EndpointInformation

func (*Endpoint) Proto

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

func (*Endpoint) ServiceUnique

func (endpoint *Endpoint) ServiceUnique() string

func (*Endpoint) Unique

func (endpoint *Endpoint) Unique() string

type EndpointAccess

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

type EndpointInformation

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

func EndpointInformationFromProto

func EndpointInformationFromProto(endpoint *basev0.Endpoint) *EndpointInformation

func ParseEndpoint

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

func (*EndpointInformation) Identifier

func (endpoint *EndpointInformation) Identifier() string

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

func (*EndpointInformation) UnknownAPI

func (endpoint *EndpointInformation) UnknownAPI() bool

type EndpointReference

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

An EndpointReference

type EndpointSummary

type EndpointSummary struct {
	Count   int
	Uniques []string
}

func MakeManyEndpointSummary

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

type Environment

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

Environment is a configuration for an environment

func EnvironmentFromProto

func EnvironmentFromProto(env *basev0.Environment) *Environment

func LocalEnvironment

func LocalEnvironment() *Environment

LocalEnvironment is a local environment that is always available

func (*Environment) Local

func (env *Environment) Local() bool

func (*Environment) Proto

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

type EnvironmentExistsError

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

func (*EnvironmentExistsError) Error

func (err *EnvironmentExistsError) Error() string

type EnvironmentReference

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

An EnvironmentReference at the level

func (*EnvironmentReference) String

func (ref *EnvironmentReference) String() string

type EnvironmentVariable

type EnvironmentVariable struct {
	Key   string
	Value any
}

func AsRestRouteEnvironmentVariable

func AsRestRouteEnvironmentVariable(ctx context.Context, endpoint *basev0.Endpoint) []*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 EndpointAsEnvironmentVariable

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

func Env

func Env(key string, value any) *EnvironmentVariable

func EnvironmentAsEnvironmentVariable

func EnvironmentAsEnvironmentVariable(env *basev0.Environment) *EnvironmentVariable

func ModuleAsEnvironmentVariable

func ModuleAsEnvironmentVariable(module string) *EnvironmentVariable

func RestRoutesAsEnvironmentVariable

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

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(configurations ...*basev0.Configuration) error

func (*EnvironmentVariableManager) AddEndpoints

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

func (*EnvironmentVariableManager) AddRestRoutes

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

func (*EnvironmentVariableManager) All

func (*EnvironmentVariableManager) Configurations

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

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) 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 ExtendedGRPCRoute

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

	Extension T `yaml:"extension"`
}

func LoadExtendedGRPCRoute

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

func (*ExtendedGRPCRoute[T]) Save

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

type ExtendedGRPCRouteLoader

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

ExtendedGRPCRouteLoader will return all GRPC route groups in a directory

func NewExtendedGRPCRouteLoader

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

func (*ExtendedGRPCRouteLoader[T]) Add

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

func (*ExtendedGRPCRouteLoader[T]) All

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

func (*ExtendedGRPCRouteLoader[T]) Load

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

func (*ExtendedGRPCRouteLoader[T]) Save

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

type ExtendedRestRoute

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

	Extension T `yaml:"extension"`
}

func NewExtendedRestRoute

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

type ExtendedRestRouteGroup

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

func LoadExtendedRestRouteGroup

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

func (*ExtendedRestRouteGroup[T]) Add

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

func (*ExtendedRestRouteGroup[T]) Save

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

func (*ExtendedRestRouteGroup[T]) ServiceUnique

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

type ExtendedRouteLoader

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

ExtendedRouteLoader will return all rest route groups in a directory

func NewExtendedRestRouteLoader

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

func (*ExtendedRouteLoader[T]) AddGroup

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

func (*ExtendedRouteLoader[T]) All

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

func (*ExtendedRouteLoader[T]) GroupFor

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

func (*ExtendedRouteLoader[T]) Groups

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

func (*ExtendedRouteLoader[T]) GroupsFor

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

func (*ExtendedRouteLoader[T]) Load

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

func (*ExtendedRouteLoader[T]) Save

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

type FlatLayout

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

func NewFlatLayout

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

func (FlatLayout) ModulePath

func (f FlatLayout) ModulePath(string) string

func (FlatLayout) ModulesRoot

func (f FlatLayout) ModulesRoot() string

func (FlatLayout) ServicePath

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

func (FlatLayout) ServicesRoot

func (f FlatLayout) ServicesRoot(string) string

type Forwarding

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

type GRPCRoute

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

func DetectNewGRPCRoutesFromEndpoints

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

func GRPCRouteFromProto

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

func LoadGRPCRoute

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

func UnwrapGRPCRoute

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

func (*GRPCRoute) Delete

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

func (*GRPCRoute) Route

func (g *GRPCRoute) Route() string

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

func (*GRPCRoute) Save

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

func (*GRPCRoute) ServiceUnique

func (g *GRPCRoute) ServiceUnique() string

type GRPCRouteLoader

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

GRPCRouteLoader will return all GRPC route groups in a directory

func NewGRPCRouteLoader

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

func (*GRPCRouteLoader) All

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

func (*GRPCRouteLoader) Load

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

func (*GRPCRouteLoader) Save

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

type HTTPAPI

type HTTPAPI struct{}

func (*HTTPAPI) Proto

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

type HTTPMethod

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

func ConvertHTTPMethodFromProto

func ConvertHTTPMethodFromProto(m basev0.HTTPMethod) HTTPMethod

type Hasher

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

func NewHasher

func NewHasher() *Hasher

func (*Hasher) Add

func (h *Hasher) Add(s string)

func (*Hasher) Hash

func (h *Hasher) Hash() string

type Layout

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

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

func NewLayout

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

type LayoutKind

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

type Mode

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

type Module

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

	Description string `yaml:"description,omitempty"`

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

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

func LoadModuleFromDirUnsafe

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

func LoadModuleFromPath

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

LoadModuleFromPath loads an module from a path

func ReloadModule

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

func (*Module) AddServiceReference

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

func (*Module) DeleteService

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

DeleteService deletes a service from an module

func (*Module) DeleteServiceDependencies

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

func (*Module) Dir

func (mod *Module) Dir() string

Dir returns the directory of the module

func (*Module) ExistsService

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

ExistsService returns true if the service exists in the module

func (*Module) GetServiceReferences

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

func (*Module) LoadServiceFromName

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

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

func (*Module) LoadServiceFromReference

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

func (*Module) LoadServices

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

func (*Module) NewService

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

NewService creates a service in an module

func (*Module) Proto

func (mod *Module) Proto() *basev0.Module

func (*Module) PublicEndpoints

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

func (*Module) Reference

func (mod *Module) Reference() *ModuleReference

func (*Module) Save

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

func (*Module) SaveToDir

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

func (*Module) ServicePath

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

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

func (*Module) Unique

func (mod *Module) Unique() string

func (*Module) Validate

func (mod *Module) Validate() error

func (*Module) WithDir

func (mod *Module) WithDir(dir string)

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 ModulesLayout

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

func NewModulesLayout

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

func (ModulesLayout) ModulePath

func (f ModulesLayout) ModulePath(module string) string

func (ModulesLayout) ModulesRoot

func (f ModulesLayout) ModulesRoot() string

func (ModulesLayout) ServicePath

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

func (ModulesLayout) ServicesRoot

func (f ModulesLayout) ServicesRoot(module string) string

type NetworkInstance

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

func DefaultNetworkInstance

func DefaultNetworkInstance(api string) *NetworkInstance

func FindNetworkInstanceInEnvironmentVariables

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

func ParseAddress

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

type NewModuleInput

type NewModuleInput struct {
	Name string
}

type NoModuleError

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

func (NoModuleError) Error

func (e NoModuleError) Error() string

type NonUniqueServiceNameError

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

func (NonUniqueServiceNameError) Error

type OpenAPICombinator

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

func NewOpenAPICombinator

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

func (*OpenAPICombinator) Combine

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

func (*OpenAPICombinator) LoadEndpoints

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

func (*OpenAPICombinator) Only

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

func (*OpenAPICombinator) WithDestination

func (c *OpenAPICombinator) WithDestination(filename string)

func (*OpenAPICombinator) WithVersion

func (c *OpenAPICombinator) WithVersion(version string)

type Organization

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

	Name string `yaml:"name"`
}

func OrganizationFromProto

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

func (*Organization) Proto

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

type Readme

type Readme struct {
	Content string
}

type RestRoute

type RestRoute struct {
	Path   string
	Method HTTPMethod
}

func RestRouteFromProto

func RestRouteFromProto(r *basev0.RestRoute) *RestRoute

func UnwrapRestRoute

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

func (*RestRoute) Proto

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

type RestRouteAccess

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

func ExtractRestRoutes added in v0.1.95

func ExtractRestRoutes(ctx context.Context, mappings []*basev0.NetworkMapping, networkAccess *basev0.NetworkAccess) ([]*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

func LoadRestRouteGroup

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

func UnwrapRestRouteGroup

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

func (*RestRouteGroup) Delete

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

Delete a route

func (*RestRouteGroup) Save

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

func (*RestRouteGroup) ServiceUnique

func (g *RestRouteGroup) ServiceUnique() string

type RestRouteLoader

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

RestRouteLoader will return all rest route groups in a directory

func NewRestRouteLoader

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

func (*RestRouteLoader) All

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

func (*RestRouteLoader) GroupFor

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

func (*RestRouteLoader) Groups

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

func (*RestRouteLoader) GroupsFor

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

func (*RestRouteLoader) Load

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

type RouteUnique

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

func (RouteUnique) String

func (r RouteUnique) String() string

type RunningOptions

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

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

type Service

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

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

	Agent *Agent `yaml:"agent"`

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

	// Dependencies
	ConfigurationDependencies []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 LoadServiceFromDir

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

LoadServiceFromDir loads a service from a directory

func LoadServiceFromPath

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

LoadServiceFromPath loads an service from a path

func ReloadService

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

ReloadService from directory

func (*Service) AddDependency

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

AddDependency adds a dependency to the service

func (*Service) BaseEndpoint

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

func (*Service) DeleteServiceDependencies

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

func (*Service) Dir

func (s *Service) Dir() string

func (*Service) EndpointsFromNames

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

EndpointsFromNames return matching endpoints

func (*Service) ExistsDependency

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

func (*Service) HasEndpoints

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

func (*Service) Identity

func (s *Service) Identity() *ServiceIdentity

Identity is the proto version of Unique

func (*Service) LoadEndpoints

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

func (*Service) LoadSettingsFromSpec

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

func (*Service) Local

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

func (*Service) LocalOrNil

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

func (*Service) Proto

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

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 We use a REST like convention rather then a subdomain one

func (*Service) UniqueWithWorspace

func (s *Service) UniqueWithWorspace(workspace string) string

func (*Service) UpdateSpecFromSettings

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

func (*Service) Validate

func (s *Service) Validate() error

func (*Service) WithDir

func (s *Service) WithDir(dir string)

type ServiceDependency

type ServiceDependency struct {
	Name   string `yaml:"name"`
	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 ServiceForwarding

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

func (ServiceForwarding) Forward

func (s ServiceForwarding) Forward(r *RestRoute) (*RestRoute, 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) Clone

func (s *ServiceIdentity) Clone() *ServiceIdentity

func (*ServiceIdentity) Unique

func (s *ServiceIdentity) Unique() string

type ServiceReference

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

ServiceReference is a reference to a service used by Module configuration

func ParseServiceReference

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

func (*ServiceReference) String

func (ref *ServiceReference) String() string

type ServiceWithCase

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

func ToServiceWithCase

func ToServiceWithCase(svc *Service) *ServiceWithCase

type ServiceWithModule

type ServiceWithModule struct {
	Name   string
	Module string
}

func ParseServiceWithOptionalModule

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

func (ServiceWithModule) String

func (s ServiceWithModule) String() string

func (ServiceWithModule) Unique

func (s ServiceWithModule) Unique() string

type TCP

type TCP struct{}

func NewTCP

func NewTCP() (*TCP, error)

func (*TCP) Proto

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

type Visibility

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

type Workspace

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

	Description string `yaml:"description,omitempty"`

	Layout string `yaml:"layout"`

	// Modules in the Workspace
	Modules []*ModuleReference `yaml:"modules,omitempty"`
	// contains filtered or unexported fields
}

func CreateWorkspace

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

CreateWorkspace creates a new Workspace

func FindWorkspaceUp

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

func LoadWorkspaceFromDir

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

LoadWorkspaceFromDir loads a Workspace configuration from a directory

func NewWorkspace

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

func Reload

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

func (*Workspace) AddModuleReference

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

AddModuleReference adds an module to the

func (*Workspace) Clone

func (workspace *Workspace) Clone() *Workspace

Clone returns a copy of the workspace

func (*Workspace) DeleteModule

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

DeleteModule deletes an module from the

func (*Workspace) DeleteServiceDependencies

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

DeleteServiceDependencies deletes all service dependencies from a

func (*Workspace) Dir

func (workspace *Workspace) Dir() string

Dir is the directory of the

func (*Workspace) ExistsModule

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

ExistsModule returns true if the module exists in the

func (*Workspace) 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) LoadModuleFromName

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

LoadModuleFromName loads an module from a name

func (*Workspace) LoadModuleFromReference

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

LoadModuleFromReference loads an module from a reference

func (*Workspace) LoadModules

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

LoadModules returns the modules in the

func (*Workspace) LoadService

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

LoadService loads a service from a reference returns NotFoundError if not found

func (*Workspace) LoadServiceWithModules

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

func (*Workspace) LoadServices

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

func (*Workspace) ModulePath

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

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

func (*Workspace) ModulesNames

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

ModulesNames returns the names of the modules in the

func (*Workspace) NewModule

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

NewModule creates an module in a workspace

func (*Workspace) Proto

func (workspace *Workspace) Proto() (*basev0.Workspace, error)

func (*Workspace) RelativeDir added in v0.1.109

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

func (*Workspace) RootModule

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

RootModule only applies to Flat layout

func (*Workspace) Save

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

func (*Workspace) SaveToDirUnsafe

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

func (*Workspace) Valid

func (workspace *Workspace) Valid() error

Valid checks if the workspace is valid

func (*Workspace) WithDir

func (workspace *Workspace) WithDir(dir string)

WithDir sets the directory of the workspace

func (*Workspace) WithRootModule

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

WithRootModule creates the module in Flat layout

type WrapperSwagger

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

Jump to

Keyboard shortcuts

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