Documentation
¶
Index ¶
- type CreateServiceInput
- type MutateConfigInput
- type NeedsDeploymentResponse
- type ServiceRepository
- func (self *ServiceRepository) CountDomainCollisons(ctx context.Context, tx repository.TxInterface, domain string) (int, error)
- func (self *ServiceRepository) Create(ctx context.Context, tx repository.TxInterface, input *CreateServiceInput) (*ent.Service, error)
- func (self *ServiceRepository) CreateConfig(ctx context.Context, tx repository.TxInterface, input *MutateConfigInput) (*ent.ServiceConfig, error)
- func (self *ServiceRepository) Delete(ctx context.Context, tx repository.TxInterface, serviceID uuid.UUID) error
- func (self *ServiceRepository) GetByEnvironmentID(ctx context.Context, environmentID uuid.UUID, authPredicate predicate.Service, ...) ([]*ent.Service, error)
- func (self *ServiceRepository) GetByID(ctx context.Context, serviceID uuid.UUID) (svc *ent.Service, err error)
- func (self *ServiceRepository) GetByIDsAndEnvironment(ctx context.Context, serviceIDs []uuid.UUID, environmentID uuid.UUID) ([]*ent.Service, error)
- func (self *ServiceRepository) GetByInstallationIDAndRepoName(ctx context.Context, installationID int64, repoName string) ([]*ent.Service, error)
- func (self *ServiceRepository) GetByName(ctx context.Context, name string) (*ent.Service, error)
- func (self *ServiceRepository) GetDatabaseConfig(ctx context.Context, serviceID uuid.UUID) (*schema.DatabaseConfig, error)
- func (self *ServiceRepository) GetDatabaseType(ctx context.Context, serviceID uuid.UUID) (string, error)
- func (self *ServiceRepository) GetDatabases(ctx context.Context) ([]*ent.Service, error)
- func (self *ServiceRepository) GetDeploymentNamespace(ctx context.Context, serviceID uuid.UUID) (string, error)
- func (self *ServiceRepository) GetGithubPrivateKey(ctx context.Context, serviceID uuid.UUID) (string, error)
- func (self *ServiceRepository) GetPVCMountPaths(ctx context.Context, pvcs []*models.PVCInfo) (map[string]string, error)
- func (self *ServiceRepository) GetServicesUsingPVC(ctx context.Context, pvcID string) ([]*ent.Service, error)
- func (self *ServiceRepository) IsVolumeInUse(ctx context.Context, volumeName string) (bool, error)
- func (self *ServiceRepository) NeedsDeployment(ctx context.Context, service *ent.Service) (NeedsDeploymentResponse, error)
- func (self *ServiceRepository) SetCurrentDeployment(ctx context.Context, tx repository.TxInterface, serviceID uuid.UUID, ...) error
- func (self *ServiceRepository) SummarizeServices(ctx context.Context, environmentIDs []uuid.UUID) (counts map[uuid.UUID]int, icons map[uuid.UUID][]string, err error)
- func (self *ServiceRepository) Update(ctx context.Context, tx repository.TxInterface, serviceID uuid.UUID, ...) error
- func (self *ServiceRepository) UpdateConfig(ctx context.Context, tx repository.TxInterface, ...) error
- func (self *ServiceRepository) UpdateDatabaseStorageSize(ctx context.Context, tx repository.TxInterface, serviceID uuid.UUID, ...) (*schema.DatabaseConfig, error)
- func (self *ServiceRepository) UpdateVariableMounts(ctx context.Context, tx repository.TxInterface, serviceID uuid.UUID, ...) error
- type ServiceRepositoryInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateServiceInput ¶
type CreateServiceInput struct {
KubernetesName string
Name string
ServiceType schema.ServiceType
Description string
EnvironmentID uuid.UUID
GitHubInstallationID *int64
GitRepository *string
GitRepositoryOwner *string
KubernetesSecret string
Database *string
DatabaseVersion *string
TemplateID *uuid.UUID
TemplateInstanceID *uuid.UUID
ServiceGroupID *uuid.UUID
DetectedPorts []schema.PortSpec // This is used to store detected ports, not for creation
}
type MutateConfigInput ¶
type MutateConfigInput struct {
ServiceID uuid.UUID
Builder *schema.ServiceBuilder
Provider *enum.Provider
Framework *enum.Framework
GitBranch *string
GitTag *string
Icon *string
OverwritePorts []schema.PortSpec
AddPorts []schema.PortSpec
RemovePorts []schema.PortSpec
OverwriteHosts []schema.HostSpec
AddHosts []schema.HostSpec
RemoveHosts []schema.HostSpec
Replicas *int32
AutoDeploy *bool
RailpackBuilderInstallCommand *string
RailpackBuilderBuildCommand *string
RunCommand *string
Public *bool
Image *string
DockerBuilderDockerfilePath *string
DockerBuilderBuildContext *string
CustomDefinitionVersion *string
DatabaseConfig *schema.DatabaseConfig
S3BackupSourceID *uuid.UUID
S3BackupBucket *string
BackupSchedule *string
BackupRetentionCount *int
SecurityContext *schema.SecurityContext
HealthCheck *schema.HealthCheck
OverwriteVariableMounts []*schema.VariableMount
AddVariableMounts []*schema.VariableMount
RemoveVariableMounts []*schema.VariableMount
ProtectedVariables *[]string
OverwriteVolumes []schema.ServiceVolume
AddVolumes []schema.ServiceVolume
RemoveVolumes []schema.ServiceVolume
InitContainers []*schema.InitContainer
Resources *schema.Resources
}
Create the service config
type NeedsDeploymentResponse ¶
type NeedsDeploymentResponse string
See if a service needs a new deployment
const ( NeedsBuildAndDeployment NeedsDeploymentResponse = "needs_build_and_deployment" NeedsDeployment NeedsDeploymentResponse = "needs_deployment" NoDeploymentNeeded NeedsDeploymentResponse = "no_deployment_needed" )
type ServiceRepository ¶
type ServiceRepository struct {
// contains filtered or unexported fields
}
ServiceRepository handles service database operations
func NewServiceRepository ¶
func NewServiceRepository(db *ent.Client, deploymentRepo deployment_repo.DeploymentRepositoryInterface) *ServiceRepository
NewServiceRepository creates a new repository
func (*ServiceRepository) CountDomainCollisons ¶
func (self *ServiceRepository) CountDomainCollisons(ctx context.Context, tx repository.TxInterface, domain string) (int, error)
func (*ServiceRepository) Create ¶
func (self *ServiceRepository) Create( ctx context.Context, tx repository.TxInterface, input *CreateServiceInput, ) (*ent.Service, error)
Create the service
func (*ServiceRepository) CreateConfig ¶
func (self *ServiceRepository) CreateConfig( ctx context.Context, tx repository.TxInterface, input *MutateConfigInput, ) (*ent.ServiceConfig, error)
func (*ServiceRepository) Delete ¶
func (self *ServiceRepository) Delete(ctx context.Context, tx repository.TxInterface, serviceID uuid.UUID) error
func (*ServiceRepository) GetByEnvironmentID ¶
func (*ServiceRepository) GetByIDsAndEnvironment ¶
func (*ServiceRepository) GetByInstallationIDAndRepoName ¶
func (*ServiceRepository) GetDatabaseConfig ¶
func (self *ServiceRepository) GetDatabaseConfig(ctx context.Context, serviceID uuid.UUID) (*schema.DatabaseConfig, error)
Get database config for a service
func (*ServiceRepository) GetDatabaseType ¶
func (*ServiceRepository) GetDatabases ¶
func (*ServiceRepository) GetDeploymentNamespace ¶
func (*ServiceRepository) GetGithubPrivateKey ¶
func (*ServiceRepository) GetPVCMountPaths ¶
func (self *ServiceRepository) GetPVCMountPaths(ctx context.Context, pvcs []*models.PVCInfo) (map[string]string, error)
Get PVC mount paths by IDs
func (*ServiceRepository) GetServicesUsingPVC ¶
func (self *ServiceRepository) GetServicesUsingPVC(ctx context.Context, pvcID string) ([]*ent.Service, error)
Get services using a PVC
func (*ServiceRepository) IsVolumeInUse ¶
See if volume is in use
func (*ServiceRepository) NeedsDeployment ¶
func (self *ServiceRepository) NeedsDeployment(ctx context.Context, service *ent.Service) (NeedsDeploymentResponse, error)
func (*ServiceRepository) SetCurrentDeployment ¶
func (self *ServiceRepository) SetCurrentDeployment(ctx context.Context, tx repository.TxInterface, serviceID uuid.UUID, deploymentID uuid.UUID) error
func (*ServiceRepository) SummarizeServices ¶
func (self *ServiceRepository) SummarizeServices(ctx context.Context, environmentIDs []uuid.UUID) (counts map[uuid.UUID]int, icons map[uuid.UUID][]string, err error)
Summarize services in environment
func (*ServiceRepository) Update ¶
func (self *ServiceRepository) Update( ctx context.Context, tx repository.TxInterface, serviceID uuid.UUID, name *string, description *string, ) error
Update the service
func (*ServiceRepository) UpdateConfig ¶
func (self *ServiceRepository) UpdateConfig( ctx context.Context, tx repository.TxInterface, existingConfig *ent.ServiceConfig, input *MutateConfigInput, ) error
Update service config
func (*ServiceRepository) UpdateDatabaseStorageSize ¶
func (self *ServiceRepository) UpdateDatabaseStorageSize( ctx context.Context, tx repository.TxInterface, serviceID uuid.UUID, newSize string, ) (*schema.DatabaseConfig, error)
func (*ServiceRepository) UpdateVariableMounts ¶
func (self *ServiceRepository) UpdateVariableMounts(ctx context.Context, tx repository.TxInterface, serviceID uuid.UUID, variableMounts []*schema.VariableMount) error
type ServiceRepositoryInterface ¶
type ServiceRepositoryInterface interface {
// Create the service
Create(ctx context.Context, tx repository.TxInterface, input *CreateServiceInput) (*ent.Service, error)
CreateConfig(ctx context.Context, tx repository.TxInterface, input *MutateConfigInput) (*ent.ServiceConfig, error)
// Update the service
Update(ctx context.Context, tx repository.TxInterface, serviceID uuid.UUID, name *string, description *string) error
// Update service config
UpdateConfig(ctx context.Context, tx repository.TxInterface, existingConfig *ent.ServiceConfig, input *MutateConfigInput) error
Delete(ctx context.Context, tx repository.TxInterface, serviceID uuid.UUID) error
SetCurrentDeployment(ctx context.Context, tx repository.TxInterface, serviceID uuid.UUID, deploymentID uuid.UUID) error
UpdateVariableMounts(ctx context.Context, tx repository.TxInterface, serviceID uuid.UUID, variableMounts []*schema.VariableMount) error
UpdateDatabaseStorageSize(ctx context.Context, tx repository.TxInterface, serviceID uuid.UUID, newSize string) (*schema.DatabaseConfig, error)
GetByID(ctx context.Context, serviceID uuid.UUID) (svc *ent.Service, err error)
GetByIDsAndEnvironment(ctx context.Context, serviceIDs []uuid.UUID, environmentID uuid.UUID) ([]*ent.Service, error)
GetByName(ctx context.Context, name string) (*ent.Service, error)
GetDatabaseType(ctx context.Context, serviceID uuid.UUID) (string, error)
GetDatabases(ctx context.Context) ([]*ent.Service, error)
GetByInstallationIDAndRepoName(ctx context.Context, installationID int64, repoName string) ([]*ent.Service, error)
GetByEnvironmentID(ctx context.Context, environmentID uuid.UUID, authPredicate predicate.Service, withLatestDeployment bool) ([]*ent.Service, error)
GetGithubPrivateKey(ctx context.Context, serviceID uuid.UUID) (string, error)
CountDomainCollisons(ctx context.Context, tx repository.TxInterface, domain string) (int, error)
GetDeploymentNamespace(ctx context.Context, serviceID uuid.UUID) (string, error)
// Summarize services in environment
SummarizeServices(ctx context.Context, environmentIDs []uuid.UUID) (counts map[uuid.UUID]int, icons map[uuid.UUID][]string, err error)
NeedsDeployment(ctx context.Context, service *ent.Service) (NeedsDeploymentResponse, error)
// See if volume is in use
IsVolumeInUse(ctx context.Context, volumeName string) (bool, error)
// Get services using a PVC
GetServicesUsingPVC(ctx context.Context, pvcID string) ([]*ent.Service, error)
// Get PVC mount paths by IDs
GetPVCMountPaths(ctx context.Context, pvcs []*models.PVCInfo) (map[string]string, error)
// Get database config for a service
GetDatabaseConfig(ctx context.Context, serviceID uuid.UUID) (*schema.DatabaseConfig, error)
}
ServiceRepositoryInterface ...
Click to show internal directories.
Click to hide internal directories.