pluginsettings

package
v0.0.0-kmdagger1 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPluginSettingNotFound = errors.New("plugin setting not found")
)

Functions

This section is empty.

Types

type DTO

type DTO struct {
	ID             int64
	OrgID          int64
	PluginID       string
	PluginVersion  string
	JSONData       map[string]interface{}
	SecureJSONData map[string][]byte
	Enabled        bool
	Pinned         bool
	Updated        time.Time
}

type FakePluginSettings

type FakePluginSettings struct {
	Service

	Plugins map[string]*DTO
}

func (*FakePluginSettings) DecryptedValues

func (ps *FakePluginSettings) DecryptedValues(dto *DTO) map[string]string

DecryptedValues decrypts the encrypted secureJSONData of the provided plugin setting and returns the decrypted values.

func (*FakePluginSettings) GetPluginSettingByPluginID

func (ps *FakePluginSettings) GetPluginSettingByPluginID(ctx context.Context, args *GetByPluginIDArgs) (*DTO, error)

GetPluginSettingByPluginID returns a Plugin Settings by Plugin ID

func (*FakePluginSettings) GetPluginSettings

func (ps *FakePluginSettings) GetPluginSettings(_ context.Context, _ *GetArgs) ([]*InfoDTO, error)

GetPluginSettings returns all Plugin Settings for the provided Org

func (*FakePluginSettings) UpdatePluginSetting

func (ps *FakePluginSettings) UpdatePluginSetting(ctx context.Context, args *UpdateArgs) error

UpdatePluginSetting updates a Plugin Setting

func (*FakePluginSettings) UpdatePluginSettingPluginVersion

func (ps *FakePluginSettings) UpdatePluginSettingPluginVersion(ctx context.Context, args *UpdatePluginVersionArgs) error

UpdatePluginSettingPluginVersion updates a Plugin Setting's plugin version

type GetArgs

type GetArgs struct {
	OrgID int64
}

type GetByPluginIDArgs

type GetByPluginIDArgs struct {
	PluginID string
	OrgID    int64
}

type GetPluginSettingByIdQuery

type GetPluginSettingByIdQuery struct {
	PluginId string
	OrgId    int64
	Result   *PluginSetting
}

type InfoDTO

type InfoDTO struct {
	PluginID      string
	OrgID         int64
	Enabled       bool
	Pinned        bool
	PluginVersion string
}

type PluginSetting

type PluginSetting struct {
	Id             int64
	PluginId       string
	OrgId          int64
	Enabled        bool
	Pinned         bool
	JsonData       map[string]interface{}
	SecureJsonData map[string][]byte
	PluginVersion  string

	Created time.Time
	Updated time.Time
}

type PluginSettingInfo

type PluginSettingInfo struct {
	PluginID      string `xorm:"plugin_id"`
	OrgID         int64  `xorm:"org_id"`
	Enabled       bool   `xorm:"enabled"`
	Pinned        bool   `xorm:"pinned"`
	PluginVersion string `xorm:"plugin_version"`
}

type PluginStateChangedEvent

type PluginStateChangedEvent struct {
	PluginId string
	OrgId    int64
	Enabled  bool
}

type Service

type Service interface {
	// GetPluginSettings returns all Plugin Settings for the provided Org
	GetPluginSettings(ctx context.Context, args *GetArgs) ([]*InfoDTO, error)
	// GetPluginSettingByPluginID returns a Plugin Settings by Plugin ID
	GetPluginSettingByPluginID(ctx context.Context, args *GetByPluginIDArgs) (*DTO, error)
	// UpdatePluginSetting updates a Plugin Setting
	UpdatePluginSetting(ctx context.Context, args *UpdateArgs) error
	// UpdatePluginSettingPluginVersion updates a Plugin Setting's plugin version
	UpdatePluginSettingPluginVersion(ctx context.Context, args *UpdatePluginVersionArgs) error
	// DecryptedValues decrypts the encrypted secureJSONData of the provided plugin setting and
	// returns the decrypted values.
	DecryptedValues(ps *DTO) map[string]string
}

type UpdateArgs

type UpdateArgs struct {
	Enabled                 bool
	Pinned                  bool
	JSONData                map[string]interface{}
	SecureJSONData          map[string]string
	PluginVersion           string
	PluginID                string
	OrgID                   int64
	EncryptedSecureJSONData map[string][]byte
}

type UpdatePluginSettingCmd

type UpdatePluginSettingCmd struct {
	Enabled        bool                   `json:"enabled"`
	Pinned         bool                   `json:"pinned"`
	JsonData       map[string]interface{} `json:"jsonData"`
	SecureJsonData map[string]string      `json:"secureJsonData"`
	PluginVersion  string                 `json:"version"`

	PluginId                string            `json:"-"`
	OrgId                   int64             `json:"-"`
	EncryptedSecureJsonData map[string][]byte `json:"-"`
}

Also acts as api DTO

type UpdatePluginSettingVersionCmd

type UpdatePluginSettingVersionCmd struct {
	PluginVersion string
	PluginId      string `json:"-"`
	OrgId         int64  `json:"-"`
}

specific command, will only update version

type UpdatePluginVersionArgs

type UpdatePluginVersionArgs struct {
	PluginVersion string
	PluginID      string
	OrgID         int64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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