Documentation
¶
Index ¶
- Constants
- Variables
- func DataSourceNameFromType(dataSourceType DataSourceType) string
- func EnvSlug(env *Environment) string
- func FormatTemplate(template string, tokens map[string]string) (string, error)
- func GetBaseDatabaseName(databaseName, dbNameTemplate, labelsJSON string) (string, error)
- func GetDefaultPolicy(pType PolicyType) (string, error)
- func IssueSlug(issue *Issue) string
- func ProjectRawShortSlug(project *ProjectRaw) string
- func ProjectRawSlug(project *ProjectRaw) string
- func ProjectShortSlug(project *Project) string
- func ProjectSlug(project *Project) string
- func ProjectWebhookSlug(projectWebhook *ProjectWebhook) string
- func ValidatePolicy(pType PolicyType, payload string) error
- func ValidateProjectDBNameTemplate(template string) error
- func ValidateRepositoryFilePathTemplate(filePathTemplate string, tenantMode ProjectTenantMode) error
- func ValidateRepositorySchemaPathTemplate(schemaPathTemplate string, tenantMode ProjectTenantMode) error
- type Activity
- type ActivityCreate
- type ActivityDelete
- type ActivityFind
- type ActivityIssueCommentCreatePayload
- type ActivityIssueCreatePayload
- type ActivityIssueFieldUpdatePayload
- type ActivityIssueStatusUpdatePayload
- type ActivityLevel
- type ActivityMemberActivateDeactivatePayload
- type ActivityMemberCreatePayload
- type ActivityMemberRoleUpdatePayload
- type ActivityPatch
- type ActivityPipelineTaskEarliestAllowedTimeUpdatePayload
- type ActivityPipelineTaskFileCommitPayload
- type ActivityPipelineTaskStatementUpdatePayload
- type ActivityPipelineTaskStatusUpdatePayload
- type ActivityProjectDatabaseTransferPayload
- type ActivityProjectRepositoryPushPayload
- type ActivitySQLEditorQueryPayload
- type ActivityService
- type ActivityType
- type Anomaly
- type AnomalyArchive
- type AnomalyDatabaseBackupMissingPayload
- type AnomalyDatabaseBackupPolicyViolationPayload
- type AnomalyDatabaseConnectionPayload
- type AnomalyDatabaseSchemaDriftPayload
- type AnomalyFind
- type AnomalyInstanceConnectionPayload
- type AnomalyService
- type AnomalySeverity
- type AnomalyType
- type AnomalyUpsert
- type AuthProvider
- type Backup
- type BackupCreate
- type BackupFind
- type BackupPatch
- type BackupPlanPolicy
- type BackupPlanPolicySchedule
- type BackupService
- type BackupSetting
- type BackupSettingFind
- type BackupSettingUpsert
- type BackupSettingsMatch
- type BackupStatus
- type BackupStorageBackend
- type BackupType
- type Bookmark
- type BookmarkCreate
- type BookmarkDelete
- type BookmarkFind
- type BookmarkService
- type CacheNamespace
- type CacheService
- type Column
- type ColumnCreate
- type ColumnFind
- type ColumnPatch
- type ColumnService
- type ConnectionInfo
- type CreateDatabaseContext
- type DataSource
- type DataSourceCreate
- type DataSourceFind
- type DataSourcePatch
- type DataSourceService
- type DataSourceType
- type Database
- type DatabaseCreate
- type DatabaseFind
- type DatabaseLabel
- type DatabaseLabelFind
- type DatabaseLabelUpsert
- type DatabasePatch
- type DatabaseService
- type Debug
- type DebugPatch
- type Deployment
- type DeploymentConfig
- type DeploymentConfigFind
- type DeploymentConfigService
- type DeploymentConfigUpsert
- type DeploymentSchedule
- type DeploymentSpec
- type Environment
- type EnvironmentCreate
- type EnvironmentDelete
- type EnvironmentFind
- type EnvironmentPatch
- type EnvironmentService
- type FeatureType
- type GitlabLogin
- type Inbox
- type InboxCreate
- type InboxFind
- type InboxPatch
- type InboxService
- type InboxStatus
- type InboxSummary
- type Index
- type IndexCreate
- type IndexFind
- type IndexService
- type Instance
- type InstanceCreate
- type InstanceFind
- type InstanceMigration
- type InstanceMigrationSchemaStatus
- type InstancePatch
- type InstanceService
- type InstanceUser
- type InstanceUserDelete
- type InstanceUserFind
- type InstanceUserService
- type InstanceUserUpsert
- type Issue
- type IssueCreate
- type IssueFieldID
- type IssueFind
- type IssuePatch
- type IssueService
- type IssueStatus
- type IssueStatusPatch
- type IssueSubscriber
- type IssueSubscriberCreate
- type IssueSubscriberDelete
- type IssueSubscriberFind
- type IssueSubscriberService
- type IssueType
- type LabelKey
- type LabelKeyFind
- type LabelKeyPatch
- type LabelSelector
- type LabelSelectorRequirement
- type LabelService
- type Login
- type Member
- type MemberCreate
- type MemberFind
- type MemberPatch
- type MemberService
- type MemberStatus
- type MigrationHistory
- type OperatorType
- type Pipeline
- type PipelineApprovalPolicy
- type PipelineApprovalValue
- type PipelineCreate
- type PipelineFind
- type PipelinePatch
- type PipelineService
- type PipelineStatus
- type Plan
- type PlanPatch
- type PlanType
- type Policy
- type PolicyFind
- type PolicyService
- type PolicyType
- type PolicyUpsert
- type Principal
- type PrincipalAuthProvider
- type PrincipalCreate
- type PrincipalFind
- type PrincipalPatch
- type PrincipalService
- type PrincipalType
- type Project
- type ProjectCreate
- type ProjectFind
- type ProjectMember
- type ProjectMemberBatchUpdate
- type ProjectMemberCreate
- type ProjectMemberDelete
- type ProjectMemberFind
- type ProjectMemberPatch
- type ProjectMemberService
- type ProjectPatch
- type ProjectRaw
- type ProjectRoleProvider
- type ProjectRoleProviderPayload
- type ProjectService
- type ProjectTenantMode
- type ProjectVisibility
- type ProjectWebhook
- type ProjectWebhookCreate
- type ProjectWebhookDelete
- type ProjectWebhookFind
- type ProjectWebhookPatch
- type ProjectWebhookService
- type ProjectWebhookTestResult
- type ProjectWorkflowType
- type Repository
- type RepositoryCreate
- type RepositoryDelete
- type RepositoryFind
- type RepositoryPatch
- type RepositoryService
- type Role
- type RowStatus
- type SQLExecute
- type SQLResultSet
- type SQLService
- type SQLSyncSchema
- type ServerInfo
- type Setting
- type SettingCreate
- type SettingFind
- type SettingName
- type SettingPatch
- type SettingService
- type Sheet
- type SheetCreate
- type SheetDelete
- type SheetFind
- type SheetPatch
- type SheetService
- type SheetVisibility
- type Signup
- type Stage
- type StageCreate
- type StageFind
- type StageService
- type SyncStatus
- type Table
- type TableCreate
- type TableDelete
- type TableFind
- type TableService
- type Task
- type TaskCheckDatabaseStatementAdvisePayload
- type TaskCheckEarliestAllowedTimePayload
- type TaskCheckResult
- type TaskCheckRun
- type TaskCheckRunCreate
- type TaskCheckRunFind
- type TaskCheckRunResultPayload
- type TaskCheckRunService
- type TaskCheckRunStatus
- type TaskCheckRunStatusPatch
- type TaskCheckStatus
- type TaskCheckType
- type TaskCreate
- type TaskDatabaseBackupPayload
- type TaskDatabaseCreatePayload
- type TaskDatabaseDataUpdatePayload
- type TaskDatabaseRestorePayload
- type TaskDatabaseSchemaUpdatePayload
- type TaskFind
- type TaskPatch
- type TaskRun
- type TaskRunCreate
- type TaskRunFind
- type TaskRunResultPayload
- type TaskRunService
- type TaskRunStatus
- type TaskRunStatusPatch
- type TaskService
- type TaskStatus
- type TaskStatusPatch
- type TaskType
- type UpdateSchemaContext
- type UpdateSchemaDetail
- type VCS
- type VCSCreate
- type VCSDelete
- type VCSFind
- type VCSPatch
- type VCSRaw
- type VCSService
- type View
- type ViewCreate
- type ViewDelete
- type ViewFind
- type ViewService
Constants ¶
const ( // AdminDataSourceName is the name for administrative data source. AdminDataSourceName = "Admin data source" // ReadWriteDataSourceName is the name for read/write data source. ReadWriteDataSourceName = "Read/Write data source" // ReadOnlyDataSourceName is the name for read-only data source. ReadOnlyDataSourceName = "ReadOnly data source" // UnknownDataSourceName is the name for unknown data source. UnknownDataSourceName = "Unknown data source" )
const ( // AllDatabaseName is the wild expression for all databases. AllDatabaseName = "*" // DefaultCharactorSetName is the default charactor set. DefaultCharactorSetName = "utf8mb4" // DefaultCollationName is the default collation name. // Use utf8mb4_general_ci instead of the new MySQL 8.0.1 default utf8mb4_0900_ai_ci // because the former is compatible with more other MySQL flavors (e.g. MariaDB) DefaultCollationName = "utf8mb4_general_ci" )
const ( // EnvironmentKeyName is the reserved key for environment. EnvironmentKeyName string = "bb.environment" // DatabaseLabelSizeMax is the maximium size of database labels. DatabaseLabelSizeMax = 4 // LocationLabelKey is the label key for location LocationLabelKey = "bb.location" // TenantLabelKey is the label key for tenant TenantLabelKey = "bb.tenant" )
const ( // PolicyTypePipelineApproval is the approval policy type. PolicyTypePipelineApproval PolicyType = "bb.policy.pipeline-approval" // PolicyTypeBackupPlan is the backup plan policy type. PolicyTypeBackupPlan PolicyType = "bb.policy.backup-plan" // PipelineApprovalValueManualNever is MANUAL_APPROVAL_NEVER approval policy value. PipelineApprovalValueManualNever PipelineApprovalValue = "MANUAL_APPROVAL_NEVER" // PipelineApprovalValueManualAlways is MANUAL_APPROVAL_ALWAYS approval policy value. PipelineApprovalValueManualAlways PipelineApprovalValue = "MANUAL_APPROVAL_ALWAYS" // BackupPlanPolicyScheduleUnset is NEVER backup plan policy value. BackupPlanPolicyScheduleUnset BackupPlanPolicySchedule = "UNSET" // BackupPlanPolicyScheduleDaily is DAILY backup plan policy value. BackupPlanPolicyScheduleDaily BackupPlanPolicySchedule = "DAILY" // BackupPlanPolicyScheduleWeekly is WEEKLY backup plan policy value. BackupPlanPolicyScheduleWeekly BackupPlanPolicySchedule = "WEEKLY" )
const DefaultProjectID = 1
DefaultProjectID is the ID for the default project.
const OnboardingPipelineID = 101
OnboardingPipelineID is the ID for onboarding pipelines.
const OnboardingTaskID1 = 101
OnboardingTaskID1 is the ID for onboarding task1.
const OnboardingTaskID2 = 102
OnboardingTaskID2 is the ID for onboarding task2.
const SystemBotID = 1
SystemBotID is the ID of the system robot.
const UnknownID = -1
UnknownID is the ID for unknowns.
Variables ¶
var ( // DBNameToken is the token for database name. DBNameToken = "{{DB_NAME}}" // EnvironemntToken is the token for environment. EnvironemntToken = "{{ENV_NAME}}" // LocationToken is the token for location. LocationToken = "{{LOCATION}}" // TenantToken is the token for tenant. TenantToken = "{{TENANT}}" )
var FeatureMatrix = map[FeatureType][3]bool{ "bb.feature.backward-compatibility": {false, true, true}, "bb.feature.schema-drift": {false, true, true}, "bb.feature.task-schedule-time": {false, true, true}, "bb.feature.multi-tenancy": {false, true, true}, "bb.feature.dba-workflow": {false, false, true}, "bb.feature.data-source": {false, false, false}, "bb.feature.approval-policy": {false, true, true}, "bb.feature.backup-policy": {false, true, true}, "bb.feature.rbac": {false, true, true}, "bb.feature.3rd-party-auth": {false, true, true}, }
FeatureMatrix is a map from the a particular feature to the respective enablement of a particular plan
var ( // PolicyTypes is a set of all policy types. PolicyTypes = map[PolicyType]bool{ PolicyTypePipelineApproval: true, PolicyTypeBackupPlan: true, } )
Functions ¶
func DataSourceNameFromType ¶
func DataSourceNameFromType(dataSourceType DataSourceType) string
DataSourceNameFromType maps the name from a data source type.
func EnvSlug ¶
func EnvSlug(env *Environment) string
EnvSlug is the slug formatter for environments.
func FormatTemplate ¶
FormatTemplate formats the template.
func GetBaseDatabaseName ¶
GetBaseDatabaseName will return the base database name given the database name, dbNameTemplate, labelsJSON.
func GetDefaultPolicy ¶
func GetDefaultPolicy(pType PolicyType) (string, error)
GetDefaultPolicy will return the default value for the given policy type. The default policy can be empty when we don't have anything to enforce at runtime.
func ProjectRawShortSlug ¶
func ProjectRawShortSlug(project *ProjectRaw) string
ProjectRawShortSlug is the slug short formatter for ProjectRaw.
func ProjectRawSlug ¶
func ProjectRawSlug(project *ProjectRaw) string
ProjectRawSlug is the slug formatter for ProjectRaw.
func ProjectShortSlug ¶
ProjectShortSlug is the slug short formatter for Project.
func ProjectSlug ¶
ProjectSlug is the slug formatter for Project.
func ProjectWebhookSlug ¶
func ProjectWebhookSlug(projectWebhook *ProjectWebhook) string
ProjectWebhookSlug is the slug formatter for project webhooks.
func ValidatePolicy ¶
func ValidatePolicy(pType PolicyType, payload string) error
ValidatePolicy will validate the policy type and payload values.
func ValidateProjectDBNameTemplate ¶
ValidateProjectDBNameTemplate validates the project database name template.
func ValidateRepositoryFilePathTemplate ¶
func ValidateRepositoryFilePathTemplate(filePathTemplate string, tenantMode ProjectTenantMode) error
ValidateRepositoryFilePathTemplate validates the repository file path template.
func ValidateRepositorySchemaPathTemplate ¶
func ValidateRepositorySchemaPathTemplate(schemaPathTemplate string, tenantMode ProjectTenantMode) error
ValidateRepositorySchemaPathTemplate validates the repository schema path template.
Types ¶
type Activity ¶
type Activity struct { ID int `jsonapi:"primary,activity"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields // The object where this activity belongs // e.g if Type is "bb.issue.xxx", then this field refers to the corresponding issue's id. ContainerID int `jsonapi:"attr,containerId"` // Domain specific fields Type ActivityType `jsonapi:"attr,type"` Level ActivityLevel `jsonapi:"attr,level"` Comment string `jsonapi:"attr,comment"` Payload string `jsonapi:"attr,payload"` }
Activity is the API message for an activity.
type ActivityCreate ¶
type ActivityCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Domain specific fields ContainerID int `jsonapi:"attr,containerId"` Type ActivityType `jsonapi:"attr,type"` Level ActivityLevel Comment string `jsonapi:"attr,comment"` Payload string `jsonapi:"attr,payload"` }
ActivityCreate is the API message for creating an activity.
type ActivityDelete ¶
type ActivityDelete struct { ID int // Standard fields // Value is assigned from the jwt subject field passed by the client. DeleterID int }
ActivityDelete is the API message for deleting an activity.
type ActivityFind ¶
type ActivityFind struct { ID *int // Domain specific fields CreatorID *int Type *string Level *ActivityLevel ContainerID *int Limit *int }
ActivityFind is the API message for finding activities.
func (*ActivityFind) String ¶
func (find *ActivityFind) String() string
type ActivityIssueCommentCreatePayload ¶
type ActivityIssueCommentCreatePayload struct { // Used by inbox to display info without paying the join cost IssueName string `json:"issueName"` }
ActivityIssueCommentCreatePayload is the API message payloads for creating issue comments.
type ActivityIssueCreatePayload ¶
type ActivityIssueCreatePayload struct { // Used by inbox to display info without paying the join cost IssueName string `json:"issueName"` }
ActivityIssueCreatePayload is the API message payloads for creating issues. These payload types are only used when marshalling to the json format for saving into the database. So we annotate with json tag using camelCase naming which is consistent with normal json naming convention. More importantly, frontend code can simply use JSON.parse to convert to the expected struct there.
type ActivityIssueFieldUpdatePayload ¶
type ActivityIssueFieldUpdatePayload struct { FieldID IssueFieldID `json:"fieldId"` OldValue string `json:"oldValue,omitempty"` NewValue string `json:"newValue,omitempty"` // Used by inbox to display info without paying the join cost IssueName string `json:"issueName"` }
ActivityIssueFieldUpdatePayload is the API message payloads for updating issue fields.
type ActivityIssueStatusUpdatePayload ¶
type ActivityIssueStatusUpdatePayload struct { OldStatus IssueStatus `json:"oldStatus,omitempty"` NewStatus IssueStatus `json:"newStatus,omitempty"` // Used by inbox to display info without paying the join cost IssueName string `json:"issueName"` }
ActivityIssueStatusUpdatePayload is the API message payloads for updating issue status.
type ActivityLevel ¶
type ActivityLevel string
ActivityLevel is the level of activities.
const ( // ActivityInfo is the INFO level of activities. ActivityInfo ActivityLevel = "INFO" // ActivityWarn is the WARN level of activities. ActivityWarn ActivityLevel = "WARN" // ActivityError is the ERROR level of activities. ActivityError ActivityLevel = "ERROR" )
func (ActivityLevel) String ¶
func (e ActivityLevel) String() string
type ActivityMemberActivateDeactivatePayload ¶
type ActivityMemberActivateDeactivatePayload struct { PrincipalID int `json:"principalId"` PrincipalName string `json:"principalName"` PrincipalEmail string `json:"principalEmail"` Role Role `json:"role"` }
ActivityMemberActivateDeactivatePayload is the API message payloads for activating or deactivating members.
type ActivityMemberCreatePayload ¶
type ActivityMemberCreatePayload struct { PrincipalID int `json:"principalId"` PrincipalName string `json:"principalName"` PrincipalEmail string `json:"principalEmail"` MemberStatus MemberStatus `json:"memberStatus"` Role Role `json:"role"` }
ActivityMemberCreatePayload is the API message payloads for creating members.
type ActivityMemberRoleUpdatePayload ¶
type ActivityMemberRoleUpdatePayload struct { PrincipalID int `json:"principalId"` PrincipalName string `json:"principalName"` PrincipalEmail string `json:"principalEmail"` OldRole Role `json:"oldRole"` NewRole Role `json:"newRole"` }
ActivityMemberRoleUpdatePayload is the API message payloads for updating member roles.
type ActivityPatch ¶
type ActivityPatch struct { ID int `jsonapi:"primary,activityPatch"` // Standard fields // Value is assigned from the jwt subject field passed by the client. UpdaterID int // Domain specific fields Comment *string `jsonapi:"attr,comment"` }
ActivityPatch is the API message for patching an activity.
type ActivityPipelineTaskEarliestAllowedTimeUpdatePayload ¶
type ActivityPipelineTaskEarliestAllowedTimeUpdatePayload struct { TaskID int `json:"taskId"` OldEarliestAllowedTs int64 `json:"oldEarliestAllowedTs,omitempty"` NewEarliestAllowedTs int64 `json:"newEarliestAllowedTs,omitempty"` // Used by inbox to display info without paying the join cost IssueName string `json:"issueName"` TaskName string `json:"taskName"` }
ActivityPipelineTaskEarliestAllowedTimeUpdatePayload is the API message payloads for pipeline task the earliest allowed time updates.
type ActivityPipelineTaskFileCommitPayload ¶
type ActivityPipelineTaskFileCommitPayload struct { TaskID int `json:"taskId"` VCSInstanceURL string `json:"vcsInstanceUrl,omitempty"` RepositoryFullPath string `json:"repositoryFullPath,omitempty"` Branch string `json:"branch,omitempty"` FilePath string `json:"filePath,omitempty"` CommitID string `json:"commitId,omitempty"` }
ActivityPipelineTaskFileCommitPayload is the API message payloads for committing pipeline task files.
type ActivityPipelineTaskStatementUpdatePayload ¶
type ActivityPipelineTaskStatementUpdatePayload struct { TaskID int `json:"taskId"` OldStatement string `json:"oldStatement,omitempty"` NewStatement string `json:"newStatement,omitempty"` // Used by inbox to display info without paying the join cost IssueName string `json:"issueName"` TaskName string `json:"taskName"` }
ActivityPipelineTaskStatementUpdatePayload is the API message payloads for pipeline task statement updates.
type ActivityPipelineTaskStatusUpdatePayload ¶
type ActivityPipelineTaskStatusUpdatePayload struct { TaskID int `json:"taskId"` OldStatus TaskStatus `json:"oldStatus,omitempty"` NewStatus TaskStatus `json:"newStatus,omitempty"` // Used by inbox to display info without paying the join cost IssueName string `json:"issueName"` TaskName string `json:"taskName"` }
ActivityPipelineTaskStatusUpdatePayload is the API message payloads for updating pipeline task status.
type ActivityProjectDatabaseTransferPayload ¶
type ActivityProjectDatabaseTransferPayload struct { DatabaseID int `json:"databaseId,omitempty"` // Used by activity table to display info without paying the join cost DatabaseName string `json:"databaseName,omitempty"` }
ActivityProjectDatabaseTransferPayload is the API message payloads for transfering databases.
type ActivityProjectRepositoryPushPayload ¶
type ActivityProjectRepositoryPushPayload struct { VCSPushEvent vcs.PushEvent `json:"pushEvent"` // Used by activity table to display info without paying the join cost // IssueID/IssueName only exist if the push event leads to the issue creation. IssueID int `json:"issueId,omitempty"` IssueName string `json:"issueName,omitempty"` }
ActivityProjectRepositoryPushPayload is the API message payloads for pushing repositories.
type ActivitySQLEditorQueryPayload ¶
type ActivitySQLEditorQueryPayload struct { // Used by activity table to display info without paying the join cost Statement string `json:"statement"` DurationNs int64 `json:"durationNs"` InstanceName string `json:"instanceName"` DatabaseName string `json:"databaseName"` Error string `json:"error"` }
ActivitySQLEditorQueryPayload is the API message payloads for the executed query info.
type ActivityService ¶
type ActivityService interface { CreateActivity(ctx context.Context, create *ActivityCreate) (*Activity, error) FindActivityList(ctx context.Context, find *ActivityFind) ([]*Activity, error) FindActivity(ctx context.Context, find *ActivityFind) (*Activity, error) PatchActivity(ctx context.Context, patch *ActivityPatch) (*Activity, error) DeleteActivity(ctx context.Context, delete *ActivityDelete) error }
ActivityService is the service for activities.
type ActivityType ¶
type ActivityType string
ActivityType is the type for an activity.
const ( // ActivityIssueCreate is the type for creating issues. ActivityIssueCreate ActivityType = "bb.issue.create" // ActivityIssueCommentCreate is the type for creating issue comments. ActivityIssueCommentCreate ActivityType = "bb.issue.comment.create" // ActivityIssueFieldUpdate is the type for updating issue fields. ActivityIssueFieldUpdate ActivityType = "bb.issue.field.update" // ActivityIssueStatusUpdate is the type for updating issue status. ActivityIssueStatusUpdate ActivityType = "bb.issue.status.update" // ActivityPipelineTaskStatusUpdate is the type for updating pipeline task status. ActivityPipelineTaskStatusUpdate ActivityType = "bb.pipeline.task.status.update" // ActivityPipelineTaskFileCommit is the type for committing pipeline task file. ActivityPipelineTaskFileCommit ActivityType = "bb.pipeline.task.file.commit" // ActivityPipelineTaskStatementUpdate is the type for updating pipeline task SQL statement. ActivityPipelineTaskStatementUpdate ActivityType = "bb.pipeline.task.statement.update" // ActivityPipelineTaskEarliestAllowedTimeUpdate is the type for updating pipeline task the earliest allowed time. ActivityPipelineTaskEarliestAllowedTimeUpdate ActivityType = "bb.pipeline.task.general.earliest-allowed-time.update" // ActivityMemberCreate is the type for creating members. ActivityMemberCreate ActivityType = "bb.member.create" // ActivityMemberRoleUpdate is the type for updating member roles. ActivityMemberRoleUpdate ActivityType = "bb.member.role.update" // ActivityMemberActivate is the type for activating members. ActivityMemberActivate ActivityType = "bb.member.activate" // ActivityMemberDeactivate is the type for deactivating members. ActivityMemberDeactivate ActivityType = "bb.member.deactivate" // ActivityProjectRepositoryPush is the type for pushing repositories. ActivityProjectRepositoryPush ActivityType = "bb.project.repository.push" // ActivityProjectDatabaseTransfer is the type for transferring databases. ActivityProjectDatabaseTransfer ActivityType = "bb.project.database.transfer" // ActivityProjectMemberCreate is the type for creating project members. ActivityProjectMemberCreate ActivityType = "bb.project.member.create" // ActivityProjectMemberDelete is the type for deleting project members. ActivityProjectMemberDelete ActivityType = "bb.project.member.delete" // ActivityProjectMemberRoleUpdate is the type for updating project member roles. ActivityProjectMemberRoleUpdate ActivityType = "bb.project.member.role.update" // ActivitySQLEditorQuery is the type for executing query. ActivitySQLEditorQuery ActivityType = "bb.sql-editor.query" )
func (ActivityType) String ¶
func (e ActivityType) String() string
type Anomaly ¶
type Anomaly struct { ID int `jsonapi:"primary,anomaly"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields InstanceID int `jsonapi:"attr,instanceId"` // Instance anomaly doesn't have databaseID DatabaseID *int `jsonapi:"attr,databaseId"` // Domain specific fields Type AnomalyType `jsonapi:"attr,type"` // Calculated field derived from type Severity AnomalySeverity `jsonapi:"attr,severity"` Payload string `jsonapi:"attr,payload"` }
Anomaly is the API message for an anomaly.
type AnomalyArchive ¶
type AnomalyArchive struct { InstanceID *int DatabaseID *int Type AnomalyType }
AnomalyArchive is the API message for archiving an anomaly.
type AnomalyDatabaseBackupMissingPayload ¶
type AnomalyDatabaseBackupMissingPayload struct { ExpectedBackupSchedule BackupPlanPolicySchedule `json:"expectedSchedule,omitempty"` // Time of last successful backup created LastBackupTs int64 `json:"lastBackupTs,omitempty"` }
AnomalyDatabaseBackupMissingPayload is the API message for missing backup payloads.
type AnomalyDatabaseBackupPolicyViolationPayload ¶
type AnomalyDatabaseBackupPolicyViolationPayload struct { EnvironmentID int `json:"environmentId,omitempty"` ExpectedBackupSchedule BackupPlanPolicySchedule `json:"expectedSchedule,omitempty"` ActualBackupSchedule BackupPlanPolicySchedule `json:"actualSchedule,omitempty"` }
AnomalyDatabaseBackupPolicyViolationPayload is the API message for backup policy violation payloads.
type AnomalyDatabaseConnectionPayload ¶
type AnomalyDatabaseConnectionPayload struct { // Connection failure detail Detail string `json:"detail,omitempty"` }
AnomalyDatabaseConnectionPayload is the API message for database connection payloads.
type AnomalyDatabaseSchemaDriftPayload ¶
type AnomalyDatabaseSchemaDriftPayload struct { // The schema version corresponds to the expected schema Version string `json:"version,omitempty"` // The expected latest schema stored in the migration history table Expect string `json:"expect,omitempty"` // The actual schema dumped from the database Actual string `json:"actual,omitempty"` }
AnomalyDatabaseSchemaDriftPayload is the API message for database schema drift payloads.
type AnomalyFind ¶
type AnomalyFind struct { // Standard fields RowStatus *RowStatus // Related fields InstanceID *int DatabaseID *int Type *AnomalyType // Only applicable if InstanceID is specified, if true, then we only return instance anomaly (database_id is NULL) InstanceOnly bool }
AnomalyFind is the API message for finding anomalies.
func (*AnomalyFind) String ¶
func (find *AnomalyFind) String() string
type AnomalyInstanceConnectionPayload ¶
type AnomalyInstanceConnectionPayload struct { // Connection failure detail Detail string `json:"detail,omitempty"` }
AnomalyInstanceConnectionPayload is the API message for instance connection payloads.
type AnomalyService ¶
type AnomalyService interface { // UpsertActiveAnomaly would update the existing active anomaly if both database id and type match, otherwise create a new one. UpsertActiveAnomaly(ctx context.Context, upsert *AnomalyUpsert) (*Anomaly, error) FindAnomalyList(ctx context.Context, find *AnomalyFind) ([]*Anomaly, error) ArchiveAnomaly(ctx context.Context, archive *AnomalyArchive) error }
AnomalyService is the service for anomaly.
type AnomalySeverity ¶
type AnomalySeverity string
AnomalySeverity is the severity of anomaly.
const ( // AnomalySeverityMedium is the medium severity. AnomalySeverityMedium AnomalySeverity = "MEDIUM" // AnomalySeverityHigh is the high severity. AnomalySeverityHigh AnomalySeverity = "HIGH" // AnomalySeverityCritical is the critical severity. AnomalySeverityCritical AnomalySeverity = "CRITICAL" )
func AnomalySeverityFromType ¶
func AnomalySeverityFromType(anomalyType AnomalyType) AnomalySeverity
AnomalySeverityFromType maps the severity from a anomaly type.
type AnomalyType ¶
type AnomalyType string
AnomalyType is the type of a task.
const ( // AnomalyInstanceConnection is the anomaly type for instance connections. AnomalyInstanceConnection AnomalyType = "bb.anomaly.instance.connection" // AnomalyInstanceMigrationSchema is the anomaly type for schema migrations. AnomalyInstanceMigrationSchema AnomalyType = "bb.anomaly.instance.migration-schema" // AnomalyDatabaseBackupPolicyViolation is the anomaly type for backup policy violations. AnomalyDatabaseBackupPolicyViolation AnomalyType = "bb.anomaly.database.backup.policy-violation" // AnomalyDatabaseBackupMissing is the anomaly type for missing backups. AnomalyDatabaseBackupMissing AnomalyType = "bb.anomaly.database.backup.missing" // AnomalyDatabaseConnection is the anomaly type for database connections. AnomalyDatabaseConnection AnomalyType = "bb.anomaly.database.connection" // AnomalyDatabaseSchemaDrift is the anomaly type for database schema drifts. AnomalyDatabaseSchemaDrift AnomalyType = "bb.anomaly.database.schema.drift" )
type AnomalyUpsert ¶
type AnomalyUpsert struct { // Standard fields CreatorID int // Related fields InstanceID int DatabaseID *int // Domain specific fields Type AnomalyType `jsonapi:"attr,type"` Payload string `jsonapi:"attr,payload"` }
AnomalyUpsert is the API message for creating an anomaly.
type AuthProvider ¶
type AuthProvider struct { Type vcs.Type `jsonapi:"attr,type"` Name string `jsonapi:"attr,name"` InstanceURL string `jsonapi:"attr,instanceUrl"` ApplicationID string `jsonapi:"attr,applicationId"` // Secret will be used for OAuth on the client side when user choose to login via Gitlab Secret string `jsonapi:"attr,secret"` }
AuthProvider is the authentication provider which only supports GitLab for now.
type Backup ¶
type Backup struct { ID int `jsonapi:"primary,backup"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields DatabaseID int `jsonapi:"attr,databaseId"` // Domain specific fields Name string `jsonapi:"attr,name"` Status BackupStatus `jsonapi:"attr,status"` Type BackupType `jsonapi:"attr,type"` StorageBackend BackupStorageBackend `jsonapi:"attr,storageBackend"` // Upon taking the database backup, we will also record the current migration history version if exists. // And when restoring the backup, we will record this in the migration history. MigrationHistoryVersion string `jsonapi:"attr,migrationHistoryVersion"` Path string `jsonapi:"attr,path"` Comment string `jsonapi:"attr,comment"` }
Backup is the API message for a backup.
type BackupCreate ¶
type BackupCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Related fields DatabaseID int `jsonapi:"attr,databaseId"` // Domain specific fields Name string `jsonapi:"attr,name"` Type BackupType `jsonapi:"attr,type"` StorageBackend BackupStorageBackend `jsonapi:"attr,storageBackend"` MigrationHistoryVersion string Path string }
BackupCreate is the API message for creating a backup.
type BackupFind ¶
type BackupFind struct { ID *int // Related fields DatabaseID *int // Domain specific fields Name *string Status *BackupStatus }
BackupFind is the API message for finding backups.
func (*BackupFind) String ¶
func (find *BackupFind) String() string
type BackupPatch ¶
type BackupPatch struct { ID int // Standard fields // Value is assigned from the jwt subject field passed by the client. UpdaterID int // Domain specific fields Status string Comment string }
BackupPatch is the API message for patching a backup.
type BackupPlanPolicy ¶
type BackupPlanPolicy struct {
Schedule BackupPlanPolicySchedule `json:"schedule"`
}
BackupPlanPolicy is the policy configuration for backup plan.
func UnmarshalBackupPlanPolicy ¶
func UnmarshalBackupPlanPolicy(payload string) (*BackupPlanPolicy, error)
UnmarshalBackupPlanPolicy will unmarshal payload to backup plan policy.
func (BackupPlanPolicy) String ¶
func (bp BackupPlanPolicy) String() (string, error)
type BackupPlanPolicySchedule ¶
type BackupPlanPolicySchedule string
BackupPlanPolicySchedule is value for backup plan policy.
type BackupService ¶
type BackupService interface { CreateBackup(ctx context.Context, create *BackupCreate) (*Backup, error) FindBackup(ctx context.Context, find *BackupFind) (*Backup, error) // Returns backup list in updated_ts descending order. FindBackupList(ctx context.Context, find *BackupFind) ([]*Backup, error) PatchBackup(ctx context.Context, patch *BackupPatch) (*Backup, error) FindBackupSetting(ctx context.Context, find *BackupSettingFind) (*BackupSetting, error) UpsertBackupSetting(ctx context.Context, upsert *BackupSettingUpsert) (*BackupSetting, error) UpsertBackupSettingTx(ctx context.Context, tx *sql.Tx, upsert *BackupSettingUpsert) (*BackupSetting, error) FindBackupSettingsMatch(ctx context.Context, match *BackupSettingsMatch) ([]*BackupSetting, error) }
BackupService is the service for backups.
type BackupSetting ¶
type BackupSetting struct { ID int `jsonapi:"primary,backupSetting"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields DatabaseID int `jsonapi:"attr,databaseId"` // Do not return this to the client since the client always has the database context and fetching the // database object and all its own related objects is a bit expensive. Database *Database // Domain specific fields Enabled bool `jsonapi:"attr,enabled"` Hour int `jsonapi:"attr,hour"` DayOfWeek int `jsonapi:"attr,dayOfWeek"` // HookURL is the callback url to be requested (using HTTP GET) after a successful backup. HookURL string `jsonapi:"attr,hookUrl"` }
BackupSetting is the backup setting for a database.
type BackupSettingFind ¶
BackupSettingFind is the message to get a backup settings.
type BackupSettingUpsert ¶
type BackupSettingUpsert struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. // CreatorID is the ID of the creator. UpdaterID int // Related fields DatabaseID int `jsonapi:"attr,databaseId"` EnvironmentID int // Domain specific fields Enabled bool `jsonapi:"attr,enabled"` Hour int `jsonapi:"attr,hour"` DayOfWeek int `jsonapi:"attr,dayOfWeek"` HookURL string `jsonapi:"attr,hookUrl"` }
BackupSettingUpsert is the message to upsert a backup settings. NOTE: We use PATCH for Upsert, this is inspired by https://google.aip.dev/134#patch-and-put
type BackupSettingsMatch ¶
BackupSettingsMatch is the message to find backup settings matching the conditions.
type BackupStatus ¶
type BackupStatus string
BackupStatus is the status of a backup.
const ( // BackupStatusPendingCreate is the status for PENDING_CREATE. BackupStatusPendingCreate BackupStatus = "PENDING_CREATE" // BackupStatusDone is the status for DONE. BackupStatusDone BackupStatus = "DONE" // BackupStatusFailed is the status for FAILED. BackupStatusFailed BackupStatus = "FAILED" )
func (BackupStatus) String ¶
func (e BackupStatus) String() string
type BackupStorageBackend ¶
type BackupStorageBackend string
BackupStorageBackend is the storage backend of a backup.
const ( // BackupStorageBackendLocal is the local storage backend for a backup. BackupStorageBackendLocal BackupStorageBackend = "LOCAL" // BackupStorageBackendS3 is the AWS S3 storage backend for a backup. Not used yet. BackupStorageBackendS3 BackupStorageBackend = "S3" // BackupStorageBackendGCS is the Google Cloud Storage (GCS) storage backend for a backup. Not used yet. BackupStorageBackendGCS BackupStorageBackend = "GCS" // BackupStorageBackendOSS is the AliCloud Object Storage Service (OSS) storage backend for a backup. Not used yet. BackupStorageBackendOSS BackupStorageBackend = "OSS" )
func (BackupStorageBackend) String ¶
func (e BackupStorageBackend) String() string
type BackupType ¶
type BackupType string
BackupType is the type of a backup.
const ( // BackupTypeAutomatic is the type for automatic backup. BackupTypeAutomatic BackupType = "AUTOMATIC" // BackupTypeManual is the type for manual backup. BackupTypeManual BackupType = "MANUAL" )
func (BackupType) String ¶
func (e BackupType) String() string
type Bookmark ¶
type Bookmark struct { ID int `jsonapi:"primary,bookmark"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Domain specific fields Name string `jsonapi:"attr,name"` Link string `jsonapi:"attr,link"` }
Bookmark is the API message for a bookmark.
type BookmarkCreate ¶
type BookmarkCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Domain specific fields Name string `jsonapi:"attr,name"` Link string `jsonapi:"attr,link"` }
BookmarkCreate is the API message for creating a bookmark.
type BookmarkDelete ¶
type BookmarkDelete struct { ID int // Standard fields // Value is assigned from the jwt subject field passed by the client. DeleterID int }
BookmarkDelete is the API message for deleting a bookmark.
type BookmarkFind ¶
BookmarkFind is the API message for finding bookmarks.
func (*BookmarkFind) String ¶
func (find *BookmarkFind) String() string
type BookmarkService ¶
type BookmarkService interface { CreateBookmark(ctx context.Context, create *BookmarkCreate) (*Bookmark, error) FindBookmarkList(ctx context.Context, find *BookmarkFind) ([]*Bookmark, error) FindBookmark(ctx context.Context, find *BookmarkFind) (*Bookmark, error) DeleteBookmark(ctx context.Context, delete *BookmarkDelete) error }
BookmarkService is the service for bookmarks.
type CacheNamespace ¶
type CacheNamespace string
CacheNamespace is the type of a cache.
const ( // PrincipalCache is the cache type of principals. PrincipalCache CacheNamespace = "p" // EnvironmentCache is the cache type of environments. EnvironmentCache CacheNamespace = "e" // ProjectCache is the cache type of projects. ProjectCache CacheNamespace = "r" // InstanceCache is the cache type of instances. InstanceCache CacheNamespace = "i" // DatabaseCache is the cache type of databases. DatabaseCache CacheNamespace = "d" // MemberCache is the cache type of members. MemberCache CacheNamespace = "m" // PipelineCache is the cache type of pipelines. PipelineCache CacheNamespace = "pl" // IssueCache is the cache type of issues. IssueCache CacheNamespace = "is" )
type CacheService ¶
type CacheService interface { FindCache(namespace CacheNamespace, id int, entry interface{}) (bool, error) UpsertCache(namespace CacheNamespace, id int, entry interface{}) error }
CacheService is the service for caches.
type Column ¶
type Column struct { ID int `jsonapi:"primary,column"` // Standard fields CreatorID int CreatedTs int64 `json:"createdTs"` UpdaterID int UpdatedTs int64 `json:"updatedTs"` // Related fields DatabaseID int TableID int // Domain specific fields Name string `json:"name"` Position int `json:"position"` Default *string `json:"default"` Nullable bool `json:"nullable"` Type string `json:"type"` CharacterSet string `json:"characterSet"` Collation string `json:"collation"` Comment string `json:"comment"` }
Column is the API message for a table column.
type ColumnCreate ¶
type ColumnCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Related fields DatabaseID int TableID int // Domain specific fields Name string Position int Default *string Nullable bool Type string CharacterSet string Collation string Comment string }
ColumnCreate is the API message for creating a column.
type ColumnFind ¶
type ColumnFind struct { ID *int // Related fields DatabaseID *int TableID *int // Domain specific fields Name *string }
ColumnFind is the API message for finding columns.
func (*ColumnFind) String ¶
func (find *ColumnFind) String() string
type ColumnPatch ¶
type ColumnPatch struct { ID int // Standard fields // Value is assigned from the jwt subject field passed by the client. UpdaterID int }
ColumnPatch is the API message for patching a columns.
type ColumnService ¶
type ColumnService interface { CreateColumn(ctx context.Context, create *ColumnCreate) (*Column, error) FindColumnList(ctx context.Context, find *ColumnFind) ([]*Column, error) FindColumn(ctx context.Context, find *ColumnFind) (*Column, error) PatchColumn(ctx context.Context, patch *ColumnPatch) (*Column, error) }
ColumnService is the service for columns.
type ConnectionInfo ¶
type ConnectionInfo struct { Engine db.Type `jsonapi:"attr,engine"` Host string `jsonapi:"attr,host"` Port string `jsonapi:"attr,port"` Username string `jsonapi:"attr,username"` Password string `jsonapi:"attr,password"` UseEmptyPassword bool `jsonapi:"attr,useEmptyPassword"` InstanceID *int `jsonapi:"attr,instanceId"` }
ConnectionInfo is the API message for connection infos.
type CreateDatabaseContext ¶
type CreateDatabaseContext struct { // InstanceID is the ID of an instance. InstanceID int `json:"instanceId"` // DatabaseName is the name of the database. DatabaseName string `json:"databaseName"` // CharacterSet is the character set of the database. CharacterSet string `json:"characterSet"` // Collation is the collation of the database. Collation string `json:"collation"` // BackupID is the ID of the backup. BackupID int `json:"backupId"` // Labels is a json-encoded string from a list of DatabaseLabel. // See definition in api.Database. Labels string `jsonapi:"attr,labels,omitempty"` }
CreateDatabaseContext is the issue create context for creating a database.
type DataSource ¶
type DataSource struct { ID int `jsonapi:"primary,dataSource"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields // Just returns InstanceID and DatabaseID otherwise would cause circular dependency. InstanceID int `jsonapi:"attr,instanceId"` DatabaseID int `jsonapi:"attr,databaseId"` // Domain specific fields Name string `jsonapi:"attr,name"` Type DataSourceType `jsonapi:"attr,type"` Username string `jsonapi:"attr,username"` Password string `jsonapi:"attr,password"` }
DataSource is the API message for a data source.
func DataSourceFromInstanceWithType ¶
func DataSourceFromInstanceWithType(instance *Instance, dataSourceType DataSourceType) *DataSource
DataSourceFromInstanceWithType gets a typed data source from a instance.
type DataSourceCreate ¶
type DataSourceCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Related fields InstanceID int `jsonapi:"attr,instanceId"` DatabaseID int `jsonapi:"attr,databaseId"` // Domain specific fields Name string `jsonapi:"attr,name"` Type DataSourceType `jsonapi:"attr,type"` Username string `jsonapi:"attr,username"` Password string `jsonapi:"attr,password"` }
DataSourceCreate is the API message for creating a data source.
type DataSourceFind ¶
type DataSourceFind struct { ID *int // Related fields InstanceID *int DatabaseID *int // Domain specific fields Type *DataSourceType }
DataSourceFind is the API message for finding data sources.
func (*DataSourceFind) String ¶
func (find *DataSourceFind) String() string
type DataSourcePatch ¶
type DataSourcePatch struct { ID int // Standard fields // Value is assigned from the jwt subject field passed by the client. UpdaterID int // Domain specific fields Username *string `jsonapi:"attr,username"` Password *string `jsonapi:"attr,password"` UseEmptyPassword *bool `jsonapi:"attr,useEmptyPassword"` }
DataSourcePatch is the API message for data source.
type DataSourceService ¶
type DataSourceService interface { CreateDataSource(ctx context.Context, create *DataSourceCreate) (*DataSource, error) // This is specifically used to create data source when creating the instance. CreateDataSourceTx(ctx context.Context, tx *sql.Tx, create *DataSourceCreate) (*DataSource, error) FindDataSourceList(ctx context.Context, find *DataSourceFind) ([]*DataSource, error) FindDataSource(ctx context.Context, find *DataSourceFind) (*DataSource, error) PatchDataSource(ctx context.Context, patch *DataSourcePatch) (*DataSource, error) }
DataSourceService is the service for data source.
type DataSourceType ¶
type DataSourceType string
DataSourceType is the type of data source.
const ( // Admin is the ADMIN type of data source. Admin DataSourceType = "ADMIN" // RW is the read/write type of data source. RW DataSourceType = "RW" // RO is the read-only type of data source. RO DataSourceType = "RO" )
func (DataSourceType) String ¶
func (e DataSourceType) String() string
type Database ¶
type Database struct { ID int `jsonapi:"primary,database"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields ProjectID int `jsonapi:"attr,projectId"` Project *Project `jsonapi:"relation,project"` InstanceID int `jsonapi:"attr,instanceId"` Instance *Instance `jsonapi:"relation,instance"` DataSourceList []*DataSource `jsonapi:"relation,dataSource"` SourceBackupID int SourceBackup *Backup `jsonapi:"relation,sourceBackup"` // Anomalies are stored in a separate table, but just return here for convenience AnomalyList []*Anomaly `jsonapi:"relation,anomaly"` // Domain specific fields Name string `jsonapi:"attr,name"` CharacterSet string `jsonapi:"attr,characterSet"` Collation string `jsonapi:"attr,collation"` SchemaVersion string `jsonapi:"attr,schemaVersion"` SyncStatus SyncStatus `jsonapi:"attr,syncStatus"` LastSuccessfulSyncTs int64 `jsonapi:"attr,lastSuccessfulSyncTs"` // Labels is a json-encoded string from a list of DatabaseLabel, // e.g. "[{"key":"bb.location","value":"earth"},{"key":"bb.tenant","value":"bytebase"}]". Labels string `jsonapi:"attr,labels,omitempty"` }
Database is the API message for a database.
type DatabaseCreate ¶
type DatabaseCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Related fields ProjectID int `jsonapi:"attr,projectId"` InstanceID int `jsonapi:"attr,instanceId"` EnvironmentID int // Domain specific fields Name string `jsonapi:"attr,name"` CharacterSet string `jsonapi:"attr,characterSet"` Collation string `jsonapi:"attr,collation"` IssueID int `jsonapi:"attr,issueId"` // Labels is a json-encoded string from a list of DatabaseLabel, // e.g. "[{"key":"bb.location","value":"earth"},{"key":"bb.tenant","value":"bytebase"}]". Labels *string `jsonapi:"attr,labels"` SchemaVersion string }
DatabaseCreate is the API message for creating a database.
type DatabaseFind ¶
type DatabaseFind struct { ID *int // Related fields InstanceID *int ProjectID *int // Domain specific fields Name *string IncludeAllDatabase bool }
DatabaseFind is the API message for finding databases.
func (*DatabaseFind) String ¶
func (find *DatabaseFind) String() string
type DatabaseLabel ¶
type DatabaseLabel struct { ID int `json:"-"` // Standard fields RowStatus RowStatus `json:"-"` CreatorID int `json:"-"` Creator *Principal `json:"-"` CreatedTs int64 `json:"-"` UpdaterID int `json:"-"` Updater *Principal `json:"-"` UpdatedTs int64 `json:"-"` // Related fields DatabaseID int `json:"-"` Key string `json:"key"` // Domain specific fields Value string `json:"value"` }
DatabaseLabel is the label associated with a database.
type DatabaseLabelFind ¶
type DatabaseLabelFind struct { // Standard fields ID *int RowStatus *RowStatus // Related fields DatabaseID *int }
DatabaseLabelFind finds the labels associated with the database.
type DatabaseLabelUpsert ¶
type DatabaseLabelUpsert struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. UpdaterID int RowStatus RowStatus // Related fields DatabaseID int Key string // Domain specific fields Value string }
DatabaseLabelUpsert upserts the label associated with the database.
type DatabasePatch ¶
type DatabasePatch struct { ID int // Standard fields // Value is assigned from the jwt subject field passed by the client. UpdaterID int // Related fields ProjectID *int `jsonapi:"attr,projectId"` SourceBackupID *int // Labels is a json-encoded string from a list of DatabaseLabel, // e.g. "[{"key":"bb.location","value":"earth"},{"key":"bb.tenant","value":"bytebase"}]". Labels *string `jsonapi:"attr,labels"` // Domain specific fields SchemaVersion *string SyncStatus *SyncStatus LastSuccessfulSyncTs *int64 }
DatabasePatch is the API message for patching a database.
type DatabaseService ¶
type DatabaseService interface { CreateDatabase(ctx context.Context, create *DatabaseCreate) (*Database, error) // This is specifically used to create the * database when creating the instance. CreateDatabaseTx(ctx context.Context, tx *sql.Tx, create *DatabaseCreate) (*Database, error) FindDatabaseList(ctx context.Context, find *DatabaseFind) ([]*Database, error) FindDatabase(ctx context.Context, find *DatabaseFind) (*Database, error) PatchDatabase(ctx context.Context, patch *DatabasePatch) (*Database, error) }
DatabaseService is the service for databases.
type Debug ¶
type Debug struct {
IsDebug bool `jsonapi:"attr,isDebug"`
}
Debug is the API message for debug info.
type DebugPatch ¶
type DebugPatch struct {
IsDebug bool `jsonapi:"attr,isDebug"`
}
DebugPatch is the API message for patching debug info.
type Deployment ¶
type Deployment struct { Name string `json:"name"` Spec *DeploymentSpec `json:"spec"` }
Deployment is the API message for deployment.
type DeploymentConfig ¶
type DeploymentConfig struct { ID int `jsonapi:"primary,deploymentConfig"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields ProjectID int Project *Project `jsonapi:"relation,project"` // Domain specific fields Name string `jsonapi:"attr,name"` // Payload encapsulates DeploymentSchedule in json string format. We use json instead jsonapi because this configuration isn't queryable as HTTP format. Payload string `jsonapi:"attr,payload"` }
DeploymentConfig is the API message for deployment configurations.
type DeploymentConfigFind ¶
DeploymentConfigFind is the find request for deployment configs.
type DeploymentConfigService ¶
type DeploymentConfigService interface { // FindDeploymentConfig finds the deployment configuration in a project. FindDeploymentConfig(ctx context.Context, find *DeploymentConfigFind) (*DeploymentConfig, error) // UpsertDeploymentConfig upserts a deployment configuration to a project. UpsertDeploymentConfig(ctx context.Context, upsert *DeploymentConfigUpsert) (*DeploymentConfig, error) }
DeploymentConfigService is the service for deployment configurations.
type DeploymentConfigUpsert ¶
type DeploymentConfigUpsert struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. // CreatorID is the ID of the creator. UpdaterID int // Related fields ProjectID int // Domain specific fields Name string `jsonapi:"attr,name"` // Payload is a json serialization of DeploymentSchedule. Payload string `jsonapi:"attr,payload"` }
DeploymentConfigUpsert is the message to upsert a deployment configuration. NOTE: We use PATCH for Upsert, this is inspired by https://google.aip.dev/134#patch-and-put
type DeploymentSchedule ¶
type DeploymentSchedule struct {
Deployments []*Deployment `json:"deployments"`
}
DeploymentSchedule is the API message for deployment schedule.
func ValidateAndGetDeploymentSchedule ¶
func ValidateAndGetDeploymentSchedule(payload string) (*DeploymentSchedule, error)
ValidateAndGetDeploymentSchedule validates and returns the deployment schedule. Note: this validation only checks whether the payloads is a valid json, however, invalid field name errors are ignored.
type DeploymentSpec ¶
type DeploymentSpec struct {
Selector *LabelSelector `json:"selector"`
}
DeploymentSpec is the API message for deployment specification.
type Environment ¶
type Environment struct { ID int `jsonapi:"primary,environment"` // Standard fields RowStatus RowStatus `jsonapi:"attr,rowStatus"` CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Domain specific fields Name string `jsonapi:"attr,name"` Order int `jsonapi:"attr,order"` }
Environment is the API message for an environment.
type EnvironmentCreate ¶
type EnvironmentCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Domain specific fields Name string `jsonapi:"attr,name"` }
EnvironmentCreate is the API message for creating an environment.
type EnvironmentDelete ¶
type EnvironmentDelete struct { ID int // Standard fields // Value is assigned from the jwt subject field passed by the client. DeleterID int }
EnvironmentDelete is the API message for deleting an environment.
type EnvironmentFind ¶
EnvironmentFind is the API message for finding environments.
func (*EnvironmentFind) String ¶
func (find *EnvironmentFind) String() string
type EnvironmentPatch ¶
type EnvironmentPatch struct { ID int `jsonapi:"primary,environmentPatch"` // Standard fields RowStatus *string `jsonapi:"attr,rowStatus"` // Value is assigned from the jwt subject field passed by the client. UpdaterID int // Domain specific fields Name *string `jsonapi:"attr,name"` Order *int `jsonapi:"attr,order"` }
EnvironmentPatch is the API message for patching an environment.
type EnvironmentService ¶
type EnvironmentService interface { CreateEnvironment(ctx context.Context, create *EnvironmentCreate) (*Environment, error) FindEnvironmentList(ctx context.Context, find *EnvironmentFind) ([]*Environment, error) FindEnvironment(ctx context.Context, find *EnvironmentFind) (*Environment, error) PatchEnvironment(ctx context.Context, patch *EnvironmentPatch) (*Environment, error) }
EnvironmentService is the service for environments.
type FeatureType ¶
type FeatureType string
FeatureType is the type of a feature.
const ( // FeatureBackwardCompatibilty checks if a DDL change is backward compatible. // See https://docs.bytebase.com/features/sql-advisor/backward-compatibility-migration-check // // Currently, we only support MySQL/TiDB thanks to github.com/pingcap/parser FeatureBackwardCompatibilty FeatureType = "bb.feature.backward-compatibility" // FeatureSchemaDrift detects if there occurs schema drift. // See https://docs.bytebase.com/features/drift-detection FeatureSchemaDrift FeatureType = "bb.feature.schema-drift" // FeatureTaskScheduleTime allows user to run task at a scheduled time FeatureTaskScheduleTime FeatureType = "bb.feature.task-schedule-time" // FeatureMultiTenancy allows user to enable tenant mode for the project. // // Tenant mode allows user to track a group of homogeneous database changes together. // e.g. A game studio may deploy many servers, each server is fully isolated with its // own database. When a new game version is released, it may require to upgrade the // underlying database schema, then tenant mode will help the studio to track the // schema change across all databases. FeatureMultiTenancy FeatureType = "bb.feature.multi-tenancy" // FeatureDBAWorkflow enforces the DBA workflow. // // - Developers can't create and view instances since they are exclusively by DBA, they can // only access database. // - Developers can submit troubleshooting issue. FeatureDBAWorkflow FeatureType = "bb.feature.dba-workflow" // FeatureDataSource exposes the data source concept. // // Currently, we DO NOT expose this feature. // // Internally Bytebase stores instance username/password in a seperate data source model. // This allows a single instance to have multiple data sources (e.g. one RW and one RO). // And from the user's perspective, the username/password // look like the property of the instance, which are not. They are the property of data source which // in turns belongs to the instance. // - Support defining extra data source for a database and exposing the related data source UI. FeatureDataSource FeatureType = "bb.feature.data-source" // FeatureApprovalPolicy allows user to specify approval policy for the environment // // e.g. One can configure to NOT require approval for dev environment while require // manual approval for production. FeatureApprovalPolicy FeatureType = "bb.feature.approval-policy" // FeatureBackupPolicy allows user to specify backup policy for the environment // // e.g. One can configure to NOT require backup for dev environment while require // weekly backup for staging and daily backup for production. FeatureBackupPolicy FeatureType = "bb.feature.backup-policy" // FeatureRBAC enables RBAC. // // - Workspace level RBAC // - Project level RBAC FeatureRBAC FeatureType = "bb.feature.rbac" // Feature3rdPartyAuth allows user to authenticate (login) and authorize (sync project member) // // Currently, we only support GitLab EE/CE auth. Feature3rdPartyAuth FeatureType = "bb.feature.3rd-party-auth" )
func (FeatureType) AccessErrorMessage ¶
func (e FeatureType) AccessErrorMessage() string
AccessErrorMessage returns a error message with feature name and minimum supported plan.
func (FeatureType) Name ¶
func (e FeatureType) Name() string
Name returns a readable name of the feature
func (FeatureType) String ¶
func (e FeatureType) String() string
type GitlabLogin ¶
type GitlabLogin struct { InstanceURL string `jsonapi:"attr,instanceUrl"` ApplicationID string `jsonapi:"attr,applicationId"` Secret string `jsonapi:"attr,secret"` AccessToken string `jsonapi:"attr,accessToken"` }
GitlabLogin is the API message for logins via Gitlab.
type Inbox ¶
type Inbox struct { ID int `jsonapi:"primary,inbox"` // Domain specific fields ReceiverID int `jsonapi:"attr,receiverId"` Activity *Activity `jsonapi:"relation,activity"` Status InboxStatus `jsonapi:"attr,status"` }
Inbox is the API message for an inbox.
type InboxCreate ¶
InboxCreate is the API message for creating an inbox.
type InboxFind ¶
type InboxFind struct { ID *int // Domain specific fields ReceiverID *int // If specified, then it will only fetch "UNREAD" item or "READ" item whose activity created after "CreatedAfterTs" ReadCreatedAfterTs *int64 }
InboxFind is the API message for finding inboxes.
type InboxPatch ¶
type InboxPatch struct { ID int // Domain specific fields Status InboxStatus `jsonapi:"attr,status"` }
InboxPatch is the API message for patching an inbox.
type InboxService ¶
type InboxService interface { CreateInbox(ctx context.Context, create *InboxCreate) (*Inbox, error) // Find the inbox list and return most recent created item first. FindInboxList(ctx context.Context, find *InboxFind) ([]*Inbox, error) FindInbox(ctx context.Context, find *InboxFind) (*Inbox, error) PatchInbox(ctx context.Context, patch *InboxPatch) (*Inbox, error) FindInboxSummary(ctx context.Context, principalID int) (*InboxSummary, error) }
InboxService is the service for inboxes.
type InboxStatus ¶
type InboxStatus string
InboxStatus is the status for inboxes.
const ( // Unread is the inbox status for UNREAD. Unread InboxStatus = "UNREAD" // Read is the inbox status for READ. Read InboxStatus = "READ" )
func (InboxStatus) String ¶
func (e InboxStatus) String() string
type InboxSummary ¶
type InboxSummary struct { HasUnread bool `json:"hasUnread"` HasUnreadError bool `json:"hasUnreadError"` }
InboxSummary is the API message for inbox summary info. This is used by the frontend to render the inbox sidebar item without fetching the actual inbox items. This returns json instead of jsonapi since it't not dealing with a particular resource.
type Index ¶
type Index struct { ID int `jsonapi:"primary,index"` // Standard fields CreatorID int CreatedTs int64 `json:"createdTs"` UpdaterID int UpdatedTs int64 `json:"updatedTs"` // Related fields DatabaseID int TableID int // Domain specific fields Name string `json:"name"` Expression string `json:"expression"` Position int `json:"position"` Type string `json:"type"` Unique bool `json:"unique"` Visible bool `json:"visible"` Comment string `json:"comment"` }
Index is the API message for an index.
type IndexCreate ¶
type IndexCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Related fields DatabaseID int TableID int // Domain specific fields Name string Expression string Position int Type string Unique bool Visible bool Comment string }
IndexCreate is the API message for creating an index.
type IndexFind ¶
type IndexFind struct { ID *int // Related fields DatabaseID *int TableID *int // Domain specific fields Name *string Expression *string }
IndexFind is the API message for finding indices.
type IndexService ¶
type IndexService interface { CreateIndex(ctx context.Context, create *IndexCreate) (*Index, error) FindIndexList(ctx context.Context, find *IndexFind) ([]*Index, error) FindIndex(ctx context.Context, find *IndexFind) (*Index, error) }
IndexService is the service for indices.
type Instance ¶
type Instance struct { ID int `jsonapi:"primary,instance"` // Standard fields RowStatus RowStatus `jsonapi:"attr,rowStatus"` CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields EnvironmentID int Environment *Environment `jsonapi:"relation,environment"` // Anomalies are stored in a separate table, but just return here for convenience AnomalyList []*Anomaly `jsonapi:"relation,anomalyList"` DataSourceList []*DataSource `jsonapi:"relation,dataSourceList"` // Domain specific fields Name string `jsonapi:"attr,name"` Engine db.Type `jsonapi:"attr,engine"` EngineVersion string `jsonapi:"attr,engineVersion"` ExternalLink string `jsonapi:"attr,externalLink"` Host string `jsonapi:"attr,host"` Port string `jsonapi:"attr,port"` Username string `jsonapi:"attr,username"` // Password is not returned to the client Password string }
Instance is the API message for an instance.
type InstanceCreate ¶
type InstanceCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Related fields EnvironmentID int `jsonapi:"attr,environmentId"` // Domain specific fields Name string `jsonapi:"attr,name"` Engine db.Type `jsonapi:"attr,engine"` ExternalLink string `jsonapi:"attr,externalLink"` Host string `jsonapi:"attr,host"` Port string `jsonapi:"attr,port"` Username string `jsonapi:"attr,username"` Password string `jsonapi:"attr,password"` }
InstanceCreate is the API message for creating an instance.
type InstanceFind ¶
InstanceFind is the API message for finding instances.
func (*InstanceFind) String ¶
func (find *InstanceFind) String() string
type InstanceMigration ¶
type InstanceMigration struct { Status InstanceMigrationSchemaStatus `jsonapi:"attr,status"` Error string `jsonapi:"attr,error"` }
InstanceMigration is the API message for instance migration.
type InstanceMigrationSchemaStatus ¶
type InstanceMigrationSchemaStatus string
InstanceMigrationSchemaStatus is the schema status for instance migration.
const ( // InstanceMigrationSchemaUnknown is the UNKNOWN InstanceMigrationSchemaStatus. InstanceMigrationSchemaUnknown InstanceMigrationSchemaStatus = "UNKNOWN" // InstanceMigrationSchemaOK is the OK InstanceMigrationSchemaStatus. InstanceMigrationSchemaOK InstanceMigrationSchemaStatus = "OK" // InstanceMigrationSchemaNotExist is the NOT_EXIST InstanceMigrationSchemaStatus. InstanceMigrationSchemaNotExist InstanceMigrationSchemaStatus = "NOT_EXIST" )
func (InstanceMigrationSchemaStatus) String ¶
func (e InstanceMigrationSchemaStatus) String() string
type InstancePatch ¶
type InstancePatch struct { ID int `jsonapi:"primary,instancePatch"` // Standard fields RowStatus *string `jsonapi:"attr,rowStatus"` // Value is assigned from the jwt subject field passed by the client. UpdaterID int // Domain specific fields Name *string `jsonapi:"attr,name"` EngineVersion *string ExternalLink *string `jsonapi:"attr,externalLink"` Host *string `jsonapi:"attr,host"` Port *string `jsonapi:"attr,port"` Username *string `jsonapi:"attr,username"` Password *string `jsonapi:"attr,password"` UseEmptyPassword bool `jsonapi:"attr,useEmptyPassword"` }
InstancePatch is the API message for patching an instance.
type InstanceService ¶
type InstanceService interface { // CreateInstance should also create the * database and the admin data source. CreateInstance(ctx context.Context, create *InstanceCreate) (*Instance, error) FindInstanceList(ctx context.Context, find *InstanceFind) ([]*Instance, error) FindInstance(ctx context.Context, find *InstanceFind) (*Instance, error) CountInstance(ctx context.Context, find *InstanceFind) (int, error) PatchInstance(ctx context.Context, patch *InstancePatch) (*Instance, error) }
InstanceService is the service for instances.
type InstanceUser ¶
type InstanceUser struct { ID int `jsonapi:"primary,instanceUser"` // Related fields InstanceID int `jsonapi:"attr,instanceId"` // Domain specific fields Name string `jsonapi:"attr,name"` Grant string `jsonapi:"attr,grant"` }
InstanceUser is the API message for instance user.
type InstanceUserDelete ¶
type InstanceUserDelete struct {
ID int
}
InstanceUserDelete is the API message for deleting an instance user.
type InstanceUserFind ¶
type InstanceUserFind struct {
InstanceID int
}
InstanceUserFind is the API message for finding instance users.
func (*InstanceUserFind) String ¶
func (find *InstanceUserFind) String() string
type InstanceUserService ¶
type InstanceUserService interface { // UpsertInstanceUser would update the existing user if name matches. UpsertInstanceUser(ctx context.Context, upsert *InstanceUserUpsert) (*InstanceUser, error) FindInstanceUserList(ctx context.Context, find *InstanceUserFind) ([]*InstanceUser, error) DeleteInstanceUser(ctx context.Context, delete *InstanceUserDelete) error }
InstanceUserService is the service for instance users.
type InstanceUserUpsert ¶
type InstanceUserUpsert struct { // Standard fields CreatorID int // Related fields InstanceID int // Domain specific fields Name string `jsonapi:"attr,name"` Grant string `jsonapi:"attr,grant"` }
InstanceUserUpsert is the API message for upserting an instance user.
type Issue ¶
type Issue struct { ID int `jsonapi:"primary,issue"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields ProjectID int Project *Project `jsonapi:"relation,project"` PipelineID int Pipeline *Pipeline `jsonapi:"relation,pipeline"` // Domain specific fields Name string `jsonapi:"attr,name"` Status IssueStatus `jsonapi:"attr,status"` Type IssueType `jsonapi:"attr,type"` Description string `jsonapi:"attr,description"` AssigneeID int `jsonapi:"attr,assigneeId"` Assignee *Principal `jsonapi:"relation,assignee"` SubscriberList []*Principal `jsonapi:"relation,subscriberList"` Payload string `jsonapi:"attr,payload"` }
Issue is the API message for an issue.
type IssueCreate ¶
type IssueCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Related fields ProjectID int `jsonapi:"attr,projectId"` PipelineID int Pipeline PipelineCreate `jsonapi:"attr,pipeline"` // Domain specific fields Name string `jsonapi:"attr,name"` Type IssueType `jsonapi:"attr,type"` Description string `jsonapi:"attr,description"` AssigneeID int `jsonapi:"attr,assigneeId"` SubscriberIDList []int `jsonapi:"attr,subscriberIdList"` Payload string `jsonapi:"attr,payload"` // CreateContext is used to create the issue pipeline and not persisted. // The context format depends on the issue type. For example, create database issue corresponds to CreateDatabaseContext. // This consolidates the pipeline generation to backend because both frontend and VCS pipeline could create issues and // we want the complexity resides in the backend. CreateContext string `jsonapi:"attr,createContext"` // ValidateOnly validates the request and previews the review, but does not actually post it. ValidateOnly bool `jsonapi:"attr,validateOnly"` }
IssueCreate is the API message for creating an issue.
type IssueFieldID ¶
type IssueFieldID string
IssueFieldID is the field ID for an issue. It has to be string type because the id for stage field contain multiple parts.
const ( // IssueFieldName is the field ID for name. IssueFieldName IssueFieldID = "1" // IssueFieldStatus is the field ID for status. IssueFieldStatus IssueFieldID = "2" // IssueFieldAssignee is the field ID for assignee. IssueFieldAssignee IssueFieldID = "3" // IssueFieldDescription is the field ID for description. IssueFieldDescription IssueFieldID = "4" // IssueFieldProject is the field ID for project. IssueFieldProject IssueFieldID = "5" // IssueFieldSubscriberList is the field ID for subscriber list. IssueFieldSubscriberList IssueFieldID = "6" // IssueFieldSQL is the field ID for SQL. IssueFieldSQL IssueFieldID = "7" )
type IssueFind ¶
type IssueFind struct { ID *int // Related fields ProjectID *int // Domain specific fields PipelineID *int // Find issue where principalID is either creator, assignee or subscriber PrincipalID *int StatusList *[]IssueStatus // If specified, then it will only fetch "Limit" most recently updated issues Limit *int }
IssueFind is the API message for finding issues.
type IssuePatch ¶
type IssuePatch struct { ID int `jsonapi:"primary,issuePatch"` // Standard fields // Value is assigned from the jwt subject field passed by the client. UpdaterID int // Domain specific fields Name *string `jsonapi:"attr,name"` // Status is only set manually via IssueStatusPatch Status *IssueStatus Description *string `jsonapi:"attr,description"` AssigneeID *int `jsonapi:"attr,assigneeId"` Payload *string `jsonapi:"attr,payload"` }
IssuePatch is the API message for patching an issue.
type IssueService ¶
type IssueService interface { CreateIssue(ctx context.Context, create *IssueCreate) (*Issue, error) FindIssueList(ctx context.Context, find *IssueFind) ([]*Issue, error) FindIssue(ctx context.Context, find *IssueFind) (*Issue, error) PatchIssue(ctx context.Context, patch *IssuePatch) (*Issue, error) }
IssueService is the services for issues.
type IssueStatus ¶
type IssueStatus string
IssueStatus is the status of an issue.
const ( // IssueOpen is the issue status for OPEN. IssueOpen IssueStatus = "OPEN" // IssueDone is the issue status for DONE. IssueDone IssueStatus = "DONE" // IssueCanceled is the issue status for CANCELED. IssueCanceled IssueStatus = "CANCELED" )
type IssueStatusPatch ¶
type IssueStatusPatch struct { ID int `jsonapi:"primary,issueStatusPatch"` // Standard fields // Value is assigned from the jwt subject field passed by the client. UpdaterID int // Domain specific fields Status IssueStatus `jsonapi:"attr,status"` Comment string `jsonapi:"attr,comment"` }
IssueStatusPatch is the API message for patching status of an issue.
type IssueSubscriber ¶
type IssueSubscriber struct { // Domain specific fields IssueID int `jsonapi:"attr,issueId"` SubscriberID int Subscriber *Principal `jsonapi:"relation,subscriber"` }
IssueSubscriber is the API message for an issue subscriber.
type IssueSubscriberCreate ¶
type IssueSubscriberCreate struct { // Domain specific fields IssueID int SubscriberID int `jsonapi:"attr,subscriberId"` }
IssueSubscriberCreate is the API message for creating an issue subscriber.
type IssueSubscriberDelete ¶
IssueSubscriberDelete is the API message for deleting an issue subscriber.
type IssueSubscriberFind ¶
IssueSubscriberFind is the API message for finding issue subscribers.
type IssueSubscriberService ¶
type IssueSubscriberService interface { CreateIssueSubscriber(ctx context.Context, create *IssueSubscriberCreate) (*IssueSubscriber, error) FindIssueSubscriberList(ctx context.Context, find *IssueSubscriberFind) ([]*IssueSubscriber, error) DeleteIssueSubscriber(ctx context.Context, delete *IssueSubscriberDelete) error }
IssueSubscriberService is the service for issue subscribers.
type IssueType ¶
type IssueType string
IssueType is the type of an issue.
const ( // IssueGeneral is the issue type for general issues. IssueGeneral IssueType = "bb.issue.general" // IssueDatabaseCreate is the issue type for creating databases. IssueDatabaseCreate IssueType = "bb.issue.database.create" // IssueDatabaseGrant is the issue type for granting databases. IssueDatabaseGrant IssueType = "bb.issue.database.grant" // IssueDatabaseSchemaUpdate is the issue type for updating database schemas (DDL). IssueDatabaseSchemaUpdate IssueType = "bb.issue.database.schema.update" // IssueDatabaseDataUpdate is the issue type for updating database data (DML). IssueDatabaseDataUpdate IssueType = "bb.issue.database.data.update" // IssueDataSourceRequest is the issue type for requesting database sources. IssueDataSourceRequest IssueType = "bb.issue.data-source.request" )
type LabelKey ¶
type LabelKey struct { ID int `jsonapi:"primary,labelKey"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Domain specific fields // bb.environment is a reserved key and identically mapped from environments. It has zero ID and its values are immutable. Key string `jsonapi:"attr,key"` ValueList []string `jsonapi:"attr,valueList"` }
LabelKey is the available key for labels.
type LabelKeyFind ¶
type LabelKeyFind struct { // RowStatus is the row status filter. RowStatus *RowStatus }
LabelKeyFind is the find request for label keys.
type LabelKeyPatch ¶
type LabelKeyPatch struct { ID int // Standard fields // Value is assigned from the jwt subject field passed by the client. // CreatorID is the ID of the creator. UpdaterID int // Domain specific fields ValueList []string `jsonapi:"attr,valueList"` }
LabelKeyPatch is the message to patch a label key.
func (*LabelKeyPatch) Validate ¶
func (patch *LabelKeyPatch) Validate() error
Validate validates the sanity of patch values.
type LabelSelector ¶
type LabelSelector struct { // MatchExpressions is a list of label selector requirements. The requirements are ANDed. MatchExpressions []*LabelSelectorRequirement `json:"matchExpressions"` }
LabelSelector is the API message for label selector.
type LabelSelectorRequirement ¶
type LabelSelectorRequirement struct { // Key is the label key that the selector applies to. Key string `json:"key"` // Operator represents a key's relationship to a set of values. Operator OperatorType `json:"operator"` // Values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. Values []string `json:"values"` }
LabelSelectorRequirement is the API message for label selector.
type LabelService ¶
type LabelService interface { // FindLabelKeyList finds all available keys for labels. FindLabelKeyList(ctx context.Context, find *LabelKeyFind) ([]*LabelKey, error) // PatchLabelKey patches a label key. PatchLabelKey(ctx context.Context, patch *LabelKeyPatch) (*LabelKey, error) // FindDatabaseLabelList finds all database labels matching the conditions, ascending by key. FindDatabaseLabelList(ctx context.Context, find *DatabaseLabelFind) ([]*DatabaseLabel, error) // SetDatabaseLabelList sets a database's labels to new labels. SetDatabaseLabelList(ctx context.Context, labels []*DatabaseLabel, databaseID int, updaterID int) ([]*DatabaseLabel, error) }
LabelService is the service for labels.
type Login ¶
type Login struct { // Domain specific fields Email string `jsonapi:"attr,email"` Password string `jsonapi:"attr,password"` }
Login is the API message for logins.
type Member ¶
type Member struct { ID int `jsonapi:"primary,member"` // Standard fields RowStatus RowStatus `jsonapi:"attr,rowStatus"` CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Domain specific fields Status MemberStatus `jsonapi:"attr,status"` Role Role `jsonapi:"attr,role"` PrincipalID int Principal *Principal `jsonapi:"relation,principal"` }
Member is the API message for a member.
type MemberCreate ¶
type MemberCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Domain specific fields Status MemberStatus `jsonapi:"attr,status"` Role Role `jsonapi:"attr,role"` PrincipalID int `jsonapi:"attr,principalId"` }
MemberCreate is the API message for creating a member.
type MemberFind ¶
MemberFind is the API message for finding members.
func (*MemberFind) String ¶
func (find *MemberFind) String() string
type MemberPatch ¶
type MemberPatch struct { ID int // Standard fields RowStatus *string `jsonapi:"attr,rowStatus"` // Value is assigned from the jwt subject field passed by the client. UpdaterID int // Domain specific fields Role *string `jsonapi:"attr,role"` }
MemberPatch is the API message for patching a member.
type MemberService ¶
type MemberService interface { CreateMember(ctx context.Context, create *MemberCreate) (*Member, error) FindMemberList(ctx context.Context, find *MemberFind) ([]*Member, error) FindMember(ctx context.Context, find *MemberFind) (*Member, error) PatchMember(ctx context.Context, patch *MemberPatch) (*Member, error) }
MemberService is the service for members.
type MemberStatus ¶
type MemberStatus string
MemberStatus is the status of an member.
const ( // Unknown is the member status for UNKNOWN. Unknown MemberStatus = "UNKNOWN" // Invited is the member status for INVITED. Invited MemberStatus = "INVITED" // Active is the member status for ACTIVE. Active MemberStatus = "ACTIVE" )
type MigrationHistory ¶
type MigrationHistory struct { ID int `jsonapi:"primary,migrationHistory"` // Standard fields Creator string `jsonapi:"attr,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` Updater string `jsonapi:"attr,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Domain specific fields ReleaseVersion string `jsonapi:"attr,releaseVersion"` Database string `jsonapi:"attr,database"` Source db.MigrationSource `jsonapi:"attr,source"` Type db.MigrationType `jsonapi:"attr,type"` Status db.MigrationStatus `jsonapi:"attr,status"` Version string `jsonapi:"attr,version"` Description string `jsonapi:"attr,description"` Statement string `jsonapi:"attr,statement"` Schema string `jsonapi:"attr,schema"` SchemaPrev string `jsonapi:"attr,schemaPrev"` ExecutionDurationNs int64 `jsonapi:"attr,executionDurationNs"` // This is a string instead of int as the issue id may come from other issue tracking system in the future IssueID string `jsonapi:"attr,issueId"` Payload string `jsonapi:"attr,payload"` }
MigrationHistory is stored in the instance instead of our own data file, so the field format is a bit different from the standard format
type OperatorType ¶
type OperatorType string
OperatorType is the type of label selector requirement operator. Valid operators are In, Exists. Note: NotIn and DoesNotExist are not supported initially.
const ( // InOperatorType is the operator type for In. InOperatorType OperatorType = "In" // ExistsOperatorType is the operator type for Exists. ExistsOperatorType OperatorType = "Exists" )
type Pipeline ¶
type Pipeline struct { ID int `jsonapi:"primary,pipeline"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields StageList []*Stage `jsonapi:"relation,stage"` // Domain specific fields Name string `jsonapi:"attr,name"` Status PipelineStatus `jsonapi:"attr,status"` }
Pipeline is the API message for pipelines.
type PipelineApprovalPolicy ¶
type PipelineApprovalPolicy struct {
Value PipelineApprovalValue `json:"value"`
}
PipelineApprovalPolicy is the policy configuration for pipeline approval
func UnmarshalPipelineApprovalPolicy ¶
func UnmarshalPipelineApprovalPolicy(payload string) (*PipelineApprovalPolicy, error)
UnmarshalPipelineApprovalPolicy will unmarshal payload to pipeline approval policy.
func (PipelineApprovalPolicy) String ¶
func (pa PipelineApprovalPolicy) String() (string, error)
type PipelineApprovalValue ¶
type PipelineApprovalValue string
PipelineApprovalValue is value for approval policy.
type PipelineCreate ¶
type PipelineCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Related fields StageList []StageCreate `jsonapi:"attr,stageList"` // Domain specific fields Name string `jsonapi:"attr,name"` }
PipelineCreate is the API message for creating a pipeline.
type PipelineFind ¶
type PipelineFind struct { ID *int // Domain specific fields Status *PipelineStatus }
PipelineFind is the API message for finding pipelines.
func (*PipelineFind) String ¶
func (find *PipelineFind) String() string
type PipelinePatch ¶
type PipelinePatch struct { ID int `jsonapi:"primary,pipelinePatch"` // Standard fields // Value is assigned from the jwt subject field passed by the client. UpdaterID int // Domain specific fields Status *PipelineStatus `jsonapi:"attr,status"` }
PipelinePatch is the API message for patching a pipeline.
type PipelineService ¶
type PipelineService interface { CreatePipeline(ctx context.Context, create *PipelineCreate) (*Pipeline, error) FindPipelineList(ctx context.Context, find *PipelineFind) ([]*Pipeline, error) FindPipeline(ctx context.Context, find *PipelineFind) (*Pipeline, error) PatchPipeline(ctx context.Context, patch *PipelinePatch) (*Pipeline, error) }
PipelineService is the service for pipelines.
type PipelineStatus ¶
type PipelineStatus string
PipelineStatus is the status for pipelines.
const ( // PipelineOpen is the pipeline status for OPEN. PipelineOpen PipelineStatus = "OPEN" // PipelineDone is the pipeline status for DONE. PipelineDone PipelineStatus = "DONE" // PipelineCanceled is the pipeline status for CANCELED. PipelineCanceled PipelineStatus = "CANCELED" )
func (PipelineStatus) String ¶
func (e PipelineStatus) String() string
type Plan ¶
type Plan struct {
Type PlanType `jsonapi:"attr,type"`
}
Plan is the API message for a plan.
type PlanPatch ¶
type PlanPatch struct {
Type PlanType `jsonapi:"attr,type"`
}
PlanPatch is the API message for patching a plan.
type Policy ¶
type Policy struct { ID int `jsonapi:"primary,policy"` // Standard fields RowStatus RowStatus `jsonapi:"attr,rowStatus"` CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields EnvironmentID int Environment *Environment `jsonapi:"relation,environment"` // Domain specific fields Type PolicyType `jsonapi:"attr,type"` Payload string `jsonapi:"attr,payload"` }
Policy is the API message for a policy.
type PolicyFind ¶
type PolicyFind struct { ID *int // Related fields EnvironmentID *int // Domain specific fields Type *PolicyType `jsonapi:"attr,type"` }
PolicyFind is the message to get a policy.
type PolicyService ¶
type PolicyService interface { FindPolicy(ctx context.Context, find *PolicyFind) (*Policy, error) UpsertPolicy(ctx context.Context, upsert *PolicyUpsert) (*Policy, error) GetBackupPlanPolicy(ctx context.Context, environmentID int) (*BackupPlanPolicy, error) GetPipelineApprovalPolicy(ctx context.Context, environmentID int) (*PipelineApprovalPolicy, error) }
PolicyService is the backend for policies.
type PolicyUpsert ¶
type PolicyUpsert struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. // CreatorID is the ID of the creator. UpdaterID int // Related fields EnvironmentID int // Domain specific fields Type PolicyType Payload string `jsonapi:"attr,payload"` }
PolicyUpsert is the message to upsert a policy. NOTE: We use PATCH for Upsert, this is inspired by https://google.aip.dev/134#patch-and-put
type Principal ¶
type Principal struct { ID int `jsonapi:"primary,principal"` // Standard fields CreatorID int `jsonapi:"attr,creatorId"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int `jsonapi:"attr,updaterId"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Domain specific fields Type PrincipalType `jsonapi:"attr,type"` Name string `jsonapi:"attr,name"` Email string `jsonapi:"attr,email"` // Do not return to the client PasswordHash string // Role is stored in the member table, but we include it when returning the principal. // This simplifies the client code where it won't require order depenendency to fetch the related member info first. Role Role `jsonapi:"attr,role"` }
Principal is the API message for principals.
func (*Principal) MarshalJSON ¶
MarshalJSON customizes the Principal Marshal method so the returned object can map directly to the frontend Principal object without any conversion.
type PrincipalAuthProvider ¶
type PrincipalAuthProvider string
PrincipalAuthProvider is the type of an authentication provider.
const ( // PrincipalAuthProviderBytebase is the Bytebase's own authentication provider. PrincipalAuthProviderBytebase PrincipalAuthProvider = "BYTEBASE" // PrincipalAuthProviderGitlabSelfHost is the self-hosted GitLab authentication provider. PrincipalAuthProviderGitlabSelfHost PrincipalAuthProvider = "GITLAB_SELF_HOST" )
type PrincipalCreate ¶
type PrincipalCreate struct { // Standard fields // For signup, value is SYSTEM_BOT_ID // For invite, value is assigned from the jwt subject field passed by the client. CreatorID int // Domain specific fields Type PrincipalType Name string `jsonapi:"attr,name"` Email string `jsonapi:"attr,email"` Password string `jsonapi:"attr,password"` PasswordHash string }
PrincipalCreate is the API message for creating a principal.
type PrincipalFind ¶
PrincipalFind is the API message for finding principals.
func (*PrincipalFind) String ¶
func (find *PrincipalFind) String() string
type PrincipalPatch ¶
type PrincipalPatch struct { ID int // Standard fields // Value is assigned from the jwt subject field passed by the client. UpdaterID int // Domain specific fields Name *string `jsonapi:"attr,name"` Password *string `jsonapi:"attr,password"` PasswordHash *string }
PrincipalPatch is the API message for patching a principal.
type PrincipalService ¶
type PrincipalService interface { CreatePrincipal(ctx context.Context, create *PrincipalCreate) (*Principal, error) FindPrincipalList(ctx context.Context) ([]*Principal, error) FindPrincipal(ctx context.Context, find *PrincipalFind) (*Principal, error) PatchPrincipal(ctx context.Context, patch *PrincipalPatch) (*Principal, error) }
PrincipalService is the service for principals.
type PrincipalType ¶
type PrincipalType string
PrincipalType is the type of a principal.
const ( // EndUser is the principal type for END_USER. EndUser PrincipalType = "END_USER" // BOT is the principal type for BOT. BOT PrincipalType = "BOT" )
func (PrincipalType) String ¶
func (e PrincipalType) String() string
type Project ¶
type Project struct { ID int `jsonapi:"primary,project"` // Standard fields RowStatus RowStatus `jsonapi:"attr,rowStatus"` CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields ProjectMemberList []*ProjectMember `jsonapi:"relation,projectMember"` // Domain specific fields Name string `jsonapi:"attr,name"` Key string `jsonapi:"attr,key"` WorkflowType ProjectWorkflowType `jsonapi:"attr,workflowType"` Visibility ProjectVisibility `jsonapi:"attr,visibility"` TenantMode ProjectTenantMode `jsonapi:"attr,tenantMode"` // DBNameTemplate is only used when a project is in tenant mode. // Empty value means {{DB_NAME}}. DBNameTemplate string `jsonapi:"attr,dbNameTemplate"` RoleProvider ProjectRoleProvider `jsonapi:"attr,roleProvider"` }
Project is the API message for a project.
type ProjectCreate ¶
type ProjectCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Domain specific fields Name string `jsonapi:"attr,name"` Key string `jsonapi:"attr,key"` TenantMode ProjectTenantMode `jsonapi:"attr,tenantMode"` DBNameTemplate string `jsonapi:"attr,dbNameTemplate"` RoleProvider ProjectRoleProvider `jsonapi:"attr,roleProvider"` }
ProjectCreate is the API message for creating a project.
type ProjectFind ¶
type ProjectFind struct { ID *int // Standard fields RowStatus *RowStatus // Domain specific fields // If present, will only find project containing PrincipalID as an active member PrincipalID *int }
ProjectFind is the API message for finding projects.
func (*ProjectFind) String ¶
func (find *ProjectFind) String() string
type ProjectMember ¶
type ProjectMember struct { ID int `jsonapi:"primary,projectMember"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields // Just returns ProjectID otherwise would cause circular dependency. ProjectID int `jsonapi:"attr,projectId"` // Domain specific fields Role string `jsonapi:"attr,role"` PrincipalID int Principal *Principal `jsonapi:"relation,principal"` RoleProvider ProjectRoleProvider `jsonapi:"attr,roleProvider"` Payload string `jsonapi:"attr,payload"` }
ProjectMember is the API message for project members.
type ProjectMemberBatchUpdate ¶
type ProjectMemberBatchUpdate struct { ID int // Standard fields // Value is assigned from the jwt subject field passed by the client. UpdaterID int // All the Member to be update should have the same role provider as this field RoleProvider ProjectRoleProvider List []*ProjectMemberCreate }
ProjectMemberBatchUpdate is the API message for batch updating project member.
type ProjectMemberCreate ¶
type ProjectMemberCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Related fields ProjectID int // Domain specific fields Role common.ProjectRole `jsonapi:"attr,role"` PrincipalID int `jsonapi:"attr,principalId"` RoleProvider ProjectRoleProvider `jsonapi:"attr,roleProvider"` Payload string `jsonapi:"attr,payload"` }
ProjectMemberCreate is the API message for creating a project member.
type ProjectMemberDelete ¶
type ProjectMemberDelete struct { ID int // Standard fields // Value is assigned from the jwt subject field passed by the client. DeleterID int }
ProjectMemberDelete is the API message for deleting a project member.
type ProjectMemberFind ¶
type ProjectMemberFind struct { ID *int // Related fields ProjectID *int RoleProvider *ProjectRoleProvider }
ProjectMemberFind is the API message for finding project members.
func (*ProjectMemberFind) String ¶
func (find *ProjectMemberFind) String() string
type ProjectMemberPatch ¶
type ProjectMemberPatch struct { ID int // Standard fields // Value is assigned from the jwt subject field passed by the client. UpdaterID int // Domain specific fields Role *string `jsonapi:"attr,role"` RoleProvider *string `jsonapi:"attr,roleProvider"` Payload *string `jsonapi:"attr,payload"` }
ProjectMemberPatch is the API message for patching a project member.
type ProjectMemberService ¶
type ProjectMemberService interface { CreateProjectMember(ctx context.Context, create *ProjectMemberCreate) (*ProjectMember, error) FindProjectMemberList(ctx context.Context, find *ProjectMemberFind) ([]*ProjectMember, error) FindProjectMember(ctx context.Context, find *ProjectMemberFind) (*ProjectMember, error) PatchProjectMember(ctx context.Context, patch *ProjectMemberPatch) (*ProjectMember, error) DeleteProjectMember(ctx context.Context, delete *ProjectMemberDelete) error BatchUpdateProjectMember(ctx context.Context, set *ProjectMemberBatchUpdate) (createdMember, deletedMember []*ProjectMember, err error) }
ProjectMemberService is the service for project members.
type ProjectPatch ¶
type ProjectPatch struct { ID int `jsonapi:"primary,projectPatch"` // Standard fields RowStatus *string `jsonapi:"attr,rowStatus"` // Value is assigned from the jwt subject field passed by the client. UpdaterID int // Domain specific fields Name *string `jsonapi:"attr,name"` Key *string `jsonapi:"attr,key"` WorkflowType *ProjectWorkflowType `jsonapi:"attr,workflowType"` RoleProvider *string `jsonapi:"attr,roleProvider"` }
ProjectPatch is the API message for patching a project.
type ProjectRaw ¶
type ProjectRaw struct { ID int // Standard fields RowStatus RowStatus CreatorID int CreatedTs int64 UpdaterID int UpdatedTs int64 // Domain specific fields Name string Key string WorkflowType ProjectWorkflowType Visibility ProjectVisibility TenantMode ProjectTenantMode DBNameTemplate string RoleProvider ProjectRoleProvider }
ProjectRaw is the store model for a project. Fields have exactly the same meanings as Project.
func (*ProjectRaw) ToProject ¶
func (raw *ProjectRaw) ToProject() *Project
ToProject creates an instance of Project based on the ProjectRaw. This is intended to be used when we need to compose a Project relationship.
type ProjectRoleProvider ¶
type ProjectRoleProvider string
ProjectRoleProvider is the role provider for a user in projects.
const ( // ProjectRoleProviderBytebase is the role provider of a project. ProjectRoleProviderBytebase ProjectRoleProvider = "BYTEBASE" // ProjectRoleProviderGitLabSelfHost is the role provider of a project. ProjectRoleProviderGitLabSelfHost ProjectRoleProvider = "GITLAB_SELF_HOST" )
func (ProjectRoleProvider) String ¶
func (e ProjectRoleProvider) String() string
type ProjectRoleProviderPayload ¶
type ProjectRoleProviderPayload struct { VCSRole string `json:"vcsRole"` LastSyncTs int64 `json:"lastSyncTs"` }
ProjectRoleProviderPayload is the payload for role provider
type ProjectService ¶
type ProjectService interface { CreateProject(ctx context.Context, create *ProjectCreate) (*ProjectRaw, error) FindProjectList(ctx context.Context, find *ProjectFind) ([]*ProjectRaw, error) FindProject(ctx context.Context, find *ProjectFind) (*ProjectRaw, error) PatchProject(ctx context.Context, patch *ProjectPatch) (*ProjectRaw, error) // This is specifically used to update the ProjectWorkflowType when linking/unlinking the repository. PatchProjectTx(ctx context.Context, tx *sql.Tx, patch *ProjectPatch) (*ProjectRaw, error) }
ProjectService is the storage access service for projects.
type ProjectTenantMode ¶
type ProjectTenantMode string
ProjectTenantMode is the tenant mode setting for project.
const ( // TenantModeDisabled is the DISABLED value for ProjectTenantMode. TenantModeDisabled ProjectTenantMode = "DISABLED" // TenantModeTenant is the TENANT value for ProjectTenantMode. TenantModeTenant ProjectTenantMode = "TENANT" )
type ProjectVisibility ¶
type ProjectVisibility string
ProjectVisibility is the visibility of a project.
const ( // Public is the project visibility for PUBLIC. Public ProjectVisibility = "PUBLIC" // Private is the project visibility for PRIVATE. Private ProjectVisibility = "PRIVATE" )
func (ProjectVisibility) String ¶
func (e ProjectVisibility) String() string
type ProjectWebhook ¶
type ProjectWebhook struct { ID int `jsonapi:"primary,projectWebhookMember"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields // Just returns ProjectID since it always operates within the project context ProjectID int `jsonapi:"attr,projecId"` // Domain specific fields Type string `jsonapi:"attr,type"` Name string `jsonapi:"attr,name"` URL string `jsonapi:"attr,url"` ActivityList []string `jsonapi:"attr,activityList"` }
ProjectWebhook is the API message for project webhooks.
type ProjectWebhookCreate ¶
type ProjectWebhookCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Related fields ProjectID int // Domain specific fields Type string `jsonapi:"attr,type"` Name string `jsonapi:"attr,name"` URL string `jsonapi:"attr,url"` ActivityList []string `jsonapi:"attr,activityList"` }
ProjectWebhookCreate is the API message for creating a project webhook.
type ProjectWebhookDelete ¶
type ProjectWebhookDelete struct { ID int // Standard fields // Value is assigned from the jwt subject field passed by the client. DeleterID int }
ProjectWebhookDelete is the API message for deleting a project webhook.
type ProjectWebhookFind ¶
type ProjectWebhookFind struct { ID *int // Related fields ProjectID *int ActivityType *ActivityType }
ProjectWebhookFind is the API message for finding project webhooks.
func (*ProjectWebhookFind) String ¶
func (find *ProjectWebhookFind) String() string
type ProjectWebhookPatch ¶
type ProjectWebhookPatch struct { ID int // Standard fields // Value is assigned from the jwt subject field passed by the client. UpdaterID int // Domain specific fields Name *string `jsonapi:"attr,name"` URL *string `jsonapi:"attr,url"` ActivityList *string `jsonapi:"attr,activityList"` }
ProjectWebhookPatch is the API message for patching a project webhook.
type ProjectWebhookService ¶
type ProjectWebhookService interface { CreateProjectWebhook(ctx context.Context, create *ProjectWebhookCreate) (*ProjectWebhook, error) FindProjectWebhookList(ctx context.Context, find *ProjectWebhookFind) ([]*ProjectWebhook, error) FindProjectWebhook(ctx context.Context, find *ProjectWebhookFind) (*ProjectWebhook, error) PatchProjectWebhook(ctx context.Context, patch *ProjectWebhookPatch) (*ProjectWebhook, error) DeleteProjectWebhook(ctx context.Context, delete *ProjectWebhookDelete) error }
ProjectWebhookService is the service for project webhooks.
type ProjectWebhookTestResult ¶
type ProjectWebhookTestResult struct {
Error string `jsonapi:"attr,error"`
}
ProjectWebhookTestResult is the test result of a project webhook.
type ProjectWorkflowType ¶
type ProjectWorkflowType string
ProjectWorkflowType is the workflow type for projects.
const ( // UIWorkflow is the UI workflow. UIWorkflow ProjectWorkflowType = "UI" // VCSWorkflow is the VCS workflow. VCSWorkflow ProjectWorkflowType = "VCS" )
func (ProjectWorkflowType) String ¶
func (e ProjectWorkflowType) String() string
type Repository ¶
type Repository struct { ID int `jsonapi:"primary,repository"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields VCSID int VCS *VCS `jsonapi:"relation,vcs"` ProjectID int Project *Project `jsonapi:"relation,project"` // Domain specific fields Name string `jsonapi:"attr,name"` FullPath string `jsonapi:"attr,fullPath"` WebURL string `jsonapi:"attr,webUrl"` BranchFilter string `jsonapi:"attr,branchFilter"` BaseDirectory string `jsonapi:"attr,baseDirectory"` // The file path template for matching the committed migration script. FilePathTemplate string `jsonapi:"attr,filePathTemplate"` // The file path template for storing the latest schema auto-generated by Bytebase after migration. // If empty, then Bytebase won't auto generate it. SchemaPathTemplate string `jsonapi:"attr,schemaPathTemplate"` ExternalID string `jsonapi:"attr,externalId"` ExternalWebhookID string WebhookURLHost string WebhookEndpointID string WebhookSecretToken string // These will be exclusively used on the server side and we don't return it to the client. AccessToken string ExpiresTs int64 RefreshToken string }
Repository is the API message for a repository.
type RepositoryCreate ¶
type RepositoryCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Related fields VCSID int `jsonapi:"attr,vcsId"` ProjectID int // Domain specific fields Name string `jsonapi:"attr,name"` FullPath string `jsonapi:"attr,fullPath"` WebURL string `jsonapi:"attr,webUrl"` BranchFilter string `jsonapi:"attr,branchFilter"` BaseDirectory string `jsonapi:"attr,baseDirectory"` FilePathTemplate string `jsonapi:"attr,filePathTemplate"` SchemaPathTemplate string `jsonapi:"attr,schemaPathTemplate"` ExternalID string `jsonapi:"attr,externalId"` // Token belonged by the user linking the project to the VCS repository. We store this token together // with the refresh token in the new repository record so we can use it to call VCS API on // behalf of that user to perform tasks like webhook CRUD later. AccessToken string `jsonapi:"attr,accessToken"` ExpiresTs int64 `jsonapi:"attr,expiresTs"` RefreshToken string `jsonapi:"attr,refreshToken"` ExternalWebhookID string WebhookURLHost string WebhookEndpointID string WebhookSecretToken string }
RepositoryCreate is the API message for creating a repository.
type RepositoryDelete ¶
type RepositoryDelete struct { // Related fields // When deleting the repository, we need to update the corresponding project workflow type to "UI", // thus we use ProjectID here. ProjectID int // Standard fields // Value is assigned from the jwt subject field passed by the client. DeleterID int }
RepositoryDelete is the API message for deleting a repository.
type RepositoryFind ¶
type RepositoryFind struct { ID *int // Related fields VCSID *int ProjectID *int // Domain specific fields WebhookEndpointID *string }
RepositoryFind is the API message for finding repositories.
func (*RepositoryFind) String ¶
func (find *RepositoryFind) String() string
type RepositoryPatch ¶
type RepositoryPatch struct { ID int `jsonapi:"primary,repositoryPatch"` // Standard fields // Value is assigned from the jwt subject field passed by the client. UpdaterID int // Domain specific fields BranchFilter *string `jsonapi:"attr,branchFilter"` BaseDirectory *string `jsonapi:"attr,baseDirectory"` FilePathTemplate *string `jsonapi:"attr,filePathTemplate"` SchemaPathTemplate *string `jsonapi:"attr,schemaPathTemplate"` AccessToken *string ExpiresTs *int64 RefreshToken *string }
RepositoryPatch is the API message for patching a repository.
type RepositoryService ¶
type RepositoryService interface { CreateRepository(ctx context.Context, create *RepositoryCreate) (*Repository, error) FindRepositoryList(ctx context.Context, find *RepositoryFind) ([]*Repository, error) FindRepository(ctx context.Context, find *RepositoryFind) (*Repository, error) PatchRepository(ctx context.Context, patch *RepositoryPatch) (*Repository, error) DeleteRepository(ctx context.Context, delete *RepositoryDelete) error }
RepositoryService is the service for repositories.
type SQLExecute ¶
type SQLExecute struct { InstanceID int `jsonapi:"attr,instanceId"` // For engines like MySQL, databaseName can be empty. DatabaseName string `jsonapi:"attr,databaseName"` Statement string `jsonapi:"attr,statement"` // For now, Readonly must be true Readonly bool `jsonapi:"attr,readonly"` // The maximum row count returned, only applicable to SELECT query. // Not enforced if limit <= 0. Limit int `jsonapi:"attr,limit"` }
SQLExecute is the API message for execute SQL. For now, we only support readonly / SELECT.
type SQLResultSet ¶
type SQLResultSet struct { // A list of rows marshalled into a JSON. Data string `jsonapi:"attr,data"` // SQL operation may fail for connection issue and there is no proper http status code for it, so we return error in the response body. Error string `jsonapi:"attr,error"` }
SQLResultSet is the API message for SQL results.
type SQLService ¶
type SQLService interface {
Ping(ctx context.Context, config *ConnectionInfo) (*SQLResultSet, error)
}
SQLService is the service for SQL.
type SQLSyncSchema ¶
type SQLSyncSchema struct {
InstanceID int `jsonapi:"attr,instanceId"`
}
SQLSyncSchema is the API message for sync schemas.
type ServerInfo ¶
type ServerInfo struct { Version string `json:"version"` Readonly bool `json:"readonly"` Demo bool `json:"demo"` Host string `json:"host"` Port string `json:"port"` NeedAdminSetup bool `json:"needAdminSetup"` StartedTs int64 `json:"startedTs"` }
ServerInfo is the API message for server info. Actuator concept is similar to the Spring Boot Actuator
type Setting ¶
type Setting struct { ID int `jsonapi:"primary,setting"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Domain specific fields Name SettingName `jsonapi:"attr,name"` Value string `jsonapi:"attr,value"` Description string `jsonapi:"attr,description"` }
Setting is the API message for a setting.
type SettingCreate ¶
type SettingCreate struct { CreatorID int Name SettingName Value string Description string }
SettingCreate is the API message for creating a setting.
type SettingFind ¶
type SettingFind struct {
Name *SettingName
}
SettingFind is the API message for finding settings.
func (*SettingFind) String ¶
func (find *SettingFind) String() string
type SettingName ¶
type SettingName string
SettingName is the name of a setting.
const ( // SettingAuthSecret is the setting name for auth secret. SettingAuthSecret SettingName = "bb.auth.secret" )
type SettingPatch ¶
type SettingPatch struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. UpdaterID int Name SettingName Value string `jsonapi:"attr,value"` }
SettingPatch is the API message for patching a setting.
type SettingService ¶
type SettingService interface { // Creates new setting and returns if not exist, returns the existing one otherwise. CreateSettingIfNotExist(ctx context.Context, create *SettingCreate) (*Setting, error) FindSettingList(ctx context.Context, find *SettingFind) ([]*Setting, error) FindSetting(ctx context.Context, find *SettingFind) (*Setting, error) PatchSetting(ctx context.Context, patch *SettingPatch) (*Setting, error) }
SettingService is the service for settings.
type Sheet ¶
type Sheet struct { ID int `jsonapi:"primary,sheet"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields ProjectID int `jsonapi:"attr,projectId"` Project *Project `jsonapi:"relation,project"` // The DatabaseID is optional. // If not NULL, the sheet ProjectID should always be equal to the id of the database related project. // A project must remove all linked sheets for a particular database before that database can be transferred to a different project. DatabaseID *int `jsonapi:"attr,databaseId"` Database *Database `jsonapi:"relation,database"` // Domain specific fields Name string `jsonapi:"attr,name"` Statement string `jsonapi:"attr,statement"` Visibility SheetVisibility `jsonapi:"attr,visibility"` }
Sheet is the API message for a sheet.
type SheetCreate ¶
type SheetCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Related fields ProjectID int `jsonapi:"attr,projectId"` DatabaseID *int `jsonapi:"attr,databaseId"` // Domain specific fields Name string `jsonapi:"attr,name"` Statement string `jsonapi:"attr,statement"` Visibility SheetVisibility `jsonapi:"attr,visibility"` }
SheetCreate is the API message for creating a sheet.
type SheetDelete ¶
type SheetDelete struct { ID int // Standard fields // Value is assigned from the jwt subject field passed by the client. DeleterID int }
SheetDelete is the API message for deleting a sheet.
type SheetFind ¶
type SheetFind struct { // Standard fields ID *int RowStatus *RowStatus // Value is assigned from the jwt subject field passed by the client. CreatorID *int // Related fields ProjectID *int // Query all related sheets with databaseId can be used for database transfer checking. DatabaseID *int // Domain fields Visibility *SheetVisibility }
SheetFind is the API message for finding sheets.
type SheetPatch ¶
type SheetPatch struct { ID int `jsonapi:"primary,sheetPatch"` // Standard fields // Value is assigned from the jwt subject field passed by the client. UpdaterID int // Related fields ProjectID int `jsonapi:"attr,projectId"` DatabaseID *int `jsonapi:"attr,databaseId"` // Domain specific fields Name *string `jsonapi:"attr,name"` Statement *string `jsonapi:"attr,statement"` Visibility *string `jsonapi:"attr,visibility"` }
SheetPatch is the API message for patching a sheet.
type SheetService ¶
type SheetService interface { CreateSheet(ctx context.Context, create *SheetCreate) (*Sheet, error) PatchSheet(ctx context.Context, patch *SheetPatch) (*Sheet, error) FindSheetList(ctx context.Context, find *SheetFind) ([]*Sheet, error) FindSheet(ctx context.Context, find *SheetFind) (*Sheet, error) DeleteSheet(ctx context.Context, delete *SheetDelete) error }
SheetService is the service for sheet.
type SheetVisibility ¶
type SheetVisibility string
SheetVisibility is the visibility of a sheet.
const ( // PrivateSheet is the sheet visibility for PRIVATE. Only sheet OWNER can read/write. PrivateSheet SheetVisibility = "PRIVATE" // ProjectSheet is the sheet visibility for PROJECT. Both sheet OWNER and project OWNER can read/write, and project DEVELOPER can read. ProjectSheet SheetVisibility = "PROJECT" // PublicSheet is the sheet visibility for PUBLIC. Sheet OWNER can read/write, and all others can read. PublicSheet SheetVisibility = "PUBLIC" )
func (SheetVisibility) String ¶
func (v SheetVisibility) String() string
type Signup ¶
type Signup struct { // Domain specific fields Name string `jsonapi:"attr,name"` Email string `jsonapi:"attr,email"` Password string `jsonapi:"attr,password"` }
Signup is the API message for sign-ups.
type Stage ¶
type Stage struct { ID int `jsonapi:"primary,stage"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields // Just returns PipelineID otherwise would cause circular dependency. PipelineID int `jsonapi:"attr,pipelineId"` EnvironmentID int Environment *Environment `jsonapi:"relation,environment"` TaskList []*Task `jsonapi:"relation,task"` // Domain specific fields Name string `jsonapi:"attr,name"` }
Stage is the API message for a stage.
type StageCreate ¶
type StageCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Related fields EnvironmentID int `jsonapi:"attr,environmentId"` PipelineID int TaskList []TaskCreate `jsonapi:"attr,taskList"` // Domain specific fields Name string `jsonapi:"attr,name"` }
StageCreate is the API message for creating a stage.
type StageService ¶
type StageService interface { CreateStage(ctx context.Context, create *StageCreate) (*Stage, error) FindStageList(ctx context.Context, find *StageFind) ([]*Stage, error) FindStage(ctx context.Context, find *StageFind) (*Stage, error) }
StageService is the service for stages.
type SyncStatus ¶
type SyncStatus string
SyncStatus is the database sync status.
const ( // OK is the OK sync status. OK SyncStatus = "OK" // NotFound is the NOT_FOUND sync status. NotFound SyncStatus = "NOT_FOUND" )
func (SyncStatus) String ¶
func (e SyncStatus) String() string
type Table ¶
type Table struct { ID int `jsonapi:"primary,table"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields DatabaseID int Database *Database `jsonapi:"relation,database"` // Domain specific fields Name string `jsonapi:"attr,name"` Type string `jsonapi:"attr,type"` Engine string `jsonapi:"attr,engine"` Collation string `jsonapi:"attr,collation"` RowCount int64 `jsonapi:"attr,rowCount"` DataSize int64 `jsonapi:"attr,dataSize"` IndexSize int64 `jsonapi:"attr,indexSize"` DataFree int64 `jsonapi:"attr,dataFree"` CreateOptions string `jsonapi:"attr,createOptions"` Comment string `jsonapi:"attr,comment"` ColumnList []*Column `jsonapi:"attr,columnList"` IndexList []*Index `jsonapi:"attr,indexList"` }
Table is the API message for a table.
type TableCreate ¶
type TableCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int CreatedTs int64 UpdatedTs int64 // Related fields DatabaseID int // Domain specific fields Name string Type string Engine string Collation string RowCount int64 DataSize int64 IndexSize int64 DataFree int64 CreateOptions string Comment string }
TableCreate is the API message for creating a table.
type TableDelete ¶
type TableDelete struct { // Related fields DatabaseID int }
TableDelete is the API message for deleting a table.
type TableFind ¶
type TableFind struct { ID *int // Related fields DatabaseID *int // Domain specific fields Name *string }
TableFind is the API message for finding tables.
type TableService ¶
type TableService interface { CreateTable(ctx context.Context, create *TableCreate) (*Table, error) FindTableList(ctx context.Context, find *TableFind) ([]*Table, error) FindTable(ctx context.Context, find *TableFind) (*Table, error) DeleteTable(ctx context.Context, delete *TableDelete) error }
TableService is the service for tables.
type Task ¶
type Task struct { ID int `jsonapi:"primary,task"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields // Just returns PipelineID and StageID otherwise would cause circular dependency. PipelineID int `jsonapi:"attr,pipelineId"` StageID int `jsonapi:"attr,stageId"` InstanceID int Instance *Instance `jsonapi:"relation,instance"` // Could be empty for creating database task when the task isn't yet completed successfully. DatabaseID *int Database *Database `jsonapi:"relation,database"` TaskRunList []*TaskRun `jsonapi:"relation,taskRun"` TaskCheckRunList []*TaskCheckRun `jsonapi:"relation,taskCheckRun"` // Domain specific fields Name string `jsonapi:"attr,name"` Status TaskStatus `jsonapi:"attr,status"` Type TaskType `jsonapi:"attr,type"` Payload string `jsonapi:"attr,payload"` EarliestAllowedTs int64 `jsonapi:"attr,earliestAllowedTs"` }
Task is the API message for a task.
type TaskCheckDatabaseStatementAdvisePayload ¶
type TaskCheckDatabaseStatementAdvisePayload struct { Statement string `json:"statement,omitempty"` DbType db.Type `json:"dbType,omitempty"` Charset string `json:"charset,omitempty"` Collation string `json:"collation,omitempty"` }
TaskCheckDatabaseStatementAdvisePayload is the task check payload for database statement advise.
type TaskCheckEarliestAllowedTimePayload ¶
type TaskCheckEarliestAllowedTimePayload struct {
EarliestAllowedTs int64 `json:"earliestAllowedTs,omitempty"`
}
TaskCheckEarliestAllowedTimePayload is the task check payload for earliest allowed time.
type TaskCheckResult ¶
type TaskCheckResult struct { Status TaskCheckStatus `json:"status,omitempty"` Code common.Code `json:"code,omitempty"` Title string `json:"title,omitempty"` Content string `json:"content,omitempty"` }
TaskCheckResult is the result of task checks.
type TaskCheckRun ¶
type TaskCheckRun struct { ID int `jsonapi:"primary,taskCheckRun"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields TaskID int `jsonapi:"attr,taskId"` // Domain specific fields Status TaskCheckRunStatus `jsonapi:"attr,status"` Type TaskCheckType `jsonapi:"attr,type"` Code common.Code `jsonapi:"attr,code"` Comment string `jsonapi:"attr,comment"` Result string `jsonapi:"attr,result"` Payload string `jsonapi:"attr,payload"` }
TaskCheckRun is the API message for task check run.
type TaskCheckRunCreate ¶
type TaskCheckRunCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Related fields TaskID int // Domain specific fields Type TaskCheckType `jsonapi:"attr,type"` Comment string `jsonapi:"attr,comment"` Payload string `jsonapi:"attr,payload"` // If true, then we will skip creating the task check run if there has already been a DONE check run // for this (TaskID, Type) pair. The check is done at the store layer so that we can wrap it in the // same transaction. // This is NOT persisted into the db SkipIfAlreadyTerminated bool }
TaskCheckRunCreate is the API message for creating a task check run.
type TaskCheckRunFind ¶
type TaskCheckRunFind struct { ID *int // Related fields TaskID *int Type *TaskCheckType // Domain specific fields StatusList *[]TaskCheckRunStatus // If true, only returns the latest Latest bool }
TaskCheckRunFind is the API message for finding task check runs.
func (*TaskCheckRunFind) String ¶
func (find *TaskCheckRunFind) String() string
type TaskCheckRunResultPayload ¶
type TaskCheckRunResultPayload struct { Detail string `json:"detail,omitempty"` ResultList []TaskCheckResult `json:"resultList,omitempty"` }
TaskCheckRunResultPayload is the result payload of a task check run.
type TaskCheckRunService ¶
type TaskCheckRunService interface { // For a particular task and a particular check type, we only create a new TaskCheckRun if matches all conditions below: // 1. There is no existing RUNNING check run. If this is the case, then returns that RUNNING check run. // 2. If SkipIfAlreadyTerminated is false, or if SkipIfAlreadyTerminated is true and there is no DONE/FAILED/CANCELED check run. If this is the case, // then returns that terminated check run. CreateTaskCheckRunIfNeeded(ctx context.Context, create *TaskCheckRunCreate) (*TaskCheckRun, error) FindTaskCheckRunList(ctx context.Context, find *TaskCheckRunFind) ([]*TaskCheckRun, error) FindTaskCheckRunListTx(ctx context.Context, tx *sql.Tx, find *TaskCheckRunFind) ([]*TaskCheckRun, error) PatchTaskCheckRunStatus(ctx context.Context, patch *TaskCheckRunStatusPatch) (*TaskCheckRun, error) }
TaskCheckRunService is the service for task check runs.
type TaskCheckRunStatus ¶
type TaskCheckRunStatus string
TaskCheckRunStatus is the status of a task check run.
const ( // TaskCheckRunUnknown is the task check run status for UNKNOWN. TaskCheckRunUnknown TaskCheckRunStatus = "UNKNOWN" // TaskCheckRunRunning is the task check run status for RUNNING. TaskCheckRunRunning TaskCheckRunStatus = "RUNNING" // TaskCheckRunDone is the task check run status for DONE. TaskCheckRunDone TaskCheckRunStatus = "DONE" // TaskCheckRunFailed is the task check run status for FAILED. TaskCheckRunFailed TaskCheckRunStatus = "FAILED" // TaskCheckRunCanceled is the task check run status for CANCELED. TaskCheckRunCanceled TaskCheckRunStatus = "CANCELED" )
func (TaskCheckRunStatus) String ¶
func (e TaskCheckRunStatus) String() string
type TaskCheckRunStatusPatch ¶
type TaskCheckRunStatusPatch struct { ID *int // Standard fields UpdaterID int // Domain specific fields Status TaskCheckRunStatus Code common.Code Result string }
TaskCheckRunStatusPatch is the API message for patching a task check run.
type TaskCheckStatus ¶
type TaskCheckStatus string
TaskCheckStatus is the status of a task check.
const ( // TaskCheckStatusSuccess is the task check status for SUCCESS. TaskCheckStatusSuccess TaskCheckStatus = "SUCCESS" // TaskCheckStatusWarn is the task check status for WARN. TaskCheckStatusWarn TaskCheckStatus = "WARN" // TaskCheckStatusError is the task check status for ERROR. TaskCheckStatusError TaskCheckStatus = "ERROR" )
func (TaskCheckStatus) String ¶
func (e TaskCheckStatus) String() string
type TaskCheckType ¶
type TaskCheckType string
TaskCheckType is the type of a taskCheck.
const ( // TaskCheckDatabaseStatementFakeAdvise is the task check type for fake advise. TaskCheckDatabaseStatementFakeAdvise TaskCheckType = "bb.task-check.database.statement.fake-advise" // TaskCheckDatabaseStatementSyntax is the task check type for statement syntax. TaskCheckDatabaseStatementSyntax TaskCheckType = "bb.task-check.database.statement.syntax" // TaskCheckDatabaseStatementCompatibility is the task check type for statement compatibility. TaskCheckDatabaseStatementCompatibility TaskCheckType = "bb.task-check.database.statement.compatibility" // TaskCheckDatabaseConnect is the task check type for database connection. TaskCheckDatabaseConnect TaskCheckType = "bb.task-check.database.connect" // TaskCheckInstanceMigrationSchema is the task check type for migrating schemas. TaskCheckInstanceMigrationSchema TaskCheckType = "bb.task-check.instance.migration-schema" // TaskCheckGeneralEarliestAllowedTime is the task check type for earliest allowed time. TaskCheckGeneralEarliestAllowedTime TaskCheckType = "bb.task-check.general.earliest-allowed-time" )
type TaskCreate ¶
type TaskCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Related fields PipelineID int StageID int InstanceID int `jsonapi:"attr,instanceId"` // Tasks like creating database may not have database. DatabaseID *int `jsonapi:"attr,databaseId"` // Domain specific fields Name string `jsonapi:"attr,name"` Status TaskStatus `jsonapi:"attr,status"` Type TaskType `jsonapi:"attr,type"` // Payload is derived from fields below it Payload string EarliestAllowedTs int64 `jsonapi:"attr,earliestAllowedTs"` Statement string `jsonapi:"attr,statement"` DatabaseName string `jsonapi:"attr,databaseName"` CharacterSet string `jsonapi:"attr,characterSet"` Collation string `jsonapi:"attr,collation"` Labels string `jsonapi:"attr,labels"` BackupID *int `jsonapi:"attr,backupId"` VCSPushEvent *vcs.PushEvent MigrationType db.MigrationType `jsonapi:"attr,migrationType"` }
TaskCreate is the API message for creating a task.
type TaskDatabaseBackupPayload ¶
type TaskDatabaseBackupPayload struct {
BackupID int `json:"backupId,omitempty"`
}
TaskDatabaseBackupPayload is the task payload for database backup.
type TaskDatabaseCreatePayload ¶
type TaskDatabaseCreatePayload struct { // The project owning the database. ProjectID int `json:"projectId,omitempty"` DatabaseName string `json:"databaseName,omitempty"` Statement string `json:"statement,omitempty"` CharacterSet string `json:"character,omitempty"` Collation string `json:"collation,omitempty"` Labels string `json:"labels,omitempty"` SchemaVersion string `json:"schemaVersion,omitempty"` }
TaskDatabaseCreatePayload is the task payload for creating databases.
type TaskDatabaseDataUpdatePayload ¶
type TaskDatabaseDataUpdatePayload struct { Statement string `json:"statement,omitempty"` SchemaVersion string `json:"schemaVersion,omitempty"` VCSPushEvent *vcs.PushEvent `json:"pushEvent,omitempty"` }
TaskDatabaseDataUpdatePayload is the task payload for database data update (DML).
type TaskDatabaseRestorePayload ¶
type TaskDatabaseRestorePayload struct { // The database name we restore to. When we restore a backup to a new database, we only have the database name // and don't have the database id upon constructing the task yet. DatabaseName string `json:"databaseName,omitempty"` BackupID int `json:"backupId,omitempty"` }
TaskDatabaseRestorePayload is the task payload for database restore.
type TaskDatabaseSchemaUpdatePayload ¶
type TaskDatabaseSchemaUpdatePayload struct { MigrationType db.MigrationType `json:"migrationType,omitempty"` Statement string `json:"statement,omitempty"` SchemaVersion string `json:"schemaVersion,omitempty"` VCSPushEvent *vcs.PushEvent `json:"pushEvent,omitempty"` }
TaskDatabaseSchemaUpdatePayload is the task payload for database schema update (DDL).
type TaskFind ¶
type TaskFind struct { ID *int // Related fields PipelineID *int StageID *int // Domain specific fields StatusList *[]TaskStatus }
TaskFind is the API message for finding tasks.
type TaskPatch ¶
type TaskPatch struct { ID int // Standard fields // Value is assigned from the jwt subject field passed by the client. UpdaterID int // Domain specific fields DatabaseID *int Statement *string `jsonapi:"attr,statement"` Payload *string EarliestAllowedTs *int64 `jsonapi:"attr,earliestAllowedTs"` }
TaskPatch is the API message for patching a task.
type TaskRun ¶
type TaskRun struct { ID int `jsonapi:"primary,taskRun"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields TaskID int `jsonapi:"attr,taskId"` // Domain specific fields Name string `jsonapi:"attr,name"` Status TaskRunStatus `jsonapi:"attr,status"` Type TaskType `jsonapi:"attr,type"` Code common.Code `jsonapi:"attr,code"` Comment string `jsonapi:"attr,comment"` Result string `jsonapi:"attr,result"` Payload string `jsonapi:"attr,payload"` }
TaskRun is the API message for a task run.
type TaskRunCreate ¶
type TaskRunCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Related fields TaskID int // Domain specific fields Name string `jsonapi:"attr,name"` Type TaskType `jsonapi:"attr,type"` Payload string `jsonapi:"attr,payload"` }
TaskRunCreate is the API message for creating a task run.
type TaskRunFind ¶
type TaskRunFind struct { ID *int // Related fields TaskID *int // Domain specific fields StatusList *[]TaskRunStatus }
TaskRunFind is the API message for finding task runs.
func (*TaskRunFind) String ¶
func (find *TaskRunFind) String() string
type TaskRunResultPayload ¶
type TaskRunResultPayload struct { Detail string `json:"detail,omitempty"` MigrationID int64 `json:"migrationId,omitempty"` Version string `json:"version,omitempty"` }
TaskRunResultPayload is the result payload for a task run.
type TaskRunService ¶
type TaskRunService interface { CreateTaskRunTx(ctx context.Context, tx *sql.Tx, create *TaskRunCreate) (*TaskRun, error) FindTaskRunListTx(ctx context.Context, tx *sql.Tx, find *TaskRunFind) ([]*TaskRun, error) FindTaskRunTx(ctx context.Context, tx *sql.Tx, find *TaskRunFind) (*TaskRun, error) PatchTaskRunStatusTx(ctx context.Context, tx *sql.Tx, patch *TaskRunStatusPatch) (*TaskRun, error) }
TaskRunService is the service for task runs.
type TaskRunStatus ¶
type TaskRunStatus string
TaskRunStatus is the status of a task run.
const ( // TaskRunUnknown is the task run status for UNKNOWN. TaskRunUnknown TaskRunStatus = "UNKNOWN" // TaskRunRunning is the task run status for RUNNING. TaskRunRunning TaskRunStatus = "RUNNING" // TaskRunDone is the task run status for DONE. TaskRunDone TaskRunStatus = "DONE" // TaskRunFailed is the task run status for FAILED. TaskRunFailed TaskRunStatus = "FAILED" // TaskRunCanceled is the task run status for CANCELED. TaskRunCanceled TaskRunStatus = "CANCELED" )
func (TaskRunStatus) String ¶
func (e TaskRunStatus) String() string
type TaskRunStatusPatch ¶
type TaskRunStatusPatch struct { ID *int // Standard fields UpdaterID int // Related fields TaskID *int // Domain specific fields Status TaskRunStatus Code *common.Code // Records the status detail (e.g. error message on failure) Comment *string Result *string }
TaskRunStatusPatch is the API message for patching a task run.
type TaskService ¶
type TaskService interface { CreateTask(ctx context.Context, create *TaskCreate) (*Task, error) FindTaskList(ctx context.Context, find *TaskFind) ([]*Task, error) FindTask(ctx context.Context, find *TaskFind) (*Task, error) PatchTask(ctx context.Context, patch *TaskPatch) (*Task, error) PatchTaskStatus(ctx context.Context, patch *TaskStatusPatch) (*Task, error) }
TaskService is the service for tasks.
type TaskStatus ¶
type TaskStatus string
TaskStatus is the status of a task.
const ( // TaskPending is the task status for PENDING. TaskPending TaskStatus = "PENDING" // TaskPendingApproval is the task status for PENDING_APPROVAL. TaskPendingApproval TaskStatus = "PENDING_APPROVAL" // TaskRunning is the task status for RUNNING. TaskRunning TaskStatus = "RUNNING" // TaskDone is the task status for DONE. TaskDone TaskStatus = "DONE" // TaskFailed is the task status for FAILED. TaskFailed TaskStatus = "FAILED" // TaskCanceled is the task status for CANCELED. TaskCanceled TaskStatus = "CANCELED" )
func (TaskStatus) String ¶
func (e TaskStatus) String() string
type TaskStatusPatch ¶
type TaskStatusPatch struct { ID int // Standard fields // Value is assigned from the jwt subject field passed by the client. UpdaterID int // Domain specific fields Status TaskStatus `jsonapi:"attr,status"` Code *common.Code Comment *string `jsonapi:"attr,comment"` Result *string }
TaskStatusPatch is the API message for patching a task status.
type TaskType ¶
type TaskType string
TaskType is the type of a task.
const ( // TaskGeneral is the task type for general tasks. TaskGeneral TaskType = "bb.task.general" // TaskDatabaseCreate is the task type for creating databases. TaskDatabaseCreate TaskType = "bb.task.database.create" // TaskDatabaseSchemaUpdate is the task type for updating database schemas. TaskDatabaseSchemaUpdate TaskType = "bb.task.database.schema.update" // TaskDatabaseDataUpdate is the task type for updating database data. TaskDatabaseDataUpdate TaskType = "bb.task.database.data.update" // TaskDatabaseBackup is the task type for creating database backups. TaskDatabaseBackup TaskType = "bb.task.database.backup" // TaskDatabaseRestore is the task type for restoring databases. TaskDatabaseRestore TaskType = "bb.task.database.restore" )
type UpdateSchemaContext ¶
type UpdateSchemaContext struct { // MigrationType is the type of a migration. MigrationType db.MigrationType `json:"migrationType"` // UpdateSchemaDetail is the details of schema update. // When a project is in tenant mode, there should be one item in the list. UpdateSchemaDetailList []*UpdateSchemaDetail `json:"updateSchemaDetailList"` // VCSPushEvent is the event information for VCS push. VCSPushEvent *vcs.PushEvent }
UpdateSchemaContext is the issue create context for updating database schema.
type UpdateSchemaDetail ¶
type UpdateSchemaDetail struct { // DatabaseID is the ID of a database. DatabaseID int `json:"databaseId"` // DatabaseName is the name of databases, mutually exclusive to DatabaseID. // This should be set when a project is in tenant mode, and ProjectID is derived from IssueCreate. DatabaseName string `json:"databaseName"` // Statement is the statement to update database schema. Statement string `json:"statement"` // EarliestAllowedTs the earliest execution time of the change at system local Unix timestamp in seconds. EarliestAllowedTs int64 `jsonapi:"attr,earliestAllowedTs"` }
UpdateSchemaDetail is the detail of updating database schema.
type VCS ¶
type VCS struct { ID int `jsonapi:"primary,vcs"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Domain specific fields Name string `jsonapi:"attr,name"` Type vcs.Type `jsonapi:"attr,type"` InstanceURL string `jsonapi:"attr,instanceUrl"` APIURL string `jsonapi:"attr,apiUrl"` ApplicationID string `jsonapi:"attr,applicationId"` // Secret will be used for OAuth on the client side when setting up project GitOps workflow. // So it should be returned to the response. Secret string `jsonapi:"attr,secret"` }
VCS is the API message for a VCS (Version Control System).
type VCSCreate ¶
type VCSCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int // Domain specific fields Name string `jsonapi:"attr,name"` Type vcs.Type `jsonapi:"attr,type"` InstanceURL string `jsonapi:"attr,instanceUrl"` // APIURL derives from InstanceURL APIURL string ApplicationID string `jsonapi:"attr,applicationId"` Secret string `jsonapi:"attr,secret"` }
VCSCreate is the API message for creating a VCS.
type VCSDelete ¶
type VCSDelete struct { ID int // Standard fields // Value is assigned from the jwt subject field passed by the client. DeleterID int }
VCSDelete is the API message for deleting a VCS.
type VCSPatch ¶
type VCSPatch struct { ID int // Standard fields // Value is assigned from the jwt subject field passed by the client. UpdaterID int // Domain specific fields Name *string `jsonapi:"attr,name"` ApplicationID *string `jsonapi:"attr,applicationId"` Secret *string `jsonapi:"attr,secret"` }
VCSPatch is the API message for patching a VCS.
type VCSRaw ¶
type VCSRaw struct { ID int // Standard fields CreatorID int CreatedTs int64 UpdaterID int UpdatedTs int64 // Domain specific fields Name string Type vcs.Type InstanceURL string APIURL string ApplicationID string Secret string }
VCSRaw is the store model for a VCS (Version Control System). Fields have exactly the same meanings as VCS.
type VCSService ¶
type VCSService interface { CreateVCS(ctx context.Context, create *VCSCreate) (*VCSRaw, error) FindVCSList(ctx context.Context, find *VCSFind) ([]*VCSRaw, error) FindVCS(ctx context.Context, find *VCSFind) (*VCSRaw, error) PatchVCS(ctx context.Context, patch *VCSPatch) (*VCSRaw, error) DeleteVCS(ctx context.Context, delete *VCSDelete) error }
VCSService is the service for VCSs.
type View ¶
type View struct { ID int `jsonapi:"primary,view"` // Standard fields CreatorID int Creator *Principal `jsonapi:"relation,creator"` CreatedTs int64 `jsonapi:"attr,createdTs"` UpdaterID int Updater *Principal `jsonapi:"relation,updater"` UpdatedTs int64 `jsonapi:"attr,updatedTs"` // Related fields DatabaseID int Database *Database `jsonapi:"relation,database"` // Domain specific fields Name string `jsonapi:"attr,name"` Definition string `jsonapi:"attr,definition"` Comment string `jsonapi:"attr,comment"` }
View is the API message for a view.
type ViewCreate ¶
type ViewCreate struct { // Standard fields // Value is assigned from the jwt subject field passed by the client. CreatorID int CreatedTs int64 UpdatedTs int64 // Related fields DatabaseID int // Domain specific fields Name string Definition string Comment string }
ViewCreate is the API message for creating a view.
type ViewDelete ¶
type ViewDelete struct { // Related fields DatabaseID int }
ViewDelete is the API message for deleting a view.
type ViewFind ¶
type ViewFind struct { ID *int // Related fields DatabaseID *int // Domain specific fields Name *string }
ViewFind is the API message for finding views.
type ViewService ¶
type ViewService interface { CreateView(ctx context.Context, create *ViewCreate) (*View, error) FindViewList(ctx context.Context, find *ViewFind) ([]*View, error) FindView(ctx context.Context, find *ViewFind) (*View, error) DeleteView(ctx context.Context, delete *ViewDelete) error }
ViewService is the service for views.
Source Files
¶
- activity.go
- actuator.go
- anomaly.go
- api.go
- auth.go
- backup.go
- bookmark.go
- cache.go
- column.go
- data_source.go
- database.go
- debug.go
- deploy.go
- environment.go
- inbox.go
- instance.go
- instance_user.go
- issue.go
- issue_subscriber.go
- label.go
- member.go
- pipeline.go
- plan.go
- policy.go
- principal.go
- project.go
- project_member.go
- project_webhook.go
- repository.go
- setting.go
- sheet.go
- slug.go
- sql.go
- stage.go
- table.go
- table_index.go
- task.go
- task_check_run.go
- task_run.go
- vcs.go
- view.go