command

package
v1.10.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ETag             = "eTag"
	Key              = "key"
	LastModifiedTime = "lastModifiedTime"
	Size             = "size"
	VersionId        = "versionId"
)
View Source
const (
	AllowedMethods = "allowedMethods"
	AllowedOrigins = "allowedOrigins"
	AllowedHeaders = "allowedHeaders"
	ExposedHeaders = "exposedHeaders"
	ID             = "id"
	MaxAgeSeconds  = "maxAgeSeconds"
)
View Source
const (
	CURL    = "curl"
	OPENSSL = "openssl"
)
View Source
const (
	AddressFormatPath    = "path"
	AddressFormatVirtual = "virtual"
)
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 CORSConfiguration added in v1.3.1

type CORSConfiguration struct {
	XMLName      xml.Name `xml:"CORSConfiguration"`
	XMLNamespace string   `xml:"xmlns,attr"`
	CORSRules    []*CORSRule
}

type CORSRule added in v1.3.1

type CORSRule struct {
	XMLName       xml.Name `xml:"CORSRule"`
	AllowedMethod []string `xml:"AllowedMethod"`
	AllowedOrigin []string `xml:"AllowedOrigin"`
	AllowedHeader []string `xml:"AllowedHeader,omitempty"`
	ExposeHeader  []string `xml:"ExposeHeader,omitempty"`
	ID            string   `xml:"ID,omitempty"`
	MaxAgeSeconds string   `xml:"MaxAgeSeconds,omitempty"`
}

type Condition added in v1.8.0

type Condition struct {
	HttpErrorCodeReturnedEquals string `xml:"HttpErrorCodeReturnedEquals,omitempty" json:"httpErrorCodeReturnedEquals,omitempty"`
	KeyPrefixEquals             string `xml:"KeyPrefixEquals,omitempty" json:"keyPrefixEquals,omitempty"`
}

type CreateBucketCommand added in v1.0.20

type CreateBucketCommand struct {
	*S3RequestBuilder
	Config *CreateBucketCommandXML
}

func NewCreateBucketCommand added in v1.0.20

func NewCreateBucketCommand(s3Command *S3RequestBuilder, 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 CurlCommand added in v1.4.0

type CurlCommand struct {
	*S3Request
	// contains filtered or unexported fields
}

func (*CurlCommand) DeriveHeaderValues added in v1.4.0

func (c *CurlCommand) DeriveHeaderValues() error

func (*CurlCommand) PerformPayloadCalculations added in v1.4.0

func (c *CurlCommand) PerformPayloadCalculations() error

func (*CurlCommand) Render added in v1.4.0

func (c *CurlCommand) Render() error

func (*CurlCommand) String added in v1.4.0

func (c *CurlCommand) String() string

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 Delete added in v1.5.0

type Delete struct {
	XMLName      xml.Name `xml:"Delete"`
	XMLNamespace string   `xml:"xmlns,attr"`
	Objects      []*Object
	Quiet        bool `xml:"Quiet,omitempty"`
}

type ErrorDocument added in v1.8.0

type ErrorDocument struct {
	Key string `xml:"Key,omitempty" json:"key,omitempty"`
}

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 HeaderValue added in v1.3.1

type HeaderValue struct {
	Key    string
	Value  string
	Signed bool
}

type IndexDocument added in v1.8.0

type IndexDocument struct {
	Suffix string `xml:"Suffix,omitempty" json:"suffix,omitempty"`
}

type Object added in v1.5.0

type Object struct {
	XMLName          xml.Name `xml:"Object"`
	ETag             string   `xml:"ETag,omitempty"`
	Key              string   `xml:"Key"`
	LastModifiedTime string   `xml:"LastModifiedTime,omitempty"`
	Size             string   `xml:"Size,omitempty"`
	VersionId        string   `xml:"VersionId,omitempty"`
}

type OpenSSLCommand added in v1.4.0

type OpenSSLCommand struct {
	*S3Request
	// contains filtered or unexported fields
}

func (*OpenSSLCommand) DeriveHeaderValues added in v1.4.0

func (o *OpenSSLCommand) DeriveHeaderValues() error

func (*OpenSSLCommand) PerformPayloadCalculations added in v1.4.0

func (o *OpenSSLCommand) PerformPayloadCalculations() error

func (*OpenSSLCommand) Render added in v1.4.0

func (o *OpenSSLCommand) Render() 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 *S3RequestBuilder, 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 *S3RequestBuilder, fields *TaggingFields) (*PutObjectTaggingCommand, error)

type PutTaggingCommand added in v1.0.20

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

type Redirect added in v1.8.0

type Redirect struct {
	HostName             string `xml:"HostName,omitempty" json:"hostName,omitempty"`
	HttpRedirectCode     string `xml:"HttpRedirectCode,omitempty" json:"httpRedirectCode,omitempty"`
	Protocol             string `xml:"Protocol,omitempty" json:"protocol,omitempty"`
	ReplaceKeyPrefixWith string `xml:"ReplaceKeyPrefixWith,omitempty" json:"replaceKeyPrefixWith,omitempty"`
	ReplaceKeyWith       string `xml:"ReplaceKeyWith,omitempty" json:"replaceKeyWith,omitempty"`
}

type RedirectAllRequestsTo added in v1.8.0

type RedirectAllRequestsTo struct {
	HostName string `xml:"HostName,omitempty" json:"hostName,omitempty"`
	Protocol string `xml:"Protocol,omitempty" json:"protocol,omitempty"`
}

type Renderer added in v1.4.0

type Renderer interface {
	CalculateDateTimeParams()
	DeriveHost() error
	DeriveBucketAndKeyPath()
	PerformPayloadCalculations() error
	DeriveHeaderValues() error
	CalculateSignature() error
	Render() error
}

type RoutingRule added in v1.8.0

type RoutingRule struct {
	Condition *Condition `xml:"Condition,omitempty" json:"condition,omitempty"`
	Redirect  *Redirect  `xml:"Redirect,omitempty" json:"redirect,omitempty"`
}

type RoutingRules added in v1.8.0

type RoutingRules struct {
	RoutingRule []RoutingRule `xml:"RoutingRule,omitempty" json:"routingRule,omitempty"`
}

type S3CommandConverter added in v1.0.19

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

type S3Request added in v1.4.0

type S3Request struct {
	Config *S3RequestConfigData
	// contains filtered or unexported fields
}

func (*S3Request) CalculateDateTimeParams added in v1.4.0

func (s *S3Request) CalculateDateTimeParams()

func (*S3Request) CalculateSignature added in v1.4.0

func (s *S3Request) CalculateSignature() error

func (*S3Request) DeriveBucketAndKeyPath added in v1.4.0

func (s *S3Request) DeriveBucketAndKeyPath()

func (*S3Request) DeriveHost added in v1.4.0

func (s *S3Request) DeriveHost() error

type S3RequestBuilder added in v1.4.0

type S3RequestBuilder struct {
	Config *S3RequestConfigData
}

func NewDeleteObjectsCommand added in v1.5.0

func NewDeleteObjectsCommand(command *S3RequestBuilder, objectStrings []string, quietMode bool) (*S3RequestBuilder, error)

func NewPutBucketCORSCommand added in v1.3.1

func NewPutBucketCORSCommand(command *S3RequestBuilder, ruleStrings []string) (*S3RequestBuilder, error)

func NewPutBucketWebsiteCommand added in v1.8.0

func NewPutBucketWebsiteCommand(command *S3RequestBuilder, websiteString string) (*S3RequestBuilder, error)

func NewPutObjectCommand added in v1.0.19

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

func (*S3RequestBuilder) CurlShellCommand added in v1.4.0

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

func (*S3RequestBuilder) OpenSSLCommand added in v1.4.0

func (s *S3RequestBuilder) OpenSSLCommand() error

func (*S3RequestBuilder) RenderCommand added in v1.4.0

func (s *S3RequestBuilder) RenderCommand(renderer Renderer) error

type S3RequestConfigData added in v1.4.0

type S3RequestConfigData 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
	UnsignedParams               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
	OmitSHA256Hash               bool
	CustomSHA256Hash             string
	OmitDate                     bool
	CustomDate                   string
	WriteXMLPayloadToFile        string
	OutputFile                   string
	HeaderFile                   string
	AddressFormat                string
	WebsiteConfiguration         string
}

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 WebsiteConfiguration added in v1.8.0

type WebsiteConfiguration struct {
	XMLName               xml.Name               `xml:"WebsiteConfiguration,omitempty" json:"-"`
	XMLNamespace          string                 `xml:"xmlns,attr" json:"xmlNamespace,omitempty"`
	ErrorDocument         *ErrorDocument         `xml:"ErrorDocument,omitempty" json:"errorDocument,omitempty"`
	IndexDocument         *IndexDocument         `xml:"IndexDocument,omitempty" json:"indexDocument,omitempty"`
	RedirectAllRequestsTo *RedirectAllRequestsTo `xml:"RedirectAllRequestsTo,omitempty" json:"redirectAllRequestsTo,omitempty"`
	RoutingRules          *RoutingRules          `xml:"RoutingRules,omitempty" json:"routingRules,omitempty"`
}

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