Documentation ¶
Index ¶
- Constants
- Variables
- func LoadPluginMarkdown(path string) (string, error)
- func LoadPluginMetadata(path string) (config.PluginMeta, error)
- func SerializePluginContext(pc *PluginContext) (string, error)
- func WithConnection(ctx context.Context, c *Connection) context.Context
- func WithPluginContext(ctx context.Context, pluginContext *PluginContext) context.Context
- type Connection
- func (c *Connection) GetData() map[string]interface{}
- func (c *Connection) GetDataKey(key string) (interface{}, bool)
- func (c *Connection) GetSensitiveData() map[string]interface{}
- func (c *Connection) GetSensitiveDataKey(key string) (interface{}, bool)
- func (c *Connection) IsAuthed() bool
- func (c *Connection) SetData(data map[string]interface{})
- func (c *Connection) SetDataKey(key string, value interface{})
- func (c *Connection) SetSensitiveData(data map[string]interface{})
- func (c *Connection) SetSensitiveDataKey(key string, value interface{})
- type ConnectionContext
- type ConnectionOpts
- type ConnectionStatus
- type ConnectionStatusCode
- type Plugin
- type PluginContext
- func DeserializePluginContext(data string) (*PluginContext, error)
- func NewPluginContext(ctx context.Context, requester string, pluginConfig settings.Provider, ...) *PluginContext
- func NewPluginContextFromCtx(ctx context.Context) *PluginContext
- func NewPluginContextWithConnection(ctx context.Context, requester string, pluginConfig settings.Provider, ...) *PluginContext
- func PluginContextFromContext(ctx context.Context) *PluginContext
- type PluginType
- type RequestOptions
- type ResourceContext
- type VisualComponentList
- type VisualResourceComponent
Constants ¶
const ( DefaultTimeout = 10 * time.Second DefaultMaxRetries = 3 DefaultBackoffInterval = 1 * time.Second )
const (
ConnectionDefaultExpiryTime = time.Hour * 24
)
Variables ¶
var AllConnectionStatusCodes = []struct { Value ConnectionStatusCode TSName string }{ {ConnectionStatusUnknown, "UNKNOWN"}, {ConnectionStatusConnected, "CONNECTED"}, {ConnectionStatusDisconnected, "DISCONNECTED"}, {ConnectionStatusPending, "PENDING"}, {ConnectionStatusFailed, "FAILED"}, {ConnectionStatusError, "ERROR"}, {ConnectionStatusUnauthorized, "UNAUTHORIZED"}, {ConnectionStatusForbidden, "FORBIDDEN"}, {ConnectionStatusBadRequest, "BAD_REQUEST"}, {ConnectionStatusNotFound, "NOT_FOUND"}, {ConnectionStatusTimeout, "TIMEOUT"}, {ConnectionStatusUnavailable, "UNAVAILABLE"}, {ConnectionStatusRequestEntityTooLarge, "REQUEST_ENTITY_TOO_LARGE"}, }
AllConnectionStatusCodes is a list of all setting types. Necessary for Wails to bind the enums.
Functions ¶
func LoadPluginMarkdown ¶
LoadPluginMarkdown loads the plugin markdown from the filesystem.
func LoadPluginMetadata ¶
func LoadPluginMetadata(path string) (config.PluginMeta, error)
LoadPluginMetadata loads the metadata for a plugin from the given path.
func SerializePluginContext ¶
func SerializePluginContext(pc *PluginContext) (string, error)
SerializePluginContext serializes the PluginContext into a JSON string. Used to pass the context between the IDE and the plugin.
func WithConnection ¶
func WithConnection(ctx context.Context, c *Connection) context.Context
func WithPluginContext ¶
func WithPluginContext(ctx context.Context, pluginContext *PluginContext) context.Context
Types ¶
type Connection ¶
type Connection struct { // LastRefresh is the time when the auth context was last refreshed // +optional LastRefresh time.Time `json:"last_refresh"` // Data is an optional map of arbitrary data that can be used to store additional information about the connection, // such as credential file locations, etc. // // This data is exposed to the user in the UI under the settings panel for the namespace. If the data is sensitive, // it should be stored in the SensitiveData field. // +optional Data map[string]interface{} `json:"data"` // Labels is a map of arbitrary key-value pairs that can be used to store additional information about the connection. // Users will likely use and modify these labels to help organize and categorize their connections. Labels map[string]interface{} `json:"labels"` // ID is the unique identifier for the connection that makes sense to the plugin implementation. // +required ID string `json:"id"` // UID is an autogenerated unique identifier for the connection that the IDE will use to identify and track. UID string `json:"uid"` // Name is the readable name of the connection. Editable by the user. // +required Name string `json:"name"` // Description is an optional description of the connection. This is primarily for the user to customize // the visual representation of the connection. // +optional Description string `json:"description"` // Avatar is an optional image that can be used to represent the connection. This is primarily for the user to customize // the visual representation of the connection in the UI. // +optional Avatar string `json:"avatar"` // ExpiryTime is the amount of time before the connection expires. // +optional ExpiryTime time.Duration `json:"expiry_time"` // contains filtered or unexported fields }
Connection holds the current state (and configuration data) for an connection target for a plugin (e.g. a Kubernetes cluster, a cloud role, etc)
This will be passed within the PluginContext so that it may be used across all requests, and data here not within the sensitiveStore will be exposed to the user in the UI for the plugin.
func ConnectionFromContext ¶
func ConnectionFromContext(ctx context.Context) *Connection
func NewConnection ¶
func NewConnection(opts ConnectionOpts) (*Connection, error)
func (*Connection) GetData ¶
func (c *Connection) GetData() map[string]interface{}
func (*Connection) GetDataKey ¶
func (c *Connection) GetDataKey(key string) (interface{}, bool)
func (*Connection) GetSensitiveData ¶
func (c *Connection) GetSensitiveData() map[string]interface{}
func (*Connection) GetSensitiveDataKey ¶
func (c *Connection) GetSensitiveDataKey(key string) (interface{}, bool)
func (*Connection) IsAuthed ¶
func (c *Connection) IsAuthed() bool
IsAuthed returns whether the auth context is authenticated or not.
func (*Connection) SetData ¶
func (c *Connection) SetData(data map[string]interface{})
func (*Connection) SetDataKey ¶
func (c *Connection) SetDataKey(key string, value interface{})
func (*Connection) SetSensitiveData ¶
func (c *Connection) SetSensitiveData(data map[string]interface{})
func (*Connection) SetSensitiveDataKey ¶
func (c *Connection) SetSensitiveDataKey(key string, value interface{})
type ConnectionContext ¶
type ConnectionContext Connection
type ConnectionOpts ¶
type ConnectionOpts struct { // Data is an optional map of arbitrary data that can be used to store additional information about the namespace. Data map[string]interface{} // SensitiveData is an optional map of arbitrary data that can be used to store additional information about the SensitiveData map[string]interface{} // Labels is a map of arbitrary key-value pairs that can be used to store additional information about the namespace. Labels map[string]interface{} // ID is the unique identifier for the authorization context that makes sense to the ID string // UID is an autogenerated unique identifier for the authorization context that the IDE. // will use to identify the authorization context. UID string // Name is the readable name of the namespace. Name string // Description is an optional description of the namespace. This is primarily for the user to customize Description string // Avatar is an optional image that can be used to represent the namespace. This is primarily for the user to customize Avatar string // ExpiryTime is the amount of time before the auth context expires ExpiryTime time.Duration }
type ConnectionStatus ¶
type ConnectionStatus struct { // Connection is the connection that the status is for. Connection *Connection `json:"connection"` // StatusCode is the status code of the connection status. Status ConnectionStatusCode `json:"status"` // Error is the error that occurred when checking the connection status. Error string `json:"error"` // Message is a human readable message that describes the status. Details string `json:"details"` }
type ConnectionStatusCode ¶
type ConnectionStatusCode string
const ( ConnectionStatusUnknown ConnectionStatusCode = "UNKNOWN" ConnectionStatusConnected ConnectionStatusCode = "CONNECTED" ConnectionStatusDisconnected ConnectionStatusCode = "DISCONNECTED" ConnectionStatusPending ConnectionStatusCode = "PENDING" ConnectionStatusFailed ConnectionStatusCode = "FAILED" ConnectionStatusError ConnectionStatusCode = "ERROR" ConnectionStatusForbidden ConnectionStatusCode = "FORBIDDEN" ConnectionStatusBadRequest ConnectionStatusCode = "BAD_REQUEST" ConnectionStatusNotFound ConnectionStatusCode = "NOT_FOUND" ConnectionStatusTimeout ConnectionStatusCode = "TIMEOUT" ConnectionStatusRequestEntityTooLarge ConnectionStatusCode = "REQUEST_ENTITY_TOO_LARGE" )
type Plugin ¶
type Plugin struct { ID string `json:"id"` Metadata config.PluginMeta `json:"metadata"` Config config.PluginConfig `json:"config"` Enabled bool `json:"enabled"` Running bool `json:"running"` DevMode bool `json:"devMode"` DevPath string `json:"devPath"` Loading bool `json:"loading"` LoadError string `json:"loadError"` Capabilities []PluginType `json:"capabilities"` RPCClient plugin.ClientProtocol `json:"-"` PluginClient *plugin.Client `json:"-"` }
Plugin represents a plugin that is installed and managed by the plugin manager.
func (*Plugin) GetRPCClient ¶
func (p *Plugin) GetRPCClient() interface{}
func (*Plugin) HasCapability ¶
func (p *Plugin) HasCapability(capability PluginType) bool
func (*Plugin) SetDisabled ¶
func (p *Plugin) SetDisabled()
func (*Plugin) SetEnabled ¶
func (p *Plugin) SetEnabled()
type PluginContext ¶
type PluginContext struct { // Current context Context context.Context `json:"-"` // RequestOptions are the options that were set for the request. RequestOptions *RequestOptions `json:"request_options"` // Connection holds the identifier of the auth context for the plugin. Connection *Connection `json:"connection"` // The resource context for the request, if available ResourceContext *ResourceContext `json:"resource_context"` // The plugin settings for the request PluginConfig settings.Provider `json:"-"` // GlobalSettings are settings that are accessible to all plugins, taken // from the global settings in the IDE section GlobalConfig *config.GlobalConfig `json:"global_config"` // Unique ID for the request RequestID string `json:"request_id"` // The ID of the requester RequesterID string `json:"requester_id"` }
PluginContext holds contextual data for requests made to a plugin.
func DeserializePluginContext ¶
func DeserializePluginContext(data string) (*PluginContext, error)
DeserializePluginContext deserializes the JSON string back into a PluginContext. Used to pass the context between the IDE and the plugin.
func NewPluginContext ¶
func NewPluginContext( ctx context.Context, requester string, pluginConfig settings.Provider, globalConfig *config.GlobalConfig, resourceContext *ResourceContext, ) *PluginContext
Construct a new plugin context with the given requester, resource key, and resource context.
func NewPluginContextFromCtx ¶
func NewPluginContextFromCtx(ctx context.Context) *PluginContext
func NewPluginContextWithConnection ¶
func NewPluginContextWithConnection( ctx context.Context, requester string, pluginConfig settings.Provider, globalConfig *config.GlobalConfig, connection *Connection, ) *PluginContext
Construct a new plugin context with a valid connection.
func PluginContextFromContext ¶
func PluginContextFromContext(ctx context.Context) *PluginContext
func (*PluginContext) IsAuthenticated ¶
func (c *PluginContext) IsAuthenticated() bool
func (*PluginContext) SetConnection ¶
func (c *PluginContext) SetConnection(authContext *Connection)
func (*PluginContext) SetResourceContext ¶
func (c *PluginContext) SetResourceContext(resourceContext *ResourceContext)
func (*PluginContext) SetSettingsProvider ¶
func (c *PluginContext) SetSettingsProvider(provider settings.Provider)
type PluginType ¶
type PluginType int
const ( ExecutorPlugin PluginType = iota FilesystemPlugin LogPlugin MetricPlugin ReporterPlugin ResourcePlugin SettingsPlugin // Special plugin capabity that allow for settings to be defined NetworkerPlugin )
func (PluginType) MarshalText ¶
func (pt PluginType) MarshalText() ([]byte, error)
func (PluginType) String ¶
func (pt PluginType) String() string
type RequestOptions ¶
type RequestOptions struct { // The timeout for the request Timeout time.Duration `json:"timeout"` // The maximum number of retries for the request, if set MaxRetries int `json:"max_retries"` // The backoff interval for the request BackoffInterval time.Duration `json:"backoff_interval"` }
RequestOptions are the options that were set for the request.
func NewDefaultRequestOptions ¶
func NewDefaultRequestOptions() *RequestOptions
type ResourceContext ¶
type ResourceContext struct { // Key identifies the resource type being requested Key string `json:"key"` }
ResourceContext holds the context of the resource that the request is for, if the request is for a resource.
type VisualComponentList ¶
type VisualComponentList struct {
Resource []VisualResourceComponent `json:"resource"`
}
VisualComponentList is a list of visual components that can be used to visualize resources in the IDE.
type VisualResourceComponent ¶
type VisualResourceComponent struct { ID string `json:"id"` Plugin string `json:"plugin"` Type string `json:"type"` Resources []string `json:"resources"` }
VisualResourceComponent is a component that can be used to visualize a resource in one of the injectable areas in the IDE.