pluginregistry

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package pluginregistry implements a service for interacting with the plugin registry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreatePluginInput

type CreatePluginInput struct {
	Name           string
	OrganizationID string
	RepositoryURL  string
	Private        bool
}

CreatePluginInput is the input for the CreatePlugin method

type CreatePluginPlatformInput

type CreatePluginPlatformInput struct {
	PluginVersionID string
	OperatingSystem string
	Architecture    string
	Filename        string
	SHASum          string
}

CreatePluginPlatformInput is the input for the CreatePluginPlatform method

type CreatePluginVersionInput

type CreatePluginVersionInput struct {
	PluginID        string
	SemanticVersion string
	Protocols       []string
}

CreatePluginVersionInput is the input for the CreatePluginVersion method

type DeletePluginInput

type DeletePluginInput struct {
	Version *int
	ID      string
}

DeletePluginInput is the input for the DeletePlugin method

type DeletePluginPlatformInput

type DeletePluginPlatformInput struct {
	Version *int
	ID      string
}

DeletePluginPlatformInput is the input for the DeletePluginPlatform method

type DeletePluginVersionInput

type DeletePluginVersionInput struct {
	Version *int
	ID      string
}

DeletePluginVersionInput is the input for the DeletePluginVersion method

type GetPluginPlatformsInput

type GetPluginPlatformsInput struct {
	// Sort specifies the field to sort on and direction
	Sort *db.PluginPlatformSortableField
	// PaginationOptions supports cursor based pagination
	PaginationOptions *pagination.Options
	// PluginVersionID is the plugin version id to filter by
	PluginVersionID *string
	// PluginID is the plugin id to filter by
	PluginID *string
	// OperatingSystem is the operating system to filter by
	OperatingSystem *string
	// Architecture is the architecture to filter by
	Architecture *string
	// BinaryUploaded specifies whether to return only plugin platforms with binaries uploaded
	BinaryUploaded *bool
}

GetPluginPlatformsInput is the input for the GetPluginPlatforms method

type GetPluginVersionDocFileInput

type GetPluginVersionDocFileInput struct {
	PluginVersionID string
	FilePath        string
}

GetPluginVersionDocFileInput is the input for getting a plugin version doc file

type GetPluginVersionsInput

type GetPluginVersionsInput struct {
	// Sort specifies the field to sort on and direction
	Sort *db.PluginVersionSortableField
	// PaginationOptions supports cursor based pagination
	PaginationOptions *pagination.Options
	// SemanticVersion is the semantic version to filter by
	SemanticVersion *string
	// SHASumsUploaded specifies whether to return only plugin versions with SHASums uploaded
	SHASumsUploaded *bool
	// Latest specifies whether to return only the latest version
	Latest *bool
	// PluginID is the plugin id to filter by
	PluginID string
}

GetPluginVersionsInput is the input for the GetPluginVersions method

type GetPluginsInput

type GetPluginsInput struct {
	// Sort specifies the field to sort on and direction
	Sort *db.PluginSortableField
	// PaginationOptions supports cursor based pagination
	PaginationOptions *pagination.Options
	// OrganizationID is the organization id to filter by
	OrganizationID *string
	// Search is the search term to filter by
	Search *string
}

GetPluginsInput is the input for the GetPlugins method

type MockRegistryStore

type MockRegistryStore struct {
	mock.Mock
}

MockRegistryStore is an autogenerated mock type for the RegistryStore type

func NewMockRegistryStore

func NewMockRegistryStore(t mockConstructorTestingTNewMockRegistryStore) *MockRegistryStore

NewMockRegistryStore creates a new instance of MockRegistryStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockRegistryStore) GetPluginPlatformBinaryPresignedURL

func (_m *MockRegistryStore) GetPluginPlatformBinaryPresignedURL(ctx context.Context, pluginPlatform *models.PluginPlatform, pluginVersion *models.PluginVersion, plugin *models.Plugin) (string, error)

GetPluginPlatformBinaryPresignedURL provides a mock function with given fields: ctx, pluginPlatform, pluginVersion, plugin

func (*MockRegistryStore) GetPluginVersionDocFile

func (_m *MockRegistryStore) GetPluginVersionDocFile(ctx context.Context, pluginVersion *models.PluginVersion, plugin *models.Plugin, filePath string) (io.ReadCloser, error)

GetPluginVersionDocFile provides a mock function with given fields: ctx, pluginVersion, plugin, filePath

func (*MockRegistryStore) GetPluginVersionReadme

func (_m *MockRegistryStore) GetPluginVersionReadme(ctx context.Context, pluginVersion *models.PluginVersion, plugin *models.Plugin) (io.ReadCloser, error)

GetPluginVersionReadme provides a mock function with given fields: ctx, pluginVersion, plugin

func (*MockRegistryStore) GetPluginVersionSHASumsPresignedURL

func (_m *MockRegistryStore) GetPluginVersionSHASumsPresignedURL(ctx context.Context, pluginVersion *models.PluginVersion, plugin *models.Plugin) (string, error)

GetPluginVersionSHASumsPresignedURL provides a mock function with given fields: ctx, pluginVersion, plugin

func (*MockRegistryStore) UploadPluginPlatformBinary

func (_m *MockRegistryStore) UploadPluginPlatformBinary(ctx context.Context, pluginPlatform *models.PluginPlatform, pluginVersion *models.PluginVersion, plugin *models.Plugin, body io.Reader) error

UploadPluginPlatformBinary provides a mock function with given fields: ctx, pluginPlatform, pluginVersion, plugin, body

func (*MockRegistryStore) UploadPluginVersionDocFile

func (_m *MockRegistryStore) UploadPluginVersionDocFile(ctx context.Context, pluginVersion *models.PluginVersion, plugin *models.Plugin, filePath string, body io.Reader) error

UploadPluginVersionDocFile provides a mock function with given fields: ctx, pluginVersion, plugin, filePath, body

func (*MockRegistryStore) UploadPluginVersionReadme

func (_m *MockRegistryStore) UploadPluginVersionReadme(ctx context.Context, pluginVersion *models.PluginVersion, plugin *models.Plugin, body io.Reader) error

UploadPluginVersionReadme provides a mock function with given fields: ctx, pluginVersion, plugin, body

func (*MockRegistryStore) UploadPluginVersionSHASums

func (_m *MockRegistryStore) UploadPluginVersionSHASums(ctx context.Context, pluginVersion *models.PluginVersion, plugin *models.Plugin, body io.Reader) error

UploadPluginVersionSHASums provides a mock function with given fields: ctx, pluginVersion, plugin, body

func (*MockRegistryStore) UploadPluginVersionSchema

func (_m *MockRegistryStore) UploadPluginVersionSchema(ctx context.Context, pluginVersion *models.PluginVersion, plugin *models.Plugin, body io.Reader) error

UploadPluginVersionSchema provides a mock function with given fields: ctx, pluginVersion, plugin, body

type PluginPlatformDownloadURLs

type PluginPlatformDownloadURLs struct {
	DownloadURL string
	SHASumsURL  string
}

PluginPlatformDownloadURLs contains the signed URLs for downloading a plugin platform

type RegistryStore

type RegistryStore interface {
	UploadPluginPlatformBinary(
		ctx context.Context,
		pluginPlatform *models.PluginPlatform,
		pluginVersion *models.PluginVersion,
		plugin *models.Plugin,
		body io.Reader,
	) error
	UploadPluginVersionReadme(
		ctx context.Context,
		pluginVersion *models.PluginVersion,
		plugin *models.Plugin,
		body io.Reader,
	) error
	UploadPluginVersionSchema(
		ctx context.Context,
		pluginVersion *models.PluginVersion,
		plugin *models.Plugin,
		body io.Reader,
	) error
	UploadPluginVersionDocFile(
		ctx context.Context,
		pluginVersion *models.PluginVersion,
		plugin *models.Plugin,
		filePath string,
		body io.Reader,
	) error
	UploadPluginVersionSHASums(
		ctx context.Context,
		pluginVersion *models.PluginVersion,
		plugin *models.Plugin,
		body io.Reader,
	) error
	GetPluginVersionDocFile(
		ctx context.Context,
		pluginVersion *models.PluginVersion,
		plugin *models.Plugin,
		filePath string,
	) (io.ReadCloser, error)
	GetPluginVersionReadme(
		ctx context.Context,
		pluginVersion *models.PluginVersion,
		plugin *models.Plugin,
	) (io.ReadCloser, error)
	GetPluginPlatformBinaryPresignedURL(
		ctx context.Context,
		pluginPlatform *models.PluginPlatform,
		pluginVersion *models.PluginVersion,
		plugin *models.Plugin,
	) (string, error)
	GetPluginVersionSHASumsPresignedURL(
		ctx context.Context,
		pluginVersion *models.PluginVersion,
		plugin *models.Plugin,
	) (string, error)
}

RegistryStore interface encapsulates the logic for saving plugin binaries and metadata

func NewRegistryStore

func NewRegistryStore(objectStore objectstore.ObjectStore) RegistryStore

NewRegistryStore creates an instance of the RegistryStore interface

type Service

type Service interface {
	GetPluginByID(ctx context.Context, id string) (*models.Plugin, error)
	GetPluginByPRN(ctx context.Context, prn string) (*models.Plugin, error)
	GetPlugins(ctx context.Context, input *GetPluginsInput) (*db.PluginsResult, error)
	GetPluginsByIDs(ctx context.Context, idList []string) ([]models.Plugin, error)
	GetPluginVersionByID(ctx context.Context, id string) (*models.PluginVersion, error)
	GetPluginVersionByPRN(ctx context.Context, prn string) (*models.PluginVersion, error)
	GetPluginVersions(ctx context.Context, input *GetPluginVersionsInput) (*db.PluginVersionsResult, error)
	GetPluginVersionsByIDs(ctx context.Context, idList []string) ([]models.PluginVersion, error)
	GetPluginVersionDocFile(ctx context.Context, input *GetPluginVersionDocFileInput) (string, error)
	GetPluginVersionReadme(ctx context.Context, pluginVersion *models.PluginVersion) (string, error)
	GetPluginPlatformByID(ctx context.Context, id string) (*models.PluginPlatform, error)
	GetPluginPlatformByPRN(ctx context.Context, prn string) (*models.PluginPlatform, error)
	GetPluginPlatforms(ctx context.Context, input *GetPluginPlatformsInput) (*db.PluginPlatformsResult, error)
	GetPluginPlatformDownloadURLs(ctx context.Context, pluginPlatformID string) (*PluginPlatformDownloadURLs, error)
	CreatePlugin(ctx context.Context, input *CreatePluginInput) (*models.Plugin, error)
	CreatePluginVersion(ctx context.Context, input *CreatePluginVersionInput) (*models.PluginVersion, error)
	CreatePluginPlatform(ctx context.Context, input *CreatePluginPlatformInput) (*models.PluginPlatform, error)
	UpdatePlugin(ctx context.Context, input *UpdatePluginInput) (*models.Plugin, error)
	UploadPluginPlatformBinary(ctx context.Context, pluginPlatformID string, body io.Reader) error
	UploadPluginVersionDocFile(ctx context.Context, input *UploadPluginVersionDocFileInput) error
	UploadPluginVersionReadme(ctx context.Context, pluginVersionID string, body io.Reader) error
	UploadPluginVersionSchema(ctx context.Context, pluginVersionID string, body io.Reader) error
	UploadPluginVersionSHASums(ctx context.Context, pluginVersionID string, body io.Reader) error
	DeletePlugin(ctx context.Context, input *DeletePluginInput) error
	DeletePluginVersion(ctx context.Context, input *DeletePluginVersionInput) error
	DeletePluginPlatform(ctx context.Context, input *DeletePluginPlatformInput) error
}

Service is the interface for the plugin registry service

func NewService

func NewService(
	logger logger.Logger,
	dbClient *db.Client,
	registryStore RegistryStore,
	limitChecker limits.LimitChecker,
	activityService activityevent.Service,
) Service

NewService creates a new instance of the plugin registry service

type UpdatePluginInput

type UpdatePluginInput struct {
	RepositoryURL *string
	Private       *bool
	Version       *int
	ID            string
}

UpdatePluginInput is the input for the UpdatePlugin method

type UploadPluginVersionDocFileInput

type UploadPluginVersionDocFileInput struct {
	Body            io.Reader
	PluginVersionID string
	Category        models.PluginVersionDocCategory
	Subcategory     string
	Title           string
	Name            string
}

UploadPluginVersionDocFileInput is the input for uploading a plugin version doc file

func (*UploadPluginVersionDocFileInput) FilePath

func (u *UploadPluginVersionDocFileInput) FilePath() (string, error)

FilePath returns the file path for the doc file

Jump to

Keyboard shortcuts

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