S3Client.php 130 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445
  1. <?php
  2. namespace AsyncAws\S3;
  3. use AsyncAws\Core\AbstractApi;
  4. use AsyncAws\Core\AwsError\AwsErrorFactoryInterface;
  5. use AsyncAws\Core\AwsError\XmlAwsErrorFactory;
  6. use AsyncAws\Core\Configuration;
  7. use AsyncAws\Core\RequestContext;
  8. use AsyncAws\Core\Result;
  9. use AsyncAws\S3\Enum\BucketCannedACL;
  10. use AsyncAws\S3\Enum\ChecksumAlgorithm;
  11. use AsyncAws\S3\Enum\ChecksumMode;
  12. use AsyncAws\S3\Enum\EncodingType;
  13. use AsyncAws\S3\Enum\MetadataDirective;
  14. use AsyncAws\S3\Enum\ObjectCannedACL;
  15. use AsyncAws\S3\Enum\ObjectLockLegalHoldStatus;
  16. use AsyncAws\S3\Enum\ObjectLockMode;
  17. use AsyncAws\S3\Enum\ObjectOwnership;
  18. use AsyncAws\S3\Enum\RequestPayer;
  19. use AsyncAws\S3\Enum\ServerSideEncryption;
  20. use AsyncAws\S3\Enum\StorageClass;
  21. use AsyncAws\S3\Enum\TaggingDirective;
  22. use AsyncAws\S3\Exception\BucketAlreadyExistsException;
  23. use AsyncAws\S3\Exception\BucketAlreadyOwnedByYouException;
  24. use AsyncAws\S3\Exception\InvalidObjectStateException;
  25. use AsyncAws\S3\Exception\NoSuchBucketException;
  26. use AsyncAws\S3\Exception\NoSuchKeyException;
  27. use AsyncAws\S3\Exception\NoSuchUploadException;
  28. use AsyncAws\S3\Exception\ObjectNotInActiveTierErrorException;
  29. use AsyncAws\S3\Input\AbortMultipartUploadRequest;
  30. use AsyncAws\S3\Input\CompleteMultipartUploadRequest;
  31. use AsyncAws\S3\Input\CopyObjectRequest;
  32. use AsyncAws\S3\Input\CreateBucketRequest;
  33. use AsyncAws\S3\Input\CreateMultipartUploadRequest;
  34. use AsyncAws\S3\Input\DeleteBucketCorsRequest;
  35. use AsyncAws\S3\Input\DeleteBucketRequest;
  36. use AsyncAws\S3\Input\DeleteObjectRequest;
  37. use AsyncAws\S3\Input\DeleteObjectsRequest;
  38. use AsyncAws\S3\Input\GetBucketCorsRequest;
  39. use AsyncAws\S3\Input\GetBucketEncryptionRequest;
  40. use AsyncAws\S3\Input\GetObjectAclRequest;
  41. use AsyncAws\S3\Input\GetObjectRequest;
  42. use AsyncAws\S3\Input\HeadBucketRequest;
  43. use AsyncAws\S3\Input\HeadObjectRequest;
  44. use AsyncAws\S3\Input\ListBucketsRequest;
  45. use AsyncAws\S3\Input\ListMultipartUploadsRequest;
  46. use AsyncAws\S3\Input\ListObjectsV2Request;
  47. use AsyncAws\S3\Input\ListPartsRequest;
  48. use AsyncAws\S3\Input\PutBucketCorsRequest;
  49. use AsyncAws\S3\Input\PutBucketNotificationConfigurationRequest;
  50. use AsyncAws\S3\Input\PutObjectAclRequest;
  51. use AsyncAws\S3\Input\PutObjectRequest;
  52. use AsyncAws\S3\Input\UploadPartRequest;
  53. use AsyncAws\S3\Result\AbortMultipartUploadOutput;
  54. use AsyncAws\S3\Result\BucketExistsWaiter;
  55. use AsyncAws\S3\Result\BucketNotExistsWaiter;
  56. use AsyncAws\S3\Result\CompleteMultipartUploadOutput;
  57. use AsyncAws\S3\Result\CopyObjectOutput;
  58. use AsyncAws\S3\Result\CreateBucketOutput;
  59. use AsyncAws\S3\Result\CreateMultipartUploadOutput;
  60. use AsyncAws\S3\Result\DeleteObjectOutput;
  61. use AsyncAws\S3\Result\DeleteObjectsOutput;
  62. use AsyncAws\S3\Result\GetBucketCorsOutput;
  63. use AsyncAws\S3\Result\GetBucketEncryptionOutput;
  64. use AsyncAws\S3\Result\GetObjectAclOutput;
  65. use AsyncAws\S3\Result\GetObjectOutput;
  66. use AsyncAws\S3\Result\HeadObjectOutput;
  67. use AsyncAws\S3\Result\ListBucketsOutput;
  68. use AsyncAws\S3\Result\ListMultipartUploadsOutput;
  69. use AsyncAws\S3\Result\ListObjectsV2Output;
  70. use AsyncAws\S3\Result\ListPartsOutput;
  71. use AsyncAws\S3\Result\ObjectExistsWaiter;
  72. use AsyncAws\S3\Result\ObjectNotExistsWaiter;
  73. use AsyncAws\S3\Result\PutObjectAclOutput;
  74. use AsyncAws\S3\Result\PutObjectOutput;
  75. use AsyncAws\S3\Result\UploadPartOutput;
  76. use AsyncAws\S3\Signer\SignerV4ForS3;
  77. use AsyncAws\S3\ValueObject\AccessControlPolicy;
  78. use AsyncAws\S3\ValueObject\CompletedMultipartUpload;
  79. use AsyncAws\S3\ValueObject\CORSConfiguration;
  80. use AsyncAws\S3\ValueObject\CreateBucketConfiguration;
  81. use AsyncAws\S3\ValueObject\Delete;
  82. use AsyncAws\S3\ValueObject\MultipartUpload;
  83. use AsyncAws\S3\ValueObject\NotificationConfiguration;
  84. use AsyncAws\S3\ValueObject\Part;
  85. class S3Client extends AbstractApi
  86. {
  87. /**
  88. * This action aborts a multipart upload. After a multipart upload is aborted, no additional parts can be uploaded using
  89. * that upload ID. The storage consumed by any previously uploaded parts will be freed. However, if any part uploads are
  90. * currently in progress, those part uploads might or might not succeed. As a result, it might be necessary to abort a
  91. * given multipart upload multiple times in order to completely free all storage consumed by all parts.
  92. *
  93. * To verify that all parts have been removed, so you don't get charged for the part storage, you should call the
  94. * ListParts [^1] action and ensure that the parts list is empty.
  95. *
  96. * For information about permissions required to use the multipart upload, see Multipart Upload and Permissions [^2].
  97. *
  98. * The following operations are related to `AbortMultipartUpload`:
  99. *
  100. * - CreateMultipartUpload [^3]
  101. * - UploadPart [^4]
  102. * - CompleteMultipartUpload [^5]
  103. * - ListParts [^6]
  104. * - ListMultipartUploads [^7]
  105. *
  106. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListParts.html
  107. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html
  108. * [^3]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html
  109. * [^4]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html
  110. * [^5]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html
  111. * [^6]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListParts.html
  112. * [^7]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListMultipartUploads.html
  113. *
  114. * @see http://docs.amazonwebservices.com/AmazonS3/latest/API/mpUploadAbort.html
  115. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_AbortMultipartUpload.html
  116. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#abortmultipartupload
  117. *
  118. * @param array{
  119. * Bucket: string,
  120. * Key: string,
  121. * UploadId: string,
  122. * RequestPayer?: RequestPayer::*,
  123. * ExpectedBucketOwner?: string,
  124. *
  125. * @region?: string,
  126. * }|AbortMultipartUploadRequest $input
  127. *
  128. * @throws NoSuchUploadException
  129. */
  130. public function abortMultipartUpload($input): AbortMultipartUploadOutput
  131. {
  132. $input = AbortMultipartUploadRequest::create($input);
  133. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'AbortMultipartUpload', 'region' => $input->getRegion(), 'exceptionMapping' => [
  134. 'NoSuchUpload' => NoSuchUploadException::class,
  135. ]]));
  136. return new AbortMultipartUploadOutput($response);
  137. }
  138. /**
  139. * @see headBucket
  140. *
  141. * @param array{
  142. * Bucket: string,
  143. * ExpectedBucketOwner?: string,
  144. *
  145. * @region?: string,
  146. * }|HeadBucketRequest $input
  147. */
  148. public function bucketExists($input): BucketExistsWaiter
  149. {
  150. $input = HeadBucketRequest::create($input);
  151. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'HeadBucket', 'region' => $input->getRegion(), 'exceptionMapping' => [
  152. 'NoSuchBucket' => NoSuchBucketException::class,
  153. ]]));
  154. return new BucketExistsWaiter($response, $this, $input);
  155. }
  156. /**
  157. * @see headBucket
  158. *
  159. * @param array{
  160. * Bucket: string,
  161. * ExpectedBucketOwner?: string,
  162. *
  163. * @region?: string,
  164. * }|HeadBucketRequest $input
  165. */
  166. public function bucketNotExists($input): BucketNotExistsWaiter
  167. {
  168. $input = HeadBucketRequest::create($input);
  169. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'HeadBucket', 'region' => $input->getRegion(), 'exceptionMapping' => [
  170. 'NoSuchBucket' => NoSuchBucketException::class,
  171. ]]));
  172. return new BucketNotExistsWaiter($response, $this, $input);
  173. }
  174. /**
  175. * Completes a multipart upload by assembling previously uploaded parts.
  176. *
  177. * You first initiate the multipart upload and then upload all parts using the UploadPart [^1] operation. After
  178. * successfully uploading all relevant parts of an upload, you call this action to complete the upload. Upon receiving
  179. * this request, Amazon S3 concatenates all the parts in ascending order by part number to create a new object. In the
  180. * Complete Multipart Upload request, you must provide the parts list. You must ensure that the parts list is complete.
  181. * This action concatenates the parts that you provide in the list. For each part in the list, you must provide the part
  182. * number and the `ETag` value, returned after that part was uploaded.
  183. *
  184. * Processing of a Complete Multipart Upload request could take several minutes to complete. After Amazon S3 begins
  185. * processing the request, it sends an HTTP response header that specifies a 200 OK response. While processing is in
  186. * progress, Amazon S3 periodically sends white space characters to keep the connection from timing out. A request could
  187. * fail after the initial 200 OK response has been sent. This means that a `200 OK` response can contain either a
  188. * success or an error. If you call the S3 API directly, make sure to design your application to parse the contents of
  189. * the response and handle it appropriately. If you use Amazon Web Services SDKs, SDKs handle this condition. The SDKs
  190. * detect the embedded error and apply error handling per your configuration settings (including automatically retrying
  191. * the request as appropriate). If the condition persists, the SDKs throws an exception (or, for the SDKs that don't use
  192. * exceptions, they return the error).
  193. *
  194. * Note that if `CompleteMultipartUpload` fails, applications should be prepared to retry the failed requests. For more
  195. * information, see Amazon S3 Error Best Practices [^2].
  196. *
  197. * ! You cannot use `Content-Type: application/x-www-form-urlencoded` with Complete Multipart Upload requests. Also, if
  198. * ! you do not provide a `Content-Type` header, `CompleteMultipartUpload` returns a 200 OK response.
  199. *
  200. * For more information about multipart uploads, see Uploading Objects Using Multipart Upload [^3].
  201. *
  202. * For information about permissions required to use the multipart upload API, see Multipart Upload and Permissions
  203. * [^4].
  204. *
  205. * `CompleteMultipartUpload` has the following special errors:
  206. *
  207. * - Error code: `EntityTooSmall`
  208. *
  209. * - Description: Your proposed upload is smaller than the minimum allowed object size. Each part must be at least 5
  210. * MB in size, except the last part.
  211. * - 400 Bad Request
  212. *
  213. * - Error code: `InvalidPart`
  214. *
  215. * - Description: One or more of the specified parts could not be found. The part might not have been uploaded, or the
  216. * specified entity tag might not have matched the part's entity tag.
  217. * - 400 Bad Request
  218. *
  219. * - Error code: `InvalidPartOrder`
  220. *
  221. * - Description: The list of parts was not in ascending order. The parts list must be specified in order by part
  222. * number.
  223. * - 400 Bad Request
  224. *
  225. * - Error code: `NoSuchUpload`
  226. *
  227. * - Description: The specified multipart upload does not exist. The upload ID might be invalid, or the multipart
  228. * upload might have been aborted or completed.
  229. * - 404 Not Found
  230. *
  231. *
  232. * The following operations are related to `CompleteMultipartUpload`:
  233. *
  234. * - CreateMultipartUpload [^5]
  235. * - UploadPart [^6]
  236. * - AbortMultipartUpload [^7]
  237. * - ListParts [^8]
  238. * - ListMultipartUploads [^9]
  239. *
  240. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html
  241. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ErrorBestPractices.html
  242. * [^3]: https://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html
  243. * [^4]: https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html
  244. * [^5]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html
  245. * [^6]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html
  246. * [^7]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_AbortMultipartUpload.html
  247. * [^8]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListParts.html
  248. * [^9]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListMultipartUploads.html
  249. *
  250. * @see http://docs.amazonwebservices.com/AmazonS3/latest/API/mpUploadComplete.html
  251. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html
  252. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#completemultipartupload
  253. *
  254. * @param array{
  255. * Bucket: string,
  256. * Key: string,
  257. * MultipartUpload?: CompletedMultipartUpload|array,
  258. * UploadId: string,
  259. * ChecksumCRC32?: string,
  260. * ChecksumCRC32C?: string,
  261. * ChecksumSHA1?: string,
  262. * ChecksumSHA256?: string,
  263. * RequestPayer?: RequestPayer::*,
  264. * ExpectedBucketOwner?: string,
  265. * SSECustomerAlgorithm?: string,
  266. * SSECustomerKey?: string,
  267. * SSECustomerKeyMD5?: string,
  268. *
  269. * @region?: string,
  270. * }|CompleteMultipartUploadRequest $input
  271. */
  272. public function completeMultipartUpload($input): CompleteMultipartUploadOutput
  273. {
  274. $input = CompleteMultipartUploadRequest::create($input);
  275. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'CompleteMultipartUpload', 'region' => $input->getRegion()]));
  276. return new CompleteMultipartUploadOutput($response);
  277. }
  278. /**
  279. * Creates a copy of an object that is already stored in Amazon S3.
  280. *
  281. * > You can store individual objects of up to 5 TB in Amazon S3. You create a copy of your object up to 5 GB in size in
  282. * > a single atomic action using this API. However, to copy an object greater than 5 GB, you must use the multipart
  283. * > upload Upload Part - Copy (UploadPartCopy) API. For more information, see Copy Object Using the REST Multipart
  284. * > Upload API [^1].
  285. *
  286. * All copy requests must be authenticated. Additionally, you must have *read* access to the source object and *write*
  287. * access to the destination bucket. For more information, see REST Authentication [^2]. Both the Region that you want
  288. * to copy the object from and the Region that you want to copy the object to must be enabled for your account.
  289. *
  290. * A copy request might return an error when Amazon S3 receives the copy request or while Amazon S3 is copying the
  291. * files. If the error occurs before the copy action starts, you receive a standard Amazon S3 error. If the error occurs
  292. * during the copy operation, the error response is embedded in the `200 OK` response. This means that a `200 OK`
  293. * response can contain either a success or an error. If you call the S3 API directly, make sure to design your
  294. * application to parse the contents of the response and handle it appropriately. If you use Amazon Web Services SDKs,
  295. * SDKs handle this condition. The SDKs detect the embedded error and apply error handling per your configuration
  296. * settings (including automatically retrying the request as appropriate). If the condition persists, the SDKs throws an
  297. * exception (or, for the SDKs that don't use exceptions, they return the error).
  298. *
  299. * If the copy is successful, you receive a response with information about the copied object.
  300. *
  301. * > If the request is an HTTP 1.1 request, the response is chunk encoded. If it were not, it would not contain the
  302. * > content-length, and you would need to read the entire body.
  303. *
  304. * The copy request charge is based on the storage class and Region that you specify for the destination object. For
  305. * pricing information, see Amazon S3 pricing [^3].
  306. *
  307. * ! Amazon S3 transfer acceleration does not support cross-Region copies. If you request a cross-Region copy using a
  308. * ! transfer acceleration endpoint, you get a 400 `Bad Request` error. For more information, see Transfer Acceleration
  309. * ! [^4].
  310. *
  311. * - `Metadata`:
  312. *
  313. * When copying an object, you can preserve all metadata (the default) or specify new metadata. However, the access
  314. * control list (ACL) is not preserved and is set to private for the user making the request. To override the default
  315. * ACL setting, specify a new ACL when generating a copy request. For more information, see Using ACLs [^5].
  316. *
  317. * To specify whether you want the object metadata copied from the source object or replaced with metadata provided in
  318. * the request, you can optionally add the `x-amz-metadata-directive` header. When you grant permissions, you can use
  319. * the `s3:x-amz-metadata-directive` condition key to enforce certain metadata behavior when objects are uploaded. For
  320. * more information, see Specifying Conditions in a Policy [^6] in the *Amazon S3 User Guide*. For a complete list of
  321. * Amazon S3-specific condition keys, see Actions, Resources, and Condition Keys for Amazon S3 [^7].
  322. *
  323. * > `x-amz-website-redirect-location` is unique to each object and must be specified in the request headers to copy
  324. * > the value.
  325. *
  326. * - `x-amz-copy-source-if Headers`:
  327. *
  328. * To only copy an object under certain conditions, such as whether the `Etag` matches or whether the object was
  329. * modified before or after a specified date, use the following request parameters:
  330. *
  331. * - `x-amz-copy-source-if-match`
  332. * - `x-amz-copy-source-if-none-match`
  333. * - `x-amz-copy-source-if-unmodified-since`
  334. * - `x-amz-copy-source-if-modified-since`
  335. *
  336. * If both the `x-amz-copy-source-if-match` and `x-amz-copy-source-if-unmodified-since` headers are present in the
  337. * request and evaluate as follows, Amazon S3 returns `200 OK` and copies the data:
  338. *
  339. * - `x-amz-copy-source-if-match` condition evaluates to true
  340. * - `x-amz-copy-source-if-unmodified-since` condition evaluates to false
  341. *
  342. * If both the `x-amz-copy-source-if-none-match` and `x-amz-copy-source-if-modified-since` headers are present in the
  343. * request and evaluate as follows, Amazon S3 returns the `412 Precondition Failed` response code:
  344. *
  345. * - `x-amz-copy-source-if-none-match` condition evaluates to false
  346. * - `x-amz-copy-source-if-modified-since` condition evaluates to true
  347. *
  348. * > All headers with the `x-amz-` prefix, including `x-amz-copy-source`, must be signed.
  349. *
  350. * - `Server-side encryption`:
  351. *
  352. * Amazon S3 automatically encrypts all new objects that are copied to an S3 bucket. When copying an object, if you
  353. * don't specify encryption information in your copy request, the encryption setting of the target object is set to
  354. * the default encryption configuration of the destination bucket. By default, all buckets have a base level of
  355. * encryption configuration that uses server-side encryption with Amazon S3 managed keys (SSE-S3). If the destination
  356. * bucket has a default encryption configuration that uses server-side encryption with Key Management Service (KMS)
  357. * keys (SSE-KMS), dual-layer server-side encryption with Amazon Web Services KMS keys (DSSE-KMS), or server-side
  358. * encryption with customer-provided encryption keys (SSE-C), Amazon S3 uses the corresponding KMS key, or a
  359. * customer-provided key to encrypt the target object copy.
  360. *
  361. * When you perform a `CopyObject` operation, if you want to use a different type of encryption setting for the target
  362. * object, you can use other appropriate encryption-related headers to encrypt the target object with a KMS key, an
  363. * Amazon S3 managed key, or a customer-provided key. With server-side encryption, Amazon S3 encrypts your data as it
  364. * writes your data to disks in its data centers and decrypts the data when you access it. If the encryption setting
  365. * in your request is different from the default encryption configuration of the destination bucket, the encryption
  366. * setting in your request takes precedence. If the source object for the copy is stored in Amazon S3 using SSE-C, you
  367. * must provide the necessary encryption information in your request so that Amazon S3 can decrypt the object for
  368. * copying. For more information about server-side encryption, see Using Server-Side Encryption [^8].
  369. *
  370. * If a target object uses SSE-KMS, you can enable an S3 Bucket Key for the object. For more information, see Amazon
  371. * S3 Bucket Keys [^9] in the *Amazon S3 User Guide*.
  372. * - `Access Control List (ACL)-Specific Request Headers`:
  373. *
  374. * When copying an object, you can optionally use headers to grant ACL-based permissions. By default, all objects are
  375. * private. Only the owner has full access control. When adding a new object, you can grant permissions to individual
  376. * Amazon Web Services accounts or to predefined groups that are defined by Amazon S3. These permissions are then
  377. * added to the ACL on the object. For more information, see Access Control List (ACL) Overview [^10] and Managing
  378. * ACLs Using the REST API [^11].
  379. *
  380. * If the bucket that you're copying objects to uses the bucket owner enforced setting for S3 Object Ownership, ACLs
  381. * are disabled and no longer affect permissions. Buckets that use this setting only accept `PUT` requests that don't
  382. * specify an ACL or `PUT` requests that specify bucket owner full control ACLs, such as the
  383. * `bucket-owner-full-control` canned ACL or an equivalent form of this ACL expressed in the XML format.
  384. *
  385. * For more information, see Controlling ownership of objects and disabling ACLs [^12] in the *Amazon S3 User Guide*.
  386. *
  387. * > If your bucket uses the bucket owner enforced setting for Object Ownership, all objects written to the bucket by
  388. * > any account will be owned by the bucket owner.
  389. *
  390. * - `Checksums`:
  391. *
  392. * When copying an object, if it has a checksum, that checksum will be copied to the new object by default. When you
  393. * copy the object over, you can optionally specify a different checksum algorithm to use with the
  394. * `x-amz-checksum-algorithm` header.
  395. * - `Storage Class Options`:
  396. *
  397. * You can use the `CopyObject` action to change the storage class of an object that is already stored in Amazon S3 by
  398. * using the `StorageClass` parameter. For more information, see Storage Classes [^13] in the *Amazon S3 User Guide*.
  399. *
  400. * If the source object's storage class is GLACIER, you must restore a copy of this object before you can use it as a
  401. * source object for the copy operation. For more information, see RestoreObject [^14]. For more information, see
  402. * Copying Objects [^15].
  403. * - `Versioning`:
  404. *
  405. * By default, `x-amz-copy-source` header identifies the current version of an object to copy. If the current version
  406. * is a delete marker, Amazon S3 behaves as if the object was deleted. To copy a different version, use the
  407. * `versionId` subresource.
  408. *
  409. * If you enable versioning on the target bucket, Amazon S3 generates a unique version ID for the object being copied.
  410. * This version ID is different from the version ID of the source object. Amazon S3 returns the version ID of the
  411. * copied object in the `x-amz-version-id` response header in the response.
  412. *
  413. * If you do not enable versioning or suspend it on the target bucket, the version ID that Amazon S3 generates is
  414. * always null.
  415. *
  416. * The following operations are related to `CopyObject`:
  417. *
  418. * - PutObject [^16]
  419. * - GetObject [^17]
  420. *
  421. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/CopyingObjctsUsingRESTMPUapi.html
  422. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html
  423. * [^3]: http://aws.amazon.com/s3/pricing/
  424. * [^4]: https://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html
  425. * [^5]: https://docs.aws.amazon.com/AmazonS3/latest/dev/S3_ACLs_UsingACLs.html
  426. * [^6]: https://docs.aws.amazon.com/AmazonS3/latest/dev/amazon-s3-policy-keys.html
  427. * [^7]: https://docs.aws.amazon.com/AmazonS3/latest/dev/list_amazons3.html
  428. * [^8]: https://docs.aws.amazon.com/AmazonS3/latest/dev/serv-side-encryption.html
  429. * [^9]: https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-key.html
  430. * [^10]: https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html
  431. * [^11]: https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-using-rest-api.html
  432. * [^12]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html
  433. * [^13]: https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html
  434. * [^14]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_RestoreObject.html
  435. * [^15]: https://docs.aws.amazon.com/AmazonS3/latest/dev/CopyingObjectsExamples.html
  436. * [^16]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html
  437. * [^17]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html
  438. *
  439. * @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectCOPY.html
  440. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_CopyObject.html
  441. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#copyobject
  442. *
  443. * @param array{
  444. * ACL?: ObjectCannedACL::*,
  445. * Bucket: string,
  446. * CacheControl?: string,
  447. * ChecksumAlgorithm?: ChecksumAlgorithm::*,
  448. * ContentDisposition?: string,
  449. * ContentEncoding?: string,
  450. * ContentLanguage?: string,
  451. * ContentType?: string,
  452. * CopySource: string,
  453. * CopySourceIfMatch?: string,
  454. * CopySourceIfModifiedSince?: \DateTimeImmutable|string,
  455. * CopySourceIfNoneMatch?: string,
  456. * CopySourceIfUnmodifiedSince?: \DateTimeImmutable|string,
  457. * Expires?: \DateTimeImmutable|string,
  458. * GrantFullControl?: string,
  459. * GrantRead?: string,
  460. * GrantReadACP?: string,
  461. * GrantWriteACP?: string,
  462. * Key: string,
  463. * Metadata?: array<string, string>,
  464. * MetadataDirective?: MetadataDirective::*,
  465. * TaggingDirective?: TaggingDirective::*,
  466. * ServerSideEncryption?: ServerSideEncryption::*,
  467. * StorageClass?: StorageClass::*,
  468. * WebsiteRedirectLocation?: string,
  469. * SSECustomerAlgorithm?: string,
  470. * SSECustomerKey?: string,
  471. * SSECustomerKeyMD5?: string,
  472. * SSEKMSKeyId?: string,
  473. * SSEKMSEncryptionContext?: string,
  474. * BucketKeyEnabled?: bool,
  475. * CopySourceSSECustomerAlgorithm?: string,
  476. * CopySourceSSECustomerKey?: string,
  477. * CopySourceSSECustomerKeyMD5?: string,
  478. * RequestPayer?: RequestPayer::*,
  479. * Tagging?: string,
  480. * ObjectLockMode?: ObjectLockMode::*,
  481. * ObjectLockRetainUntilDate?: \DateTimeImmutable|string,
  482. * ObjectLockLegalHoldStatus?: ObjectLockLegalHoldStatus::*,
  483. * ExpectedBucketOwner?: string,
  484. * ExpectedSourceBucketOwner?: string,
  485. *
  486. * @region?: string,
  487. * }|CopyObjectRequest $input
  488. *
  489. * @throws ObjectNotInActiveTierErrorException
  490. */
  491. public function copyObject($input): CopyObjectOutput
  492. {
  493. $input = CopyObjectRequest::create($input);
  494. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'CopyObject', 'region' => $input->getRegion(), 'exceptionMapping' => [
  495. 'ObjectNotInActiveTierError' => ObjectNotInActiveTierErrorException::class,
  496. ]]));
  497. return new CopyObjectOutput($response);
  498. }
  499. /**
  500. * Creates a new S3 bucket. To create a bucket, you must register with Amazon S3 and have a valid Amazon Web Services
  501. * Access Key ID to authenticate requests. Anonymous requests are never allowed to create buckets. By creating the
  502. * bucket, you become the bucket owner.
  503. *
  504. * Not every string is an acceptable bucket name. For information about bucket naming restrictions, see Bucket naming
  505. * rules [^1].
  506. *
  507. * If you want to create an Amazon S3 on Outposts bucket, see Create Bucket [^2].
  508. *
  509. * By default, the bucket is created in the US East (N. Virginia) Region. You can optionally specify a Region in the
  510. * request body. You might choose a Region to optimize latency, minimize costs, or address regulatory requirements. For
  511. * example, if you reside in Europe, you will probably find it advantageous to create buckets in the Europe (Ireland)
  512. * Region. For more information, see Accessing a bucket [^3].
  513. *
  514. * > If you send your create bucket request to the `s3.amazonaws.com` endpoint, the request goes to the `us-east-1`
  515. * > Region. Accordingly, the signature calculations in Signature Version 4 must use `us-east-1` as the Region, even if
  516. * > the location constraint in the request specifies another Region where the bucket is to be created. If you create a
  517. * > bucket in a Region other than US East (N. Virginia), your application must be able to handle 307 redirect. For more
  518. * > information, see Virtual hosting of buckets [^4].
  519. *
  520. * - `Permissions`:
  521. *
  522. * In addition to `s3:CreateBucket`, the following permissions are required when your `CreateBucket` request includes
  523. * specific headers:
  524. *
  525. * - **Access control lists (ACLs)** - If your `CreateBucket` request specifies access control list (ACL) permissions
  526. * and the ACL is public-read, public-read-write, authenticated-read, or if you specify access permissions
  527. * explicitly through any other ACL, both `s3:CreateBucket` and `s3:PutBucketAcl` permissions are needed. If the ACL
  528. * for the `CreateBucket` request is private or if the request doesn't specify any ACLs, only `s3:CreateBucket`
  529. * permission is needed.
  530. * - **Object Lock** - If `ObjectLockEnabledForBucket` is set to true in your `CreateBucket` request,
  531. * `s3:PutBucketObjectLockConfiguration` and `s3:PutBucketVersioning` permissions are required.
  532. * - **S3 Object Ownership** - If your `CreateBucket` request includes the `x-amz-object-ownership` header, then the
  533. * `s3:PutBucketOwnershipControls` permission is required. By default, `ObjectOwnership` is set to
  534. * `BucketOWnerEnforced` and ACLs are disabled. We recommend keeping ACLs disabled, except in uncommon use cases
  535. * where you must control access for each object individually. If you want to change the `ObjectOwnership` setting,
  536. * you can use the `x-amz-object-ownership` header in your `CreateBucket` request to set the `ObjectOwnership`
  537. * setting of your choice. For more information about S3 Object Ownership, see Controlling object ownership [^5] in
  538. * the *Amazon S3 User Guide*.
  539. * - **S3 Block Public Access** - If your specific use case requires granting public access to your S3 resources, you
  540. * can disable Block Public Access. You can create a new bucket with Block Public Access enabled, then separately
  541. * call the `DeletePublicAccessBlock` [^6] API. To use this operation, you must have the
  542. * `s3:PutBucketPublicAccessBlock` permission. By default, all Block Public Access settings are enabled for new
  543. * buckets. To avoid inadvertent exposure of your resources, we recommend keeping the S3 Block Public Access
  544. * settings enabled. For more information about S3 Block Public Access, see Blocking public access to your Amazon S3
  545. * storage [^7] in the *Amazon S3 User Guide*.
  546. *
  547. *
  548. * ! If your `CreateBucket` request sets `BucketOwnerEnforced` for Amazon S3 Object Ownership and specifies a bucket ACL
  549. * ! that provides access to an external Amazon Web Services account, your request fails with a `400` error and returns
  550. * ! the `InvalidBucketAcLWithObjectOwnership` error code. For more information, see Setting Object Ownership on an
  551. * ! existing bucket [^8] in the *Amazon S3 User Guide*.
  552. *
  553. * The following operations are related to `CreateBucket`:
  554. *
  555. * - PutObject [^9]
  556. * - DeleteBucket [^10]
  557. *
  558. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html
  559. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateBucket.html
  560. * [^3]: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#access-bucket-intro
  561. * [^4]: https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html
  562. * [^5]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html
  563. * [^6]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeletePublicAccessBlock.html
  564. * [^7]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html
  565. * [^8]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-ownership-existing-bucket.html
  566. * [^9]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html
  567. * [^10]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucket.html
  568. *
  569. * @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketPUT.html
  570. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html
  571. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#createbucket
  572. *
  573. * @param array{
  574. * ACL?: BucketCannedACL::*,
  575. * Bucket: string,
  576. * CreateBucketConfiguration?: CreateBucketConfiguration|array,
  577. * GrantFullControl?: string,
  578. * GrantRead?: string,
  579. * GrantReadACP?: string,
  580. * GrantWrite?: string,
  581. * GrantWriteACP?: string,
  582. * ObjectLockEnabledForBucket?: bool,
  583. * ObjectOwnership?: ObjectOwnership::*,
  584. *
  585. * @region?: string,
  586. * }|CreateBucketRequest $input
  587. *
  588. * @throws BucketAlreadyExistsException
  589. * @throws BucketAlreadyOwnedByYouException
  590. */
  591. public function createBucket($input): CreateBucketOutput
  592. {
  593. $input = CreateBucketRequest::create($input);
  594. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'CreateBucket', 'region' => $input->getRegion(), 'exceptionMapping' => [
  595. 'BucketAlreadyExists' => BucketAlreadyExistsException::class,
  596. 'BucketAlreadyOwnedByYou' => BucketAlreadyOwnedByYouException::class,
  597. ]]));
  598. return new CreateBucketOutput($response);
  599. }
  600. /**
  601. * This action initiates a multipart upload and returns an upload ID. This upload ID is used to associate all of the
  602. * parts in the specific multipart upload. You specify this upload ID in each of your subsequent upload part requests
  603. * (see UploadPart [^1]). You also include this upload ID in the final request to either complete or abort the multipart
  604. * upload request.
  605. *
  606. * For more information about multipart uploads, see Multipart Upload Overview [^2].
  607. *
  608. * If you have configured a lifecycle rule to abort incomplete multipart uploads, the upload must complete within the
  609. * number of days specified in the bucket lifecycle configuration. Otherwise, the incomplete multipart upload becomes
  610. * eligible for an abort action and Amazon S3 aborts the multipart upload. For more information, see Aborting Incomplete
  611. * Multipart Uploads Using a Bucket Lifecycle Configuration [^3].
  612. *
  613. * For information about the permissions required to use the multipart upload API, see Multipart Upload and Permissions
  614. * [^4].
  615. *
  616. * For request signing, multipart upload is just a series of regular requests. You initiate a multipart upload, send one
  617. * or more requests to upload parts, and then complete the multipart upload process. You sign each request individually.
  618. * There is nothing special about signing multipart upload requests. For more information about signing, see
  619. * Authenticating Requests (Amazon Web Services Signature Version 4) [^5].
  620. *
  621. * > After you initiate a multipart upload and upload one or more parts, to stop being charged for storing the uploaded
  622. * > parts, you must either complete or abort the multipart upload. Amazon S3 frees up the space used to store the parts
  623. * > and stop charging you for storing them only after you either complete or abort a multipart upload.
  624. *
  625. * Server-side encryption is for data encryption at rest. Amazon S3 encrypts your data as it writes it to disks in its
  626. * data centers and decrypts it when you access it. Amazon S3 automatically encrypts all new objects that are uploaded
  627. * to an S3 bucket. When doing a multipart upload, if you don't specify encryption information in your request, the
  628. * encryption setting of the uploaded parts is set to the default encryption configuration of the destination bucket. By
  629. * default, all buckets have a base level of encryption configuration that uses server-side encryption with Amazon S3
  630. * managed keys (SSE-S3). If the destination bucket has a default encryption configuration that uses server-side
  631. * encryption with an Key Management Service (KMS) key (SSE-KMS), or a customer-provided encryption key (SSE-C), Amazon
  632. * S3 uses the corresponding KMS key, or a customer-provided key to encrypt the uploaded parts. When you perform a
  633. * CreateMultipartUpload operation, if you want to use a different type of encryption setting for the uploaded parts,
  634. * you can request that Amazon S3 encrypts the object with a KMS key, an Amazon S3 managed key, or a customer-provided
  635. * key. If the encryption setting in your request is different from the default encryption configuration of the
  636. * destination bucket, the encryption setting in your request takes precedence. If you choose to provide your own
  637. * encryption key, the request headers you provide in UploadPart [^6] and UploadPartCopy [^7] requests must match the
  638. * headers you used in the request to initiate the upload by using `CreateMultipartUpload`. You can request that Amazon
  639. * S3 save the uploaded parts encrypted with server-side encryption with an Amazon S3 managed key (SSE-S3), an Key
  640. * Management Service (KMS) key (SSE-KMS), or a customer-provided encryption key (SSE-C).
  641. *
  642. * To perform a multipart upload with encryption by using an Amazon Web Services KMS key, the requester must have
  643. * permission to the `kms:Decrypt` and `kms:GenerateDataKey*` actions on the key. These permissions are required because
  644. * Amazon S3 must decrypt and read data from the encrypted file parts before it completes the multipart upload. For more
  645. * information, see Multipart upload API and permissions [^8] and Protecting data using server-side encryption with
  646. * Amazon Web Services KMS [^9] in the *Amazon S3 User Guide*.
  647. *
  648. * If your Identity and Access Management (IAM) user or role is in the same Amazon Web Services account as the KMS key,
  649. * then you must have these permissions on the key policy. If your IAM user or role belongs to a different account than
  650. * the key, then you must have the permissions on both the key policy and your IAM user or role.
  651. *
  652. * For more information, see Protecting Data Using Server-Side Encryption [^10].
  653. *
  654. * - `Access Permissions`:
  655. *
  656. * When copying an object, you can optionally specify the accounts or groups that should be granted specific
  657. * permissions on the new object. There are two ways to grant the permissions using the request headers:
  658. *
  659. * - Specify a canned ACL with the `x-amz-acl` request header. For more information, see Canned ACL [^11].
  660. * - Specify access permissions explicitly with the `x-amz-grant-read`, `x-amz-grant-read-acp`,
  661. * `x-amz-grant-write-acp`, and `x-amz-grant-full-control` headers. These parameters map to the set of permissions
  662. * that Amazon S3 supports in an ACL. For more information, see Access Control List (ACL) Overview [^12].
  663. *
  664. * You can use either a canned ACL or specify access permissions explicitly. You cannot do both.
  665. * - `Server-Side- Encryption-Specific Request Headers`:
  666. *
  667. * Amazon S3 encrypts data by using server-side encryption with an Amazon S3 managed key (SSE-S3) by default.
  668. * Server-side encryption is for data encryption at rest. Amazon S3 encrypts your data as it writes it to disks in its
  669. * data centers and decrypts it when you access it. You can request that Amazon S3 encrypts data at rest by using
  670. * server-side encryption with other key options. The option you use depends on whether you want to use KMS keys
  671. * (SSE-KMS) or provide your own encryption keys (SSE-C).
  672. *
  673. * - Use KMS keys (SSE-KMS) that include the Amazon Web Services managed key (`aws/s3`) and KMS customer managed keys
  674. * stored in Key Management Service (KMS) – If you want Amazon Web Services to manage the keys used to encrypt
  675. * data, specify the following headers in the request.
  676. *
  677. * - `x-amz-server-side-encryption`
  678. * - `x-amz-server-side-encryption-aws-kms-key-id`
  679. * - `x-amz-server-side-encryption-context`
  680. *
  681. * > If you specify `x-amz-server-side-encryption:aws:kms`, but don't provide
  682. * > `x-amz-server-side-encryption-aws-kms-key-id`, Amazon S3 uses the Amazon Web Services managed key (`aws/s3`
  683. * > key) in KMS to protect the data.
  684. *
  685. * ! All `GET` and `PUT` requests for an object protected by KMS fail if you don't make them by using Secure Sockets
  686. * ! Layer (SSL), Transport Layer Security (TLS), or Signature Version 4.
  687. *
  688. * For more information about server-side encryption with KMS keys (SSE-KMS), see Protecting Data Using Server-Side
  689. * Encryption with KMS keys [^13].
  690. * - Use customer-provided encryption keys (SSE-C) – If you want to manage your own encryption keys, provide all the
  691. * following headers in the request.
  692. *
  693. * - `x-amz-server-side-encryption-customer-algorithm`
  694. * - `x-amz-server-side-encryption-customer-key`
  695. * - `x-amz-server-side-encryption-customer-key-MD5`
  696. *
  697. * For more information about server-side encryption with customer-provided encryption keys (SSE-C), see Protecting
  698. * data using server-side encryption with customer-provided encryption keys (SSE-C) [^14].
  699. *
  700. * - `Access-Control-List (ACL)-Specific Request Headers`:
  701. *
  702. * You also can use the following access control–related headers with this operation. By default, all objects are
  703. * private. Only the owner has full access control. When adding a new object, you can grant permissions to individual
  704. * Amazon Web Services accounts or to predefined groups defined by Amazon S3. These permissions are then added to the
  705. * access control list (ACL) on the object. For more information, see Using ACLs [^15]. With this operation, you can
  706. * grant access permissions using one of the following two methods:
  707. *
  708. * - Specify a canned ACL (`x-amz-acl`) — Amazon S3 supports a set of predefined ACLs, known as *canned ACLs*. Each
  709. * canned ACL has a predefined set of grantees and permissions. For more information, see Canned ACL [^16].
  710. * - Specify access permissions explicitly — To explicitly grant access permissions to specific Amazon Web Services
  711. * accounts or groups, use the following headers. Each header maps to specific permissions that Amazon S3 supports
  712. * in an ACL. For more information, see Access Control List (ACL) Overview [^17]. In the header, you specify a list
  713. * of grantees who get the specific permission. To grant permissions explicitly, use:
  714. *
  715. * - `x-amz-grant-read`
  716. * - `x-amz-grant-write`
  717. * - `x-amz-grant-read-acp`
  718. * - `x-amz-grant-write-acp`
  719. * - `x-amz-grant-full-control`
  720. *
  721. * You specify each grantee as a type=value pair, where the type is one of the following:
  722. *
  723. * - `id` – if the value specified is the canonical user ID of an Amazon Web Services account
  724. * - `uri` – if you are granting permissions to a predefined group
  725. * - `emailAddress` – if the value specified is the email address of an Amazon Web Services account
  726. *
  727. * > Using email addresses to specify a grantee is only supported in the following Amazon Web Services Regions:
  728. * >
  729. * > - US East (N. Virginia)
  730. * > - US West (N. California)
  731. * > - US West (Oregon)
  732. * > - Asia Pacific (Singapore)
  733. * > - Asia Pacific (Sydney)
  734. * > - Asia Pacific (Tokyo)
  735. * > - Europe (Ireland)
  736. * > - South America (São Paulo)
  737. * >
  738. * > For a list of all the Amazon S3 supported Regions and endpoints, see Regions and Endpoints [^18] in the
  739. * > Amazon Web Services General Reference.
  740. *
  741. *
  742. * For example, the following `x-amz-grant-read` header grants the Amazon Web Services accounts identified by
  743. * account IDs permissions to read object data and its metadata:
  744. *
  745. * `x-amz-grant-read: id="11112222333", id="444455556666" `
  746. *
  747. *
  748. * The following operations are related to `CreateMultipartUpload`:
  749. *
  750. * - UploadPart [^19]
  751. * - CompleteMultipartUpload [^20]
  752. * - AbortMultipartUpload [^21]
  753. * - ListParts [^22]
  754. * - ListMultipartUploads [^23]
  755. *
  756. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html
  757. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html
  758. * [^3]: https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html#mpu-abort-incomplete-mpu-lifecycle-config
  759. * [^4]: https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html
  760. * [^5]: https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html
  761. * [^6]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html
  762. * [^7]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPartCopy.html
  763. * [^8]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html#mpuAndPermissions
  764. * [^9]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingKMSEncryption.html
  765. * [^10]: https://docs.aws.amazon.com/AmazonS3/latest/dev/serv-side-encryption.html
  766. * [^11]: https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL
  767. * [^12]: https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html
  768. * [^13]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingKMSEncryption.html
  769. * [^14]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerSideEncryptionCustomerKeys.html
  770. * [^15]: https://docs.aws.amazon.com/AmazonS3/latest/dev/S3_ACLs_UsingACLs.html
  771. * [^16]: https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL
  772. * [^17]: https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html
  773. * [^18]: https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
  774. * [^19]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html
  775. * [^20]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html
  776. * [^21]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_AbortMultipartUpload.html
  777. * [^22]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListParts.html
  778. * [^23]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListMultipartUploads.html
  779. *
  780. * @see http://docs.amazonwebservices.com/AmazonS3/latest/API/mpUploadInitiate.html
  781. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html
  782. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#createmultipartupload
  783. *
  784. * @param array{
  785. * ACL?: ObjectCannedACL::*,
  786. * Bucket: string,
  787. * CacheControl?: string,
  788. * ContentDisposition?: string,
  789. * ContentEncoding?: string,
  790. * ContentLanguage?: string,
  791. * ContentType?: string,
  792. * Expires?: \DateTimeImmutable|string,
  793. * GrantFullControl?: string,
  794. * GrantRead?: string,
  795. * GrantReadACP?: string,
  796. * GrantWriteACP?: string,
  797. * Key: string,
  798. * Metadata?: array<string, string>,
  799. * ServerSideEncryption?: ServerSideEncryption::*,
  800. * StorageClass?: StorageClass::*,
  801. * WebsiteRedirectLocation?: string,
  802. * SSECustomerAlgorithm?: string,
  803. * SSECustomerKey?: string,
  804. * SSECustomerKeyMD5?: string,
  805. * SSEKMSKeyId?: string,
  806. * SSEKMSEncryptionContext?: string,
  807. * BucketKeyEnabled?: bool,
  808. * RequestPayer?: RequestPayer::*,
  809. * Tagging?: string,
  810. * ObjectLockMode?: ObjectLockMode::*,
  811. * ObjectLockRetainUntilDate?: \DateTimeImmutable|string,
  812. * ObjectLockLegalHoldStatus?: ObjectLockLegalHoldStatus::*,
  813. * ExpectedBucketOwner?: string,
  814. * ChecksumAlgorithm?: ChecksumAlgorithm::*,
  815. *
  816. * @region?: string,
  817. * }|CreateMultipartUploadRequest $input
  818. */
  819. public function createMultipartUpload($input): CreateMultipartUploadOutput
  820. {
  821. $input = CreateMultipartUploadRequest::create($input);
  822. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'CreateMultipartUpload', 'region' => $input->getRegion()]));
  823. return new CreateMultipartUploadOutput($response);
  824. }
  825. /**
  826. * Deletes the S3 bucket. All objects (including all object versions and delete markers) in the bucket must be deleted
  827. * before the bucket itself can be deleted.
  828. *
  829. * The following operations are related to `DeleteBucket`:
  830. *
  831. * - CreateBucket [^1]
  832. * - DeleteObject [^2]
  833. *
  834. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html
  835. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html
  836. *
  837. * @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketDELETE.html
  838. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucket.html
  839. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#deletebucket
  840. *
  841. * @param array{
  842. * Bucket: string,
  843. * ExpectedBucketOwner?: string,
  844. *
  845. * @region?: string,
  846. * }|DeleteBucketRequest $input
  847. */
  848. public function deleteBucket($input): Result
  849. {
  850. $input = DeleteBucketRequest::create($input);
  851. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'DeleteBucket', 'region' => $input->getRegion()]));
  852. return new Result($response);
  853. }
  854. /**
  855. * Deletes the `cors` configuration information set for the bucket.
  856. *
  857. * To use this operation, you must have permission to perform the `s3:PutBucketCORS` action. The bucket owner has this
  858. * permission by default and can grant this permission to others.
  859. *
  860. * For information about `cors`, see Enabling Cross-Origin Resource Sharing [^1] in the *Amazon S3 User Guide*.
  861. *
  862. * **Related Resources**
  863. *
  864. * - PutBucketCors [^2]
  865. * - RESTOPTIONSobject [^3]
  866. *
  867. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html
  868. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketCors.html
  869. * [^3]: https://docs.aws.amazon.com/AmazonS3/latest/API/RESTOPTIONSobject.html
  870. *
  871. * @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketDELETEcors.html
  872. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketCors.html
  873. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#deletebucketcors
  874. *
  875. * @param array{
  876. * Bucket: string,
  877. * ExpectedBucketOwner?: string,
  878. *
  879. * @region?: string,
  880. * }|DeleteBucketCorsRequest $input
  881. */
  882. public function deleteBucketCors($input): Result
  883. {
  884. $input = DeleteBucketCorsRequest::create($input);
  885. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'DeleteBucketCors', 'region' => $input->getRegion()]));
  886. return new Result($response);
  887. }
  888. /**
  889. * Removes the null version (if there is one) of an object and inserts a delete marker, which becomes the latest version
  890. * of the object. If there isn't a null version, Amazon S3 does not remove any objects but will still respond that the
  891. * command was successful.
  892. *
  893. * To remove a specific version, you must use the version Id subresource. Using this subresource permanently deletes the
  894. * version. If the object deleted is a delete marker, Amazon S3 sets the response header, `x-amz-delete-marker`, to
  895. * true.
  896. *
  897. * If the object you want to delete is in a bucket where the bucket versioning configuration is MFA Delete enabled, you
  898. * must include the `x-amz-mfa` request header in the DELETE `versionId` request. Requests that include `x-amz-mfa` must
  899. * use HTTPS.
  900. *
  901. * For more information about MFA Delete, see Using MFA Delete [^1]. To see sample requests that use versioning, see
  902. * Sample Request [^2].
  903. *
  904. * You can delete objects by explicitly calling DELETE Object or configure its lifecycle (PutBucketLifecycle [^3]) to
  905. * enable Amazon S3 to remove them for you. If you want to block users or accounts from removing or deleting objects
  906. * from your bucket, you must deny them the `s3:DeleteObject`, `s3:DeleteObjectVersion`, and
  907. * `s3:PutLifeCycleConfiguration` actions.
  908. *
  909. * The following action is related to `DeleteObject`:
  910. *
  911. * - PutObject [^4]
  912. *
  913. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMFADelete.html
  914. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectDELETE.html#ExampleVersionObjectDelete
  915. * [^3]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketLifecycle.html
  916. * [^4]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html
  917. *
  918. * @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectDELETE.html
  919. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html
  920. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#deleteobject
  921. *
  922. * @param array{
  923. * Bucket: string,
  924. * Key: string,
  925. * MFA?: string,
  926. * VersionId?: string,
  927. * RequestPayer?: RequestPayer::*,
  928. * BypassGovernanceRetention?: bool,
  929. * ExpectedBucketOwner?: string,
  930. *
  931. * @region?: string,
  932. * }|DeleteObjectRequest $input
  933. */
  934. public function deleteObject($input): DeleteObjectOutput
  935. {
  936. $input = DeleteObjectRequest::create($input);
  937. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'DeleteObject', 'region' => $input->getRegion()]));
  938. return new DeleteObjectOutput($response);
  939. }
  940. /**
  941. * This action enables you to delete multiple objects from a bucket using a single HTTP request. If you know the object
  942. * keys that you want to delete, then this action provides a suitable alternative to sending individual delete requests,
  943. * reducing per-request overhead.
  944. *
  945. * The request contains a list of up to 1000 keys that you want to delete. In the XML, you provide the object key names,
  946. * and optionally, version IDs if you want to delete a specific version of the object from a versioning-enabled bucket.
  947. * For each key, Amazon S3 performs a delete action and returns the result of that delete, success, or failure, in the
  948. * response. Note that if the object specified in the request is not found, Amazon S3 returns the result as deleted.
  949. *
  950. * The action supports two modes for the response: verbose and quiet. By default, the action uses verbose mode in which
  951. * the response includes the result of deletion of each key in your request. In quiet mode the response includes only
  952. * keys where the delete action encountered an error. For a successful deletion, the action does not return any
  953. * information about the delete in the response body.
  954. *
  955. * When performing this action on an MFA Delete enabled bucket, that attempts to delete any versioned objects, you must
  956. * include an MFA token. If you do not provide one, the entire request will fail, even if there are non-versioned
  957. * objects you are trying to delete. If you provide an invalid token, whether there are versioned keys in the request or
  958. * not, the entire Multi-Object Delete request will fail. For information about MFA Delete, see MFA Delete [^1].
  959. *
  960. * Finally, the Content-MD5 header is required for all Multi-Object Delete requests. Amazon S3 uses the header value to
  961. * ensure that your request body has not been altered in transit.
  962. *
  963. * The following operations are related to `DeleteObjects`:
  964. *
  965. * - CreateMultipartUpload [^2]
  966. * - UploadPart [^3]
  967. * - CompleteMultipartUpload [^4]
  968. * - ListParts [^5]
  969. * - AbortMultipartUpload [^6]
  970. *
  971. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/Versioning.html#MultiFactorAuthenticationDelete
  972. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html
  973. * [^3]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html
  974. * [^4]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html
  975. * [^5]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListParts.html
  976. * [^6]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_AbortMultipartUpload.html
  977. *
  978. * @see http://docs.amazonwebservices.com/AmazonS3/latest/API/multiobjectdeleteapi.html
  979. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjects.html
  980. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#deleteobjects
  981. *
  982. * @param array{
  983. * Bucket: string,
  984. * Delete: Delete|array,
  985. * MFA?: string,
  986. * RequestPayer?: RequestPayer::*,
  987. * BypassGovernanceRetention?: bool,
  988. * ExpectedBucketOwner?: string,
  989. * ChecksumAlgorithm?: ChecksumAlgorithm::*,
  990. *
  991. * @region?: string,
  992. * }|DeleteObjectsRequest $input
  993. */
  994. public function deleteObjects($input): DeleteObjectsOutput
  995. {
  996. $input = DeleteObjectsRequest::create($input);
  997. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'DeleteObjects', 'region' => $input->getRegion()]));
  998. return new DeleteObjectsOutput($response);
  999. }
  1000. /**
  1001. * Returns the Cross-Origin Resource Sharing (CORS) configuration information set for the bucket.
  1002. *
  1003. * To use this operation, you must have permission to perform the `s3:GetBucketCORS` action. By default, the bucket
  1004. * owner has this permission and can grant it to others.
  1005. *
  1006. * To use this API operation against an access point, provide the alias of the access point in place of the bucket name.
  1007. *
  1008. * To use this API operation against an Object Lambda access point, provide the alias of the Object Lambda access point
  1009. * in place of the bucket name. If the Object Lambda access point alias in a request is not valid, the error code
  1010. * `InvalidAccessPointAliasError` is returned. For more information about `InvalidAccessPointAliasError`, see List of
  1011. * Error Codes [^1].
  1012. *
  1013. * For more information about CORS, see Enabling Cross-Origin Resource Sharing [^2].
  1014. *
  1015. * The following operations are related to `GetBucketCors`:
  1016. *
  1017. * - PutBucketCors [^3]
  1018. * - DeleteBucketCors [^4]
  1019. *
  1020. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList
  1021. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html
  1022. * [^3]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketCors.html
  1023. * [^4]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketCors.html
  1024. *
  1025. * @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketGETcors.html
  1026. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketCors.html
  1027. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#getbucketcors
  1028. *
  1029. * @param array{
  1030. * Bucket: string,
  1031. * ExpectedBucketOwner?: string,
  1032. *
  1033. * @region?: string,
  1034. * }|GetBucketCorsRequest $input
  1035. */
  1036. public function getBucketCors($input): GetBucketCorsOutput
  1037. {
  1038. $input = GetBucketCorsRequest::create($input);
  1039. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'GetBucketCors', 'region' => $input->getRegion()]));
  1040. return new GetBucketCorsOutput($response);
  1041. }
  1042. /**
  1043. * Returns the default encryption configuration for an Amazon S3 bucket. By default, all buckets have a default
  1044. * encryption configuration that uses server-side encryption with Amazon S3 managed keys (SSE-S3). For information about
  1045. * the bucket default encryption feature, see Amazon S3 Bucket Default Encryption [^1] in the *Amazon S3 User Guide*.
  1046. *
  1047. * To use this operation, you must have permission to perform the `s3:GetEncryptionConfiguration` action. The bucket
  1048. * owner has this permission by default. The bucket owner can grant this permission to others. For more information
  1049. * about permissions, see Permissions Related to Bucket Subresource Operations [^2] and Managing Access Permissions to
  1050. * Your Amazon S3 Resources [^3].
  1051. *
  1052. * The following operations are related to `GetBucketEncryption`:
  1053. *
  1054. * - PutBucketEncryption [^4]
  1055. * - DeleteBucketEncryption [^5]
  1056. *
  1057. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html
  1058. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources
  1059. * [^3]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html
  1060. * [^4]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketEncryption.html
  1061. * [^5]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketEncryption.html
  1062. *
  1063. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketEncryption.html
  1064. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#getbucketencryption
  1065. *
  1066. * @param array{
  1067. * Bucket: string,
  1068. * ExpectedBucketOwner?: string,
  1069. *
  1070. * @region?: string,
  1071. * }|GetBucketEncryptionRequest $input
  1072. */
  1073. public function getBucketEncryption($input): GetBucketEncryptionOutput
  1074. {
  1075. $input = GetBucketEncryptionRequest::create($input);
  1076. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'GetBucketEncryption', 'region' => $input->getRegion()]));
  1077. return new GetBucketEncryptionOutput($response);
  1078. }
  1079. /**
  1080. * Retrieves objects from Amazon S3. To use `GET`, you must have `READ` access to the object. If you grant `READ` access
  1081. * to the anonymous user, you can return the object without using an authorization header.
  1082. *
  1083. * An Amazon S3 bucket has no directory hierarchy such as you would find in a typical computer file system. You can,
  1084. * however, create a logical hierarchy by using object key names that imply a folder structure. For example, instead of
  1085. * naming an object `sample.jpg`, you can name it `photos/2006/February/sample.jpg`.
  1086. *
  1087. * To get an object from such a logical hierarchy, specify the full key name for the object in the `GET` operation. For
  1088. * a virtual hosted-style request example, if you have the object `photos/2006/February/sample.jpg`, specify the
  1089. * resource as `/photos/2006/February/sample.jpg`. For a path-style request example, if you have the object
  1090. * `photos/2006/February/sample.jpg` in the bucket named `examplebucket`, specify the resource as
  1091. * `/examplebucket/photos/2006/February/sample.jpg`. For more information about request types, see HTTP Host Header
  1092. * Bucket Specification [^1].
  1093. *
  1094. * For more information about returning the ACL of an object, see GetObjectAcl [^2].
  1095. *
  1096. * If the object you are retrieving is stored in the S3 Glacier Flexible Retrieval or S3 Glacier Deep Archive storage
  1097. * class, or S3 Intelligent-Tiering Archive or S3 Intelligent-Tiering Deep Archive tiers, before you can retrieve the
  1098. * object you must first restore a copy using RestoreObject [^3]. Otherwise, this action returns an `InvalidObjectState`
  1099. * error. For information about restoring archived objects, see Restoring Archived Objects [^4].
  1100. *
  1101. * Encryption request headers, like `x-amz-server-side-encryption`, should not be sent for GET requests if your object
  1102. * uses server-side encryption with Key Management Service (KMS) keys (SSE-KMS), dual-layer server-side encryption with
  1103. * Amazon Web Services KMS keys (DSSE-KMS), or server-side encryption with Amazon S3 managed encryption keys (SSE-S3).
  1104. * If your object does use these types of keys, you’ll get an HTTP 400 Bad Request error.
  1105. *
  1106. * If you encrypt an object by using server-side encryption with customer-provided encryption keys (SSE-C) when you
  1107. * store the object in Amazon S3, then when you GET the object, you must use the following headers:
  1108. *
  1109. * - `x-amz-server-side-encryption-customer-algorithm`
  1110. * - `x-amz-server-side-encryption-customer-key`
  1111. * - `x-amz-server-side-encryption-customer-key-MD5`
  1112. *
  1113. * For more information about SSE-C, see Server-Side Encryption (Using Customer-Provided Encryption Keys) [^5].
  1114. *
  1115. * Assuming you have the relevant permission to read object tags, the response also returns the `x-amz-tagging-count`
  1116. * header that provides the count of number of tags associated with the object. You can use GetObjectTagging [^6] to
  1117. * retrieve the tag set associated with an object.
  1118. *
  1119. * - `Permissions`:
  1120. *
  1121. * You need the relevant read object (or version) permission for this operation. For more information, see Specifying
  1122. * Permissions in a Policy [^7]. If the object that you request doesn’t exist, the error that Amazon S3 returns
  1123. * depends on whether you also have the `s3:ListBucket` permission.
  1124. *
  1125. * If you have the `s3:ListBucket` permission on the bucket, Amazon S3 returns an HTTP status code 404 (Not Found)
  1126. * error.
  1127. *
  1128. * If you don’t have the `s3:ListBucket` permission, Amazon S3 returns an HTTP status code 403 ("access denied")
  1129. * error.
  1130. * - `Versioning`:
  1131. *
  1132. * By default, the `GET` action returns the current version of an object. To return a different version, use the
  1133. * `versionId` subresource.
  1134. *
  1135. * > - If you supply a `versionId`, you need the `s3:GetObjectVersion` permission to access a specific version of an
  1136. * > object. If you request a specific version, you do not need to have the `s3:GetObject` permission. If you
  1137. * > request the current version without a specific version ID, only `s3:GetObject` permission is required.
  1138. * > `s3:GetObjectVersion` permission won't be required.
  1139. * > - If the current version of the object is a delete marker, Amazon S3 behaves as if the object was deleted and
  1140. * > includes `x-amz-delete-marker: true` in the response.
  1141. * >
  1142. *
  1143. * For more information about versioning, see PutBucketVersioning [^8].
  1144. * - `Overriding Response Header Values`:
  1145. *
  1146. * There are times when you want to override certain response header values in a `GET` response. For example, you
  1147. * might override the `Content-Disposition` response header value in your `GET` request.
  1148. *
  1149. * You can override values for a set of response headers using the following query parameters. These response header
  1150. * values are sent only on a successful request, that is, when status code 200 OK is returned. The set of headers you
  1151. * can override using these parameters is a subset of the headers that Amazon S3 accepts when you create an object.
  1152. * The response headers that you can override for the `GET` response are `Content-Type`, `Content-Language`,
  1153. * `Expires`, `Cache-Control`, `Content-Disposition`, and `Content-Encoding`. To override these header values in the
  1154. * `GET` response, you use the following request parameters.
  1155. *
  1156. * > You must sign the request, either using an Authorization header or a presigned URL, when using these parameters.
  1157. * > They cannot be used with an unsigned (anonymous) request.
  1158. *
  1159. * - `response-content-type`
  1160. * - `response-content-language`
  1161. * - `response-expires`
  1162. * - `response-cache-control`
  1163. * - `response-content-disposition`
  1164. * - `response-content-encoding`
  1165. *
  1166. * - `Overriding Response Header Values`:
  1167. *
  1168. * If both of the `If-Match` and `If-Unmodified-Since` headers are present in the request as follows: `If-Match`
  1169. * condition evaluates to `true`, and; `If-Unmodified-Since` condition evaluates to `false`; then, S3 returns 200 OK
  1170. * and the data requested.
  1171. *
  1172. * If both of the `If-None-Match` and `If-Modified-Since` headers are present in the request as follows:`
  1173. * If-None-Match` condition evaluates to `false`, and; `If-Modified-Since` condition evaluates to `true`; then, S3
  1174. * returns 304 Not Modified response code.
  1175. *
  1176. * For more information about conditional requests, see RFC 7232 [^9].
  1177. *
  1178. * The following operations are related to `GetObject`:
  1179. *
  1180. * - ListBuckets [^10]
  1181. * - GetObjectAcl [^11]
  1182. *
  1183. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html#VirtualHostingSpecifyBucket
  1184. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectAcl.html
  1185. * [^3]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_RestoreObject.html
  1186. * [^4]: https://docs.aws.amazon.com/AmazonS3/latest/dev/restoring-objects.html
  1187. * [^5]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html
  1188. * [^6]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectTagging.html
  1189. * [^7]: https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html
  1190. * [^8]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketVersioning.html
  1191. * [^9]: https://tools.ietf.org/html/rfc7232
  1192. * [^10]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBuckets.html
  1193. * [^11]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectAcl.html
  1194. *
  1195. * @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectGET.html
  1196. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html
  1197. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#getobject
  1198. *
  1199. * @param array{
  1200. * Bucket: string,
  1201. * IfMatch?: string,
  1202. * IfModifiedSince?: \DateTimeImmutable|string,
  1203. * IfNoneMatch?: string,
  1204. * IfUnmodifiedSince?: \DateTimeImmutable|string,
  1205. * Key: string,
  1206. * Range?: string,
  1207. * ResponseCacheControl?: string,
  1208. * ResponseContentDisposition?: string,
  1209. * ResponseContentEncoding?: string,
  1210. * ResponseContentLanguage?: string,
  1211. * ResponseContentType?: string,
  1212. * ResponseExpires?: \DateTimeImmutable|string,
  1213. * VersionId?: string,
  1214. * SSECustomerAlgorithm?: string,
  1215. * SSECustomerKey?: string,
  1216. * SSECustomerKeyMD5?: string,
  1217. * RequestPayer?: RequestPayer::*,
  1218. * PartNumber?: int,
  1219. * ExpectedBucketOwner?: string,
  1220. * ChecksumMode?: ChecksumMode::*,
  1221. *
  1222. * @region?: string,
  1223. * }|GetObjectRequest $input
  1224. *
  1225. * @throws NoSuchKeyException
  1226. * @throws InvalidObjectStateException
  1227. */
  1228. public function getObject($input): GetObjectOutput
  1229. {
  1230. $input = GetObjectRequest::create($input);
  1231. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'GetObject', 'region' => $input->getRegion(), 'exceptionMapping' => [
  1232. 'NoSuchKey' => NoSuchKeyException::class,
  1233. 'InvalidObjectState' => InvalidObjectStateException::class,
  1234. ]]));
  1235. return new GetObjectOutput($response);
  1236. }
  1237. /**
  1238. * Returns the access control list (ACL) of an object. To use this operation, you must have `s3:GetObjectAcl`
  1239. * permissions or `READ_ACP` access to the object. For more information, see Mapping of ACL permissions and access
  1240. * policy permissions [^1] in the *Amazon S3 User Guide*.
  1241. *
  1242. * This action is not supported by Amazon S3 on Outposts.
  1243. *
  1244. * By default, GET returns ACL information about the current version of an object. To return ACL information about a
  1245. * different version, use the versionId subresource.
  1246. *
  1247. * > If your bucket uses the bucket owner enforced setting for S3 Object Ownership, requests to read ACLs are still
  1248. * > supported and return the `bucket-owner-full-control` ACL with the owner being the account that created the bucket.
  1249. * > For more information, see Controlling object ownership and disabling ACLs [^2] in the *Amazon S3 User Guide*.
  1250. *
  1251. * The following operations are related to `GetObjectAcl`:
  1252. *
  1253. * - GetObject [^3]
  1254. * - GetObjectAttributes [^4]
  1255. * - DeleteObject [^5]
  1256. * - PutObject [^6]
  1257. *
  1258. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#acl-access-policy-permission-mapping
  1259. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html
  1260. * [^3]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html
  1261. * [^4]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectAttributes.html
  1262. * [^5]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html
  1263. * [^6]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html
  1264. *
  1265. * @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectGETacl.html
  1266. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectAcl.html
  1267. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#getobjectacl
  1268. *
  1269. * @param array{
  1270. * Bucket: string,
  1271. * Key: string,
  1272. * VersionId?: string,
  1273. * RequestPayer?: RequestPayer::*,
  1274. * ExpectedBucketOwner?: string,
  1275. *
  1276. * @region?: string,
  1277. * }|GetObjectAclRequest $input
  1278. *
  1279. * @throws NoSuchKeyException
  1280. */
  1281. public function getObjectAcl($input): GetObjectAclOutput
  1282. {
  1283. $input = GetObjectAclRequest::create($input);
  1284. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'GetObjectAcl', 'region' => $input->getRegion(), 'exceptionMapping' => [
  1285. 'NoSuchKey' => NoSuchKeyException::class,
  1286. ]]));
  1287. return new GetObjectAclOutput($response);
  1288. }
  1289. /**
  1290. * The `HEAD` action retrieves metadata from an object without returning the object itself. This action is useful if
  1291. * you're only interested in an object's metadata. To use `HEAD`, you must have READ access to the object.
  1292. *
  1293. * A `HEAD` request has the same options as a `GET` action on an object. The response is identical to the `GET` response
  1294. * except that there is no response body. Because of this, if the `HEAD` request generates an error, it returns a
  1295. * generic `400 Bad Request`, `403 Forbidden` or `404 Not Found` code. It is not possible to retrieve the exact
  1296. * exception beyond these error codes.
  1297. *
  1298. * If you encrypt an object by using server-side encryption with customer-provided encryption keys (SSE-C) when you
  1299. * store the object in Amazon S3, then when you retrieve the metadata from the object, you must use the following
  1300. * headers:
  1301. *
  1302. * - `x-amz-server-side-encryption-customer-algorithm`
  1303. * - `x-amz-server-side-encryption-customer-key`
  1304. * - `x-amz-server-side-encryption-customer-key-MD5`
  1305. *
  1306. * For more information about SSE-C, see Server-Side Encryption (Using Customer-Provided Encryption Keys) [^1].
  1307. *
  1308. * > - Encryption request headers, like `x-amz-server-side-encryption`, should not be sent for `GET` requests if your
  1309. * > object uses server-side encryption with Key Management Service (KMS) keys (SSE-KMS), dual-layer server-side
  1310. * > encryption with Amazon Web Services KMS keys (DSSE-KMS), or server-side encryption with Amazon S3 managed
  1311. * > encryption keys (SSE-S3). If your object does use these types of keys, you’ll get an HTTP 400 Bad Request
  1312. * > error.
  1313. * > - The last modified property in this case is the creation date of the object.
  1314. * >
  1315. *
  1316. * Request headers are limited to 8 KB in size. For more information, see Common Request Headers [^2].
  1317. *
  1318. * Consider the following when using request headers:
  1319. *
  1320. * - Consideration 1 – If both of the `If-Match` and `If-Unmodified-Since` headers are present in the request as
  1321. * follows:
  1322. *
  1323. * - `If-Match` condition evaluates to `true`, and;
  1324. * - `If-Unmodified-Since` condition evaluates to `false`;
  1325. *
  1326. * Then Amazon S3 returns `200 OK` and the data requested.
  1327. * - Consideration 2 – If both of the `If-None-Match` and `If-Modified-Since` headers are present in the request as
  1328. * follows:
  1329. *
  1330. * - `If-None-Match` condition evaluates to `false`, and;
  1331. * - `If-Modified-Since` condition evaluates to `true`;
  1332. *
  1333. * Then Amazon S3 returns the `304 Not Modified` response code.
  1334. *
  1335. * For more information about conditional requests, see RFC 7232 [^3].
  1336. *
  1337. * - `Permissions`:
  1338. *
  1339. * You need the relevant read object (or version) permission for this operation. For more information, see Actions,
  1340. * resources, and condition keys for Amazon S3 [^4]. If the object you request doesn't exist, the error that Amazon S3
  1341. * returns depends on whether you also have the s3:ListBucket permission.
  1342. *
  1343. * - If you have the `s3:ListBucket` permission on the bucket, Amazon S3 returns an HTTP status code 404 error.
  1344. * - If you don’t have the `s3:ListBucket` permission, Amazon S3 returns an HTTP status code 403 error.
  1345. *
  1346. *
  1347. * The following actions are related to `HeadObject`:
  1348. *
  1349. * - GetObject [^5]
  1350. * - GetObjectAttributes [^6]
  1351. *
  1352. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html
  1353. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/API/RESTCommonRequestHeaders.html
  1354. * [^3]: https://tools.ietf.org/html/rfc7232
  1355. * [^4]: https://docs.aws.amazon.com/AmazonS3/latest/dev/list_amazons3.html
  1356. * [^5]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html
  1357. * [^6]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectAttributes.html
  1358. *
  1359. * @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectHEAD.html
  1360. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_HeadObject.html
  1361. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#headobject
  1362. *
  1363. * @param array{
  1364. * Bucket: string,
  1365. * IfMatch?: string,
  1366. * IfModifiedSince?: \DateTimeImmutable|string,
  1367. * IfNoneMatch?: string,
  1368. * IfUnmodifiedSince?: \DateTimeImmutable|string,
  1369. * Key: string,
  1370. * Range?: string,
  1371. * VersionId?: string,
  1372. * SSECustomerAlgorithm?: string,
  1373. * SSECustomerKey?: string,
  1374. * SSECustomerKeyMD5?: string,
  1375. * RequestPayer?: RequestPayer::*,
  1376. * PartNumber?: int,
  1377. * ExpectedBucketOwner?: string,
  1378. * ChecksumMode?: ChecksumMode::*,
  1379. *
  1380. * @region?: string,
  1381. * }|HeadObjectRequest $input
  1382. *
  1383. * @throws NoSuchKeyException
  1384. */
  1385. public function headObject($input): HeadObjectOutput
  1386. {
  1387. $input = HeadObjectRequest::create($input);
  1388. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'HeadObject', 'region' => $input->getRegion(), 'exceptionMapping' => [
  1389. 'NoSuchKey' => NoSuchKeyException::class,
  1390. ]]));
  1391. return new HeadObjectOutput($response);
  1392. }
  1393. /**
  1394. * Returns a list of all buckets owned by the authenticated sender of the request. To use this operation, you must have
  1395. * the `s3:ListAllMyBuckets` permission.
  1396. *
  1397. * For information about Amazon S3 buckets, see Creating, configuring, and working with Amazon S3 buckets [^1].
  1398. *
  1399. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/creating-buckets-s3.html
  1400. *
  1401. * @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTServiceGET.html
  1402. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBuckets.html
  1403. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#listbuckets
  1404. *
  1405. * @param array{
  1406. *
  1407. * @region?: string,
  1408. * }|ListBucketsRequest $input
  1409. */
  1410. public function listBuckets($input = []): ListBucketsOutput
  1411. {
  1412. $input = ListBucketsRequest::create($input);
  1413. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'ListBuckets', 'region' => $input->getRegion()]));
  1414. return new ListBucketsOutput($response);
  1415. }
  1416. /**
  1417. * This action lists in-progress multipart uploads. An in-progress multipart upload is a multipart upload that has been
  1418. * initiated using the Initiate Multipart Upload request, but has not yet been completed or aborted.
  1419. *
  1420. * This action returns at most 1,000 multipart uploads in the response. 1,000 multipart uploads is the maximum number of
  1421. * uploads a response can include, which is also the default value. You can further limit the number of uploads in a
  1422. * response by specifying the `max-uploads` parameter in the response. If additional multipart uploads satisfy the list
  1423. * criteria, the response will contain an `IsTruncated` element with the value true. To list the additional multipart
  1424. * uploads, use the `key-marker` and `upload-id-marker` request parameters.
  1425. *
  1426. * In the response, the uploads are sorted by key. If your application has initiated more than one multipart upload
  1427. * using the same object key, then uploads in the response are first sorted by key. Additionally, uploads are sorted in
  1428. * ascending order within each key by the upload initiation time.
  1429. *
  1430. * For more information on multipart uploads, see Uploading Objects Using Multipart Upload [^1].
  1431. *
  1432. * For information on permissions required to use the multipart upload API, see Multipart Upload and Permissions [^2].
  1433. *
  1434. * The following operations are related to `ListMultipartUploads`:
  1435. *
  1436. * - CreateMultipartUpload [^3]
  1437. * - UploadPart [^4]
  1438. * - CompleteMultipartUpload [^5]
  1439. * - ListParts [^6]
  1440. * - AbortMultipartUpload [^7]
  1441. *
  1442. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html
  1443. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html
  1444. * [^3]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html
  1445. * [^4]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html
  1446. * [^5]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html
  1447. * [^6]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListParts.html
  1448. * [^7]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_AbortMultipartUpload.html
  1449. *
  1450. * @see http://docs.amazonwebservices.com/AmazonS3/latest/API/mpUploadListMPUpload.html
  1451. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListMultipartUploads.html
  1452. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#listmultipartuploads
  1453. *
  1454. * @param array{
  1455. * Bucket: string,
  1456. * Delimiter?: string,
  1457. * EncodingType?: EncodingType::*,
  1458. * KeyMarker?: string,
  1459. * MaxUploads?: int,
  1460. * Prefix?: string,
  1461. * UploadIdMarker?: string,
  1462. * ExpectedBucketOwner?: string,
  1463. * RequestPayer?: RequestPayer::*,
  1464. *
  1465. * @region?: string,
  1466. * }|ListMultipartUploadsRequest $input
  1467. */
  1468. public function listMultipartUploads($input): ListMultipartUploadsOutput
  1469. {
  1470. $input = ListMultipartUploadsRequest::create($input);
  1471. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'ListMultipartUploads', 'region' => $input->getRegion()]));
  1472. return new ListMultipartUploadsOutput($response, $this, $input);
  1473. }
  1474. /**
  1475. * Returns some or all (up to 1,000) of the objects in a bucket with each request. You can use the request parameters as
  1476. * selection criteria to return a subset of the objects in a bucket. A `200 OK` response can contain valid or invalid
  1477. * XML. Make sure to design your application to parse the contents of the response and handle it appropriately. Objects
  1478. * are returned sorted in an ascending order of the respective key names in the list. For more information about listing
  1479. * objects, see Listing object keys programmatically [^1].
  1480. *
  1481. * To use this operation, you must have READ access to the bucket.
  1482. *
  1483. * To use this action in an Identity and Access Management (IAM) policy, you must have permissions to perform the
  1484. * `s3:ListBucket` action. The bucket owner has this permission by default and can grant this permission to others. For
  1485. * more information about permissions, see Permissions Related to Bucket Subresource Operations [^2] and Managing Access
  1486. * Permissions to Your Amazon S3 Resources [^3].
  1487. *
  1488. * ! This section describes the latest revision of this action. We recommend that you use this revised API for
  1489. * ! application development. For backward compatibility, Amazon S3 continues to support the prior version of this API,
  1490. * ! ListObjects [^4].
  1491. *
  1492. * To get a list of your buckets, see ListBuckets [^5].
  1493. *
  1494. * The following operations are related to `ListObjectsV2`:
  1495. *
  1496. * - GetObject [^6]
  1497. * - PutObject [^7]
  1498. * - CreateBucket [^8]
  1499. *
  1500. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/ListingKeysUsingAPIs.html
  1501. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources
  1502. * [^3]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html
  1503. * [^4]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjects.html
  1504. * [^5]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBuckets.html
  1505. * [^6]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html
  1506. * [^7]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html
  1507. * [^8]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html
  1508. *
  1509. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html
  1510. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#listobjectsv2
  1511. *
  1512. * @param array{
  1513. * Bucket: string,
  1514. * Delimiter?: string,
  1515. * EncodingType?: EncodingType::*,
  1516. * MaxKeys?: int,
  1517. * Prefix?: string,
  1518. * ContinuationToken?: string,
  1519. * FetchOwner?: bool,
  1520. * StartAfter?: string,
  1521. * RequestPayer?: RequestPayer::*,
  1522. * ExpectedBucketOwner?: string,
  1523. *
  1524. * @region?: string,
  1525. * }|ListObjectsV2Request $input
  1526. *
  1527. * @throws NoSuchBucketException
  1528. */
  1529. public function listObjectsV2($input): ListObjectsV2Output
  1530. {
  1531. $input = ListObjectsV2Request::create($input);
  1532. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'ListObjectsV2', 'region' => $input->getRegion(), 'exceptionMapping' => [
  1533. 'NoSuchBucket' => NoSuchBucketException::class,
  1534. ]]));
  1535. return new ListObjectsV2Output($response, $this, $input);
  1536. }
  1537. /**
  1538. * Lists the parts that have been uploaded for a specific multipart upload. This operation must include the upload ID,
  1539. * which you obtain by sending the initiate multipart upload request (see CreateMultipartUpload [^1]). This request
  1540. * returns a maximum of 1,000 uploaded parts. The default number of parts returned is 1,000 parts. You can restrict the
  1541. * number of parts returned by specifying the `max-parts` request parameter. If your multipart upload consists of more
  1542. * than 1,000 parts, the response returns an `IsTruncated` field with the value of true, and a `NextPartNumberMarker`
  1543. * element. In subsequent `ListParts` requests you can include the part-number-marker query string parameter and set its
  1544. * value to the `NextPartNumberMarker` field value from the previous response.
  1545. *
  1546. * If the upload was created using a checksum algorithm, you will need to have permission to the `kms:Decrypt` action
  1547. * for the request to succeed.
  1548. *
  1549. * For more information on multipart uploads, see Uploading Objects Using Multipart Upload [^2].
  1550. *
  1551. * For information on permissions required to use the multipart upload API, see Multipart Upload and Permissions [^3].
  1552. *
  1553. * The following operations are related to `ListParts`:
  1554. *
  1555. * - CreateMultipartUpload [^4]
  1556. * - UploadPart [^5]
  1557. * - CompleteMultipartUpload [^6]
  1558. * - AbortMultipartUpload [^7]
  1559. * - GetObjectAttributes [^8]
  1560. * - ListMultipartUploads [^9]
  1561. *
  1562. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html
  1563. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html
  1564. * [^3]: https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html
  1565. * [^4]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html
  1566. * [^5]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html
  1567. * [^6]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html
  1568. * [^7]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_AbortMultipartUpload.html
  1569. * [^8]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectAttributes.html
  1570. * [^9]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListMultipartUploads.html
  1571. *
  1572. * @see http://docs.amazonwebservices.com/AmazonS3/latest/API/mpUploadListParts.html
  1573. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListParts.html
  1574. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#listparts
  1575. *
  1576. * @param array{
  1577. * Bucket: string,
  1578. * Key: string,
  1579. * MaxParts?: int,
  1580. * PartNumberMarker?: int,
  1581. * UploadId: string,
  1582. * RequestPayer?: RequestPayer::*,
  1583. * ExpectedBucketOwner?: string,
  1584. * SSECustomerAlgorithm?: string,
  1585. * SSECustomerKey?: string,
  1586. * SSECustomerKeyMD5?: string,
  1587. *
  1588. * @region?: string,
  1589. * }|ListPartsRequest $input
  1590. */
  1591. public function listParts($input): ListPartsOutput
  1592. {
  1593. $input = ListPartsRequest::create($input);
  1594. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'ListParts', 'region' => $input->getRegion()]));
  1595. return new ListPartsOutput($response, $this, $input);
  1596. }
  1597. /**
  1598. * @see headObject
  1599. *
  1600. * @param array{
  1601. * Bucket: string,
  1602. * IfMatch?: string,
  1603. * IfModifiedSince?: \DateTimeImmutable|string,
  1604. * IfNoneMatch?: string,
  1605. * IfUnmodifiedSince?: \DateTimeImmutable|string,
  1606. * Key: string,
  1607. * Range?: string,
  1608. * VersionId?: string,
  1609. * SSECustomerAlgorithm?: string,
  1610. * SSECustomerKey?: string,
  1611. * SSECustomerKeyMD5?: string,
  1612. * RequestPayer?: RequestPayer::*,
  1613. * PartNumber?: int,
  1614. * ExpectedBucketOwner?: string,
  1615. * ChecksumMode?: ChecksumMode::*,
  1616. *
  1617. * @region?: string,
  1618. * }|HeadObjectRequest $input
  1619. */
  1620. public function objectExists($input): ObjectExistsWaiter
  1621. {
  1622. $input = HeadObjectRequest::create($input);
  1623. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'HeadObject', 'region' => $input->getRegion(), 'exceptionMapping' => [
  1624. 'NoSuchKey' => NoSuchKeyException::class,
  1625. ]]));
  1626. return new ObjectExistsWaiter($response, $this, $input);
  1627. }
  1628. /**
  1629. * @see headObject
  1630. *
  1631. * @param array{
  1632. * Bucket: string,
  1633. * IfMatch?: string,
  1634. * IfModifiedSince?: \DateTimeImmutable|string,
  1635. * IfNoneMatch?: string,
  1636. * IfUnmodifiedSince?: \DateTimeImmutable|string,
  1637. * Key: string,
  1638. * Range?: string,
  1639. * VersionId?: string,
  1640. * SSECustomerAlgorithm?: string,
  1641. * SSECustomerKey?: string,
  1642. * SSECustomerKeyMD5?: string,
  1643. * RequestPayer?: RequestPayer::*,
  1644. * PartNumber?: int,
  1645. * ExpectedBucketOwner?: string,
  1646. * ChecksumMode?: ChecksumMode::*,
  1647. *
  1648. * @region?: string,
  1649. * }|HeadObjectRequest $input
  1650. */
  1651. public function objectNotExists($input): ObjectNotExistsWaiter
  1652. {
  1653. $input = HeadObjectRequest::create($input);
  1654. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'HeadObject', 'region' => $input->getRegion(), 'exceptionMapping' => [
  1655. 'NoSuchKey' => NoSuchKeyException::class,
  1656. ]]));
  1657. return new ObjectNotExistsWaiter($response, $this, $input);
  1658. }
  1659. /**
  1660. * Sets the `cors` configuration for your bucket. If the configuration exists, Amazon S3 replaces it.
  1661. *
  1662. * To use this operation, you must be allowed to perform the `s3:PutBucketCORS` action. By default, the bucket owner has
  1663. * this permission and can grant it to others.
  1664. *
  1665. * You set this configuration on a bucket so that the bucket can service cross-origin requests. For example, you might
  1666. * want to enable a request whose origin is `http://www.example.com` to access your Amazon S3 bucket at
  1667. * `my.example.bucket.com` by using the browser's `XMLHttpRequest` capability.
  1668. *
  1669. * To enable cross-origin resource sharing (CORS) on a bucket, you add the `cors` subresource to the bucket. The `cors`
  1670. * subresource is an XML document in which you configure rules that identify origins and the HTTP methods that can be
  1671. * executed on your bucket. The document is limited to 64 KB in size.
  1672. *
  1673. * When Amazon S3 receives a cross-origin request (or a pre-flight OPTIONS request) against a bucket, it evaluates the
  1674. * `cors` configuration on the bucket and uses the first `CORSRule` rule that matches the incoming browser request to
  1675. * enable a cross-origin request. For a rule to match, the following conditions must be met:
  1676. *
  1677. * - The request's `Origin` header must match `AllowedOrigin` elements.
  1678. * - The request method (for example, GET, PUT, HEAD, and so on) or the `Access-Control-Request-Method` header in case
  1679. * of a pre-flight `OPTIONS` request must be one of the `AllowedMethod` elements.
  1680. * - Every header specified in the `Access-Control-Request-Headers` request header of a pre-flight request must match an
  1681. * `AllowedHeader` element.
  1682. *
  1683. * For more information about CORS, go to Enabling Cross-Origin Resource Sharing [^1] in the *Amazon S3 User Guide*.
  1684. *
  1685. * The following operations are related to `PutBucketCors`:
  1686. *
  1687. * - GetBucketCors [^2]
  1688. * - DeleteBucketCors [^3]
  1689. * - RESTOPTIONSobject [^4]
  1690. *
  1691. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html
  1692. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketCors.html
  1693. * [^3]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketCors.html
  1694. * [^4]: https://docs.aws.amazon.com/AmazonS3/latest/API/RESTOPTIONSobject.html
  1695. *
  1696. * @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketPUTcors.html
  1697. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketCors.html
  1698. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#putbucketcors
  1699. *
  1700. * @param array{
  1701. * Bucket: string,
  1702. * CORSConfiguration: CORSConfiguration|array,
  1703. * ContentMD5?: string,
  1704. * ChecksumAlgorithm?: ChecksumAlgorithm::*,
  1705. * ExpectedBucketOwner?: string,
  1706. *
  1707. * @region?: string,
  1708. * }|PutBucketCorsRequest $input
  1709. */
  1710. public function putBucketCors($input): Result
  1711. {
  1712. $input = PutBucketCorsRequest::create($input);
  1713. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'PutBucketCors', 'region' => $input->getRegion()]));
  1714. return new Result($response);
  1715. }
  1716. /**
  1717. * Enables notifications of specified events for a bucket. For more information about event notifications, see
  1718. * Configuring Event Notifications [^1].
  1719. *
  1720. * Using this API, you can replace an existing notification configuration. The configuration is an XML file that defines
  1721. * the event types that you want Amazon S3 to publish and the destination where you want Amazon S3 to publish an event
  1722. * notification when it detects an event of the specified type.
  1723. *
  1724. * By default, your bucket has no event notifications configured. That is, the notification configuration will be an
  1725. * empty `NotificationConfiguration`.
  1726. *
  1727. * `<NotificationConfiguration>`
  1728. *
  1729. * `</NotificationConfiguration>`
  1730. *
  1731. * This action replaces the existing notification configuration with the configuration you include in the request body.
  1732. *
  1733. * After Amazon S3 receives this request, it first verifies that any Amazon Simple Notification Service (Amazon SNS) or
  1734. * Amazon Simple Queue Service (Amazon SQS) destination exists, and that the bucket owner has permission to publish to
  1735. * it by sending a test notification. In the case of Lambda destinations, Amazon S3 verifies that the Lambda function
  1736. * permissions grant Amazon S3 permission to invoke the function from the Amazon S3 bucket. For more information, see
  1737. * Configuring Notifications for Amazon S3 Events [^2].
  1738. *
  1739. * You can disable notifications by adding the empty NotificationConfiguration element.
  1740. *
  1741. * For more information about the number of event notification configurations that you can create per bucket, see Amazon
  1742. * S3 service quotas [^3] in *Amazon Web Services General Reference*.
  1743. *
  1744. * By default, only the bucket owner can configure notifications on a bucket. However, bucket owners can use a bucket
  1745. * policy to grant permission to other users to set this configuration with the required `s3:PutBucketNotification`
  1746. * permission.
  1747. *
  1748. * > The PUT notification is an atomic operation. For example, suppose your notification configuration includes SNS
  1749. * > topic, SQS queue, and Lambda function configurations. When you send a PUT request with this configuration, Amazon
  1750. * > S3 sends test messages to your SNS topic. If the message fails, the entire PUT action will fail, and Amazon S3 will
  1751. * > not add the configuration to your bucket.
  1752. *
  1753. * If the configuration in the request body includes only one `TopicConfiguration` specifying only the
  1754. * `s3:ReducedRedundancyLostObject` event type, the response will also include the `x-amz-sns-test-message-id` header
  1755. * containing the message ID of the test notification sent to the topic.
  1756. *
  1757. * The following action is related to `PutBucketNotificationConfiguration`:
  1758. *
  1759. * - GetBucketNotificationConfiguration [^4]
  1760. *
  1761. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html
  1762. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html
  1763. * [^3]: https://docs.aws.amazon.com/general/latest/gr/s3.html#limits_s3
  1764. * [^4]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketNotificationConfiguration.html
  1765. *
  1766. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketNotificationConfiguration.html
  1767. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#putbucketnotificationconfiguration
  1768. *
  1769. * @param array{
  1770. * Bucket: string,
  1771. * NotificationConfiguration: NotificationConfiguration|array,
  1772. * ExpectedBucketOwner?: string,
  1773. * SkipDestinationValidation?: bool,
  1774. *
  1775. * @region?: string,
  1776. * }|PutBucketNotificationConfigurationRequest $input
  1777. */
  1778. public function putBucketNotificationConfiguration($input): Result
  1779. {
  1780. $input = PutBucketNotificationConfigurationRequest::create($input);
  1781. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'PutBucketNotificationConfiguration', 'region' => $input->getRegion()]));
  1782. return new Result($response);
  1783. }
  1784. /**
  1785. * Adds an object to a bucket. You must have WRITE permissions on a bucket to add an object to it.
  1786. *
  1787. * > Amazon S3 never adds partial objects; if you receive a success response, Amazon S3 added the entire object to the
  1788. * > bucket. You cannot use `PutObject` to only update a single piece of metadata for an existing object. You must put
  1789. * > the entire object with updated metadata if you want to update some values.
  1790. *
  1791. * Amazon S3 is a distributed system. If it receives multiple write requests for the same object simultaneously, it
  1792. * overwrites all but the last object written. To prevent objects from being deleted or overwritten, you can use Amazon
  1793. * S3 Object Lock [^1].
  1794. *
  1795. * To ensure that data is not corrupted traversing the network, use the `Content-MD5` header. When you use this header,
  1796. * Amazon S3 checks the object against the provided MD5 value and, if they do not match, returns an error. Additionally,
  1797. * you can calculate the MD5 while putting an object to Amazon S3 and compare the returned ETag to the calculated MD5
  1798. * value.
  1799. *
  1800. * > - To successfully complete the `PutObject` request, you must have the `s3:PutObject` in your IAM permissions.
  1801. * > - To successfully change the objects acl of your `PutObject` request, you must have the `s3:PutObjectAcl` in your
  1802. * > IAM permissions.
  1803. * > - To successfully set the tag-set with your `PutObject` request, you must have the `s3:PutObjectTagging` in your
  1804. * > IAM permissions.
  1805. * > - The `Content-MD5` header is required for any request to upload an object with a retention period configured using
  1806. * > Amazon S3 Object Lock. For more information about Amazon S3 Object Lock, see Amazon S3 Object Lock Overview [^2]
  1807. * > in the *Amazon S3 User Guide*.
  1808. * >
  1809. *
  1810. * You have four mutually exclusive options to protect data using server-side encryption in Amazon S3, depending on how
  1811. * you choose to manage the encryption keys. Specifically, the encryption key options are Amazon S3 managed keys
  1812. * (SSE-S3), Amazon Web Services KMS keys (SSE-KMS or DSSE-KMS), and customer-provided keys (SSE-C). Amazon S3 encrypts
  1813. * data with server-side encryption by using Amazon S3 managed keys (SSE-S3) by default. You can optionally tell Amazon
  1814. * S3 to encrypt data at rest by using server-side encryption with other key options. For more information, see Using
  1815. * Server-Side Encryption [^3].
  1816. *
  1817. * When adding a new object, you can use headers to grant ACL-based permissions to individual Amazon Web Services
  1818. * accounts or to predefined groups defined by Amazon S3. These permissions are then added to the ACL on the object. By
  1819. * default, all objects are private. Only the owner has full access control. For more information, see Access Control
  1820. * List (ACL) Overview [^4] and Managing ACLs Using the REST API [^5].
  1821. *
  1822. * If the bucket that you're uploading objects to uses the bucket owner enforced setting for S3 Object Ownership, ACLs
  1823. * are disabled and no longer affect permissions. Buckets that use this setting only accept PUT requests that don't
  1824. * specify an ACL or PUT requests that specify bucket owner full control ACLs, such as the `bucket-owner-full-control`
  1825. * canned ACL or an equivalent form of this ACL expressed in the XML format. PUT requests that contain other ACLs (for
  1826. * example, custom grants to certain Amazon Web Services accounts) fail and return a `400` error with the error code
  1827. * `AccessControlListNotSupported`. For more information, see Controlling ownership of objects and disabling ACLs [^6]
  1828. * in the *Amazon S3 User Guide*.
  1829. *
  1830. * > If your bucket uses the bucket owner enforced setting for Object Ownership, all objects written to the bucket by
  1831. * > any account will be owned by the bucket owner.
  1832. *
  1833. * By default, Amazon S3 uses the STANDARD Storage Class to store newly created objects. The STANDARD storage class
  1834. * provides high durability and high availability. Depending on performance needs, you can specify a different Storage
  1835. * Class. Amazon S3 on Outposts only uses the OUTPOSTS Storage Class. For more information, see Storage Classes [^7] in
  1836. * the *Amazon S3 User Guide*.
  1837. *
  1838. * If you enable versioning for a bucket, Amazon S3 automatically generates a unique version ID for the object being
  1839. * stored. Amazon S3 returns this ID in the response. When you enable versioning for a bucket, if Amazon S3 receives
  1840. * multiple write requests for the same object simultaneously, it stores all of the objects. For more information about
  1841. * versioning, see Adding Objects to Versioning-Enabled Buckets [^8]. For information about returning the versioning
  1842. * state of a bucket, see GetBucketVersioning [^9].
  1843. *
  1844. * For more information about related Amazon S3 APIs, see the following:
  1845. *
  1846. * - CopyObject [^10]
  1847. * - DeleteObject [^11]
  1848. *
  1849. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock.html
  1850. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock-overview.html
  1851. * [^3]: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingServerSideEncryption.html
  1852. * [^4]: https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html
  1853. * [^5]: https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-using-rest-api.html
  1854. * [^6]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html
  1855. * [^7]: https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html
  1856. * [^8]: https://docs.aws.amazon.com/AmazonS3/latest/dev/AddingObjectstoVersioningEnabledBuckets.html
  1857. * [^9]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketVersioning.html
  1858. * [^10]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CopyObject.html
  1859. * [^11]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html
  1860. *
  1861. * @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectPUT.html
  1862. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html
  1863. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#putobject
  1864. *
  1865. * @param array{
  1866. * ACL?: ObjectCannedACL::*,
  1867. * Body?: string|resource|callable|iterable,
  1868. * Bucket: string,
  1869. * CacheControl?: string,
  1870. * ContentDisposition?: string,
  1871. * ContentEncoding?: string,
  1872. * ContentLanguage?: string,
  1873. * ContentLength?: string,
  1874. * ContentMD5?: string,
  1875. * ContentType?: string,
  1876. * ChecksumAlgorithm?: ChecksumAlgorithm::*,
  1877. * ChecksumCRC32?: string,
  1878. * ChecksumCRC32C?: string,
  1879. * ChecksumSHA1?: string,
  1880. * ChecksumSHA256?: string,
  1881. * Expires?: \DateTimeImmutable|string,
  1882. * GrantFullControl?: string,
  1883. * GrantRead?: string,
  1884. * GrantReadACP?: string,
  1885. * GrantWriteACP?: string,
  1886. * Key: string,
  1887. * Metadata?: array<string, string>,
  1888. * ServerSideEncryption?: ServerSideEncryption::*,
  1889. * StorageClass?: StorageClass::*,
  1890. * WebsiteRedirectLocation?: string,
  1891. * SSECustomerAlgorithm?: string,
  1892. * SSECustomerKey?: string,
  1893. * SSECustomerKeyMD5?: string,
  1894. * SSEKMSKeyId?: string,
  1895. * SSEKMSEncryptionContext?: string,
  1896. * BucketKeyEnabled?: bool,
  1897. * RequestPayer?: RequestPayer::*,
  1898. * Tagging?: string,
  1899. * ObjectLockMode?: ObjectLockMode::*,
  1900. * ObjectLockRetainUntilDate?: \DateTimeImmutable|string,
  1901. * ObjectLockLegalHoldStatus?: ObjectLockLegalHoldStatus::*,
  1902. * ExpectedBucketOwner?: string,
  1903. *
  1904. * @region?: string,
  1905. * }|PutObjectRequest $input
  1906. */
  1907. public function putObject($input): PutObjectOutput
  1908. {
  1909. $input = PutObjectRequest::create($input);
  1910. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'PutObject', 'region' => $input->getRegion()]));
  1911. return new PutObjectOutput($response);
  1912. }
  1913. /**
  1914. * Uses the `acl` subresource to set the access control list (ACL) permissions for a new or existing object in an S3
  1915. * bucket. You must have `WRITE_ACP` permission to set the ACL of an object. For more information, see What permissions
  1916. * can I grant? [^1] in the *Amazon S3 User Guide*.
  1917. *
  1918. * This action is not supported by Amazon S3 on Outposts.
  1919. *
  1920. * Depending on your application needs, you can choose to set the ACL on an object using either the request body or the
  1921. * headers. For example, if you have an existing application that updates a bucket ACL using the request body, you can
  1922. * continue to use that approach. For more information, see Access Control List (ACL) Overview [^2] in the *Amazon S3
  1923. * User Guide*.
  1924. *
  1925. * ! If your bucket uses the bucket owner enforced setting for S3 Object Ownership, ACLs are disabled and no longer
  1926. * ! affect permissions. You must use policies to grant access to your bucket and the objects in it. Requests to set
  1927. * ! ACLs or update ACLs fail and return the `AccessControlListNotSupported` error code. Requests to read ACLs are still
  1928. * ! supported. For more information, see Controlling object ownership [^3] in the *Amazon S3 User Guide*.
  1929. *
  1930. * - `Permissions`:
  1931. *
  1932. * You can set access permissions using one of the following methods:
  1933. *
  1934. * - Specify a canned ACL with the `x-amz-acl` request header. Amazon S3 supports a set of predefined ACLs, known as
  1935. * canned ACLs. Each canned ACL has a predefined set of grantees and permissions. Specify the canned ACL name as the
  1936. * value of `x-amz-ac`l. If you use this header, you cannot use other access control-specific headers in your
  1937. * request. For more information, see Canned ACL [^4].
  1938. * - Specify access permissions explicitly with the `x-amz-grant-read`, `x-amz-grant-read-acp`,
  1939. * `x-amz-grant-write-acp`, and `x-amz-grant-full-control` headers. When using these headers, you specify explicit
  1940. * access permissions and grantees (Amazon Web Services accounts or Amazon S3 groups) who will receive the
  1941. * permission. If you use these ACL-specific headers, you cannot use `x-amz-acl` header to set a canned ACL. These
  1942. * parameters map to the set of permissions that Amazon S3 supports in an ACL. For more information, see Access
  1943. * Control List (ACL) Overview [^5].
  1944. *
  1945. * You specify each grantee as a type=value pair, where the type is one of the following:
  1946. *
  1947. * - `id` – if the value specified is the canonical user ID of an Amazon Web Services account
  1948. * - `uri` – if you are granting permissions to a predefined group
  1949. * - `emailAddress` – if the value specified is the email address of an Amazon Web Services account
  1950. *
  1951. * > Using email addresses to specify a grantee is only supported in the following Amazon Web Services Regions:
  1952. * >
  1953. * > - US East (N. Virginia)
  1954. * > - US West (N. California)
  1955. * > - US West (Oregon)
  1956. * > - Asia Pacific (Singapore)
  1957. * > - Asia Pacific (Sydney)
  1958. * > - Asia Pacific (Tokyo)
  1959. * > - Europe (Ireland)
  1960. * > - South America (São Paulo)
  1961. * >
  1962. * > For a list of all the Amazon S3 supported Regions and endpoints, see Regions and Endpoints [^6] in the Amazon
  1963. * > Web Services General Reference.
  1964. *
  1965. *
  1966. * For example, the following `x-amz-grant-read` header grants list objects permission to the two Amazon Web
  1967. * Services accounts identified by their email addresses.
  1968. *
  1969. * `x-amz-grant-read: emailAddress="xyz@amazon.com", emailAddress="abc@amazon.com" `
  1970. *
  1971. * You can use either a canned ACL or specify access permissions explicitly. You cannot do both.
  1972. * - `Grantee Values`:
  1973. *
  1974. * You can specify the person (grantee) to whom you're assigning access rights (using request elements) in the
  1975. * following ways:
  1976. *
  1977. * - By the person's ID:
  1978. *
  1979. * `<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  1980. * xsi:type="CanonicalUser"><ID><>ID<></ID><DisplayName><>GranteesEmail<></DisplayName>
  1981. * </Grantee>`
  1982. *
  1983. * DisplayName is optional and ignored in the request.
  1984. * - By URI:
  1985. *
  1986. * `<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  1987. * xsi:type="Group"><URI><>http://acs.amazonaws.com/groups/global/AuthenticatedUsers<></URI></Grantee>`
  1988. * - By Email address:
  1989. *
  1990. * `<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  1991. * xsi:type="AmazonCustomerByEmail"><EmailAddress><>Grantees@email.com<></EmailAddress>lt;/Grantee>`
  1992. *
  1993. * The grantee is resolved to the CanonicalUser and, in a response to a GET Object acl request, appears as the
  1994. * CanonicalUser.
  1995. *
  1996. * > Using email addresses to specify a grantee is only supported in the following Amazon Web Services Regions:
  1997. * >
  1998. * > - US East (N. Virginia)
  1999. * > - US West (N. California)
  2000. * > - US West (Oregon)
  2001. * > - Asia Pacific (Singapore)
  2002. * > - Asia Pacific (Sydney)
  2003. * > - Asia Pacific (Tokyo)
  2004. * > - Europe (Ireland)
  2005. * > - South America (São Paulo)
  2006. * >
  2007. * > For a list of all the Amazon S3 supported Regions and endpoints, see Regions and Endpoints [^7] in the Amazon
  2008. * > Web Services General Reference.
  2009. *
  2010. *
  2011. * - `Versioning`:
  2012. *
  2013. * The ACL of an object is set at the object version level. By default, PUT sets the ACL of the current version of an
  2014. * object. To set the ACL of a different version, use the `versionId` subresource.
  2015. *
  2016. * The following operations are related to `PutObjectAcl`:
  2017. *
  2018. * - CopyObject [^8]
  2019. * - GetObject [^9]
  2020. *
  2021. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#permissions
  2022. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html
  2023. * [^3]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html
  2024. * [^4]: https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL
  2025. * [^5]: https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html
  2026. * [^6]: https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
  2027. * [^7]: https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
  2028. * [^8]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CopyObject.html
  2029. * [^9]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html
  2030. *
  2031. * @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectPUTacl.html
  2032. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObjectAcl.html
  2033. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#putobjectacl
  2034. *
  2035. * @param array{
  2036. * ACL?: ObjectCannedACL::*,
  2037. * AccessControlPolicy?: AccessControlPolicy|array,
  2038. * Bucket: string,
  2039. * ContentMD5?: string,
  2040. * ChecksumAlgorithm?: ChecksumAlgorithm::*,
  2041. * GrantFullControl?: string,
  2042. * GrantRead?: string,
  2043. * GrantReadACP?: string,
  2044. * GrantWrite?: string,
  2045. * GrantWriteACP?: string,
  2046. * Key: string,
  2047. * RequestPayer?: RequestPayer::*,
  2048. * VersionId?: string,
  2049. * ExpectedBucketOwner?: string,
  2050. *
  2051. * @region?: string,
  2052. * }|PutObjectAclRequest $input
  2053. *
  2054. * @throws NoSuchKeyException
  2055. */
  2056. public function putObjectAcl($input): PutObjectAclOutput
  2057. {
  2058. $input = PutObjectAclRequest::create($input);
  2059. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'PutObjectAcl', 'region' => $input->getRegion(), 'exceptionMapping' => [
  2060. 'NoSuchKey' => NoSuchKeyException::class,
  2061. ]]));
  2062. return new PutObjectAclOutput($response);
  2063. }
  2064. /**
  2065. * Uploads a part in a multipart upload.
  2066. *
  2067. * > In this operation, you provide part data in your request. However, you have an option to specify your existing
  2068. * > Amazon S3 object as a data source for the part you are uploading. To upload a part from an existing object, you use
  2069. * > the UploadPartCopy [^1] operation.
  2070. *
  2071. * You must initiate a multipart upload (see CreateMultipartUpload [^2]) before you can upload any part. In response to
  2072. * your initiate request, Amazon S3 returns an upload ID, a unique identifier, that you must include in your upload part
  2073. * request.
  2074. *
  2075. * Part numbers can be any number from 1 to 10,000, inclusive. A part number uniquely identifies a part and also defines
  2076. * its position within the object being created. If you upload a new part using the same part number that was used with
  2077. * a previous part, the previously uploaded part is overwritten.
  2078. *
  2079. * For information about maximum and minimum part sizes and other multipart upload specifications, see Multipart upload
  2080. * limits [^3] in the *Amazon S3 User Guide*.
  2081. *
  2082. * To ensure that data is not corrupted when traversing the network, specify the `Content-MD5` header in the upload part
  2083. * request. Amazon S3 checks the part data against the provided MD5 value. If they do not match, Amazon S3 returns an
  2084. * error.
  2085. *
  2086. * If the upload request is signed with Signature Version 4, then Amazon Web Services S3 uses the `x-amz-content-sha256`
  2087. * header as a checksum instead of `Content-MD5`. For more information see Authenticating Requests: Using the
  2088. * Authorization Header (Amazon Web Services Signature Version 4) [^4].
  2089. *
  2090. * **Note:** After you initiate multipart upload and upload one or more parts, you must either complete or abort
  2091. * multipart upload in order to stop getting charged for storage of the uploaded parts. Only after you either complete
  2092. * or abort multipart upload, Amazon S3 frees up the parts storage and stops charging you for the parts storage.
  2093. *
  2094. * For more information on multipart uploads, go to Multipart Upload Overview [^5] in the *Amazon S3 User Guide *.
  2095. *
  2096. * For information on the permissions required to use the multipart upload API, go to Multipart Upload and Permissions
  2097. * [^6] in the *Amazon S3 User Guide*.
  2098. *
  2099. * Server-side encryption is for data encryption at rest. Amazon S3 encrypts your data as it writes it to disks in its
  2100. * data centers and decrypts it when you access it. You have three mutually exclusive options to protect data using
  2101. * server-side encryption in Amazon S3, depending on how you choose to manage the encryption keys. Specifically, the
  2102. * encryption key options are Amazon S3 managed keys (SSE-S3), Amazon Web Services KMS keys (SSE-KMS), and
  2103. * Customer-Provided Keys (SSE-C). Amazon S3 encrypts data with server-side encryption using Amazon S3 managed keys
  2104. * (SSE-S3) by default. You can optionally tell Amazon S3 to encrypt data at rest using server-side encryption with
  2105. * other key options. The option you use depends on whether you want to use KMS keys (SSE-KMS) or provide your own
  2106. * encryption key (SSE-C). If you choose to provide your own encryption key, the request headers you provide in the
  2107. * request must match the headers you used in the request to initiate the upload by using CreateMultipartUpload [^7].
  2108. * For more information, go to Using Server-Side Encryption [^8] in the *Amazon S3 User Guide*.
  2109. *
  2110. * Server-side encryption is supported by the S3 Multipart Upload actions. Unless you are using a customer-provided
  2111. * encryption key (SSE-C), you don't need to specify the encryption parameters in each UploadPart request. Instead, you
  2112. * only need to specify the server-side encryption parameters in the initial Initiate Multipart request. For more
  2113. * information, see CreateMultipartUpload [^9].
  2114. *
  2115. * If you requested server-side encryption using a customer-provided encryption key (SSE-C) in your initiate multipart
  2116. * upload request, you must provide identical encryption information in each part upload using the following headers.
  2117. *
  2118. * - x-amz-server-side-encryption-customer-algorithm
  2119. * - x-amz-server-side-encryption-customer-key
  2120. * - x-amz-server-side-encryption-customer-key-MD5
  2121. *
  2122. * `UploadPart` has the following special errors:
  2123. *
  2124. * - - *Code: NoSuchUpload*
  2125. * - - *Cause: The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload
  2126. * - might have been aborted or completed.*
  2127. * - - * HTTP Status Code: 404 Not Found *
  2128. * - - *SOAP Fault Code Prefix: Client*
  2129. * -
  2130. *
  2131. * The following operations are related to `UploadPart`:
  2132. *
  2133. * - CreateMultipartUpload [^10]
  2134. * - CompleteMultipartUpload [^11]
  2135. * - AbortMultipartUpload [^12]
  2136. * - ListParts [^13]
  2137. * - ListMultipartUploads [^14]
  2138. *
  2139. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPartCopy.html
  2140. * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html
  2141. * [^3]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/qfacts.html
  2142. * [^4]: https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-auth-using-authorization-header.html
  2143. * [^5]: https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html
  2144. * [^6]: https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html
  2145. * [^7]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html
  2146. * [^8]: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingServerSideEncryption.html
  2147. * [^9]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html
  2148. * [^10]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html
  2149. * [^11]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html
  2150. * [^12]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_AbortMultipartUpload.html
  2151. * [^13]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListParts.html
  2152. * [^14]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListMultipartUploads.html
  2153. *
  2154. * @see http://docs.amazonwebservices.com/AmazonS3/latest/API/mpUploadUploadPart.html
  2155. * @see https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html
  2156. * @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#uploadpart
  2157. *
  2158. * @param array{
  2159. * Body?: string|resource|callable|iterable,
  2160. * Bucket: string,
  2161. * ContentLength?: string,
  2162. * ContentMD5?: string,
  2163. * ChecksumAlgorithm?: ChecksumAlgorithm::*,
  2164. * ChecksumCRC32?: string,
  2165. * ChecksumCRC32C?: string,
  2166. * ChecksumSHA1?: string,
  2167. * ChecksumSHA256?: string,
  2168. * Key: string,
  2169. * PartNumber: int,
  2170. * UploadId: string,
  2171. * SSECustomerAlgorithm?: string,
  2172. * SSECustomerKey?: string,
  2173. * SSECustomerKeyMD5?: string,
  2174. * RequestPayer?: RequestPayer::*,
  2175. * ExpectedBucketOwner?: string,
  2176. *
  2177. * @region?: string,
  2178. * }|UploadPartRequest $input
  2179. */
  2180. public function uploadPart($input): UploadPartOutput
  2181. {
  2182. $input = UploadPartRequest::create($input);
  2183. $response = $this->getResponse($input->request(), new RequestContext(['operation' => 'UploadPart', 'region' => $input->getRegion()]));
  2184. return new UploadPartOutput($response);
  2185. }
  2186. protected function getAwsErrorFactory(): AwsErrorFactoryInterface
  2187. {
  2188. return new XmlAwsErrorFactory();
  2189. }
  2190. protected function getEndpoint(string $uri, array $query, ?string $region): string
  2191. {
  2192. $uriParts = explode('/', $uri, 3);
  2193. $bucket = explode('?', $uriParts[1] ?? '', 2)[0];
  2194. $uriWithOutBucket = substr($uriParts[1] ?? '', \strlen($bucket)) . ($uriParts[2] ?? '');
  2195. $bucketLen = \strlen($bucket);
  2196. $configuration = $this->getConfiguration();
  2197. if (
  2198. $bucketLen < 3 || $bucketLen > 63
  2199. || filter_var($bucket, \FILTER_VALIDATE_IP) // Cannot look like an IP address
  2200. || !preg_match('/^[a-z0-9]([a-z0-9\-]*[a-z0-9])?$/', $bucket) // Bucket cannot have dot (because of TLS)
  2201. || filter_var(parse_url($configuration->get('endpoint'), \PHP_URL_HOST), \FILTER_VALIDATE_IP) // Custom endpoint cannot look like an IP address @phpstan-ignore-line
  2202. || filter_var($configuration->get('pathStyleEndpoint'), \FILTER_VALIDATE_BOOLEAN)
  2203. ) {
  2204. return parent::getEndpoint($uri, $query, $region);
  2205. }
  2206. return preg_replace('|https?://|', '${0}' . $bucket . '.', parent::getEndpoint('/' . $uriWithOutBucket, $query, $region));
  2207. }
  2208. protected function getEndpointMetadata(?string $region): array
  2209. {
  2210. if (null === $region) {
  2211. return [
  2212. 'endpoint' => 'https://s3.amazonaws.com',
  2213. 'signRegion' => 'us-east-1',
  2214. 'signService' => 's3',
  2215. 'signVersions' => ['s3v4'],
  2216. ];
  2217. }
  2218. switch ($region) {
  2219. case 'af-south-1':
  2220. case 'ap-east-1':
  2221. case 'ap-northeast-1':
  2222. case 'ap-northeast-2':
  2223. case 'ap-northeast-3':
  2224. case 'ap-south-1':
  2225. case 'ap-south-2':
  2226. case 'ap-southeast-1':
  2227. case 'ap-southeast-2':
  2228. case 'ap-southeast-3':
  2229. case 'ap-southeast-4':
  2230. case 'ca-central-1':
  2231. case 'eu-central-1':
  2232. case 'eu-central-2':
  2233. case 'eu-north-1':
  2234. case 'eu-south-1':
  2235. case 'eu-south-2':
  2236. case 'eu-west-1':
  2237. case 'eu-west-2':
  2238. case 'eu-west-3':
  2239. case 'me-central-1':
  2240. case 'me-south-1':
  2241. case 'sa-east-1':
  2242. case 'us-east-1':
  2243. case 'us-east-2':
  2244. case 'us-gov-east-1':
  2245. case 'us-gov-west-1':
  2246. case 'us-west-1':
  2247. case 'us-west-2':
  2248. return [
  2249. 'endpoint' => "https://s3.$region.amazonaws.com",
  2250. 'signRegion' => $region,
  2251. 'signService' => 's3',
  2252. 'signVersions' => ['s3v4'],
  2253. ];
  2254. case 'cn-north-1':
  2255. case 'cn-northwest-1':
  2256. return [
  2257. 'endpoint' => "https://s3.$region.amazonaws.com.cn",
  2258. 'signRegion' => $region,
  2259. 'signService' => 's3',
  2260. 'signVersions' => ['s3v4'],
  2261. ];
  2262. case 's3-external-1':
  2263. return [
  2264. 'endpoint' => 'https://s3-external-1.amazonaws.com',
  2265. 'signRegion' => 'us-east-1',
  2266. 'signService' => 's3',
  2267. 'signVersions' => ['s3v4'],
  2268. ];
  2269. case 'fips-ca-central-1':
  2270. return [
  2271. 'endpoint' => 'https://s3-fips.ca-central-1.amazonaws.com',
  2272. 'signRegion' => 'ca-central-1',
  2273. 'signService' => 's3',
  2274. 'signVersions' => ['s3v4'],
  2275. ];
  2276. case 'fips-us-east-1':
  2277. return [
  2278. 'endpoint' => 'https://s3-fips.us-east-1.amazonaws.com',
  2279. 'signRegion' => 'us-east-1',
  2280. 'signService' => 's3',
  2281. 'signVersions' => ['s3v4'],
  2282. ];
  2283. case 'fips-us-east-2':
  2284. return [
  2285. 'endpoint' => 'https://s3-fips.us-east-2.amazonaws.com',
  2286. 'signRegion' => 'us-east-2',
  2287. 'signService' => 's3',
  2288. 'signVersions' => ['s3v4'],
  2289. ];
  2290. case 'fips-us-west-1':
  2291. return [
  2292. 'endpoint' => 'https://s3-fips.us-west-1.amazonaws.com',
  2293. 'signRegion' => 'us-west-1',
  2294. 'signService' => 's3',
  2295. 'signVersions' => ['s3v4'],
  2296. ];
  2297. case 'fips-us-west-2':
  2298. return [
  2299. 'endpoint' => 'https://s3-fips.us-west-2.amazonaws.com',
  2300. 'signRegion' => 'us-west-2',
  2301. 'signService' => 's3',
  2302. 'signVersions' => ['s3v4'],
  2303. ];
  2304. case 'fips-us-gov-east-1':
  2305. return [
  2306. 'endpoint' => 'https://s3-fips.us-gov-east-1.amazonaws.com',
  2307. 'signRegion' => 'us-gov-east-1',
  2308. 'signService' => 's3',
  2309. 'signVersions' => ['s3v4'],
  2310. ];
  2311. case 'fips-us-gov-west-1':
  2312. return [
  2313. 'endpoint' => 'https://s3-fips.us-gov-west-1.amazonaws.com',
  2314. 'signRegion' => 'us-gov-west-1',
  2315. 'signService' => 's3',
  2316. 'signVersions' => ['s3v4'],
  2317. ];
  2318. case 'us-iso-east-1':
  2319. case 'us-iso-west-1':
  2320. return [
  2321. 'endpoint' => "https://s3.$region.c2s.ic.gov",
  2322. 'signRegion' => $region,
  2323. 'signService' => 's3',
  2324. 'signVersions' => ['s3v4'],
  2325. ];
  2326. case 'us-isob-east-1':
  2327. return [
  2328. 'endpoint' => 'https://s3.us-isob-east-1.sc2s.sgov.gov',
  2329. 'signRegion' => 'us-isob-east-1',
  2330. 'signService' => 's3',
  2331. 'signVersions' => ['s3v4'],
  2332. ];
  2333. }
  2334. return [
  2335. 'endpoint' => 'https://s3.amazonaws.com',
  2336. 'signRegion' => 'us-east-1',
  2337. 'signService' => 's3',
  2338. 'signVersions' => ['s3v4'],
  2339. ];
  2340. }
  2341. protected function getServiceCode(): string
  2342. {
  2343. @trigger_error('Using the client with an old version of Core is deprecated. Run "composer update async-aws/core".', \E_USER_DEPRECATED);
  2344. return 's3';
  2345. }
  2346. protected function getSignatureScopeName(): string
  2347. {
  2348. @trigger_error('Using the client with an old version of Core is deprecated. Run "composer update async-aws/core".', \E_USER_DEPRECATED);
  2349. return 's3';
  2350. }
  2351. protected function getSignatureVersion(): string
  2352. {
  2353. @trigger_error('Using the client with an old version of Core is deprecated. Run "composer update async-aws/core".', \E_USER_DEPRECATED);
  2354. return 's3v4';
  2355. }
  2356. /**
  2357. * @return callable[]
  2358. */
  2359. protected function getSignerFactories(): array
  2360. {
  2361. return [
  2362. 's3v4' => function (string $service, string $region) {
  2363. $configuration = $this->getConfiguration();
  2364. $options = [];
  2365. // We need async-aws/core: 1.8 or above to use sendChunkedBody.
  2366. if (Configuration::optionExists('sendChunkedBody')) {
  2367. $options['sendChunkedBody'] = filter_var($configuration->get('sendChunkedBody'), \FILTER_VALIDATE_BOOLEAN);
  2368. }
  2369. return new SignerV4ForS3($service, $region, $options);
  2370. },
  2371. ] + parent::getSignerFactories();
  2372. }
  2373. }