Class: Aws::S3::Encryption::Client
- Inherits:
-
Object
- Object
- Aws::S3::Encryption::Client
- Defined in:
- lib/aws-sdk-resources/services/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
Instance Method Summary collapse
-
#get_object(params = {}, &block) ⇒ Object
Gets an object from Amazon S3, decrypting data locally.
-
#initialize(options = {}) ⇒ Client
constructor
Creates a new encryption client.
-
#put_object(params = {}) ⇒ Object
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:
-
‘:key_provider`
-
‘:encryption_key`
You may also pass any other options accepted by S3::Client#initialize.
184 185 186 187 188 189 |
# File 'lib/aws-sdk-resources/services/s3/encryption/client.rb', line 184 def initialize( = {}) @client = extract_client() @key_provider = extract_key_provider() @envelope_location = extract_location() @instruction_file_suffix = extract_suffix() end |
Instance Attribute Details
#client ⇒ S3::Client (readonly)
192 193 194 |
# File 'lib/aws-sdk-resources/services/s3/encryption/client.rb', line 192 def client @client end |
#envelope_location ⇒ Symbol<:metadata, :instruction_file> (readonly)
198 199 200 |
# File 'lib/aws-sdk-resources/services/s3/encryption/client.rb', line 198 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.
203 204 205 |
# File 'lib/aws-sdk-resources/services/s3/encryption/client.rb', line 203 def instruction_file_suffix @instruction_file_suffix end |
#key_provider ⇒ KeyProvider (readonly)
195 196 197 |
# File 'lib/aws-sdk-resources/services/s3/encryption/client.rb', line 195 def key_provider @key_provider end |
Instance Method Details
#get_object(params = {}, &block) ⇒ Object
The ‘:range` request parameter is not yet supported.
Gets an object from Amazon S3, decrypting data locally. See S3::Client#get_object for documentation on accepted request parameters.
235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'lib/aws-sdk-resources/services/s3/encryption/client.rb', line 235 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] = { key_provider: @key_provider, envelope_location: envelope_location, instruction_file_suffix: instruction_file_suffix, } req.send_request(target: block) end |
#put_object(params = {}) ⇒ Object
Uploads an object to Amazon S3, encrypting data client-side. See S3::Client#put_object for documentation on accepted request parameters.
211 212 213 214 215 216 217 218 219 220 |
# File 'lib/aws-sdk-resources/services/s3/encryption/client.rb', line 211 def put_object(params = {}) req = @client.build_request(:put_object, params) req.handlers.add(EncryptHandler, priority: 95) req.context[:encryption] = { materials: @key_provider.encryption_materials, envelope_location: @envelope_location, instruction_file_suffix: @instruction_file_suffix, } req.send_request end |