Documentation
¶
Index ¶
- type CommonPrefix
- type CompleteMultipartPart
- type CompleteMultipartUploadRequest
- type CompleteMultipartUploadResponse
- type ErrorSimulation
- type InitiateMultipartUploadResponse
- type ListObjectsV2Response
- type Multipart
- type Object
- type ObjectInfo
- type PartInfo
- type RequestLog
- type Server
- func (m *Server) Clear()
- func (m *Server) Close()
- func (m *Server) DeleteObject(key string) bool
- func (m *Server) DisableErrorSimulation()
- func (m *Server) EnableErrorSimulation(config ErrorSimulation)
- func (m *Server) GetMultipartUpload(uploadID string) (*Multipart, bool)
- func (m *Server) GetObject(key string) (*Object, bool)
- func (m *Server) GetObjectMetadata(key string) (map[string]string, bool)
- func (m *Server) GetRequestLog() []RequestLog
- func (m *Server) GetRequestsWithMethod(method string) []RequestLog
- func (m *Server) HasRequestWithMethod(method string) bool
- func (m *Server) ListMultipartUploads() map[string]*Multipart
- func (m *Server) ListObjects(prefix string) []string
- func (m *Server) ObjectContent(key string) ([]byte, bool)
- func (m *Server) ObjectExists(key string) bool
- func (m *Server) PopulateTestData(data map[string][]byte)
- func (m *Server) PutObject(key string, content []byte) string
- func (m *Server) PutObjectWithMetadata(key string, content []byte, metadata map[string]string) string
- func (m *Server) RequestCount() int
- func (m *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (m *Server) SetObjectMetadata(key string, metadata map[string]string) bool
- func (m *Server) URL() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommonPrefix ¶
type CommonPrefix struct {
Prefix string `xml:"Prefix"`
}
CommonPrefix represents a common prefix in the list response
type CompleteMultipartPart ¶
CompleteMultipartPart represents a part in the complete request
type CompleteMultipartUploadRequest ¶
type CompleteMultipartUploadRequest struct {
XMLName xml.Name `xml:"CompleteMultipartUpload"`
Parts []CompleteMultipartPart `xml:"Part"`
}
CompleteMultipartUploadRequest represents the XML request for completing multipart upload
type CompleteMultipartUploadResponse ¶
type CompleteMultipartUploadResponse struct {
XMLName xml.Name `xml:"CompleteMultipartUploadResult"`
Location string `xml:"Location"`
Bucket string `xml:"Bucket"`
Key string `xml:"Key"`
ETag string `xml:"ETag"`
}
CompleteMultipartUploadResponse represents the XML response for completing multipart upload
type ErrorSimulation ¶
type ErrorSimulation struct {
NetworkErrors bool
NotFoundErrors bool
PermissionErrors bool
InternalErrors bool
ErrorRate float64 // 0.0 to 1.0
}
ErrorSimulation controls error injection for testing
type InitiateMultipartUploadResponse ¶
type InitiateMultipartUploadResponse struct {
XMLName xml.Name `xml:"InitiateMultipartUploadResult"`
Bucket string `xml:"Bucket"`
Key string `xml:"Key"`
UploadId string `xml:"UploadId"`
}
InitiateMultipartUploadResponse represents the XML response for initiating multipart upload
type ListObjectsV2Response ¶
type ListObjectsV2Response struct {
XMLName xml.Name `xml:"ListBucketResult"`
Name string `xml:"Name"`
Prefix string `xml:"Prefix"`
Delimiter string `xml:"Delimiter"`
MaxKeys int `xml:"MaxKeys"`
IsTruncated bool `xml:"IsTruncated"`
Contents []ObjectInfo `xml:"Contents"`
CommonPrefixes []CommonPrefix `xml:"CommonPrefixes"`
NextContinuationToken string `xml:"NextContinuationToken,omitempty"`
}
ListObjectsV2Response represents the XML response for ListObjectsV2
type Multipart ¶
type Multipart struct {
ID string
Bucket string
Key string
Parts map[int]*PartInfo
Created time.Time
Metadata map[string]string
}
Multipart tracks the state of a multipart upload
type Object ¶
type Object struct {
Content []byte
ETag string
LastModified time.Time
ContentType string
Metadata map[string]string
}
Object represents an S3 object stored in the mock server
type ObjectInfo ¶
type ObjectInfo struct {
Key string `xml:"Key"`
LastModified time.Time `xml:"LastModified"`
ETag string `xml:"ETag"`
Size int64 `xml:"Size"`
}
ObjectInfo represents an object in the list response
type RequestLog ¶
type RequestLog struct {
Method string
Path string
Query string
Headers map[string]string
Body []byte
Timestamp time.Time
}
RequestLog captures details about requests made to the mock server
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server provides a comprehensive mock implementation of the AWS S3 API for testing purposes. It implements all S3 operations used by the client library including object operations, multipart uploads, list operations, and S3 Select.
func (*Server) Clear ¶
func (m *Server) Clear()
Clear removes all objects and uploads from the mock server
func (*Server) Close ¶
func (m *Server) Close()
Close shuts down the mock server and cleans up resources
func (*Server) DeleteObject ¶
DeleteObject removes an object from the mock server
func (*Server) DisableErrorSimulation ¶
func (m *Server) DisableErrorSimulation()
DisableErrorSimulation disables all error simulation
func (*Server) EnableErrorSimulation ¶
func (m *Server) EnableErrorSimulation(config ErrorSimulation)
EnableErrorSimulation enables error simulation with the given configuration
func (*Server) GetMultipartUpload ¶
GetMultipartUpload returns a multipart upload by ID
func (*Server) GetObjectMetadata ¶
GetObjectMetadata returns metadata for an object
func (*Server) GetRequestLog ¶
func (m *Server) GetRequestLog() []RequestLog
GetRequestLog returns all logged requests
func (*Server) GetRequestsWithMethod ¶
func (m *Server) GetRequestsWithMethod(method string) []RequestLog
GetRequestsWithMethod returns all requests with the specified method
func (*Server) HasRequestWithMethod ¶
HasRequestWithMethod checks if a request with the specified method was made
func (*Server) ListMultipartUploads ¶
ListMultipartUploads returns all active multipart uploads
func (*Server) ListObjects ¶
ListObjects returns a list of object keys matching the given prefix
func (*Server) ObjectContent ¶
ObjectContent returns the content of an object if it exists
func (*Server) ObjectExists ¶
ObjectExists checks if an object exists in the mock server
func (*Server) PopulateTestData ¶
PopulateTestData adds multiple test objects to the mock server
func (*Server) PutObjectWithMetadata ¶
func (m *Server) PutObjectWithMetadata(key string, content []byte, metadata map[string]string) string
PutObjectWithMetadata adds an object with metadata to the mock server
func (*Server) RequestCount ¶
RequestCount returns the number of requests made to the server
func (*Server) ServeHTTP ¶
func (m *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles HTTP requests to the mock S3 server
func (*Server) SetObjectMetadata ¶
SetObjectMetadata sets metadata for an existing object