| 1 |
<?php |
| 2 |
|
| 3 |
namespace Dudlewebs\WPMCS\s3\Aws\S3; |
| 4 |
|
| 5 |
use Dudlewebs\WPMCS\s3\Aws\Api\ApiProvider; |
| 6 |
use Dudlewebs\WPMCS\s3\Aws\Api\DocModel; |
| 7 |
use Dudlewebs\WPMCS\s3\Aws\Api\Service; |
| 8 |
use Dudlewebs\WPMCS\s3\Aws\AwsClient; |
| 9 |
use Dudlewebs\WPMCS\s3\Aws\CacheInterface; |
| 10 |
use Dudlewebs\WPMCS\s3\Aws\ClientResolver; |
| 11 |
use Dudlewebs\WPMCS\s3\Aws\Command; |
| 12 |
use Dudlewebs\WPMCS\s3\Aws\Exception\AwsException; |
| 13 |
use Dudlewebs\WPMCS\s3\Aws\HandlerList; |
| 14 |
use Dudlewebs\WPMCS\s3\Aws\InputValidationMiddleware; |
| 15 |
use Dudlewebs\WPMCS\s3\Aws\Middleware; |
| 16 |
use Dudlewebs\WPMCS\s3\Aws\Retry\QuotaManager; |
| 17 |
use Dudlewebs\WPMCS\s3\Aws\RetryMiddleware; |
| 18 |
use Dudlewebs\WPMCS\s3\Aws\ResultInterface; |
| 19 |
use Dudlewebs\WPMCS\s3\Aws\CommandInterface; |
| 20 |
use Dudlewebs\WPMCS\s3\Aws\RetryMiddlewareV2; |
| 21 |
use Dudlewebs\WPMCS\s3\Aws\S3\UseArnRegion\Configuration; |
| 22 |
use Dudlewebs\WPMCS\s3\Aws\S3\UseArnRegion\ConfigurationInterface; |
| 23 |
use Dudlewebs\WPMCS\s3\Aws\S3\UseArnRegion\ConfigurationProvider as UseArnRegionConfigurationProvider; |
| 24 |
use Dudlewebs\WPMCS\s3\Aws\S3\RegionalEndpoint\ConfigurationProvider; |
| 25 |
use Dudlewebs\WPMCS\s3\GuzzleHttp\Exception\RequestException; |
| 26 |
use Dudlewebs\WPMCS\s3\GuzzleHttp\Promise\Promise; |
| 27 |
use Dudlewebs\WPMCS\s3\GuzzleHttp\Promise\PromiseInterface; |
| 28 |
use Dudlewebs\WPMCS\s3\Psr\Http\Message\RequestInterface; |
| 29 |
/** |
| 30 |
* Client used to interact with **Amazon Simple Storage Service (Amazon S3)**. |
| 31 |
* |
| 32 |
* @method \Aws\Result abortMultipartUpload(array $args = []) |
| 33 |
* @method \GuzzleHttp\Promise\Promise abortMultipartUploadAsync(array $args = []) |
| 34 |
* @method \Aws\Result completeMultipartUpload(array $args = []) |
| 35 |
* @method \GuzzleHttp\Promise\Promise completeMultipartUploadAsync(array $args = []) |
| 36 |
* @method \Aws\Result copyObject(array $args = []) |
| 37 |
* @method \GuzzleHttp\Promise\Promise copyObjectAsync(array $args = []) |
| 38 |
* @method \Aws\Result createBucket(array $args = []) |
| 39 |
* @method \GuzzleHttp\Promise\Promise createBucketAsync(array $args = []) |
| 40 |
* @method \Aws\Result createMultipartUpload(array $args = []) |
| 41 |
* @method \GuzzleHttp\Promise\Promise createMultipartUploadAsync(array $args = []) |
| 42 |
* @method \Aws\Result deleteBucket(array $args = []) |
| 43 |
* @method \GuzzleHttp\Promise\Promise deleteBucketAsync(array $args = []) |
| 44 |
* @method \Aws\Result deleteBucketAnalyticsConfiguration(array $args = []) |
| 45 |
* @method \GuzzleHttp\Promise\Promise deleteBucketAnalyticsConfigurationAsync(array $args = []) |
| 46 |
* @method \Aws\Result deleteBucketCors(array $args = []) |
| 47 |
* @method \GuzzleHttp\Promise\Promise deleteBucketCorsAsync(array $args = []) |
| 48 |
* @method \Aws\Result deleteBucketEncryption(array $args = []) |
| 49 |
* @method \GuzzleHttp\Promise\Promise deleteBucketEncryptionAsync(array $args = []) |
| 50 |
* @method \Aws\Result deleteBucketIntelligentTieringConfiguration(array $args = []) |
| 51 |
* @method \GuzzleHttp\Promise\Promise deleteBucketIntelligentTieringConfigurationAsync(array $args = []) |
| 52 |
* @method \Aws\Result deleteBucketInventoryConfiguration(array $args = []) |
| 53 |
* @method \GuzzleHttp\Promise\Promise deleteBucketInventoryConfigurationAsync(array $args = []) |
| 54 |
* @method \Aws\Result deleteBucketLifecycle(array $args = []) |
| 55 |
* @method \GuzzleHttp\Promise\Promise deleteBucketLifecycleAsync(array $args = []) |
| 56 |
* @method \Aws\Result deleteBucketMetricsConfiguration(array $args = []) |
| 57 |
* @method \GuzzleHttp\Promise\Promise deleteBucketMetricsConfigurationAsync(array $args = []) |
| 58 |
* @method \Aws\Result deleteBucketOwnershipControls(array $args = []) |
| 59 |
* @method \GuzzleHttp\Promise\Promise deleteBucketOwnershipControlsAsync(array $args = []) |
| 60 |
* @method \Aws\Result deleteBucketPolicy(array $args = []) |
| 61 |
* @method \GuzzleHttp\Promise\Promise deleteBucketPolicyAsync(array $args = []) |
| 62 |
* @method \Aws\Result deleteBucketReplication(array $args = []) |
| 63 |
* @method \GuzzleHttp\Promise\Promise deleteBucketReplicationAsync(array $args = []) |
| 64 |
* @method \Aws\Result deleteBucketTagging(array $args = []) |
| 65 |
* @method \GuzzleHttp\Promise\Promise deleteBucketTaggingAsync(array $args = []) |
| 66 |
* @method \Aws\Result deleteBucketWebsite(array $args = []) |
| 67 |
* @method \GuzzleHttp\Promise\Promise deleteBucketWebsiteAsync(array $args = []) |
| 68 |
* @method \Aws\Result deleteObject(array $args = []) |
| 69 |
* @method \GuzzleHttp\Promise\Promise deleteObjectAsync(array $args = []) |
| 70 |
* @method \Aws\Result deleteObjectTagging(array $args = []) |
| 71 |
* @method \GuzzleHttp\Promise\Promise deleteObjectTaggingAsync(array $args = []) |
| 72 |
* @method \Aws\Result deleteObjects(array $args = []) |
| 73 |
* @method \GuzzleHttp\Promise\Promise deleteObjectsAsync(array $args = []) |
| 74 |
* @method \Aws\Result deletePublicAccessBlock(array $args = []) |
| 75 |
* @method \GuzzleHttp\Promise\Promise deletePublicAccessBlockAsync(array $args = []) |
| 76 |
* @method \Aws\Result getBucketAccelerateConfiguration(array $args = []) |
| 77 |
* @method \GuzzleHttp\Promise\Promise getBucketAccelerateConfigurationAsync(array $args = []) |
| 78 |
* @method \Aws\Result getBucketAcl(array $args = []) |
| 79 |
* @method \GuzzleHttp\Promise\Promise getBucketAclAsync(array $args = []) |
| 80 |
* @method \Aws\Result getBucketAnalyticsConfiguration(array $args = []) |
| 81 |
* @method \GuzzleHttp\Promise\Promise getBucketAnalyticsConfigurationAsync(array $args = []) |
| 82 |
* @method \Aws\Result getBucketCors(array $args = []) |
| 83 |
* @method \GuzzleHttp\Promise\Promise getBucketCorsAsync(array $args = []) |
| 84 |
* @method \Aws\Result getBucketEncryption(array $args = []) |
| 85 |
* @method \GuzzleHttp\Promise\Promise getBucketEncryptionAsync(array $args = []) |
| 86 |
* @method \Aws\Result getBucketIntelligentTieringConfiguration(array $args = []) |
| 87 |
* @method \GuzzleHttp\Promise\Promise getBucketIntelligentTieringConfigurationAsync(array $args = []) |
| 88 |
* @method \Aws\Result getBucketInventoryConfiguration(array $args = []) |
| 89 |
* @method \GuzzleHttp\Promise\Promise getBucketInventoryConfigurationAsync(array $args = []) |
| 90 |
* @method \Aws\Result getBucketLifecycle(array $args = []) |
| 91 |
* @method \GuzzleHttp\Promise\Promise getBucketLifecycleAsync(array $args = []) |
| 92 |
* @method \Aws\Result getBucketLifecycleConfiguration(array $args = []) |
| 93 |
* @method \GuzzleHttp\Promise\Promise getBucketLifecycleConfigurationAsync(array $args = []) |
| 94 |
* @method \Aws\Result getBucketLocation(array $args = []) |
| 95 |
* @method \GuzzleHttp\Promise\Promise getBucketLocationAsync(array $args = []) |
| 96 |
* @method \Aws\Result getBucketLogging(array $args = []) |
| 97 |
* @method \GuzzleHttp\Promise\Promise getBucketLoggingAsync(array $args = []) |
| 98 |
* @method \Aws\Result getBucketMetricsConfiguration(array $args = []) |
| 99 |
* @method \GuzzleHttp\Promise\Promise getBucketMetricsConfigurationAsync(array $args = []) |
| 100 |
* @method \Aws\Result getBucketNotification(array $args = []) |
| 101 |
* @method \GuzzleHttp\Promise\Promise getBucketNotificationAsync(array $args = []) |
| 102 |
* @method \Aws\Result getBucketNotificationConfiguration(array $args = []) |
| 103 |
* @method \GuzzleHttp\Promise\Promise getBucketNotificationConfigurationAsync(array $args = []) |
| 104 |
* @method \Aws\Result getBucketOwnershipControls(array $args = []) |
| 105 |
* @method \GuzzleHttp\Promise\Promise getBucketOwnershipControlsAsync(array $args = []) |
| 106 |
* @method \Aws\Result getBucketPolicy(array $args = []) |
| 107 |
* @method \GuzzleHttp\Promise\Promise getBucketPolicyAsync(array $args = []) |
| 108 |
* @method \Aws\Result getBucketPolicyStatus(array $args = []) |
| 109 |
* @method \GuzzleHttp\Promise\Promise getBucketPolicyStatusAsync(array $args = []) |
| 110 |
* @method \Aws\Result getBucketReplication(array $args = []) |
| 111 |
* @method \GuzzleHttp\Promise\Promise getBucketReplicationAsync(array $args = []) |
| 112 |
* @method \Aws\Result getBucketRequestPayment(array $args = []) |
| 113 |
* @method \GuzzleHttp\Promise\Promise getBucketRequestPaymentAsync(array $args = []) |
| 114 |
* @method \Aws\Result getBucketTagging(array $args = []) |
| 115 |
* @method \GuzzleHttp\Promise\Promise getBucketTaggingAsync(array $args = []) |
| 116 |
* @method \Aws\Result getBucketVersioning(array $args = []) |
| 117 |
* @method \GuzzleHttp\Promise\Promise getBucketVersioningAsync(array $args = []) |
| 118 |
* @method \Aws\Result getBucketWebsite(array $args = []) |
| 119 |
* @method \GuzzleHttp\Promise\Promise getBucketWebsiteAsync(array $args = []) |
| 120 |
* @method \Aws\Result getObject(array $args = []) |
| 121 |
* @method \GuzzleHttp\Promise\Promise getObjectAsync(array $args = []) |
| 122 |
* @method \Aws\Result getObjectAcl(array $args = []) |
| 123 |
* @method \GuzzleHttp\Promise\Promise getObjectAclAsync(array $args = []) |
| 124 |
* @method \Aws\Result getObjectAttributes(array $args = []) |
| 125 |
* @method \GuzzleHttp\Promise\Promise getObjectAttributesAsync(array $args = []) |
| 126 |
* @method \Aws\Result getObjectLegalHold(array $args = []) |
| 127 |
* @method \GuzzleHttp\Promise\Promise getObjectLegalHoldAsync(array $args = []) |
| 128 |
* @method \Aws\Result getObjectLockConfiguration(array $args = []) |
| 129 |
* @method \GuzzleHttp\Promise\Promise getObjectLockConfigurationAsync(array $args = []) |
| 130 |
* @method \Aws\Result getObjectRetention(array $args = []) |
| 131 |
* @method \GuzzleHttp\Promise\Promise getObjectRetentionAsync(array $args = []) |
| 132 |
* @method \Aws\Result getObjectTagging(array $args = []) |
| 133 |
* @method \GuzzleHttp\Promise\Promise getObjectTaggingAsync(array $args = []) |
| 134 |
* @method \Aws\Result getObjectTorrent(array $args = []) |
| 135 |
* @method \GuzzleHttp\Promise\Promise getObjectTorrentAsync(array $args = []) |
| 136 |
* @method \Aws\Result getPublicAccessBlock(array $args = []) |
| 137 |
* @method \GuzzleHttp\Promise\Promise getPublicAccessBlockAsync(array $args = []) |
| 138 |
* @method \Aws\Result headBucket(array $args = []) |
| 139 |
* @method \GuzzleHttp\Promise\Promise headBucketAsync(array $args = []) |
| 140 |
* @method \Aws\Result headObject(array $args = []) |
| 141 |
* @method \GuzzleHttp\Promise\Promise headObjectAsync(array $args = []) |
| 142 |
* @method \Aws\Result listBucketAnalyticsConfigurations(array $args = []) |
| 143 |
* @method \GuzzleHttp\Promise\Promise listBucketAnalyticsConfigurationsAsync(array $args = []) |
| 144 |
* @method \Aws\Result listBucketIntelligentTieringConfigurations(array $args = []) |
| 145 |
* @method \GuzzleHttp\Promise\Promise listBucketIntelligentTieringConfigurationsAsync(array $args = []) |
| 146 |
* @method \Aws\Result listBucketInventoryConfigurations(array $args = []) |
| 147 |
* @method \GuzzleHttp\Promise\Promise listBucketInventoryConfigurationsAsync(array $args = []) |
| 148 |
* @method \Aws\Result listBucketMetricsConfigurations(array $args = []) |
| 149 |
* @method \GuzzleHttp\Promise\Promise listBucketMetricsConfigurationsAsync(array $args = []) |
| 150 |
* @method \Aws\Result listBuckets(array $args = []) |
| 151 |
* @method \GuzzleHttp\Promise\Promise listBucketsAsync(array $args = []) |
| 152 |
* @method \Aws\Result listMultipartUploads(array $args = []) |
| 153 |
* @method \GuzzleHttp\Promise\Promise listMultipartUploadsAsync(array $args = []) |
| 154 |
* @method \Aws\Result listObjectVersions(array $args = []) |
| 155 |
* @method \GuzzleHttp\Promise\Promise listObjectVersionsAsync(array $args = []) |
| 156 |
* @method \Aws\Result listObjects(array $args = []) |
| 157 |
* @method \GuzzleHttp\Promise\Promise listObjectsAsync(array $args = []) |
| 158 |
* @method \Aws\Result listObjectsV2(array $args = []) |
| 159 |
* @method \GuzzleHttp\Promise\Promise listObjectsV2Async(array $args = []) |
| 160 |
* @method \Aws\Result listParts(array $args = []) |
| 161 |
* @method \GuzzleHttp\Promise\Promise listPartsAsync(array $args = []) |
| 162 |
* @method \Aws\Result putBucketAccelerateConfiguration(array $args = []) |
| 163 |
* @method \GuzzleHttp\Promise\Promise putBucketAccelerateConfigurationAsync(array $args = []) |
| 164 |
* @method \Aws\Result putBucketAcl(array $args = []) |
| 165 |
* @method \GuzzleHttp\Promise\Promise putBucketAclAsync(array $args = []) |
| 166 |
* @method \Aws\Result putBucketAnalyticsConfiguration(array $args = []) |
| 167 |
* @method \GuzzleHttp\Promise\Promise putBucketAnalyticsConfigurationAsync(array $args = []) |
| 168 |
* @method \Aws\Result putBucketCors(array $args = []) |
| 169 |
* @method \GuzzleHttp\Promise\Promise putBucketCorsAsync(array $args = []) |
| 170 |
* @method \Aws\Result putBucketEncryption(array $args = []) |
| 171 |
* @method \GuzzleHttp\Promise\Promise putBucketEncryptionAsync(array $args = []) |
| 172 |
* @method \Aws\Result putBucketIntelligentTieringConfiguration(array $args = []) |
| 173 |
* @method \GuzzleHttp\Promise\Promise putBucketIntelligentTieringConfigurationAsync(array $args = []) |
| 174 |
* @method \Aws\Result putBucketInventoryConfiguration(array $args = []) |
| 175 |
* @method \GuzzleHttp\Promise\Promise putBucketInventoryConfigurationAsync(array $args = []) |
| 176 |
* @method \Aws\Result putBucketLifecycle(array $args = []) |
| 177 |
* @method \GuzzleHttp\Promise\Promise putBucketLifecycleAsync(array $args = []) |
| 178 |
* @method \Aws\Result putBucketLifecycleConfiguration(array $args = []) |
| 179 |
* @method \GuzzleHttp\Promise\Promise putBucketLifecycleConfigurationAsync(array $args = []) |
| 180 |
* @method \Aws\Result putBucketLogging(array $args = []) |
| 181 |
* @method \GuzzleHttp\Promise\Promise putBucketLoggingAsync(array $args = []) |
| 182 |
* @method \Aws\Result putBucketMetricsConfiguration(array $args = []) |
| 183 |
* @method \GuzzleHttp\Promise\Promise putBucketMetricsConfigurationAsync(array $args = []) |
| 184 |
* @method \Aws\Result putBucketNotification(array $args = []) |
| 185 |
* @method \GuzzleHttp\Promise\Promise putBucketNotificationAsync(array $args = []) |
| 186 |
* @method \Aws\Result putBucketNotificationConfiguration(array $args = []) |
| 187 |
* @method \GuzzleHttp\Promise\Promise putBucketNotificationConfigurationAsync(array $args = []) |
| 188 |
* @method \Aws\Result putBucketOwnershipControls(array $args = []) |
| 189 |
* @method \GuzzleHttp\Promise\Promise putBucketOwnershipControlsAsync(array $args = []) |
| 190 |
* @method \Aws\Result putBucketPolicy(array $args = []) |
| 191 |
* @method \GuzzleHttp\Promise\Promise putBucketPolicyAsync(array $args = []) |
| 192 |
* @method \Aws\Result putBucketReplication(array $args = []) |
| 193 |
* @method \GuzzleHttp\Promise\Promise putBucketReplicationAsync(array $args = []) |
| 194 |
* @method \Aws\Result putBucketRequestPayment(array $args = []) |
| 195 |
* @method \GuzzleHttp\Promise\Promise putBucketRequestPaymentAsync(array $args = []) |
| 196 |
* @method \Aws\Result putBucketTagging(array $args = []) |
| 197 |
* @method \GuzzleHttp\Promise\Promise putBucketTaggingAsync(array $args = []) |
| 198 |
* @method \Aws\Result putBucketVersioning(array $args = []) |
| 199 |
* @method \GuzzleHttp\Promise\Promise putBucketVersioningAsync(array $args = []) |
| 200 |
* @method \Aws\Result putBucketWebsite(array $args = []) |
| 201 |
* @method \GuzzleHttp\Promise\Promise putBucketWebsiteAsync(array $args = []) |
| 202 |
* @method \Aws\Result putObject(array $args = []) |
| 203 |
* @method \GuzzleHttp\Promise\Promise putObjectAsync(array $args = []) |
| 204 |
* @method \Aws\Result putObjectAcl(array $args = []) |
| 205 |
* @method \GuzzleHttp\Promise\Promise putObjectAclAsync(array $args = []) |
| 206 |
* @method \Aws\Result putObjectLegalHold(array $args = []) |
| 207 |
* @method \GuzzleHttp\Promise\Promise putObjectLegalHoldAsync(array $args = []) |
| 208 |
* @method \Aws\Result putObjectLockConfiguration(array $args = []) |
| 209 |
* @method \GuzzleHttp\Promise\Promise putObjectLockConfigurationAsync(array $args = []) |
| 210 |
* @method \Aws\Result putObjectRetention(array $args = []) |
| 211 |
* @method \GuzzleHttp\Promise\Promise putObjectRetentionAsync(array $args = []) |
| 212 |
* @method \Aws\Result putObjectTagging(array $args = []) |
| 213 |
* @method \GuzzleHttp\Promise\Promise putObjectTaggingAsync(array $args = []) |
| 214 |
* @method \Aws\Result putPublicAccessBlock(array $args = []) |
| 215 |
* @method \GuzzleHttp\Promise\Promise putPublicAccessBlockAsync(array $args = []) |
| 216 |
* @method \Aws\Result restoreObject(array $args = []) |
| 217 |
* @method \GuzzleHttp\Promise\Promise restoreObjectAsync(array $args = []) |
| 218 |
* @method \Aws\Result selectObjectContent(array $args = []) |
| 219 |
* @method \GuzzleHttp\Promise\Promise selectObjectContentAsync(array $args = []) |
| 220 |
* @method \Aws\Result uploadPart(array $args = []) |
| 221 |
* @method \GuzzleHttp\Promise\Promise uploadPartAsync(array $args = []) |
| 222 |
* @method \Aws\Result uploadPartCopy(array $args = []) |
| 223 |
* @method \GuzzleHttp\Promise\Promise uploadPartCopyAsync(array $args = []) |
| 224 |
* @method \Aws\Result writeGetObjectResponse(array $args = []) |
| 225 |
* @method \GuzzleHttp\Promise\Promise writeGetObjectResponseAsync(array $args = []) |
| 226 |
*/ |
| 227 |
class S3Client extends AwsClient implements S3ClientInterface |
| 228 |
{ |
| 229 |
use S3ClientTrait; |
| 230 |
/** @var array */ |
| 231 |
private static $mandatoryAttributes = ['Bucket', 'Key']; |
| 232 |
public static function getArguments() |
| 233 |
{ |
| 234 |
$args = parent::getArguments(); |
| 235 |
$args['retries']['fn'] = [__CLASS__, '_applyRetryConfig']; |
| 236 |
$args['api_provider']['fn'] = [__CLASS__, '_applyApiProvider']; |
| 237 |
return $args + ['bucket_endpoint' => ['type' => 'config', 'valid' => ['bool'], 'doc' => 'Set to true to send requests to a hardcoded ' . 'bucket endpoint rather than create an endpoint as a ' . 'result of injecting the bucket into the URL. This ' . 'option is useful for interacting with CNAME endpoints.'], 'use_arn_region' => ['type' => 'config', 'valid' => ['bool', Configuration::class, CacheInterface::class, 'callable'], 'doc' => 'Set to true to allow passed in ARNs to override' . ' client region. Accepts...', 'fn' => [__CLASS__, '_apply_use_arn_region'], 'default' => [UseArnRegionConfigurationProvider::class, 'defaultProvider']], 'use_accelerate_endpoint' => ['type' => 'config', 'valid' => ['bool'], 'doc' => 'Set to true to send requests to an S3 Accelerate' . ' endpoint by default. Can be enabled or disabled on' . ' individual operations by setting' . ' \'@use_accelerate_endpoint\' to true or false. Note:' . ' you must enable S3 Accelerate on a bucket before it can' . ' be accessed via an Accelerate endpoint.', 'default' => \false], 'use_path_style_endpoint' => ['type' => 'config', 'valid' => ['bool'], 'doc' => 'Set to true to send requests to an S3 path style' . ' endpoint by default.' . ' Can be enabled or disabled on individual operations by setting' . ' \'@use_path_style_endpoint\' to true or false.', 'default' => \false], 'disable_multiregion_access_points' => ['type' => 'config', 'valid' => ['bool'], 'doc' => 'Set to true to disable the usage of' . ' multi region access points. These are enabled by default.' . ' Can be enabled or disabled on individual operations by setting' . ' \'@disable_multiregion_access_points\' to true or false.', 'default' => \false]]; |
| 238 |
} |
| 239 |
/** |
| 240 |
* {@inheritdoc} |
| 241 |
* |
| 242 |
* In addition to the options available to |
| 243 |
* {@see Aws\AwsClient::__construct}, S3Client accepts the following |
| 244 |
* options: |
| 245 |
* |
| 246 |
* - bucket_endpoint: (bool) Set to true to send requests to a |
| 247 |
* hardcoded bucket endpoint rather than create an endpoint as a result |
| 248 |
* of injecting the bucket into the URL. This option is useful for |
| 249 |
* interacting with CNAME endpoints. |
| 250 |
* - calculate_md5: (bool) Set to false to disable calculating an MD5 |
| 251 |
* for all Amazon S3 signed uploads. |
| 252 |
* - s3_us_east_1_regional_endpoint: |
| 253 |
* (Aws\S3\RegionalEndpoint\ConfigurationInterface|Aws\CacheInterface\|callable|string|array) |
| 254 |
* Specifies whether to use regional or legacy endpoints for the us-east-1 |
| 255 |
* region. Provide an Aws\S3\RegionalEndpoint\ConfigurationInterface object, an |
| 256 |
* instance of Aws\CacheInterface, a callable configuration provider used |
| 257 |
* to create endpoint configuration, a string value of `legacy` or |
| 258 |
* `regional`, or an associative array with the following keys: |
| 259 |
* endpoint_types: (string) Set to `legacy` or `regional`, defaults to |
| 260 |
* `legacy` |
| 261 |
* - use_accelerate_endpoint: (bool) Set to true to send requests to an S3 |
| 262 |
* Accelerate endpoint by default. Can be enabled or disabled on |
| 263 |
* individual operations by setting '@use_accelerate_endpoint' to true or |
| 264 |
* false. Note: you must enable S3 Accelerate on a bucket before it can be |
| 265 |
* accessed via an Accelerate endpoint. |
| 266 |
* - use_arn_region: (Aws\S3\UseArnRegion\ConfigurationInterface, |
| 267 |
* Aws\CacheInterface, bool, callable) Set to true to enable the client |
| 268 |
* to use the region from a supplied ARN argument instead of the client's |
| 269 |
* region. Provide an instance of Aws\S3\UseArnRegion\ConfigurationInterface, |
| 270 |
* an instance of Aws\CacheInterface, a callable that provides a promise for |
| 271 |
* a Configuration object, or a boolean value. Defaults to false (i.e. |
| 272 |
* the SDK will not follow the ARN region if it conflicts with the client |
| 273 |
* region and instead throw an error). |
| 274 |
* - use_dual_stack_endpoint: (bool) Set to true to send requests to an S3 |
| 275 |
* Dual Stack endpoint by default, which enables IPv6 Protocol. |
| 276 |
* Can be enabled or disabled on individual operations by setting |
| 277 |
* '@use_dual_stack_endpoint\' to true or false. Note: |
| 278 |
* you cannot use it together with an accelerate endpoint. |
| 279 |
* - use_path_style_endpoint: (bool) Set to true to send requests to an S3 |
| 280 |
* path style endpoint by default. |
| 281 |
* Can be enabled or disabled on individual operations by setting |
| 282 |
* '@use_path_style_endpoint\' to true or false. Note: |
| 283 |
* you cannot use it together with an accelerate endpoint. |
| 284 |
* - disable_multiregion_access_points: (bool) Set to true to disable |
| 285 |
* sending multi region requests. They are enabled by default. |
| 286 |
* Can be enabled or disabled on individual operations by setting |
| 287 |
* '@disable_multiregion_access_points\' to true or false. Note: |
| 288 |
* you cannot use it together with an accelerate or dualstack endpoint. |
| 289 |
* |
| 290 |
* @param array $args |
| 291 |
*/ |
| 292 |
public function __construct(array $args) |
| 293 |
{ |
| 294 |
if (!isset($args['s3_us_east_1_regional_endpoint']) || $args['s3_us_east_1_regional_endpoint'] instanceof CacheInterface) { |
| 295 |
$args['s3_us_east_1_regional_endpoint'] = ConfigurationProvider::defaultProvider($args); |
| 296 |
} |
| 297 |
parent::__construct($args); |
| 298 |
$stack = $this->getHandlerList(); |
| 299 |
$stack->appendInit(SSECMiddleware::wrap($this->getEndpoint()->getScheme()), 's3.ssec'); |
| 300 |
$stack->appendBuild(ApplyChecksumMiddleware::wrap($this->getApi()), 's3.checksum'); |
| 301 |
$stack->appendBuild(Middleware::contentType(['PutObject', 'UploadPart']), 's3.content_type'); |
| 302 |
// Use the bucket style middleware when using a "bucket_endpoint" (for cnames) |
| 303 |
if ($this->getConfig('bucket_endpoint')) { |
| 304 |
$stack->appendBuild(BucketEndpointMiddleware::wrap(), 's3.bucket_endpoint'); |
| 305 |
} else { |
| 306 |
$stack->appendBuild(S3EndpointMiddleware::wrap($this->getRegion(), $this->getConfig('endpoint_provider'), ['accelerate' => $this->getConfig('use_accelerate_endpoint'), 'path_style' => $this->getConfig('use_path_style_endpoint'), 'use_fips_endpoint' => $this->getConfig('use_fips_endpoint'), 'dual_stack' => $this->getConfig('use_dual_stack_endpoint')->isUseDualStackEndpoint()]), 's3.endpoint_middleware'); |
| 307 |
} |
| 308 |
$stack->appendBuild(BucketEndpointArnMiddleware::wrap($this->getApi(), $this->getRegion(), ['use_arn_region' => $this->getConfig('use_arn_region'), 'accelerate' => $this->getConfig('use_accelerate_endpoint'), 'path_style' => $this->getConfig('use_path_style_endpoint'), 'dual_stack' => $this->getConfig('use_dual_stack_endpoint')->isUseDualStackEndpoint(), 'use_fips_endpoint' => $this->getConfig('use_fips_endpoint'), 'disable_multiregion_access_points' => $this->getConfig('disable_multiregion_access_points'), 'endpoint' => isset($args['endpoint']) ? $args['endpoint'] : null]), 's3.bucket_endpoint_arn'); |
| 309 |
$stack->appendValidate(InputValidationMiddleware::wrap($this->getApi(), self::$mandatoryAttributes), 'input_validation_middleware'); |
| 310 |
$stack->appendSign(PutObjectUrlMiddleware::wrap(), 's3.put_object_url'); |
| 311 |
$stack->appendSign(PermanentRedirectMiddleware::wrap(), 's3.permanent_redirect'); |
| 312 |
$stack->appendInit(Middleware::sourceFile($this->getApi()), 's3.source_file'); |
| 313 |
$stack->appendInit($this->getSaveAsParameter(), 's3.save_as'); |
| 314 |
$stack->appendInit($this->getLocationConstraintMiddleware(), 's3.location'); |
| 315 |
$stack->appendInit($this->getEncodingTypeMiddleware(), 's3.auto_encode'); |
| 316 |
$stack->appendInit($this->getHeadObjectMiddleware(), 's3.head_object'); |
| 317 |
} |
| 318 |
/** |
| 319 |
* Determine if a string is a valid name for a DNS compatible Amazon S3 |
| 320 |
* bucket. |
| 321 |
* |
| 322 |
* DNS compatible bucket names can be used as a subdomain in a URL (e.g., |
| 323 |
* "<bucket>.s3.amazonaws.com"). |
| 324 |
* |
| 325 |
* @param string $bucket Bucket name to check. |
| 326 |
* |
| 327 |
* @return bool |
| 328 |
*/ |
| 329 |
public static function isBucketDnsCompatible($bucket) |
| 330 |
{ |
| 331 |
if (!\is_string($bucket)) { |
| 332 |
return \false; |
| 333 |
} |
| 334 |
$bucketLen = \strlen($bucket); |
| 335 |
return $bucketLen >= 3 && $bucketLen <= 63 && !\filter_var($bucket, \FILTER_VALIDATE_IP) && \preg_match('/^[a-z0-9]([a-z0-9\\-\\.]*[a-z0-9])?$/', $bucket); |
| 336 |
} |
| 337 |
public static function _apply_use_arn_region($value, array &$args, HandlerList $list) |
| 338 |
{ |
| 339 |
if ($value instanceof CacheInterface) { |
| 340 |
$value = UseArnRegionConfigurationProvider::defaultProvider($args); |
| 341 |
} |
| 342 |
if (\is_callable($value)) { |
| 343 |
$value = $value(); |
| 344 |
} |
| 345 |
if ($value instanceof PromiseInterface) { |
| 346 |
$value = $value->wait(); |
| 347 |
} |
| 348 |
if ($value instanceof ConfigurationInterface) { |
| 349 |
$args['use_arn_region'] = $value; |
| 350 |
} else { |
| 351 |
// The Configuration class itself will validate other inputs |
| 352 |
$args['use_arn_region'] = new Configuration($value); |
| 353 |
} |
| 354 |
} |
| 355 |
public function createPresignedRequest(CommandInterface $command, $expires, array $options = []) |
| 356 |
{ |
| 357 |
$command = clone $command; |
| 358 |
$command->getHandlerList()->remove('signer'); |
| 359 |
$request = \Dudlewebs\WPMCS\s3\Aws\serialize($command); |
| 360 |
$signing_name = $this->getSigningName($request->getUri()->getHost()); |
| 361 |
/** @var \Aws\Signature\SignatureInterface $signer */ |
| 362 |
$signer = \call_user_func($this->getSignatureProvider(), $this->getConfig('signature_version'), $signing_name, $this->getConfig('signing_region')); |
| 363 |
return $signer->presign($request, $this->getCredentials()->wait(), $expires, $options); |
| 364 |
} |
| 365 |
/** |
| 366 |
* Returns the URL to an object identified by its bucket and key. |
| 367 |
* |
| 368 |
* The URL returned by this method is not signed nor does it ensure that the |
| 369 |
* bucket and key given to the method exist. If you need a signed URL, then |
| 370 |
* use the {@see \Aws\S3\S3Client::createPresignedRequest} method and get |
| 371 |
* the URI of the signed request. |
| 372 |
* |
| 373 |
* @param string $bucket The name of the bucket where the object is located |
| 374 |
* @param string $key The key of the object |
| 375 |
* |
| 376 |
* @return string The URL to the object |
| 377 |
*/ |
| 378 |
public function getObjectUrl($bucket, $key) |
| 379 |
{ |
| 380 |
$command = $this->getCommand('GetObject', ['Bucket' => $bucket, 'Key' => $key]); |
| 381 |
return (string) \Dudlewebs\WPMCS\s3\Aws\serialize($command)->getUri(); |
| 382 |
} |
| 383 |
/** |
| 384 |
* Raw URL encode a key and allow for '/' characters |
| 385 |
* |
| 386 |
* @param string $key Key to encode |
| 387 |
* |
| 388 |
* @return string Returns the encoded key |
| 389 |
*/ |
| 390 |
public static function encodeKey($key) |
| 391 |
{ |
| 392 |
return \str_replace('%2F', '/', \rawurlencode($key)); |
| 393 |
} |
| 394 |
/** |
| 395 |
* Provides a middleware that removes the need to specify LocationConstraint on CreateBucket. |
| 396 |
* |
| 397 |
* @return \Closure |
| 398 |
*/ |
| 399 |
private function getLocationConstraintMiddleware() |
| 400 |
{ |
| 401 |
$region = $this->getRegion(); |
| 402 |
return static function (callable $handler) use($region) { |
| 403 |
return function (Command $command, $request = null) use($handler, $region) { |
| 404 |
if ($command->getName() === 'CreateBucket') { |
| 405 |
$locationConstraint = isset($command['CreateBucketConfiguration']['LocationConstraint']) ? $command['CreateBucketConfiguration']['LocationConstraint'] : null; |
| 406 |
if ($locationConstraint === 'us-east-1') { |
| 407 |
unset($command['CreateBucketConfiguration']); |
| 408 |
} elseif ('us-east-1' !== $region && empty($locationConstraint)) { |
| 409 |
$command['CreateBucketConfiguration'] = ['LocationConstraint' => $region]; |
| 410 |
} |
| 411 |
} |
| 412 |
return $handler($command, $request); |
| 413 |
}; |
| 414 |
}; |
| 415 |
} |
| 416 |
/** |
| 417 |
* Provides a middleware that supports the `SaveAs` parameter. |
| 418 |
* |
| 419 |
* @return \Closure |
| 420 |
*/ |
| 421 |
private function getSaveAsParameter() |
| 422 |
{ |
| 423 |
return static function (callable $handler) { |
| 424 |
return function (Command $command, $request = null) use($handler) { |
| 425 |
if ($command->getName() === 'GetObject' && isset($command['SaveAs'])) { |
| 426 |
$command['@http']['sink'] = $command['SaveAs']; |
| 427 |
unset($command['SaveAs']); |
| 428 |
} |
| 429 |
return $handler($command, $request); |
| 430 |
}; |
| 431 |
}; |
| 432 |
} |
| 433 |
/** |
| 434 |
* Provides a middleware that disables content decoding on HeadObject |
| 435 |
* commands. |
| 436 |
* |
| 437 |
* @return \Closure |
| 438 |
*/ |
| 439 |
private function getHeadObjectMiddleware() |
| 440 |
{ |
| 441 |
return static function (callable $handler) { |
| 442 |
return function (CommandInterface $command, RequestInterface $request = null) use($handler) { |
| 443 |
if ($command->getName() === 'HeadObject' && !isset($command['@http']['decode_content'])) { |
| 444 |
$command['@http']['decode_content'] = \false; |
| 445 |
} |
| 446 |
return $handler($command, $request); |
| 447 |
}; |
| 448 |
}; |
| 449 |
} |
| 450 |
/** |
| 451 |
* Provides a middleware that autopopulates the EncodingType parameter on |
| 452 |
* ListObjects commands. |
| 453 |
* |
| 454 |
* @return \Closure |
| 455 |
*/ |
| 456 |
private function getEncodingTypeMiddleware() |
| 457 |
{ |
| 458 |
return static function (callable $handler) { |
| 459 |
return function (Command $command, $request = null) use($handler) { |
| 460 |
$autoSet = \false; |
| 461 |
if ($command->getName() === 'ListObjects' && empty($command['EncodingType'])) { |
| 462 |
$command['EncodingType'] = 'url'; |
| 463 |
$autoSet = \true; |
| 464 |
} |
| 465 |
return $handler($command, $request)->then(function (ResultInterface $result) use($autoSet) { |
| 466 |
if ($result['EncodingType'] === 'url' && $autoSet) { |
| 467 |
static $topLevel = ['Delimiter', 'Marker', 'NextMarker', 'Prefix']; |
| 468 |
static $nested = [['Contents', 'Key'], ['CommonPrefixes', 'Prefix']]; |
| 469 |
foreach ($topLevel as $key) { |
| 470 |
if (isset($result[$key])) { |
| 471 |
$result[$key] = \urldecode($result[$key]); |
| 472 |
} |
| 473 |
} |
| 474 |
foreach ($nested as $steps) { |
| 475 |
if (isset($result[$steps[0]])) { |
| 476 |
foreach ($result[$steps[0]] as $key => $part) { |
| 477 |
if (isset($part[$steps[1]])) { |
| 478 |
$result[$steps[0]][$key][$steps[1]] = \urldecode($part[$steps[1]]); |
| 479 |
} |
| 480 |
} |
| 481 |
} |
| 482 |
} |
| 483 |
} |
| 484 |
return $result; |
| 485 |
}); |
| 486 |
}; |
| 487 |
}; |
| 488 |
} |
| 489 |
/** |
| 490 |
* Special handling for when the service name is s3-object-lambda. |
| 491 |
* So, if the host contains s3-object-lambda, then the service name |
| 492 |
* returned is s3-object-lambda, otherwise the default signing service is returned. |
| 493 |
* @param string $host The host to validate if is a s3-object-lambda URL. |
| 494 |
* @return string returns the signing service name to be used |
| 495 |
*/ |
| 496 |
private function getSigningName($host) |
| 497 |
{ |
| 498 |
if (\strpos($host, 's3-object-lambda')) { |
| 499 |
return 's3-object-lambda'; |
| 500 |
} |
| 501 |
return $this->getConfig('signing_name'); |
| 502 |
} |
| 503 |
/** @internal */ |
| 504 |
public static function _applyRetryConfig($value, $args, HandlerList $list) |
| 505 |
{ |
| 506 |
if ($value) { |
| 507 |
$config = \Dudlewebs\WPMCS\s3\Aws\Retry\ConfigurationProvider::unwrap($value); |
| 508 |
if ($config->getMode() === 'legacy') { |
| 509 |
$maxRetries = $config->getMaxAttempts() - 1; |
| 510 |
$decider = RetryMiddleware::createDefaultDecider($maxRetries); |
| 511 |
$decider = function ($retries, $command, $request, $result, $error) use($decider, $maxRetries) { |
| 512 |
$maxRetries = null !== $command['@retries'] ? $command['@retries'] : $maxRetries; |
| 513 |
if ($decider($retries, $command, $request, $result, $error)) { |
| 514 |
return \true; |
| 515 |
} |
| 516 |
if ($error instanceof AwsException && $retries < $maxRetries) { |
| 517 |
if ($error->getResponse() && $error->getResponse()->getStatusCode() >= 400) { |
| 518 |
return \strpos($error->getResponse()->getBody(), 'Your socket connection to the server') !== \false; |
| 519 |
} |
| 520 |
if ($error->getPrevious() instanceof RequestException) { |
| 521 |
// All commands except CompleteMultipartUpload are |
| 522 |
// idempotent and may be retried without worry if a |
| 523 |
// networking error has occurred. |
| 524 |
return $command->getName() !== 'CompleteMultipartUpload'; |
| 525 |
} |
| 526 |
} |
| 527 |
return \false; |
| 528 |
}; |
| 529 |
$delay = [RetryMiddleware::class, 'exponentialDelay']; |
| 530 |
$list->appendSign(Middleware::retry($decider, $delay), 'retry'); |
| 531 |
} else { |
| 532 |
$defaultDecider = RetryMiddlewareV2::createDefaultDecider(new QuotaManager(), $config->getMaxAttempts()); |
| 533 |
$list->appendSign(RetryMiddlewareV2::wrap($config, ['collect_stats' => $args['stats']['retries'], 'decider' => function ($attempts, CommandInterface $cmd, $result) use($defaultDecider, $config) { |
| 534 |
$isRetryable = $defaultDecider($attempts, $cmd, $result); |
| 535 |
if (!$isRetryable && $result instanceof AwsException && $attempts < $config->getMaxAttempts()) { |
| 536 |
if (!empty($result->getResponse()) && \strpos($result->getResponse()->getBody(), 'Your socket connection to the server') !== \false) { |
| 537 |
$isRetryable = \false; |
| 538 |
} |
| 539 |
if ($result->getPrevious() instanceof RequestException && $cmd->getName() !== 'CompleteMultipartUpload') { |
| 540 |
$isRetryable = \true; |
| 541 |
} |
| 542 |
} |
| 543 |
return $isRetryable; |
| 544 |
}]), 'retry'); |
| 545 |
} |
| 546 |
} |
| 547 |
} |
| 548 |
/** @internal */ |
| 549 |
public static function _applyApiProvider($value, array &$args, HandlerList $list) |
| 550 |
{ |
| 551 |
ClientResolver::_apply_api_provider($value, $args); |
| 552 |
$args['parser'] = new GetBucketLocationParser(new ValidateResponseChecksumParser(new AmbiguousSuccessParser(new RetryableMalformedResponseParser($args['parser'], $args['exception_class']), $args['error_parser'], $args['exception_class']), $args['api'])); |
| 553 |
} |
| 554 |
/** |
| 555 |
* @internal |
| 556 |
* @codeCoverageIgnore |
| 557 |
*/ |
| 558 |
public static function applyDocFilters(array $api, array $docs) |
| 559 |
{ |
| 560 |
$b64 = '<div class="alert alert-info">This value will be base64 encoded on your behalf.</div>'; |
| 561 |
$opt = '<div class="alert alert-info">This value will be computed for you it is not supplied.</div>'; |
| 562 |
// Add a note on the CopyObject docs |
| 563 |
$s3ExceptionRetryMessage = "<p>Additional info on response behavior: if there is" . " an internal error in S3 after the request was successfully recieved," . " a 200 response will be returned with an <code>S3Exception</code> embedded" . " in it; this will still be caught and retried by" . " <code>RetryMiddleware.</code></p>"; |
| 564 |
$docs['operations']['CopyObject'] .= $s3ExceptionRetryMessage; |
| 565 |
$docs['operations']['CompleteMultipartUpload'] .= $s3ExceptionRetryMessage; |
| 566 |
$docs['operations']['UploadPartCopy'] .= $s3ExceptionRetryMessage; |
| 567 |
$docs['operations']['UploadPart'] .= $s3ExceptionRetryMessage; |
| 568 |
// Add note about stream ownership in the putObject call |
| 569 |
$guzzleStreamMessage = "<p>Additional info on behavior of the stream" . " parameters: Psr7 takes ownership of streams and will automatically close" . " streams when this method is called with a stream as the <code>Body</code>" . " parameter. To prevent this, set the <code>Body</code> using" . " <code>GuzzleHttp\\Psr7\\stream_for</code> method with a is an instance of" . " <code>Psr\\Http\\Message\\StreamInterface</code>, and it will be returned" . " unmodified. This will allow you to keep the stream in scope. </p>"; |
| 570 |
$docs['operations']['PutObject'] .= $guzzleStreamMessage; |
| 571 |
// Add the SourceFile parameter. |
| 572 |
$docs['shapes']['SourceFile']['base'] = 'The path to a file on disk to use instead of the Body parameter.'; |
| 573 |
$api['shapes']['SourceFile'] = ['type' => 'string']; |
| 574 |
$api['shapes']['PutObjectRequest']['members']['SourceFile'] = ['shape' => 'SourceFile']; |
| 575 |
$api['shapes']['UploadPartRequest']['members']['SourceFile'] = ['shape' => 'SourceFile']; |
| 576 |
// Add the ContentSHA256 parameter. |
| 577 |
$docs['shapes']['ContentSHA256']['base'] = 'A SHA256 hash of the body content of the request.'; |
| 578 |
$api['shapes']['ContentSHA256'] = ['type' => 'string']; |
| 579 |
$api['shapes']['PutObjectRequest']['members']['ContentSHA256'] = ['shape' => 'ContentSHA256']; |
| 580 |
$api['shapes']['UploadPartRequest']['members']['ContentSHA256'] = ['shape' => 'ContentSHA256']; |
| 581 |
unset($api['shapes']['PutObjectRequest']['members']['ContentMD5']); |
| 582 |
unset($api['shapes']['UploadPartRequest']['members']['ContentMD5']); |
| 583 |
$docs['shapes']['ContentSHA256']['append'] = $opt; |
| 584 |
// Add the SaveAs parameter. |
| 585 |
$docs['shapes']['SaveAs']['base'] = 'The path to a file on disk to save the object data.'; |
| 586 |
$api['shapes']['SaveAs'] = ['type' => 'string']; |
| 587 |
$api['shapes']['GetObjectRequest']['members']['SaveAs'] = ['shape' => 'SaveAs']; |
| 588 |
// Several SSECustomerKey documentation updates. |
| 589 |
$docs['shapes']['SSECustomerKey']['append'] = $b64; |
| 590 |
$docs['shapes']['CopySourceSSECustomerKey']['append'] = $b64; |
| 591 |
$docs['shapes']['SSECustomerKeyMd5']['append'] = $opt; |
| 592 |
// Add the ObjectURL to various output shapes and documentation. |
| 593 |
$docs['shapes']['ObjectURL']['base'] = 'The URI of the created object.'; |
| 594 |
$api['shapes']['ObjectURL'] = ['type' => 'string']; |
| 595 |
$api['shapes']['PutObjectOutput']['members']['ObjectURL'] = ['shape' => 'ObjectURL']; |
| 596 |
$api['shapes']['CopyObjectOutput']['members']['ObjectURL'] = ['shape' => 'ObjectURL']; |
| 597 |
$api['shapes']['CompleteMultipartUploadOutput']['members']['ObjectURL'] = ['shape' => 'ObjectURL']; |
| 598 |
// Fix references to Location Constraint. |
| 599 |
unset($api['shapes']['CreateBucketRequest']['payload']); |
| 600 |
$api['shapes']['BucketLocationConstraint']['enum'] = ["ap-northeast-1", "ap-southeast-2", "ap-southeast-1", "cn-north-1", "eu-central-1", "eu-west-1", "us-east-1", "us-west-1", "us-west-2", "sa-east-1"]; |
| 601 |
// Add a note that the ContentMD5 is optional. |
| 602 |
$docs['shapes']['ContentMD5']['append'] = '<div class="alert alert-info">The value will be computed on ' . 'your behalf.</div>'; |
| 603 |
return [new Service($api, ApiProvider::defaultProvider()), new DocModel($docs)]; |
| 604 |
} |
| 605 |
/** |
| 606 |
* @internal |
| 607 |
* @codeCoverageIgnore |
| 608 |
*/ |
| 609 |
public static function addDocExamples($examples) |
| 610 |
{ |
| 611 |
$getObjectExample = ['input' => ['Bucket' => 'arn:aws:s3:us-east-1:123456789012:accesspoint:myaccesspoint', 'Key' => 'my-key'], 'output' => ['Body' => 'class GuzzleHttp\\Psr7\\Stream#208 (7) {...}', 'ContentLength' => '11', 'ContentType' => 'application/octet-stream'], 'comments' => ['input' => '', 'output' => 'Simplified example output'], 'description' => 'The following example retrieves an object by referencing the bucket via an S3 accesss point ARN. Result output is simplified for the example.', 'id' => '', 'title' => 'To get an object via an S3 access point ARN']; |
| 612 |
if (isset($examples['GetObject'])) { |
| 613 |
$examples['GetObject'][] = $getObjectExample; |
| 614 |
} else { |
| 615 |
$examples['GetObject'] = [$getObjectExample]; |
| 616 |
} |
| 617 |
$putObjectExample = ['input' => ['Bucket' => 'arn:aws:s3:us-east-1:123456789012:accesspoint:myaccesspoint', 'Key' => 'my-key', 'Body' => 'my-body'], 'output' => ['ObjectURL' => 'https://my-bucket.s3.us-east-1.amazonaws.com/my-key'], 'comments' => ['input' => '', 'output' => 'Simplified example output'], 'description' => 'The following example uploads an object by referencing the bucket via an S3 accesss point ARN. Result output is simplified for the example.', 'id' => '', 'title' => 'To upload an object via an S3 access point ARN']; |
| 618 |
if (isset($examples['PutObject'])) { |
| 619 |
$examples['PutObject'][] = $putObjectExample; |
| 620 |
} else { |
| 621 |
$examples['PutObject'] = [$putObjectExample]; |
| 622 |
} |
| 623 |
return $examples; |
| 624 |
} |
| 625 |
} |
| 626 |
|