Class: Aws::S3::Object
- Inherits:
-
Object
- Object
- Aws::S3::Object
- Extended by:
- Deprecations
- Defined in:
- sig/object.rbs,
lib/aws-sdk-s3/customizations/object.rb,
sig/customizations/object.rbs,
lib/aws-sdk-s3/object.rb
Overview
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#accept_ranges ⇒ String
Indicates that a range of bytes was specified.
-
#archive_status ⇒ String
The archive state of the head object.
-
#bucket_key_enabled ⇒ Boolean
Indicates whether the object uses an S3 Bucket Key for server-side encryption with Key Management Service (KMS) keys (SSE-KMS).
- #bucket_name ⇒ String
-
#cache_control ⇒ String
Specifies caching behavior along the request/reply chain.
-
#checksum_crc32 ⇒ String
The Base64 encoded, 32-bit
CRC32 checksumof the object. -
#checksum_crc32c ⇒ String
The Base64 encoded, 32-bit
CRC32Cchecksum of the object. -
#checksum_crc64nvme ⇒ String
The Base64 encoded, 64-bit
CRC64NVMEchecksum of the object. -
#checksum_md5 ⇒ String
The Base64 encoded, 128-bit
MD5digest of the object. -
#checksum_sha1 ⇒ String
The Base64 encoded, 160-bit
SHA1digest of the object. -
#checksum_sha256 ⇒ String
The Base64 encoded, 256-bit
SHA256digest of the object. -
#checksum_sha512 ⇒ String
The Base64 encoded, 512-bit
SHA512digest of the object. -
#checksum_type ⇒ String
The checksum type, which determines how part-level checksums are combined to create an object-level checksum for multipart objects.
-
#checksum_xxhash128 ⇒ String
The Base64 encoded, 128-bit
XXHASH128checksum of the object. -
#checksum_xxhash3 ⇒ String
The Base64 encoded, 64-bit
XXHASH3checksum of the object. -
#checksum_xxhash64 ⇒ String
The Base64 encoded, 64-bit
XXHASH64checksum of the object. -
#content_disposition ⇒ String
Specifies presentational information for the object.
-
#content_encoding ⇒ String
Indicates what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field.
-
#content_language ⇒ String
The language the content is in.
-
#content_length ⇒ Integer
Size of the body in bytes.
-
#content_range ⇒ String
The portion of the object returned in the response for a
GETrequest. -
#content_type ⇒ String
A standard MIME type describing the format of the object data.
-
#delete_marker ⇒ Boolean
Specifies whether the object retrieved was (true) or was not (false) a Delete Marker.
-
#etag ⇒ String
An entity tag (ETag) is an opaque identifier assigned by a web server to a specific version of a resource found at a URL.
-
#expiration ⇒ String
If the object expiration is configured (see [
PutBucketLifecycleConfiguration][1]), the response includes this header. -
#expires ⇒ Time
The date and time at which the object is no longer cacheable.
- #expires_string ⇒ String
- #key ⇒ String
-
#last_modified ⇒ Time
Date and time when the object was last modified.
-
#metadata ⇒ Hash<String,String>
A map of metadata to store with the object in S3.
-
#missing_meta ⇒ Integer
This is set to the number of metadata entries not returned in
x-amz-metaheaders. -
#object_lock_legal_hold_status ⇒ String
Specifies whether a legal hold is in effect for this object.
-
#object_lock_mode ⇒ String
The Object Lock mode, if any, that's in effect for this object.
-
#object_lock_retain_until_date ⇒ Time
The date and time when the Object Lock retention period expires.
-
#parts_count ⇒ Integer
The count of parts this object has.
-
#replication_status ⇒ String
Amazon S3 can return this header if your request involves a bucket that is either a source or a destination in a replication rule.
-
#request_charged ⇒ String
If present, indicates that the requester was successfully charged for the request.
-
#restore ⇒ String
If the object is an archived object (an object whose storage class is GLACIER), the response includes this header if either the archive restoration is in progress (see [RestoreObject][1] or an archive copy is already restored.
-
#server_side_encryption ⇒ String
The server-side encryption algorithm used when you store this object in Amazon S3 or Amazon FSx.
-
#sse_customer_algorithm ⇒ String
If server-side encryption with a customer-provided encryption key was requested, the response will include this header to confirm the encryption algorithm that's used.
-
#sse_customer_key_md5 ⇒ String
If server-side encryption with a customer-provided encryption key was requested, the response will include this header to provide the round-trip message integrity verification of the customer-provided encryption key.
-
#ssekms_key_id ⇒ String
If present, indicates the ID of the KMS key that was used for object encryption.
-
#storage_class ⇒ String
Provides storage class information of the object.
-
#tag_count ⇒ Integer
The number of tags, if any, on the object, when you have the relevant permission to read object tags.
-
#version_id ⇒ String
Version ID of the object.
-
#website_redirect_location ⇒ String
If the bucket is configured as a website, redirects requests for this object to another object in the same bucket or to an external URL.
Actions collapse
- #copy_from(options = {}) ⇒ Types::CopyObjectOutput
- #delete(options = {}) ⇒ Types::DeleteObjectOutput
- #get(options = {}, &block) ⇒ Types::GetObjectOutput
- #head(options = {}) ⇒ Types::HeadObjectOutput
- #initiate_multipart_upload(options = {}) ⇒ MultipartUpload
- #put(options = {}) ⇒ Types::PutObjectOutput
- #restore_object(options = {}) ⇒ Types::RestoreObjectOutput
Associations collapse
- #acl ⇒ ObjectAcl
- #bucket ⇒ Bucket
- #identifiers ⇒ Object deprecated private Deprecated.
- #multipart_upload(id) ⇒ MultipartUpload
- #version(id) ⇒ ObjectVersion
Instance Method Summary collapse
- #client ⇒ Client
- #copy_to(target, options = {}) ⇒ void
-
#data ⇒ Types::HeadObjectOutput
Returns the data for this Object.
-
#data_loaded? ⇒ Boolean
Returns
trueif this resource is loaded. - #download_file(destination, options = {}) ⇒ Boolean
-
#exists?(options = {}) ⇒ Boolean
Returns
trueif the Object exists. -
#initialize(*args) ⇒ Object
constructor
A new instance of Object.
- #load ⇒ self (also: #reload)
- #move_to(target, options = {}) ⇒ void
- #presigned_post(options = {}) ⇒ Object
- #presigned_request(method, params = {}) ⇒ [String, Hash[String, String]]
- #presigned_url(method, params = {}) ⇒ String
- #public_url(options = {}) ⇒ String
- #size ⇒ Object
- #upload_file(source, options = {}) ⇒ void
- #upload_stream(options = {}) {|write_stream| ... } ⇒ Boolean
-
#wait_until(options = {}) {|resource| ... } ⇒ Resource
deprecated
Deprecated.
Use [Aws::S3::Client] #wait_until instead
- #wait_until_exists(options = {}, &block) ⇒ Object
- #wait_until_not_exists(options = {}, &block) ⇒ Object
Constructor Details
#initialize(bucket_name, key, options = {}) ⇒ Object #initialize(options = {}) ⇒ Object
Returns a new instance of Object.
13 14 15 |
# File 'sig/object.rbs', line 13
def initialize: (String bucket_name, String key, Hash[Symbol, untyped] options) -> void
| (bucket_name: String, key: String, ?client: Client) -> void
| (Hash[Symbol, untyped] args) -> void
|
Instance Method Details
#accept_ranges ⇒ String
Indicates that a range of bytes was specified.
27 |
# File 'sig/object.rbs', line 27
def accept_ranges: () -> ::String
|
#archive_status ⇒ String
The archive state of the head object.
36 |
# File 'sig/object.rbs', line 36
def archive_status: () -> ("ARCHIVE_ACCESS" | "DEEP_ARCHIVE_ACCESS")
|
#bucket_key_enabled ⇒ Boolean
Indicates whether the object uses an S3 Bucket Key for server-side encryption with Key Management Service (KMS) keys (SSE-KMS).
129 |
# File 'sig/object.rbs', line 129
def bucket_key_enabled: () -> bool
|
#bucket_name ⇒ String
18 |
# File 'sig/object.rbs', line 18
def bucket_name: () -> String
|
#cache_control ⇒ String
Specifies caching behavior along the request/reply chain.
87 |
# File 'sig/object.rbs', line 87
def cache_control: () -> ::String
|
#checksum_crc32 ⇒ String
The Base64 encoded, 32-bit CRC32 checksum of the object. This
checksum is only present if the checksum was uploaded with the object.
When you use an API operation on an object that was uploaded using
multipart uploads, this value may not be a direct checksum value of
the full object. Instead, it's a calculation based on the checksum
values of each individual part. For more information about how
checksums are calculated with multipart uploads, see Checking object
integrity in the Amazon S3 User Guide.
45 |
# File 'sig/object.rbs', line 45
def checksum_crc32: () -> ::String
|
#checksum_crc32c ⇒ String
The Base64 encoded, 32-bit CRC32C checksum of the object. This
checksum is only present if the checksum was uploaded with the object.
When you use an API operation on an object that was uploaded using
multipart uploads, this value may not be a direct checksum value of
the full object. Instead, it's a calculation based on the checksum
values of each individual part. For more information about how
checksums are calculated with multipart uploads, see Checking object
integrity in the Amazon S3 User Guide.
48 |
# File 'sig/object.rbs', line 48
def checksum_crc32c: () -> ::String
|
#checksum_crc64nvme ⇒ String
The Base64 encoded, 64-bit CRC64NVME checksum of the object. For
more information, see Checking object integrity in the Amazon S3 User
Guide.
51 |
# File 'sig/object.rbs', line 51
def checksum_crc64nvme: () -> ::String
|
#checksum_md5 ⇒ String
The Base64 encoded, 128-bit MD5 digest of the object. For more
information, see Checking object integrity in the Amazon S3 User
Guide.
63 |
# File 'sig/object.rbs', line 63
def checksum_md5: () -> ::String
|
#checksum_sha1 ⇒ String
The Base64 encoded, 160-bit SHA1 digest of the object. This checksum
is only present if the checksum was uploaded with the object. When you
use the API operation on an object that was uploaded using multipart
uploads, this value may not be a direct checksum value of the full
object. Instead, it's a calculation based on the checksum values of
each individual part. For more information about how checksums are
calculated with multipart uploads, see Checking object integrity
in the Amazon S3 User Guide.
54 |
# File 'sig/object.rbs', line 54
def checksum_sha1: () -> ::String
|
#checksum_sha256 ⇒ String
The Base64 encoded, 256-bit SHA256 digest of the object. This
checksum is only present if the checksum was uploaded with the object.
When you use an API operation on an object that was uploaded using
multipart uploads, this value may not be a direct checksum value of
the full object. Instead, it's a calculation based on the checksum
values of each individual part. For more information about how
checksums are calculated with multipart uploads, see Checking object
integrity in the Amazon S3 User Guide.
57 |
# File 'sig/object.rbs', line 57
def checksum_sha256: () -> ::String
|
#checksum_sha512 ⇒ String
The Base64 encoded, 512-bit SHA512 digest of the object. For more
information, see Checking object integrity in the Amazon S3 User
Guide.
60 |
# File 'sig/object.rbs', line 60
def checksum_sha512: () -> ::String
|
#checksum_type ⇒ String
The checksum type, which determines how part-level checksums are
combined to create an object-level checksum for multipart objects. You
can use this header response to verify that the checksum type that is
received is the same checksum type that was specified in
CreateMultipartUpload request. For more information, see Checking
object integrity in the Amazon S3 User Guide.
75 |
# File 'sig/object.rbs', line 75
def checksum_type: () -> ("COMPOSITE" | "FULL_OBJECT")
|
#checksum_xxhash128 ⇒ String
The Base64 encoded, 128-bit XXHASH128 checksum of the object. For
more information, see Checking object integrity in the Amazon S3 User
Guide.
72 |
# File 'sig/object.rbs', line 72
def checksum_xxhash128: () -> ::String
|
#checksum_xxhash3 ⇒ String
The Base64 encoded, 64-bit XXHASH3 checksum of the object. For more
information, see Checking object integrity in the Amazon S3 User
Guide.
69 |
# File 'sig/object.rbs', line 69
def checksum_xxhash3: () -> ::String
|
#checksum_xxhash64 ⇒ String
The Base64 encoded, 64-bit XXHASH64 checksum of the object. For more
information, see Checking object integrity in the Amazon S3 User
Guide.
66 |
# File 'sig/object.rbs', line 66
def checksum_xxhash64: () -> ::String
|
#content_disposition ⇒ String
Specifies presentational information for the object.
90 |
# File 'sig/object.rbs', line 90
def content_disposition: () -> ::String
|
#content_encoding ⇒ String
Indicates what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field.
93 |
# File 'sig/object.rbs', line 93
def content_encoding: () -> ::String
|
#content_language ⇒ String
The language the content is in.
96 |
# File 'sig/object.rbs', line 96
def content_language: () -> ::String
|
#content_length ⇒ Integer
Size of the body in bytes.
42 |
# File 'sig/object.rbs', line 42
def content_length: () -> ::Integer
|
#content_range ⇒ String
The portion of the object returned in the response for a GET
request.
102 |
# File 'sig/object.rbs', line 102
def content_range: () -> ::String
|
#content_type ⇒ String
A standard MIME type describing the format of the object data.
99 |
# File 'sig/object.rbs', line 99
def content_type: () -> ::String
|
#copy_from(options = {}) ⇒ Types::CopyObjectOutput
99 |
# File 'lib/aws-sdk-s3/customizations/object.rb', line 99 alias_method :copy_from, :copy_from |
#copy_to(target, options = {}) ⇒ void
This method returns an undefined value.
https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Object.html#copy_to-instance_method
142 143 144 145 146 |
# File 'lib/aws-sdk-s3/customizations/object.rb', line 142 def copy_to(target, = {}) Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do ObjectCopier.new(self, ).copy_to(target, ) end end |
#data ⇒ Types::HeadObjectOutput
Returns the data for this Aws::S3::Object. Calls
Client#head_object if #data_loaded? is false.
162 |
# File 'sig/object.rbs', line 162
def data: () -> Types::HeadObjectOutput
|
#data_loaded? ⇒ Boolean
165 |
# File 'sig/object.rbs', line 165
def data_loaded?: () -> bool
|
#delete(options = {}) ⇒ Types::DeleteObjectOutput
227 |
# File 'sig/object.rbs', line 227
def delete: (
|
#delete_marker ⇒ Boolean
Specifies whether the object retrieved was (true) or was not (false) a Delete Marker. If false, this response header does not appear in the response.
24 |
# File 'sig/object.rbs', line 24
def delete_marker: () -> bool
|
#download_file(destination, options = {}) ⇒ Boolean
562 563 564 565 566 567 568 569 570 571 |
# File 'lib/aws-sdk-s3/customizations/object.rb', line 562 def download_file(destination, = {}) download_opts = .merge(bucket: bucket_name, key: key) executor = DefaultExecutor.new(max_threads: download_opts.delete([:thread_count])) downloader = FileDownloader.new(client: client, executor: executor) Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do downloader.download(destination, download_opts) end executor.shutdown true end |
#etag ⇒ String
An entity tag (ETag) is an opaque identifier assigned by a web server to a specific version of a resource found at a URL.
78 |
# File 'sig/object.rbs', line 78
def etag: () -> ::String
|
#exists?(options = {}) ⇒ Boolean
Returns true if the Object exists.
168 169 |
# File 'sig/object.rbs', line 168
def exists?: (?max_attempts: Integer, ?delay: Numeric, ?before_attempt: (^(Integer attempts) -> void), ?before_wait: (^(Integer attempts, untyped response) -> void)) -> bool
| (?Hash[Symbol, untyped]) -> bool
|
#expiration ⇒ String
If the object expiration is configured (see
PutBucketLifecycleConfiguration ), the response includes this
header. It includes the expiry-date and rule-id key-value pairs
providing object expiration information. The value of the rule-id is
URL-encoded.
NotImplemented" in all responses
for directory buckets.
30 |
# File 'sig/object.rbs', line 30
def expiration: () -> ::String
|
#expires ⇒ Time
The date and time at which the object is no longer cacheable.
105 |
# File 'sig/object.rbs', line 105
def expires: () -> ::Time
|
#expires_string ⇒ String
108 |
# File 'sig/object.rbs', line 108
def expires_string: () -> ::String
|
#get(options = {}, &block) ⇒ Types::GetObjectOutput
240 |
# File 'sig/object.rbs', line 240
def get: (
|
#identifiers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
3632 3633 3634 3635 3636 3637 |
# File 'lib/aws-sdk-s3/object.rb', line 3632 def identifiers { bucket_name: @bucket_name, key: @key } end |
#initiate_multipart_upload(options = {}) ⇒ MultipartUpload
264 |
# File 'sig/object.rbs', line 264
def initiate_multipart_upload: (
|
#key ⇒ String
21 |
# File 'sig/object.rbs', line 21
def key: () -> String
|
#last_modified ⇒ Time
Date and time when the object was last modified.
39 |
# File 'sig/object.rbs', line 39
def last_modified: () -> ::Time
|
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::S3::Object.
Returns self making it possible to chain methods.
object.reload.data
158 |
# File 'sig/object.rbs', line 158
def load: () -> self
|
#metadata ⇒ Hash<String,String>
A map of metadata to store with the object in S3.
117 |
# File 'sig/object.rbs', line 117
def metadata: () -> ::Hash[::String, ::String]
|
#missing_meta ⇒ Integer
This is set to the number of metadata entries not returned in
x-amz-meta headers. This can happen if you create metadata using an
API like SOAP that supports more flexible metadata than the REST API.
For example, using SOAP, you can create metadata whose values are not
legal HTTP headers.
81 |
# File 'sig/object.rbs', line 81
def missing_meta: () -> ::Integer
|
#move_to(target, options = {}) ⇒ void
This method returns an undefined value.
https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Object.html#move_to-instance_method
156 157 158 159 |
# File 'lib/aws-sdk-s3/customizations/object.rb', line 156 def move_to(target, = {}) copy_to(target, ) delete end |
#multipart_upload(id) ⇒ MultipartUpload
467 |
# File 'sig/object.rbs', line 467
def multipart_upload: (String id) -> MultipartUpload
|
#object_lock_legal_hold_status ⇒ String
Specifies whether a legal hold is in effect for this object. This
header is only returned if the requester has the
s3:GetObjectLegalHold permission. This header is not returned if the
specified version of this object has never had a legal hold applied.
For more information about S3 Object Lock, see Object Lock.
153 |
# File 'sig/object.rbs', line 153
def object_lock_legal_hold_status: () -> ("ON" | "OFF")
|
#object_lock_mode ⇒ String
The Object Lock mode, if any, that's in effect for this object. This
header is only returned if the requester has the
s3:GetObjectRetention permission. For more information about S3
Object Lock, see Object Lock.
147 |
# File 'sig/object.rbs', line 147
def object_lock_mode: () -> ("GOVERNANCE" | "COMPLIANCE")
|
#object_lock_retain_until_date ⇒ Time
The date and time when the Object Lock retention period expires. This
header is only returned if the requester has the
s3:GetObjectRetention permission.
150 |
# File 'sig/object.rbs', line 150
def object_lock_retain_until_date: () -> ::Time
|
#parts_count ⇒ Integer
The count of parts this object has. This value is only returned if you
specify partNumber in your request and the object was uploaded as a
multipart upload.
141 |
# File 'sig/object.rbs', line 141
def parts_count: () -> ::Integer
|
#presigned_post(options = {}) ⇒ Object
170 171 172 173 174 175 176 177 |
# File 'lib/aws-sdk-s3/customizations/object.rb', line 170 def presigned_post( = {}) PresignedPost.new( client.config.credentials, client.config.region, bucket_name, { key: key, url: bucket.url }.merge() ) end |
#presigned_request(method, params = {}) ⇒ [String, Hash[String, String]]
314 315 316 317 318 319 320 321 322 323 324 325 |
# File 'lib/aws-sdk-s3/customizations/object.rb', line 314 def presigned_request(method, params = {}) presigner = Presigner.new(client: client) if %w(delete head get put).include?(method.to_s) method = "#{method}_object".to_sym end presigner.presigned_request( method.downcase, params.merge(bucket: bucket_name, key: key) ) end |
#presigned_url(method, params = {}) ⇒ String
241 242 243 244 245 246 247 248 249 250 251 252 |
# File 'lib/aws-sdk-s3/customizations/object.rb', line 241 def presigned_url(method, params = {}) presigner = Presigner.new(client: client) if %w(delete head get put).include?(method.to_s) method = "#{method}_object".to_sym end presigner.presigned_url( method.downcase, params.merge(bucket: bucket_name, key: key) ) end |
#public_url(options = {}) ⇒ String
349 350 351 352 353 354 |
# File 'lib/aws-sdk-s3/customizations/object.rb', line 349 def public_url( = {}) url = URI.parse(bucket.url()) url.path += '/' unless url.path[-1] == '/' url.path += key.gsub(/[^\/]+/) { |s| Seahorse::Util.uri_escape(s) } url.to_s end |
#replication_status ⇒ String
Amazon S3 can return this header if your request involves a bucket that is either a source or a destination in a replication rule.
In replication, you have a source bucket on which you configure
replication and destination bucket or buckets where Amazon S3 stores
object replicas. When you request an object (GetObject) or object
metadata (HeadObject) from these buckets, Amazon S3 will return the
x-amz-replication-status header in the response as follows:
-
If requesting an object from the source bucket, Amazon S3 will return the
x-amz-replication-statusheader if the object in your request is eligible for replication.For example, suppose that in your replication configuration, you specify object prefix
TaxDocsrequesting Amazon S3 to replicate objects with key prefixTaxDocs. Any objects you upload with this key name prefix, for exampleTaxDocs/document1.pdf, are eligible for replication. For any object request with this key name prefix, Amazon S3 will return thex-amz-replication-statusheader with value PENDING, COMPLETED or FAILED indicating object replication status. -
If requesting an object from a destination bucket, Amazon S3 will return the
x-amz-replication-statusheader with value REPLICA if the object in your request is a replica that Amazon S3 created and there is no replica modification replication in progress. -
When replicating objects to multiple destination buckets, the
x-amz-replication-statusheader acts differently. The header of the source object will only return a value of COMPLETED when replication is successful to all destinations. The header will remain at value PENDING until replication has completed for all destinations. If one or more destinations fails replication the header will return FAILED.
For more information, see Replication.
138 |
# File 'sig/object.rbs', line 138
def replication_status: () -> ("COMPLETE" | "PENDING" | "FAILED" | "REPLICA" | "COMPLETED")
|
#request_charged ⇒ String
If present, indicates that the requester was successfully charged for the request. For more information, see Using Requester Pays buckets for storage transfers and usage in the Amazon Simple Storage Service user guide.
135 |
# File 'sig/object.rbs', line 135
def request_charged: () -> ("requester")
|
#restore ⇒ String
If the object is an archived object (an object whose storage class is GLACIER), the response includes this header if either the archive restoration is in progress (see RestoreObject or an archive copy is already restored.
If an archive copy is already restored, the header value indicates when Amazon S3 is scheduled to delete the object copy. For example:
x-amz-restore: ongoing-request="false", expiry-date="Fri, 21 Dec 2012 00:00:00 GMT"
If the object restoration is in progress, the header returns the value
ongoing-request="true".
For more information about archiving objects, see Transitioning Objects: General Considerations.
EXPRESS_ONEZONE (the S3 Express One Zone
storage class) in Availability Zones and ONEZONE_IA (the S3 One
Zone-Infrequent Access storage class) in Dedicated Local Zones.
33 |
# File 'sig/object.rbs', line 33
def restore: () -> ::String
|
#restore_object(options = {}) ⇒ Types::RestoreObjectOutput
347 |
# File 'sig/object.rbs', line 347
def restore_object: (
|
#server_side_encryption ⇒ String
The server-side encryption algorithm used when you store this object in Amazon S3 or Amazon FSx.
aws:fsx.
114 |
# File 'sig/object.rbs', line 114
def server_side_encryption: () -> ("AES256" | "aws:fsx" | "aws:kms" | "aws:kms:dsse")
|
#size ⇒ Object
6 |
# File 'lib/aws-sdk-s3/customizations/object.rb', line 6 alias size content_length |
#sse_customer_algorithm ⇒ String
If server-side encryption with a customer-provided encryption key was requested, the response will include this header to confirm the encryption algorithm that's used.
120 |
# File 'sig/object.rbs', line 120
def sse_customer_algorithm: () -> ::String
|
#sse_customer_key_md5 ⇒ String
If server-side encryption with a customer-provided encryption key was requested, the response will include this header to provide the round-trip message integrity verification of the customer-provided encryption key.
123 |
# File 'sig/object.rbs', line 123
def sse_customer_key_md5: () -> ::String
|
#ssekms_key_id ⇒ String
If present, indicates the ID of the KMS key that was used for object encryption.
126 |
# File 'sig/object.rbs', line 126
def ssekms_key_id: () -> ::String
|
#storage_class ⇒ String
Provides storage class information of the object. Amazon S3 returns this header for all objects except for S3 Standard storage class objects.
For more information, see Storage Classes.
EXPRESS_ONEZONE (the S3 Express One Zone storage class) in
Availability Zones and ONEZONE_IA (the S3 One Zone-Infrequent Access
storage class) in Dedicated Local Zones.
132 |
# File 'sig/object.rbs', line 132
def storage_class: () -> ("STANDARD" | "REDUCED_REDUNDANCY" | "STANDARD_IA" | "ONEZONE_IA" | "INTELLIGENT_TIERING" | "GLACIER" | "DEEP_ARCHIVE" | "OUTPOSTS" | "GLACIER_IR" | "SNOW" | "EXPRESS_ONEZONE" | "FSX_OPENZFS" | "FSX_ONTAP")
|
#tag_count ⇒ Integer
The number of tags, if any, on the object, when you have the relevant permission to read object tags.
You can use GetObjectTagging to retrieve the tag set associated with an object.
144 |
# File 'sig/object.rbs', line 144
def tag_count: () -> ::Integer
|
#upload_file(source, options = {}) ⇒ void
This method returns an undefined value.
https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Object.html#upload_file-instance_method
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 |
# File 'lib/aws-sdk-s3/customizations/object.rb', line 480 def upload_file(source, = {}) upload_opts = .merge(bucket: bucket_name, key: key) executor = DefaultExecutor.new(max_threads: upload_opts.delete(:thread_count)) uploader = FileUploader.new( client: client, executor: executor, multipart_threshold: upload_opts.delete(:multipart_threshold) ) response = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do uploader.upload(source, upload_opts) end yield response if block_given? executor.shutdown true end |
#upload_stream(options = {}) {|write_stream| ... } ⇒ Boolean
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
# File 'lib/aws-sdk-s3/customizations/object.rb', line 406 def upload_stream( = {}, &block) upload_opts = .merge(bucket: bucket_name, key: key) executor = DefaultExecutor.new(max_threads: upload_opts.delete(:thread_count)) uploader = MultipartStreamUploader.new( client: client, executor: executor, tempfile: upload_opts.delete(:tempfile), part_size: upload_opts.delete(:part_size) ) Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do uploader.upload(upload_opts, &block) end executor.shutdown true end |
#version(id) ⇒ ObjectVersion
470 |
# File 'sig/object.rbs', line 470
def version: (String id) -> ObjectVersion
|
#version_id ⇒ String
Version ID of the object.
84 |
# File 'sig/object.rbs', line 84
def version_id: () -> ::String
|
#wait_until(options = {}) {|resource| ... } ⇒ Resource
Use [Aws::S3::Client] #wait_until instead
The waiting operation is performed on a copy. The original resource remains unchanged.
Waiter polls an API operation until a resource enters a desired state.
Basic Usage
Waiter will polls until it is successful, it fails by entering a terminal state, or until a maximum number of attempts are made.
# polls in a loop until condition is true
resource.wait_until() {|resource| condition}
Example
instance.wait_until(max_attempts:10, delay:5) do |instance|
instance.state.name == 'running'
end
Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. The waiting condition is set by passing a block to #wait_until:
# poll for ~25 seconds
resource.wait_until(max_attempts:5,delay:5) {|resource|...}
Callbacks
You can be notified before each polling attempt and before each
delay. If you throw :success or :failure from these callbacks,
it will terminate the waiter.
started_at = Time.now
# poll for 1 hour, instead of a number of attempts
proc = Proc.new do |attempts, response|
throw :failure if Time.now - started_at > 3600
end
# disable max attempts
instance.wait_until(before_wait:proc, max_attempts:nil) {...}
Handling Errors
When a waiter is successful, it returns the Resource. When a waiter fails, it raises an error.
begin
resource.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
attempts attempt in seconds invoked before each attempt invoked before each wait
779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 |
# File 'lib/aws-sdk-s3/object.rb', line 779 def wait_until( = {}, &block) self_copy = self.dup attempts = 0 [:max_attempts] = 10 unless .key?(:max_attempts) [:delay] ||= 10 [:poller] = Proc.new do attempts += 1 if block.call(self_copy) [:success, self_copy] else self_copy.reload unless attempts == [:max_attempts] :retry end end Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do Aws::Waiters::Waiter.new().wait({}) end end |
#wait_until_exists(options = {}, &block) ⇒ Object
172 173 |
# File 'sig/object.rbs', line 172
def wait_until_exists: (?max_attempts: Integer, ?delay: Numeric, ?before_attempt: (^(Integer attempts) -> void), ?before_wait: (^(Integer attempts, untyped response) -> void)) ?{ (untyped waiter) -> void } -> Object
| (?Hash[Symbol, untyped]) ?{ (untyped waiter) -> void } -> Object
|
#wait_until_not_exists(options = {}, &block) ⇒ Object
176 177 |
# File 'sig/object.rbs', line 176
def wait_until_not_exists: (?max_attempts: Integer, ?delay: Numeric, ?before_attempt: (^(Integer attempts) -> void), ?before_wait: (^(Integer attempts, untyped response) -> void)) ?{ (untyped waiter) -> void } -> Object
| (?Hash[Symbol, untyped]) ?{ (untyped waiter) -> void } -> Object
|
#website_redirect_location ⇒ String
If the bucket is configured as a website, redirects requests for this object to another object in the same bucket or to an external URL. Amazon S3 stores the value of this header in the object metadata.
111 |
# File 'sig/object.rbs', line 111
def website_redirect_location: () -> ::String
|