space

package
v0.0.0-...-94d0466 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2025 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Overview

Copyright (c) 2023-2024 北京渠成软件有限公司(Beijing Qucheng Software Co., Ltd. www.qucheng.com) All rights reserved. Use of this source code is covered by the following dual licenses: (1) Z PUBLIC LICENSE 1.2 (ZPL 1.2) (2) Affero General Public License 3.0 (AGPL 3.0) license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

WireSet provides a wire set for this package.

Functions

This section is empty.

Types

type AiConfigCreateInput

type AiConfigCreateInput struct {
	IsDefault bool          `json:"is_default,omitempty"`
	Provider  enum.Provider `json:"provider"`
	Model     string        `json:"model"`
	Endpoint  string        `json:"endpoint"`
	Token     string        `json:"token"`
}

func (*AiConfigCreateInput) Sanitize

func (in *AiConfigCreateInput) Sanitize() error

type AiConfigUpdateInput

type AiConfigUpdateInput struct {
	IsDefault bool          `json:"is_default,omitempty"`
	Provider  enum.Provider `json:"provider,omitempty"`
	Model     string        `json:"model,omitempty"`
	Endpoint  string        `json:"endpoint,omitempty"`
	Token     string        `json:"token,omitempty"`
}

type Controller

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

func NewController

func NewController(config *types.Config, tx dbtx.Transactor, urlProvider url.Provider,
	sseStreamer sse.Streamer, identifierCheck check.SpaceIdentifier, authorizer authz.Authorizer,
	spacePathStore store.SpacePathStore, pipelineStore store.PipelineStore, secretStore store.SecretStore,
	connectorStore store.ConnectorStore, templateStore store.TemplateStore, spaceStore store.SpaceStore,
	repoStore store.RepoStore, principalStore store.PrincipalStore, artStore store.ArtifactStore, repoCtrl *repo.Controller,
	membershipStore store.MembershipStore, prListService *pullreq.ListService,
	importer *importer.Repository, exporter *exporter.Repository,
	limiter limiter.ResourceLimiter, publicAccess publicaccess.Service, auditService audit.Service,
	gitspaceSvc *gitspace.Service, labelSvc *label.Service,
	instrumentation instrument.Service, aiStore store.AIStore, executionStore store.ExecutionStore,
) *Controller

func ProvideController

func ProvideController(config *types.Config, tx dbtx.Transactor, urlProvider url.Provider, sseStreamer sse.Streamer,
	identifierCheck check.SpaceIdentifier, authorizer authz.Authorizer, spacePathStore store.SpacePathStore,
	pipelineStore store.PipelineStore, secretStore store.SecretStore,
	connectorStore store.ConnectorStore, templateStore store.TemplateStore,
	spaceStore store.SpaceStore, repoStore store.RepoStore, principalStore store.PrincipalStore, artStore store.ArtifactStore,
	repoCtrl *repo.Controller, membershipStore store.MembershipStore, prListService *pullreq.ListService,
	importer *importer.Repository, exporter *exporter.Repository, limiter limiter.ResourceLimiter,
	publicAccess publicaccess.Service, auditService audit.Service, gitspaceService *gitspace.Service,
	labelSvc *label.Service, instrumentation instrument.Service, aiStore store.AIStore, executionStore store.ExecutionStore,
) *Controller

func (*Controller) Create

func (c *Controller) Create(
	ctx context.Context,
	session *auth.Session,
	in *CreateInput,
) (*SpaceOutput, error)

Create creates a new space.

func (*Controller) CreateAIConfig

func (c *Controller) CreateAIConfig(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	in *AiConfigCreateInput,
) (*types.AIConfig, error)

CreateAIConfig creates a new ai config in a space.

func (*Controller) DefineLabel

func (c *Controller) DefineLabel(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	in *types.DefineLabelInput,
) (*types.Label, error)

DefineLabel defines a new label for the specified space.

func (*Controller) DefineLabelValue

func (c *Controller) DefineLabelValue(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	key string,
	in *types.DefineValueInput,
) (*types.LabelValue, error)

DefineLabelValue defines a new label value for the specified space and label.

func (*Controller) DeleteAIConfig

func (c *Controller) DeleteAIConfig(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	id int64,
) error

func (*Controller) DeleteLabel

func (c *Controller) DeleteLabel(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	key string,
) error

DeleteLabel deletes a label for the specified space.

func (*Controller) DeleteLabelValue

func (c *Controller) DeleteLabelValue(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	key string,
	value string,
) error

DeleteLabelValue deletes a label value for the specified space.

func (*Controller) Events

func (c *Controller) Events(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
) (<-chan *sse.Event, <-chan error, func(context.Context) error, error)

func (*Controller) Export

func (c *Controller) Export(ctx context.Context, session *auth.Session, spaceRef string, in *ExportInput) error

Export creates a new empty repository in harness code and does git push to it.

func (*Controller) ExportProgress

func (c *Controller) ExportProgress(ctx context.Context,
	session *auth.Session,
	spaceRef string,
) (ExportProgressOutput, error)

ExportProgress returns progress of the export job.

func (*Controller) Find

func (c *Controller) Find(ctx context.Context, session *auth.Session, spaceRef string) (*SpaceOutput, error)

* Find finds a space.

func (*Controller) Import

func (c *Controller) Import(ctx context.Context, session *auth.Session, in *ImportInput) (*SpaceOutput, error)

Import creates new space and starts import of all repositories from the remote provider's space into it.

func (*Controller) ImportRepositories

func (c *Controller) ImportRepositories(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	in *ImportRepositoriesInput,
) (ImportRepositoriesOutput, error)

ImportRepositories imports repositories into an existing space. It ignores and continues on repo naming conflicts.

func (*Controller) ListAIConfigs

func (c *Controller) ListAIConfigs(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
) ([]types.AIConfig, int64, error)

ListAIConfigs lists the ai configs in a space.

func (*Controller) ListAllSpaces

func (c *Controller) ListAllSpaces(
	ctx context.Context,
	session *auth.Session,
	filter *types.SpaceFilter,
) ([]*SpaceOutput, int64, error)

func (*Controller) ListArtifacts

func (c *Controller) ListArtifacts(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	filter *types.ArtifactFilter,
) ([]*types.ArtifactListItem, int64, error)

func (*Controller) ListConnectors

func (c *Controller) ListConnectors(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	filter types.ListQueryFilter,
) ([]*types.Connector, int64, error)

ListConnectors lists the connectors in a space.

func (*Controller) ListExecutions

func (c *Controller) ListExecutions(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	filter types.ListExecutionsFilter,
) ([]*types.Execution, int64, error)

ListExecutions lists the executions in a space.

func (*Controller) ListGitspaces

func (c *Controller) ListGitspaces(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	filter types.ListQueryFilter,
) ([]*types.GitspaceConfig, int64, error)

func (*Controller) ListLabelValues

func (c *Controller) ListLabelValues(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	key string,
	filter *types.ListQueryFilter,
) ([]*types.LabelValue, error)

ListLabelValues lists all label values defined in the specified space.

func (*Controller) ListLabels

func (c *Controller) ListLabels(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	filter *types.LabelFilter,
) ([]*types.Label, int64, error)

ListLabels lists all labels defined for the specified space.

func (*Controller) ListPipelines

func (c *Controller) ListPipelines(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	filter types.ListPipelinesFilter,
) ([]*types.Pipeline, int64, error)

ListPipelines lists the pipelines in a space.

func (*Controller) ListPullReqs

func (c *Controller) ListPullReqs(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	includeSubspaces bool,
	filter *types.PullReqFilter,
) ([]types.PullReqRepo, error)

ListPullReqs returns a list of pull requests from the provided space.

func (*Controller) ListRepositories

func (c *Controller) ListRepositories(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	filter *types.RepoFilter,
) ([]*repoCtrl.RepositoryOutput, int64, error)

ListRepositories lists the repositories of a space.

func (*Controller) ListRepositoriesNoAuth

func (c *Controller) ListRepositoriesNoAuth(
	ctx context.Context,
	spaceID int64,
	filter *types.RepoFilter,
) ([]*repoCtrl.RepositoryOutput, int64, error)

ListRepositoriesNoAuth list repositories WITHOUT checking for PermissionRepoView.

func (*Controller) ListSecrets

func (c *Controller) ListSecrets(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	filter types.ListQueryFilter,
) ([]*types.Secret, int64, error)

ListSecrets lists the secrets in a space.

func (*Controller) ListServiceAccounts

func (c *Controller) ListServiceAccounts(ctx context.Context, session *auth.Session,
	spaceRef string) ([]*types.ServiceAccount, error)

* ListServiceAccounts lists the service accounts of a space.

func (*Controller) ListSpaces

func (c *Controller) ListSpaces(ctx context.Context,
	session *auth.Session,
	spaceRef string,
	filter *types.SpaceFilter,
) ([]*SpaceOutput, int64, error)

ListSpaces lists the child spaces of a space.

func (*Controller) ListSpacesByMembership

func (c *Controller) ListSpacesByMembership(ctx context.Context, userID int64, filter *types.SpaceFilter,
) ([]*SpaceOutput, int64, error)

func (*Controller) ListSpacesNoAuth

func (c *Controller) ListSpacesNoAuth(
	ctx context.Context,
	spaceID int64,
	filter *types.SpaceFilter,
) ([]*SpaceOutput, int64, error)

ListSpacesNoAuth lists spaces WITHOUT checking PermissionSpaceView.

func (*Controller) ListTemplates

func (c *Controller) ListTemplates(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	filter types.ListQueryFilter,
) ([]*types.Template, int64, error)

ListTemplates lists the templates in a space.

func (*Controller) MembershipAdd

func (c *Controller) MembershipAdd(ctx context.Context,
	session *auth.Session,
	spaceRef string,
	in *MembershipAddInput,
) (*types.MembershipUser, error)

MembershipAdd adds a new membership to a space.

func (*Controller) MembershipDelete

func (c *Controller) MembershipDelete(ctx context.Context,
	session *auth.Session,
	spaceRef string,
	userUID string,
) error

MembershipDelete removes an existing membership from a space.

func (*Controller) MembershipList

func (c *Controller) MembershipList(ctx context.Context,
	session *auth.Session,
	spaceRef string,
	filter types.MembershipUserFilter,
) ([]types.MembershipUser, int64, error)

MembershipList lists all space memberships.

func (*Controller) MembershipUpdate

func (c *Controller) MembershipUpdate(ctx context.Context,
	session *auth.Session,
	spaceRef string,
	userUID string,
	in *MembershipUpdateInput,
) (*types.MembershipUser, error)

MembershipUpdate changes the role of an existing membership.

func (*Controller) Move

func (c *Controller) Move(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	in *MoveInput,
) (*SpaceOutput, error)

Move moves a space to a new identifier. TODO: Add support for moving to other parents and alias.

func (*Controller) Purge

func (c *Controller) Purge(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	deletedAt int64,
) error

Purge deletes the space and all its subspaces and repositories permanently.

func (*Controller) PurgeNoAuth

func (c *Controller) PurgeNoAuth(
	ctx context.Context,
	session *auth.Session,
	space *types.Space,
) error

PurgeNoAuth purges the space - no authorization is verified. WARNING For internal calls only.

func (*Controller) Restore

func (c *Controller) Restore(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	deletedAt int64,
	in *RestoreInput,
) (*SpaceOutput, error)

func (*Controller) SaveLabel

func (c *Controller) SaveLabel(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	in *types.SaveInput,
) (*types.LabelWithValues, error)

SaveLabel defines a new label for the specified space.

func (*Controller) SetDefaultAIConfig

func (c *Controller) SetDefaultAIConfig(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	id int64,
) error

func (*Controller) SoftDelete

func (c *Controller) SoftDelete(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
) (*SoftDeleteResponse, error)

SoftDelete marks deleted timestamp for the space and all its subspaces and repositories inside.

func (*Controller) SoftDeleteNoAuth

func (c *Controller) SoftDeleteNoAuth(
	ctx context.Context,
	session *auth.Session,
	space *types.Space,
) (*SoftDeleteResponse, error)

SoftDeleteNoAuth soft deletes the space - no authorization is verified. WARNING For internal calls only.

func (*Controller) TestAIConfig

func (c *Controller) TestAIConfig(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	id int64,
) error

func (*Controller) Update

func (c *Controller) Update(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	in *UpdateInput,
) (*SpaceOutput, error)

Update updates a space.

func (*Controller) UpdateAIConfig

func (c *Controller) UpdateAIConfig(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	id int64,
	in *AiConfigUpdateInput,
) (*types.AIConfig, error)

func (*Controller) UpdateLabel

func (c *Controller) UpdateLabel(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	key string,
	in *types.UpdateLabelInput,
) (*types.Label, error)

UpdateLabel updates a label for the specified space.

func (*Controller) UpdateLabelValue

func (c *Controller) UpdateLabelValue(
	ctx context.Context,
	session *auth.Session,
	spaceRef string,
	key string,
	value string,
	in *types.UpdateValueInput,
) (*types.LabelValue, error)

UpdateLabelValue updates a label value for the specified space and label.

func (*Controller) UpdatePublicAccess

func (c *Controller) UpdatePublicAccess(ctx context.Context,
	session *auth.Session,
	spaceRef string,
	in *UpdatePublicAccessInput,
) (*SpaceOutput, error)

type CreateInput

type CreateInput struct {
	ParentRef string `json:"parent_ref"`
	// TODO [CODE-1363]: remove after identifier migration.
	UID         string `json:"uid" deprecated:"true"`
	Identifier  string `json:"identifier"`
	Description string `json:"description"`
	IsPublic    bool   `json:"is_public"`
}

type ExportInput

type ExportInput struct {
	AccountID         string `json:"account_id"`
	OrgIdentifier     string `json:"org_identifier"`
	ProjectIdentifier string `json:"project_identifier"`
	Token             string `json:"token"`
}

type ExportProgressOutput

type ExportProgressOutput struct {
	Repos []job.Progress `json:"repos"`
}

type ImportInput

type ImportInput struct {
	CreateInput
	ProviderInput
}

type ImportRepositoriesInput

type ImportRepositoriesInput struct {
	ProviderInput
}

type ImportRepositoriesOutput

type ImportRepositoriesOutput struct {
	ImportingRepos []*repoctrl.RepositoryOutput `json:"importing_repos"`
	DuplicateRepos []*repoctrl.RepositoryOutput `json:"duplicate_repos"` // repos which already exist in the space.
}

type MembershipAddInput

type MembershipAddInput struct {
	UserUID string              `json:"user_uid"`
	Role    enum.MembershipRole `json:"role"`
}

func (*MembershipAddInput) Validate

func (in *MembershipAddInput) Validate() error

type MembershipUpdateInput

type MembershipUpdateInput struct {
	Role enum.MembershipRole `json:"role"`
}

func (*MembershipUpdateInput) Validate

func (in *MembershipUpdateInput) Validate() error

type MoveInput

type MoveInput struct {
	// TODO [CODE-1363]: remove after identifier migration.
	UID        *string `json:"uid" deprecated:"true"`
	Identifier *string `json:"identifier"`
}

MoveInput is used for moving a space.

type ProviderInput

type ProviderInput struct {
	Provider      importer.Provider       `json:"provider"`
	ProviderSpace string                  `json:"provider_space"`
	Pipelines     importer.PipelineOption `json:"pipelines"`
	Mirror        bool                    `json:"mirror,omitempty"`
}

type RestoreInput

type RestoreInput struct {
	NewIdentifier *string `json:"new_identifier,omitempty"`
	NewParentRef  *string `json:"new_parent_ref,omitempty"` // Reference of the new parent space
}

type SoftDeleteResponse

type SoftDeleteResponse struct {
	DeletedAt int64 `json:"deleted_at"`
}

type SpaceOutput

type SpaceOutput struct {
	types.Space
	IsPublic bool `json:"is_public" yaml:"is_public"`
}

func GetSpaceOutput

func GetSpaceOutput(
	ctx context.Context,
	publicAccess publicaccess.Service,
	space *types.Space,
) (*SpaceOutput, error)

func (SpaceOutput) MarshalJSON

func (s SpaceOutput) MarshalJSON() ([]byte, error)

TODO [CODE-1363]: remove after identifier migration.

type UpdateInput

type UpdateInput struct {
	Description *string `json:"description"`
}

UpdateInput is used for updating a space.

type UpdatePublicAccessInput

type UpdatePublicAccessInput struct {
	IsPublic bool `json:"is_public"`
}

Jump to

Keyboard shortcuts

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