biz

package
v0.3.6 Latest Latest
Warning

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

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

README

Biz

Documentation

Overview

Package biz is a generated GoMock package.

Index

Constants

View Source
const (
	TenantLabel               = "coderepo.resource.nautes.io/tenant-management"
	NautesClusterDir          = "nautes/overlays/production/clusters"
	DefaultClusterTemplateURL = "https://github.com/nautes-labs/cluster-templates.git"
	SecretPath                = "default"
	SecretEngine              = "pki"
)
View Source
const (
	// Argo-operator Index key, Used to obtain roles from the configuration
	ArgoOperator = "Argo"
	// Product default project name
	DefaultProject        = "default.project"
	KustomizationFileName = "kustomization.yaml"
)

Common

View Source
const (
	// Product naming prefix
	ProductPrefix = "product-"
	// CodeRepo naming prefix
	RepoPrefix = "repo-"
)

prefix...

View Source
const (
	// Secret Repo stores git related data engine name
	SecretsGitEngine = "git"
	// Secret Repo stores deploykey key
	SecretsDeployKey = "deploykey"
	// Secret Repo stores access token key
	SecretsAccessToken = "accesstoken"
	// Key data default store user
	DefaultUser = "default"
	// DeployKey fingerprint data Key
	Fingerprint = "fingerprint"
	// DeployKey fingerprint data ID
	DeployKeyID = "id"
)

Secret store Constants

View Source
const (
	// AccessToken fingerprint data ID
	AccessTokenID = "id"
	// Access token key path name
	AccessTokenName = "accesstoken-api"
	// Access token scope permissions
	APIPermission AccessTokenPermission = "api"
	// Access token authorization role
	Developer  AccessLevelValue = 30
	Maintainer AccessLevelValue = 40
	Owner      AccessLevelValue = 50
)

Access token

View Source
const (
	// layout resouce directory names
	CodeReposSubDir = "code-repos"
	RuntimesDir     = "runtimes"
	EnvSubDir       = "envs"
	ProjectsDir     = "projects"
)
View Source
const (
	ResourceInfoKey = "ResourceInfoKey"
	// How to mark this request method
	SaveMethod   = "Save"
	DeleteMethod = "Delete"
)

Constants used to store commit information

View Source
const (
	PROJECT_NOT_FOUND  = "PROJECT_NOT_FOUND"
	GROUP_NOT_FOUND    = "GROUP_NOT_FOUND"
	NODE_NOT_FOUND     = "NODE_NOT_FOUND"
	RESOURCE_NOT_FOUND = "RESOURCE_NOT_FOUND"
	RESOURCE_NOT_MATCH = "RESOURCE_NOT_MATCH"
	NO_AUTHORIZATION   = "NO_AUTHORIZATION"
	ResourceNotExist   = "RESOURCE_NOT_EXIST"
)

Variables

View Source
var (
	ErrorProjectNotFound = errors.New(404, PROJECT_NOT_FOUND, "the project path is not found")
	ErrorGroupNotFound   = errors.New(404, GROUP_NOT_FOUND, "the group path is not found")
	ErrorNodetNotFound   = errors.New(404, NODE_NOT_FOUND, "the node is not found")
	ErrorResourceNoFound = errors.New(404, RESOURCE_NOT_FOUND, "the resource is not found")
	ErrorResourceNoMatch = errors.New(500, RESOURCE_NOT_MATCH, "the resource is not match")
	ErrorNoAuth          = errors.New(403, NO_AUTHORIZATION, "no access to the code repository")
)

ProviderSet is biz providers.

Functions

func Contains added in v0.3.3

func Contains(arr []int, target int) bool

func GetClusterFromTenantRepository added in v0.3.5

func GetClusterFromTenantRepository(tenantRepositoryLocalPath, clusterName string) (*resourcev1alpha1.Cluster, error)

func GetClusterTemplateHttpsURL

func GetClusterTemplateHttpsURL(configs *nautesconfigs.Config) string

func ListDeployKeys added in v0.3.0

func ListDeployKeys(ctx context.Context, codeRepo CodeRepo, pid int, opts *ListOptions) listFunc

func ResourceDoesNotExistOrUnavailable added in v0.3.6

func ResourceDoesNotExistOrUnavailable(resourceName, resourceKind, resourcePath string, errMsgs ...string) error

func SetResourceContext added in v0.3.1

func SetResourceContext(ctx context.Context, productName, method, parentResouceKind, parentResouceName, resourceKind, resourceName string) context.Context

SetResourceContext is mount resource information to context.

func SpliceCodeRepoResourceName

func SpliceCodeRepoResourceName(id int) string

Types

type AccessLevelValue added in v0.3.0

type AccessLevelValue int

type AccessTokenPermission added in v0.3.0

type AccessTokenPermission string

type AccessTokenSecretData added in v0.3.0

type AccessTokenSecretData struct {
	// The ID of the access token secret
	ID int
}

type BizOptions

type BizOptions struct {
	ResouceName       string
	ProductName       string
	InsecureSkipCheck bool
}

type CacheStore added in v0.3.4

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

type CloneRepositoryParam

type CloneRepositoryParam struct {
	// The URL of the repository to clone
	URL string
	// The user to use for the clone operation
	User string
	// The email to use for the clone operation
	Email string
}

type ClusterData

type ClusterData struct {
	ClusterName string
	ApiServer   string
	ClusterType string
	Usage       string
	HostCluster string
}

type ClusterUsecase

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

func NewClusterUsecase

func NewClusterUsecase(logger log.Logger, codeRepo CodeRepo, secretRepo Secretrepo, resourcesUsecase *ResourcesUsecase, configs *nautesconfigs.Config, client client.Client, cluster cluster.ClusterRegistrationOperator, dex DexRepo) *ClusterUsecase

func (*ClusterUsecase) CloneRepository

func (c *ClusterUsecase) CloneRepository(ctx context.Context, url string) (string, error)

func (*ClusterUsecase) ConvertKubeconfig

func (r *ClusterUsecase) ConvertKubeconfig(config, server string) (string, error)

func (*ClusterUsecase) DeleteCluster

func (c *ClusterUsecase) DeleteCluster(ctx context.Context, clusterName string) error

func (*ClusterUsecase) DeleteDexConfig

func (c *ClusterUsecase) DeleteDexConfig(param *cluster.ClusterRegistrationParam) error

func (*ClusterUsecase) GetCluster added in v0.3.1

func (c *ClusterUsecase) GetCluster(ctx context.Context, clusterName string) (*resourcev1alpha1.Cluster, error)

func (*ClusterUsecase) GetDefaultCertificate added in v0.3.5

func (c *ClusterUsecase) GetDefaultCertificate(ctx context.Context) (string, error)

func (*ClusterUsecase) GetTenantRepository

func (c *ClusterUsecase) GetTenantRepository(ctx context.Context) (*Project, error)

func (*ClusterUsecase) ListClusters added in v0.3.1

func (c *ClusterUsecase) ListClusters(ctx context.Context) ([]*resourcev1alpha1.Cluster, error)

func (*ClusterUsecase) SaveCluster

func (c *ClusterUsecase) SaveCluster(ctx context.Context, param *cluster.ClusterRegistrationParam, kubeconfig string) error

func (*ClusterUsecase) SaveDexConfig

func (c *ClusterUsecase) SaveDexConfig(param *cluster.ClusterRegistrationParam, teantLocalPath string) error

func (*ClusterUsecase) SaveKubeconfig

func (c *ClusterUsecase) SaveKubeconfig(ctx context.Context, id, server, config string) error

type CodeRepo

type CodeRepo interface {
	GetCurrentUser(ctx context.Context) (user string, email string, err error)
	CreateCodeRepo(ctx context.Context, gid int, options *GitCodeRepoOptions) (*Project, error)
	UpdateCodeRepo(ctx context.Context, pid interface{}, options *GitCodeRepoOptions) (*Project, error)
	DeleteCodeRepo(ctx context.Context, pid interface{}) error
	GetCodeRepo(ctx context.Context, pid interface{}) (*Project, error)
	ListDeployKeys(ctx context.Context, pid interface{}, opt *ListOptions) ([]*ProjectDeployKey, error)
	ListAllDeployKeys(ctx context.Context, opt *ListOptions) ([]*ProjectDeployKey, error)
	GetDeployKey(ctx context.Context, pid interface{}, deployKeyID int) (*ProjectDeployKey, error)
	EnableProjectDeployKey(ctx context.Context, pid interface{}, deployKey int) (*ProjectDeployKey, error)
	UpdateDeployKey(ctx context.Context, pid interface{}, deployKey int, title string, canPush bool) (*ProjectDeployKey, error)
	SaveDeployKey(ctx context.Context, pid interface{}, title string, canPush bool, publicKey []byte) (*ProjectDeployKey, error)
	DeleteDeployKey(ctx context.Context, pid interface{}, deployKey int) error
	CreateGroup(ctx context.Context, gitOptions *GitGroupOptions) (*Group, error)
	DeleteGroup(ctx context.Context, gid interface{}) error
	UpdateGroup(ctx context.Context, gid interface{}, git *GitGroupOptions) (*Group, error)
	GetGroup(ctx context.Context, gid interface{}) (*Group, error)
	ListAllGroups(ctx context.Context) ([]*Group, error)
	ListGroupCodeRepos(ctx context.Context, gid interface{}, opts ...string) ([]*Project, error)
	ListCodeRepos(ctx context.Context, search string) ([]*Project, error)
	ListAccessTokens(ctx context.Context, pid interface{}, opt *ListOptions) ([]*ProjectAccessToken, error)
	GetProjectAccessToken(ctx context.Context, pid interface{}, id int) (*ProjectAccessToken, error)
	CreateProjectAccessToken(ctx context.Context, pid interface{}, opt *CreateProjectAccessTokenOptions) (*ProjectAccessToken, error)
	DeleteProjectAccessToken(ctx context.Context, pid interface{}, id int) error
}

type CodeRepoBindingData added in v0.3.0

type CodeRepoBindingData struct {
	Name string
	Spec resourcev1alpha1.CodeRepoBindingSpec
}

type CodeRepoBindingUsecase added in v0.3.0

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

func NewCodeRepoCodeRepoBindingUsecase added in v0.3.0

func NewCodeRepoCodeRepoBindingUsecase(logger log.Logger, codeRepo CodeRepo, secretRepo Secretrepo, nodestree nodestree.NodesTree, resourcesUsecase *ResourcesUsecase, config *nautesconfigs.Config, client client.Client) *CodeRepoBindingUsecase

func (*CodeRepoBindingUsecase) CheckReference added in v0.3.0

func (c *CodeRepoBindingUsecase) CheckReference(options nodestree.CompareOptions, node *nodestree.Node, k8sClient client.Client) (bool, error)

func (*CodeRepoBindingUsecase) CreateNode added in v0.3.0

func (c *CodeRepoBindingUsecase) CreateNode(path string, data interface{}) (*nodestree.Node, error)

func (*CodeRepoBindingUsecase) CreateResource added in v0.3.0

func (c *CodeRepoBindingUsecase) CreateResource(kind string) interface{}

func (*CodeRepoBindingUsecase) DeleteCodeRepoBinding added in v0.3.0

func (c *CodeRepoBindingUsecase) DeleteCodeRepoBinding(ctx context.Context, options *BizOptions) error

func (*CodeRepoBindingUsecase) GetCodeRepoBinding added in v0.3.0

func (c *CodeRepoBindingUsecase) GetCodeRepoBinding(ctx context.Context, options *BizOptions) (*resourcev1alpha1.CodeRepoBinding, error)

func (*CodeRepoBindingUsecase) GetDeployKeyFromSecretRepo added in v0.3.0

func (c *CodeRepoBindingUsecase) GetDeployKeyFromSecretRepo(ctx context.Context, repoName, user, permissions string) (*DeployKeySecretData, error)

func (*CodeRepoBindingUsecase) ListCodeRepoBindings added in v0.3.0

func (c *CodeRepoBindingUsecase) ListCodeRepoBindings(ctx context.Context, options *BizOptions) ([]*nodestree.Node, error)

func (*CodeRepoBindingUsecase) RevokeDeployKey added in v0.3.0

func (c *CodeRepoBindingUsecase) RevokeDeployKey(ctx context.Context, codeRepos []*resourcev1alpha1.CodeRepo, authorizationpid interface{}, permissions string) error

func (*CodeRepoBindingUsecase) SaveCodeRepoBinding added in v0.3.0

func (c *CodeRepoBindingUsecase) SaveCodeRepoBinding(ctx context.Context, options *BizOptions, data *CodeRepoBindingData) error

func (*CodeRepoBindingUsecase) UpdateNode added in v0.3.0

func (c *CodeRepoBindingUsecase) UpdateNode(resourceNode *nodestree.Node, data interface{}) (*nodestree.Node, error)

type CodeRepoData

type CodeRepoData struct {
	Name string
	Spec resourcev1alpha1.CodeRepoSpec
}

type CodeRepoUsecase

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

func NewCodeRepoUsecase

func NewCodeRepoUsecase(logger log.Logger, codeRepo CodeRepo, secretRepo Secretrepo, nodestree nodestree.NodesTree, config *nautesconfigs.Config, resourcesUsecase *ResourcesUsecase, codeRepoBindingUsecase *CodeRepoBindingUsecase, client client.Client) *CodeRepoUsecase

func (*CodeRepoUsecase) CheckReference

func (c *CodeRepoUsecase) CheckReference(options nodestree.CompareOptions, node *nodestree.Node, k8sClient client.Client) (bool, error)

func (*CodeRepoUsecase) CreateNode

func (c *CodeRepoUsecase) CreateNode(path string, data interface{}) (*nodestree.Node, error)

func (*CodeRepoUsecase) CreateResource

func (c *CodeRepoUsecase) CreateResource(kind string) interface{}

func (*CodeRepoUsecase) DeleteCodeRepo

func (c *CodeRepoUsecase) DeleteCodeRepo(ctx context.Context, options *BizOptions) error

func (*CodeRepoUsecase) GetAllAccessTokens added in v0.3.0

func (c *CodeRepoUsecase) GetAllAccessTokens(ctx context.Context, pid int) ([]*ProjectAccessToken, error)

func (*CodeRepoUsecase) GetCodeRepo

func (c *CodeRepoUsecase) GetCodeRepo(ctx context.Context, codeRepoName, productName string) (*ProjectCodeRepo, error)

func (*CodeRepoUsecase) ListAccessTokens added in v0.3.0

func (c *CodeRepoUsecase) ListAccessTokens(ctx context.Context, pid int, opts *ListOptions) ([]interface{}, error)

func (*CodeRepoUsecase) ListCodeRepos

func (c *CodeRepoUsecase) ListCodeRepos(ctx context.Context, productName string) ([]*ProjectCodeRepo, error)

func (*CodeRepoUsecase) SaveCodeRepo

func (c *CodeRepoUsecase) SaveCodeRepo(ctx context.Context, options *BizOptions, data *CodeRepoData, gitOptions *GitCodeRepoOptions) error

func (*CodeRepoUsecase) UpdateNode

func (c *CodeRepoUsecase) UpdateNode(node *nodestree.Node, data interface{}) (*nodestree.Node, error)

type CreateProjectAccessTokenOptions added in v0.3.0

type CreateProjectAccessTokenOptions struct {
	// Name represents the name of the project access token.
	Name *string `url:"name,omitempty" json:"name,omitempty"`
	// Scopes represents the scopes to be granted to the project access token.
	Scopes *[]string `url:"scopes,omitempty" json:"scopes,omitempty"`
	// AccessLevel represents the access level to be granted to the project access token.
	AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
	// ExpiresAt represents the date and time when the project access token will expire.
	ExpiresAt *ISOTime `url:"expires_at,omitempty" json:"expires_at,omitempty"`
}

type DeployKeyProject added in v0.3.0

type DeployKeyProject struct {
	// The ID of the project
	ID int `json:"id"`
	// The description of the project
	Description string `json:"description"`
	// The name of the project
	Name string `json:"name"`
	// The name of the project with namespace
	NameWithNamespace string `json:"name_with_namespace"`
	// The path of the project
	Path string `json:"path"`
	// The path of the project with namespace
	PathWithNamespace string `json:"path_with_namespace"`
	// The date and time when the project was created
	CreatedAt *time.Time `json:"created_at"`
}

type DeployKeySecretData

type DeployKeySecretData struct {
	// The ID of the deploy key secret
	ID int
	// The fingerprint associated with the deploy key secret
	Fingerprint string
}

type DeployKeyType added in v0.3.0

type DeployKeyType string
const (
	// Git read-only and read-write permissions
	ReadOnly  DeployKeyType = "readonly"
	ReadWrite DeployKeyType = "readwrite"
)

Deploykey

type DeploymentRuntimeData

type DeploymentRuntimeData struct {
	Name string
	Spec resourcev1alpha1.DeploymentRuntimeSpec
}

type DeploymentRuntimeUsecase

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

func NewDeploymentRuntimeUsecase

func NewDeploymentRuntimeUsecase(logger log.Logger, codeRepo CodeRepo, nodestree nodestree.NodesTree, resourcesUsecase *ResourcesUsecase, client client.Client, config *nautesconfigs.Config) *DeploymentRuntimeUsecase

func (*DeploymentRuntimeUsecase) CheckReference

func (d *DeploymentRuntimeUsecase) CheckReference(options nodestree.CompareOptions, node *nodestree.Node, k8sClient client.Client) (bool, error)

func (*DeploymentRuntimeUsecase) CreateNode

func (e *DeploymentRuntimeUsecase) CreateNode(path string, data interface{}) (*nodestree.Node, error)

func (*DeploymentRuntimeUsecase) CreateResource

func (d *DeploymentRuntimeUsecase) CreateResource(kind string) interface{}

func (*DeploymentRuntimeUsecase) DeleteDeploymentRuntime

func (d *DeploymentRuntimeUsecase) DeleteDeploymentRuntime(ctx context.Context, options *BizOptions) error

func (*DeploymentRuntimeUsecase) GetDeploymentRuntime

func (d *DeploymentRuntimeUsecase) GetDeploymentRuntime(ctx context.Context, deploymentRuntimeName, productName string) (*resourcev1alpha1.DeploymentRuntime, error)

func (*DeploymentRuntimeUsecase) ListDeploymentRuntimes

func (d *DeploymentRuntimeUsecase) ListDeploymentRuntimes(ctx context.Context, productName string) ([]*nodestree.Node, error)

func (*DeploymentRuntimeUsecase) SaveDeploymentRuntime

func (d *DeploymentRuntimeUsecase) SaveDeploymentRuntime(ctx context.Context, options *BizOptions, data *DeploymentRuntimeData) error

func (*DeploymentRuntimeUsecase) UpdateNode

func (e *DeploymentRuntimeUsecase) UpdateNode(resourceNode *nodestree.Node, data interface{}) (*nodestree.Node, error)

type DexRepo

type DexRepo interface {
	UpdateRedirectURIs(redirectURI string) error
	RemoveRedirectURIs(redirectURIs string) error
}

type EnviromentData

type EnviromentData struct {
	Name string
	Spec resourcev1alpha1.EnvironmentSpec
}

type EnvironmentUsecase

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

func NewEnviromentUsecase

func NewEnviromentUsecase(logger log.Logger, config *nautesconfigs.Config, codeRepo CodeRepo, nodestree nodestree.NodesTree, resourcesUsecase *ResourcesUsecase) *EnvironmentUsecase

func (*EnvironmentUsecase) CheckReference

func (e *EnvironmentUsecase) CheckReference(options nodestree.CompareOptions, node *nodestree.Node, k8sClient client.Client) (bool, error)

func (*EnvironmentUsecase) ConvertProductToGroupName added in v0.3.1

func (c *EnvironmentUsecase) ConvertProductToGroupName(ctx context.Context, env *resourcev1alpha1.Environment) error

func (*EnvironmentUsecase) CreateNode

func (e *EnvironmentUsecase) CreateNode(path string, data interface{}) (*nodestree.Node, error)

func (*EnvironmentUsecase) CreateResource

func (e *EnvironmentUsecase) CreateResource(kind string) interface{}

func (*EnvironmentUsecase) DeleteEnvironment

func (e *EnvironmentUsecase) DeleteEnvironment(ctx context.Context, options *BizOptions) error

func (*EnvironmentUsecase) GetEnvironment

func (e *EnvironmentUsecase) GetEnvironment(ctx context.Context, enviromentName, productName string) (*resourcev1alpha1.Environment, error)

func (*EnvironmentUsecase) ListEnvironments

func (e *EnvironmentUsecase) ListEnvironments(ctx context.Context, productName string) ([]*nodestree.Node, error)

func (*EnvironmentUsecase) SaveEnvironment

func (e *EnvironmentUsecase) SaveEnvironment(ctx context.Context, options *BizOptions, data *EnviromentData) error

func (*EnvironmentUsecase) UpdateNode

func (e *EnvironmentUsecase) UpdateNode(resourceNode *nodestree.Node, data interface{}) (*nodestree.Node, error)

type GitCodeRepoOptions

type GitCodeRepoOptions struct {
	Gitlab *GitlabCodeRepoOptions
	Github interface{}
}

type GitGroupOptions

type GitGroupOptions struct {
	Github *GroupOptions
	Gitlab *GroupOptions
}

type GitRepo

type GitRepo interface {
	Commit(ctx context.Context, path string) error
	SaveConfig(ctx context.Context, path string) error
	Clone(ctx context.Context, param *CloneRepositoryParam) (string, error)
	Merge(ctx context.Context, path string) (string, error)
	Push(ctx context.Context, path string, command ...string) error
	Diff(ctx context.Context, path string, command ...string) (string, error)
	Fetch(ctx context.Context, path string, command ...string) (string, error)
}

type GitlabCodeRepoOptions

type GitlabCodeRepoOptions struct {
	// The name of the repository
	Name string `json:"name,omitempty"`
	// The path of the repository
	Path string `json:"path,omitempty"`
	// The visibility level of the repository
	Visibility string `json:"visibility,omitempty"`
	// The description of the repository
	Description string `json:"description,omitempty"`
	// The ID of the namespace to which the repository belongs
	NamespaceID int32 `json:"namespace_id,omitempty"`
}

type Group

type Group struct {
	ID          int32
	Name        string
	Visibility  string
	Description string
	Path        string
	WebUrl      string
	ParentId    int32
}

func CreateGroup

func CreateGroup(ctx context.Context, codeRepo CodeRepo, gitOptions *GitGroupOptions) (group *Group, err error)

func GetGroup

func GetGroup(ctx context.Context, codeRepo CodeRepo, gid interface{}) (group *Group, err error)

func UpdateGroup

func UpdateGroup(ctx context.Context, codeRepo CodeRepo, configClient *nautesconfigs.Config, gid int, git *GitGroupOptions) (group *Group, err error)

type GroupAndProjectItem

type GroupAndProjectItem struct {
	Group   *Group
	Project *Project
}

type GroupOptions

type GroupOptions struct {
	// The name of the group
	Name string `json:"name,omitempty"`
	// The path of the group
	Path string `json:"path,omitempty"`
	// The visibility level of the group
	Visibility string `json:"visibility,omitempty"`
	// The description of the group
	Description string `json:"description,omitempty"`
	// The ID of the parent group
	ParentId int32 `json:"parent_id,omitempty"`
}

type ISOTime added in v0.3.0

type ISOTime time.Time

Project Access token type definition.

type Kubernetes added in v0.3.0

type Kubernetes interface {
	ListCodeRepo(ctx context.Context) (*resourcev1alpha1.CodeRepoList, error)
	ListCodeRepoBindings(ctx context.Context) (*resourcev1alpha1.CodeRepoBindingList, error)
}

type ListMatchOptions added in v0.3.0

type ListMatchOptions func(*resourcev1alpha1.CodeRepo) bool

type ListOptions

type ListOptions struct {
	// The page number
	Page int `url:"page,omitempty" json:"page,omitempty"`
	// The number of items per page
	PerPage int `url:"per_page,omitempty" json:"per_page,omitempty"`
}

type MockCodeRepo

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

MockCodeRepo is a mock of CodeRepo interface.

func NewMockCodeRepo

func NewMockCodeRepo(ctrl *gomock.Controller) *MockCodeRepo

NewMockCodeRepo creates a new mock instance.

func (*MockCodeRepo) CreateCodeRepo

func (m *MockCodeRepo) CreateCodeRepo(ctx context.Context, gid int, options *GitCodeRepoOptions) (*Project, error)

CreateCodeRepo mocks base method.

func (*MockCodeRepo) CreateGroup

func (m *MockCodeRepo) CreateGroup(ctx context.Context, gitOptions *GitGroupOptions) (*Group, error)

CreateGroup mocks base method.

func (*MockCodeRepo) CreateProjectAccessToken added in v0.3.0

func (m *MockCodeRepo) CreateProjectAccessToken(ctx context.Context, pid interface{}, opt *CreateProjectAccessTokenOptions) (*ProjectAccessToken, error)

CreateProjectAccessToken mocks base method.

func (*MockCodeRepo) DeleteCodeRepo

func (m *MockCodeRepo) DeleteCodeRepo(ctx context.Context, pid interface{}) error

DeleteCodeRepo mocks base method.

func (*MockCodeRepo) DeleteDeployKey

func (m *MockCodeRepo) DeleteDeployKey(ctx context.Context, pid interface{}, deployKey int) error

DeleteDeployKey mocks base method.

func (*MockCodeRepo) DeleteGroup

func (m *MockCodeRepo) DeleteGroup(ctx context.Context, gid interface{}) error

DeleteGroup mocks base method.

func (*MockCodeRepo) DeleteProjectAccessToken added in v0.3.0

func (m *MockCodeRepo) DeleteProjectAccessToken(ctx context.Context, pid interface{}, id int) error

DeleteProjectAccessToken mocks base method.

func (*MockCodeRepo) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockCodeRepo) EnableProjectDeployKey added in v0.3.0

func (m *MockCodeRepo) EnableProjectDeployKey(ctx context.Context, pid interface{}, deployKey int) (*ProjectDeployKey, error)

EnableProjectDeployKey mocks base method.

func (*MockCodeRepo) GetCodeRepo

func (m *MockCodeRepo) GetCodeRepo(ctx context.Context, pid interface{}) (*Project, error)

GetCodeRepo mocks base method.

func (*MockCodeRepo) GetCurrentUser

func (m *MockCodeRepo) GetCurrentUser(ctx context.Context) (string, string, error)

GetCurrentUser mocks base method.

func (*MockCodeRepo) GetDeployKey

func (m *MockCodeRepo) GetDeployKey(ctx context.Context, pid interface{}, deployKeyID int) (*ProjectDeployKey, error)

GetDeployKey mocks base method.

func (*MockCodeRepo) GetGroup

func (m *MockCodeRepo) GetGroup(ctx context.Context, gid interface{}) (*Group, error)

GetGroup mocks base method.

func (*MockCodeRepo) GetProjectAccessToken added in v0.3.0

func (m *MockCodeRepo) GetProjectAccessToken(ctx context.Context, pid interface{}, id int) (*ProjectAccessToken, error)

GetProjectAccessToken mocks base method.

func (*MockCodeRepo) ListAccessTokens added in v0.3.0

func (m *MockCodeRepo) ListAccessTokens(ctx context.Context, pid interface{}, opt *ListOptions) ([]*ProjectAccessToken, error)

ListAccessTokens mocks base method.

func (*MockCodeRepo) ListAllDeployKeys added in v0.3.0

func (m *MockCodeRepo) ListAllDeployKeys(ctx context.Context, opt *ListOptions) ([]*ProjectDeployKey, error)

ListAllDeployKeys mocks base method.

func (*MockCodeRepo) ListAllGroups

func (m *MockCodeRepo) ListAllGroups(ctx context.Context) ([]*Group, error)

ListAllGroups mocks base method.

func (*MockCodeRepo) ListCodeRepos added in v0.3.4

func (m *MockCodeRepo) ListCodeRepos(ctx context.Context, search string) ([]*Project, error)

ListCodeRepos mocks base method.

func (*MockCodeRepo) ListDeployKeys

func (m *MockCodeRepo) ListDeployKeys(ctx context.Context, pid interface{}, opt *ListOptions) ([]*ProjectDeployKey, error)

ListDeployKeys mocks base method.

func (*MockCodeRepo) ListGroupCodeRepos

func (m *MockCodeRepo) ListGroupCodeRepos(ctx context.Context, gid interface{}, opts ...string) ([]*Project, error)

ListGroupCodeRepos mocks base method.

func (*MockCodeRepo) SaveDeployKey

func (m *MockCodeRepo) SaveDeployKey(ctx context.Context, pid interface{}, title string, canPush bool, publicKey []byte) (*ProjectDeployKey, error)

SaveDeployKey mocks base method.

func (*MockCodeRepo) UpdateCodeRepo

func (m *MockCodeRepo) UpdateCodeRepo(ctx context.Context, pid interface{}, options *GitCodeRepoOptions) (*Project, error)

UpdateCodeRepo mocks base method.

func (*MockCodeRepo) UpdateDeployKey added in v0.3.0

func (m *MockCodeRepo) UpdateDeployKey(ctx context.Context, pid interface{}, deployKey int, title string, canPush bool) (*ProjectDeployKey, error)

UpdateDeployKey mocks base method.

func (*MockCodeRepo) UpdateGroup

func (m *MockCodeRepo) UpdateGroup(ctx context.Context, gid interface{}, git *GitGroupOptions) (*Group, error)

UpdateGroup mocks base method.

type MockCodeRepoMockRecorder

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

MockCodeRepoMockRecorder is the mock recorder for MockCodeRepo.

func (*MockCodeRepoMockRecorder) CreateCodeRepo

func (mr *MockCodeRepoMockRecorder) CreateCodeRepo(ctx, gid, options interface{}) *gomock.Call

CreateCodeRepo indicates an expected call of CreateCodeRepo.

func (*MockCodeRepoMockRecorder) CreateGroup

func (mr *MockCodeRepoMockRecorder) CreateGroup(ctx, gitOptions interface{}) *gomock.Call

CreateGroup indicates an expected call of CreateGroup.

func (*MockCodeRepoMockRecorder) CreateProjectAccessToken added in v0.3.0

func (mr *MockCodeRepoMockRecorder) CreateProjectAccessToken(ctx, pid, opt interface{}) *gomock.Call

CreateProjectAccessToken indicates an expected call of CreateProjectAccessToken.

func (*MockCodeRepoMockRecorder) DeleteCodeRepo

func (mr *MockCodeRepoMockRecorder) DeleteCodeRepo(ctx, pid interface{}) *gomock.Call

DeleteCodeRepo indicates an expected call of DeleteCodeRepo.

func (*MockCodeRepoMockRecorder) DeleteDeployKey

func (mr *MockCodeRepoMockRecorder) DeleteDeployKey(ctx, pid, deployKey interface{}) *gomock.Call

DeleteDeployKey indicates an expected call of DeleteDeployKey.

func (*MockCodeRepoMockRecorder) DeleteGroup

func (mr *MockCodeRepoMockRecorder) DeleteGroup(ctx, gid interface{}) *gomock.Call

DeleteGroup indicates an expected call of DeleteGroup.

func (*MockCodeRepoMockRecorder) DeleteProjectAccessToken added in v0.3.0

func (mr *MockCodeRepoMockRecorder) DeleteProjectAccessToken(ctx, pid, id interface{}) *gomock.Call

DeleteProjectAccessToken indicates an expected call of DeleteProjectAccessToken.

func (*MockCodeRepoMockRecorder) EnableProjectDeployKey added in v0.3.0

func (mr *MockCodeRepoMockRecorder) EnableProjectDeployKey(ctx, pid, deployKey interface{}) *gomock.Call

EnableProjectDeployKey indicates an expected call of EnableProjectDeployKey.

func (*MockCodeRepoMockRecorder) GetCodeRepo

func (mr *MockCodeRepoMockRecorder) GetCodeRepo(ctx, pid interface{}) *gomock.Call

GetCodeRepo indicates an expected call of GetCodeRepo.

func (*MockCodeRepoMockRecorder) GetCurrentUser

func (mr *MockCodeRepoMockRecorder) GetCurrentUser(ctx interface{}) *gomock.Call

GetCurrentUser indicates an expected call of GetCurrentUser.

func (*MockCodeRepoMockRecorder) GetDeployKey

func (mr *MockCodeRepoMockRecorder) GetDeployKey(ctx, pid, deployKeyID interface{}) *gomock.Call

GetDeployKey indicates an expected call of GetDeployKey.

func (*MockCodeRepoMockRecorder) GetGroup

func (mr *MockCodeRepoMockRecorder) GetGroup(ctx, gid interface{}) *gomock.Call

GetGroup indicates an expected call of GetGroup.

func (*MockCodeRepoMockRecorder) GetProjectAccessToken added in v0.3.0

func (mr *MockCodeRepoMockRecorder) GetProjectAccessToken(ctx, pid, id interface{}) *gomock.Call

GetProjectAccessToken indicates an expected call of GetProjectAccessToken.

func (*MockCodeRepoMockRecorder) ListAccessTokens added in v0.3.0

func (mr *MockCodeRepoMockRecorder) ListAccessTokens(ctx, pid, opt interface{}) *gomock.Call

ListAccessTokens indicates an expected call of ListAccessTokens.

func (*MockCodeRepoMockRecorder) ListAllDeployKeys added in v0.3.0

func (mr *MockCodeRepoMockRecorder) ListAllDeployKeys(ctx, opt interface{}) *gomock.Call

ListAllDeployKeys indicates an expected call of ListAllDeployKeys.

func (*MockCodeRepoMockRecorder) ListAllGroups

func (mr *MockCodeRepoMockRecorder) ListAllGroups(ctx interface{}) *gomock.Call

ListAllGroups indicates an expected call of ListAllGroups.

func (*MockCodeRepoMockRecorder) ListCodeRepos added in v0.3.4

func (mr *MockCodeRepoMockRecorder) ListCodeRepos(ctx, search interface{}) *gomock.Call

ListCodeRepos indicates an expected call of ListCodeRepos.

func (*MockCodeRepoMockRecorder) ListDeployKeys

func (mr *MockCodeRepoMockRecorder) ListDeployKeys(ctx, pid, opt interface{}) *gomock.Call

ListDeployKeys indicates an expected call of ListDeployKeys.

func (*MockCodeRepoMockRecorder) ListGroupCodeRepos

func (mr *MockCodeRepoMockRecorder) ListGroupCodeRepos(ctx, gid interface{}, opts ...interface{}) *gomock.Call

ListGroupCodeRepos indicates an expected call of ListGroupCodeRepos.

func (*MockCodeRepoMockRecorder) SaveDeployKey

func (mr *MockCodeRepoMockRecorder) SaveDeployKey(ctx, pid, title, canPush, publicKey interface{}) *gomock.Call

SaveDeployKey indicates an expected call of SaveDeployKey.

func (*MockCodeRepoMockRecorder) UpdateCodeRepo

func (mr *MockCodeRepoMockRecorder) UpdateCodeRepo(ctx, pid, options interface{}) *gomock.Call

UpdateCodeRepo indicates an expected call of UpdateCodeRepo.

func (*MockCodeRepoMockRecorder) UpdateDeployKey added in v0.3.0

func (mr *MockCodeRepoMockRecorder) UpdateDeployKey(ctx, pid, deployKey, title, canPush interface{}) *gomock.Call

UpdateDeployKey indicates an expected call of UpdateDeployKey.

func (*MockCodeRepoMockRecorder) UpdateGroup

func (mr *MockCodeRepoMockRecorder) UpdateGroup(ctx, gid, git interface{}) *gomock.Call

UpdateGroup indicates an expected call of UpdateGroup.

type MockDexRepo

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

MockDexRepo is a mock of DexRepo interface.

func NewMockDexRepo

func NewMockDexRepo(ctrl *gomock.Controller) *MockDexRepo

NewMockDexRepo creates a new mock instance.

func (*MockDexRepo) EXPECT

func (m *MockDexRepo) EXPECT() *MockDexRepoMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockDexRepo) RemoveRedirectURIs

func (m *MockDexRepo) RemoveRedirectURIs(redirectURIs string) error

RemoveRedirectURIs mocks base method.

func (*MockDexRepo) UpdateRedirectURIs

func (m *MockDexRepo) UpdateRedirectURIs(redirectURI string) error

UpdateRedirectURIs mocks base method.

type MockDexRepoMockRecorder

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

MockDexRepoMockRecorder is the mock recorder for MockDexRepo.

func (*MockDexRepoMockRecorder) RemoveRedirectURIs

func (mr *MockDexRepoMockRecorder) RemoveRedirectURIs(redirectURIs interface{}) *gomock.Call

RemoveRedirectURIs indicates an expected call of RemoveRedirectURIs.

func (*MockDexRepoMockRecorder) UpdateRedirectURIs

func (mr *MockDexRepoMockRecorder) UpdateRedirectURIs(redirectURI interface{}) *gomock.Call

UpdateRedirectURIs indicates an expected call of UpdateRedirectURIs.

type MockGitRepo

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

MockGitRepo is a mock of GitRepo interface.

func NewMockGitRepo

func NewMockGitRepo(ctrl *gomock.Controller) *MockGitRepo

NewMockGitRepo creates a new mock instance.

func (*MockGitRepo) Clone

func (m *MockGitRepo) Clone(ctx context.Context, param *CloneRepositoryParam) (string, error)

Clone mocks base method.

func (*MockGitRepo) Commit

func (m *MockGitRepo) Commit(ctx context.Context, path string) error

Commit mocks base method.

func (*MockGitRepo) Diff

func (m *MockGitRepo) Diff(ctx context.Context, path string, command ...string) (string, error)

Diff mocks base method.

func (*MockGitRepo) EXPECT

func (m *MockGitRepo) EXPECT() *MockGitRepoMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockGitRepo) Fetch

func (m *MockGitRepo) Fetch(ctx context.Context, path string, command ...string) (string, error)

Fetch mocks base method.

func (*MockGitRepo) Merge

func (m *MockGitRepo) Merge(ctx context.Context, path string) (string, error)

Merge mocks base method.

func (*MockGitRepo) Push

func (m *MockGitRepo) Push(ctx context.Context, path string, command ...string) error

Push mocks base method.

func (*MockGitRepo) SaveConfig

func (m *MockGitRepo) SaveConfig(ctx context.Context, path string) error

SaveConfig mocks base method.

type MockGitRepoMockRecorder

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

MockGitRepoMockRecorder is the mock recorder for MockGitRepo.

func (*MockGitRepoMockRecorder) Clone

func (mr *MockGitRepoMockRecorder) Clone(ctx, param interface{}) *gomock.Call

Clone indicates an expected call of Clone.

func (*MockGitRepoMockRecorder) Commit

func (mr *MockGitRepoMockRecorder) Commit(ctx, path interface{}) *gomock.Call

Commit indicates an expected call of Commit.

func (*MockGitRepoMockRecorder) Diff

func (mr *MockGitRepoMockRecorder) Diff(ctx, path interface{}, command ...interface{}) *gomock.Call

Diff indicates an expected call of Diff.

func (*MockGitRepoMockRecorder) Fetch

func (mr *MockGitRepoMockRecorder) Fetch(ctx, path interface{}, command ...interface{}) *gomock.Call

Fetch indicates an expected call of Fetch.

func (*MockGitRepoMockRecorder) Merge

func (mr *MockGitRepoMockRecorder) Merge(ctx, path interface{}) *gomock.Call

Merge indicates an expected call of Merge.

func (*MockGitRepoMockRecorder) Push

func (mr *MockGitRepoMockRecorder) Push(ctx, path interface{}, command ...interface{}) *gomock.Call

Push indicates an expected call of Push.

func (*MockGitRepoMockRecorder) SaveConfig

func (mr *MockGitRepoMockRecorder) SaveConfig(ctx, path interface{}) *gomock.Call

SaveConfig indicates an expected call of SaveConfig.

type MockKubernetes added in v0.3.0

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

MockKubernetes is a mock of Kubernetes interface.

func NewMockKubernetes added in v0.3.0

func NewMockKubernetes(ctrl *gomock.Controller) *MockKubernetes

NewMockKubernetes creates a new mock instance.

func (*MockKubernetes) EXPECT added in v0.3.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockKubernetes) ListCodeRepo added in v0.3.0

func (m *MockKubernetes) ListCodeRepo(ctx context.Context) (*v1alpha1.CodeRepoList, error)

ListCodeRepo mocks base method.

func (*MockKubernetes) ListCodeRepoBindings added in v0.3.0

func (m *MockKubernetes) ListCodeRepoBindings(ctx context.Context) (*v1alpha1.CodeRepoBindingList, error)

ListCodeRepoBindings mocks base method.

type MockKubernetesMockRecorder added in v0.3.0

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

MockKubernetesMockRecorder is the mock recorder for MockKubernetes.

func (*MockKubernetesMockRecorder) ListCodeRepo added in v0.3.0

func (mr *MockKubernetesMockRecorder) ListCodeRepo(ctx interface{}) *gomock.Call

ListCodeRepo indicates an expected call of ListCodeRepo.

func (*MockKubernetesMockRecorder) ListCodeRepoBindings added in v0.3.0

func (mr *MockKubernetesMockRecorder) ListCodeRepoBindings(ctx interface{}) *gomock.Call

ListCodeRepoBindings indicates an expected call of ListCodeRepoBindings.

type MockSecretrepo

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

MockSecretrepo is a mock of Secretrepo interface.

func NewMockSecretrepo

func NewMockSecretrepo(ctrl *gomock.Controller) *MockSecretrepo

NewMockSecretrepo creates a new mock instance.

func (*MockSecretrepo) AuthorizationSecret

func (m *MockSecretrepo) AuthorizationSecret(ctx context.Context, id int, destUser, gitType, mountPath string) error

AuthorizationSecret mocks base method.

func (*MockSecretrepo) DeleteSecret

func (m *MockSecretrepo) DeleteSecret(ctx context.Context, id int, user, permission string) error

DeleteSecret mocks base method.

func (*MockSecretrepo) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockSecretrepo) GetDeployKey

func (m *MockSecretrepo) GetDeployKey(ctx context.Context, secretOptions *SecretOptions) (*DeployKeySecretData, error)

GetDeployKey mocks base method.

func (*MockSecretrepo) GetProjectAccessToken added in v0.3.0

func (m *MockSecretrepo) GetProjectAccessToken(ctx context.Context, secretOptions *SecretOptions) (*AccessTokenSecretData, error)

GetProjectAccessToken mocks base method.

func (*MockSecretrepo) GetSecret

func (m *MockSecretrepo) GetSecret(ctx context.Context, secretOptions *SecretOptions) (string, error)

GetSecret mocks base method.

func (*MockSecretrepo) SaveClusterConfig

func (m *MockSecretrepo) SaveClusterConfig(ctx context.Context, id, config string) error

SaveClusterConfig mocks base method.

func (*MockSecretrepo) SaveDeployKey

func (m *MockSecretrepo) SaveDeployKey(ctx context.Context, id, key, user, permission string, extendKVs map[string]string) error

SaveDeployKey mocks base method.

func (*MockSecretrepo) SaveProjectAccessToken added in v0.3.0

func (m *MockSecretrepo) SaveProjectAccessToken(ctx context.Context, id, token, user, permission string, extendKVs map[string]string) error

SaveProjectAccessToken mocks base method.

type MockSecretrepoMockRecorder

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

MockSecretrepoMockRecorder is the mock recorder for MockSecretrepo.

func (*MockSecretrepoMockRecorder) AuthorizationSecret

func (mr *MockSecretrepoMockRecorder) AuthorizationSecret(ctx, id, destUser, gitType, mountPath interface{}) *gomock.Call

AuthorizationSecret indicates an expected call of AuthorizationSecret.

func (*MockSecretrepoMockRecorder) DeleteSecret

func (mr *MockSecretrepoMockRecorder) DeleteSecret(ctx, id, user, permission interface{}) *gomock.Call

DeleteSecret indicates an expected call of DeleteSecret.

func (*MockSecretrepoMockRecorder) GetDeployKey

func (mr *MockSecretrepoMockRecorder) GetDeployKey(ctx, secretOptions interface{}) *gomock.Call

GetDeployKey indicates an expected call of GetDeployKey.

func (*MockSecretrepoMockRecorder) GetProjectAccessToken added in v0.3.0

func (mr *MockSecretrepoMockRecorder) GetProjectAccessToken(ctx, secretOptions interface{}) *gomock.Call

GetProjectAccessToken indicates an expected call of GetProjectAccessToken.

func (*MockSecretrepoMockRecorder) GetSecret

func (mr *MockSecretrepoMockRecorder) GetSecret(ctx, secretOptions interface{}) *gomock.Call

GetSecret indicates an expected call of GetSecret.

func (*MockSecretrepoMockRecorder) SaveClusterConfig

func (mr *MockSecretrepoMockRecorder) SaveClusterConfig(ctx, id, config interface{}) *gomock.Call

SaveClusterConfig indicates an expected call of SaveClusterConfig.

func (*MockSecretrepoMockRecorder) SaveDeployKey

func (mr *MockSecretrepoMockRecorder) SaveDeployKey(ctx, id, key, user, permission, extendKVs interface{}) *gomock.Call

SaveDeployKey indicates an expected call of SaveDeployKey.

func (*MockSecretrepoMockRecorder) SaveProjectAccessToken added in v0.3.0

func (mr *MockSecretrepoMockRecorder) SaveProjectAccessToken(ctx, id, token, user, permission, extendKVs interface{}) *gomock.Call

SaveProjectAccessToken indicates an expected call of SaveProjectAccessToken.

type PipelineRuntimeValidateClient added in v0.3.0

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

func (*PipelineRuntimeValidateClient) GetCodeRepoBindingList added in v0.3.0

func (p *PipelineRuntimeValidateClient) GetCodeRepoBindingList(productName, repoName string) (*resourcev1alpha1.CodeRepoBindingList, error)

func (*PipelineRuntimeValidateClient) GetCodeRepoList added in v0.3.0

func (p *PipelineRuntimeValidateClient) GetCodeRepoList(repoName string) (*resourcev1alpha1.CodeRepoList, error)

type ProductAuthorization added in v0.3.0

type ProductAuthorization struct {
	ProductName   string
	ProjectScopes map[string]bool
	// contains filtered or unexported fields
}

type ProductUsecase

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

ProductUsecase is a Product usecase.

func NewProductUsecase

func NewProductUsecase(logger log.Logger, codeRepo CodeRepo, secretRepo Secretrepo, gitRepo GitRepo, configs *nautesconfigs.Config, resourcesUsecase *ResourcesUsecase, codeRepoUsecase *CodeRepoUsecase) *ProductUsecase

func (*ProductUsecase) DeleteProduct

func (p *ProductUsecase) DeleteProduct(ctx context.Context, productID string) error

func (*ProductUsecase) GetGroupAndDefaultProject

func (p *ProductUsecase) GetGroupAndDefaultProject(ctx context.Context, productName string) (*GroupAndProjectItem, error)

func (*ProductUsecase) GetProduct

func (p *ProductUsecase) GetProduct(ctx context.Context, productName string) (*GroupAndProjectItem, error)

func (*ProductUsecase) ListProducts

func (p *ProductUsecase) ListProducts(ctx context.Context) ([]*GroupAndProjectItem, error)

func (*ProductUsecase) SaveProduct

func (p *ProductUsecase) SaveProduct(ctx context.Context, productName string, gitOptions *GitGroupOptions) (group *Group, project *Project, err error)

type Project

type Project struct {
	ID                int32
	Name              string
	Visibility        string
	Description       string
	Path              string
	WebUrl            string
	SshUrlToRepo      string
	HttpUrlToRepo     string
	PathWithNamespace string
	Namespace         *ProjectNamespace
}

func GetProject

func GetProject(ctx context.Context, codeRepo CodeRepo, pid interface{}) (project *Project, err error)

type ProjectAccessToken added in v0.3.0

type ProjectAccessToken struct {
	// ID represents the unique identifier of the project access token.
	ID int `json:"id"`
	// UserID represents the unique identifier of the user associated with the project access token.
	UserID int `json:"user_id"`
	// Name represents the name of the project access token.
	Name string `json:"name"`
	// Scopes represents the scopes granted to the project access token.
	Scopes []string `json:"scopes"`
	// CreatedAt represents the date and time when the project access token was created.
	CreatedAt *time.Time `json:"created_at"`
	// LastUsedAt represents the date and time when the project access token was last used.
	LastUsedAt *time.Time `json:"last_used_at"`
	// ExpiresAt represents the date and time when the project access token will expire.
	ExpiresAt *ISOTime `json:"expires_at"`
	// Active represents whether the project access token is active or not.
	Active bool `json:"active"`
	// Revoked represents whether the project access token has been revoked or not.
	Revoked bool `json:"revoked"`
	// Token represents the value of the project access token.
	Token string `json:"token"`
	// AccessLevel represents the access level granted to the project access token.
	AccessLevel AccessLevelValue `json:"access_level"`
}

type ProjectCodeRepo added in v0.3.6

type ProjectCodeRepo struct {
	CodeRepo *resourcev1alpha1.CodeRepo
	Project  *Project
}

type ProjectData

type ProjectData struct {
	ProjectName string
	ProductName string
	Language    string
}

type ProjectDeployKey

type ProjectDeployKey struct {
	// The ID of the deploy key
	ID int `json:"id"`
	// The title of the deploy key
	Title string `json:"title"`
	// The key value of the deploy key
	Key string `json:"key"`
	// The date and time when the deploy key was created
	CreatedAt *time.Time `json:"created_at"`
	// Whether the deploy key has push access
	CanPush bool `json:"can_push"`
	// The fingerprint of the deploy key
	Fingerprint string `json:"fingerprint"`
	// The projects that have write access to this deploy key
	ProjectsWithWriteAccess []*DeployKeyProject `json:"projects_with_write_access"`
}

func GetAllDeployKeys added in v0.3.0

func GetAllDeployKeys(ctx context.Context, codeRepo CodeRepo, pid int) ([]*ProjectDeployKey, error)

type ProjectNamespace added in v0.3.0

type ProjectNamespace struct {
	ID        int
	Name      string
	Path      string
	Kind      string
	FullPath  string
	AvatarURL string
	WebURL    string
}

type ProjectPipelineRuntimeData

type ProjectPipelineRuntimeData struct {
	Name string
	Spec resourcev1alpha1.ProjectPipelineRuntimeSpec
}

type ProjectPipelineRuntimeUsecase

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

func NewProjectPipelineRuntimeUsecase

func NewProjectPipelineRuntimeUsecase(logger log.Logger, codeRepo CodeRepo, nodestree nodestree.NodesTree, resourcesUsecase *ResourcesUsecase, client client.Client, config *nautesconfigs.Config) *ProjectPipelineRuntimeUsecase

func (*ProjectPipelineRuntimeUsecase) CheckReference

func (p *ProjectPipelineRuntimeUsecase) CheckReference(options nodestree.CompareOptions, node *nodestree.Node, k8sClient client.Client) (bool, error)

func (*ProjectPipelineRuntimeUsecase) CreateNode

func (p *ProjectPipelineRuntimeUsecase) CreateNode(path string, data interface{}) (*nodestree.Node, error)

func (*ProjectPipelineRuntimeUsecase) CreateResource

func (p *ProjectPipelineRuntimeUsecase) CreateResource(kind string) interface{}

func (*ProjectPipelineRuntimeUsecase) DeleteProjectPipelineRuntime

func (p *ProjectPipelineRuntimeUsecase) DeleteProjectPipelineRuntime(ctx context.Context, options *BizOptions) error

func (*ProjectPipelineRuntimeUsecase) GetProjectPipelineRuntime

func (p *ProjectPipelineRuntimeUsecase) GetProjectPipelineRuntime(ctx context.Context, projectPipelineName, productName string) (*nodestree.Node, error)

func (*ProjectPipelineRuntimeUsecase) IsRepositoryExist added in v0.3.0

func (p *ProjectPipelineRuntimeUsecase) IsRepositoryExist(ctx context.Context, productName, repoName string) (*Project, error)

func (*ProjectPipelineRuntimeUsecase) ListProjectPipelineRuntimes

func (p *ProjectPipelineRuntimeUsecase) ListProjectPipelineRuntimes(ctx context.Context, productName string) ([]*nodestree.Node, error)

func (*ProjectPipelineRuntimeUsecase) SaveProjectPipelineRuntime

func (p *ProjectPipelineRuntimeUsecase) SaveProjectPipelineRuntime(ctx context.Context, options *BizOptions, data *ProjectPipelineRuntimeData) error

func (*ProjectPipelineRuntimeUsecase) UpdateNode

func (p *ProjectPipelineRuntimeUsecase) UpdateNode(node *nodestree.Node, data interface{}) (*nodestree.Node, error)

type ProjectUsecase

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

func NewProjectUsecase

func NewProjectUsecase(logger log.Logger, codeRepo CodeRepo, secretRepo Secretrepo, nodestree nodestree.NodesTree, configs *nautesconfigs.Config, resourcesUsecase *ResourcesUsecase) *ProjectUsecase

func (*ProjectUsecase) CheckReference

func (p *ProjectUsecase) CheckReference(options nodestree.CompareOptions, node *nodestree.Node, k8sClient client.Client) (bool, error)

func (*ProjectUsecase) CreateNode

func (p *ProjectUsecase) CreateNode(path string, data interface{}) (*nodestree.Node, error)

func (*ProjectUsecase) CreateResource

func (p *ProjectUsecase) CreateResource(kind string) interface{}

func (*ProjectUsecase) DeleteProject

func (p *ProjectUsecase) DeleteProject(ctx context.Context, options *BizOptions) error

func (*ProjectUsecase) GetProject

func (p *ProjectUsecase) GetProject(ctx context.Context, projectName, productName string) (*resourcev1alpha1.Project, error)

func (*ProjectUsecase) ListProjects

func (p *ProjectUsecase) ListProjects(ctx context.Context, productName string) ([]*resourcev1alpha1.Project, error)

func (*ProjectUsecase) SaveProject

func (p *ProjectUsecase) SaveProject(ctx context.Context, options *BizOptions, data *ProjectData) error

func (*ProjectUsecase) UpdateNode

func (p *ProjectUsecase) UpdateNode(resourceNode *nodestree.Node, data interface{}) (*nodestree.Node, error)

type ResourceInfo added in v0.3.1

type ResourceInfo struct {
	// The product name to which the resource belongs
	ProductName string
	// Method of operating resources
	Method string
	// Parent class resource kind
	ParentResouceKind string
	// Parent class resource name
	ParentResourceName string
	// Current resource kind
	ResourceKind string
	// Current resource name
	ResourceName string
}

type ResourcesUsecase

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

func NewResourcesUsecase

func NewResourcesUsecase(log log.Logger, codeRepo CodeRepo, secretRepo Secretrepo, gitRepo GitRepo, nodestree nodestree.NodesTree, configs *nautesconfigs.Config) *ResourcesUsecase

func (*ResourcesUsecase) CloneCodeRepo

func (r *ResourcesUsecase) CloneCodeRepo(ctx context.Context, url string) (path string, err error)

func (*ResourcesUsecase) ConvertCodeRepoToRepoName added in v0.3.1

func (r *ResourcesUsecase) ConvertCodeRepoToRepoName(ctx context.Context, codeRepoName string) (string, error)

func (*ResourcesUsecase) ConvertGroupToProductName added in v0.3.6

func (r *ResourcesUsecase) ConvertGroupToProductName(ctx context.Context, productName string) (string, error)

func (*ResourcesUsecase) ConvertProductToGroupName added in v0.3.1

func (r *ResourcesUsecase) ConvertProductToGroupName(ctx context.Context, productName string) (string, error)

func (*ResourcesUsecase) ConvertRepoNameToCodeRepo added in v0.3.1

func (r *ResourcesUsecase) ConvertRepoNameToCodeRepo(ctx context.Context, productName, codeRepoName string) (string, error)

func (*ResourcesUsecase) Delete

func (r *ResourcesUsecase) Delete(ctx context.Context, resourceOptions *resourceOptions, getResourceName getResouceName) error

func (*ResourcesUsecase) Get

func (r *ResourcesUsecase) Get(ctx context.Context, resourceKind, productName string, operator nodestree.NodesOperator, getResourceName getResouceName) (*nodestree.Node, error)

func (*ResourcesUsecase) GetCodeRepo

func (r *ResourcesUsecase) GetCodeRepo(ctx context.Context, ProductName, codeRepoName string) (*Project, error)

GetCodeRepoName The name of the codeRepo resource must be prefixed with repo-, eg: repo-1

func (*ResourcesUsecase) GetGroupAndProjectByGroupID added in v0.3.0

func (r *ResourcesUsecase) GetGroupAndProjectByGroupID(ctx context.Context, gid interface{}) (*Group, *Project, error)

func (*ResourcesUsecase) GetNode

func (r *ResourcesUsecase) GetNode(nodes *nodestree.Node, kind, resourceName string) *nodestree.Node

GetNode get specifial node accroding to resource kind and name

func (*ResourcesUsecase) GetNodes added in v0.3.0

func (r *ResourcesUsecase) GetNodes() (*nodestree.Node, error)

func (*ResourcesUsecase) InsertNodes

func (r *ResourcesUsecase) InsertNodes(nodestree nodestree.NodesTree, nodes, resource *nodestree.Node) (*nodestree.Node, error)

func (*ResourcesUsecase) List

func (r *ResourcesUsecase) List(ctx context.Context, gid interface{}, operator nodestree.NodesOperator) (*nodestree.Node, error)

func (*ResourcesUsecase) RemoveNode

func (r *ResourcesUsecase) RemoveNode(nodes, node *nodestree.Node) (*nodestree.Node, error)

RemoveNode delete the specified node accroding to the path

func (*ResourcesUsecase) Save

func (r *ResourcesUsecase) Save(ctx context.Context, resourceOptions *resourceOptions, data interface{}) error

Save create or update config to git platform

func (*ResourcesUsecase) SaveConfig

func (r *ResourcesUsecase) SaveConfig(ctx context.Context, path string) error

SaveConfig Save project resource config to git platform If automatic merge fails will retry three times

func (*ResourcesUsecase) SaveDeployConfig

func (r *ResourcesUsecase) SaveDeployConfig(nodes *nodestree.Node, path string) error

func (*ResourcesUsecase) WriteResource

func (r *ResourcesUsecase) WriteResource(node *nodestree.Node) (err error)

WriteResource Write project resource content to a file

type RretryCountType

type RretryCountType string
const (
	// When pushing code configuration, there is a key with a context retry
	RretryCount RretryCountType = "RretryCount"
)

type SecretData

type SecretData struct {
	// The ID of the secret
	ID int `json:"id"`
	// The data associated with the secret
	Data string `json:"key"`
}

type SecretOptions

type SecretOptions struct {
	// The path of the secret
	SecretPath string
	// The engine used to store the secret
	SecretEngine string
	// The key used to access the secret
	SecretKey string
}

type Secretrepo

type Secretrepo interface {
	GetSecret(ctx context.Context, secretOptions *SecretOptions) (string, error)
	GetDeployKey(ctx context.Context, secretOptions *SecretOptions) (*DeployKeySecretData, error)
	SaveDeployKey(ctx context.Context, id, key, user, permission string, extendKVs map[string]string) error
	SaveProjectAccessToken(ctx context.Context, id, token, user, permission string, extendKVs map[string]string) error
	SaveClusterConfig(ctx context.Context, id, config string) error
	DeleteSecret(ctx context.Context, id int, user, permission string) error
	AuthorizationSecret(ctx context.Context, id int, destUser, gitType, mountPath string) error
	GetProjectAccessToken(ctx context.Context, secretOptions *SecretOptions) (*AccessTokenSecretData, error)
}

Jump to

Keyboard shortcuts

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