command

package
v0.0.0-...-ea4c5e1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewScript

func NewScript(ctx *pulumi.Context,
	conn *remote.ConnectionArgs,
	localScriptPath string,
	createParam, updateParam, deleteParam *string,
) (*remote.Command, error)

If *Param is nil, the create/update/delete command is not run

Types

type Args

type Args struct {
	Create                   pulumi.StringInput
	Update                   pulumi.StringInput
	Delete                   pulumi.StringInput
	Triggers                 pulumi.ArrayInput
	Stdin                    pulumi.StringPtrInput
	Environment              pulumi.StringMap
	RequirePasswordFromStdin bool
	Sudo                     bool
	// Only used for local commands
	LocalAssetPaths pulumi.StringArrayInput
	LocalDir        pulumi.StringInput
}

type Command

type Command interface {
	pulumi.Resource

	StdoutOutput() pulumi.StringOutput
	StderrOutput() pulumi.StringOutput
}

func WaitForCloudInit

func WaitForCloudInit(runner Runner) (Command, error)

func WaitForSuccessfulConnection

func WaitForSuccessfulConnection(runner Runner) (Command, error)

type FileManager

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

func NewFileManager

func NewFileManager(runner Runner) *FileManager

func (*FileManager) CopyAbsoluteFolder

func (fm *FileManager) CopyAbsoluteFolder(absoluteFolder string, remoteFolder string, opts ...pulumi.ResourceOption) ([]pulumi.Resource, error)

CopyAbsoluteFolder copies recursively a folder to a remote folder. This function returns the resources that can be used with `pulumi.DependsOn`.

func (*FileManager) CopyFSFolder

func (fm *FileManager) CopyFSFolder(
	folderFS fs.FS,
	folderPath string,
	remoteFolder string,
	opts ...pulumi.ResourceOption,
) ([]pulumi.Resource, error)

CopyFSFolder copies recursively a local folder to a remote folder. You may consider using `CopyRelativeFolder` which has a simpler API.

func (*FileManager) CopyFile

func (fm *FileManager) CopyFile(name string, localPath, remotePath pulumi.StringInput, opts ...pulumi.ResourceOption) (pulumi.Resource, error)

func (*FileManager) CopyInlineFile

func (fm *FileManager) CopyInlineFile(fileContent pulumi.StringInput, remotePath string, opts ...pulumi.ResourceOption) (pulumi.Resource, error)

func (*FileManager) CopyRelativeFile

func (fm *FileManager) CopyRelativeFile(relativePath string, remotePath string, opts ...pulumi.ResourceOption) (pulumi.Resource, error)

CopyRelativeFile copies relative path to a remote path. The relative path is defined in the same way as for `CopyRelativeFolder`. This function returns the resource that can be used with `pulumi.DependsOn`.

func (*FileManager) CopyRelativeFolder

func (fm *FileManager) CopyRelativeFolder(relativeFolder string, remoteFolder string, opts ...pulumi.ResourceOption) ([]pulumi.Resource, error)

CopyRelativeFolder copies recursively a relative folder to a remote folder. The path of the folder is relative to the caller of this function. For example, if this function is called from ~/foo/test.go with remoteFolder="bar" then the full path of the folder will be ~/foo/bar“. This function returns the resources that can be used with `pulumi.DependsOn`.

func (*FileManager) CreateDirectory

func (fm *FileManager) CreateDirectory(remotePath string, useSudo bool, opts ...pulumi.ResourceOption) (Command, error)

CreateDirectory if it does not exist

func (*FileManager) CreateDirectoryForFile

func (fm *FileManager) CreateDirectoryForFile(remotePath string, useSudo bool, opts ...pulumi.ResourceOption) (Command, error)

CreateDirectoryForFile if the directory does not exist To avoid pulumi.URN collisions if multiple files use the same directory, use the full filePath as URN and path.Split out the folderPath for creation

func (*FileManager) CreateDirectoryFromPulumiString

func (fm *FileManager) CreateDirectoryFromPulumiString(name string, remotePath pulumi.String, useSudo bool, opts ...pulumi.ResourceOption) (Command, error)

CreateDirectoryFromPulumiString if it does not exist from directory name as a Pulumi String

func (*FileManager) HomeDirectory

func (fm *FileManager) HomeDirectory(folderName string, opts ...pulumi.ResourceOption) (Command, string, error)

HomeDirectory creates a directory in home directory, if it does not exist A home directory is a file system directory on a multi-user operating system containing files for a given user of the system. It does not require sudo, using sudo in home directory allows to change default ownership and it is discouraged.

func (*FileManager) IsPathAbsolute

func (fm *FileManager) IsPathAbsolute(path string) bool

func (*FileManager) TempDirectory

func (fm *FileManager) TempDirectory(folderName string, opts ...pulumi.ResourceOption) (Command, string, error)

TempDirectory creates a temporary directory

type GenericPackageManager

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

func NewGenericPackageManager

func NewGenericPackageManager(
	runner Runner,
	name string,
	installCmd string,
	updateCmd string,
	env pulumi.StringMap,
) *GenericPackageManager

func (*GenericPackageManager) Ensure

func (m *GenericPackageManager) Ensure(packageRef string, transform Transformer, checkBinary string, opts ...pulumi.ResourceOption) (Command, error)

type LocalCommand

type LocalCommand struct {
	*local.Command
}

func (*LocalCommand) StderrOutput

func (c *LocalCommand) StderrOutput() pulumi.StringOutput

func (*LocalCommand) StdoutOutput

func (c *LocalCommand) StdoutOutput() pulumi.StringOutput

type LocalRunner

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

func NewLocalRunner

func NewLocalRunner(e config.Env, args LocalRunnerArgs) *LocalRunner

func (*LocalRunner) Command

func (r *LocalRunner) Command(name string, args *Args, opts ...pulumi.ResourceOption) (Command, error)

func (*LocalRunner) Config

func (r *LocalRunner) Config() RunnerConfiguration

func (*LocalRunner) Environment

func (r *LocalRunner) Environment() config.Env

func (*LocalRunner) Namer

func (r *LocalRunner) Namer() namer.Namer

func (*LocalRunner) OsCommand

func (r *LocalRunner) OsCommand() OSCommand

func (*LocalRunner) PulumiOptions

func (r *LocalRunner) PulumiOptions() []pulumi.ResourceOption

type LocalRunnerArgs

type LocalRunnerArgs struct {
	User      string
	OSCommand OSCommand
}

type OSCommand

type OSCommand interface {
	GetTemporaryDirectory() string
	GetHomeDirectory() string

	CreateDirectory(
		runner Runner,
		resourceName string,
		remotePath pulumi.StringInput,
		useSudo bool,
		opts ...pulumi.ResourceOption) (Command, error)
	MoveFile(runner Runner, name string, source, destination pulumi.StringInput, sudo bool, opts ...pulumi.ResourceOption) (Command, error)

	BuildCommandString(
		command pulumi.StringInput,
		env pulumi.StringMap,
		sudo bool,
		passwordFromStdin bool,
		user string) pulumi.StringInput

	IsPathAbsolute(path string) bool

	NewCopyFile(runner Runner, name string, localPath, remotePath pulumi.StringInput, opts ...pulumi.ResourceOption) (pulumi.Resource, error)
	// contains filtered or unexported methods
}

OSCommand defines the commands which are OS specifics

func NewLocalOSCommand

func NewLocalOSCommand() OSCommand

func NewUnixOSCommand

func NewUnixOSCommand() OSCommand

func NewWindowsOSCommand

func NewWindowsOSCommand() OSCommand

type ReadyFunc

type ReadyFunc func(Runner) (Command, error)

type RemoteCommand

type RemoteCommand struct {
	*remote.Command
}

func (*RemoteCommand) StderrOutput

func (c *RemoteCommand) StderrOutput() pulumi.StringOutput

func (*RemoteCommand) StdoutOutput

func (c *RemoteCommand) StdoutOutput() pulumi.StringOutput

type RemoteRunner

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

func NewRemoteRunner

func NewRemoteRunner(e config.Env, args RemoteRunnerArgs) (*RemoteRunner, error)

func (*RemoteRunner) Command

func (r *RemoteRunner) Command(name string, args *Args, opts ...pulumi.ResourceOption) (Command, error)

func (*RemoteRunner) Config

func (r *RemoteRunner) Config() RunnerConfiguration

func (*RemoteRunner) Environment

func (r *RemoteRunner) Environment() config.Env

func (*RemoteRunner) Namer

func (r *RemoteRunner) Namer() namer.Namer

func (*RemoteRunner) OsCommand

func (r *RemoteRunner) OsCommand() OSCommand

func (*RemoteRunner) PulumiOptions

func (r *RemoteRunner) PulumiOptions() []pulumi.ResourceOption

type RemoteRunnerArgs

type RemoteRunnerArgs struct {
	ParentResource pulumi.Resource
	ConnectionName string
	Connection     remote.ConnectionInput
	ReadyFunc      ReadyFunc
	User           string
	OSCommand      OSCommand
}

type Runner

type Runner interface {
	Environment() config.Env
	Namer() namer.Namer
	Config() RunnerConfiguration
	OsCommand() OSCommand
	PulumiOptions() []pulumi.ResourceOption

	Command(name string, args *Args, opts ...pulumi.ResourceOption) (Command, error)
	// contains filtered or unexported methods
}

type RunnerConfiguration

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

type Transformer

type Transformer func(name string, args Args) (string, Args)

Transformer is a function that can be used to modify the command name and args. Examples: swapping `args.Delete` with `args.Create`, or adding `args.Triggers`, or editing the name

Jump to

Keyboard shortcuts

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