module

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: MPL-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package module is reponsible for registry modules

Index

Constants

View Source
const (
	ModuleStatusPending       ModuleStatus = "pending"
	ModuleStatusNoVersionTags ModuleStatus = "no_version_tags"
	ModuleStatusSetupFailed   ModuleStatus = "setup_failed"
	ModuleStatusSetupComplete ModuleStatus = "setup_complete"

	ModuleVersionStatusPending             ModuleVersionStatus = "pending"
	ModuleVersionStatusCloning             ModuleVersionStatus = "cloning"
	ModuleVersionStatusCloneFailed         ModuleVersionStatus = "clone_failed"
	ModuleVersionStatusRegIngressReqFailed ModuleVersionStatus = "reg_ingress_req_failed"
	ModuleVersionStatusRegIngressing       ModuleVersionStatus = "reg_ingressing"
	ModuleVersionStatusRegIngressFailed    ModuleVersionStatus = "reg_ingress_failed"
	ModuleVersionStatusOK                  ModuleVersionStatus = "ok"
)

Variables

View Source
var ErrInvalidModuleRepo = errors.New("invalid repository name for module")

Functions

This section is empty.

Types

type CreateModuleVersionOptions

type CreateModuleVersionOptions struct {
	ModuleID resource.TfeID
	Version  string
}

type CreateOptions

type CreateOptions struct {
	Name         string
	Provider     string
	Organization organization.Name
}

type GetModuleOptions

type GetModuleOptions struct {
	Name         string            `schema:"name,required"`
	Provider     string            `schema:"provider,required"`
	Organization organization.Name `schema:"organization,required"`
}

type ListOptions added in v0.3.17

type ListOptions struct {
	Organization organization.Name `schema:"organization_name,required"` // filter by organization name
	Providers    []string          `schema:"search[providers]"`          // filter by providers (OR boolean logic)
}

type Module

type Module struct {
	ID           resource.TfeID `db:"module_id"`
	CreatedAt    time.Time      `db:"created_at"`
	UpdatedAt    time.Time      `db:"updated_at"`
	Name         string
	Provider     string
	Status       ModuleStatus
	Organization organization.Name       `db:"organization_name"` // Module belongs to an organization
	Versions     []ModuleVersion         `db:"module_versions"`   // versions sorted in descending order
	Connection   *connections.Connection // optional vcs repo connection
}

func (*Module) AvailableVersions

func (m *Module) AvailableVersions() (avail []ModuleVersion)

func (*Module) Latest

func (m *Module) Latest() *ModuleVersion

Latest retrieves the latest version, which is the greatest version with an ok status. If there is no such version, nil is returned.

func (*Module) LogValue

func (m *Module) LogValue() slog.Value

func (*Module) Version

func (m *Module) Version(v string) *ModuleVersion

type ModuleList

type ModuleList struct {
	*resource.Pagination
	Items []*Module
}

type ModuleStatus

type ModuleStatus string

type ModuleVersion

type ModuleVersion struct {
	ID          resource.TfeID `db:"module_version_id"`
	Version     string
	CreatedAt   time.Time `db:"created_at"`
	UpdatedAt   time.Time `db:"updated_at"`
	Status      ModuleVersionStatus
	StatusError *string        `db:"status_error"`
	ModuleID    resource.TfeID `db:"module_id"`
}

ModuleVersion is a version of a module.

NOTE: field order must match postgres table column order.

func (*ModuleVersion) LogValue added in v0.1.10

func (v *ModuleVersion) LogValue() slog.Value

type ModuleVersionStatus

type ModuleVersionStatus string

type Options

type Options struct {
	logr.Logger

	*sql.DB
	*internal.HostnameService
	*surl.Signer

	Authorizer         *authz.Authorizer
	RepohookService    *repohooks.Service
	VCSProviderService *vcs.Service
	ConnectionsService *connections.Service
	VCSEventSubscriber vcs.Subscriber
}

type PublishOptions

type PublishOptions struct {
	Repo          Repo
	VCSProviderID resource.TfeID
}

type PublishVersionOptions

type PublishVersionOptions struct {
	ModuleID resource.TfeID
	Version  string
	Ref      string
	Repo     Repo
	Client   vcs.Client
}

type Repo

type Repo vcs.Repo

Repo is the path of repository for a module. It is expected to follow a certain format, which varies according to the cloud providing the Repo, but it should always end with '/<identifier>-<name>-<provider>', with name and provider being used to set the name and provider of the module.

func (Repo) Split

func (r Repo) Split() (name, provider string, err error)

type Service

type Service struct {
	logr.Logger

	*authz.Authorizer
	// contains filtered or unexported fields
}

func NewService

func NewService(opts Options) *Service

func (*Service) AddHandlers added in v0.2.2

func (s *Service) AddHandlers(r *mux.Router)

func (*Service) CreateModule

func (s *Service) CreateModule(ctx context.Context, opts CreateOptions) (*Module, error)

func (*Service) CreateVersion

func (s *Service) CreateVersion(ctx context.Context, opts CreateModuleVersionOptions) (*ModuleVersion, error)

func (*Service) DeleteModule

func (s *Service) DeleteModule(ctx context.Context, id resource.TfeID) (*Module, error)

func (*Service) GetModule

func (s *Service) GetModule(ctx context.Context, opts GetModuleOptions) (*Module, error)

func (*Service) GetModuleByConnection added in v0.1.14

func (s *Service) GetModuleByConnection(ctx context.Context, vcsProviderID resource.TfeID, repoPath vcs.Repo) (*Module, error)

func (*Service) GetModuleByID

func (s *Service) GetModuleByID(ctx context.Context, id resource.TfeID) (*Module, error)

func (*Service) GetModuleInfo

func (s *Service) GetModuleInfo(ctx context.Context, versionID resource.TfeID) (*TerraformModule, error)

func (*Service) ListModules

func (s *Service) ListModules(ctx context.Context, opts ListOptions) ([]*Module, error)

func (*Service) ListProviders added in v0.4.8

func (s *Service) ListProviders(ctx context.Context, organization organization.Name) ([]string, error)

func (*Service) PublishModule

func (s *Service) PublishModule(ctx context.Context, opts PublishOptions) (*Module, error)

PublishModule publishes a new module from a VCS repository, enumerating through its git tags and releasing a module version for each tag.

func (*Service) PublishVersion

func (s *Service) PublishVersion(ctx context.Context, opts PublishVersionOptions) error

PublishVersion publishes a module version, retrieving its contents from a repository and uploading it to the module store.

type TerraformModule

type TerraformModule struct {
	*tfconfig.Module
	// contains filtered or unexported fields
}

TerraformModule is a module of terraform configuration

func UnmarshalTerraformModule added in v0.4.8

func UnmarshalTerraformModule(tarball []byte) (*TerraformModule, error)

func (*TerraformModule) GetReadme added in v0.4.8

func (t *TerraformModule) GetReadme() []byte

GetReadme returns the module's readme content

type UpdateModuleVersionStatusOptions

type UpdateModuleVersionStatusOptions struct {
	ID     resource.TfeID
	Status ModuleVersionStatus
	Error  string
}

Jump to

Keyboard shortcuts

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