applications

package
v0.0.0-...-3a2f251 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildApplicationManifest

func BuildApplicationManifest(application *models.Application, environment *models.Environment, db *database.MongoDB) (map[string]interface{}, error)

func GenerateRoutes

func GenerateRoutes(relativePath string, r *gin.Engine, appHandler *ApiHandler)

Types

type ApiHandler

type ApiHandler struct {
	MongoDB *database.MongoDB
	Config  *apiConfig.Config
}

func NewApiHandler

func NewApiHandler(config *apiConfig.Config, mongo *database.MongoDB) *ApiHandler

func (*ApiHandler) ComponentPods

func (a *ApiHandler) ComponentPods(c *gin.Context)

func (*ApiHandler) CreateApplication

func (a *ApiHandler) CreateApplication(c *gin.Context)

func (*ApiHandler) CreateComponent

func (a *ApiHandler) CreateComponent(c *gin.Context)

func (*ApiHandler) CreateEnvironment

func (a *ApiHandler) CreateEnvironment(c *gin.Context)

func (*ApiHandler) CreateOrganization

func (a *ApiHandler) CreateOrganization(c *gin.Context)

func (*ApiHandler) DeleteComponent

func (a *ApiHandler) DeleteComponent(c *gin.Context)

func (*ApiHandler) DeleteEnvironment

func (a *ApiHandler) DeleteEnvironment(c *gin.Context)

func (*ApiHandler) DeployApplication

func (a *ApiHandler) DeployApplication(c *gin.Context)

func (*ApiHandler) DetailApplication

func (a *ApiHandler) DetailApplication(c *gin.Context)

func (*ApiHandler) DetailComponent

func (a *ApiHandler) DetailComponent(c *gin.Context)

func (*ApiHandler) DetailOrganization

func (a *ApiHandler) DetailOrganization(c *gin.Context)

func (*ApiHandler) ListApplications

func (a *ApiHandler) ListApplications(c *gin.Context)

func (*ApiHandler) ListComponents

func (a *ApiHandler) ListComponents(c *gin.Context)

func (*ApiHandler) ListOrganization

func (a *ApiHandler) ListOrganization(c *gin.Context)

func (*ApiHandler) StatusApplication

func (a *ApiHandler) StatusApplication(c *gin.Context)

func (*ApiHandler) StatusComponent

func (a *ApiHandler) StatusComponent(c *gin.Context)

func (*ApiHandler) StatusComponentHealth

func (a *ApiHandler) StatusComponentHealth(c *gin.Context)

func (*ApiHandler) StreamLogs

func (a *ApiHandler) StreamLogs(c *gin.Context)

func (*ApiHandler) UpdateComponent

func (a *ApiHandler) UpdateComponent(c *gin.Context)

type ApplicationHandler

type ApplicationHandler struct {
	ID             string
	OrganizationID string
	Model          *models.Application
	DB             *database.MongoDB
}

func ListOrganizationApplications

func ListOrganizationApplications(organizationID string, db *database.MongoDB) ([]*ApplicationHandler, error)

func NewApplicationHandler

func NewApplicationHandler(db *database.MongoDB) (*ApplicationHandler, error)

func (*ApplicationHandler) GetApplicationByID

func (ah *ApplicationHandler) GetApplicationByID(appID string) error

func (*ApplicationHandler) Status

func (ah *ApplicationHandler) Status(environment *models.Environment) (ProviderStatus, error)

type ApplicationListResponse

type ApplicationListResponse struct {
	Organization OrganizationResponse  `json:"organization"`
	Applications []ApplicationResponse `json:"applications"`
}

type ApplicationResponse

type ApplicationResponse struct {
	*models.Application
	TotalComponents int64 `json:"total_components"`
}

type ApplicationStatus

type ApplicationStatus string

ApplicationStatus Indicate the current condition of the overall application

const (
	ApplicationStarting           ApplicationStatus = "starting"
	ApplicationRendering          ApplicationStatus = "rendering"
	ApplicationPolicyGenerating   ApplicationStatus = "generatingPolicy"
	ApplicationRunningWorkflow    ApplicationStatus = "runningWorkflow"
	ApplicationWorkflowSuspending ApplicationStatus = "workflowSuspending"
	ApplicationWorkflowTerminated ApplicationStatus = "workflowTerminated"
	ApplicationWorkflowFailed     ApplicationStatus = "workflowFailed"
	ApplicationRunning            ApplicationStatus = "running"
	ApplicationUnhealthy          ApplicationStatus = "unhealthy"
	ApplicationDeleting           ApplicationStatus = "deleting"
)

type ApplicationStatusResponse

type ApplicationStatusResponse struct {
	Status ApplicationStatus `json:"status"`
}

type ComponentListResponse

type ComponentListResponse struct {
	Components []ComponentResponse `json:"components"`
}

type ComponentPodsResponse

type ComponentPodsResponse struct {
	Pods []providers.Pod `json:"pods"`
}

type ComponentProperties

type ComponentProperties struct {
	NetworkProperties   *providers.NetworkProperties     `json:"network"`
	ResourcesProperties *providers.ResourcesProperties   `json:"resources"`
	StorageProperties   *providers.StorageProperties     `json:"storage"`
	SourceProperties    *providers.SourceProperties      `json:"source"`
	Health              *providers.ComponentStatusHealth `json:"health"`
}

type ComponentResponse

type ComponentResponse struct {
	*models.Component
}

type ComponentStatusResponse

type ComponentStatusResponse struct {
	Component  ComponentResponse   `json:"component"`
	Properties ComponentProperties `json:"properties"`
}

type CreateApplicationRequest

type CreateApplicationRequest struct {
	Name        string `json:"name" validate:"required"`
	Description string `json:"description"`
}

type CreateComponentRequest

type CreateComponentRequest struct {
	Name        string                   `json:"name" binding:"required"`
	Type        string                   `json:"type" binding:"required"`
	Description string                   `json:"description"`
	Settings    models.ComponentSettings `json:"settings"`
}

type CreateEnvironmentRequest

type CreateEnvironmentRequest struct {
	Name string `json:"name" validate:"required,regexp=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"` // TODO: Validate this field with a regex, current implementation doesn't work
}

type CreateOrganizationRequest

type CreateOrganizationRequest struct {
	Name string `json:"name" binding:"required"`
}

func (*CreateOrganizationRequest) ParseRequestToModel

func (r *CreateOrganizationRequest) ParseRequestToModel() *models.Organization

type EnvironmentListResponse

type EnvironmentListResponse struct {
	Environments []EnvironmentResponse `json:"environments"`
}

type EnvironmentResponse

type EnvironmentResponse struct {
	*models.Environment
}

type OrganizationListResponse

type OrganizationListResponse struct {
	Organizations []OrganizationResponse `json:"organizations"`
}

type OrganizationResponse

type OrganizationResponse struct {
	*models.Organization
}

type Properties

type Properties interface {
}

type ProviderDispatcher

type ProviderDispatcher interface {
	DeployApplication(manifest map[string]interface{}) error
	UpdateApplication(manifest map[string]interface{}) error
}

func NewProviderDispatcher

func NewProviderDispatcher(application *models.Application, environment *models.Environment) (ProviderDispatcher, error)

type ProviderStatus

type ProviderStatus interface {
	GetApplicationStatus() (string, error)
	GetNetworkProperties(componentName string) (*providers.NetworkProperties, error)
	GetResourcesProperties(componentName string) (*providers.ResourcesProperties, error)
	GetStorageProperties(componentName string) (*providers.StorageProperties, error)
	GetSourceProperties(componentName string) (*providers.SourceProperties, error)
	GetComponentStatus(componentName string) (*providers.ComponentStatusHealth, error)
	GetPodList(componentName string) ([]providers.Pod, error)
	StreamLogs(c context.Context, podName string, logStream *providers.LogStream, linesBuffer int)
}

func NewProviderStatus

func NewProviderStatus(application *models.Application, environment *models.Environment) (ProviderStatus, error)

type ProviderType

type ProviderType string
const (
	Vela ProviderType = "vela"
)

type ServiceComponentStatusResponse

type ServiceComponentStatusResponse struct {
	UpdatedReplicas      int32     `json:"updated_replicas"`
	ReadyReplicas        int32     `json:"ready_replicas"`
	AvailableReplicas    int32     `json:"available_replicas"`
	ConditionAvailable   string    `json:"condition_available"`
	ConditionProgressing string    `json:"condition_progressing"`
	Created              time.Time `json:"created"`
	Updated              time.Time `json:"updated"`
}

func (*ServiceComponentStatusResponse) FromClientsetToResponse

func (r *ServiceComponentStatusResponse) FromClientsetToResponse(deployment k8sV1.Deployment)

type Trait

type Trait struct {
	Name       string                 `json:"name"`
	Type       string                 `json:"type"`
	Properties map[string]interface{} `json:"properties"`
}

Jump to

Keyboard shortcuts

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