Documentation
¶
Overview ¶
Package projects contains utilities for working with projects.
Index ¶
Constants ¶
const (
// MinderMetadataVersion is the version of the metadata format.
MinderMetadataVersion = "v1alpha1"
)
Variables ¶
var ( // ErrProjectAlreadyExists is returned when a project with the same name already exists ErrProjectAlreadyExists = errors.New("project already exists") )
var ( // ErrValidationFailed is returned when a project fails validation ErrValidationFailed = fmt.Errorf("validation failed") )
Functions ¶
func SerializeMetadata ¶
SerializeMetadata serializes the given Metadata object into JSON.
func ValidateName ¶
ValidateName validates the given project name.
Types ¶
type Metadata ¶
type Metadata struct {
Version string `json:"version"`
SelfEnrolled bool `json:"self_enrolled"`
// This will be deprecated in favor of PublicMetadataV1.
Description string `json:"description"`
// Public is a field that is meant to be read by other systems.
// It will be exposed to the public, e.g. via a UI.
Public PublicMetadataV1 `json:"public"`
}
Metadata contains metadata relevant for a project.
func NewSelfEnrolledMetadata ¶
NewSelfEnrolledMetadata returns a new Metadata object with the SelfEnrolled field set to true.
type ProjectCreator ¶
type ProjectCreator interface {
// ProvisionSelfEnrolledProject creates the core default components of the project
// (project, marketplace subscriptions, etc.).
ProvisionSelfEnrolledProject(
ctx context.Context,
qtx db.ExtendQuerier,
projectName string,
userSub string,
) (outproj *db.Project, projerr error)
// ProvisionChildProject creates the components of a child project which is nested
// under a parent in the project hierarchy. The parent project is checked for
// existence before creating the child project.
ProvisionChildProject(
ctx context.Context,
qtx db.ExtendQuerier,
parentProjectID uuid.UUID,
projectName string,
) (outproj *db.Project, projerr error)
}
ProjectCreator encapsulates operations for managing projects TODO: There are several follow-ups needed here: 1. Move the delete operations into this interface 2. The interface is very GitHub-specific. It needs to be made more generic.
func NewProjectCreator ¶
func NewProjectCreator(authzClient authz.Client, marketplace marketplaces.Marketplace, profilesCfg *server.DefaultProfilesConfig, featuresCfg *server.FeaturesConfig, ) ProjectCreator
NewProjectCreator creates a new instance of the project creator
type ProjectDeleter ¶
type ProjectDeleter interface {
// CleanUpUnmanagedProjects deletes a project if it has no role assignments left
CleanUpUnmanagedProjects(
ctx context.Context,
subject string,
proj uuid.UUID,
querier db.Querier,
) error
// DeleteProject deletes a project and authorization relationships
DeleteProject(
ctx context.Context,
proj uuid.UUID,
querier db.Querier,
) error
}
ProjectDeleter encapsulates operations for deleting projects This is a separate interface/struct to ProjectCreator to avoid a circular dependency issue.
func NewProjectDeleter ¶
func NewProjectDeleter( authzClient authz.Client, providerManager manager.ProviderManager, ) ProjectDeleter
NewProjectDeleter creates a new instance of the project deleter
type PublicMetadataV1 ¶
type PublicMetadataV1 struct {
Description string `json:"description"`
DisplayName string `json:"display_name"`
}
PublicMetadataV1 contains public metadata relevant for a project.