tungsten

package
v0.0.0-...-a25c09b Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommitHash = ""

CommitHash represents the Git commit hash as of building This is set by the Go linker

View Source
var ProtocolVersion = fmt.Sprintf("%d.%d", TungstenVersion.Segments()[0], TungstenVersion.Segments()[1])

ProtocolVersion is the plugin protocol version (Generated from the major and minor version)

View Source
var RawTungstenVersion = ""

RawTungstenVersion represents the raw version This is set by the Go linker

View Source
var TungstenVersion = version.Must(version.NewSemver(RawTungstenVersion))

TungstenVersion represents the parsed version

Functions

func Connect

func Connect(target Target) (*ssh.Client, error)

Connect connects to the specified target

Types

type Artifact

type Artifact struct {
	Plugin         string   `hcl:"plugin,label"`
	Operation      string   `hcl:"operation,label"`
	ArtifactConfig hcl.Body `hcl:",remain"`
}

Artifact represents a Tungsten artifact

type ArtifactInterface

type ArtifactInterface interface {
	GetPluginSchema() (hcldec.ObjectSpec, error)
	GetArtifactSchema() (hcldec.ObjectSpec, error)
	SetPluginConfig(cty.Value) (bool, error)
	Detect(OperationArguments) (bool, error)
	Install(OperationArguments) (bool, error)
	Upgrade(OperationArguments) (bool, error)
	Uninstall(OperationArguments) (bool, error)
}

ArtifactInterface is the artifact-plugin interface

type ArtifactPlugin

type ArtifactPlugin struct {
	Implementation ArtifactInterface
}

ArtifactPlugin is an implementation plugin.Plugin

func (*ArtifactPlugin) Client

func (plug *ArtifactPlugin) Client(_ *plugin.MuxBroker, client *rpc.Client) (interface{}, error)

Client returns a new instance of the RPC artifact client plugin

func (*ArtifactPlugin) Server

func (plug *ArtifactPlugin) Server(_ *plugin.MuxBroker) (interface{}, error)

Server returns a new instance of the RPC artifact server plugin

type ArtifactRPC

type ArtifactRPC struct {
	Client *rpc.Client
}

ArtifactRPC represents the RPC artifact plugin

func (*ArtifactRPC) Detect

func (client *ArtifactRPC) Detect(config OperationArguments) (bool, error)

Detect detects if an artifact is present

func (*ArtifactRPC) GetArtifactSchema

func (client *ArtifactRPC) GetArtifactSchema() (hcldec.ObjectSpec, error)

GetArtifactSchema gets the artifacts's config schema

func (*ArtifactRPC) GetPluginSchema

func (client *ArtifactRPC) GetPluginSchema() (hcldec.ObjectSpec, error)

GetPluginSchema gets the plugin's config schema

func (*ArtifactRPC) Install

func (client *ArtifactRPC) Install(config OperationArguments) error

Install the artifact

func (*ArtifactRPC) SetPluginConfig

func (client *ArtifactRPC) SetPluginConfig(config cty.Value) error

SetPluginConfig sets the plugin's global config

func (*ArtifactRPC) Uninstall

func (client *ArtifactRPC) Uninstall(config OperationArguments) error

Uninstall the artifact

func (*ArtifactRPC) Upgrade

func (client *ArtifactRPC) Upgrade(config OperationArguments) error

Upgrade the artifact

type ArtifactRPCServer

type ArtifactRPCServer struct {
	//The actual implementation
	Implementation ArtifactInterface
}

ArtifactRPCServer represents the RPC artifact server plugin

func (*ArtifactRPCServer) Detect

func (server *ArtifactRPCServer) Detect(args OperationArguments, resp *bool) error

Detect the artifact

func (*ArtifactRPCServer) GetArtifactSchema

func (server *ArtifactRPCServer) GetArtifactSchema(args interface{}, resp *hcldec.ObjectSpec) error

GetArtifactSchema gets the artifacts's config schema

func (*ArtifactRPCServer) GetPluginSchema

func (server *ArtifactRPCServer) GetPluginSchema(args interface{}, resp *hcldec.ObjectSpec) error

GetPluginSchema gets the plugin's config schema

func (*ArtifactRPCServer) Install

func (server *ArtifactRPCServer) Install(args OperationArguments, resp *bool) error

Install the artifact

func (*ArtifactRPCServer) SetPluginConfig

func (server *ArtifactRPCServer) SetPluginConfig(args cty.Value, resp *bool) error

SetPluginConfig gets the artifacts's config schema

func (*ArtifactRPCServer) Uninstall

func (server *ArtifactRPCServer) Uninstall(args OperationArguments, resp *bool) error

Uninstall the artifact

func (*ArtifactRPCServer) Upgrade

func (server *ArtifactRPCServer) Upgrade(args OperationArguments, resp *bool) error

Upgrade the artifact

type Config

type Config struct {
	Version   Version    `hcl:"version,block"`
	Plugins   []Plugin   `hcl:"plugin,block"`
	Targets   []Target   `hcl:"target,block"`
	Artifacts []Artifact `hcl:"artifact,block"`
}

Config represents a complete Tungsten config

func LoadConfig

func LoadConfig(path string, logger hclog.Logger) (Config, hcl.EvalContext, error)

LoadConfig parses and loads dependencies from the HCL file at the specified location

type OperationArguments

type OperationArguments struct {
	Config cty.Value
	Send   func(command string) string
}

OperationArguments represents the arguments for an artifact-plugin operation

type Plugin

type Plugin struct {
	Name         string   `hcl:"name,label"`
	Source       string   `hcl:"source"`
	PluginConfig hcl.Body `hcl:",remain"`
}

Plugin represents a Tungsten plugin block

type Target

type Target struct {
	Address    string `hcl:"address"`
	Username   string `hcl:"username,optional"`
	Password   string `hcl:"password,optional"`
	PrivateKey string `hcl:"private_key,optional"`
}

Target presents a Tungsten endpoint target

type Version

type Version struct {
	RequiredVersion string `hcl:"required_version"`
}

Version represents a Tungsten HCL version block

Jump to

Keyboard shortcuts

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