Class: Aws::S3::Encryption::Client
- Inherits:
-
Object
- Object
- Aws::S3::Encryption::Client
- Extended by:
- Deprecations
- Defined in:
- lib/aws-sdk-s3/encryption/client.rb
Instance Attribute Summary collapse
- #client ⇒ S3::Client readonly
- #envelope_location ⇒ Symbol<:metadata, :instruction_file> readonly
-
#instruction_file_suffix ⇒ String
readonly
When #envelope_location is ‘:instruction_file`, the envelope is stored in the object with the object key suffixed by this string.
-
#key_provider ⇒ KeyProvider?
readonly
Returns ‘nil` if you are using AWS Key Management Service (KMS).
Instance Method Summary collapse
-
#get_object(params = {}, &block) ⇒ Types::GetObjectOutput
Gets an object from Amazon S3, decrypting data locally.
-
#initialize(options = {}) ⇒ Client
constructor
Creates a new encryption client.
-
#put_object(params = {}) ⇒ Types::PutObjectOutput
Uploads an object to Amazon S3, encrypting data client-side.
Constructor Details
#initialize(options = {}) ⇒ Client
Creates a new encryption client. You must provide on of the following options:
-
‘:encryption_key`
-
‘:kms_key_id`
-
‘:key_provider`
You may also pass any other options accepted by ‘Client#initialize`.
220 221 222 223 224 225 |
# File 'lib/aws-sdk-s3/encryption/client.rb', line 220 def initialize( = {}) @client = extract_client() @cipher_provider = cipher_provider() @envelope_location = extract_location() @instruction_file_suffix = extract_suffix() end |
Instance Attribute Details
#client ⇒ S3::Client (readonly)
228 229 230 |
# File 'lib/aws-sdk-s3/encryption/client.rb', line 228 def client @client end |
#envelope_location ⇒ Symbol<:metadata, :instruction_file> (readonly)
235 236 237 |
# File 'lib/aws-sdk-s3/encryption/client.rb', line 235 def envelope_location @envelope_location end |
#instruction_file_suffix ⇒ String (readonly)
Returns When #envelope_location is ‘:instruction_file`, the envelope is stored in the object with the object key suffixed by this string.
240 241 242 |
# File 'lib/aws-sdk-s3/encryption/client.rb', line 240 def instruction_file_suffix @instruction_file_suffix end |
#key_provider ⇒ KeyProvider? (readonly)
Returns ‘nil` if you are using AWS Key Management Service (KMS).
232 233 234 |
# File 'lib/aws-sdk-s3/encryption/client.rb', line 232 def key_provider @key_provider end |
Instance Method Details
#get_object(params = {}, &block) ⇒ Types::GetObjectOutput
The ‘:range` request parameter is not yet supported.
Gets an object from Amazon S3, decrypting data locally. See Client#get_object for documentation on accepted request parameters.
272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
# File 'lib/aws-sdk-s3/encryption/client.rb', line 272 def get_object(params = {}, &block) if params[:range] raise NotImplementedError, '#get_object with :range not supported yet' end envelope_location, instruction_file_suffix = (params) req = @client.build_request(:get_object, params) req.handlers.add(DecryptHandler) req.context[:encryption] = { cipher_provider: @cipher_provider, envelope_location: envelope_location, instruction_file_suffix: instruction_file_suffix, } req.send_request(target: block) end |
#put_object(params = {}) ⇒ Types::PutObjectOutput
Uploads an object to Amazon S3, encrypting data client-side. See Client#put_object for documentation on accepted request parameters.
248 249 250 251 252 253 254 255 256 257 |
# File 'lib/aws-sdk-s3/encryption/client.rb', line 248 def put_object(params = {}) req = @client.build_request(:put_object, params) req.handlers.add(EncryptHandler, priority: 95) req.context[:encryption] = { cipher_provider: @cipher_provider, envelope_location: @envelope_location, instruction_file_suffix: @instruction_file_suffix, } req.send_request end |