types

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidMemberRole

func IsValidMemberRole(r MemberRole) bool

func IsValidRemoteRepositoryConfigType

func IsValidRemoteRepositoryConfigType(t RemoteRepositoryConfigType) bool

func IsValidVisibility

func IsValidVisibility(v Visibility) bool

func SourceSupportsAuthType

func SourceSupportsAuthType(rsType RemoteSourceType, authType RemoteSourceAuthType) bool

Types

type LinkedAccount

type LinkedAccount struct {
	sqlg.ObjectMeta

	UserID string `json:"user_id,omitempty"`

	RemoteUserID        string `json:"remote_user_id,omitempty"`
	RemoteUserName      string `json:"remote_username,omitempty"`
	RemoteUserAvatarURL string `json:"remote_user_avatar_url,omitempty"`

	RemoteSourceID string `json:"remote_source_id,omitempty"`

	UserAccessToken string `json:"user_access_token,omitempty"`

	Oauth2AccessToken          string    `json:"oauth2_access_token,omitempty"`
	Oauth2RefreshToken         string    `json:"oauth2_refresh_token,omitempty"`
	Oauth2AccessTokenExpiresAt time.Time `json:"oauth_2_access_token_expires_at,omitempty"`
}

func NewLinkedAccount added in v0.8.0

func NewLinkedAccount(tx *sql.Tx) *LinkedAccount

type MemberRole

type MemberRole string
const (
	MemberRoleOwner  MemberRole = "owner"
	MemberRoleMember MemberRole = "member"
)

type ObjectKind added in v0.8.0

type ObjectKind string
const (
	ObjectKindUser          ObjectKind = "user"
	ObjectKindOrg           ObjectKind = "org"
	ObjectKindOrgMember     ObjectKind = "orgmember"
	ObjectKindProjectGroup  ObjectKind = "projectgroup"
	ObjectKindProject       ObjectKind = "project"
	ObjectKindRemoteSource  ObjectKind = "remotesource"
	ObjectKindSecret        ObjectKind = "secret"
	ObjectKindVariable      ObjectKind = "variable"
	ObjectKindOrgInvitation ObjectKind = "orginvitation"
)

type OrgInvitation added in v0.8.0

type OrgInvitation struct {
	sqlg.ObjectMeta

	UserID         string     `json:"user_id,omitempty"`
	OrganizationID string     `json:"organization_id,omitempty"`
	Role           MemberRole `json:"role,omitempty"`
}

func NewOrgInvitation added in v0.8.0

func NewOrgInvitation(tx *sql.Tx) *OrgInvitation

type Organization

type Organization struct {
	sqlg.ObjectMeta

	Name string `json:"name,omitempty"`

	Visibility Visibility `json:"visibility,omitempty"`

	// CreatorUserID is the user id that created the organization. It could be empty
	// if the org was created by using the admin user or the user has been removed.
	CreatorUserID string `json:"creator_user_id,omitempty"`
}

func NewOrganization added in v0.8.0

func NewOrganization(tx *sql.Tx) *Organization

type OrganizationMember

type OrganizationMember struct {
	sqlg.ObjectMeta

	OrganizationID string `json:"organization_id,omitempty"`
	UserID         string `json:"user_id,omitempty"`

	MemberRole MemberRole `json:"member_role,omitempty"`
}

func NewOrganizationMember added in v0.8.0

func NewOrganizationMember(tx *sql.Tx) *OrganizationMember

type Parent

type Parent struct {
	Kind ObjectKind `json:"type,omitempty"`
	ID   string     `json:"id,omitempty"`
}

type Project

type Project struct {
	sqlg.ObjectMeta

	Name string `json:"name,omitempty"`

	Parent Parent `json:"parent,omitempty"`

	// Secret is a secret that could be used for signing or other purposes. It
	// should never be directly exposed to external services
	Secret string `json:"secret,omitempty"`

	Visibility Visibility `json:"visibility,omitempty"`

	// Remote Repository fields
	RemoteRepositoryConfigType RemoteRepositoryConfigType `json:"remote_repository_config_type,omitempty"`

	RemoteSourceID  string `json:"remote_source_id,omitempty"`
	LinkedAccountID string `json:"linked_account_id,omitempty"`

	// The remote repository id
	RepositoryID string `json:"repository_id,omitempty"`

	// The remote repository path. It may be different for every kind of git source.
	// NOTE: it may be changed remotely but won't be updated here. Every git source
	// works differently so we must find a way to update it:
	// * let the user update it manually
	// * auto update it if the remote let us query by repository id (gitea cannot
	// do this but gitlab can and github has an hidden api to do this)
	RepositoryPath string `json:"repository_path,omitempty"`

	SSHPrivateKey string `json:"ssh_private_key,omitempty"` // PEM Encoded private key

	SkipSSHHostKeyCheck bool `json:"skip_ssh_host_key_check,omitempty"`

	// Webhooksecret is the secret passed to git sources that support a
	// secret/token for signing or verifying the webhook payload
	WebhookSecret string `json:"webhook_secret,omitempty"`

	PassVarsToForkedPR bool `json:"pass_vars_to_forked_pr,omitempty"`

	DefaultBranch string `json:"default_branch,omitempty"`

	MembersCanPerformRunActions bool `json:"members_can_perform_run_actions,omitempty"`
}

func NewProject added in v0.8.0

func NewProject(tx *sql.Tx) *Project

type ProjectGroup

type ProjectGroup struct {
	sqlg.ObjectMeta

	Name string `json:"name,omitempty"`

	Parent Parent `json:"parent,omitempty"`

	Visibility Visibility `json:"visibility,omitempty"`
}

func NewProjectGroup added in v0.8.0

func NewProjectGroup(tx *sql.Tx) *ProjectGroup

type RemoteRepositoryConfigType

type RemoteRepositoryConfigType string

RemoteRepositoryConfigType defines how a remote repository is configured and managed. Currently only "remotesource" is supported. In future other config types (like a fully manual config) could be supported.

const (
	// RemoteRepositoryConfigTypeManual is currently only used for tests and not available for direct usage
	RemoteRepositoryConfigTypeManual       RemoteRepositoryConfigType = "manual"
	RemoteRepositoryConfigTypeRemoteSource RemoteRepositoryConfigType = "remotesource"
)

type RemoteSource

type RemoteSource struct {
	sqlg.ObjectMeta

	Name   string `json:"name,omitempty"`
	APIURL string `json:"apiurl,omitempty"`

	SkipVerify bool `json:"skip_verify,omitempty"`

	Type     RemoteSourceType     `json:"type,omitempty"`
	AuthType RemoteSourceAuthType `json:"auth_type,omitempty"`

	// Oauth2 data
	Oauth2ClientID     string `json:"client_id,omitempty"`
	Oauth2ClientSecret string `json:"client_secret,omitempty"`

	SSHHostKey string `json:"ssh_host_key,omitempty"` // Public ssh host key of the remote source

	SkipSSHHostKeyCheck bool `json:"skip_ssh_host_key_check,omitempty"`

	RegistrationEnabled bool `json:"registration_enabled,omitempty"`
	LoginEnabled        bool `json:"login_enabled,omitempty"`
}

func NewRemoteSource added in v0.8.0

func NewRemoteSource(tx *sql.Tx) *RemoteSource

type RemoteSourceAuthType

type RemoteSourceAuthType string
const (
	RemoteSourceAuthTypePassword RemoteSourceAuthType = "password"
	RemoteSourceAuthTypeOauth2   RemoteSourceAuthType = "oauth2"
)

func SourceSupportedAuthTypes

func SourceSupportedAuthTypes(rsType RemoteSourceType) []RemoteSourceAuthType

type RemoteSourceType

type RemoteSourceType string
const (
	RemoteSourceTypeGitea  RemoteSourceType = "gitea"
	RemoteSourceTypeGithub RemoteSourceType = "github"
	RemoteSourceTypeGitlab RemoteSourceType = "gitlab"
)

type Secret

type Secret struct {
	sqlg.ObjectMeta

	Name string `json:"name,omitempty"`

	Parent Parent `json:"parent,omitempty"`

	Type SecretType `json:"type,omitempty"`

	// internal secret
	Data map[string]string `json:"data,omitempty"`

	// external secret
	SecretProviderID string `json:"secret_provider_id,omitempty"`
	Path             string `json:"path,omitempty"`
}

func NewSecret added in v0.8.0

func NewSecret(tx *sql.Tx) *Secret

type SecretProviderType

type SecretProviderType string
const (
	// TODO(sgotti) unimplemented
	SecretProviderK8s   SecretProviderType = "k8s"
	SecretProviderVault SecretProviderType = "vault"
)

type SecretType

type SecretType string
const (
	SecretTypeInternal SecretType = "internal"
	SecretTypeExternal SecretType = "external"
)

type SortDirection added in v0.9.0

type SortDirection string
const (
	SortDirectionAsc  SortDirection = "asc"
	SortDirectionDesc SortDirection = "desc"
)

type User

type User struct {
	sqlg.ObjectMeta

	Name string `json:"name,omitempty"`

	// Secret is a secret that could be used for signing or other purposes. It
	// should never be directly exposed to external services
	Secret string `json:"secret,omitempty"`

	// Admin defines if the user is a global admin
	Admin bool `json:"admin,omitempty"`
}

func NewUser added in v0.8.0

func NewUser(tx *sql.Tx) *User

type UserToken added in v0.8.0

type UserToken struct {
	sqlg.ObjectMeta

	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`

	UserID string `json:"user_id,omitempty"`
}

func NewUserToken added in v0.8.0

func NewUserToken(tx *sql.Tx) *UserToken

type Variable

type Variable struct {
	sqlg.ObjectMeta

	Name string `json:"name,omitempty"`

	Parent Parent `json:"parent,omitempty"`

	Values []VariableValue `json:"values,omitempty"`
}

func NewVariable added in v0.8.0

func NewVariable(tx *sql.Tx) *Variable

type VariableValue

type VariableValue struct {
	SecretName string `json:"secret_name,omitempty"`
	SecretVar  string `json:"secret_var,omitempty"`

	When *stypes.When `json:"when,omitempty"`
}

type Visibility

type Visibility string
const (
	VisibilityPublic  Visibility = "public"
	VisibilityPrivate Visibility = "private"
)

Jump to

Keyboard shortcuts

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