Documentation ¶
Index ¶
- Constants
- func CopySessionActors(session service.Session) service.Session
- func ErrorToServiceError(err error) service.CacaoError
- type Actor
- type Config
- type DeploymentRun
- type DeploymentRunFilter
- type DeploymentRunUpdate
- type DeploymentWorkflow
- type EventHandler
- type IncomingEvent
- type MiscConfig
- type OpenStackPreRequisiteTemplateParameterInjection
- type OpenStackProviderMetadata
- type OutgoingEvent
- type PreRequisiteTemplate
- type ProviderCredentialPair
- type ResponseEvent
- type WorkflowPurpose
Constants ¶
const DoNotSent common.EventType = "DoNotSentThis"
DoNotSent this constant is for event that should not be sent, but has to return an event
FIXME consider making return response event optional, not all cases have a valid response event.
const TerraformAWSDeploymentType service.TemplateTypeName = "aws_terraform"
TerraformAWSDeploymentType is a deployment type for Terraform template engine and AWS cloud provider
const TerraformOpenStackDeploymentType service.TemplateTypeName = "openstack_terraform"
TerraformOpenStackDeploymentType is a deployment type for Terraform template engine and OpenStack cloud provider
Variables ¶
This section is empty.
Functions ¶
func CopySessionActors ¶
CopySessionActors copies over the actor and emulator in Session.
func ErrorToServiceError ¶
func ErrorToServiceError(err error) service.CacaoError
ErrorToServiceError converts built-in error object into service error that can be transported in events.
Types ¶
type Actor ¶
Actor is the user that performs certain action. FIXME remove this alias, once migration is done
func ActorFromSession ¶
ActorFromSession construct Actor from service.Session
type Config ¶
type Config struct { MiscConfig MiscConfig Messaging messaging2.NatsStanMsgConfig // STAN config for AWM AWMStanConfig messaging2.NatsStanMsgConfig MongoConfig db.MongoDBConfig }
Config ...
type DeploymentRun ¶
type DeploymentRun struct { ID common.ID `bson:"_id"` Deployment common.ID `bson:"deployment"` TemplateType service.TemplateTypeName `bson:"template_type"` CreatedBy deploymentcommon.Creator `bson:",inline"` // transaction ID of the create run request CreateRunTID common.TransactionID `bson:"create_run_tid"` PrimaryProvider common.ID `bson:"primary_provider"` PrerequisiteTemplate deploymentcommon.TemplateSnapshot `bson:"prerequisite_template"` TemplateSnapshot deploymentcommon.TemplateSnapshot `bson:"template"` Parameters deploymentcommon.DeploymentParameters `bson:"parameters"` CloudCredentials deploymentcommon.ProviderCredentialMappings `bson:"cloud_creds"` GitCredential string `bson:"git_cred"` Status deploymentcommon.DeploymentRunStatus `bson:"status"` //StatusMsg string `bson:"status_msg"` StateUpdatedAt time.Time `bson:"state_updated_at"` TerraformState *deploymentcommon.TerraformState `bson:"tf_state"` }
DeploymentRun contains data relevant to preflight and execution stage of run. The difference between this definition of Run and the one used by Metadata service is that this one includes data that is specific to template-engine (Terraform) and cloud provider.
type DeploymentRunFilter ¶
type DeploymentRunFilter struct { ID common.ID `bson:"_id"` Deployment common.ID `bson:"deployment"` }
DeploymentRunFilter is filter for searching deployment run
func (DeploymentRunFilter) ToBSON ¶
func (filter DeploymentRunFilter) ToBSON() map[string]interface{}
ToBSON converts the filter into bson
type DeploymentRunUpdate ¶
type DeploymentRunUpdate struct { Status *deploymentcommon.DeploymentRunStatus `bson:"status"` StateUpdatedAt *time.Time `bson:"state_updated_at"` TerraformState *deploymentcommon.TerraformState `bson:"tf_state"` }
DeploymentRunUpdate is used for updating deployment run, it contains fields that can potentially be updated. All fields should be nullable(ptr or slice), so that fields that has nil value is not updated in storage.
func (DeploymentRunUpdate) ToBSON ¶
func (update DeploymentRunUpdate) ToBSON() map[string]interface{}
ToBSON converts the update struct to bson
type DeploymentWorkflow ¶
type DeploymentWorkflow struct { WorkflowName string `bson:"wf_name"` AWMProvider common.ID `bson:"provider"` Purpose WorkflowPurpose `bson:"purpose"` Deployment common.ID `bson:"deployment"` TemplateType service.TemplateTypeName `bson:"deployment_type"` Run common.ID `bson:"run"` CreatedAt time.Time `bson:"created_at"` EndedAt time.Time `bson:"ended_at"` Status string `bson:"status"` Logs *string `bson:"logs"` }
DeploymentWorkflow is record of workflow launched for a deployment run or any deployment actions. The unique index should be the combination of AWMProvider and WorkflowName.
type EventHandler ¶
type EventHandler interface {
Handle(IncomingEvent) ResponseEvent
}
EventHandler is handler for events
type IncomingEvent ¶
type IncomingEvent interface { EventType() common.EventType Transaction() common.TransactionID CloudEvent() cloudevents.Event }
IncomingEvent is a incoming event to be handled
type MiscConfig ¶
type MiscConfig struct { PodName string `envconfig:"POD_NAME"` LogLevel string `envconfig:"LOG_LEVEL" default:"trace"` // CACAO's public SSH key CacaoSSHKey string `envconfig:"CACAO_SSH_KEY"` // comma separated list, e.g. export CACAO_WHITELIST_CIDRS=127.0.0.1/24,8.8.8.8/32 WhitelistCIDRs []string `envconfig:"CACAO_WHITELIST_CIDRS"` LogsStorageBaseURL string `envconfig:"LOGS_STORAGE_BASE_URL"` LogsJWTKeyBase64 string `envconfig:"LOGS_JWT_KEY_BASE64"` }
MiscConfig are miscellaneous configurations that can be load from env var.
type OpenStackPreRequisiteTemplateParameterInjection ¶
type OpenStackPreRequisiteTemplateParameterInjection struct { Username string `json:"username" mapstructure:"username"` KeyPairName string `json:"keypair_name" mapstructure:"keypair_name"` PublicSSHKey string `json:"public_ssh_key" mapstructure:"public_ssh_key"` ExternalNetworkUUID string `json:"external_network_uuid" mapstructure:"external_network_uuid"` }
OpenStackPreRequisiteTemplateParameterInjection is parameters to be injected into PreRequisiteTemplateParameter for OpenStack provider.
type OpenStackProviderMetadata ¶
type OpenStackProviderMetadata struct { PreRequisiteTemplate PreRequisiteTemplate `json:"prerequisite_template" mapstructure:"prerequisite_template"` // public ssh key to be injected into instances PublicSSHKey string `json:"public_ssh_key" mapstructure:"public_ssh_key"` ExternalNetworkName string `json:"external_network_name" mapstructure:"external_network_name"` // OpenStack External Network UUID ExternalNetworkUUID string `json:"external_network_uuid" mapstructure:"external_network_uuid"` // a list of OpenStack subnets UUID that belongs to the external network ExternalSubnetUUIDs []string `json:"external_subnet_uuids" mapstructure:"external_subnet_uuids"` }
OpenStackProviderMetadata contains portions of provider metadata that deployment svc needs for OpenStack provider.
func (OpenStackProviderMetadata) Validate ¶
func (m OpenStackProviderMetadata) Validate() bool
Validate returns true if the metadata is valid.
type OutgoingEvent ¶
type OutgoingEvent interface { EventType() common.EventType Transaction() common.TransactionID ToCloudEvent(source string) (cloudevents.Event, error) }
OutgoingEvent is a outgoing event to be published
type PreRequisiteTemplate ¶
type PreRequisiteTemplate struct { TemplateID common.ID `json:"template_id" mapstructure:"template_id"` // This includes the parameter values that are static, e.g. specific to cloud provider; but not to users, or deployments. // param vals that are dynamic (e.g. username) will be injected at runtime. ParamValue service.DeploymentParameterValues `json:"param_value" mapstructure:"param_value"` }
PreRequisiteTemplate is the template that is the pre-requisite for deployments. Note: this is provider specific, thus specified by provider metadata.
type ProviderCredentialPair ¶
type ProviderCredentialPair struct { Provider common.ID Credential *service.CredentialModel }
ProviderCredentialPair is a cloud credential associated with a provider.
type ResponseEvent ¶
type ResponseEvent struct {
// contains filtered or unexported fields
}
ResponseEvent is response event
func NewDoNotSentEvent ¶
func NewDoNotSentEvent() ResponseEvent
NewDoNotSentEvent creates a dummy event that will not be sent
func NewEvent ¶
func NewEvent(eventType common.EventType, transaction common.TransactionID, event interface{}) ResponseEvent
NewEvent creates a new response event
func (ResponseEvent) EventType ¶
func (e ResponseEvent) EventType() common.EventType
EventType returns event type
func (ResponseEvent) ToCloudEvent ¶
func (e ResponseEvent) ToCloudEvent(source string) (cloudevents.Event, error)
ToCloudEvent converts event to cloudevent
func (ResponseEvent) Transaction ¶
func (e ResponseEvent) Transaction() common.TransactionID
Transaction ...
type WorkflowPurpose ¶
type WorkflowPurpose string
WorkflowPurpose is the purpose of which the workflow is intended to achieve
const ( // PreflightPurpose is a workflow launched during preflight stage, e.g. to apply prerequisite template. PreflightPurpose WorkflowPurpose = "preflight" // ExecutionPurpose is a workflow launched during execution stage, e.g. to execute the actual template. ExecutionPurpose WorkflowPurpose = "execution" // DeletionPurpose is a workflow launched to delete the resources provisioned by a deployment. DeletionPurpose WorkflowPurpose = "deletion" // PrerequisiteDeletionPurpose is a workflow launched to delete the resources provisioned by prerequisite template on the primary provider of a deployment. PrerequisiteDeletionPurpose WorkflowPurpose = "prerequisite_deletion" )