smbclient

package
v0.0.0-...-df8de4e Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package smbclient is used to execute smbclient commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Username string
	Password string
}

Auth represents the values needed to authenticate to a share.

type CommandError

type CommandError struct {
	Desc       string
	Command    []string
	Err        error
	Output     string
	ErrOutput  string
	ExitStatus int
}

CommandError represents a failed command.

func (CommandError) Error

func (ce CommandError) Error() string

func (CommandError) Unwrap

func (ce CommandError) Unwrap() error

Unwrap returns the error that generated the CommandError.

type Host

type Host string

Host name or ip address for a share.

func (Host) String

func (h Host) String() string

type Listing

type Listing []string

Listing of services from smbclient.

type Share

type Share struct {
	Host Host
	Name string
}

Share represents the host and name of an smb share.

func (Share) String

func (s Share) String() string

type SmbClient

type SmbClient interface {
	List(ctx context.Context, host Host, auth Auth) (Listing, error)
	Command(ctx context.Context, share Share, auth Auth, cmd []string) error
	CommandOutput(ctx context.Context, share Share, auth Auth, cmd []string) ([]byte, error)
	CacheFlush(ctx context.Context) error
}

SmbClient is an interface that covers common methods for interacting with smbclient when testing.

func MustPodExec

func MustPodExec(
	tclient *kube.TestClient, namespace, pod, container string) SmbClient

MustPodExec returns an SmbClient set up to execute commands on the given pod and container, using the given kube client.

Jump to

Keyboard shortcuts

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