space

package
v1.0.3-gitspaces-beta Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

WireSet provides a wire set for this package.

Functions

This section is empty.

Types

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, repoCtrl *repo.Controller,
	membershipStore store.MembershipStore, importer *importer.Repository, exporter *exporter.Repository,
	limiter limiter.ResourceLimiter, publicAccess publicaccess.Service, auditService audit.Service,
	gitspaceSvc *gitspace.Service,
	gitspaceStore store.GitspaceConfigStore, gitspaceInstanceStore store.GitspaceInstanceStore,
	labelSvc *label.Service,
) *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,
	repoCtrl *repo.Controller, membershipStore store.MembershipStore, importer *importer.Repository,
	exporter *exporter.Repository, limiter limiter.ResourceLimiter, publicAccess publicaccess.Service,
	auditService audit.Service, gitspaceService *gitspace.Service,
	gitspaceConfigStore store.GitspaceConfigStore, instanceStore store.GitspaceInstanceStore,
	labelSvc *label.Service,
) *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) 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) 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) 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) 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) 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) 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) 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) Update

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

Update updates a space.

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"`
}

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