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)

Specifies the owner of the object that is part of the multipart upload.

Returns:

  • (Types::Owner)

    Specifies the owner of the object that is part of the multipart upload.

#storage_classString (readonly)

The class of storage used to store the object.

Possible values:

  • STANDARD
  • REDUCED_REDUNDANCY
  • STANDARD_IA
  • ONEZONE_IA
  • INTELLIGENT_TIERING
  • GLACIER
  • DEEP_ARCHIVE
  • OUTPOSTS

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

This operation aborts a multipart upload. After a multipart upload is aborted, no additional parts can be uploaded using that upload ID. The storage consumed by any previously uploaded parts will be freed. However, if any part uploads are currently in progress, those part uploads might or might not succeed. As a result, it might be necessary to abort a given multipart upload multiple times in order to completely free all storage consumed by all parts.

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

For information about permissions required to use the multipart upload API, see Multipart Upload API and Permissions.

The following operations are related to AbortMultipartUpload:

Examples:

Request syntax example with placeholder values


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

Options Hash (options):

  • :request_payer (String)

    Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. For information about downloading objects from requester pays buckets, see Downloading Objects in Requestor Pays Buckets in the Amazon S3 Developer Guide.

  • :expected_bucket_owner (String)

    The account id of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

  • :use_accelerate_endpoint (Boolean)

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

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
  expected_bucket_owner: "AccountId",
  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):

  • :compute_parts (Boolean) — default: false

    When true, the Client#list_parts method will be called to determine the list of required part numbers and their ETags.

  • :multipart_upload (Types::CompletedMultipartUpload)

    The container for the multipart upload request information.

  • :request_payer (String)

    Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. For information about downloading objects from requester pays buckets, see Downloading Objects in Requestor Pays Buckets in the Amazon S3 Developer Guide.

  • :expected_bucket_owner (String)

    The account id of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

  • :use_accelerate_endpoint (Boolean)

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

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
  expected_bucket_owner: "AccountId",
  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 they will be charged for the request. Bucket owners need not specify this parameter in their requests. For information about downloading objects from requester pays buckets, see Downloading Objects in Requestor Pays Buckets in the Amazon S3 Developer Guide.

  • :expected_bucket_owner (String)

    The account id of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

  • :use_accelerate_endpoint (Boolean)

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

Returns:

See Also: