client

package
v1.29.1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package client provides the client interface for 'file'

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeRemoteFileGroup added in v1.23.6

func ChangeRemoteFileGroup(ctx context.Context, conn *proxy.Conn, req ChgrpRequest) error

ChangeRemoteFileGroup is a helper function for changing file group on one or more remote hosts using a proxy.Conn.

func ChangeRemoteFileOwnership added in v1.23.6

func ChangeRemoteFileOwnership(ctx context.Context, conn *proxy.Conn, req ChownRequest) error

ChangeRemoteFileOwnership is a helper function for changing file ownership on one or more remote hosts using a proxy.Conn.

func ChangeRemoteFilePermission added in v1.23.6

func ChangeRemoteFilePermission(ctx context.Context, conn *proxy.Conn, path string, mode uint32) error

ChangeRemoteFilePermission is a helper function for changing file permission on one or more remote hosts using a proxy.Conn.

func CopyRemoteFile

func CopyRemoteFile(ctx context.Context, conn *proxy.Conn, source string, destination *FileConfig) error

CopyRemoteFile is a helper function for copying a file on one or more remote hosts using a proxy.Conn.

func MakeRemoteDir added in v1.23.6

func MakeRemoteDir(ctx context.Context, conn *proxy.Conn, req MkdirRequest) error

MakeRemoteDir is a helper function for creating a directory on one or more remote hosts using a proxy.Conn.

func ReadRemoteFile

func ReadRemoteFile(ctx context.Context, conn *proxy.Conn, path string) ([]byte, error)

ReadRemoteFile is a helper function for reading a single file from a remote host using a proxy.Conn. If the conn is defined for >1 targets this will return an error.

func RemoveRemoteFile added in v1.14.3

func RemoveRemoteFile(ctx context.Context, conn *proxy.Conn, path string) error

RemoveRemoteFile is a helper function for removing a file on one or more remote hosts using a proxy.Conn.

func SymlinkRemote added in v1.23.6

func SymlinkRemote(ctx context.Context, conn *proxy.Conn, target, linkname string) error

SymlinkRemote is a helper function for creating a symlink on one or more remote hosts using a proxy.Conn. This is similar to `ln -s <target> <linkname>`

func WriteRemoteFile

func WriteRemoteFile(ctx context.Context, conn *proxy.Conn, config *FileConfig, contents []byte) error

WriteRemoteFile is a helper function for writing a single file to a remote host using a proxy.Conn.

Types

type ChgrpRequest added in v1.23.6

type ChgrpRequest struct {
	Path string
	// Exactly one of Group or Uid must be set.
	Group *string
	Gid   *int
}

type ChownRequest added in v1.23.6

type ChownRequest struct {
	Path string
	// Exactly one of Username or Uid must be set.
	Username *string
	Uid      *int
}

type FileConfig

type FileConfig struct {
	// Filename is the remote full path to write the file.
	Filename string

	// User is the remote user to chown() the file ownership.
	User string

	// Group is the remote group to chgrp() the file group.
	Group string

	// Perms are the standard unix file permissions for the remote file.
	Perms int

	// If overwrite is true the remote file will be overwritten if it exists,
	// otherwise it's an error to write to an existing file.
	Overwrite bool
}

FileConfig defines a configuration defining a remote file. This will be used when defining a remote written file such as writing a new file or copying one.

type ListRemoteResponse added in v1.28.4

type ListRemoteResponse struct {
	Target   string
	Index    int
	Contents []*pb.StatReply
}

func ListRemote added in v1.28.4

func ListRemote(ctx context.Context, conn *proxy.Conn, listRequest ListRequest) ([]ListRemoteResponse, error)

ListRemote is a helper function for listing the contents of a directory on one or more remote hosts using a proxy.Conn. This is similar to `ls <path>`

type ListRequest added in v1.28.4

type ListRequest struct {
	Path       string
	MaxResults int
}

type MkdirRequest added in v1.23.6

type MkdirRequest struct {
	Path string
	Mode int
	// Exactly one of Username or Uid must be set.
	Username *string
	Uid      *int
	// Exactly one of Group or Gid must be set.
	Group *string
	Gid   *int
}

type ReadRemoteFileResponse added in v1.23.6

type ReadRemoteFileResponse struct {
	Target   string
	Index    int
	Contents []byte
}

func ReadRemoteFileMany added in v1.23.6

func ReadRemoteFileMany(ctx context.Context, conn *proxy.Conn, path string) ([]ReadRemoteFileResponse, error)

ReadRemoteFileMany is a helper function for reading a single file from one or more remote hosts using a proxy.Conn.

Jump to

Keyboard shortcuts

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