const ( VNCReadWriteAuthRequired = "vnc_read_write_auth_required" VNCReadWriteAuthRequiredOverride = "vnc_read_write_auth_required_override" VNCReadAuthRequired = "vnc_read_auth_required" VNCReadAuthRequiredOverride = "vnc_read_auth_required_override" )
const ( // BslSitePath the request path to create a bsl site. BslSitePath = "/site/v1/sites" // BslSitePath the request path to delete a bsl site. BslUpdateSitePath = "/site/v1/sites/%s" // BslOrgPath the request path to get a bsl org. BslOrgPath = "/provisioning/organizations" // ActiveStatus active status for bsl site ActiveStatus = "ACTIVE" // InActiveStatus inactive status for bsl site InActiveStatus = "INACTIVE" // DefaultLatitude is the default latitude value used when a latitude is not provided. DefaultLatitude = 90.0 // DefaultLongitude is the default longitude value used when a longitude is not provided. DefaultLongitude = 180.0 )
const ( // config_key as expected in the db AcRelayKey = "ac_relay" PxeEnabledKey = "pxe_enabled" BootstrapAckKey = "bootstrap_ack" VpnEnabledKey = "vpn_enabled" ThickPosKey = "thick_pos" EgressGatewayEnabledKey = "egress_gateway_enabled" GatewayRateLimitingEnabledKey = "gateway_rate_limiting_enabled" UplinkRateLimitKey = "uplink_rate_limit" DownlinkRateLimitKey = "downlink_rate_limit" ClusterLogLevelKey = "cluster_log_level" NamespaceLogLevelsKey = "namespace_log_levels" AutoUpdateEnabledKey = "auto_update_enabled" MaximumLanOutageHoursKey = "maximum_lan_outage_hours" VncReadWriteAuthRequired = "vnc_read_write_auth_required" VncReadAuthRequired = "vnc_read_auth_required" )
const ( WIType = "wiUser" GenericType = "generic" )
const ( BspEnterpriseUnitPath = "/provisioning/enterprise-units" ProvisionedStatus = "PROVISIONED" ProvisioningStatusMessage = "Edge Provisioning" )
const ( // ComponentOwner is the default owner for operations carried out by bff. // More info here: https://docs.edge-infra.dev/rfc/0004-chariot-v2/#ownership ComponentOwner string = "api-server" )
const (
EdgeInjectableConfigmapAnnotation = "injector.edge.ncr.com/configmap"
)
const EdgeOwner = "edge"
const PlatformSecret = "platform"
const (
ResetPasswordWithTokenURLPath = "/provisioning/user-profiles/reset-password"
)
var ( ErrInvalidRateLimit = errors.New("invalid format for upload or download rate limits") ErrClusterEdgeIDEmpty = errors.New("cluster edge id cannot be empty") ErrInvalidMaximumLanOutageHours = errors.New("maximum lan outage duration must be at least 24 hours") )
var ( ErrMustForceClusterReset = errors.New("cluster cannot be reset without force being set to true") ErrCanOnlyResetStore = errors.New("only store clusters can be reset") ErrNoOptionalPalletLabels = errors.New("no optional pallet labels found in banner") )
var ( ErrClusterMissing = errors.New("cluster must be provided") ErrKindMissing = errors.New("kind must be provided") )
var ( ErrDuplicateTerminalDiskDevicePaths = errors.New("terminals cannot have disks with duplicate device paths") )
var ( ErrorDeleteHelmRepo = errors.New("helm repository cannot be deleted it has associated helm releases") )
func BuildClusterLabelQuery(queryString string, clusterEdgeID *string, labelEdgeID *string) (string, []interface{}, error)
func ConvertToHelmReleases(ctx context.Context, res []string) ([]helmApi.HelmRelease, error)
func CreateKustomizations(ctx context.Context, bucketName, clusterPath, storeVersion string) ([]string, error)
func GetContents(url string, username string, password string, file string, doNotParse bool) (*resty.Response, error)
func GetGroupsForUser(_ context.Context, client *bsl.Request, username string) ([]string, error)
func GetMockBspServer(testOrg, testOrgID, testUser, testUserRole, testEmail, testResetURL string) *httptest.Server
func NewBootstrapService(topLevelProjectID string, artifactRegistryClient clients.ArtifactRegistryClient, sqlDB *sql.DB) *bootstrapService
func NewChariotService(projectID, pubsubTopic string, opts ...option.ClientOption) *chariotService
func NewClusterConfigService(sqlDB *sql.DB) *clusterConfigService
func NewCompatibilityService(sqlDB *sql.DB) *compatibilityService
func NewEdgeAgentService(pubsubTopic string, opts ...option.ClientOption) *edgeAgentService
func NewGcpClientService() *gcpClientService
func NewGcpService(gcpClientService GcpClientService, topLevelProjectId string, bqClient clients.BQClient) *gcpService
func NewGkeClient(masterconfig string) (*gkeClient, error)
func NewHelmService(cfg *types.Config, chariotService ChariotService, gcpService GCPService, sqlDB *sql.DB, bqClient clients.BQClient, compatibilityService CompatibilityService) *helmService
func NewIAMSettingsService(sqlDB *sql.DB) *iamSettingService
func NewLabelService(artifactService artifacts.Service, sqlDB *sql.DB) *labelService
func NewLogClassificationLabelService(sqlDB *sql.DB) *logClassificationLabelsService
nolint
func NewLogClassificationService(sqlDB *sql.DB) *logClassificationService
nolint
func NewLogReplayService(sqlDB *sql.DB) *logReplayService
nolint
func NewNamespaceService(sqlDB *sql.DB) *namespaceService
func NewOperatorInterventionService(sqlDB *sql.DB) *operatorInterventionService
func NewRegistrationService(gkeService GkeClient, topLevelProjectId string, secretService SecretService, gcpService GCPService, bslSiteService BSLSiteService, iamService IAMService, sqlDB *sql.DB, chariotService ChariotService, terminalService TerminalService, activationCodeService edgenode.ActivationCode, clusterLabelSvc interfaces.ClusterLabelService, labelService LabelService) *registrationService
func NewSecretService(gkeService GkeClient, chariotService ChariotService, gcpService GCPService, bqClient clients.BQClient) *secretService
func NewStoreClusterService(gkeService GkeClient, bqClient clients.BQClient, sqlDB *sql.DB, chariotService ChariotService, terminalService TerminalService, compatibilityService CompatibilityService) *storeClusterService
func NewTenantService(sqlDB *sql.DB, bslClient *bsl.Client, bspConfig *types.BSPConfig) *tenantService
func NewVirtualMachineService(sqlDB *sql.DB) *virtualMachineService
func VerifyCoordinate(coordinate *float64, defaultCoordinate float64) float64
VerifyCoordinate checks the latitude or longitude value to ensure it is not nil,
if nil it sets a default value.
if the value is not nil it returns the initial value.
type ActivityService interface { GetActions(ctx context.Context, username *string, bannerEdgeID *string, clusterEdgeID *string, batchID *string, action *string, status *string, tenantEdgeID, cursor string, count int, previous bool) ([]*model.Action, int, error) CreateAction(ctx context.Context, action model.Action) error }
func NewActivityService(config *types.Config, sqlDB *sql.DB) ActivityService
type ArtifactRegistryService interface { // Retrieve the artifact registry entry with a given ID. GetArtifactRegistry(ctx context.Context, registryEdgeID string) (*model.ArtifactRegistry, error) // Retrieve all artifact registries entries for a given banner. GetArtifactRegistriesForBanner(ctx context.Context, bannerEdgeID string) ([]*model.ArtifactRegistry, error) // Retrieve all artifact registries entries for a given cluster. GetArtifactRegistriesForCluster(ctx context.Context, clusterEdgeID string) ([]*model.ArtifactRegistry, error) // Create a new artifact registry entry. CreateArtifactRegistryEntry(ctx context.Context, createArtifactRegistry *model.ArtifactRegistryCreateInput) (*model.ArtifactRegistry, error) // Update the artifact registry entry with a given ID. UpdateArtifactRegistryEntry(ctx context.Context, registryEdgeID string, updateArtifactRegistry *model.ArtifactRegistryUpdateInput) (*model.ArtifactRegistry, error) // Delete the artifact registry entry with a given ID. DeleteArtifactRegistryEntry(ctx context.Context, registryEdgeID string) (bool, error) // Retrieve the cluster artifact registry entry with a given ID. GetClusterArtifactRegistry(ctx context.Context, clusterRegistryEdgeID string) (*model.ClusterArtifactRegistry, error) // Retrieve all cluster artifact registries for a given cluster. GetClusterArtifactRegistries(ctx context.Context, clusterEdgeID string) ([]*model.ClusterArtifactRegistry, error) // Create a new cluster artifact registry entry. CreateClusterArtifactRegistryEntry(ctx context.Context, createClusterArtifactRegistry *model.ClusterArtifactRegistryCreateInput) (*model.ClusterArtifactRegistry, error) // Delete the cluster artifact registry entry with a given ID. DeleteClusterArtifactRegistryEntry(ctx context.Context, clusterRegistryEdgeID string) (bool, error) }
func NewArtifactRegistryService(sqlDB *sql.DB) ArtifactRegistryService
type BSLSiteService interface { CreateBSLSite(ctx context.Context, storeName, enterpriseUnitName, status string, latitude, longitude float64, clusterBanner *model.Banner, referenceID string) (*bsl.BSLInfo, error) GetOrCreateSite(ctx context.Context, storeInfo *model.StoreInfo, clusterBanner *model.Banner, storeName, clusterGUID string) (*bsl.BSLInfo, bool, error) UpdateBSLSiteByID(ctx context.Context, clusterBanner *model.Banner, siteID string, site model.Site) (*model.StoreSiteInfo, error) GetBSLSiteByID(ctx context.Context, siteID string, clusterBanner *model.Banner) (*bsl.BSLInfo, error) DeleteBSLSite(ctx context.Context, bslSite *bsl.BSLInfo, siteBanner *model.Banner) error DoesSiteHaveAttachedCluster(ctx context.Context, siteID string) (bool, error) }
func NewBSLSiteService(client *bsl.Client, sqlDB *sql.DB) BSLSiteService
NewBSLSiteService creates a new BSL Site Service.
type BannerConfigService interface { UpdateBannerConfig(ctx context.Context, bannerEdgeID string, bannerConfig *model.UpdateBannerConfig) (*model.BannerConfig, error) GetBannerConfig(ctx context.Context, bannerEdgeID string) (*model.BannerConfig, error) }
func NewBannerConfigService(sqlDB *sql.DB) BannerConfigService
type BannerService interface { GetBannerTenantInfo(ctx context.Context, orgName string) (*model.Tenant, error) GetBanners(ctx context.Context) ([]*model.Banner, error) GetBannerCRByID(ctx context.Context, id string) (*bannerv1alpha1.Banner, error) GetBanner(ctx context.Context, bannerEdgeID string) (*model.Banner, error) CheckBannerInBSL(ctx context.Context, bannerModel *model.Banner) (*model.Banner, error) CreateEUBanner(ctx context.Context, name string, description *string) (*model.Banner, error) CreateOrganizationBanner(ctx context.Context, name string, description *string) (*model.Banner, error) UndoCreateBanner(ctx context.Context, name, id, uuid, bannerObject string, isOrgBanner *bool, bucketPath string) error DeleteEUBanner(ctx context.Context, name, id string) (bool, error) DeleteOrgBanner(ctx context.Context, id string) (bool, error) AssignUserToEUBanners(ctx context.Context, username string, banners []string) error AssignUserToOrgBanners(ctx context.Context, username string, banners []*model.Banner) error GetUsersForEuBanner(ctx context.Context, organizationID string) ([]*model.User, error) GetBSLOrganization(ctx context.Context, organization string) (*bsl.BSLOrganization, error) GetUserAssignedBanners(ctx context.Context, username string) ([]*model.BannerInfo, error) CreateBannerCr(ctx context.Context, uuid, projectID, name, enterpriseUnitID string, enablements []string) (string, error) DeleteBannerSQLEntry(ctx context.Context, bannerUUID string) error CreateBannerSQLEntry(ctx context.Context, projectID, bannerName, bannerType, enterpriseUnitID, bannerUUID, description string) error GetBannerProjectID(ctx context.Context, bannerEdgeID string) (string, error) GetBannerTypeFromID(ctx context.Context, id string) (banner.Type, error) GetBannerTypeFromUUID(ctx context.Context, uuid string) (banner.Type, error) GetBannerByEdgeID(ctx context.Context, bannerUUID string) (*model.Banner, error) GetBannerByBSLID(ctx context.Context, bannerBSLID string) (*model.Banner, error) GetEdgeBannerInfo(ctx context.Context, banners []*model.Banner) []*model.Banner GetClusterInfraInfo(ctx context.Context, bannerEdgeID string) (*model.Cluster, error) GetBannerByNameAndTenant(ctx context.Context, name, orgName string) (*model.Banner, error) DeleteClusterSQLEntry(ctx context.Context, clusterEdgeID string) error GetBannerInfraInfo(ctx context.Context) (*model.Cluster, error) GetBannerInfraBucketPath(ctx context.Context) (string, error) UpdateBannerSQL(ctx context.Context, update *model.Banner) error UpdateEUBanner(ctx context.Context, update *model.Banner) error UpdateOrgBanner(ctx context.Context, update *model.Banner) error GetBSLEU(ctx context.Context, eu string) (*types.EnterpriseUnitData, error) UpdateBannerRemoteAccessIP(ctx context.Context, remoteAccessIP string, bannerEdgeID string) error GetBannerRemoteAccessIP(ctx context.Context, bannerEdgeID string) (string, error) GetBannerInfraStatus(ctx context.Context, bannerEdgeID string) (*model.BannerStatus, error) UpdateBannerEdgeSecurityCompliance(ctx context.Context, optInEdgeSecurityCompliance model.EdgeSecurityComplianceOptions, bannerEdgeID string) error }
func NewBannerService(gkeService GkeClient, chariotService ChariotService, bslClient *bsl.Client, project string, sqlDB *sql.DB, config *apiTypes.Config) BannerService
type BootstrapService interface { GetSAKeySecret(name, namespace, secretKey, saKey string) (string, error) GetManifests(ctx context.Context, clusterType string, pallets []types.Pallet, cluster *model.Cluster) ([]string, error) CreateClusterBootstrapTokenEntry(ctx context.Context, clusterEdgeID string, secretName string, expireAt time.Time) error GetClusterBootstrapTokens(ctx context.Context, clusterEdgeID string) ([]types.ClusterBootstrapToken, error) DeleteExpiredClusterBootstrapTokens(ctx context.Context, clusterEdgeID string) error }
type CABundleService interface { GetCABundle(ctx context.Context, bannerID string, topLevelProject string) (*model.CaBundle, error) }
func NewCABundleService(sqlDB *sql.DB, gcpClientService GcpClientService) CABundleService
type CapabilityService interface { // only used by edge platform components / infra CreateCapability(ctx context.Context, capability model.CapabilityInput) (*model.Capability, error) UpdateCapability(ctx context.Context, capability *model.CapabilityUpdateInput) error // used by users AddCapability(ctx context.Context, capMapping *model.CapabilityBannerMappingInput) error RemoveCapability(ctx context.Context, capMapping *model.CapabilityBannerMappingInput) error ListCapabilities(ctx context.Context) ([]*model.Capability, error) // todo switch to return list of capabilities ListCapabilitiesByBanner(ctx context.Context, bannerID *string) ([]*model.Capability, error) }
func NewCapabilityService(sqlDB *sql.DB, bannerService BannerService, chariotService ChariotService, foremanID string) CapabilityService
type ChariotService interface { InvokeChariotPubsub(ctx context.Context, chariotMessage *chariotClientApi.ChariotMessage, attributes map[string]string) error CheckClusterAndInvokeChariotPubsub(ctx context.Context, cluster *model.Cluster, chariotMessage *chariotClientApi.ChariotMessage, attributes map[string]string) error }
type ClusterConfigService interface { UpdateClusterConfig(ctx context.Context, clusterEdgeID string, updatedClusterConfig *model.UpdateClusterConfig) (*model.ClusterConfig, error) GetClusterConfig(ctx context.Context, clusterEdgeID string) (*model.ClusterConfig, error) }
type CompatibilityService interface { GetArtifactVersionCompatibility(ctx context.Context, artifact model.ArtifactVersion, compatibleArtifactName *string) (*model.ArtifactCompatibility, error) IsCompatible(ctx context.Context, primaryArtifact, secondaryArtifact model.ArtifactVersion) (bool, error) AddArtifactCompatibility(ctx context.Context, artifactCompatibility model.ArtifactCompatibilityPayload) (added bool, err error) DeleteArtifactCompatibility(ctx context.Context, artifactCompatibility model.ArtifactCompatibilityPayload) (deleted bool, err error) }
type EdgeAgentService interface { InvokeEdgeAgentPubsub(ctx context.Context, notificationMessage *edgeAgentClientApi.NotificationMessage, projectID string) error }
type ErrInvalidLogLevel struct { LogLevel string }
func (e *ErrInvalidLogLevel) Error() string
type GCPService interface { GetZones(ctx context.Context) ([]*string, error) GetGKEVersions(ctx context.Context, zone string) ([]*string, error) GetMachineTypes(ctx context.Context, zone string) ([]*model.MachineTypeInfo, error) AddSecret(ctx context.Context, name, owner, t string, secrets []*model.KeyValues, projectID string, workload *string, expireAt *time.Time) error GetMachineType(ctx context.Context, zone string, machineType string) (*model.MachineTypeInfo, error) GetSecrets(ctx context.Context, name *string, owner, t *string, getValues bool, projectID string) ([]*model.SecretManagerResponse, error) DeleteSecret(ctx context.Context, name string, projectID string) (bool, error) }
type GcpClientService interface { GetComputeClient(ctx context.Context, projectID string) (types.ComputeService, error) GetContainerClient(ctx context.Context, projectID string) (types.ContainerService, error) GetSecretClient(ctx context.Context, projectID string) (types.SecretManagerService, error) GetPubSubClient(ctx context.Context, projectID string) (types.PubSubService, error) }
type GkeClient interface { GetConfigForCluster(ctx context.Context, cluster *types.GkeCluster) (*rest.Config, error) GetRuntimeClient(ctx context.Context, cluster *types.GkeCluster) (client.WithWatch, error) }
type HelmService interface { UpdateHelmReleaseSQL(ctx context.Context, helmEdgeID string, version, configValues *string, injectConfigmaps []model.InjectableConfigmaps) error CreateHelmReleaseSQL(ctx context.Context, payload model.HelmReleasePayload, cluster *model.Cluster) error ValidateHelmConfig(config string, schema string) (bool, error) GetHelmCharts(ctx context.Context, secretName, projectID string) ([]*model.HelmChart, error) GetHelmChartVersion(ctx context.Context, name, secretName, projectID string) (*model.HelmChartResponse, error) DeleteHelmReleaseSQL(ctx context.Context, clusterEdgeID string) ([]string, error) SoftDeleteHelmReleaseSQL(ctx context.Context, helmEdgeID, name, clusterEdgeID *string) error GetDefaultConfigSchema(ctx context.Context, chartName string, secret string, chartVersion string, projectID string) (*model.HelmConfig, error) CreateBannerHelmRepository(ctx context.Context, name string, url string, secret *string, projectID string) error DeleteHelmRepo(ctx context.Context, name string, projectID string, bannerEdgeID string) error GetHelmRepositoryInfo(ctx context.Context, params model.HelmConfigSchemaParams, projectID string) (*model.HelmRepositoryInfo, error) GenerateHelmReleaseExternalSecrets(ctx context.Context, projectID string, namespace string, secrets []string) ([]*externalsecrets.ExternalSecret, error) SendExternalSecretToChariot(ctx context.Context, projectID, id string, externalSecrets []*externalsecrets.ExternalSecret) error GetHelmReleasesStatus(ctx context.Context, cluster *model.Cluster) ([]*model.HelmReleaseStatus, error) GetHelmWorkloadsByName(ctx context.Context, clusterEdgeID string, workloadName string) ([]*model.HelmWorkload, error) GetHelmWorkloads(ctx context.Context, clusterEdgeID *string, bannerEdgeID *string, all bool) ([]*model.HelmWorkload, error) GetHelmRepositoryIndex(repoURL string, username string, password string) (*repo.IndexFile, error) GetHelmWorkload(ctx context.Context, helmEdgeID, clusterEdgeID string) (*model.HelmWorkload, error) GetAttachedHelmSecrets(ctx context.Context, helmEdgeID *string) ([]*model.HelmSecrets, error) DeleteHelmSecrets(ctx context.Context, helmEdgeID string, deleteSecrets []string) (bool, error) GetSecretsByHelmEdgeID(ctx context.Context, helmEdgeID string) ([]string, error) AddHelmSecrets(ctx context.Context, helmEdgeID string, secretName []string) (bool, error) GetHelmStatus(ctx context.Context, clusterEdgeID, workloadName, workloadNamespace, helmChart, helmRepo, createdAt, updatedAt string, deleted *bool) (*model.HelmStatus, error) GetLabelsByHelmEdgeID(ctx context.Context, helmEdgeID string) ([]*model.Label, error) AddWorkloadLabel(ctx context.Context, helmEdgeID, newLabel string) (bool, error) AddWorkloadLabels(ctx context.Context, helmEdgeID string, newLabels []string) (bool, error) DeleteWorkloadLabel(ctx context.Context, helmEdgeID, deleteLabel string) (bool, error) DeleteWorkloadLabels(ctx context.Context, helmEdgeID string) (bool, error) DeleteWorkloadLabelByLabelEdgeID(ctx context.Context, deleteLabel string) (bool, error) GetHelmWorkloadConfigmaps(ctx context.Context, helmEdgeID string) ([]*model.HelmWorkloadConfigmaps, error) GetBannerByHelmEdgeID(ctx context.Context, helmEdgeID string) (*model.Banner, error) GetHelmRepoConnectionInfo(ctx context.Context, secretName string, projectID string) (string, string, string, error) GetHelmChartFromIndex(index *repo.IndexFile, chartName string, chartVersion string, username string, password string) (*chart.Chart, error) GetSoftDeletedHelmWorkloads(ctx context.Context, clusterEdgeID string) ([]*model.HelmWorkload, error) DeleteHelmReleaseByHelmEdgeID(ctx context.Context, helmEdgeID string) error }
type IAMRole struct {
// contains filtered or unexported fields
}
func NewIamRole(name string) IAMRole
func NewWIIamRole(name, ns, k8sSAName string) IAMRole
type IAMService interface { CreateServiceAccount(ctx context.Context, projectID, serviceAccountName, displayName, description string) (*iam.ServiceAccount, error) CreatePolicyBinding(ctx context.Context, serviceAccountProjectID, policyProjectID, serviceAccountName string, roles []IAMRole) (*cloudresourcemanager.Policy, error) CreateSAKey(ctx context.Context, projectID string, serviceAccount *iam.ServiceAccount) (*iam.ServiceAccountKey, error) CreateSAandSAKey(ctx context.Context, ProjectID, serviceAccountName, displayName, description string) (*edgeiam.Component, error) CreateOrUpdateEdgeIAM(ctx context.Context, serviceAccountProjectID, policyProjectID, serviceAccountName string, componentIAM *edgeiam.Component, roles []IAMRole) (*edgeiam.Component, error) }
func NewIAMService(opts ...option.ClientOption) IAMService
NewIAMService creates a new IAM Service.
type IAMSettingsService interface { CreateSettings(ctx context.Context, bannerID string, providerSettings model.ProviderInput) (*model.Provider, error) GetSettings(ctx context.Context, bannerID string) (*model.Provider, error) UpdateSettings(ctx context.Context, bannerID string, providerSettings model.ProviderInput) (*model.Provider, error) DeleteSettings(ctx context.Context, bannerID string) (*model.Provider, error) }
type LabelService interface { CreateLabel(ctx context.Context, label *model.LabelInput) error UpdateLabel(ctx context.Context, label *model.LabelUpdateInput) error GetLabels(ctx context.Context, bannerEdgeID *string) ([]*model.Label, error) GetLabelTypes(ctx context.Context, bannerEdgeID *string) ([]string, error) DeleteLabels(ctx context.Context, labelEdgeID string) error CreateClusterLabel(ctx context.Context, clusterEdgeID, labelEdgeID string) error CreateClusterLabels(ctx context.Context, clusterEdgeID string, labelEdgeIDs []string) error GetClusterLabels(ctx context.Context, clusterEdgeID, labelEdgeID *string) ([]*model.ClusterLabel, error) DeleteClusterLabels(ctx context.Context, clusterEdgeID, labelEdgeID *string) error GetEdgeClusterLabelKeys(ctx context.Context, clusterEdgeID string) ([]string, error) GetLabel(ctx context.Context, labelEdgeID string) (*model.Label, error) GetLabelTenant(ctx context.Context, labelEdgeID string) (*model.Tenant, error) }
type LogClassificationLabelsService interface { GetLogClassificationLabel(ctx context.Context, logClassificationLabelEdgeID string, logClassificationEdgeID string, labelEdgeID string) (*model.LogClassificationLabel, error) GetLogClassificationLabelsByLabel(ctx context.Context, labelEdgeID string) ([]*model.LogClassificationLabel, error) GetLogClassificationLabelsByBanner(ctx context.Context, bannerEdgeID string) ([]*model.LogClassificationLabel, error) CreateLogClassificationLabel(ctx context.Context, logClassificationLabelEdgeID string, logClassificationEdgeID string, labelEdgeID string) (string, error) UpdateLogClassificationLabel(ctx context.Context, logClassificationEdgeID string, labelEdgeID string) (string, error) DeleteLogClassificationLabel(ctx context.Context, logClassificationLabelEdgeID string, logClassificationEdgeID string, labelEdgeID string) (bool, error) }
type LogClassificationService interface { CreateLogClassification(ctx context.Context, bannerEdgeID string, logClassificationEdgeID string, newClusterConfig model.CreateClassificationInput) (*model.LogClassification, error) UpdateLogClassification(ctx context.Context, bannerEdgeID string, logClassificationEdgeID string, updatedClusterConfig *model.UpdateClassificationInput) (*model.LogClassification, error) GetLogClassification(ctx context.Context, bannerEdgeID string, logClassificationEdgeID string) (*model.LogClassification, error) DeleteLogClassification(ctx context.Context, bannerEdgeID string, logClassificationEdgeID string) (bool, error) GetLogClassificationsByBanner(ctx context.Context, bannerEdgeID string) ([]*model.LogClassification, error) }
type LogReplayService interface { GetLogReplay(ctx context.Context, logReplayID string) (*model.LogReplay, error) GetLogReplays(ctx context.Context, clusterEdgeID string, unexecutedLogReplays *bool) ([]*model.LogReplay, error) GetLogReplayJobs(ctx context.Context, clusterEdgeID string) ([]*model.LogReplayJob, error) CreateLogReplay(ctx context.Context, clusterEdgeID string, inputPayload model.CreateLogReplayPayload) (bool, error) UpdateLogReplay(ctx context.Context, logReplayID string, clusterEdgeID string, inputPayload model.UpdateLogReplayPayload) (bool, error) DeleteLogReplay(ctx context.Context, logReplayID string) (bool, error) }
type NamespaceService interface { CreateNamespaceEntry(ctx context.Context, createNamespace *model.NamespaceCreateInput) (*model.Namespace, error) DeleteNamespaceEntry(ctx context.Context, bannerEdgeID string, name string) error GetBannerNamespaces(ctx context.Context, bannerEdgeID string, name *string) ([]*model.Namespace, error) GetClusterNamespaces(ctx context.Context, clusterEdgeID string, name *string) ([]*model.Namespace, error) CreateDSDSKubeNamespaceCR(namespace *model.Namespace) (string, error) CreateClusterNamespaceEntry(ctx context.Context, transaction *sql.Tx, namespaceEdgeID string, clusterEdgeID string) error GetNumClustersUsingNamespace(ctx context.Context, namespaceEdgeID string) (int, error) GetClusterNamespaceEdgeID(ctx context.Context, transaction *sql.Tx, namespaceEdgeID string, clusterEdgeID string) (string, error) GetNamespaceName(ctx context.Context, namespaceEdgeID string) (string, error) }
type OperatorInterventionService interface { DeleteRoleMapping(ctx context.Context, mapping model.DeleteOperatorInterventionMappingInput) (*model.DeleteOperatorInterventionResponse, error) RoleMappings(ctx context.Context, roles []string) ([]*model.OiRoleMapping, error) UpdateRoleMappings(ctx context.Context, roleMappings []*model.UpdateOperatorInterventionRoleMappingInput) (*model.UpdateOperatorInterventionRoleMappingResponse, error) ReadPrivileges(ctx context.Context, names []*model.OperatorInterventionPrivilegeInput) ([]*model.Privilege, error) CreatePrivileges(ctx context.Context, input []*model.OperatorInterventionPrivilegeInput) (*model.CreateOperatorInterventionPrivilegeResponse, error) DeletePrivilege(ctx context.Context, payload model.OperatorInterventionPrivilegeInput) (*model.DeleteOperatorInterventionPrivilegeResponse, error) DeleteRule(ctx context.Context, payload model.DeleteOperatorInterventionRuleInput) (*model.DeleteOperatorInterventionRuleResponse, error) ReadRules(ctx context.Context, privileges []*model.OperatorInterventionPrivilegeInput) ([]*model.Rule, error) UpdateRules(ctx context.Context, rules []*model.UpdateOperatorInterventionRuleInput) (*model.UpdateOperatorInterventionRuleResponse, error) ReadCommands(ctx context.Context, payload []*model.OperatorInterventionCommandInput) ([]*model.Command, error) CreateCommands(ctx context.Context, mappings []*model.OperatorInterventionCommandInput) (*model.CreateOperatorInterventionCommandResponse, error) DeleteCommand(ctx context.Context, payload model.OperatorInterventionCommandInput) (*model.DeleteOperatorInterventionCommandResponse, error) }
type RegistrationService interface { IsClusterSQLEntryExist(ctx context.Context, clusterName, projectID string) (bool, error) CreateClusterSQLEntry(ctx context.Context, payload *model.RegistrationPayload, projectID, clusterGUID, siteID, bannerEdgeID string, active bool, location string) error UpdateClusterSQLEntry(ctx context.Context, active bool, clusterEdgeID string) error CreateAClusterCR(ctx context.Context, clusterType, name, projectID, fleet, organization, clusterEdgeID string, banner *model.Banner, gkeClusterSpec *model.ClusterInfo) (string, error) UploadClusterCaHash(ctx context.Context, clusterEdgeID, clusterCaHash string) error ClusterCaHash(ctx context.Context, clusterEdgeID string) (string, error) // Reset refreshes all activation codes for terminals in this cluster, and marks the cluster as in-active // Note: must be forced (i.e., force = true) as this is a destructive operation Reset(ctx context.Context, clusterEdgeID string, force bool) error }
type RoleService interface { AddRoleToUser(ctx context.Context, username, roleName string) error AddRoleToUserLegacy(ctx context.Context, org, username, roleName string) error RevokeRoleFromUser(ctx context.Context, username, roleName string) error IsOrgAdmin(roles []string) bool IsBannerAdmin(roles []string) bool GetEdgeGroupsForUserUser(ctx context.Context, username string) ([]string, error) RecoverPassword(ctx context.Context, username string, organization string) error }
func NewRoleService(BSPConfig types.BSPConfig, cl *bsl.Client) RoleService
type SecretService interface { CreateSecret(ctx context.Context, cluster *model.Cluster, name, namespace string, description *string, values []*model.KeyValues) (bool, error) GetSecrets(ctx context.Context, cluster *model.Cluster, namespace string, name *string) (*corev1.SecretList, error) DeleteSecret(ctx context.Context, cluster *model.Cluster, name, namespace string) (bool, error) GetClusterDefaultSecret(ctx context.Context, cluster *types.GkeCluster) (*corev1.Secret, error) CreateExternalSecret(ctx context.Context, projectID string, name string, namespace string, values []*model.KeyValues, cluster *model.Cluster, clusterInfra *model.Cluster, secretType corev1.SecretType, k8sSecretName string) error DeleteExternalSecret(ctx context.Context, name string, namespace string, projectID string, cluster *model.Cluster, clusterInfra *model.Cluster, k8sSecretName string) error }
type StoreClusterService interface { GetClusters(ctx context.Context, projectID string, labels []string) ([]*model.Cluster, error) GetClusterStatus(ctx context.Context, cluster *model.Cluster) (*model.ClusterStatusResponse, error) GetCluster(ctx context.Context, clusterEdgeID string) (*model.Cluster, error) DeleteStoreEntry(ctx context.Context, clusterEdgeID string) error GetClusterByNameAndProject(ctx context.Context, clusterName, projectID string) (*model.Cluster, error) GetClusterByClusterEdgeID(ctx context.Context, clusterEdgeID string) (types.Cluster, error) SoftDeleteStoreEntry(ctx context.Context, clusterEdgeID string) error GetClusterConfigmap(ctx context.Context, cluster *model.Cluster, configmapName, namespace string) (*corev1.ConfigMap, error) GetLabelsForCluster(ctx context.Context, clusterEdgeID string) ([]*model.Label, error) GetClusterNetworkServices(ctx context.Context, clusterEdgeID string) ([]*model.ClusterNetworkServiceInfo, error) GetClusterNetworkServiceByNetworkID(ctx context.Context, clusterEdgeID, networkServiceID string) (*model.ClusterNetworkServiceInfo, error) GetClusterK8sNetworkServices(ctx context.Context, clusterEdgeID string) (map[string]string, error) CreateClusterNetworkServices(ctx context.Context, clusterEdgeID string, networkServicesInfo []*model.CreateNetworkServiceInfo) ([]*model.ClusterNetworkServiceInfo, error) UpdateClusterNetworkServices(ctx context.Context, clusterEdgeID string, networkServicesInfo []*model.UpdateNetworkServiceInfo, existingServiceTypesByID map[string]string) ([]*model.ClusterNetworkServiceInfo, error) DeleteClusterNetworkService(ctx context.Context, clusterEdgeID string, networkServiceID string) (bool, error) UpdateStoreName(ctx context.Context, clusterEdgeID string, name string) error UpdateStoreSiteID(ctx context.Context, clusterEdgeID string, siteID string) error GetEventsForCluster(ctx context.Context, clusterEdgeID string) ([]*model.Event, error) GetActiveEdgeVersion(ctx context.Context, clusterEdgeID string) (string, error) GetInfraStatus(ctx context.Context, clusterEdgeID string) (*model.InfraStatus, error) GetCombinedClusterStatus(ctx context.Context, cluster *model.CombinedStatus) (*model.ClusterStatus, error) GetReplicationStatus(ctx context.Context, clusterEdgeID string) ([]*model.ReplicationStatus, error) GetClusterComponentsStatus(ctx context.Context, cluster *model.CombinedStatus) ([]*model.ComponentStatus, error) GetComponentStatus(ctx context.Context, clusterEdgeID, kind string, active bool) (*model.ClusterStatus, error) GetSupportStatus(ctx context.Context, cluster *model.CombinedStatus) (*model.SupportStatus, error) }
type TenantService interface { Create(ctx context.Context, input *model.TenantInput) (*model.Tenant, error) List(ctx context.Context) ([]*model.Tenant, error) Get(ctx context.Context, id string) (*model.Tenant, error) GetTenantByBannerID(ctx context.Context, id string) (*model.Tenant, error) GetTenantByClusterEdgeID(ctx context.Context, id string) (*model.Tenant, error) GetByName(ctx context.Context, name string) (*model.Tenant, error) GetOktaTenants(ctx context.Context, token string) ([]*model.Tenant, error) }
type TerminalLabelService interface { CreateTerminalLabel(context.Context, string, ...string) error GetTerminalLabel(context.Context, string) (*model.TerminalLabel, error) DeleteTerminalLabels(context.Context, model.SearchTerminalLabelInput) ([]*model.TerminalLabel, error) SendUpdatedIENCRAfterDeletion(context.Context, []*model.TerminalLabel) error GetTerminalLabels(context.Context, model.SearchTerminalLabelInput) ([]*model.TerminalLabel, error) GetTerminalLabelsInfo(ctx context.Context, terminals []*model.Terminal) ([]*model.Terminal, error) }
func NewTerminalLabelService(sqlDB *sql.DB, chariotSvc ChariotService, terminalSvc TerminalService, storeClusterSvc StoreClusterService, labelSvc LabelService) TerminalLabelService
type TerminalService interface { CreateTerminalEntry(ctx context.Context, newTerminal *model.TerminalCreateInput, activationCode crypto.Credential) (*model.Terminal, error) UpdateTerminalEntry(ctx context.Context, terminal *model.TerminalIDInput) (*model.Terminal, error) DeleteTerminalEntry(ctx context.Context, terminalID string) error CreateTerminalInterfaceEntry(ctx context.Context, terminalID string, newTerminalInterface *model.TerminalInterfaceCreateInput) (*model.TerminalInterface, error) UpdateTerminalInterfaceEntry(ctx context.Context, updatedInterface *model.TerminalInterfaceIDInput) (*model.TerminalInterface, error) DeleteTerminalInterfaceEntry(ctx context.Context, terminalInterfaceID string) (*model.Terminal, error) CreateTerminalAddressEntry(ctx context.Context, terminalInterfaceID string, newTerminalAddress *model.TerminalAddressCreateInput) (*model.TerminalAddress, error) UpdateTerminalAddressEntry(ctx context.Context, updatedAddress *model.TerminalAddressIDInput) (*model.TerminalAddress, error) DeleteTerminalAddressEntry(ctx context.Context, terminalAddressID string) (*model.Terminal, error) GetTerminal(ctx context.Context, terminalID string, getLabels *bool) (*model.Terminal, error) GetTerminals(ctx context.Context, clusterEdgeID *string, terminalHostname *string) ([]*model.Terminal, error) GetBannerTerminals(ctx context.Context, bannerEdgeID, projectID string) ([]*model.Terminal, error) CreateDSDSIENodeCR(terminal *model.Terminal, clusterNetworkServices []*model.ClusterNetworkServiceInfo, customLabels map[string]string, edgeVersion string) (string, error) CreateCICIENodeCR(terminal *model.Terminal, clusterNetworkServices []*model.ClusterNetworkServiceInfo, customLabels map[string]string, edgeVersion string) (string, error) GetTerminalFromInterface(ctx context.Context, terminalInterfaceID string) (*model.Terminal, error) GetTerminalFromAddress(ctx context.Context, terminalAddressID string) (*model.Terminal, error) GetTerminalBootstrapConfig(ctx context.Context, terminal *model.Terminal, clusterNetworkServices []*model.ClusterNetworkServiceInfo, breakGlassSecret, grubSecret cc.Secret, bootstrapAck, isFirstNode bool, organization string, bootstrapTokenValues []*model.KeyValues, clusterCaHash, endpoint string) (string, error) RemoveClusterEdgeBootstrapToken(ctx context.Context, clusterEdgeID string) error CreateTerminalDiskEntry(ctx context.Context, terminalID string, newTerminalDisk *model.TerminalDiskCreateInput) (*model.TerminalDisk, error) DeleteTerminalDiskEntry(ctx context.Context, terminalDiskID string) (*model.Terminal, error) UpdateTerminalDiskEntry(ctx context.Context, terminalDiskID string, updatedDisk model.TerminalDiskUpdateInput) (*model.TerminalDisk, error) GetTerminalFromDisk(ctx context.Context, terminalDiskID string) (*model.Terminal, error) GetTerminalNodeStatus(ctx context.Context, clusterEdgeID, terminalID, hostname string) (*model.TerminalStatus, error) GetNodeReplicationStatus(ctx context.Context, clusterEdgeID, hostname string) (*model.ReplicationStatus, error) GetTerminalsByClusterID(ctx context.Context, clusterEdgeID string) ([]*model.Terminal, error) TerminalDevices(ctx context.Context, terminalID string) (*model.TerminalDevices, error) }
func NewTerminalService(sqlDB *sql.DB, labelSvc LabelService) TerminalService
func NewTerminalServiceBQ(sqlDB *sql.DB, BQClient clients.BQClient, labelSvc LabelService) TerminalService
type UpdateSiteResponse struct { model.StoreSiteInfo Contacts map[string]model.Contact `json:"contacts"` }
type UserManagementService interface { Login(ctx context.Context, username, password, organization string) (*model.AuthPayload, error) Register(ctx context.Context, firstName, lastName, username, email, password, organization string) (string, error) TokenExchange(ctx context.Context, organization string, user *types.AuthUser, provider string) (string, error) GetUserProfile(ctx context.Context, token string) (*model.User, error) GetUsers(ctx context.Context) ([]*model.User, error) GetUsersForOrgBanner(ctx context.Context, bannerName string) ([]*model.User, error) Delete(ctx context.Context, username string) error ResetPassword(ctx context.Context, username, newPassword, organization string) error UpdateUserPasswordWithToken(ctx context.Context, token, organization, newPassword string) error WhoAmI(ctx context.Context, username, organization, token, provider string) (*model.User, error) UpdateUserProfile(ctx context.Context, user *model.UpdateUser) (*model.User, error) GetUser(ctx context.Context, username, organization, token, provider string) (*model.User, error) VerifyOktaToken(ctx context.Context, token string) (*okta.IntrospectionResponse, error) LoginWithOktaToken(ctx context.Context, token, refreshToken, organization string) (*model.OktaAuthPayload, error) GetSessionUserEdgeRoles(ctx context.Context, username, token, organization, authProvider string) ([]string, error) UserData(ctx context.Context, username string) (*model.UserData, error) }
func NewUserManagementService(config edgetypes.Config, client *bsl.Client, oktaClient *okta.Client, roleService RoleService, bannerService BannerService) UserManagementService
type VirtualMachineService interface { CreateVirtualMachineEntry(ctx context.Context, createVM *model.VirtualMachineCreateInput) (*model.VirtualMachine, string, error) DeleteVirtualMachineEntry(ctx context.Context, virtualMachineID string) error UpdateVirtualMachineEntry(ctx context.Context, updateVM *model.VirtualMachineIDInput) (*model.VirtualMachine, error) GetVirtualMachine(ctx context.Context, virtualMachineID string) (*model.VirtualMachine, error) GetVirtualMachines(ctx context.Context, clusterEdgeID *string, virtualMachineHostname *string) ([]*model.VirtualMachine, error) CreateVirtualMachineDiskEntries(ctx context.Context, virtualMachineID string, createDisks []*model.VirtualMachineDiskCreateInput) ([]*model.VirtualMachineDisk, error) DeleteVirtualMachineDiskEntry(ctx context.Context, diskID string) (*model.VirtualMachineDisk, error) UpdateVirtualMachineDiskEntries(ctx context.Context, updateDisks []*model.VirtualMachineDiskIDInput) ([]*model.VirtualMachineDisk, error) GetVirtualMachineDisk(ctx context.Context, diskID string) (*model.VirtualMachineDisk, error) GetVirtualMachineDisks(ctx context.Context, virtualMachineID string) ([]*model.VirtualMachineDisk, error) GetVirtualMachineFromDisk(ctx context.Context, diskID string) (*model.VirtualMachine, error) CreateDSDSKubeVirtualMachineCR(virtualMachine *model.VirtualMachine) (string, error) GetVirtualMachineWithDisks(ctx context.Context, virtualMachineID string) (*model.VirtualMachine, error) }