@@ -44,6 +44,7 @@ trait S3ObjectTrait {
44
44
abstract protected function getConnection ();
45
45
46
46
abstract protected function getCertificateBundlePath (): ?string ;
47
+ abstract protected function getSSECParameters (bool $ copy = false ): array ;
47
48
48
49
/**
49
50
* @param string $urn the unified resource name used to identify the object
@@ -58,7 +59,7 @@ public function readObject($urn) {
58
59
'Bucket ' => $ this ->bucket ,
59
60
'Key ' => $ urn ,
60
61
'Range ' => 'bytes= ' . $ range ,
61
- ]);
62
+ ] + $ this -> getSSECParameters () );
62
63
$ request = \Aws \serialize ($ command );
63
64
$ headers = [];
64
65
foreach ($ request ->getHeaders () as $ key => $ values ) {
@@ -106,7 +107,7 @@ protected function writeSingle(string $urn, StreamInterface $stream, string $mim
106
107
'ACL ' => 'private ' ,
107
108
'ContentType ' => $ mimetype ,
108
109
'StorageClass ' => $ this ->storageClass ,
109
- ]);
110
+ ] + $ this -> getSSECParameters () );
110
111
}
111
112
112
113
@@ -126,7 +127,7 @@ protected function writeMultiPart(string $urn, StreamInterface $stream, string $
126
127
'params ' => [
127
128
'ContentType ' => $ mimetype ,
128
129
'StorageClass ' => $ this ->storageClass ,
129
- ],
130
+ ] + $ this -> getSSECParameters () ,
130
131
]);
131
132
132
133
try {
@@ -181,10 +182,12 @@ public function deleteObject($urn) {
181
182
}
182
183
183
184
public function objectExists ($ urn ) {
184
- return $ this ->getConnection ()->doesObjectExist ($ this ->bucket , $ urn );
185
+ return $ this ->getConnection ()->doesObjectExist ($ this ->bucket , $ urn, $ this -> getSSECParameters () );
185
186
}
186
187
187
188
public function copyObject ($ from , $ to ) {
188
- $ this ->getConnection ()->copy ($ this ->getBucket (), $ from , $ this ->getBucket (), $ to );
189
+ $ this ->getConnection ()->copy ($ this ->getBucket (), $ from , $ this ->getBucket (), $ to , 'private ' , [
190
+ 'params ' => $ this ->getSSECParameters () + $ this ->getSSECParameters (true )
191
+ ]);
189
192
}
190
193
}
0 commit comments