class
AWS::S3::Client
- AWS::S3::Client
- AWS::Client
- Reference
- Object
Defined in:
s3.crConstant Summary
-
MAXIMUM_PART_COUNT =
10000 -
Part numbers must be in
1..MAXIMUM_PART_COUNT. -
MINIMUM_PART_SIZE =
(5 * 1024) * 1024 -
S3 requires every part of a multipart upload except the last to be at least this large.
-
SERVICE_NAME =
"s3"
Instance Method Summary
-
#abort_multipart_upload(bucket_name : String, key : String, upload_id : String)
Cancels the upload and frees the storage used by its parts.
- #abort_multipart_upload(upload : MultipartUpload)
-
#complete_multipart_upload(bucket_name : String, key : String, upload_id : String, parts : Enumerable(MultipartUpload::Part)) : CompleteMultipartUploadResult
Assembles the uploaded
partsinto the final object. - #complete_multipart_upload(upload : MultipartUpload, parts : Enumerable(MultipartUpload::Part)) : CompleteMultipartUploadResult
-
#create_multipart_upload(bucket_name : String, key : String, headers my_headers : HTTP::Headers = HTTP::Headers.new) : MultipartUpload
Starts a multipart upload.
- #delete_object(bucket_name : String, key : String)
- #get_object(bucket_name : String, key : String, io : IO) : Nil
- #get_object(bucket : Bucket, key : String)
- #get_object(bucket_name : String, key : String) : String
- #head_object(bucket : Bucket, key : String)
- #head_object(bucket_name : String, key : String)
- #list_buckets
- #list_objects(bucket : Bucket, continuation_token : String | Nil = nil)
- #list_objects(bucket_name : String, continuation_token : String | Nil = nil)
- #list_parts(upload : MultipartUpload, part_number_marker : Int | Nil = nil, max_parts : Int | Nil = nil) : ListPartsResult
-
#list_parts(bucket_name : String, key : String, upload_id : String, part_number_marker : Int | Nil = nil, max_parts : Int | Nil = nil) : ListPartsResult
Lists the parts uploaded so far, which is how a client that lost track of an upload in progress can resume it.
-
#multipart_upload(bucket_name : String, key : String, body : IO, headers : HTTP::Headers = HTTP::Headers.new, part_size : Int = MINIMUM_PART_SIZE) : CompleteMultipartUploadResult
Uploads
bodyas a multipart upload, reading itpart_sizebytes at a time and never holding more than one part in memory. -
#presigned_url(method : String, bucket_name : String, key : String, ttl = 10.minutes, headers = HTTP::Headers.new)
Returns a URL that lets anyone holding it perform
methodon the object untilttlelapses. - #put_object(bucket_name : String, key : String, headers my_headers : HTTP::Headers, body : IO)
- #put_object(bucket_name : String, key : String, headers : HTTP::Headers, body : String)
- #upload_part(bucket_name : String, key : String, upload_id : String, part_number : Int, body : String | Bytes, headers : HTTP::Headers = HTTP::Headers.new) : MultipartUpload::Part
-
#upload_part(bucket_name : String, key : String, upload_id : String, part_number : Int, body : IO, headers my_headers : HTTP::Headers = HTTP::Headers.new) : MultipartUpload::Part
Uploads one part of a multipart upload.
- #upload_part(upload : MultipartUpload, part_number : Int, body : IO, headers : HTTP::Headers = HTTP::Headers.new) : MultipartUpload::Part
- #upload_part(upload : MultipartUpload, part_number : Int, body : String | Bytes, headers : HTTP::Headers = HTTP::Headers.new) : MultipartUpload::Part
Instance methods inherited from class AWS::Client
delete(path : String, headers = HTTP::Headers.new)
delete,
get(path : String, headers = HTTP::Headers.new)get(path : String, headers = HTTP::Headers.new, &block : HTTP::Client::Response -> ) get, head(path : String, headers : HTTP::Headers) head, post(path : String, body : String, headers = HTTP::Headers.new) post, put(path : String, body : IO, headers = HTTP::Headers.new) put
Constructor methods inherited from class AWS::Client
new(access_key_id : String = AWS.access_key_id, secret_access_key : String = AWS.secret_access_key, region : String = AWS.region, endpoint : URI = URI.parse("https://#{service_name}.#{region}.amazonaws.com"), session_token : Nil | String = AWS.session_token)
new
Macros inherited from class AWS::Client
service_name
service_name
Instance Method Detail
Cancels the upload and frees the storage used by its parts. Parts still being uploaded when this is called may survive, so it is worth calling again if any uploads were in flight.
Assembles the uploaded parts into the final object. Parts are
assembled in ascending part number order regardless of the order given
here, and any uploaded parts left out of parts are discarded.
Starts a multipart upload. Every part is then sent with #upload_part
and the object is assembled with #complete_multipart_upload. Object
metadata such as Content-Type is set here, not on the parts.
Lists the parts uploaded so far, which is how a client that lost track
of an upload in progress can resume it. Results are paginated: when
truncated? is set, pass next_part_number_marker back in as
part_number_marker to get the next page.
Uploads body as a multipart upload, reading it part_size bytes at a
time and never holding more than one part in memory. This is the
simplest way to upload something large or something that can't be
rewound, such as a socket or a pipe.
headers are applied to the object the same way they are for
#put_object. If anything goes wrong after the upload has been created,
it is aborted so S3 does not keep billing for the orphaned parts, and
the original error is re-raised.
Returns a URL that lets anyone holding it perform method on the
object until ttl elapses. Any headers given are part of the
signature, so the client using the URL must send them exactly.
Uploads one part of a multipart upload. Parts are numbered from 1 and can be uploaded in any order, concurrently, or more than once (the last upload of a given number wins).
The body must be rewindable so it can be hashed for the signature. If
it is not an IO::Memory, you must set Content-Length in headers
yourself, since S3 does not accept chunked uploads.