Method: Aws::S3::ObjectSummary#delete
- Defined in:
- lib/aws-sdk-s3/object_summary.rb
#delete(options = {}) ⇒ Types::DeleteObjectOutput
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
object_summary.delete({
mfa: "MFA",
version_id: "ObjectVersionId",
request_payer: "requester", # accepts requester
bypass_governance_retention: false,
expected_bucket_owner: "AccountId",
if_match: "IfMatch",
if_match_last_modified_time: Time.now,
if_match_size: 1,
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:mfa
(String)
—
The concatenation of the authentication device’s serial number, a space, and the value that is displayed on your authentication device. Required to permanently delete a versioned object if versioning is configured with MFA delete enabled.
<note markdown=“1”> This functionality is not supported for directory buckets.
</note> -
:version_id
(String)
—
Version ID used to reference a specific version of the object.
<note markdown=“1”> For directory buckets in this API operation, only the
nullvalue of the version ID is supported.</note> -
: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. If either the source or destination S3 bucket has Requester Pays enabled, the requester will pay for the corresponding charges. For information about downloading objects from Requester Pays buckets, see [Downloading Objects in Requester Pays Buckets] in the *Amazon S3 User Guide*.
<note markdown=“1”> This functionality is not supported for directory buckets.
</note>[1]: docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
-
:bypass_governance_retention
(Boolean)
—
Indicates whether S3 Object Lock should bypass Governance-mode restrictions to process this operation. To use this header, you must have the
s3:BypassGovernanceRetentionpermission.<note markdown=“1”> This functionality is not supported for directory buckets.
</note> -
:expected_bucket_owner
(String)
—
The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code ‘403 Forbidden` (access denied).
-
:if_match
(String)
—
Deletes the object if the ETag (entity tag) value provided during the delete operation matches the ETag of the object in S3. If the ETag values do not match, the operation returns a ‘412 Precondition Failed` error.
Expects the ETag value as a string.
If-Matchdoes accept a string value of an ‘*’ (asterisk) character to denote a match of any ETag.For more information about conditional requests, see [RFC 7232].
-
:if_match_last_modified_time
(Time, DateTime, Date, Integer, String)
—
If present, the object is deleted only if its modification times matches the provided
Timestamp. If theTimestampvalues do not match, the operation returns a ‘412 Precondition Failed` error. If theTimestampmatches or if the object doesn’t exist, the operation returns a `204 Success (No Content)` response.<note markdown=“1”> This functionality is only supported for directory buckets.
</note> -
:if_match_size
(Integer)
—
If present, the object is deleted only if its size matches the provided size in bytes. If the
Sizevalue does not match, the operation returns a ‘412 Precondition Failed` error. If theSizematches or if the object doesn’t exist, the operation returns a `204 Success (No Content)` response.<note markdown=“1”> This functionality is only supported for directory buckets.
</note>You can use the
If-Match,x-amz-if-match-last-modified-timeandx-amz-if-match-sizeconditional headers in conjunction with each-other or individually.
Returns:
1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 |
# File 'lib/aws-sdk-s3/object_summary.rb', line 1204 def delete(options = {}) options = options.merge( bucket: @bucket_name, key: @key ) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.delete_object(options) end resp.data end |