resource

package
v0.0.0-...-3f5d8b5 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StoreName  = "connections"
	PluginName = "resource"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

I HATE THIS. WHY CAN'T I JUST USE THE SAME INSTANCE?????

func NewClient

func NewClient(controller Controller) *Client

func (*Client) AddConnection

func (c *Client) AddConnection(pluginID string, connection types.Connection) error

func (*Client) Create

func (c *Client) Create(
	pluginID, connectionID, key string,
	input rt.CreateInput,
) (*rt.CreateResult, error)

func (*Client) Delete

func (c *Client) Delete(
	pluginID, connectionID, key string,
	input rt.DeleteInput,
) (*rt.DeleteResult, error)

func (*Client) Find

func (c *Client) Find(
	pluginID, connectionID, key string,
	input rt.FindInput,
) (*rt.FindResult, error)

func (*Client) Get

func (c *Client) Get(
	pluginID, connectionID, key string,
	input rt.GetInput,
) (*rt.GetResult, error)

func (*Client) GetConnection

func (c *Client) GetConnection(pluginID, connectionID string) (types.Connection, error)

func (*Client) GetConnectionNamespaces

func (c *Client) GetConnectionNamespaces(pluginID, connectionID string) ([]string, error)

func (*Client) GetDefaultLayout

func (c *Client) GetDefaultLayout(pluginID string) ([]rt.LayoutItem, error)

func (*Client) GetLayout

func (c *Client) GetLayout(pluginID string, layoutID string) ([]rt.LayoutItem, error)

func (*Client) GetResourceDefinition

func (c *Client) GetResourceDefinition(pluginID, typeID string) (rt.ResourceDefinition, error)

func (*Client) GetResourceGroup

func (c *Client) GetResourceGroup(pluginID, groupID string) (rt.ResourceGroup, error)

func (*Client) GetResourceGroups

func (c *Client) GetResourceGroups(pluginID, connectionID string) map[string]rt.ResourceGroup

func (*Client) GetResourceType

func (c *Client) GetResourceType(pluginID, typeID string) (*rt.ResourceMeta, error)

func (*Client) GetResourceTypes

func (c *Client) GetResourceTypes(pluginID, connectionID string) map[string]rt.ResourceMeta

func (*Client) HasResourceType

func (c *Client) HasResourceType(pluginID, typeID string) bool

func (*Client) List

func (c *Client) List(
	pluginID, connectionID, key string,
	input rt.ListInput,
) (*rt.ListResult, error)

func (*Client) ListConnections

func (c *Client) ListConnections(pluginID string) ([]types.Connection, error)

func (*Client) ListPlugins

func (c *Client) ListPlugins() ([]string, error)

func (*Client) LoadConnections

func (c *Client) LoadConnections(pluginID string) ([]types.Connection, error)

func (*Client) RemoveConnection

func (c *Client) RemoveConnection(pluginID, connectionID string) error

func (*Client) SetLayout

func (c *Client) SetLayout(pluginID string, layoutID string, layout []rt.LayoutItem) error

func (*Client) StartConnection

func (c *Client) StartConnection(pluginID, connectionID string) (types.ConnectionStatus, error)

func (*Client) StartConnectionInformer

func (c *Client) StartConnectionInformer(pluginID, connectionID string) error

func (*Client) StopConnection

func (c *Client) StopConnection(pluginID, connectionID string) (types.Connection, error)

func (*Client) StopConnectionInformer

func (c *Client) StopConnectionInformer(pluginID, connectionID string) error

func (*Client) Update

func (c *Client) Update(
	pluginID, connectionID, key string,
	input rt.UpdateInput,
) (*rt.UpdateResult, error)

func (*Client) UpdateConnection

func (c *Client) UpdateConnection(
	pluginID string,
	connection types.Connection,
) (types.Connection, error)

type Controller

type Controller interface {
	internaltypes.ConnectedController
	IClient
}

Controller is a controller that manages the lifecycle of resource plugins. Resource plugins interact with a backend that supplies various entities that can be read, created, updated, and deleted.

Has to satisfy both the internal connected controller type, as well as the external client type.

func NewController

func NewController(logger *zap.SugaredLogger, sp pkgsettings.Provider) Controller

NewController returns a new Controller instance.

type IClient

type IClient interface {
	// ListPlugins returns a list of all the plugins that are registered with the resource controller
	ListPlugins() ([]string, error)

	// Get performs a get requests for a resource against a resource backend plugin.
	// The pluginID should match the name of the plugin in the plugin metadata.
	Get(pluginID, connectionID, key string, input rt.GetInput) (*rt.GetResult, error)

	// List performs a list requests for a resource against a resource backend plugin.
	// The pluginID should match the name of the plugin in the plugin metadata.
	List(pluginID, connectionID, key string, input rt.ListInput) (*rt.ListResult, error)

	// Find performs a find requests for a resource against a resource backend plugin.
	// The pluginID should match the name of the plugin in the plugin metadata.
	Find(pluginID, connectionID, key string, input rt.FindInput) (*rt.FindResult, error)

	// Create performs a create requests for a resource against a resource backend plugin.
	// The pluginID should match the name of the plugin in the plugin metadata.
	Create(pluginID, connectionID, key string, input rt.CreateInput) (*rt.CreateResult, error)

	// Update performs a update requests for a resource against a resource backend plugin.
	// The pluginID should match the name of the plugin in the plugin metadata.
	Update(pluginID, connectionID, key string, input rt.UpdateInput) (*rt.UpdateResult, error)

	// Delete performs a delete requests for a resource against a resource backend plugin.
	// The pluginID should match the name of the plugin in the plugin metadata.
	Delete(pluginID, connectionID, key string, input rt.DeleteInput) (*rt.DeleteResult, error)

	// StartConnection starts a connection for a plugin
	StartConnection(pluginID, connectionID string) (types.ConnectionStatus, error)

	// StopConnection stops a connection for a plugin
	StopConnection(pluginID, connectionID string) (types.Connection, error)

	// LoadConnections loads the connections for the resource provider
	LoadConnections(pluginID string) ([]types.Connection, error)

	// ListConnections returns a list of connections for the plugin.
	// The pluginID should match the name of the plugin in the plugin metadata.
	ListConnections(pluginID string) ([]types.Connection, error)

	// GetConnection returns a connection for the plugin.
	// The pluginID should match the name of the plugin in the plugin metadata.
	GetConnection(pluginID, connectionID string) (types.Connection, error)

	// GetConnectionNamespaces returns a list of connection namespaces for a plugin.
	GetConnectionNamespaces(pluginID, connectionID string) ([]string, error)

	// AddConnection adds a new connection for the plugin.
	// The pluginID should match the name of the plugin in the plugin metadata.
	AddConnection(pluginID string, connection types.Connection) error

	// UpdateConnection updates an existing connection for a plugin
	// The pluginID should match the name of the plugin in the plugin metadata.
	UpdateConnection(pluginID string, connection types.Connection) (types.Connection, error)

	// RemoveConnection removes a connection for a plugin
	// The pluginID should match the name of the plugin in the plugin metadata.
	RemoveConnection(pluginID, connectionID string) error

	// StartConnectionInformer starts an informer for the given connection
	StartConnectionInformer(pluginID, connectionID string) error

	// StopConnectionInformer stops an informer for the given connection
	StopConnectionInformer(pluginID, connectionID string) error

	// GetResourceGroups
	GetResourceGroups(pluginID, connectionID string) map[string]rt.ResourceGroup

	// GetResourceGroup
	GetResourceGroup(pluginID, groupID string) (rt.ResourceGroup, error)

	// GetResourceTypes returns a map of all the resource types that are available to the resource controller
	GetResourceTypes(pluginID, connectionID string) map[string]rt.ResourceMeta

	// GetResourceType returns the resource type information by it's string representation
	// For example, "core::v1::Pod" or "ec2::2012-12-01::EC2Instance"
	GetResourceType(pluginID, typeID string) (*rt.ResourceMeta, error)

	// HasResourceType checks to see if the resource type exists
	HasResourceType(pluginID, typeID string) bool

	// GetResourceDefinition returns the resource definition for a given resource
	GetResourceDefinition(pluginID, typeID string) (rt.ResourceDefinition, error)

	// GetLayout returns the layout for the plugin
	GetLayout(pluginID string, layoutID string) ([]rt.LayoutItem, error)

	// GetDefaultLayout returns the default layout for the plugin
	GetDefaultLayout(pluginID string) ([]rt.LayoutItem, error)

	// SetLayout sets a single layout for a plugin
	SetLayout(pluginID string, layoutID string, layout []rt.LayoutItem) error
}

Client is the system/UI facing client for making resource requests to the resource controller. We don't really want to expose the other methods of the controller to the outside world, so only methods that should exist here are the ones that the UI/other controllers need to interact with.

Jump to

Keyboard shortcuts

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