command

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CURL    = "curl"
	OPENSSL = "openssl"
)
View Source
const (
	UnsignedPayload                            = "UNSIGNED-PAYLOAD"
	StreamingAWS4HMACSHA256Payload             = "STREAMING-AWS4-HMAC-SHA256-PAYLOAD"
	StreamingAWS4HMACSHA256PayloadTrailer      = "STREAMING-AWS4-HMAC-SHA256-PAYLOAD-TRAILER"
	StreamingUnsignedPayloadTrailer            = "STREAMING-UNSIGNED-PAYLOAD-TRAILER"
	StreamingAWS4ECDSAP256SHA256Payload        = "STREAMING-AWS4-ECDSA-P256-SHA256-PAYLOAD"
	StreamingAWS4ECDSAP256SHA256PayloadTrailer = "STREAMING-AWS4-ECDSA-P256-SHA256-PAYLOAD-TRAILER"
)
View Source
const (
	ChecksumCRC32     = "crc32"
	ChecksumCRC32C    = "crc32c"
	ChecksumCRC64NVME = "crc64nvme"
	ChecksumSHA1      = "sha1"
	ChecksumSHA256    = "sha256"
)
View Source
const SHA256HashZeroBytes = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

Variables

This section is empty.

Functions

func GetBase64ChecksumLength added in v1.0.19

func GetBase64ChecksumLength(checksumType string) (int64, error)

Types

type CreateBucketCommand added in v1.0.20

type CreateBucketCommand struct {
	*S3Command
	Config *CreateBucketCommandXML
}

func NewCreateBucketCommand added in v1.0.20

func NewCreateBucketCommand(s3Command *S3Command, locationConstraint string, constraintSet bool) (*CreateBucketCommand, error)

type CreateBucketCommandXML added in v1.0.20

type CreateBucketCommandXML struct {
	XMLName            xml.Name `xml:"CreateBucketConfiguration"`
	XMLNamespace       string   `xml:"xmlns,attr"`
	LocationConstraint string   `xml:"LocationConstraint"`
}

type DataSource added in v1.0.19

type DataSource interface {
	SourceDataByteSize() (int64, error)
	CalculateSHA256HashString() (string, error)
	Close() error
	GetReader() (io.Reader, error)
	GetTeeReader(io.Writer) (io.Reader, error)
}

type FileDataSource added in v1.0.19

type FileDataSource struct {
	File *os.File
	// contains filtered or unexported fields
}

func NewFileDataSource added in v1.0.19

func NewFileDataSource(filePath string) *FileDataSource

func (*FileDataSource) CalculateSHA256HashString added in v1.0.19

func (f *FileDataSource) CalculateSHA256HashString() (string, error)

func (*FileDataSource) Close added in v1.0.19

func (f *FileDataSource) Close() error

func (*FileDataSource) GetReader added in v1.0.19

func (f *FileDataSource) GetReader() (io.Reader, error)

func (*FileDataSource) GetTeeReader added in v1.0.19

func (f *FileDataSource) GetTeeReader(checksumWriter io.Writer) (io.Reader, error)

func (*FileDataSource) SourceDataByteSize added in v1.0.19

func (f *FileDataSource) SourceDataByteSize() (int64, error)

type OpenSSLPayloadManager added in v1.0.19

type OpenSSLPayloadManager interface {
	GetContentLength() (int64, error)
	WritePayload(string) error
}

type Payload added in v1.0.19

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

func (*Payload) GetDataSize added in v1.0.19

func (p *Payload) GetDataSize() (int64, error)

type PayloadChunked added in v1.0.19

type PayloadChunked struct {
	*Payload
	// contains filtered or unexported fields
}

type PayloadChunkedAWS added in v1.0.19

type PayloadChunkedAWS struct {
	*PayloadChunked
	// contains filtered or unexported fields
}

type PayloadSizeCalculator added in v1.0.19

type PayloadSizeCalculator interface {
	CalculatePayloadSize() int64
}

type PayloadStreamingAWS4HMACSHA256 added in v1.0.19

type PayloadStreamingAWS4HMACSHA256 struct {
	*PayloadChunkedAWS
	// contains filtered or unexported fields
}

func NewPayloadStreamingAWS4HMACSHA256 added in v1.0.19

func NewPayloadStreamingAWS4HMACSHA256(source DataSource, chunkSize int64, payloadType PayloadType, serviceString string, currentDateTime, yyyymmdd, checksumType string) *PayloadStreamingAWS4HMACSHA256

func (*PayloadStreamingAWS4HMACSHA256) AddInitialSignatureAndSigningKey added in v1.0.19

func (s *PayloadStreamingAWS4HMACSHA256) AddInitialSignatureAndSigningKey(initialSignature string, signingKey []byte)

func (*PayloadStreamingAWS4HMACSHA256) GetContentLength added in v1.0.19

func (s *PayloadStreamingAWS4HMACSHA256) GetContentLength() (int64, error)

func (*PayloadStreamingAWS4HMACSHA256) WritePayload added in v1.0.19

func (s *PayloadStreamingAWS4HMACSHA256) WritePayload(filePath string) error

type PayloadType added in v1.0.19

type PayloadType string

type PutBucketTaggingCommand added in v1.0.19

type PutBucketTaggingCommand struct {
	*PutTaggingCommand
}

func NewPutBucketTaggingCommand added in v1.0.19

func NewPutBucketTaggingCommand(s3Command *S3Command, fields *TaggingFields) (*PutBucketTaggingCommand, error)

type PutObjectTaggingCommand added in v1.0.20

type PutObjectTaggingCommand struct {
	*PutTaggingCommand
}

func NewPutObjectTaggingCommand added in v1.0.20

func NewPutObjectTaggingCommand(s3Command *S3Command, fields *TaggingFields) (*PutObjectTaggingCommand, error)

type PutTaggingCommand added in v1.0.20

type PutTaggingCommand struct {
	*S3Command
	TagCount *int
	Tags     *Tagging
}

type S3Command

type S3Command struct {
	Client                       string
	Method                       string
	Url                          string
	BucketName                   string
	ObjectKey                    string
	Query                        string
	AwsRegion                    string
	AwsAccessKeyId               string
	AwsSecretAccessKey           string
	ServiceName                  string
	SignedParams                 map[string]string
	PayloadFile                  string
	IncorrectSignature           bool
	AuthorizationHeaderMalformed bool
	AuthorizationScheme          string
	IncorrectCredential          string
	IncorrectYearMonthDay        bool
	InvalidYearMonthDay          bool
	Payload                      string
	ContentMD5                   bool
	IncorrectContentMD5          bool
	CustomContentMD5             string
	MissingHostParam             bool
	FilePath                     string
	CustomHostParam              string
	CustomHostParamSet           bool
	PayloadType                  string
	ChunkSize                    int
	ChecksumType                 string
	OmitPayloadTrailer           bool
	OmitPayloadTrailerKey        bool
	OmitContentLength            bool
	// contains filtered or unexported fields
}

func NewPutObjectCommand added in v1.0.19

func NewPutObjectCommand(s3Command *S3Command) (*S3Command, error)

func (*S3Command) CurlShellCommand

func (s *S3Command) CurlShellCommand() (string, error)

func (*S3Command) OpenSSLCommand

func (s *S3Command) OpenSSLCommand() error

type S3CommandConverter added in v1.0.19

type S3CommandConverter interface {
	CurlShellCommand() (string, error)
	OpenSSLCommand() error
}

type S3CommandErrors added in v1.0.19

type S3CommandErrors struct {
	IncorrectSignature           bool
	AuthorizationHeaderMalformed bool
	IncorrectCredential          string
	IncorrectYearMonthDay        bool
	InvalidYearMonthDay          bool
	IncorrectContentMD5          bool
	MissingHostParam             bool
	CustomHostParam              string
	CustomHostParamSet           bool
}

type S3RESTCommand added in v1.0.19

type S3RESTCommand struct {
	Method         string
	Url            string
	Queries        map[string]string
	SignedParams   map[string]string
	UnsignedParams map[string]string
	DataSource     DataSource
}

type StreamingUnsignedPayloadWithTrailer added in v1.0.19

type StreamingUnsignedPayloadWithTrailer struct {
	*PayloadChunked
	// contains filtered or unexported fields
}

func NewStreamingUnsignedPayloadWithTrailer added in v1.0.19

func NewStreamingUnsignedPayloadWithTrailer(source DataSource, chunkSize int64, checksumType string) *StreamingUnsignedPayloadWithTrailer

func (*StreamingUnsignedPayloadWithTrailer) GetContentLength added in v1.0.19

func (s *StreamingUnsignedPayloadWithTrailer) GetContentLength() (int64, error)

func (*StreamingUnsignedPayloadWithTrailer) OmitTrailerOrKey added in v1.0.19

func (s *StreamingUnsignedPayloadWithTrailer) OmitTrailerOrKey(omitTrailer, omitTrailerKey bool)

func (*StreamingUnsignedPayloadWithTrailer) WritePayload added in v1.0.19

func (s *StreamingUnsignedPayloadWithTrailer) WritePayload(filePath string) error

type StringDataSource added in v1.0.19

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

func NewStringDataSource added in v1.0.19

func NewStringDataSource(dataString string) *StringDataSource

func (*StringDataSource) CalculateSHA256HashString added in v1.0.19

func (s *StringDataSource) CalculateSHA256HashString() (string, error)

func (*StringDataSource) Close added in v1.0.19

func (s *StringDataSource) Close() error

func (*StringDataSource) GetReader added in v1.0.19

func (s *StringDataSource) GetReader() (io.Reader, error)

func (*StringDataSource) GetTeeReader added in v1.0.19

func (s *StringDataSource) GetTeeReader(checksumWriter io.Writer) (io.Reader, error)

func (*StringDataSource) SourceDataByteSize added in v1.0.19

func (s *StringDataSource) SourceDataByteSize() (int64, error)

type Tag added in v1.0.19

type Tag struct {
	Key   string `xml:"Key"`
	Value string `xml:"Value"`
}

type TagAdder added in v1.0.19

type TagAdder interface {
	AddTag(tag string, value string) error
}

type TagSet added in v1.0.19

type TagSet struct {
	Tags []Tag `xml:"Tag"`
}

type Tagging added in v1.0.20

type Tagging struct {
	XMLName      xml.Name `xml:"Tagging"`
	XMLNamespace string   `xml:"xmlns,attr"`
	TagSet       TagSet   `xml:"TagSet"`
}

func (*Tagging) AddTags added in v1.0.20

func (p *Tagging) AddTags(keys, values []string) error

func (*Tagging) GenerateKeyValuePairs added in v1.0.20

func (p *Tagging) GenerateKeyValuePairs(count int)

type TaggingFields added in v1.0.20

type TaggingFields struct {
	TagCount  int
	TagKeys   []string
	TagValues []string
}

type WholePayload added in v1.0.19

type WholePayload struct {
	*Payload
}

func NewWholePayload added in v1.0.19

func NewWholePayload(dataSource DataSource) *WholePayload

func (*WholePayload) CalculatePayloadSize added in v1.0.19

func (w *WholePayload) CalculatePayloadSize() (int64, error)

func (*WholePayload) GetContentLength added in v1.0.19

func (w *WholePayload) GetContentLength() (int64, error)

func (*WholePayload) WritePayload added in v1.0.19

func (w *WholePayload) WritePayload(filePath string) error

Jump to

Keyboard shortcuts

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