host

package
v0.10.5 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package host provides a plugin type used to interface with boundary's host related resources. Additionally it provides a repository for performing CRUDL and custom operations on this plugin type.

Index

Constants

View Source
const (
	PluginPrefix = "pl"
)

PublicId prefixes for the resources in the plugin package.

Variables

This section is empty.

Functions

func GetOpts

func GetOpts(opt ...Option) options

GetOpts - iterate the inbound Options and return a struct

Types

type Option

type Option func(*options)

Option - how Options are passed as arguments.

func WithDescription

func WithDescription(desc string) Option

WithDescription provides an optional description.

func WithLimit

func WithLimit(l int) Option

WithLimit provides an option to provide a limit. Intentionally allowing negative integers. If WithLimit < 0, then unlimited results are returned. If WithLimit == 0, then default limits are used for results.

func WithName

func WithName(name string) Option

WithName provides an optional name.

func WithPublicId

func WithPublicId(with string) Option

WithPublicId provides an optional specific public ID

type Plugin

type Plugin struct {
	*store.Plugin
	// contains filtered or unexported fields
}

A Plugin enables additional logic to be used by boundary. It is owned by a scope.

func NewPlugin

func NewPlugin(opt ...Option) *Plugin

NewPlugin creates a new in memory Plugin assigned to the global scope. Name, Description are the only allowed option. All other options are ignored.

func TestPlugin

func TestPlugin(t testing.TB, conn *db.DB, name string) *Plugin

func (*Plugin) SetTableName

func (c *Plugin) SetTableName(n string)

SetTableName sets the table name. If the caller attempts to set the name to "" the name will be reset to the default name.

func (*Plugin) TableName

func (c *Plugin) TableName() string

TableName returns the table name for the host plugin.

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

A Repository stores and retrieves the persistent types in the host package. It is not safe to use a repository concurrently.

func NewRepository

func NewRepository(r db.Reader, w db.Writer, kms *kms.Kms, opt ...Option) (*Repository, error)

NewRepository creates a new Repository. The returned repository should only be used for one transaction and it is not safe for concurrent go routines to access it. WithLimit option is used as a repo wide default limit applied to all ListX methods.

func (*Repository) CreatePlugin

func (r *Repository) CreatePlugin(ctx context.Context, p *Plugin, opt ...Option) (*Plugin, error)

CreatePlugin inserts p into the repository and returns a new Plugin containing the plugin's PublicId. p is not changed. p must contain a valid ScopeID. p must not contain a PublicId. The PublicId is generated and assigned by this method. opt is ignored.

Both p.Name and p.Description are optional. If p.Name is set, it must be unique within p.ScopeID.

Both p.CreateTime and c.UpdateTime are ignored.

func (*Repository) ListPlugins

func (r *Repository) ListPlugins(ctx context.Context, scopeIds []string, opt ...Option) ([]*Plugin, error)

ListPlugins returns a slice of Plugins for the scope IDs. WithLimit is the only option supported.

func (*Repository) LookupPlugin

func (r *Repository) LookupPlugin(ctx context.Context, id string, _ ...Option) (*Plugin, error)

LookupPlugin returns the Plugin for id. Returns nil, nil if no Plugin is found for id.

func (*Repository) LookupPluginByName

func (r *Repository) LookupPluginByName(ctx context.Context, name string, _ ...Option) (*Plugin, error)

LookupPluginByName returns the Plugin for a given name. Returns nil, nil if no Plugin is found with that plugin name.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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