You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Aws::S3::MultipartUpload

Inherits:
Resources::Resource show all
Defined in:
aws-sdk-resources/lib/aws-sdk-resources/services/s3/multipart_upload.rb

Instance Attribute Summary collapse

Attributes inherited from Resources::Resource

#client, #identifiers

Instance Method Summary collapse

Methods inherited from Resources::Resource

add_data_attribute, add_identifier, #data, data_attributes, #data_loaded?, identifiers, #load, #wait_until

Methods included from Resources::OperationMethods

#add_batch_operation, #add_operation, #batch_operation, #batch_operation_names, #batch_operations, #operation, #operation_names, #operations

Constructor Details

#initialize(bucket_name, object_key, id, options = {}) ⇒ Object #initialize(options = {}) ⇒ Object

Overloads:

  • #initialize(bucket_name, object_key, id, options = {}) ⇒ Object

    Parameters:

    • bucket_name (String)
    • object_key (String)
    • id (String)

    Options Hash (options):

    • :client (Client)

      When `:client is not given, the options hash is used to construct a new Client object.

  • #initialize(options = {}) ⇒ Object

    Options Hash (options):

    • :bucket_name (required, String)
    • :object_key (required, String)
    • :id (required, String)
    • :client (Client)

      When `:client is not given, the options hash is used to construct a new Client object.

Instance Attribute Details

#bucket_nameString (readonly)

Returns:

  • (String)

#idString (readonly)

Returns:

  • (String)

#initiatedTime (readonly)

Date and time at which the multipart upload was initiated.

Returns:

  • (Time)

    Date and time at which the multipart upload was initiated.

#initiatorTypes::Initiator (readonly)

Identifies who initiated the multipart upload.

Returns:

#keyString (readonly)

Key of the object for which the multipart upload was initiated.

Returns:

  • (String)

    Key of the object for which the multipart upload was initiated.

#object_keyString (readonly)

Returns:

  • (String)

#ownerTypes::Owner (readonly)

Returns:

#storage_classString (readonly)

The class of storage used to store the object.

Possible values:

  • STANDARD
  • REDUCED_REDUNDANCY
  • STANDARD_IA

Returns:

  • (String)

    The class of storage used to store the object.

#upload_idString (readonly)

Upload ID that identifies the multipart upload.

Returns:

  • (String)

    Upload ID that identifies the multipart upload.

Instance Method Details

#abort(options = {}) ⇒ Types::AbortMultipartUploadOutput

Aborts a multipart upload.

To verify that all parts have been removed, so you don't get charged for the part storage, you should call the List Parts operation and ensure the parts list is empty.

Examples:

Request syntax example with placeholder values


multipartupload.abort({
  request_payer: "requester", # accepts requester
  use_accelerate_endpoint: false,
})

Options Hash (options):

Returns:

See Also:

#basic_completeObject



5
# File 'aws-sdk-resources/lib/aws-sdk-resources/services/s3/multipart_upload.rb', line 5

alias_method :basic_complete, :complete

#complete(options = {}) ⇒ Object

Completes the upload, requires a list of completed parts. You can provide the list of parts with :part_number and :etag values.

upload.complete(multipart_upload: { parts: [
  { part_number: 1, etag:'etag1' },
  { part_number: 2, etag:'etag2' },
  ...
]})

Alternatively, you can pass compute_parts: true and the part list will be computed by calling Client#list_parts.

upload.complete(compute_parts: true)

Examples:

Request syntax example with placeholder values


multipartupload.complete({
  multipart_upload: {
    parts: [
      {
        etag: "ETag",
        part_number: 1,
      },
    ],
  },
  request_payer: "requester", # accepts requester
  use_accelerate_endpoint: false,
})

Basic usage

object = multipartupload.complete(options)
object.key
#=> "object-key"

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

Returns:

See Also:



25
26
27
28
29
30
# File 'aws-sdk-resources/lib/aws-sdk-resources/services/s3/multipart_upload.rb', line 25

def complete(options = {})
  if options.delete(:compute_parts)
    options[:multipart_upload] = { parts: compute_parts }
  end
  basic_complete(options)
end

#objectObject

Returns:

See Also:

#part(part_number) ⇒ MultipartUploadPart

Parameters:

Returns:

See Also:

#parts(options = {}) ⇒ Collection<MultipartUploadPart>

Returns a Collection of Aws::S3::MultipartUploadPart resources. No API requests are made until you call an enumerable method on the collection. Client#list_parts will be called multiple times until every Aws::S3::MultipartUploadPart has been yielded.

Examples:

Request syntax example with placeholder values


multipartupload.parts({
  max_parts: 1,
  part_number_marker: 1,
  request_payer: "requester", # accepts requester
  use_accelerate_endpoint: false,
})

Enumerating Aws::S3::MultipartUploadPart resources.

multipartupload.parts.each do |multipartuploadpart|
  # yields each multipartuploadpart
end

Enumerating Aws::S3::MultipartUploadPart resources with a limit.

multipartupload.parts.limit(10).each do |multipartuploadpart|
  # yields at most 10 parts
end

Options Hash (options):

  • :max_parts (Integer)

    Sets the maximum number of parts to return.

  • :part_number_marker (Integer)

    Specifies the part after which listing should begin. Only parts with higher part numbers will be listed.

  • :request_payer (String)

    Confirms that the requester knows that she or he will be charged for the request. Bucket owners need not specify this parameter in their requests. Documentation on downloading objects from requester pays buckets can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html

  • :use_accelerate_endpoint (Boolean)

    When true, the "https://BUCKETNAME.s3-accelerate.amazonaws.com" endpoint will be used.

Returns:

See Also: