db

package
v0.0.56 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrParseData = errors.New("unable to parse SQL data")

ErrParseData signifies that an error occurred while parsing SQL data

Functions

func CalculateProjectHierarchyOffset

func CalculateProjectHierarchyOffset(hierarchy int) int

CalculateProjectHierarchyOffset will calculate the offset for the hierarchy in the returned array from GetChildrenProjects and GetParentProjects. This is because the calling project is also returned.

func ErrIsUniqueViolation

func ErrIsUniqueViolation(err error) bool

ErrIsUniqueViolation returns true if the error is a unique violation

func WithTransaction added in v0.0.38

func WithTransaction[T any](store Store, fn func(querier ExtendQuerier) (T, error)) (result T, err error)

WithTransaction wraps an operation in a new DB transaction. Ideally this would be a method of the Store interface, but Go's generics do not allow for generic methods :(

Types

type ActionType

type ActionType string
const (
	ActionTypeOn     ActionType = "on"
	ActionTypeOff    ActionType = "off"
	ActionTypeDryRun ActionType = "dry_run"
)

func (*ActionType) Scan

func (e *ActionType) Scan(src interface{}) error

type AlertEvent added in v0.0.52

type AlertEvent struct {
	ID           uuid.UUID        `json:"id"`
	EvaluationID uuid.UUID        `json:"evaluation_id"`
	Status       AlertStatusTypes `json:"status"`
	Details      string           `json:"details"`
	Metadata     json.RawMessage  `json:"metadata"`
	CreatedAt    time.Time        `json:"created_at"`
}

type AlertStatusTypes

type AlertStatusTypes string
const (
	AlertStatusTypesOn           AlertStatusTypes = "on"
	AlertStatusTypesOff          AlertStatusTypes = "off"
	AlertStatusTypesError        AlertStatusTypes = "error"
	AlertStatusTypesSkipped      AlertStatusTypes = "skipped"
	AlertStatusTypesNotAvailable AlertStatusTypes = "not_available"
)

func (*AlertStatusTypes) Scan

func (e *AlertStatusTypes) Scan(src interface{}) error

type Artifact

type Artifact struct {
	ID                 uuid.UUID     `json:"id"`
	RepositoryID       uuid.NullUUID `json:"repository_id"`
	ArtifactName       string        `json:"artifact_name"`
	ArtifactType       string        `json:"artifact_type"`
	ArtifactVisibility string        `json:"artifact_visibility"`
	CreatedAt          time.Time     `json:"created_at"`
	UpdatedAt          time.Time     `json:"updated_at"`
	ProjectID          uuid.UUID     `json:"project_id"`
	ProviderID         uuid.UUID     `json:"provider_id"`
	ProviderName       string        `json:"provider_name"`
}

type AuthorizationFlow added in v0.0.35

type AuthorizationFlow string
const (
	AuthorizationFlowUserInput                   AuthorizationFlow = "user_input"
	AuthorizationFlowOauth2AuthorizationCodeFlow AuthorizationFlow = "oauth2_authorization_code_flow"
	AuthorizationFlowGithubAppFlow               AuthorizationFlow = "github_app_flow"
	AuthorizationFlowNone                        AuthorizationFlow = "none"
)

func (*AuthorizationFlow) Scan added in v0.0.35

func (e *AuthorizationFlow) Scan(src interface{}) error

type Bundle added in v0.0.36

type Bundle struct {
	ID        uuid.UUID `json:"id"`
	Namespace string    `json:"namespace"`
	Name      string    `json:"name"`
}

type CountProfilesByEntityTypeRow

type CountProfilesByEntityTypeRow struct {
	NumProfiles   int64    `json:"num_profiles"`
	ProfileEntity Entities `json:"profile_entity"`
}

type CreateInvitationParams added in v0.0.53

type CreateInvitationParams struct {
	Code    string    `json:"code"`
	Email   string    `json:"email"`
	Role    string    `json:"role"`
	Project uuid.UUID `json:"project"`
	Sponsor int32     `json:"sponsor"`
}

type CreateOrganizationParams

type CreateOrganizationParams struct {
	Name     string          `json:"name"`
	Metadata json.RawMessage `json:"metadata"`
}

type CreateProfileForEntityParams

type CreateProfileForEntityParams struct {
	Entity          Entities        `json:"entity"`
	ProfileID       uuid.UUID       `json:"profile_id"`
	ContextualRules json.RawMessage `json:"contextual_rules"`
}

type CreateProfileParams

type CreateProfileParams struct {
	ProjectID      uuid.UUID      `json:"project_id"`
	Remediate      NullActionType `json:"remediate"`
	Alert          NullActionType `json:"alert"`
	Name           string         `json:"name"`
	SubscriptionID uuid.NullUUID  `json:"subscription_id"`
	DisplayName    string         `json:"display_name"`
	Labels         []string       `json:"labels"`
}

type CreateProjectParams

type CreateProjectParams struct {
	Name     string          `json:"name"`
	ParentID uuid.NullUUID   `json:"parent_id"`
	Metadata json.RawMessage `json:"metadata"`
}

type CreateProjectWithIDParams added in v0.0.27

type CreateProjectWithIDParams struct {
	ID       uuid.UUID       `json:"id"`
	Name     string          `json:"name"`
	Metadata json.RawMessage `json:"metadata"`
}

type CreateProviderParams

type CreateProviderParams struct {
	Name       string              `json:"name"`
	ProjectID  uuid.UUID           `json:"project_id"`
	Class      ProviderClass       `json:"class"`
	Implements []ProviderType      `json:"implements"`
	Definition json.RawMessage     `json:"definition"`
	AuthFlows  []AuthorizationFlow `json:"auth_flows"`
}

type CreatePullRequestParams

type CreatePullRequestParams struct {
	RepositoryID uuid.UUID `json:"repository_id"`
	PrNumber     int64     `json:"pr_number"`
}

type CreateRepositoryParams

type CreateRepositoryParams struct {
	Provider      string         `json:"provider"`
	ProjectID     uuid.UUID      `json:"project_id"`
	RepoOwner     string         `json:"repo_owner"`
	RepoName      string         `json:"repo_name"`
	RepoID        int64          `json:"repo_id"`
	IsPrivate     bool           `json:"is_private"`
	IsFork        bool           `json:"is_fork"`
	WebhookID     sql.NullInt64  `json:"webhook_id"`
	WebhookUrl    string         `json:"webhook_url"`
	DeployUrl     string         `json:"deploy_url"`
	CloneUrl      string         `json:"clone_url"`
	DefaultBranch sql.NullString `json:"default_branch"`
	License       sql.NullString `json:"license"`
	ProviderID    uuid.UUID      `json:"provider_id"`
}

type CreateRuleTypeParams

type CreateRuleTypeParams struct {
	Name           string          `json:"name"`
	ProjectID      uuid.UUID       `json:"project_id"`
	Description    string          `json:"description"`
	Guidance       string          `json:"guidance"`
	Definition     json.RawMessage `json:"definition"`
	SeverityValue  Severity        `json:"severity_value"`
	SubscriptionID uuid.NullUUID   `json:"subscription_id"`
	DisplayName    string          `json:"display_name"`
}

type CreateSelectorParams added in v0.0.54

type CreateSelectorParams struct {
	ProfileID uuid.UUID    `json:"profile_id"`
	Entity    NullEntities `json:"entity"`
	Selector  string       `json:"selector"`
	Comment   string       `json:"comment"`
}

type CreateSessionStateParams

type CreateSessionStateParams struct {
	Provider          string                `json:"provider"`
	ProjectID         uuid.UUID             `json:"project_id"`
	RemoteUser        sql.NullString        `json:"remote_user"`
	SessionState      string                `json:"session_state"`
	OwnerFilter       sql.NullString        `json:"owner_filter"`
	ProviderConfig    []byte                `json:"provider_config"`
	EncryptedRedirect pqtype.NullRawMessage `json:"encrypted_redirect"`
}

type CreateSubscriptionParams added in v0.0.37

type CreateSubscriptionParams struct {
	ProjectID      uuid.UUID `json:"project_id"`
	BundleID       uuid.UUID `json:"bundle_id"`
	CurrentVersion string    `json:"current_version"`
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type DeleteNonUpdatedRulesParams added in v0.0.52

type DeleteNonUpdatedRulesParams struct {
	ProfileID  uuid.UUID   `json:"profile_id"`
	EntityType Entities    `json:"entity_type"`
	UpdatedIds []uuid.UUID `json:"updated_ids"`
}

type DeleteProfileForEntityParams added in v0.0.16

type DeleteProfileForEntityParams struct {
	ProfileID uuid.UUID `json:"profile_id"`
	Entity    Entities  `json:"entity"`
}

type DeleteProfileParams added in v0.0.35

type DeleteProfileParams struct {
	ID        uuid.UUID `json:"id"`
	ProjectID uuid.UUID `json:"project_id"`
}

type DeleteProjectRow

type DeleteProjectRow struct {
	ID        uuid.UUID       `json:"id"`
	Name      string          `json:"name"`
	Metadata  json.RawMessage `json:"metadata"`
	CreatedAt time.Time       `json:"created_at"`
	UpdatedAt time.Time       `json:"updated_at"`
	ParentID  uuid.NullUUID   `json:"parent_id"`
}

type DeleteProviderParams

type DeleteProviderParams struct {
	ID        uuid.UUID `json:"id"`
	ProjectID uuid.UUID `json:"project_id"`
}

type DeletePullRequestParams

type DeletePullRequestParams struct {
	RepositoryID uuid.UUID `json:"repository_id"`
	PrNumber     int64     `json:"pr_number"`
}

type DeleteRuleInstantiationParams added in v0.0.16

type DeleteRuleInstantiationParams struct {
	EntityProfileID uuid.UUID `json:"entity_profile_id"`
	RuleTypeID      uuid.UUID `json:"rule_type_id"`
}

type DeleteRuleStatusesForProfileAndRuleTypeParams added in v0.0.16

type DeleteRuleStatusesForProfileAndRuleTypeParams struct {
	ProfileID  uuid.UUID `json:"profile_id"`
	RuleTypeID uuid.UUID `json:"rule_type_id"`
	RuleName   string    `json:"rule_name"`
}

type DeleteSessionStateByProjectIDParams

type DeleteSessionStateByProjectIDParams struct {
	Provider  string    `json:"provider"`
	ProjectID uuid.UUID `json:"project_id"`
}

type EnqueueFlushParams added in v0.0.17

type EnqueueFlushParams struct {
	Entity        Entities      `json:"entity"`
	RepositoryID  uuid.NullUUID `json:"repository_id"`
	ArtifactID    uuid.NullUUID `json:"artifact_id"`
	PullRequestID uuid.NullUUID `json:"pull_request_id"`
	ProjectID     uuid.UUID     `json:"project_id"`
}

type Entities

type Entities string
const (
	EntitiesRepository       Entities = "repository"
	EntitiesBuildEnvironment Entities = "build_environment"
	EntitiesArtifact         Entities = "artifact"
	EntitiesPullRequest      Entities = "pull_request"
	EntitiesRelease          Entities = "release"
	EntitiesPipelineRun      Entities = "pipeline_run"
	EntitiesTaskRun          Entities = "task_run"
	EntitiesBuild            Entities = "build"
)

func (*Entities) Scan

func (e *Entities) Scan(src interface{}) error

type Entitlement

type Entitlement struct {
	ID        uuid.UUID `json:"id"`
	Feature   string    `json:"feature"`
	ProjectID uuid.UUID `json:"project_id"`
	CreatedAt time.Time `json:"created_at"`
}

type EntityExecutionLock added in v0.0.17

type EntityExecutionLock struct {
	ID            uuid.UUID     `json:"id"`
	Entity        Entities      `json:"entity"`
	LockedBy      uuid.UUID     `json:"locked_by"`
	LastLockTime  time.Time     `json:"last_lock_time"`
	RepositoryID  uuid.NullUUID `json:"repository_id"`
	ArtifactID    uuid.NullUUID `json:"artifact_id"`
	PullRequestID uuid.NullUUID `json:"pull_request_id"`
	ProjectID     uuid.NullUUID `json:"project_id"`
}

type EntityProfile

type EntityProfile struct {
	ID              uuid.UUID       `json:"id"`
	Entity          Entities        `json:"entity"`
	ProfileID       uuid.UUID       `json:"profile_id"`
	ContextualRules json.RawMessage `json:"contextual_rules"`
	CreatedAt       time.Time       `json:"created_at"`
	UpdatedAt       time.Time       `json:"updated_at"`
	Migrated        bool            `json:"migrated"`
}

type EntityProfileRule

type EntityProfileRule struct {
	ID              uuid.UUID `json:"id"`
	EntityProfileID uuid.UUID `json:"entity_profile_id"`
	RuleTypeID      uuid.UUID `json:"rule_type_id"`
	CreatedAt       time.Time `json:"created_at"`
}

type EvalStatusTypes

type EvalStatusTypes string
const (
	EvalStatusTypesSuccess EvalStatusTypes = "success"
	EvalStatusTypesFailure EvalStatusTypes = "failure"
	EvalStatusTypesError   EvalStatusTypes = "error"
	EvalStatusTypesSkipped EvalStatusTypes = "skipped"
	EvalStatusTypesPending EvalStatusTypes = "pending"
)

func (*EvalStatusTypes) Scan

func (e *EvalStatusTypes) Scan(src interface{}) error

type EvaluationRuleEntity added in v0.0.53

type EvaluationRuleEntity struct {
	ID            uuid.UUID     `json:"id"`
	RuleID        uuid.UUID     `json:"rule_id"`
	RepositoryID  uuid.NullUUID `json:"repository_id"`
	PullRequestID uuid.NullUUID `json:"pull_request_id"`
	ArtifactID    uuid.NullUUID `json:"artifact_id"`
}

type EvaluationStatus added in v0.0.53

type EvaluationStatus struct {
	ID             uuid.UUID       `json:"id"`
	RuleEntityID   uuid.UUID       `json:"rule_entity_id"`
	Status         EvalStatusTypes `json:"status"`
	Details        string          `json:"details"`
	EvaluationTime time.Time       `json:"evaluation_time"`
}

type ExtendQuerier

type ExtendQuerier interface {
	Querier
	GetRuleEvaluationByProfileIdAndRuleType(ctx context.Context, profileID uuid.UUID, entityType NullEntities,
		ruleName sql.NullString, entityID uuid.NullUUID, ruleTypeName sql.NullString) (ListRuleEvaluationsByProfileIdRow, error)
}

ExtendQuerier extends the Querier interface with custom queries

type Feature

type Feature struct {
	Name      string          `json:"name"`
	Settings  json.RawMessage `json:"settings"`
	CreatedAt time.Time       `json:"created_at"`
	UpdatedAt time.Time       `json:"updated_at"`
}

type FindProvidersParams added in v0.0.38

type FindProvidersParams struct {
	Projects []uuid.UUID      `json:"projects"`
	Trait    NullProviderType `json:"trait"`
	Name     sql.NullString   `json:"name"`
}

type FlushCache added in v0.0.17

type FlushCache struct {
	ID            uuid.UUID     `json:"id"`
	Entity        Entities      `json:"entity"`
	RepositoryID  uuid.NullUUID `json:"repository_id"`
	ArtifactID    uuid.NullUUID `json:"artifact_id"`
	PullRequestID uuid.NullUUID `json:"pull_request_id"`
	QueuedAt      time.Time     `json:"queued_at"`
	ProjectID     uuid.NullUUID `json:"project_id"`
}

type FlushCacheParams added in v0.0.17

type FlushCacheParams struct {
	Entity        Entities      `json:"entity"`
	RepositoryID  uuid.NullUUID `json:"repository_id"`
	ArtifactID    uuid.NullUUID `json:"artifact_id"`
	PullRequestID uuid.NullUUID `json:"pull_request_id"`
}

type GetAccessTokenByEnrollmentNonceParams added in v0.0.39

type GetAccessTokenByEnrollmentNonceParams struct {
	ProjectID       uuid.UUID      `json:"project_id"`
	EnrollmentNonce sql.NullString `json:"enrollment_nonce"`
}

type GetAccessTokenByProjectIDParams

type GetAccessTokenByProjectIDParams struct {
	Provider  string    `json:"provider"`
	ProjectID uuid.UUID `json:"project_id"`
}

type GetAccessTokenSinceDateParams

type GetAccessTokenSinceDateParams struct {
	Provider  string    `json:"provider"`
	ProjectID uuid.UUID `json:"project_id"`
	UpdatedAt time.Time `json:"updated_at"`
}

type GetArtifactByIDParams added in v0.0.43

type GetArtifactByIDParams struct {
	ID        uuid.UUID `json:"id"`
	ProjectID uuid.UUID `json:"project_id"`
}

type GetArtifactByNameParams added in v0.0.22

type GetArtifactByNameParams struct {
	RepositoryID uuid.NullUUID `json:"repository_id"`
	ProjectID    uuid.UUID     `json:"project_id"`
	ArtifactName string        `json:"artifact_name"`
}

type GetBundleParams added in v0.0.38

type GetBundleParams struct {
	Namespace string `json:"namespace"`
	Name      string `json:"name"`
}

type GetChildrenProjectsRow

type GetChildrenProjectsRow struct {
	ID        uuid.UUID       `json:"id"`
	Name      string          `json:"name"`
	Metadata  json.RawMessage `json:"metadata"`
	ParentID  uuid.NullUUID   `json:"parent_id"`
	CreatedAt time.Time       `json:"created_at"`
	UpdatedAt time.Time       `json:"updated_at"`
}

type GetFeatureInProjectParams

type GetFeatureInProjectParams struct {
	ProjectID uuid.UUID `json:"project_id"`
	Feature   string    `json:"feature"`
}

type GetIDByProfileEntityNameParams added in v0.0.53

type GetIDByProfileEntityNameParams struct {
	ProfileID  uuid.UUID `json:"profile_id"`
	EntityType Entities  `json:"entity_type"`
	Name       string    `json:"name"`
}

type GetInstallationIDByEnrollmentNonceParams added in v0.0.39

type GetInstallationIDByEnrollmentNonceParams struct {
	ProjectID       uuid.NullUUID  `json:"project_id"`
	EnrollmentNonce sql.NullString `json:"enrollment_nonce"`
}

type GetInvitationByCodeRow added in v0.0.53

type GetInvitationByCodeRow struct {
	Code            string    `json:"code"`
	Email           string    `json:"email"`
	Role            string    `json:"role"`
	Project         uuid.UUID `json:"project"`
	Sponsor         int32     `json:"sponsor"`
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
	IdentitySubject string    `json:"identity_subject"`
}

type GetInvitationsByEmailAndProjectParams added in v0.0.53

type GetInvitationsByEmailAndProjectParams struct {
	Email   string    `json:"email"`
	Project uuid.UUID `json:"project"`
}

type GetInvitationsByEmailAndProjectRow added in v0.0.53

type GetInvitationsByEmailAndProjectRow struct {
	Code            string    `json:"code"`
	Email           string    `json:"email"`
	Role            string    `json:"role"`
	Project         uuid.UUID `json:"project"`
	Sponsor         int32     `json:"sponsor"`
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
	IdentitySubject string    `json:"identity_subject"`
}

type GetInvitationsByEmailRow added in v0.0.53

type GetInvitationsByEmailRow struct {
	Code            string    `json:"code"`
	Email           string    `json:"email"`
	Role            string    `json:"role"`
	Project         uuid.UUID `json:"project"`
	Sponsor         int32     `json:"sponsor"`
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
	IdentitySubject string    `json:"identity_subject"`
}

type GetLatestEvalStateForRuleEntityParams added in v0.0.53

type GetLatestEvalStateForRuleEntityParams struct {
	RuleID        uuid.UUID     `json:"rule_id"`
	RepositoryID  uuid.NullUUID `json:"repository_id"`
	PullRequestID uuid.NullUUID `json:"pull_request_id"`
	ArtifactID    uuid.NullUUID `json:"artifact_id"`
}

type GetParentProjectsUntilParams

type GetParentProjectsUntilParams struct {
	ID   uuid.UUID `json:"id"`
	ID_2 uuid.UUID `json:"id_2"`
}

type GetProfileByIDAndLockParams added in v0.0.35

type GetProfileByIDAndLockParams struct {
	ID        uuid.UUID `json:"id"`
	ProjectID uuid.UUID `json:"project_id"`
}

type GetProfileByIDParams added in v0.0.35

type GetProfileByIDParams struct {
	ID        uuid.UUID `json:"id"`
	ProjectID uuid.UUID `json:"project_id"`
}

type GetProfileByNameAndLockParams added in v0.0.16

type GetProfileByNameAndLockParams struct {
	ProjectID uuid.UUID `json:"project_id"`
	Name      string    `json:"name"`
}

type GetProfileByProjectAndIDParams

type GetProfileByProjectAndIDParams struct {
	ProjectID uuid.UUID `json:"project_id"`
	ID        uuid.UUID `json:"id"`
}

type GetProfileByProjectAndIDRow

type GetProfileByProjectAndIDRow struct {
	Profile                   Profile                   `json:"profile"`
	ProfilesWithEntityProfile ProfilesWithEntityProfile `json:"profiles_with_entity_profile"`
	ProfilesWithSelectors     []ProfileSelector         `json:"profiles_with_selectors"`
}

type GetProfileForEntityParams added in v0.0.16

type GetProfileForEntityParams struct {
	ProfileID uuid.UUID `json:"profile_id"`
	Entity    Entities  `json:"entity"`
}

type GetProfileStatusByIdAndProjectParams

type GetProfileStatusByIdAndProjectParams struct {
	ID        uuid.UUID `json:"id"`
	ProjectID uuid.UUID `json:"project_id"`
}

type GetProfileStatusByIdAndProjectRow

type GetProfileStatusByIdAndProjectRow struct {
	ID            uuid.UUID       `json:"id"`
	Name          string          `json:"name"`
	ProfileStatus EvalStatusTypes `json:"profile_status"`
	LastUpdated   time.Time       `json:"last_updated"`
}

type GetProfileStatusByNameAndProjectParams

type GetProfileStatusByNameAndProjectParams struct {
	ProjectID uuid.UUID `json:"project_id"`
	Name      string    `json:"name"`
}

type GetProfileStatusByNameAndProjectRow

type GetProfileStatusByNameAndProjectRow struct {
	ID            uuid.UUID       `json:"id"`
	Name          string          `json:"name"`
	ProfileStatus EvalStatusTypes `json:"profile_status"`
	LastUpdated   time.Time       `json:"last_updated"`
}

type GetProfileStatusByProjectRow

type GetProfileStatusByProjectRow struct {
	ID            uuid.UUID       `json:"id"`
	Name          string          `json:"name"`
	ProfileStatus EvalStatusTypes `json:"profile_status"`
	LastUpdated   time.Time       `json:"last_updated"`
}

type GetProjectIDBySessionStateRow added in v0.0.35

type GetProjectIDBySessionStateRow struct {
	Provider          string                `json:"provider"`
	ProjectID         uuid.UUID             `json:"project_id"`
	RemoteUser        sql.NullString        `json:"remote_user"`
	OwnerFilter       sql.NullString        `json:"owner_filter"`
	ProviderConfig    []byte                `json:"provider_config"`
	RedirectUrl       sql.NullString        `json:"redirect_url"`
	EncryptedRedirect pqtype.NullRawMessage `json:"encrypted_redirect"`
}

type GetProviderByIDAndProjectParams added in v0.0.48

type GetProviderByIDAndProjectParams struct {
	ID        uuid.UUID `json:"id"`
	ProjectID uuid.UUID `json:"project_id"`
}

type GetProviderByNameParams

type GetProviderByNameParams struct {
	Name     string      `json:"name"`
	Projects []uuid.UUID `json:"projects"`
}

type GetProviderWebhooksRow added in v0.0.48

type GetProviderWebhooksRow struct {
	RepoOwner string        `json:"repo_owner"`
	RepoName  string        `json:"repo_name"`
	WebhookID sql.NullInt64 `json:"webhook_id"`
}

type GetPullRequestParams

type GetPullRequestParams struct {
	RepositoryID uuid.UUID `json:"repository_id"`
	PrNumber     int64     `json:"pr_number"`
}

type GetRepositoryByIDAndProjectParams

type GetRepositoryByIDAndProjectParams struct {
	ID        uuid.UUID `json:"id"`
	ProjectID uuid.UUID `json:"project_id"`
}

type GetRepositoryByRepoNameParams

type GetRepositoryByRepoNameParams struct {
	RepoOwner string         `json:"repo_owner"`
	RepoName  string         `json:"repo_name"`
	ProjectID uuid.UUID      `json:"project_id"`
	Provider  sql.NullString `json:"provider"`
}

type GetRuleInstancesForProfileEntityParams added in v0.0.52

type GetRuleInstancesForProfileEntityParams struct {
	ProfileID  uuid.UUID `json:"profile_id"`
	EntityType Entities  `json:"entity_type"`
}

type GetRuleTypeByNameParams

type GetRuleTypeByNameParams struct {
	Projects []uuid.UUID `json:"projects"`
	Name     string      `json:"name"`
}

type GetRuleTypeIDByRuleNameEntityProfileParams added in v0.0.56

type GetRuleTypeIDByRuleNameEntityProfileParams struct {
	Name       string    `json:"name"`
	EntityType Entities  `json:"entity_type"`
	ProfileID  uuid.UUID `json:"profile_id"`
}

type GetRuleTypesByEntityInHierarchyParams added in v0.0.56

type GetRuleTypesByEntityInHierarchyParams struct {
	EntityType Entities    `json:"entity_type"`
	Projects   []uuid.UUID `json:"projects"`
}

type GetSubscriptionByProjectBundleParams added in v0.0.37

type GetSubscriptionByProjectBundleParams struct {
	Namespace string    `json:"namespace"`
	Name      string    `json:"name"`
	ProjectID uuid.UUID `json:"project_id"`
}

type InsertAlertEventParams added in v0.0.54

type InsertAlertEventParams struct {
	EvaluationID uuid.UUID        `json:"evaluation_id"`
	Status       AlertStatusTypes `json:"status"`
	Details      string           `json:"details"`
	Metadata     json.RawMessage  `json:"metadata"`
}

type InsertEvaluationRuleEntityParams added in v0.0.53

type InsertEvaluationRuleEntityParams struct {
	RuleID        uuid.UUID     `json:"rule_id"`
	RepositoryID  uuid.NullUUID `json:"repository_id"`
	PullRequestID uuid.NullUUID `json:"pull_request_id"`
	ArtifactID    uuid.NullUUID `json:"artifact_id"`
}

type InsertEvaluationStatusParams added in v0.0.53

type InsertEvaluationStatusParams struct {
	RuleEntityID uuid.UUID       `json:"rule_entity_id"`
	Status       EvalStatusTypes `json:"status"`
	Details      string          `json:"details"`
}

type InsertRemediationEventParams added in v0.0.54

type InsertRemediationEventParams struct {
	EvaluationID uuid.UUID              `json:"evaluation_id"`
	Status       RemediationStatusTypes `json:"status"`
	Details      string                 `json:"details"`
	Metadata     json.RawMessage        `json:"metadata"`
}

type LatestEvaluationStatus added in v0.0.53

type LatestEvaluationStatus struct {
	RuleEntityID        uuid.UUID `json:"rule_entity_id"`
	EvaluationHistoryID uuid.UUID `json:"evaluation_history_id"`
}

type ListEvaluationHistoryParams added in v0.0.55

type ListEvaluationHistoryParams struct {
	Next            sql.NullTime             `json:"next"`
	Prev            sql.NullTime             `json:"prev"`
	Entitytypes     []Entities               `json:"entitytypes"`
	Entitynames     []string                 `json:"entitynames"`
	Profilenames    []string                 `json:"profilenames"`
	Remediations    []RemediationStatusTypes `json:"remediations"`
	Alerts          []AlertStatusTypes       `json:"alerts"`
	Statuses        []EvalStatusTypes        `json:"statuses"`
	Notentitytypes  []Entities               `json:"notentitytypes"`
	Notentitynames  []string                 `json:"notentitynames"`
	Notprofilenames []string                 `json:"notprofilenames"`
	Notremediations []RemediationStatusTypes `json:"notremediations"`
	Notalerts       []AlertStatusTypes       `json:"notalerts"`
	Notstatuses     []EvalStatusTypes        `json:"notstatuses"`
	Fromts          sql.NullTime             `json:"fromts"`
	Tots            sql.NullTime             `json:"tots"`
	Projectid       uuid.UUID                `json:"projectid"`
	Size            int32                    `json:"size"`
}

type ListEvaluationHistoryRow added in v0.0.55

type ListEvaluationHistoryRow struct {
	EvaluationID       uuid.UUID                  `json:"evaluation_id"`
	EvaluatedAt        time.Time                  `json:"evaluated_at"`
	EntityType         interface{}                `json:"entity_type"`
	EntityID           interface{}                `json:"entity_id"`
	RepoOwner          sql.NullString             `json:"repo_owner"`
	RepoName           sql.NullString             `json:"repo_name"`
	PrNumber           sql.NullInt64              `json:"pr_number"`
	ArtifactName       sql.NullString             `json:"artifact_name"`
	ProjectID          uuid.NullUUID              `json:"project_id"`
	RuleType           string                     `json:"rule_type"`
	RuleName           string                     `json:"rule_name"`
	ProfileName        string                     `json:"profile_name"`
	EvaluationStatus   EvalStatusTypes            `json:"evaluation_status"`
	EvaluationDetails  string                     `json:"evaluation_details"`
	RemediationStatus  NullRemediationStatusTypes `json:"remediation_status"`
	RemediationDetails sql.NullString             `json:"remediation_details"`
	AlertStatus        NullAlertStatusTypes       `json:"alert_status"`
	AlertDetails       sql.NullString             `json:"alert_details"`
}

type ListInvitationsForProjectRow added in v0.0.52

type ListInvitationsForProjectRow struct {
	Email           string    `json:"email"`
	Role            string    `json:"role"`
	IdentitySubject string    `json:"identity_subject"`
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
}

type ListOldestRuleEvaluationsByRepositoryIdRow added in v0.0.52

type ListOldestRuleEvaluationsByRepositoryIdRow struct {
	RepositoryID      uuid.UUID `json:"repository_id"`
	OldestLastUpdated time.Time `json:"oldest_last_updated"`
}

type ListOrganizationsParams

type ListOrganizationsParams struct {
	Limit  int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type ListProfilesByProjectIDAndLabelParams added in v0.0.38

type ListProfilesByProjectIDAndLabelParams struct {
	ProjectID     uuid.UUID `json:"project_id"`
	IncludeLabels []string  `json:"include_labels"`
	ExcludeLabels []string  `json:"exclude_labels"`
}

func (*ListProfilesByProjectIDAndLabelParams) LabelsFromFilter added in v0.0.38

func (lp *ListProfilesByProjectIDAndLabelParams) LabelsFromFilter(filter string)

LabelsFromFilter parses the filter string and populates the IncludeLabels and ExcludeLabels fields

type ListProfilesByProjectIDAndLabelRow added in v0.0.38

type ListProfilesByProjectIDAndLabelRow struct {
	Profile                   Profile                   `json:"profile"`
	ProfilesWithEntityProfile ProfilesWithEntityProfile `json:"profiles_with_entity_profile"`
	ProfilesWithSelectors     []ProfileSelector         `json:"profiles_with_selectors"`
}

func (ListProfilesByProjectIDAndLabelRow) GetContextualRules added in v0.0.40

GetContextualRules returns the contextual rules

func (ListProfilesByProjectIDAndLabelRow) GetEntityProfile added in v0.0.38

func (r ListProfilesByProjectIDAndLabelRow) GetEntityProfile() NullEntities

GetEntityProfile returns the entity profile

func (ListProfilesByProjectIDAndLabelRow) GetProfile added in v0.0.38

GetProfile returns the profile

func (ListProfilesByProjectIDAndLabelRow) GetSelectors added in v0.0.55

GetSelectors returns the selectors

type ListProfilesByProjectIDRow

type ListProfilesByProjectIDRow struct {
	Profile                   Profile                   `json:"profile"`
	ProfilesWithEntityProfile ProfilesWithEntityProfile `json:"profiles_with_entity_profile"`
	ProfilesWithSelectors     []ProfileSelector         `json:"profiles_with_selectors"`
}

func (ListProfilesByProjectIDRow) GetContextualRules added in v0.0.40

func (r ListProfilesByProjectIDRow) GetContextualRules() pqtype.NullRawMessage

GetContextualRules returns the contextual rules

func (ListProfilesByProjectIDRow) GetEntityProfile added in v0.0.38

func (r ListProfilesByProjectIDRow) GetEntityProfile() NullEntities

GetEntityProfile returns the entity profile

func (ListProfilesByProjectIDRow) GetProfile added in v0.0.38

func (r ListProfilesByProjectIDRow) GetProfile() Profile

GetProfile returns the profile

func (ListProfilesByProjectIDRow) GetSelectors added in v0.0.55

func (r ListProfilesByProjectIDRow) GetSelectors() []ProfileSelector

GetSelectors returns the selectors

type ListProvidersByProjectIDPaginatedParams added in v0.0.30

type ListProvidersByProjectIDPaginatedParams struct {
	ProjectID uuid.UUID    `json:"project_id"`
	CreatedAt sql.NullTime `json:"created_at"`
	Limit     int32        `json:"limit"`
}

type ListRegisteredRepositoriesByProjectIDAndProviderParams

type ListRegisteredRepositoriesByProjectIDAndProviderParams struct {
	ProjectID uuid.UUID      `json:"project_id"`
	Provider  sql.NullString `json:"provider"`
}

type ListRepositoriesAfterIDParams added in v0.0.52

type ListRepositoriesAfterIDParams struct {
	ID    uuid.UUID `json:"id"`
	Limit int64     `json:"limit"`
}

type ListRepositoriesByProjectIDParams

type ListRepositoriesByProjectIDParams struct {
	ProjectID uuid.UUID      `json:"project_id"`
	RepoID    sql.NullInt64  `json:"repo_id"`
	Provider  sql.NullString `json:"provider"`
	Limit     sql.NullInt64  `json:"limit"`
}

type ListRuleEvaluationsByProfileIdParams

type ListRuleEvaluationsByProfileIdParams struct {
	ProfileID    uuid.UUID      `json:"profile_id"`
	EntityType   NullEntities   `json:"entity_type"`
	EntityID     uuid.NullUUID  `json:"entity_id"`
	RuleTypeName sql.NullString `json:"rule_type_name"`
	RuleName     sql.NullString `json:"rule_name"`
}

type ListRuleEvaluationsByProfileIdRow

type ListRuleEvaluationsByProfileIdRow struct {
	EvalStatus            NullEvalStatusTypes        `json:"eval_status"`
	EvalLastUpdated       sql.NullTime               `json:"eval_last_updated"`
	EvalDetails           sql.NullString             `json:"eval_details"`
	RemStatus             NullRemediationStatusTypes `json:"rem_status"`
	RemDetails            sql.NullString             `json:"rem_details"`
	RemMetadata           pqtype.NullRawMessage      `json:"rem_metadata"`
	RemLastUpdated        sql.NullTime               `json:"rem_last_updated"`
	AlertStatus           NullAlertStatusTypes       `json:"alert_status"`
	AlertDetails          sql.NullString             `json:"alert_details"`
	AlertMetadata         pqtype.NullRawMessage      `json:"alert_metadata"`
	AlertLastUpdated      sql.NullTime               `json:"alert_last_updated"`
	RuleEvaluationID      uuid.UUID                  `json:"rule_evaluation_id"`
	RepositoryID          uuid.NullUUID              `json:"repository_id"`
	Entity                Entities                   `json:"entity"`
	RuleName              string                     `json:"rule_name"`
	RepoName              string                     `json:"repo_name"`
	RepoOwner             string                     `json:"repo_owner"`
	Provider              string                     `json:"provider"`
	RuleTypeName          string                     `json:"rule_type_name"`
	RuleTypeSeverityValue Severity                   `json:"rule_type_severity_value"`
	RuleTypeID            uuid.UUID                  `json:"rule_type_id"`
	RuleTypeGuidance      string                     `json:"rule_type_guidance"`
	RuleTypeDisplayName   string                     `json:"rule_type_display_name"`
}

type ListTokensToMigrateParams added in v0.0.52

type ListTokensToMigrateParams struct {
	DefaultAlgorithm  string `json:"default_algorithm"`
	DefaultKeyVersion string `json:"default_key_version"`
	BatchOffset       int64  `json:"batch_offset"`
	BatchSize         int64  `json:"batch_size"`
}

type ListUsersParams

type ListUsersParams struct {
	Limit  int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type LockIfThresholdNotExceededParams added in v0.0.17

type LockIfThresholdNotExceededParams struct {
	Entity        Entities      `json:"entity"`
	RepositoryID  uuid.NullUUID `json:"repository_id"`
	ArtifactID    uuid.NullUUID `json:"artifact_id"`
	PullRequestID uuid.NullUUID `json:"pull_request_id"`
	ProjectID     uuid.UUID     `json:"project_id"`
	Interval      string        `json:"interval"`
}

type MigrationProfileBackfillLog added in v0.0.29

type MigrationProfileBackfillLog struct {
	ProfileID uuid.UUID `json:"profile_id"`
}

type NullActionType

type NullActionType struct {
	ActionType ActionType `json:"action_type"`
	Valid      bool       `json:"valid"` // Valid is true if ActionType is not NULL
}

func ValidateAlertType added in v0.0.36

func ValidateAlertType(r string) NullActionType

ValidateAlertType validates the alert type, defaulting to "on" if invalid

func ValidateRemediateType added in v0.0.36

func ValidateRemediateType(r string) NullActionType

ValidateRemediateType validates the remediate type, defaulting to "off" if invalid

func (*NullActionType) Scan

func (ns *NullActionType) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullActionType) Value

func (ns NullActionType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullAlertStatusTypes

type NullAlertStatusTypes struct {
	AlertStatusTypes AlertStatusTypes `json:"alert_status_types"`
	Valid            bool             `json:"valid"` // Valid is true if AlertStatusTypes is not NULL
}

func (*NullAlertStatusTypes) Scan

func (ns *NullAlertStatusTypes) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullAlertStatusTypes) Value

func (ns NullAlertStatusTypes) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullAuthorizationFlow added in v0.0.35

type NullAuthorizationFlow struct {
	AuthorizationFlow AuthorizationFlow `json:"authorization_flow"`
	Valid             bool              `json:"valid"` // Valid is true if AuthorizationFlow is not NULL
}

func (*NullAuthorizationFlow) Scan added in v0.0.35

func (ns *NullAuthorizationFlow) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullAuthorizationFlow) Value added in v0.0.35

func (ns NullAuthorizationFlow) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullEntities

type NullEntities struct {
	Entities Entities `json:"entities"`
	Valid    bool     `json:"valid"` // Valid is true if Entities is not NULL
}

func (*NullEntities) Scan

func (ns *NullEntities) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullEntities) Value

func (ns NullEntities) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullEvalStatusTypes

type NullEvalStatusTypes struct {
	EvalStatusTypes EvalStatusTypes `json:"eval_status_types"`
	Valid           bool            `json:"valid"` // Valid is true if EvalStatusTypes is not NULL
}

func (*NullEvalStatusTypes) Scan

func (ns *NullEvalStatusTypes) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullEvalStatusTypes) Value

func (ns NullEvalStatusTypes) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullProviderClass added in v0.0.38

type NullProviderClass struct {
	ProviderClass ProviderClass `json:"provider_class"`
	Valid         bool          `json:"valid"` // Valid is true if ProviderClass is not NULL
}

func (*NullProviderClass) Scan added in v0.0.38

func (ns *NullProviderClass) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullProviderClass) Value added in v0.0.38

func (ns NullProviderClass) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullProviderType

type NullProviderType struct {
	ProviderType ProviderType `json:"provider_type"`
	Valid        bool         `json:"valid"` // Valid is true if ProviderType is not NULL
}

func (*NullProviderType) Scan

func (ns *NullProviderType) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullProviderType) Value

func (ns NullProviderType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullRemediationStatusTypes

type NullRemediationStatusTypes struct {
	RemediationStatusTypes RemediationStatusTypes `json:"remediation_status_types"`
	Valid                  bool                   `json:"valid"` // Valid is true if RemediationStatusTypes is not NULL
}

func (*NullRemediationStatusTypes) Scan

func (ns *NullRemediationStatusTypes) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullRemediationStatusTypes) Value

Value implements the driver Valuer interface.

type NullSeverity added in v0.0.32

type NullSeverity struct {
	Severity Severity `json:"severity"`
	Valid    bool     `json:"valid"` // Valid is true if Severity is not NULL
}

func (*NullSeverity) Scan added in v0.0.32

func (ns *NullSeverity) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullSeverity) Value added in v0.0.32

func (ns NullSeverity) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type OrphanProjectParams added in v0.0.35

type OrphanProjectParams struct {
	ID       uuid.UUID       `json:"id"`
	Metadata json.RawMessage `json:"metadata"`
}

type PgTime added in v0.0.55

type PgTime struct{ time.Time }

PgTime wraps a time.Time

func (*PgTime) Scan added in v0.0.55

func (t *PgTime) Scan(val interface{}) error

Scan implements the sql.Scanner interface

func (*PgTime) Value added in v0.0.55

func (t *PgTime) Value() (driver.Value, error)

Value implements the driver.Valuer interface

type PgTimeArray added in v0.0.55

type PgTimeArray []PgTime

PgTimeArray wraps a time.Time slice to be used as a Postgres array type PgTimeArray []time.Time

func (*PgTimeArray) Scan added in v0.0.55

func (a *PgTimeArray) Scan(src interface{}) error

Scan implements the sql.Scanner interface

func (*PgTimeArray) Value added in v0.0.55

func (a *PgTimeArray) Value() (driver.Value, error)

Value implements the driver.Valuer interface

type Profile

type Profile struct {
	ID             uuid.UUID      `json:"id"`
	Name           string         `json:"name"`
	Provider       sql.NullString `json:"provider"`
	ProjectID      uuid.UUID      `json:"project_id"`
	Remediate      NullActionType `json:"remediate"`
	Alert          NullActionType `json:"alert"`
	CreatedAt      time.Time      `json:"created_at"`
	UpdatedAt      time.Time      `json:"updated_at"`
	ProviderID     uuid.NullUUID  `json:"provider_id"`
	SubscriptionID uuid.NullUUID  `json:"subscription_id"`
	DisplayName    string         `json:"display_name"`
	Labels         []string       `json:"labels"`
}

type ProfileRow added in v0.0.38

type ProfileRow interface {
	GetProfile() Profile
	GetEntityProfile() NullEntities
	GetSelectors() []ProfileSelector
	GetContextualRules() pqtype.NullRawMessage
}

ProfileRow is an interface row in the profiles table

type ProfileSelector added in v0.0.54

type ProfileSelector struct {
	ID        uuid.UUID    `json:"id"`
	ProfileID uuid.UUID    `json:"profile_id"`
	Entity    NullEntities `json:"entity"`
	Selector  string       `json:"selector"`
	Comment   string       `json:"comment"`
}

func (*ProfileSelector) Scan added in v0.0.54

func (s *ProfileSelector) Scan(value interface{}) error

Scan implements the sql.Scanner interface for the SelectorInfo struct

type ProfileStatus

type ProfileStatus struct {
	ID            uuid.UUID       `json:"id"`
	ProfileID     uuid.UUID       `json:"profile_id"`
	ProfileStatus EvalStatusTypes `json:"profile_status"`
	LastUpdated   time.Time       `json:"last_updated"`
}

type ProfilesWithEntityProfile added in v0.0.40

type ProfilesWithEntityProfile struct {
	ID              uuid.NullUUID         `json:"id"`
	Entity          NullEntities          `json:"entity"`
	ProfileID       uuid.NullUUID         `json:"profile_id"`
	ContextualRules pqtype.NullRawMessage `json:"contextual_rules"`
	CreatedAt       sql.NullTime          `json:"created_at"`
	UpdatedAt       sql.NullTime          `json:"updated_at"`
	Profid          uuid.UUID             `json:"profid"`
}

type Project

type Project struct {
	ID             uuid.UUID       `json:"id"`
	Name           string          `json:"name"`
	IsOrganization bool            `json:"is_organization"`
	Metadata       json.RawMessage `json:"metadata"`
	ParentID       uuid.NullUUID   `json:"parent_id"`
	CreatedAt      time.Time       `json:"created_at"`
	UpdatedAt      time.Time       `json:"updated_at"`
}

type Provider

type Provider struct {
	ID         uuid.UUID           `json:"id"`
	Name       string              `json:"name"`
	Version    string              `json:"version"`
	ProjectID  uuid.UUID           `json:"project_id"`
	Implements []ProviderType      `json:"implements"`
	Definition json.RawMessage     `json:"definition"`
	CreatedAt  time.Time           `json:"created_at"`
	UpdatedAt  time.Time           `json:"updated_at"`
	AuthFlows  []AuthorizationFlow `json:"auth_flows"`
	Class      ProviderClass       `json:"class"`
}

func (*Provider) CanImplement added in v0.0.48

func (p *Provider) CanImplement(impl ProviderType) bool

CanImplement returns true if the provider implements the given type.

type ProviderAccessToken

type ProviderAccessToken struct {
	ID                   int32                 `json:"id"`
	Provider             string                `json:"provider"`
	ProjectID            uuid.UUID             `json:"project_id"`
	OwnerFilter          sql.NullString        `json:"owner_filter"`
	EncryptedToken       sql.NullString        `json:"encrypted_token"`
	ExpirationTime       time.Time             `json:"expiration_time"`
	CreatedAt            time.Time             `json:"created_at"`
	UpdatedAt            time.Time             `json:"updated_at"`
	EnrollmentNonce      sql.NullString        `json:"enrollment_nonce"`
	EncryptedAccessToken pqtype.NullRawMessage `json:"encrypted_access_token"`
}

type ProviderClass added in v0.0.38

type ProviderClass string
const (
	ProviderClassGithub    ProviderClass = "github"
	ProviderClassGithubApp ProviderClass = "github-app"
	ProviderClassGhcr      ProviderClass = "ghcr"
	ProviderClassDockerhub ProviderClass = "dockerhub"
)

func (*ProviderClass) Scan added in v0.0.38

func (e *ProviderClass) Scan(src interface{}) error

type ProviderGithubAppInstallation added in v0.0.37

type ProviderGithubAppInstallation struct {
	AppInstallationID int64          `json:"app_installation_id"`
	ProviderID        uuid.NullUUID  `json:"provider_id"`
	OrganizationID    int64          `json:"organization_id"`
	EnrollingUserID   sql.NullString `json:"enrolling_user_id"`
	CreatedAt         time.Time      `json:"created_at"`
	UpdatedAt         time.Time      `json:"updated_at"`
	EnrollmentNonce   sql.NullString `json:"enrollment_nonce"`
	ProjectID         uuid.NullUUID  `json:"project_id"`
	IsOrg             bool           `json:"is_org"`
}

type ProviderType

type ProviderType string
const (
	ProviderTypeGithub      ProviderType = "github"
	ProviderTypeRest        ProviderType = "rest"
	ProviderTypeGit         ProviderType = "git"
	ProviderTypeOci         ProviderType = "oci"
	ProviderTypeRepoLister  ProviderType = "repo-lister"
	ProviderTypeImageLister ProviderType = "image-lister"
)

func (*ProviderType) Scan

func (e *ProviderType) Scan(src interface{}) error

type PullRequest

type PullRequest struct {
	ID           uuid.UUID `json:"id"`
	RepositoryID uuid.UUID `json:"repository_id"`
	PrNumber     int64     `json:"pr_number"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

type Querier

type Querier interface {
	CountProfilesByEntityType(ctx context.Context) ([]CountProfilesByEntityTypeRow, error)
	CountProfilesByName(ctx context.Context, name string) (int64, error)
	CountRepositories(ctx context.Context) (int64, error)
	CountUsers(ctx context.Context) (int64, error)
	// CreateInvitation creates a new invitation. The code is a secret that is sent
	// to the invitee, and the email is the address to which the invitation will be
	// sent. The role is the role that the invitee will have when they accept the
	// invitation. The project is the project to which the invitee will be invited.
	// The sponsor is the user who is inviting the invitee.
	CreateInvitation(ctx context.Context, arg CreateInvitationParams) (UserInvite, error)
	CreateProfile(ctx context.Context, arg CreateProfileParams) (Profile, error)
	CreateProfileForEntity(ctx context.Context, arg CreateProfileForEntityParams) (EntityProfile, error)
	CreateProject(ctx context.Context, arg CreateProjectParams) (Project, error)
	CreateProjectWithID(ctx context.Context, arg CreateProjectWithIDParams) (Project, error)
	CreateProvider(ctx context.Context, arg CreateProviderParams) (Provider, error)
	CreatePullRequest(ctx context.Context, arg CreatePullRequestParams) (PullRequest, error)
	CreateRepository(ctx context.Context, arg CreateRepositoryParams) (Repository, error)
	CreateRuleType(ctx context.Context, arg CreateRuleTypeParams) (RuleType, error)
	CreateSelector(ctx context.Context, arg CreateSelectorParams) (ProfileSelector, error)
	CreateSessionState(ctx context.Context, arg CreateSessionStateParams) (SessionStore, error)
	// Subscriptions --
	CreateSubscription(ctx context.Context, arg CreateSubscriptionParams) (Subscription, error)
	CreateUser(ctx context.Context, identitySubject string) (User, error)
	DeleteArtifact(ctx context.Context, id uuid.UUID) error
	DeleteExpiredSessionStates(ctx context.Context) (int64, error)
	DeleteInstallationIDByAppID(ctx context.Context, appInstallationID int64) error
	// DeleteInvitation deletes an invitation by its code. This is intended to be
	// called by a user who has issued an invitation and then accepted it, declined
	// it or the sponsor has decided to revoke it.
	DeleteInvitation(ctx context.Context, code string) (UserInvite, error)
	DeleteNonUpdatedRules(ctx context.Context, arg DeleteNonUpdatedRulesParams) error
	DeleteProfile(ctx context.Context, arg DeleteProfileParams) error
	DeleteProfileForEntity(ctx context.Context, arg DeleteProfileForEntityParams) error
	DeleteProject(ctx context.Context, id uuid.UUID) ([]DeleteProjectRow, error)
	DeleteProvider(ctx context.Context, arg DeleteProviderParams) error
	DeletePullRequest(ctx context.Context, arg DeletePullRequestParams) error
	DeleteRepository(ctx context.Context, id uuid.UUID) error
	DeleteRuleInstantiation(ctx context.Context, arg DeleteRuleInstantiationParams) error
	// DeleteRuleStatusesForProfileAndRuleType deletes a rule evaluation
	// but locks the table before doing so.
	DeleteRuleStatusesForProfileAndRuleType(ctx context.Context, arg DeleteRuleStatusesForProfileAndRuleTypeParams) error
	DeleteRuleType(ctx context.Context, id uuid.UUID) error
	DeleteSelector(ctx context.Context, id uuid.UUID) error
	DeleteSessionStateByProjectID(ctx context.Context, arg DeleteSessionStateByProjectIDParams) error
	DeleteUser(ctx context.Context, id int32) error
	EnqueueFlush(ctx context.Context, arg EnqueueFlushParams) (FlushCache, error)
	// FindProviders allows us to take a trait and filter
	// providers by it. It also optionally takes a name, in case we want to
	// filter by name as well.
	FindProviders(ctx context.Context, arg FindProvidersParams) ([]Provider, error)
	FlushCache(ctx context.Context, arg FlushCacheParams) (FlushCache, error)
	GetAccessTokenByEnrollmentNonce(ctx context.Context, arg GetAccessTokenByEnrollmentNonceParams) (ProviderAccessToken, error)
	GetAccessTokenByProjectID(ctx context.Context, arg GetAccessTokenByProjectIDParams) (ProviderAccessToken, error)
	GetAccessTokenByProvider(ctx context.Context, provider string) ([]ProviderAccessToken, error)
	GetAccessTokenSinceDate(ctx context.Context, arg GetAccessTokenSinceDateParams) (ProviderAccessToken, error)
	GetArtifactByID(ctx context.Context, arg GetArtifactByIDParams) (Artifact, error)
	GetArtifactByName(ctx context.Context, arg GetArtifactByNameParams) (Artifact, error)
	GetBundle(ctx context.Context, arg GetBundleParams) (Bundle, error)
	GetChildrenProjects(ctx context.Context, id uuid.UUID) ([]GetChildrenProjectsRow, error)
	// GetFeatureInProject verifies if a feature is available for a specific project.
	// It returns the settings for the feature if it is available.
	GetFeatureInProject(ctx context.Context, arg GetFeatureInProjectParams) (json.RawMessage, error)
	GetIDByProfileEntityName(ctx context.Context, arg GetIDByProfileEntityNameParams) (uuid.UUID, error)
	// GetImmediateChildrenProjects is a query that returns all the immediate children of a project.
	GetImmediateChildrenProjects(ctx context.Context, parentID uuid.UUID) ([]Project, error)
	GetInstallationIDByAppID(ctx context.Context, appInstallationID int64) (ProviderGithubAppInstallation, error)
	GetInstallationIDByEnrollmentNonce(ctx context.Context, arg GetInstallationIDByEnrollmentNonceParams) (ProviderGithubAppInstallation, error)
	GetInstallationIDByProviderID(ctx context.Context, providerID uuid.NullUUID) (ProviderGithubAppInstallation, error)
	// GetInvitationByCode retrieves an invitation by its code. This is intended to
	// be called by a user who has received an invitation email and is following the
	// link to accept the invitation or when querying for additional info about the
	// invitation.
	GetInvitationByCode(ctx context.Context, code string) (GetInvitationByCodeRow, error)
	// GetInvitationsByEmail retrieves all invitations for a given email address.
	// This is intended to be called by a logged in user with their own email address,
	// to allow them to accept invitations even if email delivery was not working.
	// Note that this requires that the destination email address matches the email
	// address of the logged in user in the external identity service / auth token.
	// This clarification is related solely for user's ListInvitations calls and does
	// not affect to resolving invitations intended for other mail addresses.
	GetInvitationsByEmail(ctx context.Context, email string) ([]GetInvitationsByEmailRow, error)
	// GetInvitationsByEmailAndProject retrieves all invitations by email and project.
	GetInvitationsByEmailAndProject(ctx context.Context, arg GetInvitationsByEmailAndProjectParams) ([]GetInvitationsByEmailAndProjectRow, error)
	// Copyright 2024 Stacklok, Inc
	//
	// Licensed under the Apache License, Version 2.0 (the "License");
	// you may not use this file except in compliance with the License.
	// You may obtain a copy of the License at
	//
	//      http://www.apache.org/licenses/LICENSE-2.0
	//
	// Unless required by applicable law or agreed to in writing, software
	// distributed under the License is distributed on an "AS IS" BASIS,
	// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	// See the License for the specific language governing permissions and
	// limitations under the License.
	GetLatestEvalStateForRuleEntity(ctx context.Context, arg GetLatestEvalStateForRuleEntityParams) (EvaluationStatus, error)
	GetParentProjects(ctx context.Context, id uuid.UUID) ([]uuid.UUID, error)
	GetParentProjectsUntil(ctx context.Context, arg GetParentProjectsUntilParams) ([]uuid.UUID, error)
	GetProfileByID(ctx context.Context, arg GetProfileByIDParams) (Profile, error)
	GetProfileByIDAndLock(ctx context.Context, arg GetProfileByIDAndLockParams) (Profile, error)
	GetProfileByNameAndLock(ctx context.Context, arg GetProfileByNameAndLockParams) (Profile, error)
	GetProfileByProjectAndID(ctx context.Context, arg GetProfileByProjectAndIDParams) ([]GetProfileByProjectAndIDRow, error)
	GetProfileForEntity(ctx context.Context, arg GetProfileForEntityParams) (EntityProfile, error)
	GetProfileStatusByIdAndProject(ctx context.Context, arg GetProfileStatusByIdAndProjectParams) (GetProfileStatusByIdAndProjectRow, error)
	GetProfileStatusByNameAndProject(ctx context.Context, arg GetProfileStatusByNameAndProjectParams) (GetProfileStatusByNameAndProjectRow, error)
	GetProfileStatusByProject(ctx context.Context, projectID uuid.UUID) ([]GetProfileStatusByProjectRow, error)
	GetProjectByID(ctx context.Context, id uuid.UUID) (Project, error)
	GetProjectByName(ctx context.Context, name string) (Project, error)
	GetProjectIDBySessionState(ctx context.Context, sessionState string) (GetProjectIDBySessionStateRow, error)
	GetProviderByID(ctx context.Context, id uuid.UUID) (Provider, error)
	GetProviderByIDAndProject(ctx context.Context, arg GetProviderByIDAndProjectParams) (Provider, error)
	// GetProviderByName allows us to get a provider by its name. This takes
	// into account the project hierarchy, so it will only return the provider
	// if it exists in the project or any of its ancestors. It'll return the first
	// provider that matches the name.
	GetProviderByName(ctx context.Context, arg GetProviderByNameParams) (Provider, error)
	// get a list of repos with webhooks belonging to a provider
	// is used for webhook cleanup during provider deletion
	GetProviderWebhooks(ctx context.Context, providerID uuid.UUID) ([]GetProviderWebhooksRow, error)
	GetPullRequest(ctx context.Context, arg GetPullRequestParams) (PullRequest, error)
	GetPullRequestByID(ctx context.Context, id uuid.UUID) (PullRequest, error)
	// avoid using this, where possible use GetRepositoryByIDAndProject instead
	GetRepositoryByID(ctx context.Context, id uuid.UUID) (Repository, error)
	GetRepositoryByIDAndProject(ctx context.Context, arg GetRepositoryByIDAndProjectParams) (Repository, error)
	GetRepositoryByRepoID(ctx context.Context, repoID int64) (Repository, error)
	GetRepositoryByRepoName(ctx context.Context, arg GetRepositoryByRepoNameParams) (Repository, error)
	GetRuleInstancesForProfile(ctx context.Context, profileID uuid.UUID) ([]RuleInstance, error)
	GetRuleInstancesForProfileEntity(ctx context.Context, arg GetRuleInstancesForProfileEntityParams) ([]RuleInstance, error)
	GetRuleTypeByID(ctx context.Context, id uuid.UUID) (RuleType, error)
	GetRuleTypeByName(ctx context.Context, arg GetRuleTypeByNameParams) (RuleType, error)
	// intended as a temporary transition query
	// this will be removed once rule_instances is used consistently in the engine
	GetRuleTypeIDByRuleNameEntityProfile(ctx context.Context, arg GetRuleTypeIDByRuleNameEntityProfileParams) (uuid.UUID, error)
	GetRuleTypesByEntityInHierarchy(ctx context.Context, arg GetRuleTypesByEntityInHierarchyParams) ([]RuleType, error)
	GetSelectorByID(ctx context.Context, id uuid.UUID) (ProfileSelector, error)
	GetSelectorsByProfileID(ctx context.Context, profileID uuid.UUID) ([]ProfileSelector, error)
	GetSubscriptionByProjectBundle(ctx context.Context, arg GetSubscriptionByProjectBundleParams) (Subscription, error)
	GetUnclaimedInstallationsByUser(ctx context.Context, ghID sql.NullString) ([]ProviderGithubAppInstallation, error)
	GetUserByID(ctx context.Context, id int32) (User, error)
	GetUserBySubject(ctx context.Context, identitySubject string) (User, error)
	GlobalListProviders(ctx context.Context) ([]Provider, error)
	GlobalListProvidersByClass(ctx context.Context, class ProviderClass) ([]Provider, error)
	InsertAlertEvent(ctx context.Context, arg InsertAlertEventParams) error
	InsertEvaluationRuleEntity(ctx context.Context, arg InsertEvaluationRuleEntityParams) (uuid.UUID, error)
	InsertEvaluationStatus(ctx context.Context, arg InsertEvaluationStatusParams) (uuid.UUID, error)
	InsertRemediationEvent(ctx context.Context, arg InsertRemediationEventParams) error
	ListArtifactsByRepoID(ctx context.Context, repositoryID uuid.NullUUID) ([]Artifact, error)
	ListEvaluationHistory(ctx context.Context, arg ListEvaluationHistoryParams) ([]ListEvaluationHistoryRow, error)
	ListFlushCache(ctx context.Context) ([]FlushCache, error)
	// ListInvitationsForProject collects the information visible to project
	// administrators after an invitation has been issued.  In particular, it
	// *does not* report the invitation code, which is a secret intended for
	// the invitee.
	ListInvitationsForProject(ctx context.Context, project uuid.UUID) ([]ListInvitationsForProjectRow, error)
	// ListNonOrgProjects is a query that lists all non-organization projects.
	// projects have a boolean field is_organization that is set to true if the project is an organization.
	// this flag is no longer used and will be removed in the future.
	ListNonOrgProjects(ctx context.Context) ([]Project, error)
	// ListOrgProjects is a query that lists all organization projects.
	// projects have a boolean field is_organization that is set to true if the project is an organization.
	// this flag is no longer used and will be removed in the future.
	ListOldOrgProjects(ctx context.Context) ([]Project, error)
	// ListOldestRuleEvaluationsByRepositoryId has casts in select statement as sqlc generates incorrect types.
	// cast after MIN is required due to a known bug in sqlc: https://github.com/sqlc-dev/sqlc/issues/1965
	ListOldestRuleEvaluationsByRepositoryId(ctx context.Context, repositoryIds []uuid.UUID) ([]ListOldestRuleEvaluationsByRepositoryIdRow, error)
	ListProfilesByProjectID(ctx context.Context, projectID uuid.UUID) ([]ListProfilesByProjectIDRow, error)
	ListProfilesByProjectIDAndLabel(ctx context.Context, arg ListProfilesByProjectIDAndLabelParams) ([]ListProfilesByProjectIDAndLabelRow, error)
	ListProfilesInstantiatingRuleType(ctx context.Context, ruleTypeID uuid.UUID) ([]string, error)
	// ListProvidersByProjectID allows us to list all providers
	// for a given array of projects.
	ListProvidersByProjectID(ctx context.Context, projects []uuid.UUID) ([]Provider, error)
	// ListProvidersByProjectIDPaginated allows us to lits all providers for a given project
	// with pagination taken into account. In this case, the cursor is the creation date.
	ListProvidersByProjectIDPaginated(ctx context.Context, arg ListProvidersByProjectIDPaginatedParams) ([]Provider, error)
	ListRegisteredRepositoriesByProjectIDAndProvider(ctx context.Context, arg ListRegisteredRepositoriesByProjectIDAndProviderParams) ([]Repository, error)
	ListRepositoriesAfterID(ctx context.Context, arg ListRepositoriesAfterIDParams) ([]Repository, error)
	ListRepositoriesByProjectID(ctx context.Context, arg ListRepositoriesByProjectIDParams) ([]Repository, error)
	ListRuleEvaluationsByProfileId(ctx context.Context, arg ListRuleEvaluationsByProfileIdParams) ([]ListRuleEvaluationsByProfileIdRow, error)
	ListRuleTypesByProject(ctx context.Context, projectID uuid.UUID) ([]RuleType, error)
	// When doing a key/algorithm rotation, identify the secrets which need to be
	// rotated. The criteria for rotation are:
	// 1) The encrypted_access_token is NULL (this should be removed when we make
	//    this column non-nullable).
	// 2) The access token does not use the configured default algorithm.
	// 3) The access token does not use the default key version.
	// This query accepts the default key version/algorithm as arguments since
	// that information is not known to the database.
	ListTokensToMigrate(ctx context.Context, arg ListTokensToMigrateParams) ([]ProviderAccessToken, error)
	ListUsers(ctx context.Context, arg ListUsersParams) ([]User, error)
	// LockIfThresholdNotExceeded is used to lock an entity for execution. It will
	// attempt to insert or update the entity_execution_lock table only if the
	// last_lock_time is older than the threshold. If the lock is successful, it
	// will return the lock record. If the lock is unsuccessful, it will return
	// NULL.
	LockIfThresholdNotExceeded(ctx context.Context, arg LockIfThresholdNotExceededParams) (EntityExecutionLock, error)
	// OrphanProject is a query that sets the parent_id of a project to NULL.
	OrphanProject(ctx context.Context, arg OrphanProjectParams) (Project, error)
	// ReleaseLock is used to release a lock on an entity. It will delete the
	// entity_execution_lock record if the lock is held by the given locked_by
	// value.
	ReleaseLock(ctx context.Context, arg ReleaseLockParams) error
	RepositoryExistsAfterID(ctx context.Context, id uuid.UUID) (bool, error)
	SetCurrentVersion(ctx context.Context, arg SetCurrentVersionParams) error
	UpdateEncryptedSecret(ctx context.Context, arg UpdateEncryptedSecretParams) error
	// UpdateInvitationRole updates an invitation by its code. This is intended to be
	// called by a user who has issued an invitation and then decided to change the
	// role of the invitee.
	UpdateInvitationRole(ctx context.Context, arg UpdateInvitationRoleParams) (UserInvite, error)
	UpdateLease(ctx context.Context, arg UpdateLeaseParams) error
	UpdateProfile(ctx context.Context, arg UpdateProfileParams) (Profile, error)
	UpdateProjectMeta(ctx context.Context, arg UpdateProjectMetaParams) (Project, error)
	UpdateProvider(ctx context.Context, arg UpdateProviderParams) error
	UpdateReminderLastSentById(ctx context.Context, id uuid.UUID) error
	UpdateRuleType(ctx context.Context, arg UpdateRuleTypeParams) (RuleType, error)
	UpdateSelector(ctx context.Context, arg UpdateSelectorParams) (ProfileSelector, error)
	UpsertAccessToken(ctx context.Context, arg UpsertAccessTokenParams) (ProviderAccessToken, error)
	UpsertArtifact(ctx context.Context, arg UpsertArtifactParams) (Artifact, error)
	// Copyright 2024 Stacklok, Inc
	//
	// Licensed under the Apache License, Version 2.0 (the "License");
	// you may not use this file except in compliance with the License.
	// You may obtain a copy of the License at
	//
	//      http://www.apache.org/licenses/LICENSE-2.0
	//
	// Unless required by applicable law or agreed to in writing, software
	// distributed under the License is distributed on an "AS IS" BASIS,
	// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	// See the License for the specific language governing permissions and
	// limitations under the License.
	// Bundles --
	UpsertBundle(ctx context.Context, arg UpsertBundleParams) error
	UpsertInstallationID(ctx context.Context, arg UpsertInstallationIDParams) (ProviderGithubAppInstallation, error)
	UpsertLatestEvaluationStatus(ctx context.Context, arg UpsertLatestEvaluationStatusParams) error
	UpsertProfileForEntity(ctx context.Context, arg UpsertProfileForEntityParams) (EntityProfile, error)
	UpsertPullRequest(ctx context.Context, arg UpsertPullRequestParams) (PullRequest, error)
	UpsertRuleDetailsAlert(ctx context.Context, arg UpsertRuleDetailsAlertParams) (uuid.UUID, error)
	UpsertRuleDetailsEval(ctx context.Context, arg UpsertRuleDetailsEvalParams) (uuid.UUID, error)
	UpsertRuleDetailsRemediate(ctx context.Context, arg UpsertRuleDetailsRemediateParams) (uuid.UUID, error)
	UpsertRuleEvaluations(ctx context.Context, arg UpsertRuleEvaluationsParams) (uuid.UUID, error)
	// Copyright 2024 Stacklok, Inc
	//
	// Licensed under the Apache License, Version 2.0 (the "License");
	// you may not use this file except in compliance with the License.
	// You may obtain a copy of the License at
	//
	//      http://www.apache.org/licenses/LICENSE-2.0
	//
	// Unless required by applicable law or agreed to in writing, software
	// distributed under the License is distributed on an "AS IS" BASIS,
	// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	// See the License for the specific language governing permissions and
	// limitations under the License.
	UpsertRuleInstance(ctx context.Context, arg UpsertRuleInstanceParams) (uuid.UUID, error)
	UpsertRuleInstantiation(ctx context.Context, arg UpsertRuleInstantiationParams) (EntityProfileRule, error)
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) CountProfilesByEntityType

func (q *Queries) CountProfilesByEntityType(ctx context.Context) ([]CountProfilesByEntityTypeRow, error)

func (*Queries) CountProfilesByName added in v0.0.20

func (q *Queries) CountProfilesByName(ctx context.Context, name string) (int64, error)

func (*Queries) CountRepositories added in v0.0.16

func (q *Queries) CountRepositories(ctx context.Context) (int64, error)

func (*Queries) CountUsers

func (q *Queries) CountUsers(ctx context.Context) (int64, error)

func (*Queries) CreateInvitation added in v0.0.53

func (q *Queries) CreateInvitation(ctx context.Context, arg CreateInvitationParams) (UserInvite, error)

CreateInvitation creates a new invitation. The code is a secret that is sent to the invitee, and the email is the address to which the invitation will be sent. The role is the role that the invitee will have when they accept the invitation. The project is the project to which the invitee will be invited. The sponsor is the user who is inviting the invitee.

func (*Queries) CreateOrganization

func (q *Queries) CreateOrganization(ctx context.Context, arg CreateOrganizationParams) (Project, error)

func (*Queries) CreateProfile

func (q *Queries) CreateProfile(ctx context.Context, arg CreateProfileParams) (Profile, error)

func (*Queries) CreateProfileForEntity

func (q *Queries) CreateProfileForEntity(ctx context.Context, arg CreateProfileForEntityParams) (EntityProfile, error)

func (*Queries) CreateProject

func (q *Queries) CreateProject(ctx context.Context, arg CreateProjectParams) (Project, error)

func (*Queries) CreateProjectWithID added in v0.0.27

func (q *Queries) CreateProjectWithID(ctx context.Context, arg CreateProjectWithIDParams) (Project, error)

func (*Queries) CreateProvider

func (q *Queries) CreateProvider(ctx context.Context, arg CreateProviderParams) (Provider, error)

func (*Queries) CreatePullRequest

func (q *Queries) CreatePullRequest(ctx context.Context, arg CreatePullRequestParams) (PullRequest, error)

func (*Queries) CreateRepository

func (q *Queries) CreateRepository(ctx context.Context, arg CreateRepositoryParams) (Repository, error)

func (*Queries) CreateRuleType

func (q *Queries) CreateRuleType(ctx context.Context, arg CreateRuleTypeParams) (RuleType, error)

func (*Queries) CreateSelector added in v0.0.54

func (q *Queries) CreateSelector(ctx context.Context, arg CreateSelectorParams) (ProfileSelector, error)

func (*Queries) CreateSessionState

func (q *Queries) CreateSessionState(ctx context.Context, arg CreateSessionStateParams) (SessionStore, error)

func (*Queries) CreateSubscription added in v0.0.37

func (q *Queries) CreateSubscription(ctx context.Context, arg CreateSubscriptionParams) (Subscription, error)

Subscriptions --

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, identitySubject string) (User, error)

func (*Queries) DeleteArtifact

func (q *Queries) DeleteArtifact(ctx context.Context, id uuid.UUID) error

func (*Queries) DeleteExpiredSessionStates

func (q *Queries) DeleteExpiredSessionStates(ctx context.Context) (int64, error)

func (*Queries) DeleteInstallationIDByAppID added in v0.0.39

func (q *Queries) DeleteInstallationIDByAppID(ctx context.Context, appInstallationID int64) error

func (*Queries) DeleteInvitation added in v0.0.53

func (q *Queries) DeleteInvitation(ctx context.Context, code string) (UserInvite, error)

DeleteInvitation deletes an invitation by its code. This is intended to be called by a user who has issued an invitation and then accepted it, declined it or the sponsor has decided to revoke it.

func (*Queries) DeleteNonUpdatedRules added in v0.0.52

func (q *Queries) DeleteNonUpdatedRules(ctx context.Context, arg DeleteNonUpdatedRulesParams) error

func (*Queries) DeleteOrganization

func (q *Queries) DeleteOrganization(ctx context.Context, id uuid.UUID) error

func (*Queries) DeleteProfile

func (q *Queries) DeleteProfile(ctx context.Context, arg DeleteProfileParams) error

func (*Queries) DeleteProfileForEntity added in v0.0.16

func (q *Queries) DeleteProfileForEntity(ctx context.Context, arg DeleteProfileForEntityParams) error

func (*Queries) DeleteProject

func (q *Queries) DeleteProject(ctx context.Context, id uuid.UUID) ([]DeleteProjectRow, error)

func (*Queries) DeleteProvider

func (q *Queries) DeleteProvider(ctx context.Context, arg DeleteProviderParams) error

func (*Queries) DeletePullRequest

func (q *Queries) DeletePullRequest(ctx context.Context, arg DeletePullRequestParams) error

func (*Queries) DeleteRepository

func (q *Queries) DeleteRepository(ctx context.Context, id uuid.UUID) error

func (*Queries) DeleteRuleInstantiation added in v0.0.16

func (q *Queries) DeleteRuleInstantiation(ctx context.Context, arg DeleteRuleInstantiationParams) error

func (*Queries) DeleteRuleStatusesForProfileAndRuleType added in v0.0.16

func (q *Queries) DeleteRuleStatusesForProfileAndRuleType(ctx context.Context, arg DeleteRuleStatusesForProfileAndRuleTypeParams) error

DeleteRuleStatusesForProfileAndRuleType deletes a rule evaluation but locks the table before doing so.

func (*Queries) DeleteRuleType

func (q *Queries) DeleteRuleType(ctx context.Context, id uuid.UUID) error

func (*Queries) DeleteSelector added in v0.0.54

func (q *Queries) DeleteSelector(ctx context.Context, id uuid.UUID) error

func (*Queries) DeleteSessionStateByProjectID

func (q *Queries) DeleteSessionStateByProjectID(ctx context.Context, arg DeleteSessionStateByProjectIDParams) error

func (*Queries) DeleteUser

func (q *Queries) DeleteUser(ctx context.Context, id int32) error

func (*Queries) EnqueueFlush added in v0.0.17

func (q *Queries) EnqueueFlush(ctx context.Context, arg EnqueueFlushParams) (FlushCache, error)

func (*Queries) FindProviders added in v0.0.38

func (q *Queries) FindProviders(ctx context.Context, arg FindProvidersParams) ([]Provider, error)

FindProviders allows us to take a trait and filter providers by it. It also optionally takes a name, in case we want to filter by name as well.

func (*Queries) FlushCache added in v0.0.17

func (q *Queries) FlushCache(ctx context.Context, arg FlushCacheParams) (FlushCache, error)

func (*Queries) GetAccessTokenByEnrollmentNonce added in v0.0.39

func (q *Queries) GetAccessTokenByEnrollmentNonce(ctx context.Context, arg GetAccessTokenByEnrollmentNonceParams) (ProviderAccessToken, error)

func (*Queries) GetAccessTokenByProjectID

func (q *Queries) GetAccessTokenByProjectID(ctx context.Context, arg GetAccessTokenByProjectIDParams) (ProviderAccessToken, error)

func (*Queries) GetAccessTokenByProvider

func (q *Queries) GetAccessTokenByProvider(ctx context.Context, provider string) ([]ProviderAccessToken, error)

func (*Queries) GetAccessTokenSinceDate

func (q *Queries) GetAccessTokenSinceDate(ctx context.Context, arg GetAccessTokenSinceDateParams) (ProviderAccessToken, error)

func (*Queries) GetArtifactByID

func (q *Queries) GetArtifactByID(ctx context.Context, arg GetArtifactByIDParams) (Artifact, error)

func (*Queries) GetArtifactByName added in v0.0.22

func (q *Queries) GetArtifactByName(ctx context.Context, arg GetArtifactByNameParams) (Artifact, error)

func (*Queries) GetBundle added in v0.0.38

func (q *Queries) GetBundle(ctx context.Context, arg GetBundleParams) (Bundle, error)

func (*Queries) GetChildrenProjects

func (q *Queries) GetChildrenProjects(ctx context.Context, id uuid.UUID) ([]GetChildrenProjectsRow, error)

func (*Queries) GetFeatureInProject

func (q *Queries) GetFeatureInProject(ctx context.Context, arg GetFeatureInProjectParams) (json.RawMessage, error)

GetFeatureInProject verifies if a feature is available for a specific project. It returns the settings for the feature if it is available.

func (*Queries) GetIDByProfileEntityName added in v0.0.53

func (q *Queries) GetIDByProfileEntityName(ctx context.Context, arg GetIDByProfileEntityNameParams) (uuid.UUID, error)

func (*Queries) GetImmediateChildrenProjects added in v0.0.53

func (q *Queries) GetImmediateChildrenProjects(ctx context.Context, parentID uuid.UUID) ([]Project, error)

GetImmediateChildrenProjects is a query that returns all the immediate children of a project.

func (*Queries) GetInstallationIDByAppID added in v0.0.39

func (q *Queries) GetInstallationIDByAppID(ctx context.Context, appInstallationID int64) (ProviderGithubAppInstallation, error)

func (*Queries) GetInstallationIDByEnrollmentNonce added in v0.0.39

func (q *Queries) GetInstallationIDByEnrollmentNonce(ctx context.Context, arg GetInstallationIDByEnrollmentNonceParams) (ProviderGithubAppInstallation, error)

func (*Queries) GetInstallationIDByProviderID added in v0.0.37

func (q *Queries) GetInstallationIDByProviderID(ctx context.Context, providerID uuid.NullUUID) (ProviderGithubAppInstallation, error)

func (*Queries) GetInvitationByCode added in v0.0.53

func (q *Queries) GetInvitationByCode(ctx context.Context, code string) (GetInvitationByCodeRow, error)

GetInvitationByCode retrieves an invitation by its code. This is intended to be called by a user who has received an invitation email and is following the link to accept the invitation or when querying for additional info about the invitation.

func (*Queries) GetInvitationsByEmail added in v0.0.53

func (q *Queries) GetInvitationsByEmail(ctx context.Context, email string) ([]GetInvitationsByEmailRow, error)

GetInvitationsByEmail retrieves all invitations for a given email address. This is intended to be called by a logged in user with their own email address, to allow them to accept invitations even if email delivery was not working. Note that this requires that the destination email address matches the email address of the logged in user in the external identity service / auth token. This clarification is related solely for user's ListInvitations calls and does not affect to resolving invitations intended for other mail addresses.

func (*Queries) GetInvitationsByEmailAndProject added in v0.0.53

GetInvitationsByEmailAndProject retrieves all invitations by email and project.

func (*Queries) GetLatestEvalStateForRuleEntity added in v0.0.53

func (q *Queries) GetLatestEvalStateForRuleEntity(ctx context.Context, arg GetLatestEvalStateForRuleEntityParams) (EvaluationStatus, error)

Copyright 2024 Stacklok, Inc

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

func (*Queries) GetOrganization

func (q *Queries) GetOrganization(ctx context.Context, id uuid.UUID) (Project, error)

func (*Queries) GetOrganizationByName

func (q *Queries) GetOrganizationByName(ctx context.Context, name string) (Project, error)

func (*Queries) GetOrganizationForUpdate

func (q *Queries) GetOrganizationForUpdate(ctx context.Context, name string) (Project, error)

func (*Queries) GetParentProjects

func (q *Queries) GetParentProjects(ctx context.Context, id uuid.UUID) ([]uuid.UUID, error)

func (*Queries) GetParentProjectsUntil

func (q *Queries) GetParentProjectsUntil(ctx context.Context, arg GetParentProjectsUntilParams) ([]uuid.UUID, error)

func (*Queries) GetProfileByID

func (q *Queries) GetProfileByID(ctx context.Context, arg GetProfileByIDParams) (Profile, error)

func (*Queries) GetProfileByIDAndLock added in v0.0.16

func (q *Queries) GetProfileByIDAndLock(ctx context.Context, arg GetProfileByIDAndLockParams) (Profile, error)

func (*Queries) GetProfileByNameAndLock added in v0.0.16

func (q *Queries) GetProfileByNameAndLock(ctx context.Context, arg GetProfileByNameAndLockParams) (Profile, error)

func (*Queries) GetProfileByProjectAndID

func (q *Queries) GetProfileByProjectAndID(ctx context.Context, arg GetProfileByProjectAndIDParams) ([]GetProfileByProjectAndIDRow, error)

func (*Queries) GetProfileForEntity added in v0.0.16

func (q *Queries) GetProfileForEntity(ctx context.Context, arg GetProfileForEntityParams) (EntityProfile, error)

func (*Queries) GetProfileStatusByProject

func (q *Queries) GetProfileStatusByProject(ctx context.Context, projectID uuid.UUID) ([]GetProfileStatusByProjectRow, error)

func (*Queries) GetProjectByID

func (q *Queries) GetProjectByID(ctx context.Context, id uuid.UUID) (Project, error)

func (*Queries) GetProjectByName

func (q *Queries) GetProjectByName(ctx context.Context, name string) (Project, error)

func (*Queries) GetProjectIDBySessionState added in v0.0.35

func (q *Queries) GetProjectIDBySessionState(ctx context.Context, sessionState string) (GetProjectIDBySessionStateRow, error)

func (*Queries) GetProviderByID

func (q *Queries) GetProviderByID(ctx context.Context, id uuid.UUID) (Provider, error)

func (*Queries) GetProviderByIDAndProject added in v0.0.48

func (q *Queries) GetProviderByIDAndProject(ctx context.Context, arg GetProviderByIDAndProjectParams) (Provider, error)

func (*Queries) GetProviderByName

func (q *Queries) GetProviderByName(ctx context.Context, arg GetProviderByNameParams) (Provider, error)

GetProviderByName allows us to get a provider by its name. This takes into account the project hierarchy, so it will only return the provider if it exists in the project or any of its ancestors. It'll return the first provider that matches the name.

func (*Queries) GetProviderWebhooks added in v0.0.48

func (q *Queries) GetProviderWebhooks(ctx context.Context, providerID uuid.UUID) ([]GetProviderWebhooksRow, error)

get a list of repos with webhooks belonging to a provider is used for webhook cleanup during provider deletion

func (*Queries) GetPullRequest

func (q *Queries) GetPullRequest(ctx context.Context, arg GetPullRequestParams) (PullRequest, error)

func (*Queries) GetPullRequestByID added in v0.0.17

func (q *Queries) GetPullRequestByID(ctx context.Context, id uuid.UUID) (PullRequest, error)

func (*Queries) GetRepositoryByID

func (q *Queries) GetRepositoryByID(ctx context.Context, id uuid.UUID) (Repository, error)

avoid using this, where possible use GetRepositoryByIDAndProject instead

func (*Queries) GetRepositoryByIDAndProject

func (q *Queries) GetRepositoryByIDAndProject(ctx context.Context, arg GetRepositoryByIDAndProjectParams) (Repository, error)

func (*Queries) GetRepositoryByRepoID

func (q *Queries) GetRepositoryByRepoID(ctx context.Context, repoID int64) (Repository, error)

func (*Queries) GetRepositoryByRepoName

func (q *Queries) GetRepositoryByRepoName(ctx context.Context, arg GetRepositoryByRepoNameParams) (Repository, error)

func (*Queries) GetRuleEvaluationByProfileIdAndRuleType

func (q *Queries) GetRuleEvaluationByProfileIdAndRuleType(
	ctx context.Context,
	profileID uuid.UUID,
	entityType NullEntities,
	ruleName sql.NullString,
	entityID uuid.NullUUID,
	ruleTypeName sql.NullString,
) (ListRuleEvaluationsByProfileIdRow, error)

GetRuleEvaluationByProfileIdAndRuleType returns the rule evaluation for a given profile and its rule name

func (*Queries) GetRuleInstancesForProfile added in v0.0.52

func (q *Queries) GetRuleInstancesForProfile(ctx context.Context, profileID uuid.UUID) ([]RuleInstance, error)

func (*Queries) GetRuleInstancesForProfileEntity added in v0.0.52

func (q *Queries) GetRuleInstancesForProfileEntity(ctx context.Context, arg GetRuleInstancesForProfileEntityParams) ([]RuleInstance, error)

func (*Queries) GetRuleTypeByID

func (q *Queries) GetRuleTypeByID(ctx context.Context, id uuid.UUID) (RuleType, error)

func (*Queries) GetRuleTypeByName

func (q *Queries) GetRuleTypeByName(ctx context.Context, arg GetRuleTypeByNameParams) (RuleType, error)

func (*Queries) GetRuleTypeIDByRuleNameEntityProfile added in v0.0.56

func (q *Queries) GetRuleTypeIDByRuleNameEntityProfile(ctx context.Context, arg GetRuleTypeIDByRuleNameEntityProfileParams) (uuid.UUID, error)

intended as a temporary transition query this will be removed once rule_instances is used consistently in the engine

func (*Queries) GetRuleTypesByEntityInHierarchy added in v0.0.56

func (q *Queries) GetRuleTypesByEntityInHierarchy(ctx context.Context, arg GetRuleTypesByEntityInHierarchyParams) ([]RuleType, error)

func (*Queries) GetSelectorByID added in v0.0.54

func (q *Queries) GetSelectorByID(ctx context.Context, id uuid.UUID) (ProfileSelector, error)

func (*Queries) GetSelectorsByProfileID added in v0.0.54

func (q *Queries) GetSelectorsByProfileID(ctx context.Context, profileID uuid.UUID) ([]ProfileSelector, error)

func (*Queries) GetSubscriptionByProjectBundle added in v0.0.37

func (q *Queries) GetSubscriptionByProjectBundle(ctx context.Context, arg GetSubscriptionByProjectBundleParams) (Subscription, error)

func (*Queries) GetUnclaimedInstallationsByUser added in v0.0.40

func (q *Queries) GetUnclaimedInstallationsByUser(ctx context.Context, ghID sql.NullString) ([]ProviderGithubAppInstallation, error)

func (*Queries) GetUserByID

func (q *Queries) GetUserByID(ctx context.Context, id int32) (User, error)

func (*Queries) GetUserBySubject

func (q *Queries) GetUserBySubject(ctx context.Context, identitySubject string) (User, error)

func (*Queries) GlobalListProviders

func (q *Queries) GlobalListProviders(ctx context.Context) ([]Provider, error)

func (*Queries) GlobalListProvidersByClass added in v0.0.38

func (q *Queries) GlobalListProvidersByClass(ctx context.Context, class ProviderClass) ([]Provider, error)

func (*Queries) InsertAlertEvent added in v0.0.54

func (q *Queries) InsertAlertEvent(ctx context.Context, arg InsertAlertEventParams) error

func (*Queries) InsertEvaluationRuleEntity added in v0.0.53

func (q *Queries) InsertEvaluationRuleEntity(ctx context.Context, arg InsertEvaluationRuleEntityParams) (uuid.UUID, error)

func (*Queries) InsertEvaluationStatus added in v0.0.53

func (q *Queries) InsertEvaluationStatus(ctx context.Context, arg InsertEvaluationStatusParams) (uuid.UUID, error)

func (*Queries) InsertRemediationEvent added in v0.0.54

func (q *Queries) InsertRemediationEvent(ctx context.Context, arg InsertRemediationEventParams) error

func (*Queries) ListArtifactsByRepoID

func (q *Queries) ListArtifactsByRepoID(ctx context.Context, repositoryID uuid.NullUUID) ([]Artifact, error)

func (*Queries) ListEvaluationHistory added in v0.0.55

func (q *Queries) ListEvaluationHistory(ctx context.Context, arg ListEvaluationHistoryParams) ([]ListEvaluationHistoryRow, error)

func (*Queries) ListFlushCache added in v0.0.17

func (q *Queries) ListFlushCache(ctx context.Context) ([]FlushCache, error)

func (*Queries) ListInvitationsForProject added in v0.0.52

func (q *Queries) ListInvitationsForProject(ctx context.Context, project uuid.UUID) ([]ListInvitationsForProjectRow, error)

ListInvitationsForProject collects the information visible to project administrators after an invitation has been issued. In particular, it *does not* report the invitation code, which is a secret intended for the invitee.

func (*Queries) ListNonOrgProjects added in v0.0.35

func (q *Queries) ListNonOrgProjects(ctx context.Context) ([]Project, error)

ListNonOrgProjects is a query that lists all non-organization projects. projects have a boolean field is_organization that is set to true if the project is an organization. this flag is no longer used and will be removed in the future.

func (*Queries) ListOldOrgProjects added in v0.0.35

func (q *Queries) ListOldOrgProjects(ctx context.Context) ([]Project, error)

ListOrgProjects is a query that lists all organization projects. projects have a boolean field is_organization that is set to true if the project is an organization. this flag is no longer used and will be removed in the future.

func (*Queries) ListOldestRuleEvaluationsByRepositoryId added in v0.0.52

func (q *Queries) ListOldestRuleEvaluationsByRepositoryId(ctx context.Context, repositoryIds []uuid.UUID) ([]ListOldestRuleEvaluationsByRepositoryIdRow, error)

ListOldestRuleEvaluationsByRepositoryId has casts in select statement as sqlc generates incorrect types. cast after MIN is required due to a known bug in sqlc: https://github.com/sqlc-dev/sqlc/issues/1965

func (*Queries) ListOrganizations

func (q *Queries) ListOrganizations(ctx context.Context, arg ListOrganizationsParams) ([]Project, error)

func (*Queries) ListProfilesByProjectID

func (q *Queries) ListProfilesByProjectID(ctx context.Context, projectID uuid.UUID) ([]ListProfilesByProjectIDRow, error)

func (*Queries) ListProfilesByProjectIDAndLabel added in v0.0.38

func (*Queries) ListProfilesInstantiatingRuleType

func (q *Queries) ListProfilesInstantiatingRuleType(ctx context.Context, ruleTypeID uuid.UUID) ([]string, error)

func (*Queries) ListProvidersByProjectID

func (q *Queries) ListProvidersByProjectID(ctx context.Context, projects []uuid.UUID) ([]Provider, error)

ListProvidersByProjectID allows us to list all providers for a given array of projects.

func (*Queries) ListProvidersByProjectIDPaginated added in v0.0.30

func (q *Queries) ListProvidersByProjectIDPaginated(ctx context.Context, arg ListProvidersByProjectIDPaginatedParams) ([]Provider, error)

ListProvidersByProjectIDPaginated allows us to lits all providers for a given project with pagination taken into account. In this case, the cursor is the creation date.

func (*Queries) ListRegisteredRepositoriesByProjectIDAndProvider

func (q *Queries) ListRegisteredRepositoriesByProjectIDAndProvider(ctx context.Context, arg ListRegisteredRepositoriesByProjectIDAndProviderParams) ([]Repository, error)

func (*Queries) ListRepositoriesAfterID added in v0.0.52

func (q *Queries) ListRepositoriesAfterID(ctx context.Context, arg ListRepositoriesAfterIDParams) ([]Repository, error)

func (*Queries) ListRepositoriesByProjectID

func (q *Queries) ListRepositoriesByProjectID(ctx context.Context, arg ListRepositoriesByProjectIDParams) ([]Repository, error)

func (*Queries) ListRuleTypesByProject added in v0.0.39

func (q *Queries) ListRuleTypesByProject(ctx context.Context, projectID uuid.UUID) ([]RuleType, error)

func (*Queries) ListTokensToMigrate added in v0.0.52

func (q *Queries) ListTokensToMigrate(ctx context.Context, arg ListTokensToMigrateParams) ([]ProviderAccessToken, error)

When doing a key/algorithm rotation, identify the secrets which need to be rotated. The criteria for rotation are:

  1. The encrypted_access_token is NULL (this should be removed when we make this column non-nullable).
  2. The access token does not use the configured default algorithm.
  3. The access token does not use the default key version.

This query accepts the default key version/algorithm as arguments since that information is not known to the database.

func (*Queries) ListUsers

func (q *Queries) ListUsers(ctx context.Context, arg ListUsersParams) ([]User, error)

func (*Queries) LockIfThresholdNotExceeded added in v0.0.17

func (q *Queries) LockIfThresholdNotExceeded(ctx context.Context, arg LockIfThresholdNotExceededParams) (EntityExecutionLock, error)

LockIfThresholdNotExceeded is used to lock an entity for execution. It will attempt to insert or update the entity_execution_lock table only if the last_lock_time is older than the threshold. If the lock is successful, it will return the lock record. If the lock is unsuccessful, it will return NULL.

func (*Queries) OrphanProject added in v0.0.35

func (q *Queries) OrphanProject(ctx context.Context, arg OrphanProjectParams) (Project, error)

OrphanProject is a query that sets the parent_id of a project to NULL.

func (*Queries) ReleaseLock added in v0.0.17

func (q *Queries) ReleaseLock(ctx context.Context, arg ReleaseLockParams) error

ReleaseLock is used to release a lock on an entity. It will delete the entity_execution_lock record if the lock is held by the given locked_by value.

func (*Queries) RepositoryExistsAfterID added in v0.0.52

func (q *Queries) RepositoryExistsAfterID(ctx context.Context, id uuid.UUID) (bool, error)

func (*Queries) SetCurrentVersion added in v0.0.37

func (q *Queries) SetCurrentVersion(ctx context.Context, arg SetCurrentVersionParams) error

func (*Queries) UpdateEncryptedSecret added in v0.0.52

func (q *Queries) UpdateEncryptedSecret(ctx context.Context, arg UpdateEncryptedSecretParams) error

func (*Queries) UpdateInvitationRole added in v0.0.54

func (q *Queries) UpdateInvitationRole(ctx context.Context, arg UpdateInvitationRoleParams) (UserInvite, error)

UpdateInvitationRole updates an invitation by its code. This is intended to be called by a user who has issued an invitation and then decided to change the role of the invitee.

func (*Queries) UpdateLease added in v0.0.17

func (q *Queries) UpdateLease(ctx context.Context, arg UpdateLeaseParams) error

func (*Queries) UpdateOrganization

func (q *Queries) UpdateOrganization(ctx context.Context, arg UpdateOrganizationParams) (Project, error)

func (*Queries) UpdateProfile added in v0.0.16

func (q *Queries) UpdateProfile(ctx context.Context, arg UpdateProfileParams) (Profile, error)

func (*Queries) UpdateProjectMeta added in v0.0.35

func (q *Queries) UpdateProjectMeta(ctx context.Context, arg UpdateProjectMetaParams) (Project, error)

func (*Queries) UpdateProvider added in v0.0.35

func (q *Queries) UpdateProvider(ctx context.Context, arg UpdateProviderParams) error

func (*Queries) UpdateReminderLastSentById added in v0.0.52

func (q *Queries) UpdateReminderLastSentById(ctx context.Context, id uuid.UUID) error

func (*Queries) UpdateRuleType

func (q *Queries) UpdateRuleType(ctx context.Context, arg UpdateRuleTypeParams) (RuleType, error)

func (*Queries) UpdateSelector added in v0.0.54

func (q *Queries) UpdateSelector(ctx context.Context, arg UpdateSelectorParams) (ProfileSelector, error)

func (*Queries) UpsertAccessToken added in v0.0.33

func (q *Queries) UpsertAccessToken(ctx context.Context, arg UpsertAccessTokenParams) (ProviderAccessToken, error)

func (*Queries) UpsertArtifact

func (q *Queries) UpsertArtifact(ctx context.Context, arg UpsertArtifactParams) (Artifact, error)

func (*Queries) UpsertBundle added in v0.0.37

func (q *Queries) UpsertBundle(ctx context.Context, arg UpsertBundleParams) error

Copyright 2024 Stacklok, Inc

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Bundles --

func (*Queries) UpsertInstallationID added in v0.0.38

func (*Queries) UpsertLatestEvaluationStatus added in v0.0.53

func (q *Queries) UpsertLatestEvaluationStatus(ctx context.Context, arg UpsertLatestEvaluationStatusParams) error

func (*Queries) UpsertProfileForEntity added in v0.0.16

func (q *Queries) UpsertProfileForEntity(ctx context.Context, arg UpsertProfileForEntityParams) (EntityProfile, error)

func (*Queries) UpsertPullRequest

func (q *Queries) UpsertPullRequest(ctx context.Context, arg UpsertPullRequestParams) (PullRequest, error)

func (*Queries) UpsertRuleDetailsAlert

func (q *Queries) UpsertRuleDetailsAlert(ctx context.Context, arg UpsertRuleDetailsAlertParams) (uuid.UUID, error)

func (*Queries) UpsertRuleDetailsEval

func (q *Queries) UpsertRuleDetailsEval(ctx context.Context, arg UpsertRuleDetailsEvalParams) (uuid.UUID, error)

func (*Queries) UpsertRuleDetailsRemediate

func (q *Queries) UpsertRuleDetailsRemediate(ctx context.Context, arg UpsertRuleDetailsRemediateParams) (uuid.UUID, error)

func (*Queries) UpsertRuleEvaluations

func (q *Queries) UpsertRuleEvaluations(ctx context.Context, arg UpsertRuleEvaluationsParams) (uuid.UUID, error)

func (*Queries) UpsertRuleInstance added in v0.0.52

func (q *Queries) UpsertRuleInstance(ctx context.Context, arg UpsertRuleInstanceParams) (uuid.UUID, error)

Copyright 2024 Stacklok, Inc

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

func (*Queries) UpsertRuleInstantiation

func (q *Queries) UpsertRuleInstantiation(ctx context.Context, arg UpsertRuleInstantiationParams) (EntityProfileRule, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type ReleaseLockParams added in v0.0.17

type ReleaseLockParams struct {
	Entity        Entities      `json:"entity"`
	RepositoryID  uuid.NullUUID `json:"repository_id"`
	ArtifactID    uuid.NullUUID `json:"artifact_id"`
	PullRequestID uuid.NullUUID `json:"pull_request_id"`
	LockedBy      uuid.UUID     `json:"locked_by"`
}

type RemediationEvent added in v0.0.52

type RemediationEvent struct {
	ID           uuid.UUID              `json:"id"`
	EvaluationID uuid.UUID              `json:"evaluation_id"`
	Status       RemediationStatusTypes `json:"status"`
	Details      string                 `json:"details"`
	Metadata     json.RawMessage        `json:"metadata"`
	CreatedAt    time.Time              `json:"created_at"`
}

type RemediationStatusTypes

type RemediationStatusTypes string
const (
	RemediationStatusTypesSuccess      RemediationStatusTypes = "success"
	RemediationStatusTypesFailure      RemediationStatusTypes = "failure"
	RemediationStatusTypesError        RemediationStatusTypes = "error"
	RemediationStatusTypesSkipped      RemediationStatusTypes = "skipped"
	RemediationStatusTypesNotAvailable RemediationStatusTypes = "not_available"
	RemediationStatusTypesPending      RemediationStatusTypes = "pending"
)

func (*RemediationStatusTypes) Scan

func (e *RemediationStatusTypes) Scan(src interface{}) error

type Repository

type Repository struct {
	ID               uuid.UUID      `json:"id"`
	Provider         string         `json:"provider"`
	ProjectID        uuid.UUID      `json:"project_id"`
	RepoOwner        string         `json:"repo_owner"`
	RepoName         string         `json:"repo_name"`
	RepoID           int64          `json:"repo_id"`
	IsPrivate        bool           `json:"is_private"`
	IsFork           bool           `json:"is_fork"`
	WebhookID        sql.NullInt64  `json:"webhook_id"`
	WebhookUrl       string         `json:"webhook_url"`
	DeployUrl        string         `json:"deploy_url"`
	CloneUrl         string         `json:"clone_url"`
	CreatedAt        time.Time      `json:"created_at"`
	UpdatedAt        time.Time      `json:"updated_at"`
	DefaultBranch    sql.NullString `json:"default_branch"`
	License          sql.NullString `json:"license"`
	ProviderID       uuid.UUID      `json:"provider_id"`
	ReminderLastSent sql.NullTime   `json:"reminder_last_sent"`
}

type RuleDetailsAlert

type RuleDetailsAlert struct {
	ID          uuid.UUID        `json:"id"`
	RuleEvalID  uuid.UUID        `json:"rule_eval_id"`
	Status      AlertStatusTypes `json:"status"`
	Details     string           `json:"details"`
	Metadata    json.RawMessage  `json:"metadata"`
	LastUpdated time.Time        `json:"last_updated"`
}

type RuleDetailsEval

type RuleDetailsEval struct {
	ID          uuid.UUID       `json:"id"`
	RuleEvalID  uuid.UUID       `json:"rule_eval_id"`
	Status      EvalStatusTypes `json:"status"`
	Details     string          `json:"details"`
	LastUpdated time.Time       `json:"last_updated"`
}

type RuleDetailsRemediate

type RuleDetailsRemediate struct {
	ID          uuid.UUID              `json:"id"`
	RuleEvalID  uuid.UUID              `json:"rule_eval_id"`
	Status      RemediationStatusTypes `json:"status"`
	Details     string                 `json:"details"`
	LastUpdated time.Time              `json:"last_updated"`
	Metadata    json.RawMessage        `json:"metadata"`
}

type RuleEvaluation

type RuleEvaluation struct {
	ID            uuid.UUID     `json:"id"`
	Entity        Entities      `json:"entity"`
	ProfileID     uuid.UUID     `json:"profile_id"`
	RuleTypeID    uuid.UUID     `json:"rule_type_id"`
	RepositoryID  uuid.NullUUID `json:"repository_id"`
	ArtifactID    uuid.NullUUID `json:"artifact_id"`
	PullRequestID uuid.NullUUID `json:"pull_request_id"`
	RuleName      string        `json:"rule_name"`
}

type RuleInstance added in v0.0.52

type RuleInstance struct {
	ID         uuid.UUID       `json:"id"`
	ProfileID  uuid.UUID       `json:"profile_id"`
	RuleTypeID uuid.UUID       `json:"rule_type_id"`
	Name       string          `json:"name"`
	EntityType Entities        `json:"entity_type"`
	Def        json.RawMessage `json:"def"`
	Params     json.RawMessage `json:"params"`
	CreatedAt  time.Time       `json:"created_at"`
	UpdatedAt  time.Time       `json:"updated_at"`
	ProjectID  uuid.UUID       `json:"project_id"`
}

type RuleType

type RuleType struct {
	ID             uuid.UUID       `json:"id"`
	Name           string          `json:"name"`
	Provider       sql.NullString  `json:"provider"`
	ProjectID      uuid.UUID       `json:"project_id"`
	Description    string          `json:"description"`
	Guidance       string          `json:"guidance"`
	Definition     json.RawMessage `json:"definition"`
	CreatedAt      time.Time       `json:"created_at"`
	UpdatedAt      time.Time       `json:"updated_at"`
	SeverityValue  Severity        `json:"severity_value"`
	ProviderID     uuid.NullUUID   `json:"provider_id"`
	SubscriptionID uuid.NullUUID   `json:"subscription_id"`
	DisplayName    string          `json:"display_name"`
}

type SQLStore

type SQLStore struct {
	*Queries
	// contains filtered or unexported fields
}

SQLStore provides all functions to execute SQL queries and transactions

func (*SQLStore) BeginTransaction

func (s *SQLStore) BeginTransaction() (*sql.Tx, error)

BeginTransaction begins a new transaction

func (*SQLStore) CheckHealth

func (s *SQLStore) CheckHealth() error

CheckHealth checks the health of the database

func (*SQLStore) Commit

func (*SQLStore) Commit(tx *sql.Tx) error

Commit commits a transaction

func (*SQLStore) GetQuerierWithTransaction

func (*SQLStore) GetQuerierWithTransaction(tx *sql.Tx) ExtendQuerier

GetQuerierWithTransaction returns a new Querier with the provided transaction

func (*SQLStore) Rollback

func (*SQLStore) Rollback(tx *sql.Tx) error

Rollback rolls back a transaction

type SessionStore

type SessionStore struct {
	ID                int32                 `json:"id"`
	Provider          string                `json:"provider"`
	ProjectID         uuid.UUID             `json:"project_id"`
	Port              sql.NullInt32         `json:"port"`
	OwnerFilter       sql.NullString        `json:"owner_filter"`
	SessionState      string                `json:"session_state"`
	CreatedAt         time.Time             `json:"created_at"`
	RedirectUrl       sql.NullString        `json:"redirect_url"`
	RemoteUser        sql.NullString        `json:"remote_user"`
	EncryptedRedirect pqtype.NullRawMessage `json:"encrypted_redirect"`
	ProviderConfig    []byte                `json:"provider_config"`
}

type SetCurrentVersionParams added in v0.0.37

type SetCurrentVersionParams struct {
	CurrentVersion string    `json:"current_version"`
	ProjectID      uuid.UUID `json:"project_id"`
}

type Severity added in v0.0.32

type Severity string
const (
	SeverityUnknown  Severity = "unknown"
	SeverityInfo     Severity = "info"
	SeverityLow      Severity = "low"
	SeverityMedium   Severity = "medium"
	SeverityHigh     Severity = "high"
	SeverityCritical Severity = "critical"
)

func (*Severity) Scan added in v0.0.32

func (e *Severity) Scan(src interface{}) error

type Store

type Store interface {
	ExtendQuerier
	CheckHealth() error
	BeginTransaction() (*sql.Tx, error)
	GetQuerierWithTransaction(tx *sql.Tx) ExtendQuerier
	Commit(tx *sql.Tx) error
	Rollback(tx *sql.Tx) error
}

Store provides all functions to execute db queries and transactions

func NewStore

func NewStore(db *sql.DB) Store

NewStore creates a new store

type Subscription added in v0.0.36

type Subscription struct {
	ID             uuid.UUID `json:"id"`
	ProjectID      uuid.UUID `json:"project_id"`
	BundleID       uuid.UUID `json:"bundle_id"`
	CurrentVersion string    `json:"current_version"`
}

type UpdateEncryptedSecretParams added in v0.0.52

type UpdateEncryptedSecretParams struct {
	ID     int32           `json:"id"`
	Secret json.RawMessage `json:"secret"`
}

type UpdateInvitationRoleParams added in v0.0.54

type UpdateInvitationRoleParams struct {
	Code string `json:"code"`
	Role string `json:"role"`
}

type UpdateLeaseParams added in v0.0.17

type UpdateLeaseParams struct {
	Entity        Entities      `json:"entity"`
	RepositoryID  uuid.NullUUID `json:"repository_id"`
	ArtifactID    uuid.NullUUID `json:"artifact_id"`
	PullRequestID uuid.NullUUID `json:"pull_request_id"`
	LockedBy      uuid.UUID     `json:"locked_by"`
}

type UpdateOrganizationParams

type UpdateOrganizationParams struct {
	ID       uuid.UUID       `json:"id"`
	Name     string          `json:"name"`
	Metadata json.RawMessage `json:"metadata"`
}

type UpdateProfileParams added in v0.0.16

type UpdateProfileParams struct {
	ID          uuid.UUID      `json:"id"`
	ProjectID   uuid.UUID      `json:"project_id"`
	Remediate   NullActionType `json:"remediate"`
	Alert       NullActionType `json:"alert"`
	DisplayName string         `json:"display_name"`
	Labels      []string       `json:"labels"`
}

type UpdateProjectMetaParams added in v0.0.35

type UpdateProjectMetaParams struct {
	ID       uuid.UUID       `json:"id"`
	Metadata json.RawMessage `json:"metadata"`
}

type UpdateProviderParams added in v0.0.35

type UpdateProviderParams struct {
	Implements []ProviderType      `json:"implements"`
	Definition json.RawMessage     `json:"definition"`
	AuthFlows  []AuthorizationFlow `json:"auth_flows"`
	ID         uuid.UUID           `json:"id"`
	ProjectID  uuid.UUID           `json:"project_id"`
}

type UpdateRuleTypeParams

type UpdateRuleTypeParams struct {
	ID            uuid.UUID       `json:"id"`
	Description   string          `json:"description"`
	Definition    json.RawMessage `json:"definition"`
	SeverityValue Severity        `json:"severity_value"`
	DisplayName   string          `json:"display_name"`
}

type UpdateSelectorParams added in v0.0.54

type UpdateSelectorParams struct {
	ID       uuid.UUID    `json:"id"`
	Entity   NullEntities `json:"entity"`
	Selector string       `json:"selector"`
	Comment  string       `json:"comment"`
}

type UpsertAccessTokenParams added in v0.0.33

type UpsertAccessTokenParams struct {
	ProjectID            uuid.UUID             `json:"project_id"`
	Provider             string                `json:"provider"`
	ExpirationTime       time.Time             `json:"expiration_time"`
	OwnerFilter          sql.NullString        `json:"owner_filter"`
	EnrollmentNonce      sql.NullString        `json:"enrollment_nonce"`
	EncryptedAccessToken pqtype.NullRawMessage `json:"encrypted_access_token"`
}

type UpsertArtifactParams

type UpsertArtifactParams struct {
	RepositoryID       uuid.NullUUID `json:"repository_id"`
	ArtifactName       string        `json:"artifact_name"`
	ArtifactType       string        `json:"artifact_type"`
	ArtifactVisibility string        `json:"artifact_visibility"`
	ProjectID          uuid.UUID     `json:"project_id"`
	ProviderID         uuid.UUID     `json:"provider_id"`
	ProviderName       string        `json:"provider_name"`
}

type UpsertBundleParams added in v0.0.37

type UpsertBundleParams struct {
	Namespace string `json:"namespace"`
	Name      string `json:"name"`
}

type UpsertInstallationIDParams added in v0.0.38

type UpsertInstallationIDParams struct {
	OrganizationID    int64          `json:"organization_id"`
	AppInstallationID int64          `json:"app_installation_id"`
	ProviderID        uuid.NullUUID  `json:"provider_id"`
	EnrollingUserID   sql.NullString `json:"enrolling_user_id"`
	EnrollmentNonce   sql.NullString `json:"enrollment_nonce"`
	ProjectID         uuid.NullUUID  `json:"project_id"`
	IsOrg             bool           `json:"is_org"`
}

type UpsertLatestEvaluationStatusParams added in v0.0.53

type UpsertLatestEvaluationStatusParams struct {
	RuleEntityID        uuid.UUID `json:"rule_entity_id"`
	EvaluationHistoryID uuid.UUID `json:"evaluation_history_id"`
}

type UpsertProfileForEntityParams added in v0.0.16

type UpsertProfileForEntityParams struct {
	Entity          Entities        `json:"entity"`
	ProfileID       uuid.UUID       `json:"profile_id"`
	ContextualRules json.RawMessage `json:"contextual_rules"`
}

type UpsertPullRequestParams

type UpsertPullRequestParams struct {
	RepositoryID uuid.UUID `json:"repository_id"`
	PrNumber     int64     `json:"pr_number"`
}

type UpsertRuleDetailsAlertParams

type UpsertRuleDetailsAlertParams struct {
	RuleEvalID uuid.UUID        `json:"rule_eval_id"`
	Status     AlertStatusTypes `json:"status"`
	Details    string           `json:"details"`
	Metadata   json.RawMessage  `json:"metadata"`
}

type UpsertRuleDetailsEvalParams

type UpsertRuleDetailsEvalParams struct {
	RuleEvalID uuid.UUID       `json:"rule_eval_id"`
	Status     EvalStatusTypes `json:"status"`
	Details    string          `json:"details"`
}

type UpsertRuleDetailsRemediateParams

type UpsertRuleDetailsRemediateParams struct {
	RuleEvalID uuid.UUID              `json:"rule_eval_id"`
	Status     RemediationStatusTypes `json:"status"`
	Details    string                 `json:"details"`
	Metadata   json.RawMessage        `json:"metadata"`
}

type UpsertRuleEvaluationsParams

type UpsertRuleEvaluationsParams struct {
	ProfileID     uuid.UUID     `json:"profile_id"`
	RepositoryID  uuid.NullUUID `json:"repository_id"`
	ArtifactID    uuid.NullUUID `json:"artifact_id"`
	PullRequestID uuid.NullUUID `json:"pull_request_id"`
	RuleTypeID    uuid.UUID     `json:"rule_type_id"`
	Entity        Entities      `json:"entity"`
	RuleName      string        `json:"rule_name"`
}

type UpsertRuleInstanceParams added in v0.0.52

type UpsertRuleInstanceParams struct {
	ProfileID  uuid.UUID       `json:"profile_id"`
	RuleTypeID uuid.UUID       `json:"rule_type_id"`
	Name       string          `json:"name"`
	EntityType Entities        `json:"entity_type"`
	Def        json.RawMessage `json:"def"`
	Params     json.RawMessage `json:"params"`
	ProjectID  uuid.UUID       `json:"project_id"`
}

type UpsertRuleInstantiationParams

type UpsertRuleInstantiationParams struct {
	EntityProfileID uuid.UUID `json:"entity_profile_id"`
	RuleTypeID      uuid.UUID `json:"rule_type_id"`
}

type User

type User struct {
	ID              int32     `json:"id"`
	IdentitySubject string    `json:"identity_subject"`
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
}

type UserInvite added in v0.0.52

type UserInvite struct {
	Code      string    `json:"code"`
	Email     string    `json:"email"`
	Role      string    `json:"role"`
	Project   uuid.UUID `json:"project"`
	Sponsor   int32     `json:"sponsor"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Directories

Path Synopsis
Package embedded provides a test-only embedded Postgres database for testing queries.
Package embedded provides a test-only embedded Postgres database for testing queries.
Package fixtures contains code for creating DB fixtures and is used in various parts of the code.
Package fixtures contains code for creating DB fixtures and is used in various parts of the code.

Jump to

Keyboard shortcuts

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