Documentation ¶
Index ¶
- type Action
- type ActionHandler
- type ActionId
- type ActionImplementation
- type ActionName
- type ActionRequest
- type ActionResponse
- type ActionStatus
- type ActionStatusCode
- type Application
- type ApplicationId
- type ApplicationName
- type Domain
- type DomainId
- type DomainName
- type ImplementationMode
- type MessageDesc
- type MessageId
- type MessageType
- type OrgId
- type OrgName
- type Organization
- type RequestMessageDesc
- type Resource
- type ResourceId
- type ResourceName
- type ResponseMessageDesc
- type Subject
- type SubjectId
- type System
- type SystemId
- type SystemName
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action interface { // Id Action id Id() ActionId // Name Action name must be unique within the scope of the resource Name() ActionName // ResourceId resource id ResourceId() ResourceId // SystemId refers to the system that the Action belongs to SystemId() SystemId // DomainId refers to the domain that the Action belongs to DomainId() DomainId // OrgId refers to the organization the Action belongs to OrgId() OrgId // Enabled is the Action enabled. // An Action can only be enabled / disabled by an owner in the organization hierarchy. Enabled() bool // MessageDescs defines the types of request-response messages that are supported by this action MessageDescs() []MessageDesc // Version is the resource action version. The purpose is to ensure the correct version is deployed. Version() *semver.Version }
Action represents any system Action. For example, it could represent a service, database, queue, etc.
type ActionHandler ¶
type ActionHandler interface {
Execute(ctx context.Context, request <-chan ActionRequest) <-chan ActionResponse
}
type ActionImplementation ¶
type ActionImplementation interface { Mode() ImplementationMode MetricOpts() *metrics.MetricOpts HealthChecks() comp.HealthChecks }
type ActionRequest ¶
type ActionRequest interface { // Id unique message id for tracking purposes Id() MessageId // Type message type Type() MessageType // Created when the message was created Created() time.Time // SubjectId who initiated the request SubjectId() SubjectId // MessageSequence is used when messages are streamed in a request. The message sequence starts at 1. MessageSequence() uint32 // FinalMessage is used to indicate that this is the final message in a stream. // For non-streamed messages, this will always be true FinalMessage() bool // Body the request message body // If the message fails parsing, then an error is returned. Body() (*capnp.Message, error) }
type ActionResponse ¶
type ActionResponse interface { // Id unique message id for tracking purposes Id() MessageId // RequestId correlates the response message to the request message RequestId() MessageId // Type message type Type() MessageType // Created when the message was created Created() time.Time // MessageSequence is used when messages are streamed in a request. The message sequence starts at 1. MessageSequence() uint32 // FinalMessage is used to indicate that this is the final message in a stream. // For non-streamed messages, this will always be true FinalMessage() bool // Body returns the response message payload. // If the action status indicates a failure, then there will be no body. // If the message fails parsing, then an error is returned. Body() (*capnp.Message, error) // Status reports if the request was successfully processed. Status() ActionStatus }
type ActionStatus ¶
type ActionStatus interface { Success() bool Code() ActionStatusCode Message() string }
ActionStatus reports the action request status
type Application ¶
type Application interface { // Id is the app id Id() ApplicationId // Name is the app name Name() ApplicationName // Version is the application version. The purpose is to ensure the correct version is deployed. Version() *semver.Version // OrgId is the owning organization OrgId() OrgId // CACert is an intermediate CA cert that is signed by the organization's CA cert. // It is used to issue client certs used to access the application CACert() tls.Certificate // ActionIds are the actions that are exposed via the app. ActionIds() []ActionId // Created is when the application was created Created() time.Time }
Application is used to package resource actions as an application. All who have access to the application have access to all of the app's resource actions.
type ApplicationName ¶
type ApplicationName string
ApplicationName must be unique within the owning organization
type Domain ¶
type Domain interface { // Id domain id Id() DomainId // Name domain name must be unique within the scope of the organization Name() DomainName // OrgId refers to the Organization this domain belongs to OrgId() OrgId // Created when the domain was created Created() time.Time // Enabled is the domain enabled. // A domain can only be enabled / disabled by an organization owner. Enabled() bool // Owners who own the domain // Domain owners have full control over the domain, except for disabling / enabling the domain. Owners() []SubjectId }
Domain owns and manages systems
type ImplementationMode ¶
type ImplementationMode uint8
ImplementationMode indicates the implementation mode
const ( // LOCAL means the action runs locally, i.e., within the same process // This means the server is running locally. LOCAL ImplementationMode = iota // NATSCLIENT means the action is invoked remotely via NATS, i.e., messages are sent to the server via NATS NATS_CLIENT // NATS_SERVER means the action is processing messages received via NATS NATS_SERVER )
type MessageDesc ¶
type MessageDesc interface { RequestMessageDesc() RequestMessageDesc ResponseMessageDesc() ResponseMessageDesc }
type MessageType ¶
type MessageType string
MessageType message type - used to communicate the message body type
type Organization ¶
type Organization interface { //Id org id Id() OrgId // Name org name is globally unique Name() OrgName // Created when the organization was created Created() time.Time // Enabled is the organization enabled Enabled() bool // Owners who own the organization // Owners have full control over the entire organization. Owners() []SubjectId // CACert is the organization CA Certificate that is used to create all certificates for the organization CACert() tls.Certificate }
Organization owns and manages domains and applications
type RequestMessageDesc ¶
type RequestMessageDesc interface { Type() MessageType Streaming() bool }
type Resource ¶
type Resource interface { // Id Resource id Id() ResourceId // Name Resource name must be unique within the scope of the system Name() ResourceName // Version is the resource version. The purpose is to ensure the correct version is deployed. Version() *semver.Version // SystemId refers to the system that the resource belongs to SystemId() SystemId // DomainId refers to the domain that the Resource belongs to DomainId() DomainId // OrgId refers to the organization the Resource belongs to OrgId() OrgId // Created when the domain was created Created() time.Time // Enabled is the Resource enabled. // A Resource can only be enabled / disabled by a domain owner or an organization owner. Enabled() bool // Owners who own the Resource Owners() []SubjectId }
Resource represents any system resource. For example, it could represent a service, database, queue, etc.
type ResponseMessageDesc ¶
type ResponseMessageDesc interface { Type() MessageType Streaming() bool // StatusCodes returns the possible status codes that can be returned on a response. StatusCodes() []ActionStatusCode }
type Subject ¶
type Subject interface { // Id subject id Id() SubjectId // OrgId the organization the subject belongs to OrgId() OrgId Created() time.Time // Enabled can only be changed by an organization owner Enabled() bool // Certificate which is signed by the organization's CA cert Cert() tls.Certificate }
Subject subject
type System ¶
type System interface { // Id system id Id() SystemId // Name system name must be unique within the scope of the domain Name() SystemName // DomainId refers to the domain that the system belongs to DomainId() DomainId // OrgId refers to the organization the system belongs to OrgId() OrgId // Created when the domain was created Created() time.Time // Enabled is the system enabled. // A system can only be enabled / disabled by a domain owner or an organization owner. Enabled() bool // Owners who own the system Owners() []SubjectId }
System owns and manages resources