Documentation ¶
Index ¶
- Variables
- func ErrorEncoder(_ context.Context, err error, w http.ResponseWriter)
- func MakeHandler(svc Service, auth endpoint.Middleware, metrics *o11y.ModuleMetrics, ...) http.Handler
- type InmemStorage
- func (s *InmemStorage) GetModule(_ context.Context, namespace, name, provider, version string) (core.Module, error)
- func (s *InmemStorage) ListModuleVersions(ctx context.Context, namespace, name, provider string) ([]core.Module, error)
- func (s *InmemStorage) MigrateModules(ctx context.Context, dryRun bool) error
- func (s *InmemStorage) UploadModule(ctx context.Context, namespace, name, provider, version string, body io.Reader) (core.Module, error)
- type InmemStorageOption
- type Metadata
- type Middleware
- type Service
- type Spec
- type Storage
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ErrorEncoder ¶
func ErrorEncoder(_ context.Context, err error, w http.ResponseWriter)
ErrorEncoder translates domain specific errors to HTTP status codes
func MakeHandler ¶
func MakeHandler(svc Service, auth endpoint.Middleware, metrics *o11y.ModuleMetrics, instrumentation o11y.Middleware, options ...httptransport.ServerOption) http.Handler
MakeHandler returns a fully initialized http.Handler.
Types ¶
type InmemStorage ¶
type InmemStorage struct {
// contains filtered or unexported fields
}
InmemStorage is a Storage implementation This storage is typically used for testing purposes.
func (*InmemStorage) GetModule ¶
func (s *InmemStorage) GetModule(_ context.Context, namespace, name, provider, version string) (core.Module, error)
GetModule retrieves information about a module from the in-memory storage.
func (*InmemStorage) ListModuleVersions ¶
func (*InmemStorage) MigrateModules ¶
func (s *InmemStorage) MigrateModules(ctx context.Context, dryRun bool) error
type InmemStorageOption ¶
type InmemStorageOption func(*InmemStorage)
InmemStorageOption provides additional options for the InmemStorage.
func WithInmemArchiveFormat ¶
func WithInmemArchiveFormat(archiveFormat string) InmemStorageOption
WithInmemArchiveFormat configures the module archive format (zip, tar, tgz, etc.)
type Metadata ¶
type Metadata struct { Namespace string `hcl:"namespace" json:"namespace"` Name string `hcl:"name" json:"name"` Provider string `hcl:"provider" json:"provider"` Version string `hcl:"version" json:"version"` }
Metadata provides information about a given module version.
type Middleware ¶
Middleware is a Service middleware.
func LoggingMiddleware ¶
func LoggingMiddleware() Middleware
LoggingMiddleware is a logging Service middleware.
type Service ¶
type Service interface { GetModule(ctx context.Context, namespace, name, provider, version string) (core.Module, error) ListModuleVersions(ctx context.Context, namespace, name, provider string) ([]core.Module, error) }
Service implements the Module Registry Protocol. For more information see: https://www.terraform.io/docs/internals/module-registry-protocol.html.
func NewService ¶
NewService returns a fully initialized Service.
type Spec ¶
type Spec struct {
Metadata Metadata `hcl:"metadata,block" json:"metadata"`
}
Spec represents a module spec with metadata.
type Storage ¶
type Storage interface { // GetModule should return an ErrModuleNotFound error if the requested module version cannot be found GetModule(ctx context.Context, namespace, name, provider, version string) (core.Module, error) ListModuleVersions(ctx context.Context, namespace, name, provider string) ([]core.Module, error) UploadModule(ctx context.Context, namespace, name, provider, version string, body io.Reader) (core.Module, error) }
Storage represents the repository of Terraform modules.
func NewInmemStorage ¶
func NewInmemStorage(options ...InmemStorageOption) Storage
NewInmemStorage returns a fully initialized in-memory storage.