Documentation
¶
Index ¶
- Constants
- Variables
- func GetLatestBuildStatus(buildConditions []metav1.Condition) string
- type BuildPlaneService
- func (s *BuildPlaneService) GetBuildPlane(ctx context.Context, orgName string) (*openchoreov1alpha1.BuildPlane, error)
- func (s *BuildPlaneService) GetBuildPlaneClient(ctx context.Context, orgName string) (client.Client, error)
- func (s *BuildPlaneService) ListBuildPlanes(ctx context.Context, orgName string) ([]models.BuildPlaneResponse, error)
- type BuildService
- func (s *BuildService) ListBuildTemplates(ctx context.Context, orgName string) ([]models.BuildTemplateResponse, error)
- func (s *BuildService) ListBuilds(ctx context.Context, orgName, projectName, componentName string) ([]models.BuildResponse, error)
- func (s *BuildService) TriggerBuild(ctx context.Context, orgName, projectName, componentName, commit string) (*models.BuildResponse, error)
- type ComponentObserverResponse
- type ComponentService
- func (s *ComponentService) CreateComponent(ctx context.Context, orgName, projectName string, ...) (*models.ComponentResponse, error)
- func (s *ComponentService) CreateComponentWorkload(ctx context.Context, orgName, projectName, componentName string, ...) (*openchoreov1alpha1.WorkloadSpec, error)
- func (s *ComponentService) GetBuildObserverURL(ctx context.Context, orgName, projectName, componentName string) (*ComponentObserverResponse, error)
- func (s *ComponentService) GetComponent(ctx context.Context, orgName, projectName, componentName string, ...) (*models.ComponentResponse, error)
- func (s *ComponentService) GetComponentBinding(ctx context.Context, orgName, projectName, componentName, environment string) (*models.BindingResponse, error)
- func (s *ComponentService) GetComponentBindings(ctx context.Context, orgName, projectName, componentName string, ...) ([]*models.BindingResponse, error)
- func (s *ComponentService) GetComponentObserverURL(ctx context.Context, ...) (*ComponentObserverResponse, error)
- func (s *ComponentService) GetComponentWorkloads(ctx context.Context, orgName, projectName, componentName string) (interface{}, error)
- func (s *ComponentService) ListComponents(ctx context.Context, orgName, projectName string) ([]*models.ComponentResponse, error)
- func (s *ComponentService) PromoteComponent(ctx context.Context, req *PromoteComponentPayload) ([]*models.BindingResponse, error)
- func (s *ComponentService) UpdateComponentBinding(ctx context.Context, orgName, projectName, componentName, bindingName string, ...) (*models.BindingResponse, error)
- type ComponentSpecFetcher
- type ComponentSpecFetcherRegistry
- type DataPlaneService
- func (s *DataPlaneService) CreateDataPlane(ctx context.Context, orgName string, req *models.CreateDataPlaneRequest) (*models.DataPlaneResponse, error)
- func (s *DataPlaneService) GetDataPlane(ctx context.Context, orgName, dpName string) (*models.DataPlaneResponse, error)
- func (s *DataPlaneService) ListDataPlanes(ctx context.Context, orgName string) ([]*models.DataPlaneResponse, error)
- type DeploymentPipelineService
- type EnvironmentService
- func (s *EnvironmentService) CreateEnvironment(ctx context.Context, orgName string, req *models.CreateEnvironmentRequest) (*models.EnvironmentResponse, error)
- func (s *EnvironmentService) GetEnvironment(ctx context.Context, orgName, envName string) (*models.EnvironmentResponse, error)
- func (s *EnvironmentService) ListEnvironments(ctx context.Context, orgName string) ([]*models.EnvironmentResponse, error)
- type ObserverConnectionMethod
- type OrganizationService
- type ProjectService
- func (s *ProjectService) CreateProject(ctx context.Context, orgName string, req *models.CreateProjectRequest) (*models.ProjectResponse, error)
- func (s *ProjectService) GetProject(ctx context.Context, orgName, projectName string) (*models.ProjectResponse, error)
- func (s *ProjectService) ListProjects(ctx context.Context, orgName string) ([]*models.ProjectResponse, error)
- type PromoteComponentPayload
- type ServiceSpecFetcher
- type Services
- type WebApplicationSpecFetcher
- type WorkloadSpecFetcher
Constants ¶
const ( CodeProjectExists = "PROJECT_EXISTS" CodeProjectNotFound = "PROJECT_NOT_FOUND" CodeComponentExists = "COMPONENT_EXISTS" CodeComponentNotFound = "COMPONENT_NOT_FOUND" CodeOrganizationNotFound = "ORGANIZATION_NOT_FOUND" CodeEnvironmentNotFound = "ENVIRONMENT_NOT_FOUND" CodeEnvironmentExists = "ENVIRONMENT_EXISTS" CodeDataPlaneNotFound = "DATAPLANE_NOT_FOUND" CodeDataPlaneExists = "DATAPLANE_EXISTS" CodeBindingNotFound = "BINDING_NOT_FOUND" CodeDeploymentPipelineNotFound = "DEPLOYMENT_PIPELINE_NOT_FOUND" CodeInvalidPromotionPath = "INVALID_PROMOTION_PATH" CodeInvalidInput = "INVALID_INPUT" CodeInternalError = "INTERNAL_ERROR" )
Error codes for API responses
Variables ¶
var ( ErrProjectAlreadyExists = errors.New("project already exists") ErrProjectNotFound = errors.New("project not found") ErrComponentAlreadyExists = errors.New("component already exists") ErrComponentNotFound = errors.New("component not found") ErrOrganizationNotFound = errors.New("organization not found") ErrEnvironmentNotFound = errors.New("environment not found") ErrEnvironmentAlreadyExists = errors.New("environment already exists") ErrDataPlaneNotFound = errors.New("dataplane not found") ErrDataPlaneAlreadyExists = errors.New("dataplane already exists") ErrBindingNotFound = errors.New("binding not found") ErrDeploymentPipelineNotFound = errors.New("deployment pipeline not found") ErrInvalidPromotionPath = errors.New("invalid promotion path") )
Common service errors
Functions ¶
func GetLatestBuildStatus ¶
Types ¶
type BuildPlaneService ¶
type BuildPlaneService struct {
// contains filtered or unexported fields
}
BuildPlaneService handles build plane-related business logic
func NewBuildPlaneService ¶
func NewBuildPlaneService(k8sClient client.Client, bpClientMgr *kubernetesClient.KubeMultiClientManager, logger *slog.Logger) *BuildPlaneService
NewBuildPlaneService creates a new build plane service
func (*BuildPlaneService) GetBuildPlane ¶
func (s *BuildPlaneService) GetBuildPlane(ctx context.Context, orgName string) (*openchoreov1alpha1.BuildPlane, error)
GetBuildPlane retrieves the build plane for an organization
func (*BuildPlaneService) GetBuildPlaneClient ¶
func (s *BuildPlaneService) GetBuildPlaneClient(ctx context.Context, orgName string) (client.Client, error)
GetBuildPlaneClient creates and returns a Kubernetes client for the build plane cluster
func (*BuildPlaneService) ListBuildPlanes ¶
func (s *BuildPlaneService) ListBuildPlanes(ctx context.Context, orgName string) ([]models.BuildPlaneResponse, error)
ListBuildPlanes retrieves all build planes for an organization
type BuildService ¶
type BuildService struct {
// contains filtered or unexported fields
}
BuildService handles build-related business logic
func NewBuildService ¶
func NewBuildService(k8sClient client.Client, buildPlaneService *BuildPlaneService, bpClientMgr *kubernetesClient.KubeMultiClientManager, logger *slog.Logger) *BuildService
NewBuildService creates a new build service
func (*BuildService) ListBuildTemplates ¶
func (s *BuildService) ListBuildTemplates(ctx context.Context, orgName string) ([]models.BuildTemplateResponse, error)
ListBuildTemplates retrieves cluster workflow templates (argo) available for an organization in the buildplane
func (*BuildService) ListBuilds ¶
func (s *BuildService) ListBuilds(ctx context.Context, orgName, projectName, componentName string) ([]models.BuildResponse, error)
ListBuilds retrieves builds for a component using spec.owner fields instead of labels
func (*BuildService) TriggerBuild ¶
func (s *BuildService) TriggerBuild(ctx context.Context, orgName, projectName, componentName, commit string) (*models.BuildResponse, error)
TriggerBuild creates a new build from a component
type ComponentObserverResponse ¶
type ComponentObserverResponse struct {
ObserverURL string `json:"observerUrl,omitempty"`
ConnectionMethod *ObserverConnectionMethod `json:"connectionMethod,omitempty"`
Message string `json:"message,omitempty"`
}
ComponentObserverResponse represents the response for observer URL requests
type ComponentService ¶
type ComponentService struct {
// contains filtered or unexported fields
}
ComponentService handles component-related business logic
func NewComponentService ¶
func NewComponentService(k8sClient client.Client, projectService *ProjectService, logger *slog.Logger) *ComponentService
NewComponentService creates a new component service
func (*ComponentService) CreateComponent ¶
func (s *ComponentService) CreateComponent(ctx context.Context, orgName, projectName string, req *models.CreateComponentRequest) (*models.ComponentResponse, error)
CreateComponent creates a new component in the given project
func (*ComponentService) CreateComponentWorkload ¶
func (s *ComponentService) CreateComponentWorkload(ctx context.Context, orgName, projectName, componentName string, workloadSpec *openchoreov1alpha1.WorkloadSpec) (*openchoreov1alpha1.WorkloadSpec, error)
CreateComponentWorkload creates or updates workload data for a specific component
func (*ComponentService) GetBuildObserverURL ¶
func (s *ComponentService) GetBuildObserverURL(ctx context.Context, orgName, projectName, componentName string) (*ComponentObserverResponse, error)
GetBuildObserverURL retrieves the observer URL for component build logs
func (*ComponentService) GetComponent ¶
func (s *ComponentService) GetComponent(ctx context.Context, orgName, projectName, componentName string, additionalResources []string) (*models.ComponentResponse, error)
GetComponent retrieves a specific component
func (*ComponentService) GetComponentBinding ¶
func (s *ComponentService) GetComponentBinding(ctx context.Context, orgName, projectName, componentName, environment string) (*models.BindingResponse, error)
GetComponentBinding retrieves the binding for a component in a specific environment
func (*ComponentService) GetComponentBindings ¶
func (s *ComponentService) GetComponentBindings(ctx context.Context, orgName, projectName, componentName string, environments []string) ([]*models.BindingResponse, error)
GetComponentBindings retrieves bindings for a component in multiple environments If environments is empty, it will get all environments from the project's deployment pipeline
func (*ComponentService) GetComponentObserverURL ¶
func (s *ComponentService) GetComponentObserverURL(ctx context.Context, orgName, projectName, componentName, environmentName string) (*ComponentObserverResponse, error)
GetComponentObserverURL retrieves the observer URL for component runtime logs
func (*ComponentService) GetComponentWorkloads ¶
func (s *ComponentService) GetComponentWorkloads(ctx context.Context, orgName, projectName, componentName string) (interface{}, error)
GetComponentWorkloads retrieves workload data for a specific component
func (*ComponentService) ListComponents ¶
func (s *ComponentService) ListComponents(ctx context.Context, orgName, projectName string) ([]*models.ComponentResponse, error)
ListComponents lists all components in the given project
func (*ComponentService) PromoteComponent ¶
func (s *ComponentService) PromoteComponent(ctx context.Context, req *PromoteComponentPayload) ([]*models.BindingResponse, error)
PromoteComponent promotes a component from source environment to target environment
func (*ComponentService) UpdateComponentBinding ¶
func (s *ComponentService) UpdateComponentBinding(ctx context.Context, orgName, projectName, componentName, bindingName string, req *models.UpdateBindingRequest) (*models.BindingResponse, error)
UpdateComponentBinding updates a component binding
type ComponentSpecFetcher ¶
type ComponentSpecFetcher interface {
FetchSpec(ctx context.Context, k8sClient client.Client, namespace, componentName string) (interface{}, error)
GetTypeName() string
}
ComponentSpecFetcher interface for fetching component-specific specifications
type ComponentSpecFetcherRegistry ¶
type ComponentSpecFetcherRegistry struct {
// contains filtered or unexported fields
}
ComponentSpecFetcherRegistry manages all component spec fetchers
func NewComponentSpecFetcherRegistry ¶
func NewComponentSpecFetcherRegistry() *ComponentSpecFetcherRegistry
NewComponentSpecFetcherRegistry creates a new registry with all fetchers
func (*ComponentSpecFetcherRegistry) GetFetcher ¶
func (r *ComponentSpecFetcherRegistry) GetFetcher(typeName string) (ComponentSpecFetcher, bool)
GetFetcher retrieves a fetcher by type name
func (*ComponentSpecFetcherRegistry) Register ¶
func (r *ComponentSpecFetcherRegistry) Register(fetcher ComponentSpecFetcher)
Register adds a fetcher to the registry
type DataPlaneService ¶
type DataPlaneService struct {
// contains filtered or unexported fields
}
DataPlaneService handles dataplane-related business logic
func NewDataPlaneService ¶
func NewDataPlaneService(k8sClient client.Client, logger *slog.Logger) *DataPlaneService
NewDataPlaneService creates a new dataplane service
func (*DataPlaneService) CreateDataPlane ¶
func (s *DataPlaneService) CreateDataPlane(ctx context.Context, orgName string, req *models.CreateDataPlaneRequest) (*models.DataPlaneResponse, error)
CreateDataPlane creates a new dataplane
func (*DataPlaneService) GetDataPlane ¶
func (s *DataPlaneService) GetDataPlane(ctx context.Context, orgName, dpName string) (*models.DataPlaneResponse, error)
GetDataPlane retrieves a specific dataplane
func (*DataPlaneService) ListDataPlanes ¶
func (s *DataPlaneService) ListDataPlanes(ctx context.Context, orgName string) ([]*models.DataPlaneResponse, error)
ListDataPlanes lists all dataplanes in the specified organization
type DeploymentPipelineService ¶
type DeploymentPipelineService struct {
// contains filtered or unexported fields
}
DeploymentPipelineService handles deployment pipeline-related business logic
func NewDeploymentPipelineService ¶
func NewDeploymentPipelineService(k8sClient client.Client, projectService *ProjectService, logger *slog.Logger) *DeploymentPipelineService
NewDeploymentPipelineService creates a new deployment pipeline service
func (*DeploymentPipelineService) GetProjectDeploymentPipeline ¶
func (s *DeploymentPipelineService) GetProjectDeploymentPipeline(ctx context.Context, orgName, projectName string) (*models.DeploymentPipelineResponse, error)
GetProjectDeploymentPipeline retrieves the deployment pipeline for a given project
type EnvironmentService ¶
type EnvironmentService struct {
// contains filtered or unexported fields
}
EnvironmentService handles environment-related business logic
func NewEnvironmentService ¶
func NewEnvironmentService(k8sClient client.Client, logger *slog.Logger) *EnvironmentService
NewEnvironmentService creates a new environment service
func (*EnvironmentService) CreateEnvironment ¶
func (s *EnvironmentService) CreateEnvironment(ctx context.Context, orgName string, req *models.CreateEnvironmentRequest) (*models.EnvironmentResponse, error)
CreateEnvironment creates a new environment
func (*EnvironmentService) GetEnvironment ¶
func (s *EnvironmentService) GetEnvironment(ctx context.Context, orgName, envName string) (*models.EnvironmentResponse, error)
GetEnvironment retrieves a specific environment
func (*EnvironmentService) ListEnvironments ¶
func (s *EnvironmentService) ListEnvironments(ctx context.Context, orgName string) ([]*models.EnvironmentResponse, error)
ListEnvironments lists all environments in the specified organization
type ObserverConnectionMethod ¶
type ObserverConnectionMethod struct {
Type string `json:"type,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
BearerToken string `json:"bearerToken,omitempty"`
}
ObserverConnectionMethod contains the access method for the observer
type OrganizationService ¶
type OrganizationService struct {
// contains filtered or unexported fields
}
OrganizationService handles organization-related business logic
func NewOrganizationService ¶
func NewOrganizationService(k8sClient client.Client, logger *slog.Logger) *OrganizationService
NewOrganizationService creates a new organization service
func (*OrganizationService) GetOrganization ¶
func (s *OrganizationService) GetOrganization(ctx context.Context, orgName string) (*models.OrganizationResponse, error)
GetOrganization retrieves a specific organization
func (*OrganizationService) ListOrganizations ¶
func (s *OrganizationService) ListOrganizations(ctx context.Context) ([]*models.OrganizationResponse, error)
ListOrganizations lists all organizations
type ProjectService ¶
type ProjectService struct {
// contains filtered or unexported fields
}
ProjectService handles project-related business logic
func NewProjectService ¶
func NewProjectService(k8sClient client.Client, logger *slog.Logger) *ProjectService
NewProjectService creates a new project service
func (*ProjectService) CreateProject ¶
func (s *ProjectService) CreateProject(ctx context.Context, orgName string, req *models.CreateProjectRequest) (*models.ProjectResponse, error)
CreateProject creates a new project in the given organization
func (*ProjectService) GetProject ¶
func (s *ProjectService) GetProject(ctx context.Context, orgName, projectName string) (*models.ProjectResponse, error)
GetProject retrieves a specific project
func (*ProjectService) ListProjects ¶
func (s *ProjectService) ListProjects(ctx context.Context, orgName string) ([]*models.ProjectResponse, error)
ListProjects lists all projects in the given organization
type PromoteComponentPayload ¶
type PromoteComponentPayload struct {
models.PromoteComponentRequest
ComponentName string `json:"componentName"`
ProjectName string `json:"projectName"`
OrgName string `json:"orgName"`
}
type ServiceSpecFetcher ¶
type ServiceSpecFetcher struct{}
ServiceSpecFetcher fetches Service specifications
func (*ServiceSpecFetcher) GetTypeName ¶
func (f *ServiceSpecFetcher) GetTypeName() string
type Services ¶
type Services struct {
ProjectService *ProjectService
ComponentService *ComponentService
OrganizationService *OrganizationService
EnvironmentService *EnvironmentService
DataPlaneService *DataPlaneService
BuildService *BuildService
BuildPlaneService *BuildPlaneService
DeploymentPipelineService *DeploymentPipelineService
// contains filtered or unexported fields
}
func NewServices ¶
func NewServices(k8sClient client.Client, k8sBPClientMgr *kubernetesClient.KubeMultiClientManager, logger *slog.Logger) *Services
NewServices creates and initializes all services
func (*Services) GetKubernetesClient ¶
GetKubernetesClient returns the Kubernetes client for direct API operations
type WebApplicationSpecFetcher ¶
type WebApplicationSpecFetcher struct{}
WebApplicationSpecFetcher fetches WebApplication specifications
func (*WebApplicationSpecFetcher) GetTypeName ¶
func (f *WebApplicationSpecFetcher) GetTypeName() string
type WorkloadSpecFetcher ¶
type WorkloadSpecFetcher struct{}
func (*WorkloadSpecFetcher) GetTypeName ¶
func (f *WorkloadSpecFetcher) GetTypeName() string